aboutsummaryrefslogtreecommitdiff
path: root/src/Java
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java')
-rw-r--r--src/Java/gregtech/api/enums/TAE.java79
-rw-r--r--src/Java/gregtech/api/util/CustomRecipeMap.java2
-rw-r--r--src/Java/gregtech/api/util/Recipe_GT.java6
-rw-r--r--src/Java/gtPlusPlus/GTplusplus.java42
-rw-r--r--src/Java/gtPlusPlus/api/enums/ParticleNames.java37
-rw-r--r--src/Java/gtPlusPlus/api/objects/Logger.java36
-rw-r--r--src/Java/gtPlusPlus/api/objects/minecraft/multi/NoEUBonusMultiBehaviour.java27
-rw-r--r--src/Java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java4
-rw-r--r--src/Java/gtPlusPlus/api/objects/minecraft/multi/NoSpeedBonusMultiBehaviour.java27
-rw-r--r--src/Java/gtPlusPlus/australia/GTplusplus_Australia.java3
-rw-r--r--src/Java/gtPlusPlus/core/block/ModBlocks.java3
-rw-r--r--src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java65
-rw-r--r--src/Java/gtPlusPlus/core/common/CommonProxy.java18
-rw-r--r--src/Java/gtPlusPlus/core/config/ConfigHandler.java4
-rw-r--r--src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java2
-rw-r--r--src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java13
-rw-r--r--src/Java/gtPlusPlus/core/item/ModItems.java9
-rw-r--r--src/Java/gtPlusPlus/core/item/base/ore/BaseItemMilledOre.java25
-rw-r--r--src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java49
-rw-r--r--src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java17
-rw-r--r--src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java9
-rw-r--r--src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java451
-rw-r--r--src/Java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java113
-rw-r--r--src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java1107
-rw-r--r--src/Java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java5
-rw-r--r--src/Java/gtPlusPlus/core/item/food/BaseItemMetaFood.java431
-rw-r--r--src/Java/gtPlusPlus/core/item/general/ItemGiantEgg.java20
-rw-r--r--src/Java/gtPlusPlus/core/item/init/ItemsFoods.java43
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java6
-rw-r--r--src/Java/gtPlusPlus/core/lib/CORE.java9
-rw-r--r--src/Java/gtPlusPlus/core/material/Material.java4
-rw-r--r--src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java54
-rw-r--r--src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java136
-rw-r--r--src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java241
-rw-r--r--src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java16
-rw-r--r--src/Java/gtPlusPlus/core/recipe/common/CI.java158
-rw-r--r--src/Java/gtPlusPlus/core/util/Utils.java16
-rw-r--r--src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java4
-rw-r--r--src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java26
-rw-r--r--src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java18
-rw-r--r--src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java105
-rw-r--r--src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java9
-rw-r--r--src/Java/gtPlusPlus/core/util/minecraft/PlayerUtils.java8
-rw-r--r--src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java12
-rw-r--r--src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java41
-rw-r--r--src/Java/gtPlusPlus/core/util/sys/GeoUtils.java9
-rw-r--r--src/Java/gtPlusPlus/core/util/sys/NetworkUtils.java2
-rw-r--r--src/Java/gtPlusPlus/everglades/GTplusplus_Everglades.java9
-rw-r--r--src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java6
-rw-r--r--src/Java/gtPlusPlus/nei/GT_NEI_MillingMachine.java472
-rw-r--r--src/Java/gtPlusPlus/nei/NEI_GT_Config.java11
-rw-r--r--src/Java/gtPlusPlus/plugin/sulfurchem/Core_SulfuricChemistry.java4
-rw-r--r--src/Java/gtPlusPlus/preloader/CORE_Preloader.java25
-rw-r--r--src/Java/gtPlusPlus/preloader/DevHelper.java181
-rw-r--r--src/Java/gtPlusPlus/preloader/Preloader_Logger.java60
-rw-r--r--src/Java/gtPlusPlus/preloader/asm/AsmConfig.java38
-rw-r--r--src/Java/gtPlusPlus/preloader/asm/ClassesToTransform.java74
-rw-r--r--src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java43
-rw-r--r--src/Java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java38
-rw-r--r--src/Java/gtPlusPlus/preloader/asm/Preloader_SetupClass.java23
-rw-r--r--src/Java/gtPlusPlus/preloader/asm/helpers/MethodHelper_GT.java25
-rw-r--r--src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java3
-rw-r--r--src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BusPatch.java105
-rw-r--r--src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client.java13
-rw-r--r--src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_MetaGenerated_Tool.java116
-rw-r--r--src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Utility.java6
-rw-r--r--src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java352
-rw-r--r--src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java258
-rw-r--r--src/Java/gtPlusPlus/xmod/bartcrops/abstracts/BaseAestheticCrop.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/bartcrops/abstracts/BaseHarvestableCrop.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/bartcrops/crops/Crop_Hemp.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java15
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomOrePrefix.java112
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java35
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SteamCondenser.java7
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java6
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java11
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java6
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java5
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java11
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java52
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java81
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java77
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings.java97
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaTieredCasingBlocks1.java10
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java30
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java411
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java6
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java9
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java6
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java404
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java623
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java590
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java6
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java10
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java16
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java317
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java8
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java21
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java15
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java10
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java96
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java42
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java26
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java5
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFuelRefinery.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIsaMill.java14
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java6
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSemiFluidgenerators.java3
-rw-r--r--src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java4
-rw-r--r--src/Java/sun/repackage/AccessorGenerator.java715
-rw-r--r--src/Java/sun/repackage/BootstrapConstructorAccessorImpl.java52
-rw-r--r--src/Java/sun/repackage/ByteVector.java37
-rw-r--r--src/Java/sun/repackage/ByteVectorFactory.java36
-rw-r--r--src/Java/sun/repackage/ByteVectorImpl.java88
-rw-r--r--src/Java/sun/repackage/CallerSensitive.java41
-rw-r--r--src/Java/sun/repackage/ClassDefiner.java73
-rw-r--r--src/Java/sun/repackage/ClassFileAssembler.java671
-rw-r--r--src/Java/sun/repackage/ClassFileConstants.java140
-rw-r--r--src/Java/sun/repackage/ConstructorAccessor.java41
-rw-r--r--src/Java/sun/repackage/ConstructorAccessorImpl.java41
-rw-r--r--src/Java/sun/repackage/DelegatingConstructorAccessorImpl.java51
-rw-r--r--src/Java/sun/repackage/DelegatingMethodAccessorImpl.java49
-rw-r--r--src/Java/sun/repackage/FieldAccessor.java96
-rw-r--r--src/Java/sun/repackage/FieldAccessorImpl.java105
-rw-r--r--src/Java/sun/repackage/ForgeEnumHelper.java70
-rw-r--r--src/Java/sun/repackage/InstantiationExceptionConstructorAccessorImpl.java51
-rw-r--r--src/Java/sun/repackage/Label.java76
-rw-r--r--src/Java/sun/repackage/LangReflectAccess.java112
-rw-r--r--src/Java/sun/repackage/MagicAccessorImpl.java47
-rw-r--r--src/Java/sun/repackage/MethodAccessor.java40
-rw-r--r--src/Java/sun/repackage/MethodAccessorGenerator.java780
-rw-r--r--src/Java/sun/repackage/MethodAccessorImpl.java48
-rw-r--r--src/Java/sun/repackage/NativeConstructorAccessorImpl.java72
-rw-r--r--src/Java/sun/repackage/NativeMethodAccessorImpl.java69
-rw-r--r--src/Java/sun/repackage/PermissionFactory.java36
-rw-r--r--src/Java/sun/repackage/ReflectUtil.java338
-rw-r--r--src/Java/sun/repackage/Reflection.java361
-rw-r--r--src/Java/sun/repackage/ReflectionFactory.java706
-rw-r--r--src/Java/sun/repackage/SecurityConstants.java227
-rw-r--r--src/Java/sun/repackage/SerializationConstructorAccessorImpl.java45
-rw-r--r--src/Java/sun/repackage/UTF8.java76
-rw-r--r--src/Java/sun/repackage/Unsafe.java1146
-rw-r--r--src/Java/sun/repackage/UnsafeFieldAccessorFactory.java4446
-rw-r--r--src/Java/sun/repackage/UnsafeFieldAccessorImpl.java205
-rw-r--r--src/Java/sun/repackage/UnsafeQualifiedFieldAccessorImpl.java50
-rw-r--r--src/Java/sun/repackage/UnsafeQualifiedStaticFieldAccessorImpl.java42
-rw-r--r--src/Java/sun/repackage/UnsafeStaticFieldAccessorImpl.java49
151 files changed, 17845 insertions, 2091 deletions
diff --git a/src/Java/gregtech/api/enums/TAE.java b/src/Java/gregtech/api/enums/TAE.java
index 2827704f62..d7e16feb09 100644
--- a/src/Java/gregtech/api/enums/TAE.java
+++ b/src/Java/gregtech/api/enums/TAE.java
@@ -1,10 +1,14 @@
package gregtech.api.enums;
import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.HashSet;
import gregtech.api.interfaces.ITexture;
import gregtech.api.objects.GT_CopiedBlockTexture;
import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
@@ -13,40 +17,65 @@ public class TAE {
//TAE stands for Texture Array Expansion.
- public static int gtTexturesArrayStartOrigin;
public static int gtPPLastUsedIndex = 64;
public static int secondaryIndex = 0;
- public static boolean hasArrayBeenExpanded = false;
+
+ public static HashMap<Integer, GT_CopiedBlockTexture> mTAE = new HashMap<Integer, GT_CopiedBlockTexture>();
+ private static final HashSet<Integer> mFreeSlots = new HashSet<Integer>(64);
+
+ static {
+ for (int i=64;i<128;i++) {
+ mFreeSlots.add(i);
+ }
+ Logger.INFO("Initialising TAE.");
+ }
- public static boolean hookGtTextures() {
- /*ITexture[] textureArrayDump = Textures.BlockIcons.CASING_BLOCKS;
- ITexture[] newTextureArray = new ITexture[1024];
- Utils.LOG_INFO("|======| Texture Array Start Length: "+textureArrayDump.length+" |======|");
- for (int r=0;r<textureArrayDump.length;r++){
- if (textureArrayDump[r] == null){
- Utils.LOG_WARNING("Texture slot "+r+" is empty.");
+ /**
+ *
+ * @param aPage - The Texture page (0-3)
+ * @param aID - The ID on the specified page (0-15)
+ * @param gt_CopiedBlockTexture - The Texture to register
+ * @return - Did it register correctly?
+ */
+ public static boolean registerTexture(int aPage, int aID, GT_CopiedBlockTexture gt_CopiedBlockTexture) {
+ int aRealID = aID + (aPage * 16);
+ return registerTexture(64 + aRealID, gt_CopiedBlockTexture);
+ }
+
+ private static boolean registerTexture(int aID, GT_CopiedBlockTexture gt_CopiedBlockTexture) {
+ if (mFreeSlots.contains(aID)) {
+ mFreeSlots.remove(aID);
+ mTAE.put(aID, gt_CopiedBlockTexture);
+ return true;
+ }
+ else {
+ CORE.crash("Tried to register texture with ID "+aID+" to TAE, but it is already in use.");
+ return false; // Dead Code
+ }
+ }
+
+ public static void finalizeTAE() {
+ String aFreeSpaces = "";
+ AutoMap<Integer> aTemp = new AutoMap<Integer>(mFreeSlots);
+ for (int i = 0; i < mFreeSlots.size() ; i++) {
+ aFreeSpaces += aTemp.get(i);
+ if (i != (mFreeSlots.size() - 1)) {
+ aFreeSpaces += ", ";
}
}
- gtTexturesArrayStartOrigin = textureArrayDump.length;
- System.arraycopy(textureArrayDump, 0, newTextureArray, 0, textureArrayDump.length);
- Textures.BlockIcons.CASING_BLOCKS = newTextureArray;
- if (Textures.BlockIcons.CASING_BLOCKS.length == 1024){
- hasArrayBeenExpanded = true;
+ Logger.INFO("Free Indexes within TAE: "+aFreeSpaces);
+ Logger.INFO("Filling them with ERROR textures.");
+ for (int aFreeSlot : aTemp.values()) {
+ registerTexture(aFreeSlot, new GT_CopiedBlockTexture(ModBlocks.blockCasingsTieredGTPP, 1, 15));
}
- else {
- hasArrayBeenExpanded = false;
+ Logger.INFO("Finalising TAE.");
+ for (int aKeyTae : mTAE.keySet()) {
+ Textures.BlockIcons.CASING_BLOCKS[aKeyTae] = mTAE.get(aKeyTae);
}
- return hasArrayBeenExpanded;*/
- return true;
+ Logger.INFO("Finalised TAE.");
}
- /*public static boolean registerTextures(GT_RenderedTexture textureToRegister) {
- Textures.BlockIcons.CASING_BLOCKS[gtPPLastUsedIndex] = textureToRegister;
- //Just so I know registration is done.
- return true;
- }*/
-
- public static boolean registerTextures(GT_CopiedBlockTexture gt_CopiedBlockTexture) {
+ private static boolean registerTextures(GT_CopiedBlockTexture gt_CopiedBlockTexture) {
try {
//Handle page 2.
Logger.INFO("[TAE} Registering Texture, Last used casing ID is "+gtPPLastUsedIndex+".");
diff --git a/src/Java/gregtech/api/util/CustomRecipeMap.java b/src/Java/gregtech/api/util/CustomRecipeMap.java
index a39050b4e0..ba0ab3dd29 100644
--- a/src/Java/gregtech/api/util/CustomRecipeMap.java
+++ b/src/Java/gregtech/api/util/CustomRecipeMap.java
@@ -22,7 +22,7 @@ public class CustomRecipeMap/* extends GT_Recipe_Map*/{
//public static final CustomRecipeMap sOreWasherRecipes = new GT_Recipe_Map_OreWasher(new HashSet<GT_Recipe>(0), "ic.recipe.orewasher", "Ore Washer", "ic2.blockOreWashingPlant", RES_PATH_GUI + "basicmachines/OreWasher", 1, 3, 1, 1, 1, E, 1, E, true, false);
//Fission Fuel Plant Recipes
- public static final CustomRecipeMap sFissionFuelProcessing = new CustomRecipeMap(new HashSet<GT_Recipe>(50), "gt.recipe.fissionfuel", "Fission Fuel Processing", null, RES_PATH_GUI + "basicmachines/FissionFuel", 0, 0, 0, 4, 1, E, 1, E, true, true);
+ public static final CustomRecipeMap sFissionFuelProcessing = new CustomRecipeMap(new HashSet<GT_Recipe>(50), "gt.recipe.fissionfuel", "Nuclear Fuel Processing", null, RES_PATH_GUI + "basicmachines/FissionFuel", 0, 0, 0, 4, 1, E, 1, E, true, true);
public static final CustomRecipeMap mMultiWireMill = new CustomRecipeMap(new HashSet<GT_Recipe>(500), "gt.recipe.multi.wiremill", "Multiblock Wiremill", null, RES_PATH_GUI + "basicmachines/FissionFuel", 1, 1, 0, 0, 1, E, 1, E, true, true);
diff --git a/src/Java/gregtech/api/util/Recipe_GT.java b/src/Java/gregtech/api/util/Recipe_GT.java
index bfe05d33e7..3ddb25e754 100644
--- a/src/Java/gregtech/api/util/Recipe_GT.java
+++ b/src/Java/gregtech/api/util/Recipe_GT.java
@@ -14,6 +14,7 @@ import gregtech.api.objects.GT_ItemStack;
import gregtech.api.objects.ItemData;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map_Fuel;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map_Macerator;
import gtPlusPlus.api.interfaces.IComparableRecipe;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
@@ -248,7 +249,7 @@ public class Recipe_GT extends GT_Recipe implements IComparableRecipe{
public static final GT_Recipe_Map sGeoThermalFuels = new GT_Recipe_Map(new HashSet<GT_Recipe>(10), "gt.recipe.geothermalfuel", "GeoThermal Fuel", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true);
public static final GT_Recipe_Map sChemicalDehydratorRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(200), "gt.recipe.chemicaldehydrator", "Chemical Dehydrator", null, RES_PATH_GUI + "basicmachines/Dehydrator", 2, 9, 0, 0, 1, E, 1, E, true, true);
- public static final GT_Recipe_Map sVacuumFurnaceRecipes = new GT_Recipe_Map(new HashSet(500), "gt.recipe.vacfurnace", "Vacuum Furnace", null, "gregtech:textures/gui/basicmachines/Default", 2, 2, 1, 0, 1, "Heat Capacity: ", 1, " K", false, true);
+ public static final GT_Recipe_Map sVacuumFurnaceRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(500), "gt.recipe.vacfurnace", "Vacuum Furnace", null, "gregtech:textures/gui/basicmachines/Default", 2, 2, 1, 0, 1, "Heat Capacity: ", 1, " K", false, true);
public static final GT_Recipe_Map sAlloyBlastSmelterRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(200), "gt.recipe.alloyblastsmelter", "Alloy Blast Smelter", null, RES_PATH_GUI + "basicmachines/BlastSmelter", 9, 9, 1, 0, 1, E, 1, E, true, true);
public static final GT_Recipe_Map sSteamTurbineFuels = new GT_Recipe_Map(new HashSet<GT_Recipe>(10), "gt.recipe.geothermalfuel", "GeoThermal Fuel", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true);
@@ -256,6 +257,9 @@ public class Recipe_GT extends GT_Recipe implements IComparableRecipe{
public static final GT_Recipe_Map sLiquidFluorineThoriumReactorRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(50), "gt.recipe.lftr", "Liquid Fluoride Thorium Reactor", null, RES_PATH_GUI + "basicmachines/LFTR", 0, 0, 0, 2, 1, "Start: ", 1, " EU", true, true);
public static final GT_Recipe_Map sLiquidFluorineThoriumReactorRecipesEx = new GT_Recipe_Map(new NoConflictGTRecipeMap(), "gt.recipe.lftr.2", "Liquid Fluoride Thorium Reactor", null, RES_PATH_GUI + "basicmachines/LFTR", 0, 0, 0, 2, 1, "Start: ", 1, " EU", true, true);
+ // Ore Milling Map
+ public static final GT_Recipe_Map sOreMillRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(10000), "gt.recipe.oremill", "Milling", null, RES_PATH_GUI + "basicmachines/LFTR", 3, 4, 1, 0, 1, E, 1, E, true, true);
+
//Fission Fuel Plant Recipes
//public static final GT_Recipe_Map sFissionFuelProcessing = new GT_Recipe_Map(new HashSet<GT_Recipe>(50), "gt.recipe.fissionfuel", "Fission Fuel Processing", null, RES_PATH_GUI + "basicmachines/LFTR", 0, 0, 0, 9, 1, E, 1, E, true, true);
diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java
index 6f734db111..0e70baf524 100644
--- a/src/Java/gtPlusPlus/GTplusplus.java
+++ b/src/Java/gtPlusPlus/GTplusplus.java
@@ -43,7 +43,6 @@ import gtPlusPlus.core.handler.events.MissingMappingsEvent;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.lib.LoadedMods;
import gtPlusPlus.core.material.Material;
-import gtPlusPlus.core.material.nuclear.FLUORIDES;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.data.LocaleUtils;
import gtPlusPlus.core.util.minecraft.HazmatUtils;
@@ -65,7 +64,6 @@ import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechMiniRaFusion;
import gtPlusPlus.xmod.thaumcraft.commands.CommandDumpAspects;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.util.IIcon;
-import net.minecraftforge.oredict.OreDictionary;
@MCVersion(value = "1.7.10")
@Mod(modid = CORE.MODID, name = CORE.name, version = CORE.VERSION, dependencies = "required-after:Forge; after:TConstruct; after:PlayerAPI; after:dreamcraft; after:IC2; after:ihl; after:psychedelicraft; after:gregtech; after:Forestry; after:MagicBees; after:CoFHCore; after:Growthcraft; after:Railcraft; after:CompactWindmills; after:ForbiddenMagic; after:MorePlanet; after:PneumaticCraft; after:ExtraUtilities; after:Thaumcraft; after:rftools; after:simplyjetpacks; after:BigReactors; after:EnderIO; after:tectech; after:GTRedtech; after:beyondrealitycore; after:OpenBlocks; after:IC2NuclearControl; after:TGregworks; after:StevesCarts; after:xreliquary;")
@@ -80,11 +78,11 @@ public class GTplusplus implements ActionListener {
STARTED(SERVER_START);
protected boolean mIsPhaseActive = false;
private final INIT_PHASE mPrev;
-
+
private INIT_PHASE(INIT_PHASE aPreviousPhase) {
mPrev = aPreviousPhase;
}
-
+
public synchronized final boolean isPhaseActive() {
return mIsPhaseActive;
}
@@ -98,9 +96,9 @@ public class GTplusplus implements ActionListener {
}
}
}
-
+
public static INIT_PHASE CURRENT_LOAD_PHASE = INIT_PHASE.SUPER;
-
+
//Mod Instance
@Mod.Instance(CORE.MODID)
public static GTplusplus instance;
@@ -129,7 +127,7 @@ public class GTplusplus implements ActionListener {
// Blocks
Logger.WARNING("Processing texture: " + TexturesGtBlock.Casing_Machine_Dimensional.getTextureFile().getResourcePath());
}
-
+
public GTplusplus() {
super();
INIT_PHASE.SUPER.setPhaseActive(true);
@@ -153,8 +151,10 @@ public class GTplusplus implements ActionListener {
//setupMaterialWhitelist();
//HTTP Requests
- CORE.MASTER_VERSION = NetworkUtils.getContentFromURL("https://raw.githubusercontent.com/draknyte1/GTplusplus/master/Recommended.txt").toLowerCase();
- CORE.USER_COUNTRY = GeoUtils.determineUsersCountry();
+ if (CORE.ConfigSwitches.enableUpdateChecker) {
+ CORE.MASTER_VERSION = NetworkUtils.getContentFromURL("https://raw.githubusercontent.com/draknyte1/GTplusplus/master/Recommended.txt").toLowerCase();
+ CORE.USER_COUNTRY = GeoUtils.determineUsersCountry();
+ }
// Handle GT++ Config
ConfigHandler.handleConfigFile(event);
@@ -204,11 +204,7 @@ public class GTplusplus implements ActionListener {
Core_Manager.postInit();
//SprinklerHandler.registerModFerts();
- //Set Variables for Fluorite Block handling
- Logger.INFO("Setting some Variables for the block break event handler.");
- BlockEventHandler.oreLimestone = OreDictionary.getOres("oreLimestone");
- BlockEventHandler.blockLimestone = OreDictionary.getOres("limestone");
- BlockEventHandler.fluoriteOre = FLUORIDES.FLUORITE.getOre(1);
+ BlockEventHandler.init();
Logger.INFO("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
Logger.INFO("| Recipes succesfully Loaded: " + RegistrationHandler.recipesSuccess + " | Failed: "
@@ -220,8 +216,8 @@ public class GTplusplus implements ActionListener {
@EventHandler
public synchronized void serverStarting(final FMLServerStartingEvent event) {
INIT_PHASE.SERVER_START.setPhaseActive(true);
- event.registerServerCommand(new CommandMath());
- event.registerServerCommand(new CommandEnableDebugWhileRunning());
+ event.registerServerCommand(new CommandMath());
+ event.registerServerCommand(new CommandEnableDebugWhileRunning());
event.registerServerCommand(new CommandDebugChunks());
if (LoadedMods.Thaumcraft) {
event.registerServerCommand(new CommandDumpAspects());
@@ -242,7 +238,7 @@ public class GTplusplus implements ActionListener {
}
SystemUtils.invokeGC();
}
-
+
}
@Override
@@ -281,7 +277,7 @@ public class GTplusplus implements ActionListener {
}
}
}
-
+
protected void generateGregtechRecipeMaps() {
int[] mValidCount = new int[] {0, 0, 0};
@@ -324,7 +320,7 @@ public class GTplusplus implements ActionListener {
Recipe_GT.Gregtech_Recipe_Map.sMultiblockCentrifugeRecipes_GT.add(a);
}
}
-
+
//Large Electrolyzer generation
mOriginalCount[1] = GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes.mRecipeList.size();
for (GT_Recipe x : GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes.mRecipeList) {
@@ -349,7 +345,7 @@ public class GTplusplus implements ActionListener {
mInvalidCount[1]++;
}
}
-
+
if (Recipe_GT.Gregtech_Recipe_Map.sMultiblockElectrolyzerRecipes_GT.mRecipeList.size() < 1) {
for (GT_Recipe a : Recipe_GT.Gregtech_Recipe_Map.sMultiblockElectrolyzerRecipes.mRecipeList) {
Recipe_GT.Gregtech_Recipe_Map.sMultiblockElectrolyzerRecipes_GT.add(a);
@@ -373,11 +369,11 @@ public class GTplusplus implements ActionListener {
mInvalidCount[2]++;
}
}
-
+
//Redo plasma recipes in Adv. Vac.
//Meta_GT_Proxy.generatePlasmaRecipesForAdvVacFreezer();
-
-
+
+
String[] machineName = new String[] {"Centrifuge", "Electrolyzer", "Vacuum Freezer"};
for (int i=0;i<3;i++) {
Logger.INFO("[Recipe] Generated "+mValidCount[i]+" recipes for the Industrial "+machineName[i]+". The original machine can process "+mOriginalCount[i]+" recipes, meaning "+mInvalidCount[i]+" are invalid for this Multiblock's processing in some way.");
diff --git a/src/Java/gtPlusPlus/api/enums/ParticleNames.java b/src/Java/gtPlusPlus/api/enums/ParticleNames.java
new file mode 100644
index 0000000000..d082cd6779
--- /dev/null
+++ b/src/Java/gtPlusPlus/api/enums/ParticleNames.java
@@ -0,0 +1,37 @@
+package gtPlusPlus.api.enums;
+
+public enum ParticleNames {
+
+ explode,
+ largeexplode,
+ hugeexplosion,
+ bubble,
+ splash,
+ suspended,
+ depthsuspend,
+ crit,
+ magicCrit,
+ smoke,
+ largesmoke,
+ spell,
+ instantSpell,
+ mobSpell,
+ dripWater,
+ dripLava,
+ townaura,
+ note,
+ portal,
+ enchantmenttable,
+ flame,
+ lava,
+ footstep,
+ cloud,
+ reddust,
+ snowballpoof,
+ snowshovel,
+ slime,
+ heart,
+ iconcrack_,
+ tilecrack_;
+
+}
diff --git a/src/Java/gtPlusPlus/api/objects/Logger.java b/src/Java/gtPlusPlus/api/objects/Logger.java
index 9c1e3d4338..6b7ca18590 100644
--- a/src/Java/gtPlusPlus/api/objects/Logger.java
+++ b/src/Java/gtPlusPlus/api/objects/Logger.java
@@ -5,7 +5,7 @@ import org.apache.logging.log4j.LogManager;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.relauncher.FMLRelaunchLog;
import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.proxy.ClientProxy;
+import gtPlusPlus.preloader.CORE_Preloader;
import gtPlusPlus.preloader.asm.AsmConfig;
public class Logger {
@@ -39,19 +39,7 @@ public class Logger {
// Non-Dev Comments
public static void MACHINE_INFO(final String s) {
if (enabled) {
-
- boolean localPlayer = false;
- try {
- if (ClientProxy.playerName != null){
- if (ClientProxy.playerName.toLowerCase().contains("draknyte1")){
- localPlayer = true;
- }
- }
- }
- catch (final Throwable t){
-
- }
-
+ boolean localPlayer = CORE_Preloader.DEV_ENVIRONMENT;
if (CORE.ConfigSwitches.MACHINE_INFO || localPlayer) {
final String name1 = gtPlusPlus.core.util.reflect.ReflectionUtils.getMethodName(2);
modLogger.info("Machine Info: " + s + " | " + name1);
@@ -62,7 +50,7 @@ public class Logger {
// Developer Comments
public static void WARNING(final String s) {
if (enabled) {
- if (CORE.DEBUG) {
+ if (CORE_Preloader.DEBUG_MODE) {
modLogger.warn(s);
}
}
@@ -71,7 +59,7 @@ public class Logger {
// Errors
public static void ERROR(final String s) {
if (enabled) {
- if (CORE.DEBUG) {
+ if (CORE_Preloader.DEBUG_MODE) {
modLogger.fatal(s);
}
}
@@ -80,7 +68,7 @@ public class Logger {
// Developer Logger
public static void SPECIFIC_WARNING(final String whatToLog, final String msg, final int line) {
if (enabled) {
- // if (!CORE.DEBUG){
+ // if (!CORE_Preloader.DEBUG_MODE){
FMLLog.warning("GT++ |" + line + "| " + whatToLog + " | " + msg);
// }
}
@@ -111,7 +99,7 @@ public class Logger {
*/
public static void BEES(final String s) {
if (enabled) {
- if (CORE.DEVENV || CORE.DEBUG) {
+ if (CORE_Preloader.DEV_ENVIRONMENT || CORE_Preloader.DEBUG_MODE) {
modLogger.info("[Bees] "+s);
}
}
@@ -121,7 +109,7 @@ public class Logger {
*/
public static void DEBUG_BEES(final String s) {
if (enabled) {
- if (CORE.DEVENV || CORE.DEBUG) {
+ if (CORE_Preloader.DEV_ENVIRONMENT || CORE_Preloader.DEBUG_MODE) {
modLogger.info("[Debug][Bees] "+s);
}
}
@@ -134,7 +122,7 @@ public class Logger {
*/
public static void MATERIALS(final String s) {
if (enabled) {
- if (/* CORE.DEVENV || */CORE.DEBUG) {
+ if (/* CORE_Preloader.DEV_ENVIRONMENT || */CORE_Preloader.DEBUG_MODE) {
modLogger.info("[Materials] "+s);
}
}
@@ -144,7 +132,7 @@ public class Logger {
*/
public static void DEBUG_MATERIALS(final String s) {
if (enabled) {
- if (CORE.DEVENV || CORE.DEBUG) {
+ if (CORE_Preloader.DEV_ENVIRONMENT || CORE_Preloader.DEBUG_MODE) {
modLogger.info("[Debug][Materials] "+s);
}
}
@@ -155,7 +143,7 @@ public class Logger {
*/
public static void REFLECTION(final String s) {
if (enabled) {
- if (CORE.DEVENV || CORE.DEBUG) {
+ if (CORE_Preloader.DEV_ENVIRONMENT || CORE_Preloader.DEBUG_MODE) {
modLogger.info("[Reflection] "+s);
}
}
@@ -167,7 +155,7 @@ public class Logger {
*/
public static void WORLD(final String s) {
if (enabled) {
- if (CORE.DEVENV || CORE.DEBUG) {
+ if (CORE_Preloader.DEV_ENVIRONMENT || CORE_Preloader.DEBUG_MODE) {
modLogger.info("[WorldGen] "+s);
}
}
@@ -175,7 +163,7 @@ public class Logger {
public static void RECIPE(String string) {
if (enabled) {
- if (/*CORE.DEVENV || */CORE.DEBUG) {
+ if (/*CORE_Preloader.DEV_ENVIRONMENT || */CORE_Preloader.DEBUG_MODE) {
modLogger.info("[Recipe] "+string);
}
}
diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoEUBonusMultiBehaviour.java b/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoEUBonusMultiBehaviour.java
new file mode 100644
index 0000000000..78341db7a1
--- /dev/null
+++ b/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoEUBonusMultiBehaviour.java
@@ -0,0 +1,27 @@
+package gtPlusPlus.api.objects.minecraft.multi;
+
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import net.minecraft.item.ItemStack;
+
+public class NoEUBonusMultiBehaviour extends SpecialMultiBehaviour {
+
+ public NoEUBonusMultiBehaviour() {
+ // Used by other mods which may wish to not obtain bonus outputs on their Sifting or Maceration recipes.
+ }
+
+ @Override
+ public ItemStack getTriggerItem() {
+ return GregtechItemList.Chip_MultiNerf_NoEuBonus.get(1);
+ }
+
+ @Override
+ public String getTriggerItemTooltip() {
+ return "Prevents EU discounts on GT++ multiblocks when used";
+ }
+
+ @Override
+ public int getEUPercent() {
+ return 0;
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java b/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java
index 4dc032d01f..8137f2573d 100644
--- a/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java
+++ b/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java
@@ -1,6 +1,6 @@
package gtPlusPlus.api.objects.minecraft.multi;
-import gtPlusPlus.core.recipe.common.CI;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
import net.minecraft.item.ItemStack;
public class NoOutputBonusMultiBehaviour extends SpecialMultiBehaviour {
@@ -11,7 +11,7 @@ public class NoOutputBonusMultiBehaviour extends SpecialMultiBehaviour {
@Override
public ItemStack getTriggerItem() {
- return CI.getNumberedBioCircuit(22);
+ return GregtechItemList.Chip_MultiNerf_NoOutputBonus.get(1);
}
@Override
diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoSpeedBonusMultiBehaviour.java b/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoSpeedBonusMultiBehaviour.java
new file mode 100644
index 0000000000..fe7a90960d
--- /dev/null
+++ b/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoSpeedBonusMultiBehaviour.java
@@ -0,0 +1,27 @@
+package gtPlusPlus.api.objects.minecraft.multi;
+
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import net.minecraft.item.ItemStack;
+
+public class NoSpeedBonusMultiBehaviour extends SpecialMultiBehaviour {
+
+ public NoSpeedBonusMultiBehaviour() {
+ // Used by other mods which may wish to not obtain bonus outputs on their Sifting or Maceration recipes.
+ }
+
+ @Override
+ public ItemStack getTriggerItem() {
+ return GregtechItemList.Chip_MultiNerf_NoSpeedBonus.get(1);
+ }
+
+ @Override
+ public String getTriggerItemTooltip() {
+ return "Prevents speed bonuses on GT++ multiblocks when used";
+ }
+
+ @Override
+ public int getSpeedBonusPercent() {
+ return 0;
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/australia/GTplusplus_Australia.java b/src/Java/gtPlusPlus/australia/GTplusplus_Australia.java
index 77562f5691..9a16ad1785 100644
--- a/src/Java/gtPlusPlus/australia/GTplusplus_Australia.java
+++ b/src/Java/gtPlusPlus/australia/GTplusplus_Australia.java
@@ -26,6 +26,7 @@ import gtPlusPlus.australia.gen.map.structure.StructureManager;
import gtPlusPlus.australia.world.AustraliaWorldGenerator;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.lib.CORE.Australia;
+import gtPlusPlus.preloader.CORE_Preloader;
import gtPlusPlus.xmod.gregtech.api.util.GTPP_Config;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.config.Configuration;
@@ -126,7 +127,7 @@ public class GTplusplus_Australia implements ActionListener {
WorldGen_GT_Australia_Base.oreveinPercentage = 16;
WorldGen_GT_Australia_Base.oreveinAttempts = 16;
WorldGen_GT_Australia_Base.oreveinMaxPlacementAttempts = 2;
- if (CORE.DEBUG || CORE.DEVENV){
+ if (CORE_Preloader.DEBUG_MODE || CORE.DEVENV){
WorldGen_GT_Australia_Base.debugWorldGen = true;
}
AustraliaContentLoader.run();
diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java
index db9ad2264c..a8536683b5 100644
--- a/src/Java/gtPlusPlus/core/block/ModBlocks.java
+++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java
@@ -29,7 +29,6 @@ import gtPlusPlus.core.block.machine.Machine_WorkbenchAdvanced;
import gtPlusPlus.core.block.machine.bedrock.Mining_Head_Fake;
import gtPlusPlus.core.block.machine.bedrock.Mining_Pipe_Fake;
import gtPlusPlus.core.fluids.FluidRegistryHandler;
-import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaTieredCasingBlocks1;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraftforge.fluids.Fluid;
@@ -56,7 +55,9 @@ public final class ModBlocks {
public static Block blockCasings2Misc;
public static Block blockCasings3Misc;
public static Block blockCasings4Misc;
+ public static Block blockCasings5Misc;
public static Block blockCasingsTieredGTPP;
+ public static Block blockSpecialMultiCasings;
public static Block blockMetaTileEntity;
public static Block blockHeliumGenerator;
diff --git a/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java b/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java
index 06b6f14822..903730f767 100644
--- a/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java
+++ b/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java
@@ -2,15 +2,22 @@ package gtPlusPlus.core.commands;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.NBTUtils;
import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.preloader.CORE_Preloader;
import gtPlusPlus.preloader.asm.AsmConfig;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@@ -74,8 +81,8 @@ public class CommandEnableDebugWhileRunning implements ICommand
Logger.INFO("Toggling Debug Mode.");
final EntityPlayer P = CommandUtils.getPlayer(S);
if (PlayerUtils.isPlayerOP(P)) {
- CORE.DEBUG = Utils.invertBoolean(CORE.DEBUG);
- PlayerUtils.messagePlayer(P, "Toggled GT++ Debug Mode - Enabled: "+CORE.DEBUG);
+ CORE_Preloader.DEBUG_MODE = Utils.invertBoolean(CORE_Preloader.DEBUG_MODE);
+ PlayerUtils.messagePlayer(P, "Toggled GT++ Debug Mode - Enabled: "+CORE_Preloader.DEBUG_MODE);
}
}
else if (argString[0].toLowerCase().equals("logging")) {
@@ -84,6 +91,28 @@ public class CommandEnableDebugWhileRunning implements ICommand
AsmConfig.disableAllLogging = Utils.invertBoolean(AsmConfig.disableAllLogging);
PlayerUtils.messagePlayer(P, "Toggled GT++ Logging - Enabled: "+(!AsmConfig.disableAllLogging));
}
+ /* else if (argString[0].toLowerCase().equals("test")) {
+ ItemStack mSemiFluidgen = ItemUtils.simpleMetaStack("IC2:blockGenerator", 7, 1);
+ final EntityPlayer P = CommandUtils.getPlayer(S);
+ if(mSemiFluidgen != null) {
+ PlayerUtils.messagePlayer(P, ItemUtils.getItemName(mSemiFluidgen));
+ }
+ }*/
+ else if (argString[0].toLowerCase().equals("hand")) {
+ final EntityPlayer P = CommandUtils.getPlayer(S);
+ if (P != null) {
+ ItemStack aHeldItem = PlayerUtils.getItemStackInPlayersHand(P);
+ if (aHeldItem != null) {
+ String aItemDisplayName = ItemUtils.getItemName(aHeldItem);
+ String aItemUnlocalName = ItemUtils.getUnlocalizedItemName(aHeldItem);
+ String aNbtString = tryIterateNBTData(aHeldItem);
+ PlayerUtils.messagePlayer(P, "["+aItemUnlocalName+"]"+"["+aItemDisplayName+"] "+aNbtString);
+ }
+ else {
+ PlayerUtils.messagePlayer(P, "No item held.");
+ }
+ }
+ }
else {
final EntityPlayer P = CommandUtils.getPlayer(S);
PlayerUtils.messagePlayer(P, "Invalid command, use '?' as an argument for help.'");
@@ -117,5 +146,35 @@ public class CommandEnableDebugWhileRunning implements ICommand
public boolean playerUsesCommand(final World W, final EntityPlayer P, final int cost){
return true;
}
+
+ public static String tryIterateNBTData(ItemStack aStack) {
+ try {
+ AutoMap<String> aItemDataTags = new AutoMap<String>();
+ NBTTagCompound aNBT = NBTUtils.getNBT(aStack);
+ if (aNBT != null) {
+ if (!aNBT.hasNoTags()) {
+ Map<?, ?> mInternalMap = ReflectionUtils.getField(aNBT, "tagMap");
+ if (mInternalMap != null) {
+ for (Map.Entry<?, ?> e : mInternalMap.entrySet()) {
+ aItemDataTags.add(e.getKey().toString()+":"+e.getValue());
+ }
+ int a = 0;
+ String data = "";
+ for (String tag : aItemDataTags) {
+ data += (tag+",");
+ }
+ if (data.endsWith(",")) {
+ data = data.substring(0, data.length()-2);
+ }
+ return data;
+ } else {
+ Logger.INFO("Data map reflected from NBTTagCompound was not valid.");
+ return "Bad NBT";
+ }
+ }
+ }
+ } catch (Throwable t) {}
+ return "";
+ }
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/common/CommonProxy.java b/src/Java/gtPlusPlus/core/common/CommonProxy.java
index 71a7b37cfc..0aeff5ae16 100644
--- a/src/Java/gtPlusPlus/core/common/CommonProxy.java
+++ b/src/Java/gtPlusPlus/core/common/CommonProxy.java
@@ -1,7 +1,5 @@
package gtPlusPlus.core.common;
-import static gtPlusPlus.core.lib.CORE.DEBUG;
-
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
@@ -49,8 +47,10 @@ import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.player.PlayerCache;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
import gtPlusPlus.plugin.villagers.block.BlockGenericSpawner;
+import gtPlusPlus.preloader.CORE_Preloader;
import gtPlusPlus.xmod.eio.handler.HandlerTooltip_EIO;
import gtPlusPlus.xmod.galacticraft.handler.HandlerTooltip_GC;
+import gtPlusPlus.xmod.gregtech.HANDLER_GT;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
import gtPlusPlus.xmod.gregtech.api.util.SpecialBehaviourTooltipHandler;
import net.minecraft.enchantment.Enchantment;
@@ -80,15 +80,19 @@ public class CommonProxy {
LoadedMods.checkLoaded();
Logger.INFO("Making sure we're ready to party!");
- if (!DEBUG) {
+ if (!CORE_Preloader.DEBUG_MODE) {
Logger.WARNING("Development mode not enabled.");
- } else if (DEBUG) {
+ } else if (CORE_Preloader.DEBUG_MODE) {
Logger.INFO("Development mode enabled.");
} else {
Logger.WARNING("Development mode not set.");
}
AddToCreativeTab.initialiseTabs();
+
+ if (LoadedMods.Gregtech) {
+ HANDLER_GT.addNewOrePrefixes();
+ }
// Moved from Init after Debug Loading.
// 29/01/18 - Alkalus
@@ -110,7 +114,7 @@ public class CommonProxy {
Logger.INFO("[Proxy] Calling Render registrator.");
registerRenderThings();
- if (!mFluidsGenerated && ItemList.valueOf("Cell_Empty").hasBeenSet()) {
+ if (!mFluidsGenerated && ItemList.Cell_Empty.hasBeenSet()) {
Material.generateQueuedFluids();
mFluidsGenerated = true;
}
@@ -119,14 +123,14 @@ public class CommonProxy {
public void init(final FMLInitializationEvent e) {
// Debug Loading
- if (CORE.DEBUG) {
+ if (CORE_Preloader.DEBUG_MODE) {
DEBUG_INIT.registerHandlers();
}
registerCustomItemsForMaterials();
ModBlocks.blockCustomMobSpawner = new BlockGenericSpawner();
- if (!mFluidsGenerated && ItemList.valueOf("Cell_Empty").hasBeenSet()) {
+ if (!mFluidsGenerated && ItemList.Cell_Empty.hasBeenSet()) {
Material.generateQueuedFluids();
mFluidsGenerated = true;
} else {
diff --git a/src/Java/gtPlusPlus/core/config/ConfigHandler.java b/src/Java/gtPlusPlus/core/config/ConfigHandler.java
index 61e7045192..0760dfc2cc 100644
--- a/src/Java/gtPlusPlus/core/config/ConfigHandler.java
+++ b/src/Java/gtPlusPlus/core/config/ConfigHandler.java
@@ -22,8 +22,8 @@ public class ConfigHandler {
"Stops mod checking for updates.");
// Debug
- DEBUG = config.getBoolean("debugMode", "debug", false,
- "Enables all sorts of debug logging. (Don't use unless told to, breaks other things.)");
+ /* DEBUG = config.getBoolean("debugMode", "debug", false,
+ "Enables all sorts of debug logging. (Don't use unless told to, breaks other things.)");*/
disableEnderIOIntegration = config.getBoolean("disableEnderIO", "debug", false,
"Disables EnderIO Integration.");
disableEnderIOIngotTooltips = config.getBoolean("disableEnderIOIngotTooltips", "debug", false,
diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
index d7c971e71f..21f3e1d6cd 100644
--- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
+++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
@@ -83,6 +83,7 @@ import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialTreeFarm
import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialWashPlant;
import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialWiremill;
import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIronBlastFurnace;
+import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIsaMill;
import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechLFTR;
import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechLargeTurbinesAndHeatExchanger;
import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechMiniRaFusion;
@@ -218,6 +219,7 @@ public class COMPAT_HANDLER {
GregtechFluidReactor.run();
GregtechAlgaeContent.run();
GregtechIndustrialAlloySmelter.run();
+ GregtechIsaMill.run();
//New Horizons Content
NewHorizonsAccelerator.run();
diff --git a/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java
index ee6c15fa67..b3738e6ea2 100644
--- a/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java
+++ b/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java
@@ -16,17 +16,28 @@ import net.minecraft.util.ChunkCoordinates;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.item.ModItems;
import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.material.nuclear.FLUORIDES;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.world.BlockEvent;
+import net.minecraftforge.oredict.OreDictionary;
+import thaumcraft.common.lib.FakeThaumcraftPlayer;
public class BlockEventHandler {
public static ArrayList<ItemStack> oreLimestone;
public static ArrayList<ItemStack> blockLimestone;
public static ItemStack fluoriteOre;
+
+ public static void init() {
+ //Set Variables for Fluorite Block handling
+ Logger.INFO("Setting some Variables for the block break event handler.");
+ BlockEventHandler.oreLimestone = OreDictionary.getOres("oreLimestone");
+ BlockEventHandler.blockLimestone = OreDictionary.getOres("limestone");
+ BlockEventHandler.fluoriteOre = FLUORIDES.FLUORITE.getOre(1);
+ }
@SubscribeEvent
public void onBlockLeftClicked(final PlayerInteractEvent event) {
@@ -90,7 +101,7 @@ public class BlockEventHandler {
ChunkCoordinates aChunkLocation = p.getPlayerCoordinates();
// Cache Fake Player
- if (p instanceof FakePlayer
+ if (p instanceof FakePlayer || p instanceof FakeThaumcraftPlayer
|| (event.harvester.getCommandSenderName() == null
|| event.harvester.getCommandSenderName().length() <= 0)
|| (p.isEntityInvulnerable() && !p.canCommandSenderUseCommand(0, "")
diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java
index 354107147b..fd2b98c7be 100644
--- a/src/Java/gtPlusPlus/core/item/ModItems.java
+++ b/src/Java/gtPlusPlus/core/item/ModItems.java
@@ -35,11 +35,13 @@ import gtPlusPlus.core.item.chemistry.AgriculturalChem;
import gtPlusPlus.core.item.chemistry.CoalTar;
import gtPlusPlus.core.item.chemistry.GenericChem;
import gtPlusPlus.core.item.chemistry.IonParticles;
+import gtPlusPlus.core.item.chemistry.MilledOreProcessing;
import gtPlusPlus.core.item.chemistry.NuclearChem;
import gtPlusPlus.core.item.chemistry.RocketFuels;
import gtPlusPlus.core.item.chemistry.StandardBaseParticles;
import gtPlusPlus.core.item.crafting.ItemDummyResearch;
import gtPlusPlus.core.item.effects.RarityUncommon;
+import gtPlusPlus.core.item.food.BaseItemMetaFood;
import gtPlusPlus.core.item.general.BaseItemGrindle;
import gtPlusPlus.core.item.general.BufferCore;
import gtPlusPlus.core.item.general.ItemAirFilter;
@@ -94,6 +96,7 @@ import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.minecraft.MaterialUtils;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
import gtPlusPlus.everglades.GTplusplus_Everglades;
+import gtPlusPlus.preloader.CORE_Preloader;
import gtPlusPlus.xmod.cofh.HANDLER_COFH;
import gtPlusPlus.xmod.eio.material.MaterialEIO;
import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechItems;
@@ -367,6 +370,8 @@ public final class ModItems {
public static CoreItem itemExquisiteIndustrialDiamond;
+ public static BaseItemMetaFood itemMetaFood;
+
static {
Logger.INFO("Items!");
//Default item used when recipes fail, handy for debugging. Let's make sure they exist when this class is called upon.
@@ -384,7 +389,7 @@ public final class ModItems {
itemDummyResearch = new ItemDummyResearch();
//Debug Loading
- if (CORE.DEBUG){
+ if (CORE_Preloader.DEBUG_MODE){
DEBUG_INIT.registerItems();
}
@@ -996,6 +1001,8 @@ public final class ModItems {
//General Chemistry
new GenericChem();
+ // Milled Ore Processing
+ new MilledOreProcessing();
//Bombs
itemBombCasing = new CoreItem("itemBombCasing", "Bomb Casing", tabMisc);
diff --git a/src/Java/gtPlusPlus/core/item/base/ore/BaseItemMilledOre.java b/src/Java/gtPlusPlus/core/item/base/ore/BaseItemMilledOre.java
new file mode 100644
index 0000000000..4edf4ae75d
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/base/ore/BaseItemMilledOre.java
@@ -0,0 +1,25 @@
+package gtPlusPlus.core.item.base.ore;
+
+import gregtech.api.enums.Materials;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.util.minecraft.MaterialUtils;
+import net.minecraft.item.Item;
+
+public class BaseItemMilledOre extends BaseOreComponent{
+
+ public BaseItemMilledOre(final Material material, int aMaterialEU) {
+ super(material, BaseOreComponent.ComponentTypes.MILLED);
+ CORE.RA.addMillingRecipe(material, aMaterialEU);
+ }
+
+ public static Item generate(Materials aMat, int aMaterialEU) {
+ return generate(MaterialUtils.generateMaterialFromGtENUM(aMat), aMaterialEU);
+ }
+
+ public static Item generate(Material aMat, int aMaterialEU) {
+ return new BaseItemMilledOre(aMat, aMaterialEU);
+ }
+
+
+}
diff --git a/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java b/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java
index c5b7191ddd..356fdac24e 100644
--- a/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java
+++ b/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java
@@ -18,6 +18,7 @@ import gtPlusPlus.core.material.state.MaterialState;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.minecraft.EntityUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.gregtech.api.enums.CustomOrePrefix;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
@@ -48,7 +49,6 @@ public class BaseOreComponent extends Item{
this.setCreativeTab(AddToCreativeTab.tabMisc);
this.setUnlocalizedName(this.unlocalName);
this.setMaxStackSize(64);
- //this.setTextureName(this.getCorrectTextures());
this.componentColour = material.getRgbAsHex();
GameRegistry.registerItem(this, this.unlocalName);
registerComponent();
@@ -59,9 +59,9 @@ public class BaseOreComponent extends Item{
//ThaumcraftUtils.addAspectToItem(ItemUtils.getSimpleStack(this), TC_Aspect_Wrapper.generate(TC_Aspects.RADIO.mAspect), componentMaterial.vRadiationLevel);
}
}
-
+
}
-
+
public boolean registerComponent() {
Logger.MATERIALS("Attempting to register "+this.getUnlocalizedName()+".");
if (this.componentMaterial == null) {
@@ -92,7 +92,10 @@ public class BaseOreComponent extends Item{
else if (componentType == ComponentTypes.DUSTPURE) {
aKey = OrePrefixes.dustPure.name();
}
-
+ else if (componentType == ComponentTypes.MILLED) {
+ aKey = CustomOrePrefix.milled.get().name();
+ }
+
ItemStack x = aMap.get(aKey);
if (x == null) {
aMap.put(aKey, ItemUtils.getSimpleStack(this));
@@ -107,13 +110,6 @@ public class BaseOreComponent extends Item{
}
}
- public String getCorrectTextures(){
- if (!CORE.ConfigSwitches.useGregtechTextures){
- return CORE.MODID + ":" + "item"+this.componentType.COMPONENT_NAME;
- }
- return "gregtech" + ":" + "materialicons/METALLIC/" + this.componentType.COMPONENT_NAME;
- }
-
/*@Override
public String getItemStackDisplayName(final ItemStack p_77653_1_) {
return (this.componentType.getPrefix()+this.componentMaterial.getLocalizedName()+this.componentType.DISPLAY_NAME);
@@ -181,7 +177,13 @@ public class BaseOreComponent extends Item{
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(final IIconRegister par1IconRegister){
- if (CORE.ConfigSwitches.useGregtechTextures){
+ if (this.componentType == ComponentTypes.MILLED) {
+ this.base = par1IconRegister.registerIcon(CORE.MODID + ":" + "processing/MilledOre/"+this.componentType.getComponent());
+ if (this.componentType.hasOverlay()){
+ this.overlay = par1IconRegister.registerIcon(CORE.MODID + ":" + "processing/MilledOre/"+this.componentType.getComponent()+"_Overlay");
+ }
+ }
+ else if (CORE.ConfigSwitches.useGregtechTextures){
//Logger.MATERIALS(this.componentType.getPrefix()+this.componentMaterial.getLocalizedName()+this.componentType.DISPLAY_NAME+" is using `"+"gregtech" + ":" + "materialicons/METALLIC/" + this.componentType.COMPONENT_NAME+"' as the layer 0 texture path.");
this.base = par1IconRegister.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + this.componentType.COMPONENT_NAME);
if (this.componentType.hasOverlay()){
@@ -199,13 +201,21 @@ public class BaseOreComponent extends Item{
@Override
public int getColorFromItemStack(final ItemStack stack, final int renderPass) {
- if (renderPass == 0 && !CORE.ConfigSwitches.useGregtechTextures){
+ if (this.componentType == ComponentTypes.MILLED) {
+ if (renderPass == 1){
+ return Utils.rgbtoHexValue(230, 230, 230);
+ }
return this.componentColour;
}
- if (renderPass == 1 && CORE.ConfigSwitches.useGregtechTextures){
- return Utils.rgbtoHexValue(230, 230, 230);
- }
- return this.componentColour;
+ else {
+ if (renderPass == 0 && !CORE.ConfigSwitches.useGregtechTextures){
+ return this.componentColour;
+ }
+ if (renderPass == 1 && CORE.ConfigSwitches.useGregtechTextures){
+ return Utils.rgbtoHexValue(230, 230, 230);
+ }
+ return this.componentColour;
+ }
}
@@ -226,7 +236,8 @@ public class BaseOreComponent extends Item{
DUSTPURE("dustPure", "Purified ", " Dust", true),
CRUSHED("crushed", "Crushed ", " Ore", true),
CRUSHEDCENTRIFUGED("crushedCentrifuged", "Centrifuged Crushed "," Ore", true),
- CRUSHEDPURIFIED("crushedPurified", "Purified Crushed ", " Ore", true);
+ CRUSHEDPURIFIED("crushedPurified", "Purified Crushed ", " Ore", true),
+ MILLED("milled", "Milled ", " Ore", true);
private String COMPONENT_NAME;
private String PREFIX;
@@ -252,7 +263,7 @@ public class BaseOreComponent extends Item{
public boolean hasOverlay(){
return this.HAS_OVERLAY;
}
-
+
public String getPrefix(){
return this.PREFIX;
}
diff --git a/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java b/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java
index 0e23e9a845..3f02ca898d 100644
--- a/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java
+++ b/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java
@@ -12,6 +12,7 @@ import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.api.objects.minecraft.ItemPackage;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.material.ELEMENT;
import gtPlusPlus.core.recipe.common.CI;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.minecraft.FluidUtils;
@@ -556,6 +557,22 @@ public class AgriculturalChem extends ItemPackage {
CORE.RA.addSemifluidFuel(FluidUtils.getFluidStack(ManureSlurry, 1000), 24);
CORE.RA.addSemifluidFuel(FluidUtils.getFluidStack(FertileManureSlurry, 1000), 32);
+ // Red Slurry / Tailings Processing
+ GT_Values.RA.addCentrifugeRecipe(
+ CI.getNumberedBioCircuit(10),
+ GT_Values.NI,
+ FluidUtils.getFluidStack(AgriculturalChem.RedMud, 1000),
+ FluidUtils.getWater(500),
+ ELEMENT.getInstance().IRON.getSmallDust(1),
+ ELEMENT.getInstance().COPPER.getSmallDust(1),
+ ELEMENT.getInstance().TIN.getSmallDust(1),
+ ELEMENT.getInstance().SULFUR.getSmallDust(1),
+ ELEMENT.getInstance().NICKEL.getTinyDust(1),
+ ELEMENT.getInstance().LEAD.getTinyDust(1),
+ new int[] { 3000, 3000, 2000, 2000, 1000, 1000 },
+ 30 * 20,
+ 30);
+
}
@Override
diff --git a/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java b/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java
index 981bfed479..37428b18d6 100644
--- a/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java
+++ b/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java
@@ -189,20 +189,20 @@ public class CoalTar extends ItemPackage {
GT_Values.RA.addDistilleryRecipe(
CI.getNumberedCircuit(5), //Circuit
FluidUtils.getFluidStack("fluid.coaltar", 1500), //aInput
- FluidUtils.getFluidStack("fluid.kerosene", 400), //aOutput
+ FluidUtils.getFluidStack("fluid.kerosene", 600), //aOutput
300, //aDuration
64,//aEUt
false //Hidden?
);
GT_Values.RA.addDistillationTowerRecipe(
- FluidUtils.getFluidStack("fluid.coaltar", 1000),
+ FluidUtils.getFluidStack("fluid.coaltar", 1200),
new FluidStack[]{
FluidUtils.getFluidStack("fluid.coaltaroil", 500), //aOutput
FluidUtils.getFluidStack("liquid_naphtha", 100), //aOutput
FluidUtils.getFluidStack("fluid.ethylbenzene", 150), //aOutput
FluidUtils.getFluidStack("fluid.anthracene", 50), //aOutput
- FluidUtils.getFluidStack("fluid.kerosene", 200), //aOutput
+ FluidUtils.getFluidStack("fluid.kerosene", 400), //aOutput
},
null,
900,
@@ -314,9 +314,6 @@ public class CoalTar extends ItemPackage {
@Override
public void fluids() {
-
- //Special Compatibility for Coke
- ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(ModItems.itemCoalCoke, 1), "fuelCoke");
//Create Coal Gas
Coal_Gas = FluidUtils.generateFluidNonMolten("CoalGas", "Coal Gas", 500, new short[]{48, 48, 48, 100}, null, null);
//Ethanol
diff --git a/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java b/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java
index 49d3303688..ff55326031 100644
--- a/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java
+++ b/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java
@@ -1,12 +1,15 @@
package gtPlusPlus.core.item.chemistry;
+import static gtPlusPlus.core.lib.CORE.GTNH;
+
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.TextureSet;
-import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
import gtPlusPlus.api.objects.minecraft.ItemPackage;
import gtPlusPlus.core.item.chemistry.general.ItemGenericChemBase;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.material.ELEMENT;
+import gtPlusPlus.core.material.MISC_MATERIALS;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.material.MaterialGenerator;
import gtPlusPlus.core.material.MaterialStack;
@@ -16,8 +19,9 @@ import gtPlusPlus.core.recipe.common.CI;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.minecraft.FluidUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
-import gtPlusPlus.plugin.agrichem.item.algae.ItemAgrichemBase;
-import net.minecraft.block.Block;
+import gtPlusPlus.plugin.agrichem.BioRecipes;
+import gtPlusPlus.plugin.agrichem.block.AgrichemFluids;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -28,14 +32,21 @@ import net.minecraftforge.fluids.FluidStack;
public class GenericChem extends ItemPackage {
/**
+ * Switches
+ */
+
+ private static boolean usingGregtechNitricOxide = false;
+ private static boolean usingGregtechNitrogenDioxide = false;
+
+ /**
* Materials
*/
-
+
public static final Material BAKELITE = new Material("Bakelite", MaterialState.SOLID, TextureSet.SET_DULL, new short[]{90, 140, 140}, 120, 240, 23, 24, true, null, 0);//Not a GT Inherited Material
public static final Material NYLON = new Material("Nylon", MaterialState.SOLID, TextureSet.SET_SHINY, new short[]{45, 45, 45}, 300, 600, 44, 48, true, null, 0);//Not a GT Inherited Material
public static final Material CARBYNE = new Material("Carbyne", MaterialState.SOLID, TextureSet.SET_DULL, new short[]{25, 25, 25}, 2500, 5000, 63, 52, true, null, 0);//Not a GT Inherited Material
-
-
+
+
//Refined PTFE
public static final Material TEFLON = new Material(
"Teflon",
@@ -52,34 +63,37 @@ public class GenericChem extends ItemPackage {
new MaterialStack(NONMATERIAL.PLASTIC, 15),
new MaterialStack(ELEMENT.getInstance().CARBON, 5),
new MaterialStack(ELEMENT.getInstance().SODIUM, 5)
- });// Not a GT
- // Inherited
- // Material
+ });// Not a GT
+ // Inherited
+ // Material
//public static final Material HYPOGEN = new Material("Hypogen", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{220, 120, 75}, 12255, 19377, 240, 251, true, "Hy⚶", 0);//Not a GT Inherited Material
//public static final Material HYPOGEN = new Material("Hypogen", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{220, 120, 75}, 12255, 19377, 240, 251, true, "Hy⚶", 0);//Not a GT Inherited Material
//public static final Material Nylon = new Material();
-
+
/**
* Fluids
*/
- public Fluid Benzene;
- public Fluid NitroBenzene;
- public Fluid Aniline;
- public Fluid Polyurethane;
- public Fluid Phenol; //https://en.wikipedia.org/wiki/Phenol#Uses
- public Fluid Cyclohexane; //https://en.wikipedia.org/wiki/Cyclohexane
- public Fluid Cyclohexanone; //https://en.wikipedia.org/wiki/Cyclohexanone
-
- public Fluid Cadaverine; //https://en.wikipedia.org/wiki/Cadaverine
- public Fluid Putrescine; //https://en.wikipedia.org/wiki/Putrescine
-
+ public static Fluid Benzene;
+ public static Fluid NitroBenzene;
+ public static Fluid Aniline;
+ public static Fluid Polyurethane;
+ public static Fluid Phenol; //https://en.wikipedia.org/wiki/Phenol#Uses
+ public static Fluid Cyclohexane; //https://en.wikipedia.org/wiki/Cyclohexane
+ public static Fluid Cyclohexanone; //https://en.wikipedia.org/wiki/Cyclohexanone
+ public static Fluid Cadaverine; //https://en.wikipedia.org/wiki/Cadaverine
+ public static Fluid Putrescine; //https://en.wikipedia.org/wiki/Putrescine
+ public static Fluid BoricAcid;
+ public static Fluid HydrochloricAcid;
+
public static Fluid Ethylanthraquinone2;
public static Fluid Ethylanthrahydroquinone2;
public static Fluid Hydrogen_Peroxide;
public static Fluid Lithium_Peroxide;
+ public static Fluid Nitric_Oxide;
+ public static Fluid Nitrogen_Dioxide;
/**
* Items
@@ -89,6 +103,19 @@ public class GenericChem extends ItemPackage {
public Item PhenolicResins; //https://en.wikipedia.org/wiki/Phenol_formaldehyde_resin
public static ItemGenericChemBase mGenericChemItem1;
+ private ItemStack mCatalystCarrier;
+
+ public static ItemStack mRedCatalyst;
+ public static ItemStack mYellowCatalyst;
+ public static ItemStack mBlueCatalyst;
+ public static ItemStack mOrangeCatalyst;
+ public static ItemStack mPurpleCatalyst;
+ public static ItemStack mBrownCatalyst;
+ public static ItemStack mPinkCatalyst;
+
+ public static ItemStack mMillingBallAlumina;
+ public static ItemStack mMillingBallSoapstone;
+
@Override
@@ -99,26 +126,20 @@ public class GenericChem extends ItemPackage {
MaterialGenerator.generate(TEFLON, false);
mGenericChemItem1 = new ItemGenericChemBase();
-
+
registerItemStacks();
registerOreDict();
+
+ GregtechItemList.Milling_Ball_Alumina.set(mMillingBallAlumina);
+ GregtechItemList.Milling_Ball_Soapstone.set(mMillingBallSoapstone);
+
}
- private ItemStack mCatalystCarrier;
-
- public static ItemStack mRedCatalyst;
- public static ItemStack mYellowCatalyst;
- public static ItemStack mBlueCatalyst;
- public static ItemStack mOrangeCatalyst;
- public static ItemStack mPurpleCatalyst;
- public static ItemStack mBrownCatalyst;
- public static ItemStack mPinkCatalyst;
-
-
+
public void registerItemStacks() {
mCatalystCarrier = ItemUtils.simpleMetaStack(AgriculturalChem.mAgrichemItem1, 13, 1);
-
+
mRedCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 0, 1);
mYellowCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 1, 1);
mBlueCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 2, 1);
@@ -126,9 +147,11 @@ public class GenericChem extends ItemPackage {
mPurpleCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 4, 1);
mBrownCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 5, 1);
mPinkCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 6, 1);
-
+ mMillingBallAlumina = ItemUtils.simpleMetaStack(mGenericChemItem1, 7, 1);
+ mMillingBallSoapstone = ItemUtils.simpleMetaStack(mGenericChemItem1, 8, 1);
+
}
-
+
public void registerOreDict() {
ItemUtils.addItemToOreDictionary(mRedCatalyst, "catalystIronCopper");
@@ -138,7 +161,9 @@ public class GenericChem extends ItemPackage {
ItemUtils.addItemToOreDictionary(mPurpleCatalyst, "catalystIridiumRuthenium");
ItemUtils.addItemToOreDictionary(mBrownCatalyst, "catalystNickelAluminium");
ItemUtils.addItemToOreDictionary(mPinkCatalyst, "catalystPlatinumRhodium");
-
+ ItemUtils.addItemToOreDictionary(mMillingBallAlumina, "millingballAlumina");
+ ItemUtils.addItemToOreDictionary(mMillingBallSoapstone, "millingballSoapstone");
+
}
@Override
@@ -146,33 +171,43 @@ public class GenericChem extends ItemPackage {
@Override
public void fluids() {
-
+
if (!FluidRegistry.isFluidRegistered("benzene")) {
Benzene = FluidUtils.generateFluidNoPrefix("benzene", "Benzene", 278, new short[] { 100, 70, 30, 100 }, true);
}
else {
Benzene = FluidRegistry.getFluid("benzene");
}
-
+
NitroBenzene = FluidUtils.generateFluidNoPrefix("nitrobenzene", "NitroBenzene", 278, new short[] { 70, 50, 40, 100 }, true);
-
+
Aniline = FluidUtils.generateFluidNoPrefix("aniline", "Aniline", 266, new short[] { 100, 100, 30, 100 }, true);
-
+
+ BoricAcid = FluidUtils.generateFluidNoPrefix("boricacid", "Boric Acid", 278, new short[] { 90, 30, 120, 100 }, true);
+
Polyurethane = FluidUtils.generateFluidNoPrefix("polyurethane", "Polyurethane", 350, new short[] { 100, 70, 100, 100 }, true);
-
+
if (!FluidRegistry.isFluidRegistered("phenol")) {
Phenol = FluidUtils.generateFluidNoPrefix("phenol", "Phenol", 313, new short[] { 100, 70, 30, 100 }, true);
}
else {
Phenol = FluidRegistry.getFluid("phenol");
- }
-
+ }
+
+ // Use GT's if it exists, else make our own.
+ if (FluidRegistry.isFluidRegistered("hydrochloricacid_gt5u")) {
+ HydrochloricAcid = FluidRegistry.getFluid("hydrochloricacid_gt5u");
+ }
+ else {
+ HydrochloricAcid = FluidUtils.generateFluidNoPrefix("hydrochloricacid", "Hydrochloric Acid", 285, new short[] { 183, 200, 196, 100 }, true);
+ }
+
Cyclohexane = FluidUtils.generateFluidNoPrefix("cyclohexane", "Cyclohexane", 32 + 175, new short[] { 100, 70, 30, 100 }, true);
Cyclohexanone = FluidUtils.generateFluidNoPrefix("cyclohexanone", "Cyclohexanone", 32 + 175, new short[] { 100, 70, 30, 100 }, true);
-
+
Cadaverine = FluidUtils.generateFluidNoPrefix("cadaverine", "Cadaverine", 32 + 175, new short[] { 100, 70, 30, 100 }, true);
Putrescine = FluidUtils.generateFluidNoPrefix("putrescine", "Putrescine", 32 + 175, new short[] { 100, 70, 30, 100 }, true);
-
+
//Create 2-Ethylanthraquinone
//2-Ethylanthraquinone is prepared from the reaction of phthalic anhydride and ethylbenzene
Ethylanthraquinone2 = FluidUtils.generateFluidNonMolten("2Ethylanthraquinone", "2-Ethylanthraquinone", 415, new short[]{227, 255, 159, 100}, null, null);
@@ -183,6 +218,21 @@ public class GenericChem extends ItemPackage {
//Compressed Air(1500) + Ethylanthrahydroquinone(500) + Anthracene(5) = 450 Ethylanthraquinone && 200 Peroxide
Hydrogen_Peroxide = FluidUtils.generateFluidNonMolten("HydrogenPeroxide", "Hydrogen Peroxide", 150, new short[]{210, 255, 255, 100}, null, null);
+ if (FluidRegistry.isFluidRegistered("nitricoxide")) {
+ Nitric_Oxide = FluidRegistry.getFluid("nitricoxide");
+ usingGregtechNitricOxide = true;
+ }
+ else {
+ Nitric_Oxide = FluidUtils.generateFluidNoPrefix("nitricoxide", "Nitric Oxide", 200, new short[] {125, 200, 240, 100});
+ }
+ if (FluidRegistry.isFluidRegistered("nitrogendioxide")) {
+ Nitrogen_Dioxide = FluidRegistry.getFluid("nitrogendioxide");
+ usingGregtechNitrogenDioxide = true;
+ }
+ else {
+ Nitrogen_Dioxide = FluidUtils.generateFluidNoPrefix("nitrogendioxide", "Nitrogen Dioxide", 200, new short[] {100, 175, 255, 100});
+ }
+
//Lithium Hydroperoxide - LiOH + H2O2 → LiOOH + 2 H2O
@@ -191,8 +241,8 @@ public class GenericChem extends ItemPackage {
//Lithium Peroxide - 2 LiOOH → Li2O2 + H2O2 + 2 H2O
Lithium_Peroxide = FluidUtils.generateFluidNonMolten("LithiumPeroxide", "Lithium Peroxide", 446, new short[]{135, 135, 135, 100}, null, null);
-
-
+
+
}
@Override
@@ -202,7 +252,7 @@ public class GenericChem extends ItemPackage {
@Override
public boolean generateRecipes() {
-
+
recipeCatalystRed();
recipeCatalystYellow();
recipeCatalystBlue();
@@ -210,24 +260,165 @@ public class GenericChem extends ItemPackage {
recipeCatalystPurple();
recipeCatalystBrown();
recipeCatalystPink();
-
+
+ recipeGrindingBallAlumina();
+ recipeGrindingBallSoapstone();
+
recipeNitroBenzene();
recipeAniline();
recipeCadaverineAndPutrescine();
recipeCyclohexane();
recipeCyclohexanone();
-
+
recipe2Ethylanthraquinone();
recipe2Ethylanthrahydroquinone();
recipeHydrogenPeroxide();
recipeLithiumHydroperoxide();
- recipeLithiumPeroxide();
-
+ recipeLithiumPeroxide();
+ if (!usingGregtechNitricOxide) {
+ recipeNitricOxide();
+ }
+ if (!usingGregtechNitrogenDioxide) {
+ recipeNitrogenDioxide();
+ }
+
+ // Add recipes if we are not using GT's fluid.
+ if (!FluidRegistry.isFluidRegistered("hydrochloricacid_gt5u")) {
+ recipeHydrochloricAcid();
+ }
+ registerFuels();
+
return true;
+ }
+
+
+ private static void registerFuels() {
+
+ // Burnables
+
+ // Gas Fuels
+ GT_Values.RA.addFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellNitroBenzene", 1), null, 1250, 1);
+
+ }
+
+ private void recipeGrindingBallAlumina() {
+ CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {
+ CI.getNumberedCircuit(10),
+ ItemUtils.getSimpleStack(AgriculturalChem.mAlumina, 64)
+ },
+ FluidUtils.getFluidStack(GenericChem.Aniline, 4000),
+ ItemUtils.getSimpleStack(mMillingBallAlumina, 8),
+ 180 * 20,
+ 480);
+ }
+ private void recipeGrindingBallSoapstone() {
+ CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {
+ CI.getNumberedCircuit(10),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustSoapstone", 32)
+ },
+ FluidUtils.getFluidStack(AgrichemFluids.mLiquidResin, 2500),
+ ItemUtils.getSimpleStack(mMillingBallSoapstone, 8),
+ 120 * 20,
+ 480);
+ }
+
+ private void recipeNitrogenDioxide() {
+ ItemStack aNitricOxideCell = ItemUtils.getItemStackOfAmountFromOreDict("cellNitricOxide", 1);
+ ItemStack aNitrogenDioxideCell = ItemUtils.getItemStackOfAmountFromOreDict("cellNitrogenDioxide", 1);
+ GT_Values.RA.addChemicalRecipe( ItemUtils.getSimpleStack(aNitricOxideCell, 2), GT_Utility.getIntegratedCircuit(1), ELEMENT.getInstance().OXYGEN.getFluid(1000), FluidUtils.getFluidStack(Nitrogen_Dioxide, 3000), CI.emptyCells(2), 160);
+ GT_Values.RA.addChemicalRecipe( ELEMENT.getInstance().OXYGEN.getCell(1), GT_Utility.getIntegratedCircuit(1), FluidUtils.getFluidStack(Nitric_Oxide, 2000), FluidUtils.getFluidStack(Nitrogen_Dioxide, 3000), CI.emptyCells(1), 160);
+ GT_Values.RA.addChemicalRecipeForBasicMachineOnly(ItemUtils.getSimpleStack(aNitricOxideCell, 2), CI.emptyCells(1), ELEMENT.getInstance().OXYGEN.getFluid(1000), GT_Values.NF, ItemUtils.getSimpleStack(aNitrogenDioxideCell, 3), GT_Values.NI, 160, 30);
+ GT_Values.RA.addChemicalRecipeForBasicMachineOnly(ELEMENT.getInstance().OXYGEN.getCell(1), CI.emptyCells(2), FluidUtils.getFluidStack(Nitric_Oxide, 2000), GT_Values.NF, ItemUtils.getSimpleStack(aNitrogenDioxideCell, 3), GT_Values.NI, 160, 30);
+ GT_Values.RA.addChemicalRecipeForBasicMachineOnly(ItemUtils.getSimpleStack(aNitricOxideCell, 2), ELEMENT.getInstance().OXYGEN.getCell(1), GT_Values.NF, GT_Values.NF, ItemUtils.getSimpleStack(aNitrogenDioxideCell, 3), GT_Values.NI, 160, 30);
+ }
+
+
+ private void recipeNitricOxide() {
+ ItemStack aWaterCell = ItemUtils.getItemStackOfAmountFromOreDict("cellWater", 1);
+ ItemStack aNitricOxideCell = ItemUtils.getItemStackOfAmountFromOreDict("cellNitricOxide", 1);
+ GT_Values.RA.addChemicalRecipeForBasicMachineOnly(MISC_MATERIALS.AMMONIA.getCell(8), CI.emptyCells(1), ELEMENT.getInstance().OXYGEN.getFluid(5000), FluidUtils.getFluidStack(Nitric_Oxide, 4000), ItemUtils.getSimpleStack(aWaterCell, 9), GT_Values.NI, 160, 30);
+ GT_Values.RA.addChemicalRecipeForBasicMachineOnly(ELEMENT.getInstance().OXYGEN.getCell(5), CI.emptyCells(4), MISC_MATERIALS.AMMONIA.getFluid(8000), FluidUtils.getFluidStack(Nitric_Oxide, 4000), ItemUtils.getSimpleStack(aWaterCell, 9), GT_Values.NI, 160, 30);
+ GT_Values.RA.addChemicalRecipe( MISC_MATERIALS.AMMONIA.getCell(8), GT_Utility.getIntegratedCircuit(11), ELEMENT.getInstance().OXYGEN.getFluid(5000), FluidUtils.getWater(9000), ItemUtils.getSimpleStack(aNitricOxideCell, 4), CI.emptyCells(4), 160);
+ GT_Values.RA.addChemicalRecipe( ELEMENT.getInstance().OXYGEN.getCell(5), GT_Utility.getIntegratedCircuit(11), MISC_MATERIALS.AMMONIA.getFluid(8000), FluidUtils.getWater(9000), ItemUtils.getSimpleStack(aNitricOxideCell, 4), CI.emptyCells(1), 160);
+ GT_Values.RA.addChemicalRecipe( MISC_MATERIALS.AMMONIA.getCell(8), GT_Utility.getIntegratedCircuit(2), ELEMENT.getInstance().OXYGEN.getFluid(5000), FluidUtils.getFluidStack(Nitric_Oxide, 4000), CI.emptyCells(8), 320);
+ GT_Values.RA.addChemicalRecipe( ELEMENT.getInstance().OXYGEN.getCell(5), GT_Utility.getIntegratedCircuit(2), MISC_MATERIALS.AMMONIA.getFluid(8000), FluidUtils.getFluidStack(Nitric_Oxide, 4000), CI.emptyCells(5), 320);
+ GT_Values.RA.addChemicalRecipe( MISC_MATERIALS.AMMONIA.getCell(8), GT_Utility.getIntegratedCircuit(12), ELEMENT.getInstance().OXYGEN.getFluid(5000), GT_Values.NF, ItemUtils.getSimpleStack(aNitricOxideCell, 4), CI.emptyCells(4), 160);
+ GT_Values.RA.addChemicalRecipe( ELEMENT.getInstance().OXYGEN.getCell(5), GT_Utility.getIntegratedCircuit(12), MISC_MATERIALS.AMMONIA.getFluid(8000), GT_Values.NF, ItemUtils.getSimpleStack(aNitricOxideCell, 4), CI.emptyCells(1), 160);
+ GT_Values.RA.addChemicalRecipeForBasicMachineOnly(MISC_MATERIALS.AMMONIA.getCell(8), ELEMENT.getInstance().OXYGEN.getCell(5), GT_Values.NF, GT_Values.NF, ItemUtils.getSimpleStack(aNitricOxideCell, 4), ItemUtils.getSimpleStack(aWaterCell, 9), 160, 30);
+ GT_Values.RA.addMultiblockChemicalRecipe(new ItemStack[]{GT_Utility.getIntegratedCircuit(1)}, new FluidStack[]{MISC_MATERIALS.AMMONIA.getFluid(8000), ELEMENT.getInstance().OXYGEN.getFluid(5000)}, new FluidStack[]{FluidUtils.getFluidStack(Nitric_Oxide, 4000), FluidUtils.getWater(9000)}, null, 160, 30);
+ }
+
+
+ private void recipeHydrochloricAcid() {
+
+ ItemStack aAcidCell = ItemUtils.getItemStackOfAmountFromOreDict("cellHydrochloricAcid", 1);
+
+ CORE.RA.addChemicalRecipe(
+ ELEMENT.getInstance().CHLORINE.getCell(1),
+ GT_Utility.getIntegratedCircuit(1),
+ ELEMENT.getInstance().HYDROGEN.getFluid(1000),
+ FluidUtils.getFluidStack(HydrochloricAcid, 2000),
+ CI.emptyCells(1),
+ 60,
+ 8);
+
+ CORE.RA.addChemicalRecipe(
+ ELEMENT.getInstance().HYDROGEN.getCell(1),
+ GT_Utility.getIntegratedCircuit(1),
+ ELEMENT.getInstance().CHLORINE.getFluid(1000),
+ FluidUtils.getFluidStack(HydrochloricAcid, 2000),
+ CI.emptyCells(1),
+ 60,
+ 8);
+
+ GT_Values.RA.addElectrolyzerRecipe(
+ CI.emptyCells(1),
+ GT_Utility.getIntegratedCircuit(1),
+ FluidUtils.getFluidStack(HydrochloricAcid, 2000),
+ ELEMENT.getInstance().CHLORINE.getFluid(1000),
+ ELEMENT.getInstance().HYDROGEN.getCell(1),
+ GT_Values.NI,
+ GT_Values.NI,
+ GT_Values.NI,
+ GT_Values.NI,
+ GT_Values.NI,
+ null,
+ 720,
+ 30);
+
+ GT_Values.RA.addElectrolyzerRecipe(
+ CI.emptyCells(1),
+ GT_Utility.getIntegratedCircuit(11),
+ FluidUtils.getFluidStack(HydrochloricAcid, 2000),
+ ELEMENT.getInstance().HYDROGEN.getFluid(1000),
+ ELEMENT.getInstance().CHLORINE.getCell(1),
+ GT_Values.NI,
+ GT_Values.NI,
+ GT_Values.NI,
+ GT_Values.NI,
+ GT_Values.NI,
+ null,
+ 720,
+ 30);
+
+ GT_Values.RA.addElectrolyzerRecipe(
+ ItemUtils.getSimpleStack(aAcidCell, 2),
+ GT_Values.NI,
+ GT_Values.NF,
+ GT_Values.NF,
+ ELEMENT.getInstance().HYDROGEN.getCell(1),
+ ELEMENT.getInstance().CHLORINE.getCell(1),
+ GT_Values.NI,
+ GT_Values.NI,
+ GT_Values.NI,
+ GT_Values.NI,
+ null,
+ 720,
+ 30);
}
private void recipeCyclohexane() {
-
+
CORE.RA.addChemicalPlantRecipe(
new ItemStack[] {
getTierTwoChip(),
@@ -238,7 +429,7 @@ public class GenericChem extends ItemPackage {
FluidUtils.getFluidStack("hydrogen", 10000)
},
new ItemStack[] {
-
+
},
new FluidStack[] {
FluidUtils.getFluidStack(Cyclohexane, 1000),
@@ -246,11 +437,11 @@ public class GenericChem extends ItemPackage {
20 * 120,
120,
2);
-
+
}
private void recipeCyclohexanone() {
-
+
CORE.RA.addChemicalPlantRecipe(
new ItemStack[] {
getTierTwoChip(),
@@ -261,7 +452,7 @@ public class GenericChem extends ItemPackage {
FluidUtils.getFluidStack("air", 10000)
},
new ItemStack[] {
-
+
},
new FluidStack[] {
FluidUtils.getFluidStack(Cyclohexanone, 2000),
@@ -269,7 +460,7 @@ public class GenericChem extends ItemPackage {
20 * 120,
120,
2);
-
+
CORE.RA.addChemicalPlantRecipe(
new ItemStack[] {
getTierTwoChip(),
@@ -279,7 +470,7 @@ public class GenericChem extends ItemPackage {
FluidUtils.getFluidStack("oxygen", 5000)
},
new ItemStack[] {
-
+
},
new FluidStack[] {
FluidUtils.getFluidStack(Cyclohexanone, 2000),
@@ -287,10 +478,10 @@ public class GenericChem extends ItemPackage {
20 * 120,
120,
2);
-
-
-
-
+
+
+
+
}
private void recipeCatalystRed() {
@@ -305,7 +496,7 @@ public class GenericChem extends ItemPackage {
ItemUtils.getSimpleStack(mRedCatalyst, 10),
20 * 20,
30);
-
+
}
private void recipeCatalystYellow() {
@@ -320,7 +511,7 @@ public class GenericChem extends ItemPackage {
ItemUtils.getSimpleStack(mYellowCatalyst, 10),
60 * 20,
2000);
-
+
}
private void recipeCatalystBlue() {
@@ -335,7 +526,7 @@ public class GenericChem extends ItemPackage {
ItemUtils.getSimpleStack(mBlueCatalyst, 10),
40 * 20,
500);
-
+
}
private void recipeCatalystOrange() {
@@ -350,7 +541,7 @@ public class GenericChem extends ItemPackage {
ItemUtils.getSimpleStack(mOrangeCatalyst, 10),
40 * 20,
500);
-
+
}
private void recipeCatalystPurple() {
@@ -365,7 +556,7 @@ public class GenericChem extends ItemPackage {
ItemUtils.getSimpleStack(mPurpleCatalyst, 10),
120 * 20,
8000);
-
+
}
private void recipeCatalystBrown() {
@@ -380,7 +571,7 @@ public class GenericChem extends ItemPackage {
ItemUtils.getSimpleStack(mBrownCatalyst, 10),
15 * 20,
30);
-
+
}
private void recipeCatalystPink() {
@@ -395,11 +586,11 @@ public class GenericChem extends ItemPackage {
ItemUtils.getSimpleStack(mPinkCatalyst, 10),
30 * 20,
2000);
-
+
}
private void recipeCadaverineAndPutrescine() {
-
+
// Basic Recipe
CORE.RA.addChemicalPlantRecipe(
new ItemStack[] {
@@ -410,7 +601,7 @@ public class GenericChem extends ItemPackage {
FluidUtils.getHotWater(2000)
},
new ItemStack[] {
-
+
},
new FluidStack[] {
FluidUtils.getFluidStack(Cadaverine, 250),
@@ -431,7 +622,7 @@ public class GenericChem extends ItemPackage {
FluidUtils.getHotWater(3000)
},
new ItemStack[] {
-
+
},
new FluidStack[] {
FluidUtils.getFluidStack(Cadaverine, 750),
@@ -440,11 +631,11 @@ public class GenericChem extends ItemPackage {
20 * 120,
240,
2);
-
+
}
private void recipeAniline() {
-
+
CORE.RA.addChemicalPlantRecipe(
new ItemStack[] {
getTierThreeChip(),
@@ -455,7 +646,7 @@ public class GenericChem extends ItemPackage {
FluidUtils.getFluidStack("hydrogen", 10000)
},
new ItemStack[] {
-
+
},
new FluidStack[] {
FluidUtils.getFluidStack(Aniline, 2000),
@@ -463,11 +654,11 @@ public class GenericChem extends ItemPackage {
20 * 30,
500,
3);
-
+
}
private void recipeNitroBenzene() {
-
+
CORE.RA.addChemicalPlantRecipe(
new ItemStack[] {
getTierThreeChip(),
@@ -479,7 +670,7 @@ public class GenericChem extends ItemPackage {
FluidUtils.getDistilledWater(10000)
},
new ItemStack[] {
-
+
},
new FluidStack[] {
FluidUtils.getFluidStack("dilutedsulfuricacid", 3000),
@@ -488,11 +679,11 @@ public class GenericChem extends ItemPackage {
20 * 30,
500,
3);
-
+
}
private void recipe2Ethylanthraquinone() {
-
+
CORE.RA.addChemicalPlantRecipe(
new ItemStack[] {
CI.getNumberedCircuit(4),
@@ -502,7 +693,7 @@ public class GenericChem extends ItemPackage {
FluidUtils.getFluidStack(CoalTar.Ethylbenzene, 2000),
},
new ItemStack[] {
-
+
},
new FluidStack[] {
FluidUtils.getFluidStack(Ethylanthraquinone2, 2000+(144*4)),
@@ -510,7 +701,7 @@ public class GenericChem extends ItemPackage {
20 * 15,
120,
1);
-
+
/*GT_Values.RA.addChemicalRecipe(
ItemUtils.getItemStackOfAmountFromOreDict("dustPhthalicAnhydride", 4),
ItemUtils.getItemStackOfAmountFromOreDict("cellEthylbenzene", 2),
@@ -518,11 +709,11 @@ public class GenericChem extends ItemPackage {
FluidUtils.getFluidStack("fluid.2ethylanthraquinone", 2000+(144*4)),
ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 2),
20*16);*/
-
+
}
private void recipe2Ethylanthrahydroquinone() {
-
+
CORE.RA.addChemicalPlantRecipe(
new ItemStack[] {
CI.getNumberedCircuit(4),
@@ -533,7 +724,7 @@ public class GenericChem extends ItemPackage {
FluidUtils.getFluidStack("hydrogen", 2000),
},
new ItemStack[] {
-
+
},
new FluidStack[] {
FluidUtils.getFluidStack(Ethylanthrahydroquinone2, 5000),
@@ -541,7 +732,7 @@ public class GenericChem extends ItemPackage {
20 * 40,
120,
1);
-
+
/*GT_Values.RA.addChemicalRecipe(
ItemUtils.getItemStackOfAmountFromOreDict("platePalladium", 0),
ItemUtils.getItemStackOfAmountFromOreDict("cell2Ethylanthraquinone", 1),
@@ -549,7 +740,7 @@ public class GenericChem extends ItemPackage {
FluidUtils.getFluidStack("fluid.2ethylanthrahydroquinone", 1200),
ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 1),
20*40);*/
-
+
}
private void recipeLithiumPeroxide() {
@@ -571,7 +762,7 @@ public class GenericChem extends ItemPackage {
}
private void recipeLithiumHydroperoxide() {
-
+
CORE.RA.addChemicalPlantRecipe(
new ItemStack[] {
CI.getNumberedCircuit(4),
@@ -584,14 +775,14 @@ public class GenericChem extends ItemPackage {
ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroperoxide", 14),
},
new FluidStack[] {
-
+
},
20 * 30,
240,
1);
-
-
-
+
+
+
/*CORE.RA.addChemicalRecipe(
ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroxide", 7),
ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenPeroxide", 1),
@@ -605,7 +796,7 @@ public class GenericChem extends ItemPackage {
}
private void recipeHydrogenPeroxide() {
-
+
CORE.RA.addChemicalPlantRecipe(
new ItemStack[] {
CI.getNumberedCircuit(4),
@@ -624,7 +815,7 @@ public class GenericChem extends ItemPackage {
20 * 30,
240,
1);
-
+
/* CORE.RA.addChemicalRecipe(
GT_ModHandler.getAirCell(15),
ItemUtils.getItemStackOfAmountFromOreDict("cell2Ethylanthrahydroquinone", 5),
@@ -635,38 +826,38 @@ public class GenericChem extends ItemPackage {
CI.emptyCells(18),
20*30,
240);*/
-
+
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
private static final ItemStack getTierOneChip() {
return CI.getNumberedBioCircuit(4);
}
@@ -679,7 +870,7 @@ public class GenericChem extends ItemPackage {
private static final ItemStack getTierFourChip() {
return CI.getNumberedBioCircuit(16);
}
-
-
-
+
+
+
}
diff --git a/src/Java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java b/src/Java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java
new file mode 100644
index 0000000000..426f48ecf9
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java
@@ -0,0 +1,113 @@
+package gtPlusPlus.core.item.chemistry;
+
+import gregtech.api.enums.Materials;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.minecraft.ItemPackage;
+import gtPlusPlus.core.item.base.ore.BaseItemMilledOre;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.core.util.minecraft.MaterialUtils;
+import net.minecraft.item.Item;
+import net.minecraftforge.fluids.Fluid;
+
+public class MilledOreProcessing extends ItemPackage {
+
+ /**
+ * Fluids
+ */
+
+ public static Fluid ZincFlotationFroth;
+ public static Fluid CopperFlotationFroth;
+ public static Fluid NickelFlotationFroth;
+ public static Fluid PlatinumFlotationFroth;
+ public static Fluid PentlanditeFlotationFroth;
+
+
+ /**
+ * Items
+ */
+
+ // Zinc, Iron, Indium, Germanium
+ public static Item milledSphalerite;
+
+ // Copper, Iron, Cadmium, Indium
+ public static Item milledChalcopyrite;
+
+ // Nickel, Cobalt, Rhodium, Ruthenium
+ public static Item milledNickel;
+
+ // Platinum, Rhodium, Selenium, Tellurium
+ public static Item milledPlatinum;
+
+ // Iron, Nickel, Promethium, Hafnium
+ public static Item milledPentlandite;
+
+
+ @Override
+ public void items() {
+
+ milledSphalerite = BaseItemMilledOre.generate(Materials.Sphalerite, MaterialUtils.getVoltageForTier(5));
+ milledChalcopyrite = BaseItemMilledOre.generate(Materials.Chalcopyrite, MaterialUtils.getVoltageForTier(4));
+ milledNickel = BaseItemMilledOre.generate(Materials.Nickel, MaterialUtils.getVoltageForTier(4));
+ milledPlatinum = BaseItemMilledOre.generate(Materials.Platinum, MaterialUtils.getVoltageForTier(5));
+ milledPentlandite = BaseItemMilledOre.generate(Materials.Pentlandite, MaterialUtils.getVoltageForTier(5));
+
+ }
+
+ @Override
+ public void blocks() {
+ // None yet
+ }
+
+ @Override
+ public void fluids() {
+
+ short[] aZincFrothRGB = Materials.Sphalerite.mRGBa;
+ ZincFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.zincflotation", "Zinc Froth", 32 + 175, new short[] { aZincFrothRGB[0], aZincFrothRGB[1], aZincFrothRGB[2], 100 }, true);
+ short[] aCopperFrothRGB = Materials.Chalcopyrite.mRGBa;
+ CopperFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.copperflotation", "Copper Froth", 32 + 175, new short[] { aCopperFrothRGB[0], aCopperFrothRGB[1], aCopperFrothRGB[2], 100 }, true);
+ short[] aNickelFrothRGB = Materials.Nickel.mRGBa;
+ NickelFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.nickelflotation", "Nickel Froth", 32 + 175, new short[] { aNickelFrothRGB[0], aNickelFrothRGB[1], aNickelFrothRGB[2], 100 }, true);
+ short[] aPlatinumFrothRGB = Materials.Platinum.mRGBa;
+ PlatinumFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.platinumflotation", "Platinum Froth", 32 + 175, new short[] { aPlatinumFrothRGB[0], aPlatinumFrothRGB[1], aPlatinumFrothRGB[2], 100 }, true);
+ short[] aPentlanditeFrothRGB = Materials.Pentlandite.mRGBa;
+ PentlanditeFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.pentlanditeflotation", "Pentlandite Froth", 32 + 175, new short[] { aPentlanditeFrothRGB[0], aPentlanditeFrothRGB[1], aPentlanditeFrothRGB[2], 100 }, true);
+
+ }
+
+
+
+ public MilledOreProcessing() {
+ super();
+ Logger.INFO("Adding Ore Milling content");
+ }
+
+ private static void addMiscRecipes() {
+
+ /*GT_Values.RA.addCentrifugeRecipe(
+ CI.getNumberedBioCircuit(10),
+ GT_Values.NI,
+ FluidUtils.getFluidStack(MilledOreProcessing.ZincFlotationFroth, 1000),
+ FluidUtils.getWater(500),
+ ELEMENT.getInstance().IRON.getSmallDust(1),
+ ELEMENT.getInstance().COPPER.getSmallDust(1),
+ ELEMENT.getInstance().TIN.getSmallDust(1),
+ ELEMENT.getInstance().SULFUR.getSmallDust(1),
+ ELEMENT.getInstance().NICKEL.getTinyDust(1),
+ ELEMENT.getInstance().LEAD.getTinyDust(1),
+ new int[] { 3000, 3000, 2000, 2000, 1000, 1000 },
+ 30 * 20,
+ 30);*/
+
+ }
+
+ @Override
+ public String errorMessage() {
+ return "Failed to generate recipes for OreMillingProc.";
+ }
+
+ @Override
+ public boolean generateRecipes() {
+ addMiscRecipes();
+ return true;
+ }
+}
diff --git a/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java b/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java
index e6426dd6df..459acb31b9 100644
--- a/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java
+++ b/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java
@@ -6,19 +6,21 @@ import java.util.LinkedHashMap;
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
import gregtech.api.enums.GT_Values;
-import gregtech.api.enums.Materials;
import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gregtech.api.util.GT_Utility;
import gregtech.api.util.Recipe_GT;
-import gtPlusPlus.api.helpers.MaterialHelper;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.api.objects.minecraft.ItemPackage;
import gtPlusPlus.core.item.base.BaseItemComponent;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.recipe.common.CI;
import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.minecraft.FluidUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.minecraft.MaterialUtils;
+import gtPlusPlus.xmod.gregtech.common.StaticFields59;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
@@ -53,36 +55,36 @@ public class RocketFuels extends ItemPackage {
public static Item Ammonium_Nitrate_Dust;
public static Item Formaldehyde_Catalyst;
+ public static ItemStack Formaldehyde_Catalyst_Stack;
+
+ public RocketFuels() {
+ super(true);
+ }
public static void createKerosene(){
-
-
- FluidStack fuelA = FluidUtils.getFluidStack("diesel", 300);
- FluidStack fuelB = FluidUtils.getFluidStack("fuel", 300);
-
-
+ FluidStack fuelA = FluidUtils.getFluidStack("diesel", 3000);
+ FluidStack fuelB = FluidUtils.getFluidStack("fuel", 3000);
if (fuelA != null){
//GT_Values.RA.addDistilleryRecipe(23, fuelA, FluidUtils.getFluidStack(Kerosene, 50), 200, 64, false);
- GT_Values.RA.addDistilleryRecipe(CI.getNumberedCircuit(23), fuelA, FluidUtils.getFluidStack(Kerosene, 100), 200, 64, false);
+ GT_Values.RA.addDistilleryRecipe(CI.getNumberedCircuit(23), fuelA, FluidUtils.getFluidStack(Kerosene, 1800), 200, 64, false);
}
if (fuelA == null && fuelB != null){
//GT_Values.RA.addDistilleryRecipe(23, fuelB, FluidUtils.getFluidStack(Kerosene, 50), 200, 64, false);
- GT_Values.RA.addDistilleryRecipe(CI.getNumberedCircuit(23), fuelB, FluidUtils.getFluidStack(Kerosene, 100), 200, 64, false);
+ GT_Values.RA.addDistilleryRecipe(CI.getNumberedCircuit(23), fuelB, FluidUtils.getFluidStack(Kerosene, 1800), 200, 64, false);
}
}
public static void createRP1(){
- FluidStack fuelA = FluidUtils.getFluidStack(Kerosene, 100);
+ FluidStack fuelA = FluidUtils.getFluidStack(Kerosene, 1000);
if (fuelA != null){
- //GT_Values.RA.addDistilleryRecipe(23, fuelA, FluidUtils.getFluidStack(RP1, 25), 400, 120, false);
- GT_Values.RA.addDistilleryRecipe(CI.getNumberedCircuit(23), fuelA, FluidUtils.getFluidStack(RP1, 50), 400, 120, false);
+ GT_Values.RA.addDistilleryRecipe(CI.getNumberedCircuit(23), fuelA, FluidUtils.getFluidStack(RP1, 750), 20 * 40, 120, false);
}
}
public static void createNitrogenTetroxide(){
- CORE.RA.addDehydratorRecipe(
+ /*CORE.RA.addDehydratorRecipe(
new ItemStack[]{
ItemUtils.getItemStackOfAmountFromOreDict("dustCopper", 4)
},
@@ -94,42 +96,78 @@ public class RocketFuels extends ItemPackage {
},
new int[]{100, 50},
20*16,
- 500);
+ 500);*/
+
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[]{
+ ItemUtils.getItemStackOfAmountFromOreDict("dustCopper", 16),
+ ItemUtils.getSimpleStack(GenericChem.mOrangeCatalyst, 0),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("nitricacid", 4000)
+ },
+ new ItemStack[]{
+ ItemUtils.getItemStackOfAmountFromOreDict("dustSmallAsh", 1),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustSmallDarkAsh", 1),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustTinyAsh", 1),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustTinyDarkAsh", 1)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Nitrogen_Tetroxide, 3000),
+ },
+ new int[]{100, 100, 50, 50},
+ 20*30,
+ MaterialUtils.getVoltageForTier(3),
+ 2);
+
+
}
- public static void createHydrazine(){
- GT_Values.RA.addChemicalRecipe(
- ItemUtils.getItemStackOfAmountFromOreDict("cellAmmonia", 2),
- CI.getNumberedCircuit(23),
- FluidUtils.getFluidStack("fluid.hydrogenperoxide", 2000),
- FluidUtils.getFluidStack(Hydrazine, 2000),
- ItemUtils.getItemStackOfAmountFromOreDict("cellWater", 2),
- 20*32);
-
- GT_Values.RA.addChemicalRecipe(
- ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenPeroxide", 2),
- CI.getNumberedCircuit(23),
- FluidUtils.getFluidStack("ammonia", 2000),
- FluidUtils.getFluidStack(Hydrazine, 2000),
- ItemUtils.getItemStackOfAmountFromOreDict("cellWater", 2),
- 20*32);
+ public static void createHydrazine(){
+
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(21)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("fluid.hydrogenperoxide", 2000),
+ FluidUtils.getFluidStack("ammonia", 2000),
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Hydrazine, 4000),
+
+ },
+ 20 * 30,
+ MaterialUtils.getVoltageForTier(2),
+ 1);
+
}
public static void createMonomethylhydrazine(){
- CORE.RA.addDehydratorRecipe(
+
+ CORE.RA.addChemicalPlantRecipe(
new ItemStack[] {
- ItemUtils.getItemStackOfAmountFromOreDict("cellHydrazine", 2),
+ CI.getNumberedCircuit(21),
ItemUtils.getItemStackOfAmountFromOreDict("dustCarbon", 2)
},
- FluidUtils.getFluidStack("hydrogen", 2000),
- FluidUtils.getFluidStack(Monomethylhydrazine, 3000),
+ new FluidStack[] {
+ FluidUtils.getFluidStack("hydrogen", 2000),
+ FluidUtils.getFluidStack(Hydrazine, 2000),
+ },
new ItemStack[] {
- CI.emptyCells(2)
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Monomethylhydrazine, 4000),
+
},
- new int[] {10000},
- 20*48,
- 240);
+ 20 * 48,
+ 240,
+ 2);
}
@@ -143,14 +181,26 @@ public class RocketFuels extends ItemPackage {
CORE.RA.addAdvancedFreezerRecipe(new ItemStack[] {}, new FluidStack[] {FluidUtils.getFluidStack("hydrogen", 300)}, new FluidStack[] {FluidUtils.getFluidStack(Liquid_Hydrogen, 300)}, new ItemStack[] {}, new int[] {}, 20*4, 540, 0);
}
- private static void createHydratedAmmoniumNitrateSlurry() {
- GT_Values.RA.addChemicalRecipe(
- ItemUtils.getItemStackOfAmountFromOreDict("cellAmmonia", 8),
- ItemUtils.getItemStackOfAmountFromOreDict("cellNitricAcid", 8),
- null,
- FluidUtils.getFluidStack(Hydrated_Ammonium_Nitrate_Slurry, 22*144),
- null,
- 48*16);
+ private static void createHydratedAmmoniumNitrateSlurry() {
+
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedBioCircuit(21),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("ammonia", 4000),
+ FluidUtils.getFluidStack("nitricacid", 4000),
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Hydrated_Ammonium_Nitrate_Slurry, 8000),
+
+ },
+ 20 * 60,
+ 120,
+ 1);
}
@@ -162,22 +212,32 @@ public class RocketFuels extends ItemPackage {
new ItemStack[] {ItemUtils.getSimpleStack(Ammonium_Nitrate_Dust, 8)},
new int[] {10000},
90*20,
- 500);
+ 480);
}
- private static void createFormaldehyde() {
- CORE.RA.addDehydratorRecipe(
+ private static void createFormaldehyde() {
+
+ CORE.RA.addChemicalPlantRecipe(
new ItemStack[] {
- ItemUtils.getSimpleStack(Formaldehyde_Catalyst, 1),
- ItemUtils.getItemStackOfAmountFromOreDict("cellOxygen", 16)
+ CI.getNumberedBioCircuit(21),
+ ItemUtils.getSimpleStack(Formaldehyde_Catalyst, 0),
},
- FluidUtils.getFluidStack("methanol", 32000),
- FluidUtils.getFluidStack(Formaldehyde, 8000),
- new ItemStack[] {ItemUtils.getItemStackOfAmountFromOreDict("cellWater", 16)},
- new int[] {10000},
- 90*20,
- 120);
+ new FluidStack[] {
+ FluidUtils.getFluidStack("oxygen", 16000),
+ FluidUtils.getFluidStack("methanol", 32000),
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Formaldehyde, 8000),
+
+ },
+ 20 * 90,
+ 120,
+ 1);
+
}
private static void createFormaldehydeCatalyst() {
@@ -194,15 +254,29 @@ public class RocketFuels extends ItemPackage {
}
- private static void createUnsymmetricalDimethylhydrazine() {
- CORE.RA.addChemicalRecipe(
- ItemUtils.getItemStackOfAmountFromOreDict("cellHydrazine", 2),
- ItemUtils.getItemStackOfAmountFromOreDict("cellFormaldehyde", 2),
- FluidUtils.getFluidStack("hydrogen", 4000),
- FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine, 1000),
- ItemUtils.getItemStackOfAmountFromOreDict("cellWater", 2),
- ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 2),
- 20*60);
+ private static void createUnsymmetricalDimethylhydrazine() {
+
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedBioCircuit(21),
+ ItemUtils.getSimpleStack(Formaldehyde_Catalyst, 0),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("fluid.hydrazine", 2000),
+ FluidUtils.getFluidStack(Formaldehyde, 2000),
+ FluidUtils.getFluidStack("hydrogen", 4000),
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine, 2000),
+ FluidUtils.getWater(2000)
+
+ },
+ 20 * 60,
+ 120,
+ 2);
}
@@ -275,152 +349,93 @@ public class RocketFuels extends ItemPackage {
private static void createRocketFuels() {
- //Done
- GT_Values.RA.addCentrifugeRecipe(
- CI.getNumberedCircuit(23),
- ItemUtils.getItemStackOfAmountFromOreDict("cellLiquidOxygen", 2),
- FluidUtils.getFluidStack(RP1, 500),
- FluidUtils.getFluidStack(RP1_Plus_Liquid_Oxygen, 100),
- CI.emptyCells(2),
- null,
- null,
- null,
- null,
- null,
- new int[] {10000},
- 20*32,
- 480);
-
- GT_Values.RA.addCentrifugeRecipe(
- CI.getNumberedCircuit(23),
- ItemUtils.getItemStackOfAmountFromOreDict("cellRP1", 1),
- FluidUtils.getFluidStack(Liquid_Oxygen, 4000),
- FluidUtils.getFluidStack(RP1_Plus_Liquid_Oxygen, 200),
- CI.emptyCells(1),
- null,
- null,
- null,
- null,
- null,
- new int[] {10000},
- 20*64,
- 480);
-
- GT_Values.RA.addCentrifugeRecipe(
- CI.getNumberedCircuit(23),
- ItemUtils.getItemStackOfAmountFromOreDict("cellNitrogenTetroxide", 2),
- FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine, 2000),
- FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide, 1750),
- CI.emptyCells(2),
- null,
- null,
- null,
- null,
- null,
- new int[] {10000},
- 20*48,
- 480);
-
- ItemStack aCell11dimethylhydrazine = ItemUtils.getItemStackOfAmountFromOreDict("cell1,1Dimethylhydrazine", 2);
- if (ItemUtils.checkForInvalidItems(aCell11dimethylhydrazine)) {
- GT_Values.RA.addCentrifugeRecipe(
- CI.getNumberedCircuit(23),
- aCell11dimethylhydrazine,
- FluidUtils.getFluidStack(Nitrogen_Tetroxide, 2000),
- FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide, 1750),
- CI.emptyCells(2),
- null,
- null,
- null,
- null,
- null,
- new int[] {10000},
- 20*48,
- 480);
- }
- else {
- GT_Values.RA.addCentrifugeRecipe(
- CI.getNumberedCircuit(23),
- ItemUtils.getItemStackOfAmountFromOreDict("cellUnsymmetricalDimethylhydrazine", 2),
- FluidUtils.getFluidStack(Nitrogen_Tetroxide, 2000),
- FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide, 1750),
- CI.emptyCells(2),
- null,
- null,
- null,
- null,
- null,
- new int[] {10000},
- 20*48,
- 480);
- }
+ // RP1_Plus_Liquid_Oxygen
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(1),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Liquid_Oxygen, 2000),
+ FluidUtils.getFluidStack(RP1, 500),
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(RP1_Plus_Liquid_Oxygen, 1500),
+ },
+ 20 * 15,
+ 240,
+ 3);
- GT_Values.RA.addCentrifugeRecipe(
- CI.getNumberedCircuit(23),
- ItemUtils.getItemStackOfAmountFromOreDict("cellHydrazine", 4),
- FluidUtils.getFluidStack("methanol", 6000),
- FluidUtils.getFluidStack(Dense_Hydrazine_Mix, 10000),
- CI.emptyCells(4),
- null,
- null,
- null,
- null,
- null,
- new int[] {10000},
- 20*100,
- 240);
-
- GT_Values.RA.addCentrifugeRecipe(
- CI.getNumberedCircuit(23),
- ItemUtils.getItemStackOfAmountFromOreDict("cellMethanol", 6),
- FluidUtils.getFluidStack(Hydrazine, 4000),
- FluidUtils.getFluidStack(Dense_Hydrazine_Mix, 10000),
- CI.emptyCells(6),
- null,
- null,
- null,
- null,
- null,
- new int[] {10000},
- 20*100,
- 240);
-
- GT_Values.RA.addCentrifugeRecipe(
- CI.getNumberedCircuit(23),
- ItemUtils.getItemStackOfAmountFromOreDict("cellNitricAcid", 1),
- FluidUtils.getFluidStack(Monomethylhydrazine, 1000),
- FluidUtils.getFluidStack(Monomethylhydrazine_Plus_Nitric_Acid, 2000),
- CI.emptyCells(1),
- null,
- null,
- null,
- null,
- null,
- new int[] {10000},
- 20*32,
- 240);
-
- GT_Values.RA.addCentrifugeRecipe(
- CI.getNumberedCircuit(23),
- ItemUtils.getItemStackOfAmountFromOreDict("cellMonomethylhydrazine", 1),
- FluidUtils.getFluidStack("nitricacid", 1000),
- FluidUtils.getFluidStack(Monomethylhydrazine_Plus_Nitric_Acid, 2000),
- CI.emptyCells(1),
- null,
- null,
- null,
- null,
- null,
- new int[] {10000},
- 20*32,
- 240);
+
+ // Dense_Hydrazine_Mix
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(2),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Hydrazine, 4000),
+ FluidUtils.getFluidStack("methanol", 6000),
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Dense_Hydrazine_Mix, 10000),
+
+ },
+ 20 * 30,
+ 240,
+ 3);
+
+
+ // Monomethylhydrazine_Plus_Nitric_Acid
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(3),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Monomethylhydrazine, 1000),
+ FluidUtils.getFluidStack("nitricacid", 1000),
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Monomethylhydrazine_Plus_Nitric_Acid, 3000),
+
+ },
+ 20 * 45,
+ 480,
+ 3);
+
+
+ // Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(4),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine, 2000),
+ FluidUtils.getFluidStack(Nitrogen_Tetroxide, 2000),
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide, 4000),
+
+ },
+ 20 * 60,
+ 480,
+ 3);
}
@Override
public String errorMessage() {
- // TODO Auto-generated method stub
return "Bad Rocket Fuel Science!";
}
@@ -451,218 +466,9 @@ public class RocketFuels extends ItemPackage {
}
@Override
- public boolean onLoadComplete(FMLLoadCompleteEvent event) {
-
-
- if (MathUtils.randInt(1, 2) > 0) {
- return false;
- }
-
-
- Materials aMaterial_Chloramine = MaterialUtils.getMaterial("Chloramine");
- Materials aMaterial_Dimethylamine = MaterialUtils.getMaterial("Dimethylamine");
- Materials aMaterial_DilutedHydrochloricAcid = MaterialUtils.getMaterial("DilutedHydrochloricAcid");
- Materials aMaterial_NitrogenDioxide = MaterialUtils.getMaterial("NitrogenDioxide");
- Materials aMaterial_DinitrogenTetroxide = MaterialUtils.getMaterial("DinitrogenTetroxide");
- Materials aMaterial_Dimethylhydrazine = MaterialUtils.getMaterial("Dimethylhydrazine");
-
- Materials aMaterial_Oxygen = Materials.Oxygen;
- Materials aMaterial_Water = Materials.Water;
- Materials aMaterial_HypochlorousAcid = MaterialUtils.getMaterial("HypochlorousAcid");
- Materials aMaterial_Ammonia = MaterialUtils.getMaterial("Ammonia");
- Materials aMaterial_Methanol = MaterialUtils.getMaterial("Methanol");
-
- if (aMaterial_Chloramine == null || aMaterial_Dimethylamine == null || aMaterial_DilutedHydrochloricAcid == null
- || aMaterial_Dimethylhydrazine == null || aMaterial_NitrogenDioxide == null || aMaterial_DinitrogenTetroxide == null
- || aMaterial_HypochlorousAcid == null || aMaterial_Ammonia == null || aMaterial_Methanol == null) {
- return false;
- }
-
-
- MaterialHelper.getCells(aMaterial_Water, 1);
-
- ItemStack aCellEmpty = CI.emptyCells(1);
- ItemStack aCellWater = MaterialHelper.getCells(aMaterial_Water, 1);
- ItemStack aCellOxygen = MaterialHelper.getCells(aMaterial_Oxygen, 1);
- ItemStack aCellChloramine = MaterialHelper.getCells(aMaterial_Chloramine, 1);
- ItemStack aCellDimethylamine = MaterialHelper.getCells(aMaterial_Dimethylamine, 1);
- ItemStack aCellDilutedHydrochloricAcid = MaterialHelper.getCells(aMaterial_DilutedHydrochloricAcid, 1);
- ItemStack aCellNitrogenDioxide = MaterialHelper.getCells(aMaterial_NitrogenDioxide, 1);
- ItemStack aCellDinitrogenTetroxide = MaterialHelper.getCells(aMaterial_DinitrogenTetroxide, 1);
- ItemStack aCellDimethylhydrazine = MaterialHelper.getCells(aMaterial_Dimethylhydrazine, 1);
-
-
-
-
-
-
- GT_Recipe aChemReactor_1 = new Recipe_GT(
- true, //Optimise
- new ItemStack[] {}, //I
- new ItemStack[] {}, //O
- null, //Special
- new int[] {}, //Chance
- new FluidStack[] {}, //I
- new FluidStack[] {}, //O
- 0, //Dura
- 0, //Eu
- 0); //Special
-
- GT_Recipe aChemReactor_2 = new Recipe_GT(
- true, //Optimise
- new ItemStack[] {}, //I
- new ItemStack[] {}, //O
- null, //Special
- new int[] {}, //Chance
- new FluidStack[] {}, //I
- new FluidStack[] {}, //O
- 0, //Dura
- 0, //Eu
- 0); //Special
-
-
-
-
- GT_Recipe aChemReactor_Basic_1 = new Recipe_GT(
- true, //Optimise
- new ItemStack[] {}, //I
- new ItemStack[] {}, //O
- null, //Special
- new int[] {}, //Chance
- new FluidStack[] {}, //I
- new FluidStack[] {}, //O
- 0, //Dura
- 0, //Eu
- 0); //Special
-
- GT_Recipe aChemReactor_Basic_2 = new Recipe_GT(
- true, //Optimise
- new ItemStack[] {}, //I
- new ItemStack[] {}, //O
- null, //Special
- new int[] {}, //Chance
- new FluidStack[] {}, //I
- new FluidStack[] {}, //O
- 0, //Dura
- 0, //Eu
- 0); //Special
-
- GT_Recipe aChemReactor_Basic_3 = new Recipe_GT(
- true, //Optimise
- new ItemStack[] {}, //I
- new ItemStack[] {}, //O
- null, //Special
- new int[] {}, //Chance
- new FluidStack[] {}, //I
- new FluidStack[] {}, //O
- 0, //Dura
- 0, //Eu
- 0); //Special
-
- GT_Recipe aChemReactor_Basic_4 = new Recipe_GT(
- true, //Optimise
- new ItemStack[] {}, //I
- new ItemStack[] {}, //O
- null, //Special
- new int[] {}, //Chance
- new FluidStack[] {}, //I
- new FluidStack[] {}, //O
- 0, //Dura
- 0, //Eu
- 0); //Special
-
-
-
-
-
-
-
-
-
-
-
-
-
- GT_Recipe aChemReactor_Adv_1 = new Recipe_GT(
- true, //Optimise
- new ItemStack[] {}, //I
- new ItemStack[] {}, //O
- null, //Special
- new int[] {}, //Chance
- new FluidStack[] {}, //I
- new FluidStack[] {}, //O
- 0, //Dura
- 0, //Eu
- 0); //Special
-
- GT_Recipe aChemReactor_Adv_2 = new Recipe_GT(
- true, //Optimise
- new ItemStack[] {}, //I
- new ItemStack[] {}, //O
- null, //Special
- new int[] {}, //Chance
- new FluidStack[] {}, //I
- new FluidStack[] {}, //O
- 0, //Dura
- 0, //Eu
- 0); //Special
-
-
-
-
- //RecipeUtils.removeGtRecipe(aChemReactor_Basic_1, GT_Recipe.GT_Recipe_Map.sChemicalRecipes);
- //RecipeUtils.removeGtRecipe(aChemReactor_Basic_1, GT_Recipe.GT_Recipe_Map.sChemicalRecipes);
- //RecipeUtils.removeGtRecipe(aChemReactor_Basic_1, GT_Recipe.GT_Recipe_Map.sChemicalRecipes);
- //RecipeUtils.removeGtRecipe(aChemReactor_Basic_1, GT_Recipe.GT_Recipe_Map.sChemicalRecipes);
-
-
-
-
-
-
- /* GT_Values.RA.addChemicalRecipe( Materials.Chloramine.getCells(2), GT_Utility.getIntegratedCircuit(1), Materials.Dimethylamine.getGas(5000), Materials.Dimethylhydrazine.getFluid(6000), Materials.DilutedHydrochloricAcid.getCells(1), Materials.Empty.getCells(1), 960, 480);
- GT_Values.RA.addChemicalRecipe( Materials.Dimethylamine.getCells(5), GT_Utility.getIntegratedCircuit(1), Materials.Chloramine.getFluid(2000), Materials.Dimethylhydrazine.getFluid(6000), Materials.DilutedHydrochloricAcid.getCells(1), Materials.Empty.getCells(4), 960, 480);
- GT_Values.RA.addChemicalRecipeForBasicMachineOnly(Materials.Chloramine.getCells(2), Materials.Empty.getCells(4), Materials.Dimethylamine.getGas(5000), Materials.DilutedHydrochloricAcid.getFluid(1000), Materials.Dimethylhydrazine.getCells(6), GT_Values.NI, 960, 480);
- GT_Values.RA.addChemicalRecipeForBasicMachineOnly(Materials.Dimethylamine.getCells(5), Materials.Empty.getCells(1), Materials.Chloramine.getFluid(2000), Materials.DilutedHydrochloricAcid.getFluid(1000), Materials.Dimethylhydrazine.getCells(6), GT_Values.NI, 960, 480);
- GT_Values.RA.addChemicalRecipeForBasicMachineOnly(Materials.Dimethylamine.getCells(5), Materials.Chloramine.getCells(2), Materials.Chloramine.getFluid(2000), Materials.DilutedHydrochloricAcid.getFluid(1000), Materials.Dimethylhydrazine.getCells(6), Materials.DilutedHydrochloricAcid.getCells(1), 960, 480);
- GT_Values.RA.addMultiblockChemicalRecipe(new ItemStack[]{GT_Utility.getIntegratedCircuit(24)}, new FluidStack[]{Materials.HypochlorousAcid.getFluid(3000), Materials.Ammonia.getGas(8000), Materials.Methanol.getFluid(12000)}, new FluidStack[]{Materials.Dimethylhydrazine.getFluid(12000), Materials.DilutedHydrochloricAcid.getFluid(2000), Materials.Water.getFluid(9000)}, null, 1040, 480);
-
- GT_Values.RA.addChemicalRecipe(GT_Utility.getIntegratedCircuit(2), GT_Values.NI, Materials.NitrogenDioxide.getGas(1000), Materials.DinitrogenTetroxide.getGas(1000), GT_Values.NI, 640);
- GT_Values.RA.addChemicalRecipe(Materials.NitrogenDioxide.getCells(1), GT_Utility.getIntegratedCircuit(2), GT_Values.NF, Materials.DinitrogenTetroxide.getGas(1000), Materials.Empty.getCells(1), 640);
- GT_Values.RA.addChemicalRecipe(Materials.NitrogenDioxide.getCells(1), GT_Utility.getIntegratedCircuit(12), GT_Values.NF, GT_Values.NF, Materials.DinitrogenTetroxide.getCells(1), 640);
- GT_Values.RA.addMultiblockChemicalRecipe(new ItemStack[]{GT_Utility.getIntegratedCircuit(23)}, new FluidStack[]{Materials.Ammonia.getGas(8000), Materials.Oxygen.getGas(7000)}, new FluidStack[]{Materials.DinitrogenTetroxide.getGas(6000), Materials.Water.getFluid(9000)}, null, 480, 30);
- GT_Values.RA.addMultiblockChemicalRecipe(new ItemStack[]{GT_Utility.getIntegratedCircuit(23)}, new FluidStack[]{Materials.Nitrogen.getGas(2000), Materials.Hydrogen.getGas(6000), Materials.Oxygen.getGas(7000)}, new FluidStack[]{Materials.DinitrogenTetroxide.getGas(6000), Materials.Water.getFluid(9000)}, null, 1100, 480);
-
- GT_Values.RA.addMixerRecipe(Materials.Dimethylhydrazine.getCells(1), GT_Values.NI, GT_Values.NI, GT_Values.NI, Materials.DinitrogenTetroxide.getGas(1000), new FluidStack(ItemList.sRocketFuel, 2000), Materials.Empty.getCells(1), 60, 16);
- GT_Values.RA.addMixerRecipe(Materials.DinitrogenTetroxide.getCells(1), GT_Values.NI, GT_Values.NI, GT_Values.NI, Materials.Dimethylhydrazine.getFluid(1000), new FluidStack(ItemList.sRocketFuel, 2000), Materials.Empty.getCells(1), 60, 16);
- GT_Values.RA.addMixerRecipe(Materials.Dimethylhydrazine.getCells(2), GT_Values.NI, GT_Values.NI, GT_Values.NI, Materials.Oxygen.getGas(1000), new FluidStack(ItemList.sRocketFuel, 3000), Materials.Empty.getCells(2), 60, 16);
- GT_Values.RA.addMixerRecipe(Materials.Oxygen.getCells(1), GT_Values.NI, GT_Values.NI, GT_Values.NI, Materials.Dimethylhydrazine.getFluid(2000), new FluidStack(ItemList.sRocketFuel, 3000), Materials.Empty.getCells(1), 60, 16);
-
-
- */
-
-
-
-
-
-
-
-
-
- //Get Rocket Fuel
-
- //Find recipes using default values
-
- //Remove
-
- //Rebake map
-
- return true;
- };
-
- @Override
public void items() {
Formaldehyde_Catalyst = ItemUtils.generateSpecialUseDusts("FormaldehydeCatalyst", "Formaldehyde Catalyst", "Fe16V1", Utils.rgbtoHexValue(25, 5, 25))[0];
+ Formaldehyde_Catalyst_Stack = ItemUtils.getSimpleStack(Formaldehyde_Catalyst);
}
@Override
@@ -674,7 +480,7 @@ public class RocketFuels extends ItemPackage {
//Register default fluids
Diesel = MaterialUtils.getMaterial("Fuel", "Diesel").getFluid(1).getFluid();
-
+
// 5.08 Compat
if (!FluidUtils.doesFluidExist("liquid_heavy_oil")){
Oil_Heavy = FluidUtils.generateFluidNoPrefix("liquid_heavy_oil", "Heavy Oil", 200, new short[]{10, 10, 10, 100});
@@ -763,7 +569,7 @@ public class RocketFuels extends ItemPackage {
}
}
- Formaldehyde = FluidUtils.generateFluidNonMolten("Formaldehyde", "Formaldehyde", -92, new short[]{150, 75, 150, 100}, null, null);
+ Formaldehyde = FluidUtils.generateFluidNonMolten("Formaldehyde", "Formaldehyde", 185, new short[]{150, 75, 150, 100}, null, null);
Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide = FluidUtils.generateFluidNonMolten("RocketFuelMixA", "H8N4C2O4 Rocket Fuel", -185, new short[]{50, 220, 50, 100}, null, null);
RP1_Plus_Liquid_Oxygen = FluidUtils.generateFluidNonMolten("RocketFuelMixB", "Rp-1 Rocket Fuel", -250, new short[]{250, 50, 50, 100}, null, null);
@@ -773,6 +579,469 @@ public class RocketFuels extends ItemPackage {
}
+ @Override
+ public boolean onLoadComplete(FMLLoadCompleteEvent event) {
+
+ Logger.INFO("Trying to remove GT recipes for '1,1dimethylhydrazine' && 'rocket_fuel' if they exist.");
+ /*if (FluidRegistry.isFluidRegistered("1,1dimethylhydrazine")) {
+
+ // Try Remove recipes for GT/EIO Rocket Fuel Cells
+ if (FluidRegistry.isFluidRegistered("rocket_fuel")) {
+
+ // Old Recipe
+ if (MaterialUtils.doesMaterialExist("NitrogenDioxide")) {
+ GT_Recipe aOldRecipe = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellNitrogenDioxide", 1),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogen", 3),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("air", 500)
+ },
+ 388);
+ boolean aDidRemove = removeRecipe(aOldRecipe, GT_Recipe_Map.sChemicalRecipes);
+ Logger.INFO("Removed Old Recipe for Rocket Fuel: "+aDidRemove);
+ }
+
+ // Simple Recipes
+ if (MaterialUtils.doesMaterialExist("Ammonia") && MaterialUtils.doesMaterialExist("Methanol")) {
+
+ GT_Recipe aSimpleRecipe1 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellAmmonia", 3),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellMethanol", 4),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("chlorine", 1000)
+ },
+ 480);
+ GT_Recipe aSimpleRecipe2 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellChlorine", 1),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellMethanol", 4),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("ammonia", 3000)
+ },
+ 480);
+ GT_Recipe aSimpleRecipe3 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellAmmonia", 3),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellChlorine", 1),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("methanol", 4000)
+ },
+ 480);
+
+ boolean aDidRemove1 = removeRecipe(aSimpleRecipe1, GT_Recipe_Map.sChemicalRecipes);
+ boolean aDidRemove2 = removeRecipe(aSimpleRecipe2, GT_Recipe_Map.sChemicalRecipes);
+ boolean aDidRemove3 = removeRecipe(aSimpleRecipe3, GT_Recipe_Map.sChemicalRecipes);
+ Logger.INFO("Removed Simple Recipe 1 for Rocket Fuel: "+aDidRemove1);
+ Logger.INFO("Removed Simple Recipe 2 for Rocket Fuel: "+aDidRemove2);
+ Logger.INFO("Removed Simple Recipe 3 for Rocket Fuel: "+aDidRemove3);
+ }
+
+
+ // Complex Recipes I
+ if (MaterialUtils.doesMaterialExist("Dimethylhydrazine") && MaterialUtils.doesMaterialExist("DinitrogenTetroxide")) {
+
+ GT_Recipe aAdvRecipe1 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylhydrazine", 1),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("dinitrogentetroxide", 1000)
+ },
+ 16);
+ GT_Recipe aAdvRecipe2 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellDinitrogenTetroxide", 1),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("dimethylhydrazine", 1000)
+ },
+ 16);
+
+ GT_Recipe aAdvRecipe3 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylhydrazine", 2),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("oxygen", 1000)
+ },
+ 16);
+ GT_Recipe aAdvRecipe4 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellOxygen", 1),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("dimethylhydrazine", 2000)
+ },
+ 16);
+
+ boolean aDidRemove1 = removeRecipe(aAdvRecipe1, GT_Recipe_Map.sMixerRecipes);
+ boolean aDidRemove2 = removeRecipe(aAdvRecipe2, GT_Recipe_Map.sMixerRecipes);
+ boolean aDidRemove3 = removeRecipe(aAdvRecipe3, GT_Recipe_Map.sMixerRecipes);
+ boolean aDidRemove4 = removeRecipe(aAdvRecipe4, GT_Recipe_Map.sMixerRecipes);
+ Logger.INFO("Removed Complex Recipe 1 for Rocket Fuel: "+aDidRemove1);
+ Logger.INFO("Removed Complex Recipe 2 for Rocket Fuel: "+aDidRemove2);
+ Logger.INFO("Removed Complex Recipe 3 for Rocket Fuel: "+aDidRemove3);
+ Logger.INFO("Removed Complex Recipe 4 for Rocket Fuel: "+aDidRemove4);
+ }
+ }
+
+
+ // Complex Recipes II
+ if (MaterialUtils.doesMaterialExist("Dimethylhydrazine")) {
+
+ GT_Recipe aAdvRecipe1 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylhydrazine", 2),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("oxygen", 1000)
+ },
+ 16);
+ GT_Recipe aAdvRecipe2 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellOxygen", 1),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("dimethylhydrazine", 2000)
+ },
+ 16);
+
+ boolean aDidRemove1 = removeRecipe(aAdvRecipe1, GT_Recipe_Map.sMixerRecipes);
+ boolean aDidRemove2 = removeRecipe(aAdvRecipe2, GT_Recipe_Map.sMixerRecipes);
+ Logger.INFO("Removed Complex Recipe 5 for Rocket Fuel: "+aDidRemove1);
+ Logger.INFO("Removed Complex Recipe 6 for Rocket Fuel: "+aDidRemove2);
+ }
+
+ if (MaterialUtils.doesMaterialExist("Chloramine") && MaterialUtils.doesMaterialExist("Dimethylamine")) {
+ GT_Recipe aSimpleRecipe1 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellChloramine", 2),
+ GT_Utility.getIntegratedCircuit(1)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("dimethylamine", 5000)
+ },
+ 480);
+ GT_Recipe aSimpleRecipe2 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylamine", 5),
+ GT_Utility.getIntegratedCircuit(1)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("chloramine", 2000)
+ },
+ 16);
+
+
+
+ GT_Recipe aAdvRecipe1 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellChloramine", 2),
+ CI.emptyCells(4)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("dimethylamine", 5000)
+ },
+ 480);
+ GT_Recipe aAdvRecipe2 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylamine", 5),
+ CI.emptyCells(1)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("chloramine", 2000)
+ },
+ 16);
+ GT_Recipe aAdvRecipe3 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellChloramine", 2),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylamine", 5),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("chloramine", 2000)
+ },
+ 480);
+
+ boolean aDidRemove1 = removeRecipe(aSimpleRecipe1, GT_Recipe_Map.sChemicalRecipes);
+ boolean aDidRemove2 = removeRecipe(aSimpleRecipe2, GT_Recipe_Map.sChemicalRecipes);
+ boolean aDidRemove3 = removeRecipe(aAdvRecipe1, GT_Recipe_Map.sChemicalRecipes);
+ boolean aDidRemove4 = removeRecipe(aAdvRecipe2, GT_Recipe_Map.sChemicalRecipes);
+ boolean aDidRemove5 = removeRecipe(aAdvRecipe3, GT_Recipe_Map.sChemicalRecipes);
+ Logger.INFO("Removed Complex Recipe 1 for 1,1dimethylhydrazine: "+aDidRemove1);
+ Logger.INFO("Removed Complex Recipe 2 for 1,1dimethylhydrazine: "+aDidRemove2);
+ Logger.INFO("Removed Complex Recipe 3 for 1,1dimethylhydrazine: "+aDidRemove3);
+ Logger.INFO("Removed Complex Recipe 4 for 1,1dimethylhydrazine: "+aDidRemove4);
+ Logger.INFO("Removed Complex Recipe 5 for 1,1dimethylhydrazine: "+aDidRemove5);
+
+ }
+
+ if (MaterialUtils.doesMaterialExist("Chloramine") && MaterialUtils.doesMaterialExist("Dimethylamine")) {
+ GT_Recipe aSimpleRecipe1 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellChloramine", 1),
+ GT_Utility.getIntegratedCircuit(1)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("dimethylamine", 1000)
+ },
+ 480);
+ GT_Recipe aSimpleRecipe2 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylamine", 1),
+ GT_Utility.getIntegratedCircuit(1)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("chloramine", 1000)
+ },
+ 16);
+
+
+
+ GT_Recipe aAdvRecipe1 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellChloramine", 1),
+ GT_Utility.getIntegratedCircuit(11)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("dimethylamine", 1000)
+ },
+ 480);
+ GT_Recipe aAdvRecipe2 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylamine", 1),
+ GT_Utility.getIntegratedCircuit(11)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("chloramine", 1000)
+ },
+ 16);
+
+ boolean aDidRemove1 = removeRecipe(aSimpleRecipe1, GT_Recipe_Map.sChemicalRecipes);
+ boolean aDidRemove2 = removeRecipe(aSimpleRecipe2, GT_Recipe_Map.sChemicalRecipes);
+ boolean aDidRemove3 = removeRecipe(aAdvRecipe1, GT_Recipe_Map.sChemicalRecipes);
+ boolean aDidRemove4 = removeRecipe(aAdvRecipe2, GT_Recipe_Map.sChemicalRecipes);
+ Logger.INFO("Removed Complex Recipe 5 for 1,1dimethylhydrazine: "+aDidRemove1);
+ Logger.INFO("Removed Complex Recipe 6 for 1,1dimethylhydrazine: "+aDidRemove2);
+ Logger.INFO("Removed Complex Recipe 7 for 1,1dimethylhydrazine: "+aDidRemove3);
+ Logger.INFO("Removed Complex Recipe 8 for 1,1dimethylhydrazine: "+aDidRemove4);
+
+ }
+
+ if (MaterialUtils.doesMaterialExist("HypochlorousAcid") && MaterialUtils.doesMaterialExist("Ammonia") && MaterialUtils.doesMaterialExist("Methanol")) {
+
+ GT_Recipe aAdvRecipe1 = getHalfBakedRecipe(
+ new ItemStack[] {
+ GT_Utility.getIntegratedCircuit(24),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("hypochlorousacid", 3000),
+ FluidUtils.getFluidStack("ammonia", 8000),
+ FluidUtils.getFluidStack("methanol", 12000)
+ },
+ 480);
+
+ GT_Recipe aAdvRecipe2 = getHalfBakedRecipe(
+ new ItemStack[] {
+ GT_Utility.getIntegratedCircuit(24),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("hypochlorousacid", 1000),
+ FluidUtils.getFluidStack("ammonia", 1000),
+ FluidUtils.getFluidStack("methanol", 2000)
+ },
+ 480);
+
+ boolean aDidRemove1 = removeRecipe(aAdvRecipe1, StaticFields59.getLargeChemicalReactorRecipeMap());
+ boolean aDidRemove2 = removeRecipe(aAdvRecipe2, StaticFields59.getLargeChemicalReactorRecipeMap());
+ Logger.INFO("Removed Complex Recipe 9 for 1,1dimethylhydrazine: "+aDidRemove1);
+ Logger.INFO("Removed Complex Recipe 10 for 1,1dimethylhydrazine: "+aDidRemove2);
+
+
+ }
+ }*/
+
+ // Try Butcher recipes manually
+
+ //1,1Dimethylhydrazine
+ if (FluidRegistry.isFluidRegistered("1,1dimethylhydrazine")) {
+ Logger.INFO("Making sure all Chemical Reactor recipes for 1,1dimethylhydrazine have been removed.");
+ AutoMap<GT_Recipe> aToRemoveSingle = new AutoMap<GT_Recipe>();
+ ItemStack aUnsymCell = ItemUtils.getItemStackOfAmountFromOreDict("cell1,1Dimethylhydrazine", 1);
+ FluidStack aUnsymFluid = FluidUtils.getFluidStack("1,1dimethylhydrazine", 1);
+ recipe : for (GT_Recipe aRecipeSingleBlock : GT_Recipe_Map.sChemicalRecipes.mRecipeList) {
+ if (aRecipeSingleBlock != null && aRecipeSingleBlock.mEnabled) {
+ if (aRecipeSingleBlock.mOutputs != null && aRecipeSingleBlock.mOutputs.length > 0) {
+ for (ItemStack aOutputItem : aRecipeSingleBlock.mOutputs) {
+ ItemStack aTemp = aOutputItem.copy();
+ aTemp.stackSize = 1;
+ if (GT_Utility.areStacksEqual(aTemp, aUnsymCell)) {
+ aToRemoveSingle.add(aRecipeSingleBlock);
+ continue recipe;
+ }
+ }
+ }
+ if (aRecipeSingleBlock.mFluidOutputs != null && aRecipeSingleBlock.mFluidOutputs.length > 0) {
+ for (FluidStack aOutput : aRecipeSingleBlock.mFluidOutputs) {
+ if (GT_Utility.areFluidsEqual(aOutput, aUnsymFluid)) {
+ aToRemoveSingle.add(aRecipeSingleBlock);
+ continue recipe;
+ }
+ }
+ }
+ }
+ }
+ // Handle Multi Also
+ AutoMap<GT_Recipe> aToRemoveMulti = new AutoMap<GT_Recipe>();
+ recipe : for (GT_Recipe aRecipeSingleBlock : StaticFields59.getLargeChemicalReactorRecipeMap().mRecipeList) {
+ if (aRecipeSingleBlock != null && aRecipeSingleBlock.mEnabled) {
+ if (aRecipeSingleBlock.mOutputs != null && aRecipeSingleBlock.mOutputs.length > 0) {
+ for (ItemStack aOutputItem : aRecipeSingleBlock.mOutputs) {
+ ItemStack aTemp = aOutputItem.copy();
+ aTemp.stackSize = 1;
+ if (GT_Utility.areStacksEqual(aTemp, aUnsymCell)) {
+ aToRemoveMulti.add(aRecipeSingleBlock);
+ continue recipe;
+ }
+ }
+ }
+ if (aRecipeSingleBlock.mFluidOutputs != null && aRecipeSingleBlock.mFluidOutputs.length > 0) {
+ for (FluidStack aOutput : aRecipeSingleBlock.mFluidOutputs) {
+ if (GT_Utility.areFluidsEqual(aOutput, aUnsymFluid)) {
+ aToRemoveMulti.add(aRecipeSingleBlock);
+ continue recipe;
+ }
+ }
+ }
+ }
+ }
+ if (!aToRemoveSingle.isEmpty()) {
+ Logger.INFO("Found "+aToRemoveSingle.size()+" single block recipes, removing by force.");
+ for (GT_Recipe remove : aToRemoveSingle) {
+ GT_Recipe_Map.sChemicalRecipes.mRecipeList.remove(remove);
+ }
+ }
+ if (!aToRemoveMulti.isEmpty()) {
+ Logger.INFO("Found "+aToRemoveSingle.size()+" multiblock recipes, removing by force.");
+ for (GT_Recipe remove : aToRemoveMulti) {
+ StaticFields59.getLargeChemicalReactorRecipeMap().mRecipeList.remove(remove);
+ }
+ }
+ }
+
+
+ if (FluidRegistry.isFluidRegistered("rocket_fuel")) {
+ Logger.INFO("Making sure all Mixer recipes for rocket_fuel have been removed.");
+ AutoMap<GT_Recipe> aToRemoveSingle = new AutoMap<GT_Recipe>();
+ FluidStack aRocketFluid = FluidUtils.getFluidStack("rocket_fuel", 1);
+ recipe : for (GT_Recipe aRecipeSingleBlock : GT_Recipe_Map.sMixerRecipes.mRecipeList) {
+ if (aRecipeSingleBlock != null && aRecipeSingleBlock.mEnabled) {
+ if (aRecipeSingleBlock.mFluidOutputs != null && aRecipeSingleBlock.mFluidOutputs.length > 0) {
+ for (FluidStack aOutput : aRecipeSingleBlock.mFluidOutputs) {
+ if (GT_Utility.areFluidsEqual(aOutput, aRocketFluid)) {
+ aToRemoveSingle.add(aRecipeSingleBlock);
+ continue recipe;
+ }
+ }
+ }
+ }
+ }
+ if (!aToRemoveSingle.isEmpty()) {
+ Logger.INFO("Found "+aToRemoveSingle.size()+" recipes, removing by force.");
+ for (GT_Recipe remove : aToRemoveSingle) {
+ GT_Recipe_Map.sMixerRecipes.mRecipeList.remove(remove);
+ }
+ aToRemoveSingle.clear();
+ }
+
+ Logger.INFO("Making sure all Chemical Reactor recipes for rocket_fuel have been removed.");
+ recipe : for (GT_Recipe aRecipeSingleBlock : GT_Recipe_Map.sChemicalRecipes.mRecipeList) {
+ if (aRecipeSingleBlock != null && aRecipeSingleBlock.mEnabled) {
+ if (aRecipeSingleBlock.mFluidOutputs != null && aRecipeSingleBlock.mFluidOutputs.length > 0) {
+ for (FluidStack aOutput : aRecipeSingleBlock.mFluidOutputs) {
+ if (GT_Utility.areFluidsEqual(aOutput, aRocketFluid)) {
+ aToRemoveSingle.add(aRecipeSingleBlock);
+ continue recipe;
+ }
+ }
+ }
+ }
+ }
+ // Handle Multi Also
+ AutoMap<GT_Recipe> aToRemoveMulti = new AutoMap<GT_Recipe>();
+ recipe : for (GT_Recipe aRecipeSingleBlock : StaticFields59.getLargeChemicalReactorRecipeMap().mRecipeList) {
+ if (aRecipeSingleBlock != null && aRecipeSingleBlock.mEnabled) {
+ if (aRecipeSingleBlock.mFluidOutputs != null && aRecipeSingleBlock.mFluidOutputs.length > 0) {
+ for (FluidStack aOutput : aRecipeSingleBlock.mFluidOutputs) {
+ if (GT_Utility.areFluidsEqual(aOutput, aRocketFluid)) {
+ aToRemoveMulti.add(aRecipeSingleBlock);
+ continue recipe;
+ }
+ }
+ }
+ }
+ }
+ if (!aToRemoveSingle.isEmpty()) {
+ Logger.INFO("Found "+aToRemoveSingle.size()+" single block recipes, removing by force.");
+ for (GT_Recipe remove : aToRemoveSingle) {
+ GT_Recipe_Map.sChemicalRecipes.mRecipeList.remove(remove);
+ }
+ }
+ if (!aToRemoveMulti.isEmpty()) {
+ Logger.INFO("Found "+aToRemoveSingle.size()+" multiblock recipes, removing by force.");
+ for (GT_Recipe remove : aToRemoveMulti) {
+ StaticFields59.getLargeChemicalReactorRecipeMap().mRecipeList.remove(remove);
+ }
+ }
+
+ }
+
+
+
+ Logger.INFO("Finished clean-up of GT Rocket Fuel Recipes.");
+ return true;
+ }
+
+ private static Recipe_GT getHalfBakedRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, int aEU) {
+ return new Recipe_GT(false, aInputs, null, null, null, aFluidInputs, null, 0, aEU, 0);
+
+ }
+
+ public static boolean removeRecipe(GT_Recipe aRecipe, GT_Recipe_Map aMap) {
+ if (aMap != GT_Recipe_Map.sChemicalRecipes) {
+ GT_Recipe aFoundRecipe = aMap.findRecipe(null, false, true, aRecipe.mEUt, aRecipe.mFluidInputs, aRecipe.mInputs);
+ boolean aSingle = false;
+ if (aFoundRecipe != null) {
+ Logger.INFO("Found Single Block Recipe, removing.");
+ aSingle = aMap.mRecipeList.remove(aFoundRecipe);
+ Logger.INFO("Success? "+aSingle);
+ }
+ return aSingle;
+ }
+ else {
+ GT_Recipe aFoundRecipe = aMap.findRecipe(null, false, true, aRecipe.mEUt, aRecipe.mFluidInputs, aRecipe.mInputs);
+ GT_Recipe aFoundRecipe2 = StaticFields59.getLargeChemicalReactorRecipeMap().findRecipe(null, false, true, aRecipe.mEUt, aRecipe.mFluidInputs, aRecipe.mInputs);
+ boolean aSingle = false;
+ boolean aMulti = false;
+ if (aFoundRecipe != null) {
+ Logger.INFO("Found Single Block Recipe, removing.");
+ aSingle = GT_Recipe_Map.sChemicalRecipes.mRecipeList.remove(aFoundRecipe);
+ Logger.INFO("Success? "+aSingle);
+ }
+ if (aFoundRecipe2 != null) {
+ Logger.INFO("Found Multiblock Recipe, removing.");
+ aMulti = StaticFields59.getLargeChemicalReactorRecipeMap().mRecipeList.remove(aFoundRecipe2);
+ Logger.INFO("Success? "+aSingle);
+ }
+ return aSingle && aMulti;
+ }
+ }
+
}
diff --git a/src/Java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java b/src/Java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java
index 208fecd57c..7fb5f207f6 100644
--- a/src/Java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java
+++ b/src/Java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java
@@ -19,7 +19,7 @@ public class ItemGenericChemBase extends Item {
final protected IIcon base[];
- final private int aMetaSize = 7;
+ final private int aMetaSize = 9;
/*
* 0 - Red Metal Catalyst //FeCu
@@ -29,7 +29,8 @@ public class ItemGenericChemBase extends Item {
* 4 - Purple Metal Catalyst //IrIdium Ruthenium
* 5 - Brown Metal Catalyst //NiAl
* 6 - Pink Metal Catalyst //PtRh
- *
+ * 7 - Alumina Grinding Ball
+ * 8 - Soapstone Grinding Ball
*/
public ItemGenericChemBase() {
diff --git a/src/Java/gtPlusPlus/core/item/food/BaseItemMetaFood.java b/src/Java/gtPlusPlus/core/item/food/BaseItemMetaFood.java
new file mode 100644
index 0000000000..94d5a8e80f
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/food/BaseItemMetaFood.java
@@ -0,0 +1,431 @@
+package gtPlusPlus.core.item.food;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.item.ModItems;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.EntityUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemFood;
+import net.minecraft.item.ItemStack;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+
+public class BaseItemMetaFood extends ItemFood {
+
+ private static final HashMap<Integer, IIcon> mIconMap = new HashMap<Integer, IIcon>();
+ private static int mTotalMetaItems = 0;
+
+ /*
+ * 0 - Raw Human Meat
+ * 1 - Cooked Human Meat
+ * 2 - Raw Horse Meat
+ * 3 - Cooked Horse Meat
+ * 4 - Raw Wolf Meat
+ * 5 - Cooked Wolf Meat
+ * 6 - Raw Ocelot Meat
+ * 7 - Cooked Ocelot Meat
+ * 8 - Blaze Flesh
+ */
+
+ //listAllmeatraw
+ //listAllmeatcooked
+
+ public static void registerMetaFoods() {
+ registerNewMetaFood(0, "I wouldn't eat this unless I was starving", 2, 0, 64, getPotionEffectPackage(new EffectWeaknessModerate(80), new EffectSlownessModerate(80)), getOreDictNamesAsArrayList("listAllmeatraw"));
+ registerNewMetaFood(1, "Doesn't look any better cooked", 4, 1, 64, getPotionEffectPackage(new EffectWeaknessBasic(50), new EffectSlownessBasic(50)), getOreDictNamesAsArrayList("listAllmeatcooked"));
+ registerNewMetaFood(2, "", 2, 0, 64, getPotionEffectPackage(new EffectWeaknessBasic(30), new EffectSlownessBasic(30)), getOreDictNamesAsArrayList("listAllmeatraw"));
+ registerNewMetaFood(3, "", 4, 1, 64, getOreDictNamesAsArrayList("listAllmeatcooked"));
+ registerNewMetaFood(4, "", 2, 0, 64, getPotionEffectPackage(new EffectWeaknessBasic(25), new EffectSlownessBasic(30)), getOreDictNamesAsArrayList("listAllmeatraw"));
+ registerNewMetaFood(5, "", 4, 1, 64, getOreDictNamesAsArrayList("listAllmeatcooked"));
+ registerNewMetaFood(6, "", 2, 0, 64, getPotionEffectPackage(new EffectWeaknessBasic(30), new EffectSlownessBasic(25)), getOreDictNamesAsArrayList("listAllmeatraw"));
+ registerNewMetaFood(7, "", 4, 1, 64, getOreDictNamesAsArrayList("listAllmeatcooked"));
+ registerNewMetaFood(8, "Warm to the touch", EnumRarity.uncommon, 4, 1, 64, new AutoMap<PotionEffectPackage>(), new setOnFire(), getOreDictNamesAsArrayList("listAllmeatcooked"));
+ }
+
+ private static final HashMap<Integer, Integer> mMaxStackSizeMap = new HashMap<Integer, Integer>();
+ private static final HashMap<Integer, String> mTooltipMap = new HashMap<Integer, String>();
+ private static final HashMap<Integer, EnumRarity> mRarityMap = new HashMap<Integer, EnumRarity>();
+ private static final HashMap<Integer, Integer> mHealAmountMap = new HashMap<Integer, Integer>();
+ private static final HashMap<Integer, Float> mSaturationAmountMap = new HashMap<Integer, Float>();
+ private static final HashMap<Integer, AutoMap<PotionEffectPackage>> mPotionEffectsMap = new HashMap<Integer, AutoMap<PotionEffectPackage>>();
+ private static final HashMap<Integer, Boolean> mHasSpecialBehaviourMap = new HashMap<Integer, Boolean>();
+ private static final HashMap<Integer, SpecialFoodBehaviour> mSpecialBehaviourMap = new HashMap<Integer, SpecialFoodBehaviour>();
+ private static final HashMap<Integer, ArrayList<String>> mOreDictNames = new HashMap<Integer, ArrayList<String>>();
+
+
+ public static void registerNewMetaFood(final int aMetaID, String aTooltip, final int aHealAmount, final float aSaturationModifier, final int aMaxStacksize) {
+ registerNewMetaFood(aMetaID, aTooltip, EnumRarity.common, aHealAmount, aSaturationModifier, aMaxStacksize, new AutoMap<PotionEffectPackage>(), null, new ArrayList<String>());
+ }
+
+ public static void registerNewMetaFood(final int aMetaID, String aTooltip, final int aHealAmount, final float aSaturationModifier, final int aMaxStacksize, final ArrayList<String> aOreDictNames) {
+ registerNewMetaFood(aMetaID, aTooltip, EnumRarity.common, aHealAmount, aSaturationModifier, aMaxStacksize, new AutoMap<PotionEffectPackage>(), null, aOreDictNames);
+ }
+
+
+ public static void registerNewMetaFood(final int aMetaID, String aTooltip, final int aHealAmount, final float aSaturationModifier, final int aMaxStacksize, final AutoMap<PotionEffectPackage> aPotionEffects) {
+ registerNewMetaFood(aMetaID, aTooltip, EnumRarity.common, aHealAmount, aSaturationModifier, aMaxStacksize, new AutoMap<PotionEffectPackage>(), null, new ArrayList<String>());
+ }
+
+ public static void registerNewMetaFood(final int aMetaID, String aTooltip, final int aHealAmount, final float aSaturationModifier, final int aMaxStacksize, final AutoMap<PotionEffectPackage> aPotionEffects, final ArrayList<String> aOreDictNames) {
+ registerNewMetaFood(aMetaID, aTooltip, EnumRarity.common, aHealAmount, aSaturationModifier, aMaxStacksize, aPotionEffects, null, aOreDictNames);
+ }
+
+ public static void registerNewMetaFood(final int aMetaID, String aTooltip, EnumRarity aRarity, final int aHealAmount, final float aSaturationModifier, final int aMaxStacksize, final AutoMap<PotionEffectPackage> aPotionEffects, final SpecialFoodBehaviour aSpecialBehaviour) {
+ registerNewMetaFood(aMetaID, aTooltip, EnumRarity.common, aHealAmount, aSaturationModifier, aMaxStacksize, aPotionEffects, null, new ArrayList<String>());
+ }
+
+ public static void registerNewMetaFood(final int aMetaID, String aTooltip, EnumRarity aRarity, final int aHealAmount, final float aSaturationModifier, final int aMaxStacksize, final AutoMap<PotionEffectPackage> aPotionEffects, final SpecialFoodBehaviour aSpecialBehaviour, final ArrayList<String> aOreDictNames) {
+ mTotalMetaItems++;
+ mMaxStackSizeMap.put(aMetaID, aMaxStacksize);
+ mTooltipMap.put(aMetaID, aTooltip);
+ mRarityMap.put(aMetaID, aRarity);
+ mHealAmountMap.put(aMetaID, aHealAmount);
+ mSaturationAmountMap.put(aMetaID, aSaturationModifier);
+ mPotionEffectsMap.put(aMetaID, aPotionEffects);
+ mHasSpecialBehaviourMap.put(aMetaID, (aSpecialBehaviour != null));
+ if (aSpecialBehaviour != null) {
+ mSpecialBehaviourMap.put(aMetaID, aSpecialBehaviour);
+ }
+ mOreDictNames.put(aMetaID, aOreDictNames);
+ }
+
+ public static void registerFoodsToOreDict() {
+ for (int aMetaID=0; aMetaID < mTotalMetaItems; aMetaID++) {
+ ArrayList<String> aOreDictNames = mOreDictNames.get(aMetaID);
+ if (aOreDictNames != null && !aOreDictNames.isEmpty()) {
+ ItemStack aFoodStack = ItemUtils.simpleMetaStack(ModItems.itemMetaFood, aMetaID, 1);
+ for (String aOreName : aOreDictNames) {
+ ItemUtils.addItemToOreDictionary(aFoodStack, aOreName);
+ }
+ }
+ }
+ }
+
+
+ public BaseItemMetaFood() {
+ super(0, 0, false);
+ this.setHasSubtypes(true);
+ this.setNoRepair();
+ this.setMaxStackSize(64);
+ this.setMaxDamage(0);
+ this.setUnlocalizedName("BasicMetaFood");
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ GameRegistry.registerItem(this, this.getUnlocalizedName());
+ BaseItemMetaFood.registerMetaFoods();
+ }
+
+ private static final int getMetaKey(ItemStack aStack) {
+ return aStack.getItemDamage();
+ }
+
+ // Heal Amount
+ public int func_150905_g(ItemStack aStack) {
+ return mHealAmountMap.get(getMetaKey(aStack));
+ }
+
+ // Saturation Amount
+ public float func_150906_h(ItemStack aStack) {
+ return mSaturationAmountMap.get(getMetaKey(aStack));
+ }
+
+ // Whether wolves like this food, sadly doesn't support meta items
+ public boolean isWolfsFavoriteMeat() {
+ return false;
+ }
+
+ @Override
+ protected void onFoodEaten(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) {
+ //super.onFoodEaten(stack, world, player);
+ AutoMap<PotionEffectPackage> aPotionEffects = mPotionEffectsMap.get(getMetaKey(aStack));
+ if (!aWorld.isRemote && aPotionEffects != null && aPotionEffects.size() > 0) {
+ for (PotionEffectPackage aFoodEffect : aPotionEffects) {
+ if (MathUtils.randInt(0, 100) <= aFoodEffect.getChance() || aFoodEffect.getChance() == 100) {
+ PotionEffect aEffect = aFoodEffect.getEffect();
+ if (aEffect != null && aEffect.getPotionID() > 0) {
+ aPlayer.addPotionEffect(new PotionEffect(aEffect.getPotionID(), aEffect.getDuration() * 20, aEffect.getAmplifier(), aEffect.getIsAmbient()));
+ }
+ }
+ }
+ }
+
+ boolean aHasEpcialBehaviour = mHasSpecialBehaviourMap.get(getMetaKey(aStack));
+ if (!aWorld.isRemote && aHasEpcialBehaviour) {
+ SpecialFoodBehaviour aBehaviour = mSpecialBehaviourMap.get(getMetaKey(aStack));
+ if (aBehaviour != null) {
+ aBehaviour.doBehaviour(aPlayer);
+ }
+ }
+ }
+
+ @Override
+ public ItemStack onEaten(ItemStack aStack, World aWorld, EntityPlayer aPlayer) {
+ return super.onEaten(aStack, aWorld, aPlayer);
+ }
+
+
+ @Override
+ public int getItemStackLimit(ItemStack aStack) {
+ return mMaxStackSizeMap.get(getMetaKey(aStack));
+ }
+
+
+ @Override
+ public boolean isDamageable() {
+ return false;
+ }
+
+ @Override
+ public boolean shouldRotateAroundWhenRendering() {
+ return super.shouldRotateAroundWhenRendering();
+ }
+
+ @Override
+ public void onUpdate(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) {
+ super.onUpdate(p_77663_1_, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_);
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack aStack) {
+ return super.getItemStackDisplayName(aStack);
+ }
+
+ @Override
+ public void addInformation(ItemStack aStack, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) {
+ try {
+ String aTooltip = mTooltipMap.get(getMetaKey(aStack));
+ if (aTooltip != null && aTooltip.length() > 0) {
+ aList.add(aTooltip);
+ }
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ super.addInformation(aStack, p_77624_2_, aList, p_77624_4_);
+ }
+
+ @Override
+ public EnumRarity getRarity(ItemStack aStack) {
+ return mRarityMap.get(getMetaKey(aStack));
+ }
+
+ @Override
+ public boolean requiresMultipleRenderPasses() {
+ return false;
+ }
+
+ @Override
+ public void getSubItems(Item aItem, CreativeTabs p_150895_2_, List aList) {
+ for (int i=0;i<mIconMap.size();i++) {
+ aList.add(ItemUtils.simpleMetaStack(aItem, i, 1));
+ }
+ }
+
+ @Override
+ public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) {
+ return false;
+ }
+
+ @Override
+ public boolean isRepairable() {
+ return false;
+ }
+
+ @Override
+ public boolean isBookEnchantable(ItemStack stack, ItemStack book) {
+ return false;
+ }
+
+ @Override
+ public int getDisplayDamage(ItemStack stack) {
+ return stack.getItemDamage();
+ }
+
+ @Override
+ public boolean showDurabilityBar(ItemStack stack) {
+ return false;
+ }
+
+ @Override
+ public int getItemEnchantability() {
+ return 0;
+ }
+
+ @Override
+ public int getItemEnchantability(ItemStack stack) {
+ return 0;
+ }
+
+ @Override
+ public void registerIcons(final IIconRegister u) {
+ for (int i=0;i<mTotalMetaItems;i++) {
+ String aPath = CORE.MODID + ":" + "food/MetaItem1/"+i;
+ mIconMap.put(i, u.registerIcon(aPath));
+ }
+ }
+
+ @Override
+ public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) {
+ return mIconMap.get(damage);
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int damage) {
+ return mIconMap.get(damage);
+ }
+
+ @Override
+ public IIcon getIcon(ItemStack aStack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
+ return mIconMap.get(getMetaKey(aStack));
+ }
+
+ @Override
+ public IIcon getIcon(ItemStack aStack, int pass) {
+ return mIconMap.get(getMetaKey(aStack));
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack stack) {
+ return super.getUnlocalizedName() + "." + stack.getItemDamage();
+ }
+
+ private static class PotionEffectPackage {
+
+ private final PotionEffect mEffect;
+ private final int mChance;
+
+ private PotionEffectPackage(PotionEffect aEffect, int aChance) {
+ mEffect = aEffect;
+ mChance = aChance;
+ }
+
+ public PotionEffect getEffect() {
+ return this.mEffect;
+ }
+
+ public int getChance() {
+ return this.mChance;
+ }
+
+ }
+
+ private static AutoMap<PotionEffectPackage> getPotionEffectPackage(PotionEffectPackage... aEffects){
+ AutoMap<PotionEffectPackage> aPackage = new AutoMap<PotionEffectPackage>();
+ if (aEffects != null && aEffects.length > 0) {
+ for (PotionEffectPackage aEffect : aEffects) {
+ aPackage.put(aEffect);
+ }
+ }
+ return aPackage;
+ }
+
+ private static ArrayList<String> getOreDictNamesAsArrayList(String... aOreDictNames){
+ ArrayList<String> aPackage = new ArrayList<String>();
+ if (aOreDictNames != null && aOreDictNames.length > 0) {
+ for (String aEffect : aOreDictNames) {
+ aPackage.add(aEffect);
+ }
+ }
+ return aPackage;
+ }
+
+ private static class EffectWeaknessBasic extends PotionEffectPackage {
+
+ protected EffectWeaknessBasic(int aChance) {
+ super(new PotionEffect(Potion.weakness.getId(), 1, 20), aChance);
+ }
+
+ }
+
+ private static class EffectWeaknessModerate extends PotionEffectPackage {
+
+ protected EffectWeaknessModerate(int aChance) {
+ super(new PotionEffect(Potion.weakness.getId(), 2, 40), aChance);
+ }
+
+ }
+
+ private static class EffectWeaknessSevere extends PotionEffectPackage {
+
+ protected EffectWeaknessSevere(int aChance) {
+ super(new PotionEffect(Potion.weakness.getId(), 3, 60), aChance);
+ }
+
+ }
+
+ private static class EffectSlownessBasic extends PotionEffectPackage {
+
+ protected EffectSlownessBasic(int aChance) {
+ super(new PotionEffect(Potion.moveSlowdown.getId(), 1, 20), aChance);
+ }
+
+ }
+
+ private static class EffectSlownessModerate extends PotionEffectPackage {
+
+ protected EffectSlownessModerate(int aChance) {
+ super(new PotionEffect(Potion.moveSlowdown.getId(), 2, 40), aChance);
+ }
+
+ }
+
+ private static class EffectSlownessSevere extends PotionEffectPackage {
+
+ protected EffectSlownessSevere(int aChance) {
+ super(new PotionEffect(Potion.moveSlowdown.getId(), 3, 60), aChance);
+ }
+
+ }
+
+
+
+
+ private static abstract class SpecialFoodBehaviour {
+
+ protected final int mChance;
+
+ public SpecialFoodBehaviour(int aChance) {
+ mChance = aChance;
+ }
+
+ public final void doBehaviour(EntityPlayer aPlayer) {
+ if (aPlayer != null && !aPlayer.worldObj.isRemote) {
+ if (MathUtils.randInt(0, 100) < mChance || mChance == 100) {
+ behaviour(aPlayer);
+ }
+ }
+ }
+
+ protected abstract void behaviour(EntityPlayer aPlayer);
+
+ }
+
+
+ private static class setOnFire extends SpecialFoodBehaviour {
+
+ public setOnFire() {
+ super(100);
+ }
+
+ @Override
+ public void behaviour(EntityPlayer aPlayer) {
+ EntityUtils.setEntityOnFire(aPlayer, 5);
+ }
+
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/item/general/ItemGiantEgg.java b/src/Java/gtPlusPlus/core/item/general/ItemGiantEgg.java
index 4abb84a33c..d98b27d163 100644
--- a/src/Java/gtPlusPlus/core/item/general/ItemGiantEgg.java
+++ b/src/Java/gtPlusPlus/core/item/general/ItemGiantEgg.java
@@ -4,6 +4,14 @@ import static gtPlusPlus.core.lib.CORE.RANDOM;
import java.util.List;
+import gregtech.api.enums.ItemList;
+import gtPlusPlus.core.entity.item.ItemEntityGiantEgg;
+import gtPlusPlus.core.item.base.BaseItemBurnable;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.NBTUtils;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
@@ -14,16 +22,6 @@ import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
-import gregtech.api.enums.ItemList;
-
-import gtPlusPlus.core.entity.item.ItemEntityGiantEgg;
-import gtPlusPlus.core.item.base.BaseItemBurnable;
-import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
-import gtPlusPlus.core.util.minecraft.NBTUtils;
-
public class ItemGiantEgg extends BaseItemBurnable {
public ItemGiantEgg(String unlocalizedName, String displayName, CreativeTabs creativeTab, int stackSize, int maxDmg,
@@ -138,7 +136,7 @@ public class ItemGiantEgg extends BaseItemBurnable {
if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && Utils.getGregtechSubVersion() > 28) {
- ItemList xl = Utils.getValueOfItemList("Circuit_Chip_Stemcell", ItemList.Circuit_Elite);
+ ItemList xl = ItemUtils.getValueOfItemList("Circuit_Chip_Stemcell", ItemList.Circuit_Elite);
if (xl != null && xl.hasBeenSet()) {
mCorrectStemCells = xl.get(1);
}
diff --git a/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java b/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java
index 94ebb3ffcb..e5c403c503 100644
--- a/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java
+++ b/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java
@@ -1,15 +1,22 @@
package gtPlusPlus.core.item.init;
-import net.minecraft.potion.Potion;
-import net.minecraft.potion.PotionEffect;
-
import gregtech.api.util.GT_OreDictUnificator;
-
import gtPlusPlus.core.item.ModItems;
import gtPlusPlus.core.item.base.foods.BaseItemFood;
import gtPlusPlus.core.item.base.foods.BaseItemHotFood;
+import gtPlusPlus.core.item.food.BaseItemMetaFood;
import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.EntityUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.RecipeUtils;
+import net.minecraft.entity.monster.EntityBlaze;
+import net.minecraft.entity.passive.EntityHorse;
+import net.minecraft.entity.passive.EntityOcelot;
+import net.minecraft.entity.passive.EntityVillager;
+import net.minecraft.entity.passive.EntityWolf;
+import net.minecraft.item.ItemStack;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
public class ItemsFoods {
@@ -40,6 +47,34 @@ public class ItemsFoods {
ModItems.itemHotFoodCurriedSausages = new BaseItemHotFood("itemHotFoodCurriedSausages", 1, 0.5f, "Curried Sausages", 240, ModItems.itemFoodCurriedSausages);
GT_OreDictUnificator.registerOre("foodHotCurriedSausages", ItemUtils.getItemStackFromFQRN(CORE.MODID+":itemHotFoodCurriedSausages", 1));
+ ModItems.itemMetaFood = new BaseItemMetaFood();
+ BaseItemMetaFood.registerFoodsToOreDict();
+ addCookingRecipes();
+ addFoodDropsToMobs();
+
+ }
+
+ private static ItemStack getMetaFoodStack(int aID) {
+ return ItemUtils.simpleMetaStack(ModItems.itemMetaFood, aID, 1);
+ }
+
+ private static void addCookingRecipes() {
+
+ RecipeUtils.addSmeltingRecipe(getMetaFoodStack(0), getMetaFoodStack(1), 0.4F);
+ RecipeUtils.addSmeltingRecipe(getMetaFoodStack(2), getMetaFoodStack(3), 0.35F);
+ RecipeUtils.addSmeltingRecipe(getMetaFoodStack(4), getMetaFoodStack(5), 0.35F);
+ RecipeUtils.addSmeltingRecipe(getMetaFoodStack(6), getMetaFoodStack(7), 0.35F);
+
+ }
+
+ private static void addFoodDropsToMobs() {
+
+ EntityUtils.registerDropsForMob(EntityVillager.class, getMetaFoodStack(0), 2, 1500);
+ EntityUtils.registerDropsForMob(EntityHorse.class, getMetaFoodStack(2), 4, 4000);
+ EntityUtils.registerDropsForMob(EntityWolf.class, getMetaFoodStack(4), 2, 4000);
+ EntityUtils.registerDropsForMob(EntityOcelot.class, getMetaFoodStack(6), 2, 4000);
+ EntityUtils.registerDropsForMob(EntityBlaze.class, getMetaFoodStack(8), 1, 500);
+
}
}
diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java b/src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java
index a48573888e..e43dc8546b 100644
--- a/src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java
+++ b/src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java
@@ -19,7 +19,6 @@ import gregtech.api.interfaces.IItemBehaviour;
import gregtech.api.interfaces.IItemContainer;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank;
import gregtech.api.objects.ItemData;
import gregtech.api.util.GT_LanguageManager;
@@ -200,7 +199,7 @@ public class GregtechPump extends Item implements ISpecialElectricItem, IElectri
if (aOffsetMeta <= 3) {
FluidStack f = getFluid(aStack);
- aList.add("Can also drain any other standard fluid container block");
+ aList.add("Cannot drain any other standard fluid container block");
aList.add("Cannot be emptied via RMB, use inside a tank with GUI");
aList.add(EnumChatFormatting.DARK_GRAY+"This is technically just a fancy fluid cell");
aList.add(EnumChatFormatting.BLUE + (f != null ? f.getLocalizedName() : "No Fluids Contained"));
@@ -973,7 +972,8 @@ public class GregtechPump extends Item implements ISpecialElectricItem, IElectri
}
//Try support Standard Fluid Tanks too (May disable if dupes appear again)
else if ((tTileEntity instanceof IFluidTank || tTileEntity instanceof IFluidHandler)) {
- return this.drainIFluidTank(tTileEntity, aStack, aWorld, aPlayer, aX, aY, aZ);
+ //return this.drainIFluidTank(tTileEntity, aStack, aWorld, aPlayer, aX, aY, aZ);
+ return false;
}
}
}
diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java
index 34d7475df3..9e29a381e2 100644
--- a/src/Java/gtPlusPlus/core/lib/CORE.java
+++ b/src/Java/gtPlusPlus/core/lib/CORE.java
@@ -46,7 +46,6 @@ public class CORE {
public static Configuration Config;
public static boolean DEVENV = false;
- public static boolean DEBUG = false;
public static boolean NBT_PERSISTENCY_PATCH_APPLIED = false;
//Only can be set in Dev, no config or setting elsewhere.
public static final boolean LOAD_ALL_CONTENT = false;;
@@ -55,7 +54,7 @@ public class CORE {
public static final String name = "GT++";
public static final String MODID = "miscutils";
- public static final String VERSION = "1.7.03.45";
+ public static final String VERSION = "1.7.05";
public static String MASTER_VERSION = NetworkUtils.getContentFromURL("https://raw.githubusercontent.com/draknyte1/GTplusplus/master/Recommended.txt").toLowerCase();
public static String USER_COUNTRY = GeoUtils.determineUsersCountry();
public static boolean isModUpToDate = Utils.isModUpToDate();
@@ -290,12 +289,18 @@ public class CORE {
public static final String VERSION = "0.1";
}
+
public static final void crash() {
+ crash("Generic Crash");
+ }
+
+ public static final void crash(String aReason) {
Logger.INFO("==========================================================");
Logger.INFO("[GT++ CRASH]");
Logger.INFO("==========================================================");
Logger.INFO("Oooops...");
Logger.INFO("This should only happy in a development environment or when something really bad happens.");
+ Logger.INFO("Reason: "+aReason);
Logger.INFO("==========================================================");
Logger.INFO("Called from: "+ReflectionUtils.getMethodName(0));
Logger.INFO(ReflectionUtils.getMethodName(1));
diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java
index b5922dde53..7d49a8d635 100644
--- a/src/Java/gtPlusPlus/core/material/Material.java
+++ b/src/Java/gtPlusPlus/core/material/Material.java
@@ -24,6 +24,7 @@ import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.minecraft.FluidUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.minecraft.MaterialUtils;
+import gtPlusPlus.xmod.gregtech.api.enums.CustomOrePrefix;
import gtPlusPlus.xmod.thaumcraft.objects.wrapper.aspect.TC_Aspect_Wrapper;
import gtPlusPlus.xmod.tinkers.material.BaseTinkersMaterial;
import net.minecraft.block.Block;
@@ -890,6 +891,9 @@ public class Material {
public final ItemStack getDustImpure(final int stacksize){
return getComponentByPrefix(OrePrefixes.dustImpure, stacksize);
}
+ public final ItemStack getMilled(final int stacksize){
+ return getComponentByPrefix(CustomOrePrefix.milled.get(), stacksize);
+ }
public final boolean hasSolidForm() {
if (ItemUtils.checkForInvalidItems(new ItemStack[] {getDust(1), getBlock(1), getTinyDust(1), getSmallDust(1)})) {
diff --git a/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java b/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java
index d2e24b04a1..73751ac49d 100644
--- a/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java
+++ b/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java
@@ -70,8 +70,60 @@ public final class NUCLIDE {
new MaterialStack(ELEMENT.getInstance().URANIUM235, 14)
});
+ // Secondary material is molten metal
+ public static final Material NAQ_FUEL_T1 = new Material(
+ "Naquadah Fuel",
+ MaterialState.PURE_LIQUID, //State
+ null, //Material Colour
+ -1, //Melting Point in C
+ -1, //Boiling Point in C
+ -1, //Protons
+ -1,
+ false, //Uses Blast furnace?
+ //Material Stacks with Percentage of required elements.
+ new MaterialStack[]{
+ new MaterialStack(ELEMENT.getInstance().NAQUADAH, 2),
+ new MaterialStack(ELEMENT.getInstance().TANTALUM, 3)
+ });
+
+ // Secondary material is a plasma
+ public static final Material NAQ_FUEL_T2 = new Material(
+ "Enriched Naquadah Fuel",
+ MaterialState.PURE_LIQUID, //State
+ null, //Material Colour
+ -1, //Melting Point in C
+ -1, //Boiling Point in C
+ -1, //Protons
+ -1,
+ false, //Uses Blast furnace?
+ //Material Stacks with Percentage of required elements.
+ new MaterialStack[]{
+ new MaterialStack(ELEMENT.getInstance().NAQUADAH_ENRICHED, 2),
+ new MaterialStack(ELEMENT.getInstance().TITANIUM, 3)
+ });
+
+ // Secondary material is a plasma
+ public static final Material NAQ_FUEL_T3 = new Material(
+ "Naquadria Fuel",
+ MaterialState.PURE_LIQUID, //State
+ null, //Material Colour
+ -1, //Melting Point in C
+ -1, //Boiling Point in C
+ -1, //Protons
+ -1,
+ false, //Uses Blast furnace?
+ //Material Stacks with Percentage of required elements.
+ new MaterialStack[]{
+ new MaterialStack(ELEMENT.getInstance().NAQUADRIA, 2),
+ new MaterialStack(ELEMENT.getInstance().AMERICIUM, 3)
+ });
+
+
private static final NUCLIDE INSTANCE = new NUCLIDE();
- public static NUCLIDE getInstance(){return INSTANCE;}
+
+ public static NUCLIDE getInstance(){
+ return INSTANCE;
+ }
}
diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java
index c7bbe7c7cd..1561f4b475 100644
--- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java
+++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java
@@ -11,7 +11,6 @@ import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
-import gregtech.api.util.GT_Utility;
import gregtech.api.util.HotFuel;
import gregtech.api.util.ThermalFuel;
import gtPlusPlus.api.objects.Logger;
@@ -40,7 +39,6 @@ import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.minecraft.MaterialUtils;
import gtPlusPlus.core.util.reflect.AddGregtechRecipe;
import gtPlusPlus.everglades.dimension.Dimension_Everglades;
-import gtPlusPlus.plugin.agrichem.BioRecipes;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@@ -114,26 +112,99 @@ public class RECIPES_GREGTECH {
private static void chemplantRecipes() {
+ //This is subsequently absorbed in water to form nitric acid and nitric oxide.
+ //3 NO2 (g) + H2O (l) → 2 HNO3 (aq) + NO (g) (ΔH = −117 kJ/mol)
+ //The nitric oxide is cycled back for reoxidation. Alternatively, if the last step is carried out in air:
+ //4 NO2 (g) + O2 (g) + 2 H2O (l) → 4 HNO3 (aq)
+
// Advanced method for Nitric Acid Production
- /* CORE.RA.addChemicalPlantRecipe(
- new ItemStack[] {
- CI.getNumberedBioCircuit(17),
- CI.getPinkCatalyst(0),
- },
- new FluidStack[] {
- FluidUtils.getLava(10000),
- FluidUtils.getDistilledWater(5000)
- },
- new ItemStack[] {
-
- },
- new FluidStack[] {
- FluidUtils.getFluidStack("nitricacid", 2000),
- },
- 10 * 20,
- 480,
- 3);*/
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedBioCircuit(17),
+ CI.getPinkCatalyst(0),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(GenericChem.Nitrogen_Dioxide, 3000),
+ FluidUtils.getAir(7000)
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("nitricacid", 4000),
+ FluidUtils.getWater(2000),
+ },
+ 10 * 20,
+ 480,
+ 3);
+
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedBioCircuit(16),
+ CI.getPinkCatalyst(0),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(GenericChem.Nitrogen_Dioxide, 3000),
+ FluidUtils.getDistilledWater(5000)
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("nitricacid", 2000),
+ FluidUtils.getFluidStack(GenericChem.Nitric_Oxide, 1500),
+ },
+ 10 * 20,
+ 480,
+ 2);
+
+ // Produce Boric Acid
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(21),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustBorax", 4),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(GenericChem.HydrochloricAcid, 2000)
+ },
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("dustSalt", 5),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("boricacid", 2000),
+ FluidUtils.getWater(5000)
+
+ },
+ 20 * 30,
+ MaterialUtils.getVoltageForTier(3),
+ 2);
+ // Produce Th232
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(22),
+ ELEMENT.getInstance().THORIUM.getDust(16)
+ },
+ new FluidStack[] {
+ FluidUtils.getDistilledWater(2000),
+ FluidUtils.getFluidStack("boricacid", 1500)
+ },
+ new ItemStack[] {
+ ELEMENT.getInstance().THORIUM.getSmallDust(32),
+ ELEMENT.getInstance().THORIUM232.getDust(2),
+ ELEMENT.getInstance().THORIUM232.getSmallDust(2),
+ ELEMENT.getInstance().URANIUM232.getDust(1),
+ },
+ new FluidStack[] {
+
+ },
+ new int[] {
+ 0, 0, 1000, 250
+ },
+ 20 * 300,
+ MaterialUtils.getVoltageForTier(4),
+ 3);
+
}
private static void fluidheaterRecipes() {
@@ -587,6 +658,16 @@ public class RECIPES_GREGTECH {
20 * 60 * 5,
MaterialUtils.getVoltageForTier(5));
+ // Distillus Upgrade Chip
+ GT_Values.RA.addLaserEngraverRecipe(
+ GregtechItemList.Laser_Lens_WoodsGlass.get(0),
+ ItemUtils.simpleMetaStack(AgriculturalChem.mBioCircuit, 20, 1),
+ GregtechItemList.Distillus_Upgrade_Chip.get(1),
+ 20 * 60 * 5,
+ MaterialUtils.getVoltageForTier(5));
+
+
+
}
@@ -1482,10 +1563,10 @@ public class RECIPES_GREGTECH {
CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {ItemUtils.getSimpleStack(Items.nether_star), ItemUtils.getItemStackOfAmountFromOreDict("plateTungstenSteel", 8), ItemUtils.getItemStackOfAmountFromOreDict("stickBlackSteel", 8)}, null, ItemUtils.getSimpleStack(ModBlocks.blockWitherGuard, 32), 30*20, 500);
- ItemStack aFluidReg1 = Utils.getValueOfItemList("FluidRegulator_LV", ItemList.Pump_LV).get(1);
- ItemStack aFluidReg2 = Utils.getValueOfItemList("FluidRegulator_MV", ItemList.Pump_MV).get(1);
- ItemStack aFluidReg3 = Utils.getValueOfItemList("FluidRegulator_HV", ItemList.Pump_HV).get(1);
- ItemStack aFluidReg4 = Utils.getValueOfItemList("FluidRegulator_EV", ItemList.Pump_EV).get(1);
+ ItemStack aFluidReg1 = ItemUtils.getValueOfItemList("FluidRegulator_LV", ItemList.Pump_LV).get(1);
+ ItemStack aFluidReg2 = ItemUtils.getValueOfItemList("FluidRegulator_MV", ItemList.Pump_MV).get(1);
+ ItemStack aFluidReg3 = ItemUtils.getValueOfItemList("FluidRegulator_HV", ItemList.Pump_HV).get(1);
+ ItemStack aFluidReg4 = ItemUtils.getValueOfItemList("FluidRegulator_EV", ItemList.Pump_EV).get(1);
CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {
aFluidReg1,
@@ -1807,13 +1888,6 @@ public class RECIPES_GREGTECH {
private static void centrifugeRecipes() {
- GT_Values.RA.addCentrifugeRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustThorium", 8), GT_Values.NI,
- GT_Values.NF, GT_Values.NF, ELEMENT.getInstance().THORIUM232.getDust(2),
- ItemUtils.getItemStackOfAmountFromOreDict("dustSmallThorium", 20),
- ELEMENT.getInstance().URANIUM232.getDust(1), GT_Values.NI, GT_Values.NI, GT_Values.NI,
- new int[] { 0, 0, 10 }, 500 * 20, 2000);
-
-
//Process Used Fuel Rods for Krypton
//Uranium
diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java
index 2165f27ec7..ebc2c07a63 100644
--- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java
+++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java
@@ -2,9 +2,14 @@ package gtPlusPlus.core.recipe;
import static gtPlusPlus.core.lib.CORE.GTNH;
+import codechicken.nei.api.API;
import cpw.mods.fml.common.Loader;
-import gregtech.api.enums.*;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
import gregtech.api.util.GT_ModHandler;
+import gregtech.common.items.GT_MetaGenerated_Tool_01;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.item.ModItems;
@@ -15,16 +20,17 @@ import gtPlusPlus.core.material.ALLOY;
import gtPlusPlus.core.material.ELEMENT;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.recipe.common.CI;
-import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.core.util.minecraft.*;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.MaterialUtils;
+import gtPlusPlus.core.util.minecraft.RecipeUtils;
import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
import gtPlusPlus.everglades.dimension.Dimension_Everglades;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
-import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
import gtPlusPlus.xmod.gregtech.common.covers.CoverManager;
import gtPlusPlus.xmod.gregtech.common.items.MetaCustomCoverItem;
+import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@@ -241,29 +247,29 @@ public class RECIPES_Machines {
distillus();
algaeFarm();
chemPlant();
-
+
}
private static void chemPlant() {
-
+
CORE.RA.addSixSlotAssemblingRecipe(
new ItemStack[] {
- CI.getNumberedBioCircuit(19),
- CI.getTieredGTPPMachineCasing(1, 6),
- CI.getTieredComponentOfMaterial(Materials.Steel, OrePrefixes.gearGt, 6),
- CI.getTieredComponentOfMaterial(Materials.Aluminium, OrePrefixes.plate, 32),
- CI.getTieredComponentOfMaterial(Materials.CobaltBrass, OrePrefixes.dust, 16),
- CI.getTieredComponent(OrePrefixes.frameGt, 2, 4),
+ CI.getNumberedBioCircuit(19),
+ CI.getTieredGTPPMachineCasing(1, 6),
+ CI.getTieredComponentOfMaterial(Materials.Steel, OrePrefixes.gearGt, 6),
+ CI.getTieredComponentOfMaterial(Materials.Aluminium, OrePrefixes.plate, 32),
+ CI.getTieredComponentOfMaterial(Materials.CobaltBrass, OrePrefixes.dust, 16),
+ CI.getTieredComponent(OrePrefixes.frameGt, 2, 4),
},
ALLOY.STEEL.getFluid(2 * (144 * 4)),
GregtechItemList.ChemicalPlant_Controller.get(1),
120 * 20,
MaterialUtils.getVoltageForTier(2));
-
+
}
private static void algaeFarm() {
-
+
// Give the shitty algae a use :)
CORE.RA.addDistilleryRecipe(
ItemUtils.getSimpleStack(AgriculturalChem.mAlgaeBiosmass, 32),
@@ -273,26 +279,26 @@ public class RECIPES_Machines {
20 * 15,
16,
false);
-
+
CORE.RA.addSixSlotAssemblingRecipe(
new ItemStack[] {
- CI.getNumberedBioCircuit(21),
- CI.getTieredGTPPMachineCasing(0, 4),
- CI.getTieredComponentOfMaterial(Materials.Iron, OrePrefixes.rod, 12),
- CI.getTieredComponentOfMaterial(Materials.Wood, OrePrefixes.plate, 32),
- CI.getTieredComponentOfMaterial(Materials.Bronze, OrePrefixes.bolt, 16),
- CI.getTieredComponentOfMaterial(Materials.Redstone, OrePrefixes.dust, 32),
+ CI.getNumberedBioCircuit(21),
+ CI.getTieredGTPPMachineCasing(0, 4),
+ CI.getTieredComponentOfMaterial(Materials.Iron, OrePrefixes.rod, 12),
+ CI.getTieredComponentOfMaterial(Materials.Wood, OrePrefixes.plate, 32),
+ CI.getTieredComponentOfMaterial(Materials.Bronze, OrePrefixes.bolt, 16),
+ CI.getTieredComponentOfMaterial(Materials.Redstone, OrePrefixes.dust, 32),
},
ALLOY.POTIN.getFluid(2 * (144 * 4)),
GregtechItemList.AlgaeFarm_Controller.get(1),
60 * 20,
MaterialUtils.getVoltageForTier(1));
-
-
+
+
}
private static void distillus() {
-
+
CORE.RA.addChemicalPlantRecipe(
new ItemStack[] {
CI.getNumberedBioCircuit(19),
@@ -310,44 +316,44 @@ public class RECIPES_Machines {
GregtechItemList.Machine_Adv_DistillationTower.get(1)
},
new FluidStack[] {
-
+
},
20 * 600,
MaterialUtils.getVoltageForTier(6),
3);
-
+
}
private static void chunkloaders() {
-
+
ItemStack aOutputs[] = new ItemStack[] {
GregtechItemList.GT_Chunkloader_HV.get(1L),
GregtechItemList.GT_Chunkloader_IV.get(1L),
GregtechItemList.GT_Chunkloader_ZPM.get(1L),
};
-
+
int aIndex = 0;
-
+
for (int i=3;i<8;i++) {
if (i == 4 || i == 6) {
continue;
}
CORE.RA.addSixSlotAssemblingRecipe(
new ItemStack[] {
- CI.getNumberedBioCircuit(21),
- CI.getElectricPiston(i, 10),
- CI.getFieldGenerator(i + 1, 6),
- CI.getPlate(i, 16),
- CI.getTransmissionComponent(i - 1, 8),
- CI.getTieredComponent(OrePrefixes.cableGt08, i, 16)
+ CI.getNumberedBioCircuit(21),
+ CI.getElectricPiston(i, 10),
+ CI.getFieldGenerator(i + 1, 6),
+ CI.getPlate(i, 16),
+ CI.getTransmissionComponent(i - 1, 8),
+ CI.getTieredComponent(OrePrefixes.cableGt08, i, 16)
},
ALLOY.EGLIN_STEEL.getFluid(i * (144 * 4)),
aOutputs[aIndex++].copy(),
300 * 20,
MaterialUtils.getVoltageForTier(i));
}
-
-
+
+
}
private static void overflowValveCovers() {
@@ -359,25 +365,25 @@ public class RECIPES_Machines {
GregtechItemList.Cover_Overflow_EV.get(1L),
GregtechItemList.Cover_Overflow_IV.get(1L),
};
-
+
for (int i=0;i<6;i++) {
CORE.RA.addSixSlotAssemblingRecipe(
new ItemStack[] {
- CI.getNumberedBioCircuit(19),
- CI.getElectricPump(i, 2),
- CI.getElectricMotor(i, 2),
- CI.getPlate(i, 4)
+ CI.getNumberedBioCircuit(19),
+ CI.getElectricPump(i, 2),
+ CI.getElectricMotor(i, 2),
+ CI.getPlate(i, 4)
},
- FluidUtils.getWater(i * 1500),
+ FluidUtils.getWater((i+1) * 750),
aOutputs[i].copy(),
20 * 20,
MaterialUtils.getVoltageForTier(i));
}
-
+
}
private static void tieredMachineHulls() {
-
+
GregtechItemList[] aHulls = new GregtechItemList[] {
GregtechItemList.GTPP_Casing_ULV,
GregtechItemList.GTPP_Casing_LV,
@@ -390,7 +396,7 @@ public class RECIPES_Machines {
GregtechItemList.GTPP_Casing_UV,
GregtechItemList.GTPP_Casing_MAX
};
-
+
for (int i=0;i<10;i++) {
CORE.RA.addSixSlotAssemblingRecipe(
new ItemStack[] {
@@ -401,12 +407,12 @@ public class RECIPES_Machines {
CI.getTieredComponent(OrePrefixes.cableGt02, i, 4),
CI.getTieredComponent(OrePrefixes.circuit, i, 2)
},
- CI.getAlternativeTieredFluid(i, 144 * i * 2),
+ CI.getAlternativeTieredFluid(i, 144 * (i+1) * 2),
aHulls[i].get(1),
20 * 20,
MaterialUtils.getVoltageForTier(i));
}
-
+
}
private static void initModItems(){
@@ -443,7 +449,7 @@ public class RECIPES_Machines {
EV_MACHINE_Wiremill= ItemList.Machine_IV_Wiremill.get(1);
HV_MACHINE_Macerator= ItemList.Machine_EV_Macerator.get(1);
EV_MACHINE_Macerator= ItemList.Machine_IV_Macerator.get(1);
- EV_MACHINE_MassFabricator= CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? gtPlusPlus.core.util.Utils.getValueOfItemList("Machine_LuV_Massfab", ItemList.Machine_IV_Massfab).get(1) : ItemList.Machine_IV_Massfab.get(1);
+ EV_MACHINE_MassFabricator= CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? ItemUtils.getValueOfItemList("Machine_LuV_Massfab", ItemList.Machine_IV_Massfab).get(1) : ItemList.Machine_IV_Massfab.get(1);
EV_MACHINE_Centrifuge= ItemList.Machine_IV_Centrifuge.get(1);
EV_MACHINE_Cutter = ItemList.Machine_IV_Cutter.get(1);
EV_MACHINE_Extruder = ItemList.Machine_IV_Extruder.get(1);
@@ -541,9 +547,9 @@ public class RECIPES_Machines {
20 * 30,
30);
- ItemStack aFluidRegulator1 = ItemUtils.getItemListObject("FluidRegulator_MV", "Pump_HV", GTNH ? 4 : 2);
- ItemStack aFluidRegulator2 = ItemUtils.getItemListObject("FluidRegulator_IV", "Pump_LuV", GTNH ? 4 : 2);
-
+ ItemStack aFluidRegulator1 = ItemUtils.getValueOfItemList("FluidRegulator_MV",GTNH ? 4 : 2, ItemList.Electric_Pump_HV);
+ ItemStack aFluidRegulator2 = ItemUtils.getValueOfItemList("FluidRegulator_IV", GTNH ? 4 : 2, ItemUtils.getValueOfItemList("Electric_Pump_LuV", GTNH ? 8 : 4, ItemList.Electric_Pump_IV));
+
//Poo Collector
CORE.RA.addSixSlotAssemblingRecipe(
new ItemStack[] {
@@ -605,7 +611,7 @@ public class RECIPES_Machines {
plateEnergeticAlloy, pipeLargeCopper, plateEnergeticAlloy,
RECIPE_SteamCondenser);
}
-
+
//Steam Condenser
if (LoadedMods.CoFHCore && CORE.ConfigSwitches.enableMachine_RF_Convetor){
@@ -900,25 +906,47 @@ public class RECIPES_Machines {
}
//TODO
- //Semi-Fluid Generators
- ItemStack mSemiFluidgen = ItemUtils.getItemStackFromFQRN("IC2:blockGenerator:7", 1);
- mSemiFluidgen.setItemDamage(7);
+ //Semi-Fluid Generators
+ ItemStack[][] aSemiFluidInputs = new ItemStack[3][6];
+ aSemiFluidInputs[0] = new ItemStack[]{
+ CI.getNumberedBioCircuit(14),
+ CI.getTieredMachineHull(1, 1),
+ CI.getElectricPiston(1, GTNH ? 4 : 2),
+ CI.getTieredComponent(OrePrefixes.circuit, 1, GTNH ? 4 : 2),
+ CI.getPlate(1, GTNH ? 8 : 4),
+ CI.getGear(1, GTNH ? 4 : 2)
+ };
+ aSemiFluidInputs[1] = new ItemStack[]{
+ CI.getNumberedBioCircuit(14),
+ CI.getTieredMachineHull(2, 1),
+ CI.getElectricPiston(2, GTNH ? 4 : 2),
+ CI.getTieredComponent(OrePrefixes.circuit, 2, GTNH ? 4 : 2),
+ CI.getPlate(2, GTNH ? 8 : 4),
+ CI.getGear(2, GTNH ? 4 : 2)
+ };
+ aSemiFluidInputs[2] = new ItemStack[]{
+ CI.getNumberedBioCircuit(14),
+ CI.getTieredMachineHull(3, 1),
+ CI.getElectricPiston(3, GTNH ? 4 : 2),
+ CI.getTieredComponent(OrePrefixes.circuit, 3, GTNH ? 4 : 2),
+ CI.getPlate(3, GTNH ? 8 : 4),
+ CI.getGear(3, GTNH ? 4 : 2)
+ };
+ FluidStack[] aSemiFluidFluidInputs = new FluidStack[] {
+ ALLOY.BRONZE.getFluid(144 * 8),
+ ALLOY.STEEL.getFluid(144 * 8),
+ ELEMENT.getInstance().ALUMINIUM.getFluid(144 * 8),
+ };
+
//ItemUtils.simpleMetaStack("IC2:blockGenerator:7", 7, 1);
- ItemStack[] aSemifluids = new ItemStack[] {mSemiFluidgen, GregtechItemList.Generator_SemiFluid_LV.get(1), GregtechItemList.Generator_SemiFluid_MV.get(1), GregtechItemList.Generator_SemiFluid_HV.get(1)};
- for (int o=1;o<4;o++) {
+ ItemStack[] aSemifluids = new ItemStack[] {GregtechItemList.Generator_SemiFluid_LV.get(1), GregtechItemList.Generator_SemiFluid_MV.get(1), GregtechItemList.Generator_SemiFluid_HV.get(1)};
+ for (int o=0;o<3;o++) {
CORE.RA.addSixSlotAssemblingRecipe(
- new ItemStack[] {
- aSemifluids[o-1],
- CI.getElectricPiston(o, GTNH ? 4 : 2),
- CI.getElectricMotor(o, GTNH ? 2 : 1),
- CI.getTieredComponent(OrePrefixes.circuit, o, GTNH ? 4 : 2),
- CI.getPlate(o, GTNH ? 8 : 4),
- CI.getGear(o-1, GTNH ? 4 : 2)
- },
- CI.getAlternativeTieredFluid(o, 144 * 4),
+ aSemiFluidInputs[o],
+ aSemiFluidFluidInputs[o],
aSemifluids[o],
20 * 30,
- (int) GT_Values.V[o]);
+ MaterialUtils.getVoltageForTier(o+1));
}
if (CORE.ConfigSwitches.enableMultiblock_AlloyBlastSmelter){
@@ -955,9 +983,9 @@ public class RECIPES_Machines {
//Matter Fabricator CPU
RecipeUtils.addShapedGregtechRecipe(
- "plateDoubleQuantum", CI.circuitTier5, "plateDoubleQuantum",
+ CI.getDoublePlate(8, 1), CI.circuitTier5, CI.getPlate(8, 1),
cableTier8, CI.machineCasing_LuV, cableTier8,
- "plateDoubleQuantum", CI.circuitTier5, "plateDoubleQuantum",
+ CI.getPlate(8, 1), CI.circuitTier5, CI.getPlate(8, 1),
RECIPE_IndustrialMatterFabController);
//Matter Fabricator Frame Casing
RecipeUtils.addShapedGregtechRecipe(
@@ -967,9 +995,9 @@ public class RECIPES_Machines {
RECIPE_IndustrialMatterFabFrame);
//Matter Fabricator Coil
RecipeUtils.addShapedGregtechRecipe(
- "plateQuantum", "plateQuantum", "plateQuantum",
+ CI.getPlate(6, 1), CI.getPlate(7, 1), CI.getPlate(6, 1),
"frameGtStellite", CI.machineCasing_UV, "frameGtStellite",
- "plateQuantum", "plateQuantum", "plateQuantum",
+ CI.getPlate(6, 1), CI.getPlate(7, 1), CI.getPlate(6, 1),
RECIPE_IndustrialMatterFabCoil);
}
@@ -1120,12 +1148,6 @@ public class RECIPES_Machines {
aSimpleWasherTier += 2;
aSlot++;
}
-
-
-
-
-
-
}
if (CORE.ConfigSwitches.enableMachine_Pollution && PollutionUtils.isPollutionEnabled()){
@@ -1149,20 +1171,6 @@ public class RECIPES_Machines {
CI.getTieredCircuit(1), CI.machineHull_LV, CI.getTieredCircuit(0),
GregtechItemList.Pollution_Detector.get(1));
- //Air Intake Hatch
-
-
-
- ItemList FluidRegulator_IV = Utils.getValueOfItemList("FluidRegulator_IV", ItemList.Pump_IV);
- ItemStack aTieredFluidRegulator = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? FluidRegulator_IV.get(1) : ItemList.Pump_IV.get(1);
-
-
- RecipeUtils.addShapedGregtechRecipe(
- CI.component_Plate[6], ItemList.Casing_Grate.get(1), CI.component_Plate[6],
- CI.component_Plate[6], aTieredFluidRegulator, CI.component_Plate[6],
- CI.getTieredCircuit(4), ItemList.Hatch_Input_IV.get(1), CI.getTieredCircuit(4),
- GregtechItemList.Hatch_Air_Intake.get(1));
-
//ULV
RecipeUtils.addShapedGregtechRecipe(
CI.component_Plate[0], ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 0, 1), CI.component_Plate[0],
@@ -1267,6 +1275,15 @@ public class RECIPES_Machines {
);
}
+ //Air Intake Hatch
+ ItemList FluidRegulator_IV = ItemUtils.getValueOfItemList("FluidRegulator_IV", ItemList.Pump_IV);
+ ItemStack aTieredFluidRegulator = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? FluidRegulator_IV.get(1) : ItemList.Pump_IV.get(1);
+ RecipeUtils.addShapedGregtechRecipe(
+ CI.component_Plate[6], ItemList.Casing_Grate.get(1), CI.component_Plate[6],
+ CI.component_Plate[6], aTieredFluidRegulator, CI.component_Plate[6],
+ CI.getTieredCircuit(4), ItemList.Hatch_Input_IV.get(1), CI.getTieredCircuit(4),
+ GregtechItemList.Hatch_Air_Intake.get(1));
+
if (CORE.ConfigSwitches.enableMultiblock_LiquidFluorideThoriumReactor){
//Thorium Reactor
@@ -1342,15 +1359,6 @@ public class RECIPES_Machines {
CI.craftingToolHammer_Hard, "frameGtHastelloyC276", CI.craftingToolWrench,
CI.component_Plate[5], CI.getTieredMachineCasing(4), "ringInconel792",
GregtechItemList.Casing_Refinery_Structural.get(Casing_Amount));
-
-
-
-
-
-
-
-
-
}
//Shelves
@@ -1419,15 +1427,25 @@ public class RECIPES_Machines {
RECIPE_CyclotronController,
60 * 20 * 5,
MaterialUtils.getVoltageForTier(5));
+ }
+ // Mazut
+ GT_ModHandler.addCraftingRecipe(
+ GregtechItemList.Controller_LargeSemifluidGenerator.get(1L),
+ CI.bitsd,
+ new Object[]{
+ "PCP",
+ "EME",
+ "GWG",
+ 'M', ItemList.Hull_EV,
+ 'P', ItemList.Electric_Piston_EV,
+ 'E', ItemList.Electric_Pump_EV,
+ 'C', OrePrefixes.circuit.get(Materials.Data),
+ 'W', OrePrefixes.cableGt08.get(Materials.Electrum),
+ 'G', ALLOY.INCONEL_792.getGear(1)
+ });
-
-
-
-
- }
-
if (CORE.ConfigSwitches.enableMultiblock_PowerSubstation){
RecipeUtils.recipeBuilder(
"screwTitanium", "plateIncoloy020", "screwTitanium",
@@ -1475,8 +1493,7 @@ public class RECIPES_Machines {
if (CORE.ConfigSwitches.enableMultiblock_LargeAutoCrafter) {
ItemStack aCoreBlock = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK
- ? ItemList.valueOf("Block_IridiumTungstensteel").get(1,
- ItemUtils.getItemStackOfAmountFromOreDict("blockOsmiridium", 1))
+ ? ItemUtils.getValueOfItemList("Block_IridiumTungstensteel", 1, ItemUtils.getItemStackOfAmountFromOreDict("blockOsmiridium", 1))
: ItemUtils.getItemStackOfAmountFromOreDict("blockOsmiridium", 1);
aCoreBlock.stackSize = GTNH ? 2 : 1;
@@ -1622,7 +1639,7 @@ public class RECIPES_Machines {
cell1 = CI.conveyorModule_EV;
cell2 = CI.electricMotor_IV;
ItemStack casingAmazon = GregtechItemList.Casing_AmazonWarehouse.get(1);
- ItemStack aTieredUnboxinator = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? ItemList.valueOf("Machine_LuV_Unboxinator").get(1, ItemList.Machine_IV_Unboxinator.get(1)) : ItemList.Machine_IV_Unboxinator.get(1);
+ ItemStack aTieredUnboxinator = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? ItemUtils.getValueOfItemList("Machine_LuV_Unboxinator", 1, ItemList.Machine_IV_Unboxinator.get(1)) : ItemList.Machine_IV_Unboxinator.get(1);
RecipeUtils.recipeBuilder(
@@ -1768,7 +1785,7 @@ public class RECIPES_Machines {
- ItemStack aDrillController = Utils.getValueOfItemList("OreDrill4", ItemList.Hull_UV).get(1);
+ ItemStack aDrillController = ItemUtils.getValueOfItemList("OreDrill4", ItemList.Hull_UV).get(1);
//Drilling Platform
CORE.RA.addSixSlotAssemblingRecipe(
diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java
index 98ea687747..3ed2f5f168 100644
--- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java
+++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java
@@ -1,24 +1,24 @@
package gtPlusPlus.core.recipe;
import cpw.mods.fml.common.Loader;
-
-import net.minecraft.item.ItemStack;
-
-import gregtech.api.enums.*;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OreDictNames;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.enums.SubTag;
import gregtech.api.interfaces.IOreRecipeRegistrator;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
-
-import codechicken.nei.api.API;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.lib.LoadedMods;
import gtPlusPlus.core.recipe.common.CI;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.minecraft.RecipeUtils;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import net.minecraft.item.ItemStack;
public class RECIPES_Old_Circuits implements IOreRecipeRegistrator {
public RECIPES_Old_Circuits() {
@@ -445,7 +445,7 @@ public class RECIPES_Old_Circuits implements IOreRecipeRegistrator {
for (String component : CircuitToHide){
try {
- API.hideItem(Utils.getValueOfItemList(component, null).get(1L, new Object[0]));
+ ItemUtils.hideItemFromNEI(ItemUtils.getValueOfItemList(component, null).get(1L, new Object[0]));
} catch (IllegalArgumentException I){
Logger.INFO("Could not find "+component+" in the Gregtech item list.");
Logger.INFO("This is NOT an error, simply a notification.");
diff --git a/src/Java/gtPlusPlus/core/recipe/common/CI.java b/src/Java/gtPlusPlus/core/recipe/common/CI.java
index 1d3d386da3..d67a372572 100644
--- a/src/Java/gtPlusPlus/core/recipe/common/CI.java
+++ b/src/Java/gtPlusPlus/core/recipe/common/CI.java
@@ -9,7 +9,6 @@ import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.item.chemistry.AgriculturalChem;
import gtPlusPlus.core.item.chemistry.GenericChem;
import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.lib.LoadedMods;
import gtPlusPlus.core.material.ALLOY;
import gtPlusPlus.core.material.ELEMENT;
import gtPlusPlus.core.material.Material;
@@ -17,7 +16,6 @@ import gtPlusPlus.core.recipe.LOADER_Machine_Components;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
-import gtPlusPlus.xmod.eio.material.MaterialEIO;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
import gtPlusPlus.xmod.gregtech.common.StaticFields59;
import ic2.core.Ic2Items;
@@ -184,7 +182,7 @@ public class CI {
public static ItemStack explosiveITNT;
public static void preInit(){
-
+
//Tiered Components
component_Plate = new String[]{
getTieredComponent(OrePrefixes.plate, 0),
@@ -402,7 +400,7 @@ public class CI {
return ItemList.Tool_DataOrb.get(1);
}
}
-
+
public static ItemStack getDataStick(){
if (CORE.ConfigSwitches.enableOldGTcircuits && CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && !CORE.GTNH){
return GregtechItemList.Old_Tool_DataStick.get(1);
@@ -489,17 +487,7 @@ public class CI {
public static void init() {
//Set Explosives
- try {
- ItemList PowerderBarrel = Utils.getValueOfItemList("Block_Powderbarrel", null);
- if (PowerderBarrel != null){
- explosivePowderKeg = PowerderBarrel.get(1).copy();
- }
- else {
- explosivePowderKeg = ItemUtils.getSimpleStack(Items.gunpowder).copy();
- }
- } catch (java.lang.IllegalArgumentException Y) {
- explosivePowderKeg = ItemUtils.getSimpleStack(Items.gunpowder).copy();
- }
+ explosivePowderKeg = ItemUtils.getValueOfItemList("Block_Powderbarrel", 1, ItemUtils.getSimpleStack(Items.gunpowder, 16));
explosiveTNT = ItemUtils.getSimpleStack(Blocks.tnt).copy();
explosiveITNT = Ic2Items.industrialTnt.copy();
@@ -540,13 +528,13 @@ public class CI {
public static ItemStack emptyCells(int i) {
return ItemUtils.getEmptyCell(i);
}
-
-
-
+
+
+
/*
*
*/
-
+
private static final Material[] aMaterial_Main = new Material[] {
ALLOY.POTIN,
ALLOY.TUMBAGA,
@@ -561,7 +549,7 @@ public class CI {
ALLOY.QUANTUM,
ELEMENT.STANDALONE.HYPOGEN
};
-
+
private static final Material[] aMaterial_Secondary = new Material[] {
ALLOY.STEEL,
ALLOY.SILICON_CARBIDE,
@@ -576,7 +564,7 @@ public class CI {
ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN,
ELEMENT.STANDALONE.HYPOGEN
};
-
+
private static final Material[] aMaterial_Tertiary = new Material[] {
ELEMENT.getInstance().LEAD,
ELEMENT.getInstance().ALUMINIUM,
@@ -591,21 +579,21 @@ public class CI {
ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN,
ELEMENT.STANDALONE.HYPOGEN
};
-
+
private static final Materials[] aMaterial_Cables = new Materials[] {
!CORE.GTNH ? Materials.Lead : Materials.Tin,
- Materials.Cobalt,
- Materials.AnnealedCopper,
- Materials.Gold,
- Materials.Titanium,
- Materials.Nichrome,
- Materials.Platinum,
- Materials.YttriumBariumCuprate,
- Materials.Naquadah,
- Materials.Duranium,
- Materials.Superconductor,
+ Materials.Cobalt,
+ Materials.AnnealedCopper,
+ Materials.Gold,
+ Materials.Titanium,
+ Materials.Nichrome,
+ Materials.Platinum,
+ Materials.YttriumBariumCuprate,
+ Materials.Naquadah,
+ Materials.Duranium,
+ Materials.Superconductor,
};
-
+
private static final Materials[] aMaterial_Circuits = new Materials[] {
Materials.Primitive,
Materials.Basic,
@@ -619,18 +607,18 @@ public class CI {
Materials.Superconductor,
Materials.Infinite,
};
-
+
private static final Material[][] aMaster = new Material[][] {aMaterial_Main, aMaterial_Secondary, aMaterial_Tertiary};
-
-
+
+
public static FluidStack getTieredFluid(int aTier, int aAmount) {
return getTieredFluid(aTier, aAmount, 0);
}
-
+
public static FluidStack getAlternativeTieredFluid(int aTier, int aAmount) {
return getTieredFluid(aTier, aAmount, 1);
}
-
+
public static FluidStack getTertiaryTieredFluid(int aTier, int aAmount) {
return getTieredFluid(aTier, aAmount, 2);
}
@@ -642,7 +630,7 @@ public class CI {
if (a == null) {
a = aMaster[aType][aTier].getFluid(aAmount);
}*/
-
+
// Modern Handling
FluidStack a = aMaster[aType][aTier].getFluid(aAmount);
if (a == null) {
@@ -654,7 +642,7 @@ public class CI {
}
return a;
}
-
+
public static ItemStack getEnergyCore(int aTier, int aAmount) {
ItemStack[] aOutput = new ItemStack[] {
ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore"+"1", 1),
@@ -670,39 +658,43 @@ public class CI {
};
return ItemUtils.getSimpleStack(aOutput[MathUtils.balance(aTier, 0, 9)], aAmount);
}
-
+
public static ItemStack getPlate(int aTier, int aAmount) {
return getTieredComponent(OrePrefixes.plate, aTier, aAmount);
}
-
+
+ public static ItemStack getDoublePlate(int aTier, int aAmount) {
+ return getTieredComponent(OrePrefixes.plateDouble, aTier, aAmount);
+ }
+
public static ItemStack getGear(int aTier, int aAmount) {
return getTieredComponent(OrePrefixes.gearGt, aTier, aAmount);
}
-
+
public static ItemStack getIngot(int aTier, int aAmount) {
return getTieredComponent(OrePrefixes.ingot, aTier, aAmount);
}
-
+
public static ItemStack getBolt(int aTier, int aAmount) {
return getTieredComponent(OrePrefixes.bolt, aTier, aAmount);
}
-
+
public static ItemStack getTieredComponent(OrePrefixes aPrefix, int aTier, int aAmount) {
aTier = Math.max(0, aTier);
-
+
Material m = null;
-
-
-
-
-
-
+
+
+
+
+
+
if (aPrefix == OrePrefixes.liquid) {
int aMatID = (aTier == 0 || aTier == 2 || aTier == 5 || aTier == 8 ? 0 : (aTier == 1 || aTier == 3 || aTier == 6 || aTier == 9 ? 1 : 2));
ItemStack aCell = aMaster[aMatID][aTier].getCell(aAmount);
return aCell;
}
-
+
if (aPrefix == OrePrefixes.circuit) {
if (aTier == 4) {
return ItemUtils.getSimpleStack(CI.getDataStick(), aAmount);
@@ -736,19 +728,19 @@ public class CI {
else {
return ItemUtils.getOrePrefixStack(aPrefix, aMaterial_Cables[aTier], aAmount);
}
-
-
+
+
}
if (aPrefix == OrePrefixes.wireGt01 || aPrefix == OrePrefixes.wireGt02 || aPrefix == OrePrefixes.wireGt04 || aPrefix == OrePrefixes.wireGt08 || aPrefix == OrePrefixes.wireGt12 || aPrefix == OrePrefixes.wireGt16) {
return ItemUtils.getOrePrefixStack(aPrefix, aMaterial_Cables[aTier], aAmount);
}
if (aPrefix == OrePrefixes.pipeTiny || aPrefix == OrePrefixes.pipeSmall || aPrefix == OrePrefixes.pipe || aPrefix == OrePrefixes.pipeMedium || aPrefix == OrePrefixes.pipeLarge || aPrefix == OrePrefixes.pipeHuge) {
-
+
if (aPrefix == OrePrefixes.pipe) {
aPrefix = OrePrefixes.pipeMedium;
}
-
+
if (aTier == 0) {
return ItemUtils.getOrePrefixStack(aPrefix, Materials.Lead, aAmount);
}
@@ -787,12 +779,10 @@ public class CI {
}
}
- ItemStack aTempStack = null;
-
if (aPrefix == OrePrefixes.rod) {
aPrefix = OrePrefixes.stick;
}
-
+
if (aPrefix == OrePrefixes.gear || aPrefix == OrePrefixes.gearGt) {
m = aMaster[0][aTier];
}
@@ -832,24 +822,24 @@ public class CI {
else {
m = aMaterial_Main[aTier];
}
-
+
ItemStack aReturn = ItemUtils.getOrePrefixStack(aPrefix, m, aAmount);
-
+
//If Invalid, Try First Material
if (!ItemUtils.checkForInvalidItems(aReturn)) {
m = aMaster[0][aTier];
aReturn = ItemUtils.getOrePrefixStack(aPrefix, m, aAmount);
-
+
//If Invalid, Try Second Material
if (!ItemUtils.checkForInvalidItems(aReturn)) {
m = aMaster[1][aTier];
aReturn = ItemUtils.getOrePrefixStack(aPrefix, m, aAmount);
-
+
//If Invalid, Try Third Material
if (!ItemUtils.checkForInvalidItems(aReturn)) {
m = aMaster[2][aTier];
aReturn = ItemUtils.getOrePrefixStack(aPrefix, m, aAmount);
-
+
//All Invalid? Ok, shit.
//Let's add a special error ingot.
if (!ItemUtils.checkForInvalidItems(aReturn)) {
@@ -858,12 +848,12 @@ public class CI {
}
}
}
-
+
return aReturn;
-
+
}
-
+
public static ItemStack getElectricMotor(int aTier, int aSize) {
ItemStack aType;
int aLazyTier = 0;
@@ -902,7 +892,7 @@ public class CI {
}
return ItemUtils.getSimpleStack(aType, aSize);
}
-
+
public static ItemStack getElectricPiston(int aTier, int aSize) {
ItemStack aType;
int aLazyTier = 0;
@@ -941,7 +931,7 @@ public class CI {
}
return ItemUtils.getSimpleStack(aType, aSize);
}
-
+
public static ItemStack getElectricPump(int aTier, int aSize) {
ItemStack aType;
int aLazyTier = 0;
@@ -980,7 +970,7 @@ public class CI {
}
return ItemUtils.getSimpleStack(aType, aSize);
}
-
+
public static ItemStack getRobotArm(int aTier, int aSize) {
ItemStack aType;
int aLazyTier = 0;
@@ -1019,7 +1009,7 @@ public class CI {
}
return ItemUtils.getSimpleStack(aType, aSize);
}
-
+
public static ItemStack getConveyor(int aTier, int aSize) {
ItemStack aType;
int aLazyTier = 0;
@@ -1058,7 +1048,7 @@ public class CI {
}
return ItemUtils.getSimpleStack(aType, aSize);
}
-
+
public static ItemStack getEmitter(int aTier, int aSize) {
ItemStack aType;
int aLazyTier = 0;
@@ -1097,7 +1087,7 @@ public class CI {
}
return ItemUtils.getSimpleStack(aType, aSize);
}
-
+
public static ItemStack getSensor(int aTier, int aSize) {
ItemStack aType;
int aLazyTier = 0;
@@ -1136,7 +1126,7 @@ public class CI {
}
return ItemUtils.getSimpleStack(aType, aSize);
}
-
+
public static ItemStack getFieldGenerator(int aTier, int aSize) {
ItemStack aType;
int aLazyTier = 0;
@@ -1175,9 +1165,9 @@ public class CI {
}
return ItemUtils.getSimpleStack(aType, aSize);
}
-
-
+
+
public static ItemStack getTieredMachineHull(int aTier, int aSize) {
ItemStack aType;
int aLazyTier = 0;
@@ -1293,7 +1283,7 @@ public class CI {
public static ItemStack getGreenCatalyst(int aAmount) {
return ItemUtils.simpleMetaStack(AgriculturalChem.mAgrichemItem1, 14, aAmount);
}
-
+
/**
* Iron + Copper Catalyst
* @param aAmount - Stacksize
@@ -1302,7 +1292,7 @@ public class CI {
public static ItemStack getRedCatalyst(int aAmount) {
return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 0, aAmount);
}
-
+
/**
* Tungsten + Nickel Catalyst
* @param aAmount - Stacksize
@@ -1311,7 +1301,7 @@ public class CI {
public static ItemStack getYellowCatalyst(int aAmount) {
return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 1, aAmount);
}
-
+
/**
* Cobalt + Titanium Catalyst
* @param aAmount - Stacksize
@@ -1320,7 +1310,7 @@ public class CI {
public static ItemStack getBlueCatalyst(int aAmount) {
return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 2, aAmount);
}
-
+
/**
* Vanadium + Palladium Catalyst
* @param aAmount - Stacksize
@@ -1329,7 +1319,7 @@ public class CI {
public static ItemStack getOrangeCatalyst(int aAmount) {
return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 3, aAmount);
}
-
+
/**
* Iridium + Ruthenium Catalyst
* @param aAmount - Stacksize
@@ -1338,7 +1328,7 @@ public class CI {
public static ItemStack getPurpleCatalyst(int aAmount) {
return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 4, aAmount);
}
-
+
/**
* Aluminium + Nickel Catalyst
* @param aAmount - Stacksize
@@ -1347,7 +1337,7 @@ public class CI {
public static ItemStack getBrownCatalyst(int aAmount) {
return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 5, aAmount);
}
-
+
/**
* Platinum + Rhodium Catalyst
* @param aAmount - Stacksize
diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java
index 234b54d2d2..72b13b3067 100644
--- a/src/Java/gtPlusPlus/core/util/Utils.java
+++ b/src/Java/gtPlusPlus/core/util/Utils.java
@@ -935,22 +935,6 @@ public class Utils {
return false;
}
- public static ItemList getValueOfItemList(String string, ItemList aOther) {
- ItemList[] aListValues = ItemList.class.getEnumConstants();
- for (ItemList aItem : aListValues) {
- if (aItem != null) {
- if (aItem.name().equals(string) || aItem.name().toLowerCase().equals(string.toLowerCase())) {
- return aItem;
- }
- }
- }
- Logger.INFO("Tried to obtain '"+string+"' from the GT ItemList, however it does not exist.");
- if (aOther != null) {
- Logger.INFO("Using fallback option instead - "+aOther.name());
- }
- return aOther;
- }
-
public static long getMillisSince(long aStartTime, long aCurrentTime) {
return (aCurrentTime - aStartTime);
}
diff --git a/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java b/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java
index b1cd1697f5..f8fc15c778 100644
--- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java
+++ b/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java
@@ -1,12 +1,12 @@
package gtPlusPlus.core.util.debug;
-import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.preloader.CORE_Preloader;
public class DEBUG_INIT {
public static void registerBlocks(){
//Debug Loading
- if (CORE.DEBUG){
+ if (CORE_Preloader.DEBUG_MODE){
}
}
diff --git a/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java
index 49aa3a1306..66f9e2453d 100644
--- a/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java
+++ b/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java
@@ -29,8 +29,23 @@ import net.minecraft.world.biome.BiomeGenBase;
public class EntityUtils {
- public static void setEntityOnFire(final Entity entity, final int length){
- entity.setFire(length);
+ public static void setEntityOnFire(final Entity aEntity, final int length){
+ if (!isEntityImmuneToFire(aEntity)) {
+ aEntity.setFire(length);
+ }
+ }
+
+ public static boolean isEntityOnFire(final Entity aEntity) {
+ Field aIsOnFire = ReflectionUtils.getField(Entity.class, "fire");
+ if (aIsOnFire != null) {
+ int aFireTime = (int) ReflectionUtils.getFieldValue(aIsOnFire, aEntity);
+ return aFireTime > 0;
+ }
+ return false;
+ }
+
+ public static boolean isEntityImmuneToFire(Entity aEntity) {
+ return aEntity.isImmuneToFire();
}
public static int getFacingDirection(final Entity entity){
@@ -59,6 +74,13 @@ public class EntityUtils {
final int blockZ = MathHelper.floor_double(parEntity.posZ);
return new BlockPos(blockX, blockY, blockZ, parEntity.worldObj);
}
+
+ public static BlockPos findBlockPosOfEntity(final Entity parEntity){
+ final int blockX = MathHelper.floor_double(parEntity.posX);
+ final int blockY = MathHelper.floor_double(parEntity.boundingBox.minY);
+ final int blockZ = MathHelper.floor_double(parEntity.posZ);
+ return new BlockPos(blockX, blockY, blockZ, parEntity.worldObj);
+ }
//TODO
public static void registerEntityToBiomeSpawns(final Class<EntityLiving> classy, final EnumCreatureType EntityType, final BiomeGenBase baseBiomeGen){
diff --git a/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java
index d7b6bc0a30..758ec8bab0 100644
--- a/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java
+++ b/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java
@@ -1,14 +1,9 @@
package gtPlusPlus.core.util.minecraft;
-import net.minecraft.init.Items;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-
import gregtech.api.enums.Dyes;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.util.GT_LanguageManager;
-
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.minecraft.FluidGT6;
import gtPlusPlus.core.item.base.BaseItemComponent;
@@ -19,7 +14,14 @@ import gtPlusPlus.core.material.MaterialStack;
import gtPlusPlus.core.recipe.common.CI;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials;
-import net.minecraftforge.fluids.*;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidContainerRegistry;
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.IFluidContainerItem;
public class FluidUtils {
@@ -611,5 +613,9 @@ public class FluidUtils {
}
}
+ public static FluidStack getAir(int aAmount) {
+ return FluidUtils.getFluidStack("air", aAmount);
+ }
+
}
diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java
index d7d611a1e4..725799a43d 100644
--- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java
+++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java
@@ -27,6 +27,7 @@ import gtPlusPlus.core.item.base.dusts.decimal.BaseItemDecidust;
import gtPlusPlus.core.item.base.plates.BaseItemPlate_OLD;
import gtPlusPlus.core.item.chemistry.AgriculturalChem;
import gtPlusPlus.core.item.chemistry.GenericChem;
+import gtPlusPlus.core.item.chemistry.RocketFuels;
import gtPlusPlus.core.item.tool.staballoy.MultiPickaxeBase;
import gtPlusPlus.core.item.tool.staballoy.MultiSpadeBase;
import gtPlusPlus.core.lib.CORE;
@@ -36,13 +37,13 @@ import gtPlusPlus.core.recipe.common.CI;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.preloader.CORE_Preloader;
import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaTool;
import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools;
import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_DustGeneration;
import net.minecraft.block.Block;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentData;
-import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
@@ -354,7 +355,7 @@ public class ItemUtils {
}
public static ItemStack getItemStackOfAmountFromOreDictNoBroken(String oredictName, final int amount) {
- if (CORE.DEBUG) {
+ if (CORE_Preloader.DEBUG_MODE) {
Logger.WARNING("Looking up: " + oredictName + " - from method: " + ReflectionUtils.getMethodName(1));
Logger.WARNING("Looking up: " + oredictName + " - from method: " + ReflectionUtils.getMethodName(2));
Logger.WARNING("Looking up: " + oredictName + " - from method: " + ReflectionUtils.getMethodName(3));
@@ -1220,7 +1221,6 @@ public class ItemUtils {
return GT_Values.NI;
}
-
public static ItemStack depleteStack(ItemStack aStack) {
return depleteStack(aStack, 1);
}
@@ -1235,41 +1235,6 @@ public class ItemUtils {
}
return getNullStack();
}
-
- public static ItemStack getItemListObject(String aObjectFromExperimentalName, String aReplacementName, int aAmount) {
- ItemList aItemListObject = getItemListObject(aObjectFromExperimentalName, aReplacementName);
- if (aItemListObject == ItemList.NULL || aItemListObject == null) {
- return null;
- }
- else {
- return aItemListObject.get(aAmount);
- }
- }
-
- public static ItemStack getItemListObject(ItemList aItemListObject, int aAmount) {
- if (aItemListObject == ItemList.NULL || aItemListObject == null) {
- return null;
- }
- else {
- return aItemListObject.get(aAmount);
- }
- }
-
- public static ItemList getItemListObject(String aObjectFromExperimentalName, String aReplacementName) {
- ItemList aVal = ItemList.valueOf(aObjectFromExperimentalName);
- if (aVal != null) {
- return aVal;
- }
- else {
- aVal = ItemList.valueOf(aReplacementName);
- if (aVal != null) {
- return aVal;
- }
- else {
- return ItemList.NULL;
- }
- }
- }
public static boolean isControlCircuit(ItemStack aStack) {
if (aStack != null) {
@@ -1282,7 +1247,9 @@ public class ItemUtils {
}
public static boolean isCatalyst(ItemStack aStack) {
-
+ if (GT_Utility.areStacksEqual(aStack, RocketFuels.Formaldehyde_Catalyst_Stack, true)) {
+ return true;
+ }
if (GT_Utility.areStacksEqual(aStack, GenericChem.mBlueCatalyst, true)) {
return true;
}
@@ -1309,9 +1276,69 @@ public class ItemUtils {
}
return false;
}
+
+ public static boolean isMillingBall(ItemStack aStack) {
+ if (GT_Utility.areStacksEqual(aStack, GenericChem.mMillingBallAlumina, true)) {
+ return true;
+ }
+ if (GT_Utility.areStacksEqual(aStack, GenericChem.mMillingBallSoapstone, true)) {
+ return true;
+ }
+ return false;
+ }
public static String getLocalizedNameOfBlock(Block aBlock, int aMeta) {
return LangUtils.getLocalizedNameOfBlock(aBlock, aMeta);
}
+
+
+
+ public static boolean doesItemListEntryExist(String string) {
+ ItemList[] aListValues = ItemList.class.getEnumConstants();
+ for (ItemList aItem : aListValues) {
+ if (aItem != null) {
+ if (aItem.name().equals(string) || aItem.name().toLowerCase().equals(string.toLowerCase())) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public static ItemList getValueOfItemList(String string, ItemList aOther) {
+ ItemList[] aListValues = ItemList.class.getEnumConstants();
+ for (ItemList aItem : aListValues) {
+ if (aItem != null) {
+ if (aItem.name().equals(string) || aItem.name().toLowerCase().equals(string.toLowerCase())) {
+ return aItem;
+ }
+ }
+ }
+ Logger.INFO("Tried to obtain '"+string+"' from the GT ItemList, however it does not exist.");
+ if (aOther != null) {
+ Logger.INFO("Using fallback option instead - "+aOther.name());
+ }
+ return aOther;
+ }
+
+ public static ItemStack getValueOfItemList(String string, int aAmount, ItemList aOther) {
+ return getValueOfItemList(string, aOther).get(aAmount);
+ }
+
+ public static ItemStack getValueOfItemList(String string, int aAmount, ItemStack aOther) {
+ ItemList[] aListValues = ItemList.class.getEnumConstants();
+ for (ItemList aItem : aListValues) {
+ if (aItem != null) {
+ if (aItem.name().equals(string) || aItem.name().toLowerCase().equals(string.toLowerCase())) {
+ return aItem.get(aAmount);
+ }
+ }
+ }
+ Logger.INFO("Tried to obtain '"+string+"' from the GT ItemList, however it does not exist.");
+ if (aOther != null) {
+ Logger.INFO("Using fallback option instead - "+ItemUtils.getItemName(aOther));
+ }
+ return aOther;
+ }
}
diff --git a/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java
index 2108087542..64a6c9e820 100644
--- a/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java
+++ b/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java
@@ -501,5 +501,14 @@ public class MaterialUtils {
}
+ public static boolean doesMaterialExist(String aMatName) {
+ for (Materials m : Materials.values()) {
+ if (m.name().toLowerCase().equals(aMatName.toLowerCase())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/util/minecraft/PlayerUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/PlayerUtils.java
index 9a8a8e691c..e64414b493 100644
--- a/src/Java/gtPlusPlus/core/util/minecraft/PlayerUtils.java
+++ b/src/Java/gtPlusPlus/core/util/minecraft/PlayerUtils.java
@@ -188,4 +188,12 @@ public class PlayerUtils {
Utils.sendServerMessage(string);
}
+ public static boolean isCreative(EntityPlayer aPlayer) {
+ return aPlayer.capabilities.isCreativeMode;
+ }
+
+ public static boolean canTakeDamage(EntityPlayer aPlayer) {
+ return !aPlayer.capabilities.disableDamage;
+ }
+
}
diff --git a/src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java
index 13bc0c9382..56772f0dc7 100644
--- a/src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java
+++ b/src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java
@@ -20,6 +20,7 @@ import gtPlusPlus.api.objects.minecraft.ShapedRecipe;
import gtPlusPlus.core.handler.COMPAT_HANDLER;
import gtPlusPlus.core.handler.Recipes.LateRegistrationHandler;
import gtPlusPlus.core.handler.Recipes.RegistrationHandler;
+import gtPlusPlus.core.item.ModItems;
import gtPlusPlus.core.recipe.common.CI;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
import net.minecraft.item.Item;
@@ -632,5 +633,16 @@ public static int mInvalidID = 1;
}
+ public static void addSmeltingRecipe(ItemStack aStackInput, ItemStack aStackOutput) {
+ addSmeltingRecipe(aStackInput, aStackOutput, 0f);
+ }
+
+ public static void addSmeltingRecipe(ItemStack aStackInput, ItemStack aStackOutput, float aXpGained) {
+
+ GameRegistry.addSmelting(aStackInput, aStackOutput, aXpGained);
+
+ }
+
+
}
diff --git a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java
index 4d8a02d800..e45d27b926 100644
--- a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java
+++ b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java
@@ -365,7 +365,13 @@ public class ReflectionUtils {
public static boolean setField(final Object object, final String fieldName, final Object fieldValue) {
- Class<?> clazz = object.getClass();
+ Class<?> clazz;
+ if (object instanceof Class) {
+ clazz = (Class<?>) object;
+ }
+ else {
+ clazz = object.getClass();
+ }
while (clazz != null) {
try {
final Field field = getField(clazz, fieldName);
@@ -387,7 +393,13 @@ public class ReflectionUtils {
}
public static boolean setField(final Object object, final Field field, final Object fieldValue) {
- Class<?> clazz = object.getClass();
+ Class<?> clazz;
+ if (object instanceof Class) {
+ clazz = (Class<?>) object;
+ }
+ else {
+ clazz = object.getClass();
+ }
while (clazz != null) {
try {
final Field field2 = getField(clazz, field.getName());
@@ -522,6 +534,25 @@ public class ReflectionUtils {
return false;
}
+
+ public static Object invokeNonBool(Object objectInstance, Method method, Object[] values){
+ if (objectInstance == null || method == null || values == null){
+ return false;
+ }
+ String methodName = method.getName();
+ Class<?> mLocalClass = (objectInstance instanceof Class ? (Class<?>) objectInstance : objectInstance.getClass());
+ Logger.REFLECTION("Trying to invoke "+methodName+" on an instance of "+mLocalClass.getCanonicalName()+".");
+ try {
+ return method.invoke(objectInstance, values);
+ }
+ catch (SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ Logger.REFLECTION("Failed to Dynamically invoke "+methodName+" on an object of type: "+mLocalClass.getName());
+ }
+
+ Logger.REFLECTION("Invoke failed or did something wrong.");
+ return null;
+ }
+
public static Object invokeNonBool(Object objectInstance, String methodName, Class[] parameters, Object[] values){
if (objectInstance == null || methodName == null || parameters == null || values == null){
return false;
@@ -973,9 +1004,9 @@ public class ReflectionUtils {
*/
private static void makeModifiable(Field nameField) throws Exception {
nameField.setAccessible(true);
- Field modifiers = getField(Field.class, "modifiers");
- modifiers.setAccessible(true);
- modifiers.setInt(nameField, nameField.getModifiers() & ~Modifier.FINAL);
+ Field modifiers = getField(Field.class, "modifiers");
+ modifiers.setAccessible(true);
+ modifiers.setInt(nameField, nameField.getModifiers() & ~Modifier.FINAL);
}
diff --git a/src/Java/gtPlusPlus/core/util/sys/GeoUtils.java b/src/Java/gtPlusPlus/core/util/sys/GeoUtils.java
index 6ec6662a44..0e5a33b948 100644
--- a/src/Java/gtPlusPlus/core/util/sys/GeoUtils.java
+++ b/src/Java/gtPlusPlus/core/util/sys/GeoUtils.java
@@ -3,17 +3,22 @@ package gtPlusPlus.core.util.sys;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
-import java.net.*;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLConnection;
import org.apache.http.client.utils.URIBuilder;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.preloader.CORE_Preloader;
public class GeoUtils {
public static String determineUsersCountry(){
- if (!CORE.DEBUG && !CORE.DEVENV) {
+ if (!CORE_Preloader.DEBUG_MODE && !CORE.DEVENV) {
try {
if (NetworkUtils.checkNetworkIsAvailableWithValidInterface()){
return getUsersCountry();
diff --git a/src/Java/gtPlusPlus/core/util/sys/NetworkUtils.java b/src/Java/gtPlusPlus/core/util/sys/NetworkUtils.java
index f1417e8a2d..b883391a86 100644
--- a/src/Java/gtPlusPlus/core/util/sys/NetworkUtils.java
+++ b/src/Java/gtPlusPlus/core/util/sys/NetworkUtils.java
@@ -121,7 +121,7 @@ public class NetworkUtils {
private static boolean checkAddressWithTimeout(String URL, int timeout) {
try {
- InetAddress.getByName(URL).isReachable(3000); //Replace with your name
+ InetAddress.getByName(URL).isReachable(timeout); //Replace with your name
return true;
} catch (Exception e) {
return false;
diff --git a/src/Java/gtPlusPlus/everglades/GTplusplus_Everglades.java b/src/Java/gtPlusPlus/everglades/GTplusplus_Everglades.java
index 6c8a790037..0709f0b1ff 100644
--- a/src/Java/gtPlusPlus/everglades/GTplusplus_Everglades.java
+++ b/src/Java/gtPlusPlus/everglades/GTplusplus_Everglades.java
@@ -6,10 +6,12 @@ import java.io.File;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
-import cpw.mods.fml.common.event.*;
+import cpw.mods.fml.common.event.FMLInitializationEvent;
+import cpw.mods.fml.common.event.FMLPostInitializationEvent;
+import cpw.mods.fml.common.event.FMLPreInitializationEvent;
+import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion;
-
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.lib.CORE.Everglades;
@@ -22,6 +24,7 @@ import gtPlusPlus.everglades.block.DarkWorldContentLoader;
import gtPlusPlus.everglades.dimension.Dimension_Everglades;
import gtPlusPlus.everglades.gen.gt.WorldGen_GT_Base;
import gtPlusPlus.everglades.gen.gt.WorldGen_Ores;
+import gtPlusPlus.preloader.CORE_Preloader;
import gtPlusPlus.xmod.gregtech.HANDLER_GT;
import gtPlusPlus.xmod.gregtech.api.util.GTPP_Config;
import net.minecraftforge.common.DimensionManager;
@@ -171,7 +174,7 @@ public class GTplusplus_Everglades implements ActionListener {
WorldGen_GT_Base.oreveinPercentage = 64;
WorldGen_GT_Base.oreveinAttempts = 16;
WorldGen_GT_Base.oreveinMaxPlacementAttempts = 4;
- if (CORE.DEBUG || CORE.DEVENV){
+ if (CORE_Preloader.DEBUG_MODE || CORE.DEVENV){
WorldGen_GT_Base.debugWorldGen = true;
}
DarkWorldContentLoader.run();
diff --git a/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java b/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java
index 810076743f..29c3cecb6f 100644
--- a/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java
+++ b/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java
@@ -25,13 +25,11 @@ import gregtech.api.gui.GT_GUIContainer_BasicMachine;
import gregtech.api.objects.ItemData;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
import gregtech.api.util.Recipe_GT;
import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.minecraft.ItemUtils;
-import gtPlusPlus.nei.GT_NEI_MultiBlockHandler.CachedDefaultRecipe;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.init.Blocks;
@@ -62,7 +60,7 @@ extends TemplateRecipeHandler {
}
public List<Recipe_GT> getSortedRecipes() {
- List<Recipe_GT> result = new ArrayList<>(this.mRecipeMap.mRecipeList);
+ List<Recipe_GT> result = new ArrayList(this.mRecipeMap.mRecipeList);
Collections.sort(result);
return result;
}
@@ -206,7 +204,7 @@ extends TemplateRecipeHandler {
}
}
for (final PositionedStack tStack : tRecipe.mInputs) {
- if (aStack == tStack.item) {
+ if (GT_Utility.areStacksEqual(aStack, tStack.item)) {
if ((gregtech.api.enums.ItemList.Display_Fluid.isStackEqual(tStack.item, true, true)) ||
(tStack.item.stackSize != 0)) {
break;
diff --git a/src/Java/gtPlusPlus/nei/GT_NEI_MillingMachine.java b/src/Java/gtPlusPlus/nei/GT_NEI_MillingMachine.java
new file mode 100644
index 0000000000..b868c2422c
--- /dev/null
+++ b/src/Java/gtPlusPlus/nei/GT_NEI_MillingMachine.java
@@ -0,0 +1,472 @@
+package gtPlusPlus.nei;
+
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.lwjgl.opengl.GL11;
+
+import codechicken.lib.gui.GuiDraw;
+import codechicken.nei.PositionedStack;
+import codechicken.nei.guihook.GuiContainerManager;
+import codechicken.nei.guihook.IContainerInputHandler;
+import codechicken.nei.guihook.IContainerTooltipHandler;
+import codechicken.nei.recipe.GuiCraftingRecipe;
+import codechicken.nei.recipe.GuiRecipe;
+import codechicken.nei.recipe.GuiUsageRecipe;
+import codechicken.nei.recipe.TemplateRecipeHandler;
+import cpw.mods.fml.common.event.FMLInterModComms;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.gui.GT_GUIContainer_BasicMachine;
+import gregtech.api.objects.ItemData;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.Recipe_GT;
+import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidContainerRegistry;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GT_NEI_MillingMachine
+extends TemplateRecipeHandler {
+ public static final int sOffsetX = 5;
+ public static final int sOffsetY = 11;
+
+ static {
+ GuiContainerManager.addInputHandler(new GT_RectHandler());
+ GuiContainerManager.addTooltipHandler(new GT_RectHandler());
+ }
+
+ protected GT_Recipe_Map mRecipeMap;
+
+ public GT_NEI_MillingMachine() {
+ this.mRecipeMap = Gregtech_Recipe_Map.sOreMillRecipes;
+ this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(65, 13, 36, 18), this.getRecipeMapName(), new Object[0]));
+ if (!NEI_GT_Config.sIsAdded) {
+ FMLInterModComms.sendRuntimeMessage(GT_Values.GT, "NEIPlugins", "register-crafting-handler", "gregtechplusplus@" + this.getRecipeName() + "@" + this.getRecipeMapName());
+ GuiCraftingRecipe.craftinghandlers.add(this);
+ GuiUsageRecipe.usagehandlers.add(this);
+ }
+ }
+
+ public List<Recipe_GT> getSortedRecipes() {
+ List<Recipe_GT> result = new ArrayList(this.mRecipeMap.mRecipeList);
+ Collections.sort(result);
+ return result;
+ }
+
+ public static void drawText(final int aX, final int aY, final String aString, final int aColor) {
+ Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, aColor);
+ }
+
+ @Override
+ public TemplateRecipeHandler newInstance() {
+ return new GT_NEI_MillingMachine();
+ }
+
+ @Override
+ public void loadCraftingRecipes(final String outputId, final Object... results) {
+ if (outputId.equals(getRecipeMapName())) {
+ for (Recipe_GT tRecipe : getSortedRecipes()) {
+ if (!tRecipe.mHidden) {
+ this.arecipes.add(new CachedDefaultRecipe(tRecipe));
+ }
+ }
+ } else {
+ super.loadCraftingRecipes(outputId, results);
+ }
+ }
+
+ @Override
+ public void loadCraftingRecipes(final ItemStack aResult) {
+ ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aResult);
+
+ ArrayList<ItemStack> tResults = new ArrayList<ItemStack>();
+ tResults.add(aResult);
+ tResults.add(GT_OreDictUnificator.get(true, aResult));
+ if ((tPrefixMaterial != null) && (!tPrefixMaterial.mBlackListed) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) {
+ for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) {
+ tResults.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L));
+ }
+ }
+ FluidStack tFluid = GT_Utility.getFluidForFilledItem(aResult, true);
+ if (tFluid != null) {
+ tResults.add(GT_Utility.getFluidDisplayStack(tFluid, false));
+ for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) {
+ if (tData.fluid.isFluidEqual(tFluid)) {
+ tResults.add(GT_Utility.copy(new Object[]{tData.filledContainer}));
+ }
+ }
+ }
+ for (Recipe_GT tRecipe : getSortedRecipes()) {
+ if (!tRecipe.mHidden) {
+ CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe);
+ for (ItemStack tStack : tResults) {
+ if (tNEIRecipe.contains(tNEIRecipe.mOutputs, tStack)) {
+ this.arecipes.add(tNEIRecipe);
+ break;
+ }
+ }
+ }
+ }
+ //CachedDefaultRecipe tNEIRecipe;
+ }
+
+ public void loadUsageRecipes(ItemStack aInput) {
+ ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aInput);
+
+ ArrayList<ItemStack> tInputs = new ArrayList<ItemStack>();
+ tInputs.add(aInput);
+ tInputs.add(GT_OreDictUnificator.get(false, aInput));
+ if ((tPrefixMaterial != null) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) {
+ for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) {
+ tInputs.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L));
+ }
+ }
+ FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInput, true);
+ if (tFluid != null) {
+ tInputs.add(GT_Utility.getFluidDisplayStack(tFluid, false));
+ for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) {
+ if (tData.fluid.isFluidEqual(tFluid)) {
+ tInputs.add(GT_Utility.copy(new Object[]{tData.filledContainer}));
+ }
+ }
+ }
+ for (Recipe_GT tRecipe : getSortedRecipes()) {
+ if (!tRecipe.mHidden) {
+ CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe);
+ for (ItemStack tStack : tInputs) {
+ if (tNEIRecipe.contains(tNEIRecipe.mInputs, tStack)) {
+ this.arecipes.add(tNEIRecipe);
+ break;
+ }
+ }
+ }
+ }
+ //CachedDefaultRecipe tNEIRecipe;
+ }
+
+ public String getRecipeMapName() {
+ return this.mRecipeMap.mNEIName;
+ }
+
+ @Override
+ public String getOverlayIdentifier() {
+ return this.mRecipeMap.mNEIName;
+ }
+
+ @Override
+ public void drawBackground(final int recipe) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ GuiDraw.changeTexture(this.getGuiTexture());
+ GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 78);
+ }
+
+ @Override
+ public int recipiesPerPage() {
+ return 1;
+ }
+
+ @Override
+ public String getRecipeName() {
+ return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName);
+ }
+
+ @Override
+ public String getGuiTexture() {
+ return this.mRecipeMap.mNEIGUIPath;
+ }
+
+ @Override
+ public List<String> handleItemTooltip(final GuiRecipe gui, final ItemStack aStack, final List<String> currenttip, final int aRecipeIndex) {
+ final TemplateRecipeHandler.CachedRecipe tObject = this.arecipes.get(aRecipeIndex);
+ if ((tObject instanceof CachedDefaultRecipe)) {
+ final CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject;
+ for (final PositionedStack tStack : tRecipe.mOutputs) {
+ if (aStack == tStack.item) {
+ if ((!(tStack instanceof FixedPositionedStack)) || (((FixedPositionedStack) tStack).mChance <= 0) || (((FixedPositionedStack) tStack).mChance == 10000)) {
+ break;
+ }
+ currenttip.add("Chance: " + (((FixedPositionedStack) tStack).mChance / 100) + "." + ((((FixedPositionedStack) tStack).mChance % 100) < 10 ? "0" + (((FixedPositionedStack) tStack).mChance % 100) : Integer.valueOf(((FixedPositionedStack) tStack).mChance % 100)) + "%");
+ break;
+ }
+ }
+ for (final PositionedStack tStack : tRecipe.mInputs) {
+ if (GT_Utility.areStacksEqual(aStack, tStack.item)) {
+ if ((gregtech.api.enums.ItemList.Display_Fluid.isStackEqual(tStack.item, true, true)) ||
+ (tStack.item.stackSize != 0)) {
+ break;
+ }
+ if (ItemUtils.isMillingBall(aStack)) {
+ currenttip.add("Does not always get consumed in the process");
+ }
+ else if (ItemUtils.isControlCircuit(aStack)) {
+ currenttip.add("Does not get consumed in the process");
+ }
+ break;
+ }
+ }
+ }
+ return currenttip;
+ }
+
+ @Override
+ public void drawExtras(final int aRecipeIndex) {
+ final long tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt;
+ final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration;
+ if (tEUt != 0) {
+ drawText(10, 73, "Total: " + (long) (tDuration * tEUt) + " EU", -16777216);
+ //drawText(10, 83, "Usage: " + tEUt + " EU/t", -16777216);
+ if (this.mRecipeMap.mShowVoltageAmperageInNEI) {
+ drawText(10, 83, "Voltage: " + (tEUt / this.mRecipeMap.mAmperage) + " EU/t", -16777216);
+ drawText(10, 93, "Amperage: " + this.mRecipeMap.mAmperage, -16777216);
+ } else {
+ drawText(10, 93, "Voltage: unspecified", -16777216);
+ drawText(10, 103, "Amperage: unspecified", -16777216);
+ }
+ }
+ if (tDuration > 0) {
+ drawText(10, 103, "Time: " + (tDuration < 20 ? "< 1" : Integer.valueOf(tDuration / 20)) + " secs", -16777216);
+ }
+ if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) {
+ drawText(10, 113, this.mRecipeMap.mNEISpecialValuePre + (((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost, -16777216);
+ }
+ }
+
+ public static class GT_RectHandler
+ implements IContainerInputHandler, IContainerTooltipHandler {
+ @Override
+ public boolean mouseClicked(final GuiContainer gui, final int mousex, final int mousey, final int button) {
+ if (this.canHandle(gui)) {
+ if (button == 0) {
+ return this.transferRect(gui, false);
+ }
+ if (button == 1) {
+ return this.transferRect(gui, true);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean lastKeyTyped(final GuiContainer gui, final char keyChar, final int keyCode) {
+ return false;
+ }
+
+ public boolean canHandle(final GuiContainer gui) {
+ return (((gui instanceof GT_GUIContainer_BasicMachine)) && (GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI)) /*|| ((gui instanceof GT_GUIContainer_FusionReactor)) && (GT_Utility.isStringValid(((GT_GUIContainer_FusionReactor) gui).mNEI))*/);
+ }
+
+ @Override
+ public List<String> handleTooltip(final GuiContainer gui, final int mousex, final int mousey, final List<String> currenttip) {
+ if ((this.canHandle(gui)) && (currenttip.isEmpty())) {
+ if ((gui instanceof GT_GUIContainer_BasicMachine) && new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) {
+ currenttip.add("Recipes");
+ } /*else if (gui instanceof GT_GUIContainer_FusionReactor && new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) {
+ currenttip.add("Recipes");
+ }*/
+
+ }
+ return currenttip;
+ }
+
+ private boolean transferRect(final GuiContainer gui, final boolean usage) {
+ if (gui instanceof GT_GUIContainer_BasicMachine) {
+ return (this.canHandle(gui)) && (new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0]));
+ } /*else if (gui instanceof GT_GUIContainer_FusionReactor) {
+ return (canHandle(gui)) && (new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0]));
+ }*/
+ return false;
+ }
+
+ @Override
+ public List<String> handleItemDisplayName(final GuiContainer gui, final ItemStack itemstack, final List<String> currenttip) {
+ return currenttip;
+ }
+
+ @Override
+ public List<String> handleItemTooltip(final GuiContainer gui, final ItemStack itemstack, final int mousex, final int mousey, final List<String> currenttip) {
+ return currenttip;
+ }
+
+ @Override
+ public boolean keyTyped(final GuiContainer gui, final char keyChar, final int keyCode) {
+ return false;
+ }
+
+ @Override
+ public void onKeyTyped(final GuiContainer gui, final char keyChar, final int keyID) {
+ }
+
+ @Override
+ public void onMouseClicked(final GuiContainer gui, final int mousex, final int mousey, final int button) {
+ }
+
+ @Override
+ public void onMouseUp(final GuiContainer gui, final int mousex, final int mousey, final int button) {
+ }
+
+ @Override
+ public boolean mouseScrolled(final GuiContainer gui, final int mousex, final int mousey, final int scrolled) {
+ return false;
+ }
+
+ @Override
+ public void onMouseScrolled(final GuiContainer gui, final int mousex, final int mousey, final int scrolled) {
+ }
+
+ @Override
+ public void onMouseDragged(final GuiContainer gui, final int mousex, final int mousey, final int button, final long heldTime) {
+ }
+ }
+
+ public class FixedPositionedStack
+ extends PositionedStack {
+ public final int mChance;
+ public boolean permutated = false;
+
+ public FixedPositionedStack(final Object object, final int x, final int y) {
+ this(object, x, y, 0);
+ }
+
+ public FixedPositionedStack(final Object object, final int x, final int y, final int aChance) {
+ super(object, x, y, true);
+ this.mChance = aChance;
+ }
+
+ @Override
+ public void generatePermutations() {
+ if (this.permutated) {
+ return;
+ }
+ final ArrayList<ItemStack> tDisplayStacks = new ArrayList<ItemStack>();
+ for (final ItemStack tStack : this.items) {
+ if (GT_Utility.isStackValid(tStack)) {
+ if (tStack.getItemDamage() == 32767) {
+ final List<ItemStack> permutations = codechicken.nei.ItemList.itemMap.get(tStack.getItem());
+ if (!permutations.isEmpty()) {
+ ItemStack stack;
+ for (final Iterator<ItemStack> i$ = permutations.iterator(); i$.hasNext(); tDisplayStacks.add(GT_Utility.copyAmount(tStack.stackSize, new Object[]{stack}))) {
+ stack = i$.next();
+ }
+ } else {
+ final ItemStack base = new ItemStack(tStack.getItem(), tStack.stackSize);
+ base.stackTagCompound = tStack.stackTagCompound;
+ tDisplayStacks.add(base);
+ }
+ } else {
+ tDisplayStacks.add(GT_Utility.copy(new Object[]{tStack}));
+ }
+ }
+ }
+ this.items = (tDisplayStacks.toArray(new ItemStack[0]));
+ if (this.items.length == 0) {
+ this.items = new ItemStack[]{new ItemStack(Blocks.fire)};
+ }
+ this.permutated = true;
+ this.setPermutationToRender(0);
+ }
+ }
+
+ public class CachedDefaultRecipe
+ extends TemplateRecipeHandler.CachedRecipe {
+ public final GT_Recipe mRecipe;
+ public final List<PositionedStack> mOutputs = new ArrayList<PositionedStack>();
+ public final List<PositionedStack> mInputs = new ArrayList<PositionedStack>();
+
+ public CachedDefaultRecipe(final GT_Recipe aRecipe) {
+ super();
+ this.mRecipe = aRecipe;
+
+ int tStartIndex = 0;
+
+ if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
+ this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 14));
+ }
+ tStartIndex++;
+ if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
+ this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14));
+ }
+ tStartIndex++;
+ if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
+ this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14));
+ }
+ tStartIndex++;
+
+ if (aRecipe.mSpecialItems != null) {
+ this.mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 120, 52));
+ }
+ tStartIndex = 0;
+
+ //Four Output Slots
+ if (aRecipe.getOutput(tStartIndex) != null) {
+ this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 5, aRecipe.getOutputChance(tStartIndex)));
+ }
+ tStartIndex++;
+ if (aRecipe.getOutput(tStartIndex) != null) {
+ this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 5, aRecipe.getOutputChance(tStartIndex)));
+ }
+ tStartIndex++;
+ if (aRecipe.getOutput(tStartIndex) != null) {
+ this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 23, aRecipe.getOutputChance(tStartIndex)));
+ }
+ tStartIndex++;
+ if (aRecipe.getOutput(tStartIndex) != null) {
+ this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 23, aRecipe.getOutputChance(tStartIndex)));
+ }
+ tStartIndex++;
+
+
+ //New fluid display behaviour when 3 fluid inputs are detected. (Basically a mix of the code below for outputs an the code above for 9 input slots.)
+ if (aRecipe.mFluidInputs.length >= 1) {
+ if ((aRecipe.mFluidInputs[0] != null) && (aRecipe.mFluidInputs[0].getFluid() != null)) {
+ this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[0], true), 3, 31));
+ }
+ if ((aRecipe.mFluidInputs.length > 1) && (aRecipe.mFluidInputs[1] != null) && (aRecipe.mFluidInputs[1].getFluid() != null)) {
+ this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[1], true), 21, 31));
+ }
+ if ((aRecipe.mFluidInputs.length > 2) && (aRecipe.mFluidInputs[2] != null) && (aRecipe.mFluidInputs[2].getFluid() != null)) {
+ this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[2], true), 39, 31));
+ }
+ if ((aRecipe.mFluidInputs.length > 3) && (aRecipe.mFluidInputs[3] != null) && (aRecipe.mFluidInputs[3].getFluid() != null)) {
+ this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[3], true), 57, 31));
+ }
+ }
+
+ if (aRecipe.mFluidOutputs.length > 0) {
+ if ((aRecipe.mFluidOutputs[0] != null) && (aRecipe.mFluidOutputs[0].getFluid() != null)) {
+ this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 138, 5));
+ }
+ if ((aRecipe.mFluidOutputs.length > 1) && (aRecipe.mFluidOutputs[1] != null) && (aRecipe.mFluidOutputs[1].getFluid() != null)) {
+ this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[1], true), 138, 23));
+ }
+ }
+ }
+
+ @Override
+ public List<PositionedStack> getIngredients() {
+ return this.getCycledIngredients(GT_NEI_MillingMachine.this.cycleticks / 10, this.mInputs);
+ }
+
+ @Override
+ public PositionedStack getResult() {
+ return null;
+ }
+
+ @Override
+ public List<PositionedStack> getOtherStacks() {
+ return this.mOutputs;
+ }
+ }
+}
diff --git a/src/Java/gtPlusPlus/nei/NEI_GT_Config.java b/src/Java/gtPlusPlus/nei/NEI_GT_Config.java
index 45d406aa96..438ada00ba 100644
--- a/src/Java/gtPlusPlus/nei/NEI_GT_Config.java
+++ b/src/Java/gtPlusPlus/nei/NEI_GT_Config.java
@@ -4,15 +4,21 @@ import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
import gregtech.api.util.CustomRecipeMap;
import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map;
-import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.chemplant.GregtechMTE_ChemicalPlant;
+import gtPlusPlus.api.objects.data.AutoMap;
public class NEI_GT_Config
implements IConfigureNEI {
public static boolean sIsAdded = true;
+
+ private static final AutoMap<String> mUniqueRecipeMapHandling = new AutoMap<String>();
@Override
public synchronized void loadConfig() {
sIsAdded = false;
+
+ mUniqueRecipeMapHandling.add(Gregtech_Recipe_Map.sChemicalPlantRecipes.mUnlocalizedName);
+ mUniqueRecipeMapHandling.add(Gregtech_Recipe_Map.sOreMillRecipes.mUnlocalizedName);
+
for (final CustomRecipeMap tMap : gregtech.api.util.CustomRecipeMap.sMappings) {
if (tMap.mNEIAllowed) {
new GT_NEI_DefaultHandler(tMap);
@@ -20,12 +26,13 @@ implements IConfigureNEI {
}
for (final Gregtech_Recipe_Map tMap : gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map.sMappings) {
if (tMap.mNEIAllowed) {
- if (!tMap.mUnlocalizedName.equals(Gregtech_Recipe_Map.sChemicalPlantRecipes.mUnlocalizedName)) {
+ if (!mUniqueRecipeMapHandling.contains(tMap.mUnlocalizedName)) {
new GT_NEI_MultiBlockHandler(tMap);
}
}
}
new GT_NEI_FluidReactor();
+ new GT_NEI_MillingMachine();
sIsAdded = true;
API.registerRecipeHandler(new DecayableRecipeHandler());
API.registerUsageHandler(new DecayableRecipeHandler());
diff --git a/src/Java/gtPlusPlus/plugin/sulfurchem/Core_SulfuricChemistry.java b/src/Java/gtPlusPlus/plugin/sulfurchem/Core_SulfuricChemistry.java
index 6da6ddccaa..ed6762c69d 100644
--- a/src/Java/gtPlusPlus/plugin/sulfurchem/Core_SulfuricChemistry.java
+++ b/src/Java/gtPlusPlus/plugin/sulfurchem/Core_SulfuricChemistry.java
@@ -1,6 +1,5 @@
package gtPlusPlus.plugin.sulfurchem;
-import gregtech.api.enums.GT_Values;
import gregtech.api.enums.Materials;
import gregtech.api.util.GT_Recipe;
import gtPlusPlus.api.interfaces.IPlugin;
@@ -11,6 +10,7 @@ import gtPlusPlus.core.util.minecraft.FluidUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.minecraft.RecipeUtils;
import gtPlusPlus.plugin.manager.Core_Manager;
+import gtPlusPlus.preloader.CORE_Preloader;
import gtPlusPlus.xmod.gregtech.common.StaticFields59;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
@@ -57,7 +57,7 @@ public class Core_SulfuricChemistry implements IPlugin {
int addedNew = addRevisedGT6Recipes();
log("Added "+addedNew+" new Sulfuric Chemistry recipes.");
- if (CORE.DEVENV || CORE.DEBUG) {
+ if (CORE.DEVENV || CORE_Preloader.DEBUG_MODE) {
for (int i=0;i<2;i++) {
for (GT_Recipe m : mRemovedRecipes1) {
String[] mInfo = RecipeUtils.getRecipeInfo(m);
diff --git a/src/Java/gtPlusPlus/preloader/CORE_Preloader.java b/src/Java/gtPlusPlus/preloader/CORE_Preloader.java
index b8ebdaf49c..49209307f7 100644
--- a/src/Java/gtPlusPlus/preloader/CORE_Preloader.java
+++ b/src/Java/gtPlusPlus/preloader/CORE_Preloader.java
@@ -1,14 +1,33 @@
package gtPlusPlus.preloader;
+import java.io.File;
import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
+import cpw.mods.fml.common.versioning.ArtifactVersion;
+
public class CORE_Preloader {
+
public static final String NAME = "GT++ Preloader";
public static final String MODID = "GT++_Preloader";
- public static final String VERSION = "0.4-Beta";
+ public static final String VERSION = "0.5-Beta";
+ public static final List<ArtifactVersion> DEPENDENCIES;
+ public static final String JAVA_VERSION = System.getProperty("java.version");
+
+ public static File MC_DIR;
+ public static boolean DEV_ENVIRONMENT = false;
+ public static boolean DEBUG_MODE = false;
public static boolean enableOldGTcircuits = false;
public static int enableWatchdogBGM = 0;
- public static List<?> DEPENDENCIES = new ArrayList<>(Arrays.asList(new String[] {"required-before:gregtech;"}));
+
+ public static void setMinecraftDirectory(File aDir) {
+ MC_DIR = aDir;
+ }
+
+ static {
+ ArrayList<ArtifactVersion> deps = new ArrayList<ArtifactVersion>();
+ //deps.add("required-before:gregtech;");
+ DEPENDENCIES = Collections.unmodifiableList(deps);
+ }
}
diff --git a/src/Java/gtPlusPlus/preloader/DevHelper.java b/src/Java/gtPlusPlus/preloader/DevHelper.java
index 81d36d591b..70a3c53073 100644
--- a/src/Java/gtPlusPlus/preloader/DevHelper.java
+++ b/src/Java/gtPlusPlus/preloader/DevHelper.java
@@ -5,7 +5,6 @@ import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
-import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.Pair;
import gtPlusPlus.api.objects.data.weakref.WeakAutoMap;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
@@ -118,7 +117,7 @@ public class DevHelper {
String aForgeName = DevHelperInternals.srgToForge.get(mSrgName);
return aForgeName != null ? aForgeName : "BAD_FORGE_NAME";
}
-
+
public static String getMinecraftClassName(String adeObName, boolean obfuscated) {
if (obfuscated) {
return getObfuscated(adeObName);
@@ -130,7 +129,7 @@ public class DevHelper {
String obfuscatedClassname = DevHelperInternals.deObToOb.get(mDeob);
obfuscatedClassname = obfuscatedClassname != null ? obfuscatedClassname : "BAD_OBFUSCATED_CLASS_NAME";
if (obfuscatedClassname.equals("BAD_OBFUSCATED_CLASS_NAME")) {
- Logger.INFO("[Fix] Failed to Get Deobfuscated name for "+mDeob);
+ Preloader_Logger.INFO("[Fix] Failed to Get Deobfuscated name for "+mDeob);
}
return obfuscatedClassname;
}
@@ -139,15 +138,15 @@ public class DevHelper {
String deobfuscatedClassname = DevHelperInternals.obToDeOb.get(mOb);
return deobfuscatedClassname != null ? deobfuscatedClassname : "BAD_DEOBFUSCATED_CLASS_NAME";
}
-
+
public static class DevHelperInternals {
- public static Map<String, String> srgToForge = new HashMap<String, String>();
- public static Map<String, String> forgeToSrg = new HashMap<String, String>();
+ public static final Map<String, String> srgToForge = new HashMap<String, String>();
+ public static final Map<String, String> forgeToSrg = new HashMap<String, String>();
private static WeakAutoMap<Pair<String, String>> mInitMap = new WeakAutoMap<Pair<String, String>>();
//Obfuscation
- public static Map<String, String> obToDeOb = new HashMap<String, String>();
- public static Map<String, String> deObToOb = new HashMap<String, String>();
+ public static final Map<String, String> obToDeOb = new HashMap<String, String>();
+ public static final Map<String, String> deObToOb = new HashMap<String, String>();
private static WeakAutoMap<Pair<String, String>> mObInitMap = new WeakAutoMap<Pair<String, String>>();
private static boolean init() {
@@ -176,14 +175,90 @@ public class DevHelper {
}
}
}
- Logger.INFO("[DevHelper] mInitMap size: "+mInitMap.size());
- Logger.INFO("[DevHelper] mObInitMap size: "+mObInitMap.size());
+ Preloader_Logger.INFO("[DevHelper] mInitMap size: "+mInitMap.size());
+ Preloader_Logger.INFO("[DevHelper] mObInitMap size: "+mObInitMap.size());
+
+ Preloader_Logger.INFO("[DevHelper] srgToForge size: "+srgToForge.size());
+ Preloader_Logger.INFO("[DevHelper] forgeToSrg size: "+forgeToSrg.size());
+ Preloader_Logger.INFO("[DevHelper] obToDeOb size: "+obToDeOb.size());
+ Preloader_Logger.INFO("[DevHelper] deObToOb size: "+deObToOb.size());
+
+ if (srgToForge.size() > 0 && forgeToSrg.size() > 0 && obToDeOb.size() > 0 && deObToOb.size() > 0) {
+ if (srgToForge.size() == forgeToSrg.size() && obToDeOb.size() == deObToOb.size()) {
+ return true;
+ }
+ else {
+ if (srgToForge.size() != forgeToSrg.size()) {
+ int aKey1 = 0;
+ int aKey2 = 0;
+ HashMap<Integer, String> aMissingForgeNames = new HashMap<Integer, String>();
+ HashMap<Integer, String> aMissingSrgNames = new HashMap<Integer, String>();
+ Preloader_Logger.INFO("Mismatch between mapped Forge and Srg names, finding missing values.");
+ if (srgToForge.size() > forgeToSrg.size()) {
+ Preloader_Logger.INFO("More SRG Keys detected.");
+ for (String aKey : srgToForge.keySet()) {
+ if (!forgeToSrg.containsValue(aKey)) {
+ aMissingSrgNames.put(aKey1++, aKey);
+ }
+ }
+ }
+ else if (srgToForge.size() < forgeToSrg.size()) {
+ Preloader_Logger.INFO("More Forge Keys detected.");
+ for (String aKey : forgeToSrg.keySet()) {
+ if (!srgToForge.containsValue(aKey)) {
+ aMissingForgeNames.put(aKey2++, aKey);
+ }
+ }
+ }
+ if (!aMissingForgeNames.isEmpty()) {
+ for (String missingVal : aMissingForgeNames.values()) {
+ //Preloader_Logger.WARNING("Missing Forge value: "+missingVal);
+ }
+ }
+ if (!aMissingSrgNames.isEmpty()) {
+ for (String missingVal : aMissingSrgNames.values()) {
+ //Preloader_Logger.WARNING("Missing SRG value: "+missingVal);
+ }
+ }
+ }
+ if (obToDeOb.size() != deObToOb.size()) {
+ int aKey1 = 0;
+ int aKey2 = 0;
+ HashMap<Integer, String> aMissingObfNames = new HashMap<Integer, String>();
+ HashMap<Integer, String> aMissingDeObfNames = new HashMap<Integer, String>();
+ Preloader_Logger.INFO("Mismatch between mapped Obfuscated and Deobfuscated names, finding missing values.");
+ if (obToDeOb.size() > deObToOb.size()) {
+ Preloader_Logger.INFO("More Obfuscated Keys detected.");
+ for (String aKey : obToDeOb.keySet()) {
+ if (!deObToOb.containsValue(aKey)) {
+ aMissingObfNames.put(aKey1++, aKey);
+ }
+ }
+ }
+ else if (obToDeOb.size() < deObToOb.size()) {
+ Preloader_Logger.INFO("More Deobfuscated Keys detected.");
+ for (String aKey : deObToOb.keySet()) {
+ if (!obToDeOb.containsValue(aKey)) {
+ aMissingDeObfNames.put(aKey2++, aKey);
+ }
+ }
+ }
+ if (!aMissingObfNames.isEmpty()) {
+ for (String missingVal : aMissingObfNames.values()) {
+ Preloader_Logger.WARNING("Missing Obfuscated value: "+missingVal);
+ }
+ }
+ if (!aMissingDeObfNames.isEmpty()) {
+ for (String missingVal : aMissingDeObfNames.values()) {
+ Preloader_Logger.WARNING("Missing Deobfuscated value: "+missingVal);
+ }
+ }
+ }
+ }
+ }
- Logger.INFO("[DevHelper] srgToForge size: "+srgToForge.size());
- Logger.INFO("[DevHelper] forgeToSrg size: "+forgeToSrg.size());
- Logger.INFO("[DevHelper] obToDeOb size: "+obToDeOb.size());
- Logger.INFO("[DevHelper] deObToOb size: "+deObToOb.size());
- return srgToForge.size() > 0 && forgeToSrg.size() > 0 && obToDeOb.size() > 0 && deObToOb.size() > 0;
+ // return true anyway as some keys will mismatch.
+ return true;
}
private static void init1() {
@@ -5029,7 +5104,7 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("bmg", "net/minecraft/client/shader/Framebuffer"));
mObInitMap.put(new Pair<String, String>("na", "net/minecraft/client/network/NetHandlerHandshakeMemory"));
mObInitMap
- .put(new Pair<String, String>("jb", "net/minecraft/network/play/client/C02PacketUseEntity$Action"));
+ .put(new Pair<String, String>("jb", "net/minecraft/network/play/client/C02PacketUseEntity$Action"));
mObInitMap.put(new Pair<String, String>("fc", "net/minecraft/util/MessageDeserializer2"));
mObInitMap.put(new Pair<String, String>("bd", "net/minecraft/command/server/CommandPardonIp"));
mObInitMap.put(new Pair<String, String>("amw", "net/minecraft/block/BlockPumpkin"));
@@ -5104,7 +5179,7 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("tl", "net/minecraft/entity/ai/attributes/BaseAttributeMap"));
mObInitMap.put(new Pair<String, String>("pm", "net/minecraft/stats/IStatType"));
mObInitMap
- .put(new Pair<String, String>("atc", "net/minecraft/world/gen/structure/StructureMineshaftStart"));
+ .put(new Pair<String, String>("atc", "net/minecraft/world/gen/structure/StructureMineshaftStart"));
mObInitMap.put(new Pair<String, String>("apd", "net/minecraft/tileentity/TileEntityEnchantmentTable"));
mObInitMap.put(new Pair<String, String>("ale", "net/minecraft/block/BlockFurnace"));
mObInitMap.put(new Pair<String, String>("adg", "net/minecraft/item/ItemLeaves"));
@@ -5112,7 +5187,7 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("axb", "net/minecraft/world/gen/layer/GenLayerAddIsland"));
mObInitMap.put(new Pair<String, String>("bpg", "net/minecraft/client/util/JsonBlendingMode"));
mObInitMap
- .put(new Pair<String, String>("net/minecraft/realms/RealmsMth", "net/minecraft/realms/RealmsMth"));
+ .put(new Pair<String, String>("net/minecraft/realms/RealmsMth", "net/minecraft/realms/RealmsMth"));
mObInitMap.put(new Pair<String, String>("qa", "net/minecraft/util/IntHashMap$Entry"));
mObInitMap.put(new Pair<String, String>("mb", "net/minecraft/server/gui/MinecraftServerGui$3"));
mObInitMap.put(
@@ -5262,13 +5337,13 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("aaw", "net/minecraft/inventory/InventoryCraftResult"));
mObInitMap.put(new Pair<String, String>("w", "net/minecraft/client/audio/SoundCategory"));
mObInitMap
- .put(new Pair<String, String>("bqv", "net/minecraft/client/resources/IReloadableResourceManager"));
+ .put(new Pair<String, String>("bqv", "net/minecraft/client/resources/IReloadableResourceManager"));
mObInitMap.put(new Pair<String, String>("baz", "net/minecraft/client/Minecraft$3"));
mObInitMap.put(new Pair<String, String>("bey", "net/minecraft/client/gui/GuiRepair"));
mObInitMap.put(new Pair<String, String>("bix", "net/minecraft/client/model/ModelRenderer"));
mObInitMap.put(new Pair<String, String>("bmw", "net/minecraft/client/renderer/culling/ClippingHelperImpl"));
mObInitMap
- .put(new Pair<String, String>("fs", "net/minecraft/util/ChatComponentTranslationFormatException"));
+ .put(new Pair<String, String>("fs", "net/minecraft/util/ChatComponentTranslationFormatException"));
mObInitMap.put(new Pair<String, String>("bt", "net/minecraft/command/server/CommandStop"));
mObInitMap.put(new Pair<String, String>("yy", "net/minecraft/entity/player/InventoryPlayer$1"));
mObInitMap.put(new Pair<String, String>("uz", "net/minecraft/entity/ai/EntityAIPanic"));
@@ -5290,7 +5365,7 @@ public class DevHelper {
mObInitMap.put(
new Pair<String, String>("np", "net/minecraft/server/network/NetHandlerLoginServer$LoginState"));
mObInitMap
- .put(new Pair<String, String>("jq", "net/minecraft/network/handshake/INetHandlerHandshakeServer"));
+ .put(new Pair<String, String>("jq", "net/minecraft/network/handshake/INetHandlerHandshakeServer"));
mObInitMap.put(new Pair<String, String>("fr", "net/minecraft/util/ChatComponentTranslation"));
mObInitMap.put(new Pair<String, String>("arf", "net/minecraft/world/gen/feature/WorldGenBlockBlob"));
mObInitMap.put(new Pair<String, String>("ang", "net/minecraft/block/BlockRotatedPillar"));
@@ -5300,7 +5375,7 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("ave", "net/minecraft/world/gen/structure/MapGenStructure"));
mObInitMap.put(new Pair<String, String>("azd", "net/minecraft/client/AnvilConverterException"));
mObInitMap
- .put(new Pair<String, String>("net/minecraft/client/main/Main", "net/minecraft/client/main/Main"));
+ .put(new Pair<String, String>("net/minecraft/client/main/Main", "net/minecraft/client/main/Main"));
mObInitMap.put(new Pair<String, String>("bri", "net/minecraft/client/resources/SimpleResource"));
mObInitMap.put(new Pair<String, String>("bfl", "net/minecraft/client/gui/inventory/GuiContainerCreative"));
mObInitMap.put(new Pair<String, String>("bjk", "net/minecraft/client/entity/EntityClientPlayerMP"));
@@ -5310,7 +5385,7 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("od", "net/minecraft/server/management/PreYggdrasilConverter$4"));
mObInitMap.put(new Pair<String, String>("ke", "net/minecraft/network/ServerStatusResponse$Serializer"));
mObInitMap
- .put(new Pair<String, String>("gf", "net/minecraft/network/play/server/S35PacketUpdateTileEntity"));
+ .put(new Pair<String, String>("gf", "net/minecraft/network/play/server/S35PacketUpdateTileEntity"));
mObInitMap.put(new Pair<String, String>("cg", "net/minecraft/command/PlayerNotFoundException"));
mObInitMap.put(new Pair<String, String>("ary", "net/minecraft/world/gen/feature/WorldGenGlowStone1"));
mObInitMap.put(new Pair<String, String>("anz", "net/minecraft/block/BlockTallGrass"));
@@ -5353,7 +5428,7 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("btc",
"net/minecraft/client/network/LanServerDetector$ThreadLanServerFind"));
mObInitMap
- .put(new Pair<String, String>("bpd", "net/minecraft/client/renderer/tileentity/RenderWitherSkull"));
+ .put(new Pair<String, String>("bpd", "net/minecraft/client/renderer/tileentity/RenderWitherSkull"));
mObInitMap.put(new Pair<String, String>("bhf", "net/minecraft/client/model/ModelBook"));
mObInitMap.put(new Pair<String, String>("ble", "net/minecraft/client/particle/EntityFishWakeFX"));
mObInitMap.put(new Pair<String, String>("ea", "net/minecraft/nbt/NBTException"));
@@ -5397,11 +5472,11 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("aye", "net/minecraft/pathfinding/PathPoint"));
mObInitMap.put(new Pair<String, String>("bbc", "net/minecraft/client/Minecraft$6"));
mObInitMap
- .put(new Pair<String, String>("bfb", "net/minecraft/client/gui/inventory/GuiBeacon$ConfirmButton"));
+ .put(new Pair<String, String>("bfb", "net/minecraft/client/gui/inventory/GuiBeacon$ConfirmButton"));
mObInitMap.put(new Pair<String, String>("bui", "net/minecraft/client/stream/IngestServerTester"));
mObInitMap.put(new Pair<String, String>("bqj", "net/minecraft/client/renderer/texture/ITickable"));
mObInitMap
- .put(new Pair<String, String>("zb", "net/minecraft/entity/player/EntityPlayer$EnumChatVisibility"));
+ .put(new Pair<String, String>("zb", "net/minecraft/entity/player/EntityPlayer$EnumChatVisibility"));
mObInitMap.put(new Pair<String, String>("vc", "net/minecraft/entity/ai/EntityAIWander"));
mObInitMap.put(new Pair<String, String>("rd", "net/minecraft/world/EnumDifficulty"));
mObInitMap.put(new Pair<String, String>("ne", "net/minecraft/network/NetworkSystem$2"));
@@ -5428,7 +5503,7 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("brq", "net/minecraft/client/resources/Language"));
mObInitMap.put(new Pair<String, String>("bbu", "net/minecraft/client/gui/FontRenderer"));
mObInitMap
- .put(new Pair<String, String>("bft", "net/minecraft/client/gui/inventory/GuiScreenHorseInventory"));
+ .put(new Pair<String, String>("bft", "net/minecraft/client/gui/inventory/GuiScreenHorseInventory"));
mObInitMap.put(new Pair<String, String>("bjs", "net/minecraft/client/network/OldServerPinger$2"));
mObInitMap.put(new Pair<String, String>("bnr", "net/minecraft/client/renderer/entity/RenderFireball"));
mObInitMap.put(new Pair<String, String>("sk", "net/minecraft/command/IEntitySelector$1"));
@@ -5554,14 +5629,14 @@ public class DevHelper {
"net/minecraft/world/gen/structure/StructureStrongholdPieces$Straight"));
mObInitMap.put(new Pair<String, String>("bnz", "net/minecraft/client/renderer/entity/RenderItem$1"));
mObInitMap
- .put(new Pair<String, String>("gv", "net/minecraft/network/play/server/S2BPacketChangeGameState"));
+ .put(new Pair<String, String>("gv", "net/minecraft/network/play/server/S2BPacketChangeGameState"));
mObInitMap.put(new Pair<String, String>("cw", "net/minecraft/util/RegistryNamespaced"));
mObInitMap.put(new Pair<String, String>("net/minecraft/realms/RealmsScrolledSelectionList",
"net/minecraft/realms/RealmsScrolledSelectionList"));
mObInitMap.put(new Pair<String, String>("aru", "net/minecraft/world/gen/feature/WorldGenBigMushroom"));
mObInitMap.put(new Pair<String, String>("anv", "net/minecraft/block/BlockStone"));
mObInitMap
- .put(new Pair<String, String>("afx", "net/minecraft/enchantment/EnchantmentHelper$DamageIterator"));
+ .put(new Pair<String, String>("afx", "net/minecraft/enchantment/EnchantmentHelper$DamageIterator"));
mObInitMap.put(new Pair<String, String>("ajw", "net/minecraft/block/BlockCauldron"));
mObInitMap.put(
new Pair<String, String>("avt", "net/minecraft/world/gen/structure/StructureVillagePieces$Torch"));
@@ -5569,7 +5644,7 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("bcq", "net/minecraft/client/gui/GuiScreenRealmsProxy"));
mObInitMap.put(new Pair<String, String>("bgp", "net/minecraft/client/gui/stream/GuiStreamUnavailable"));
mObInitMap
- .put(new Pair<String, String>("brx", "net/minecraft/client/resources/data/IMetadataSerializer$1"));
+ .put(new Pair<String, String>("brx", "net/minecraft/client/resources/data/IMetadataSerializer$1"));
mObInitMap.put(new Pair<String, String>("wq", "net/minecraft/entity/passive/EntitySheep$1"));
mObInitMap.put(new Pair<String, String>("sr", "net/minecraft/entity/EntityFlying"));
mObInitMap.put(new Pair<String, String>("os", "net/minecraft/server/management/UserListWhitelistEntry"));
@@ -5635,7 +5710,7 @@ public class DevHelper {
"net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces$JunglePyramid"));
mObInitMap.put(new Pair<String, String>("ayb", "net/minecraft/world/gen/layer/GenLayerVoronoiZoom"));
mObInitMap
- .put(new Pair<String, String>("buf", "net/minecraft/client/stream/ChatController$SwitchChatState"));
+ .put(new Pair<String, String>("buf", "net/minecraft/client/stream/ChatController$SwitchChatState"));
mObInitMap.put(new Pair<String, String>("bqg", "net/minecraft/client/renderer/texture/TextureManager$1"));
mObInitMap.put(new Pair<String, String>("bii", "net/minecraft/client/model/PositionTextureVertex"));
mObInitMap.put(new Pair<String, String>("bmh", "net/minecraft/client/renderer/Tessellator"));
@@ -5670,7 +5745,7 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("net/minecraft/realms/RealmsLevelSummary",
"net/minecraft/realms/RealmsLevelSummary"));
mObInitMap
- .put(new Pair<String, String>("gk", "net/minecraft/network/play/server/S22PacketMultiBlockChange"));
+ .put(new Pair<String, String>("gk", "net/minecraft/network/play/server/S22PacketMultiBlockChange"));
mObInitMap.put(new Pair<String, String>("cl", "net/minecraft/block/BlockSourceImpl"));
mObInitMap.put(new Pair<String, String>("vr", "net/minecraft/entity/ai/EntityAITargetNonTamed"));
mObInitMap.put(new Pair<String, String>("rs", "net/minecraft/potion/PotionAttackDamage"));
@@ -5688,7 +5763,7 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("gj", "net/minecraft/network/play/server/S02PacketChat"));
mObInitMap.put(new Pair<String, String>("acb", "net/minecraft/creativetab/CreativeTabs$5"));
mObInitMap
- .put(new Pair<String, String>("aga", "net/minecraft/enchantment/EnchantmentHelper$ModifierLiving"));
+ .put(new Pair<String, String>("aga", "net/minecraft/enchantment/EnchantmentHelper$ModifierLiving"));
mObInitMap.put(
new Pair<String, String>("bsa", "net/minecraft/client/resources/data/AnimationMetadataSection"));
mObInitMap.put(new Pair<String, String>("bkc", "net/minecraft/client/particle/EntityFireworkOverlayFX"));
@@ -5710,7 +5785,7 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("po", "net/minecraft/util/IJsonSerializable"));
mObInitMap.put(new Pair<String, String>("lp", "net/minecraft/scoreboard/ServerScoreboard"));
mObInitMap
- .put(new Pair<String, String>("hq", "net/minecraft/network/play/server/S13PacketDestroyEntities"));
+ .put(new Pair<String, String>("hq", "net/minecraft/network/play/server/S13PacketDestroyEntities"));
mObInitMap.put(new Pair<String, String>("dr", "net/minecraft/nbt/NBTTagLong"));
mObInitMap.put(new Pair<String, String>("adi", "net/minecraft/item/ItemBucketMilk"));
mObInitMap.put(new Pair<String, String>("ahh", "net/minecraft/world/IWorldAccess"));
@@ -5812,7 +5887,7 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("acj", "net/minecraft/item/ItemDye"));
mObInitMap.put(new Pair<String, String>("agi", "net/minecraft/enchantment/EnchantmentProtection"));
mObInitMap
- .put(new Pair<String, String>("bsi", "net/minecraft/client/resources/data/TextureMetadataSection"));
+ .put(new Pair<String, String>("bsi", "net/minecraft/client/resources/data/TextureMetadataSection"));
mObInitMap.put(new Pair<String, String>("bcm", "net/minecraft/client/gui/GuiSlot"));
mObInitMap.put(new Pair<String, String>("bgl", "net/minecraft/client/gui/GuiResourcePackSelected"));
mObInitMap.put(new Pair<String, String>("bkk", "net/minecraft/client/particle/EntityLavaFX"));
@@ -5832,7 +5907,7 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("xa", "net/minecraft/entity/boss/EntityDragon"));
mObInitMap.put(new Pair<String, String>("tb", "net/minecraft/entity/item/EntityPainting"));
mObInitMap
- .put(new Pair<String, String>("asx", "net/minecraft/world/gen/structure/StructureMineshaftPieces"));
+ .put(new Pair<String, String>("asx", "net/minecraft/world/gen/structure/StructureMineshaftPieces"));
mObInitMap.put(new Pair<String, String>("aoy", "net/minecraft/tileentity/TileEntityCommandBlock$1"));
mObInitMap.put(new Pair<String, String>("akz", "net/minecraft/block/BlockFence"));
mObInitMap.put(new Pair<String, String>("aww", "net/minecraft/block/material/MaterialPortal"));
@@ -5861,7 +5936,7 @@ public class DevHelper {
"net/minecraft/realms/RealmsServerStatusPinger"));
mObInitMap.put(new Pair<String, String>("mk", "net/minecraft/world/demo/DemoWorldServer"));
mObInitMap
- .put(new Pair<String, String>("il", "net/minecraft/network/play/server/S20PacketEntityProperties"));
+ .put(new Pair<String, String>("il", "net/minecraft/network/play/server/S20PacketEntityProperties"));
mObInitMap.put(new Pair<String, String>("em", "net/minecraft/network/NetworkManager$3"));
mObInitMap.put(new Pair<String, String>("an", "net/minecraft/command/server/CommandEmote"));
mObInitMap.put(new Pair<String, String>("aqa", "net/minecraft/world/chunk/storage/NibbleArrayReader"));
@@ -5997,12 +6072,12 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("axr", "net/minecraft/world/gen/layer/GenLayerHills"));
mObInitMap.put(new Pair<String, String>("bap", "net/minecraft/client/Minecraft$1"));
mObInitMap
- .put(new Pair<String, String>("beo", "net/minecraft/client/gui/achievement/GuiStats$StatsItem$1"));
+ .put(new Pair<String, String>("beo", "net/minecraft/client/gui/achievement/GuiStats$StatsItem$1"));
mObInitMap.put(new Pair<String, String>("bin", "net/minecraft/client/model/ModelWither"));
mObInitMap.put(new Pair<String, String>("bmm",
"net/minecraft/client/renderer/tileentity/TileEntityChestRenderer"));
mObInitMap
- .put(new Pair<String, String>("jh", "net/minecraft/network/play/client/C13PacketPlayerAbilities"));
+ .put(new Pair<String, String>("jh", "net/minecraft/network/play/client/C13PacketPlayerAbilities"));
mObInitMap.put(new Pair<String, String>("fi", "net/minecraft/event/ClickEvent$Action"));
mObInitMap.put(new Pair<String, String>("bj", "net/minecraft/command/server/CommandSaveOn"));
mObInitMap.put(new Pair<String, String>("yo", "net/minecraft/entity/monster/EntitySpider$GroupData"));
@@ -6058,7 +6133,7 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("avm", "net/minecraft/world/gen/structure/StructureStart"));
mObInitMap.put(new Pair<String, String>("bcj", "net/minecraft/client/gui/GuiOptionButton"));
mObInitMap
- .put(new Pair<String, String>("bgi", "net/minecraft/client/resources/ResourcePackListEntryFound"));
+ .put(new Pair<String, String>("bgi", "net/minecraft/client/resources/ResourcePackListEntryFound"));
mObInitMap.put(new Pair<String, String>("bkh", "net/minecraft/client/particle/EntityHeartFX"));
mObInitMap.put(new Pair<String, String>("bog", "net/minecraft/client/renderer/entity/RenderLightningBolt"));
mObInitMap.put(new Pair<String, String>("lb", "net/minecraft/client/util/JsonException"));
@@ -6153,7 +6228,7 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("sa", "net/minecraft/entity/Entity"));
mObInitMap.put(new Pair<String, String>("ob", "net/minecraft/server/management/PreYggdrasilConverter$2"));
mObInitMap
- .put(new Pair<String, String>("kc", "net/minecraft/network/ServerStatusResponse$PlayerCountData"));
+ .put(new Pair<String, String>("kc", "net/minecraft/network/ServerStatusResponse$PlayerCountData"));
mObInitMap.put(new Pair<String, String>("gd", "net/minecraft/network/play/server/S37PacketStatistics"));
mObInitMap.put(new Pair<String, String>("ce", "net/minecraft/command/NumberInvalidException"));
mObInitMap.put(new Pair<String, String>("net/minecraft/realms/Realms", "net/minecraft/realms/Realms"));
@@ -6223,7 +6298,7 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("axo", "net/minecraft/world/gen/layer/GenLayer$1"));
mObInitMap.put(new Pair<String, String>("bam", "net/minecraft/client/renderer/RenderHelper"));
mObInitMap
- .put(new Pair<String, String>("bel", "net/minecraft/client/gui/achievement/GuiStats$StatsBlock$1"));
+ .put(new Pair<String, String>("bel", "net/minecraft/client/gui/achievement/GuiStats$StatsBlock$1"));
mObInitMap.put(new Pair<String, String>("bik", "net/minecraft/client/model/ModelVillager"));
mObInitMap.put(new Pair<String, String>("bmj",
"net/minecraft/client/renderer/tileentity/TileEntityBeaconRenderer"));
@@ -6289,12 +6364,12 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("wg", "net/minecraft/entity/passive/EntityChicken"));
mObInitMap.put(new Pair<String, String>("sh", "net/minecraft/entity/EntityList$EntityEggInfo"));
mObInitMap
- .put(new Pair<String, String>("oi", "net/minecraft/server/management/ServerConfigurationManager"));
+ .put(new Pair<String, String>("oi", "net/minecraft/server/management/ServerConfigurationManager"));
mObInitMap.put(new Pair<String, String>("kj", "net/minecraft/network/status/client/C00PacketServerQuery"));
mObInitMap.put(new Pair<String, String>("aka", "net/minecraft/block/BlockColored"));
mObInitMap.put(new Pair<String, String>("acc", "net/minecraft/creativetab/CreativeTabs$6"));
mObInitMap
- .put(new Pair<String, String>("agb", "net/minecraft/enchantment/EnchantmentHelper$ModifierDamage"));
+ .put(new Pair<String, String>("agb", "net/minecraft/enchantment/EnchantmentHelper$ModifierDamage"));
mObInitMap.put(new Pair<String, String>("bsb",
"net/minecraft/client/resources/data/AnimationMetadataSectionSerializer"));
mObInitMap.put(new Pair<String, String>("bkd", "net/minecraft/client/particle/EntityFireworkSparkFX"));
@@ -6333,7 +6408,7 @@ public class DevHelper {
mObInitMap.put(
new Pair<String, String>("net/minecraft/realms/Tezzelator", "net/minecraft/realms/Tezzelator"));
mObInitMap
- .put(new Pair<String, String>("ate", "net/minecraft/world/gen/structure/MapGenNetherBridge$Start"));
+ .put(new Pair<String, String>("ate", "net/minecraft/world/gen/structure/MapGenNetherBridge$Start"));
mObInitMap.put(new Pair<String, String>("apf", "net/minecraft/tileentity/TileEntityFlowerPot"));
mObInitMap.put(new Pair<String, String>("alg", "net/minecraft/block/BlockGlowstone"));
mObInitMap.put(new Pair<String, String>("axd", "net/minecraft/world/gen/layer/GenLayerAddSnow"));
@@ -6370,7 +6445,7 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("vi", "net/minecraft/entity/ai/EntityAICreeperSwell"));
mObInitMap.put(new Pair<String, String>("rj", "net/minecraft/profiler/PlayerUsageSnooper$1"));
mObInitMap
- .put(new Pair<String, String>("nk", "net/minecraft/network/NetHandlerPlayServer$SwitchEnumState"));
+ .put(new Pair<String, String>("nk", "net/minecraft/network/NetHandlerPlayServer$SwitchEnumState"));
mObInitMap.put(new Pair<String, String>("jl", "net/minecraft/network/play/client/C09PacketHeldItemChange"));
mObInitMap.put(new Pair<String, String>("fm", "net/minecraft/event/HoverEvent$Action"));
mObInitMap.put(new Pair<String, String>("bn", "net/minecraft/command/server/CommandSetDefaultSpawnpoint"));
@@ -6438,7 +6513,7 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("bdb", "net/minecraft/client/gui/GuiCreateWorld"));
mObInitMap.put(new Pair<String, String>("ly", "net/minecraft/server/gui/MinecraftServerGui"));
mObInitMap
- .put(new Pair<String, String>("hz", "net/minecraft/network/play/server/S04PacketEntityEquipment"));
+ .put(new Pair<String, String>("hz", "net/minecraft/network/play/server/S04PacketEntityEquipment"));
mObInitMap.put(new Pair<String, String>("asy",
"net/minecraft/world/gen/structure/StructureMineshaftPieces$Corridor"));
mObInitMap.put(new Pair<String, String>("aoz", "net/minecraft/tileentity/TileEntityComparator"));
@@ -6482,7 +6557,7 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("bud",
"net/minecraft/client/stream/BroadcastController$BroadcastListener"));
mObInitMap
- .put(new Pair<String, String>("bqe", "net/minecraft/client/renderer/texture/TextureAtlasSprite$1"));
+ .put(new Pair<String, String>("bqe", "net/minecraft/client/renderer/texture/TextureAtlasSprite$1"));
mObInitMap.put(new Pair<String, String>("beh", "net/minecraft/client/gui/achievement/GuiAchievement"));
mObInitMap.put(new Pair<String, String>("big", "net/minecraft/client/model/ModelSpider"));
mObInitMap.put(new Pair<String, String>("ja", "net/minecraft/network/play/client/C02PacketUseEntity"));
@@ -6662,7 +6737,7 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("bgj", "net/minecraft/client/gui/GuiResourcePackAvailable"));
mObInitMap.put(new Pair<String, String>("bki", "net/minecraft/client/particle/EntityLargeExplodeFX"));
mObInitMap
- .put(new Pair<String, String>("boh", "net/minecraft/client/renderer/entity/RendererLivingEntity"));
+ .put(new Pair<String, String>("boh", "net/minecraft/client/renderer/entity/RendererLivingEntity"));
mObInitMap.put(new Pair<String, String>("lc", "net/minecraft/client/util/JsonException$1"));
mObInitMap.put(new Pair<String, String>("hd", "net/minecraft/network/play/server/S01PacketJoinGame"));
mObInitMap.put(new Pair<String, String>("de", "net/minecraft/util/StringTranslate"));
@@ -6731,7 +6806,7 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("bbm", "net/minecraft/client/settings/GameSettings$Options"));
mObInitMap.put(new Pair<String, String>("bus", "net/minecraft/realms/RealmsConnect$1"));
mObInitMap
- .put(new Pair<String, String>("bqt", "net/minecraft/client/resources/FoliageColorReloadListener"));
+ .put(new Pair<String, String>("bqt", "net/minecraft/client/resources/FoliageColorReloadListener"));
mObInitMap.put(new Pair<String, String>("zl", "net/minecraft/entity/projectile/EntityEgg"));
mObInitMap.put(new Pair<String, String>("vm", "net/minecraft/entity/ai/EntityAIDefendVillage"));
mObInitMap.put(new Pair<String, String>("rn", "net/minecraft/util/CombatTracker"));
@@ -6795,7 +6870,7 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("pi", "net/minecraft/stats/StatBase$1"));
mObInitMap.put(new Pair<String, String>("lj", "net/minecraft/server/MinecraftServer$3"));
mObInitMap
- .put(new Pair<String, String>("hk", "net/minecraft/network/play/server/S39PacketPlayerAbilities"));
+ .put(new Pair<String, String>("hk", "net/minecraft/network/play/server/S39PacketPlayerAbilities"));
mObInitMap.put(new Pair<String, String>("dl", "net/minecraft/nbt/NBTTagEnd"));
mObInitMap.put(new Pair<String, String>("ala", "net/minecraft/block/BlockFenceGate"));
mObInitMap.put(new Pair<String, String>("adc", "net/minecraft/item/Item$ToolMaterial"));
@@ -6829,7 +6904,7 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("axp", "net/minecraft/world/gen/layer/GenLayer$2"));
mObInitMap.put(new Pair<String, String>("ban", "net/minecraft/client/renderer/GLAllocation"));
mObInitMap
- .put(new Pair<String, String>("bem", "net/minecraft/client/gui/achievement/GuiStats$StatsGeneral"));
+ .put(new Pair<String, String>("bem", "net/minecraft/client/gui/achievement/GuiStats$StatsGeneral"));
mObInitMap.put(new Pair<String, String>("bil", "net/minecraft/client/model/ModelZombieVillager"));
mObInitMap.put(new Pair<String, String>("bmk",
"net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher"));
@@ -6846,7 +6921,7 @@ public class DevHelper {
mObInitMap.put(new Pair<String, String>("ayd", "net/minecraft/pathfinding/Path"));
mObInitMap.put(new Pair<String, String>("bbb", "net/minecraft/client/Minecraft$5"));
mObInitMap
- .put(new Pair<String, String>("bfa", "net/minecraft/client/gui/inventory/GuiBeacon$CancelButton"));
+ .put(new Pair<String, String>("bfa", "net/minecraft/client/gui/inventory/GuiBeacon$CancelButton"));
mObInitMap.put(new Pair<String, String>("buh", "net/minecraft/client/stream/ChatController$ChatListener"));
mObInitMap.put(new Pair<String, String>("bqi", "net/minecraft/client/renderer/texture/TextureUtil"));
mObInitMap.put(new Pair<String, String>("za", "net/minecraft/entity/player/EntityPlayer$EnumStatus"));
diff --git a/src/Java/gtPlusPlus/preloader/Preloader_Logger.java b/src/Java/gtPlusPlus/preloader/Preloader_Logger.java
new file mode 100644
index 0000000000..84f0fab012
--- /dev/null
+++ b/src/Java/gtPlusPlus/preloader/Preloader_Logger.java
@@ -0,0 +1,60 @@
+package gtPlusPlus.preloader;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+public class Preloader_Logger {
+
+ private Preloader_Logger() {
+
+ }
+
+ // Logging Functions
+ public static final Logger MODLOGGER = Preloader_Logger.makeLogger();
+
+ // Generate GT++ Logger
+ public static Logger makeLogger() {
+ final Logger gtPlusPlusLogger = LogManager.getLogger("GT++ ASM");
+ return gtPlusPlusLogger;
+ }
+
+ public static final org.apache.logging.log4j.Logger getLogger(){
+ return MODLOGGER;
+ }
+
+ // Non-Dev Comments
+
+ public static void INFO(final String s, final String s2) {
+ INFO(s);
+ INFO(s2);
+ }
+
+ public static void INFO(final String s) {
+ MODLOGGER.info(s);
+ }
+
+ // Developer Comments
+ public static void WARNING(final String s) {
+ MODLOGGER.warn(s);
+ }
+
+ // Errors
+ public static void ERROR(final String s) {
+ MODLOGGER.fatal(s);
+ }
+
+ public static void LOG(String string, Level info, String string2) {
+ if (info.equals(Level.INFO)) {
+ INFO("["+string+"] "+string2);
+ }
+ if (info.equals(Level.WARN)) {
+ WARNING("["+string+"] "+string2);
+ }
+ if (info.equals(Level.ERROR)) {
+ ERROR("["+string+"] "+string2);
+ }
+
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java b/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java
index 87ac77d5da..d0c59726de 100644
--- a/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java
+++ b/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java
@@ -1,6 +1,8 @@
package gtPlusPlus.preloader.asm;
import cpw.mods.fml.common.FMLLog;
+import gtPlusPlus.preloader.Preloader_Logger;
+
import java.io.File;
import java.util.ArrayList;
import net.minecraftforge.common.config.Configuration;
@@ -11,7 +13,8 @@ public class AsmConfig {
public static boolean loaded;
public static Configuration config;
-
+
+ public static boolean enableOreDictPatch;
public static boolean enableTiConFluidLighting;
public static boolean enableGtTooltipFix;
public static boolean enableGtNbtFix;
@@ -27,8 +30,9 @@ public class AsmConfig {
public static boolean enableTcAspectSafety;
public static boolean enabledLwjglKeybindingFix;
public static boolean enabledFixEntitySetHealth;
-
+
public static boolean disableAllLogging;
+ public static boolean debugMode;
public AsmConfig(File file) {
if (!loaded) {
@@ -56,6 +60,12 @@ public class AsmConfig {
disableAllLogging = prop.getBoolean(false);
propOrderDebug.add(prop.getName());
+ prop = config.get("debug", "debugMode", false);
+ prop.comment = "Enables all sorts of debug logging. (Don't use unless told to, breaks other things.)";
+ prop.setLanguageKey("gtpp.debugMode").setRequiresMcRestart(false);
+ debugMode = prop.getBoolean(false);
+ propOrderDebug.add(prop.getName());
+
prop = config.get("debug", "enabledFixEntitySetHealth", false);
prop.comment = "Enable/Disable entity setHealth() fix.";
prop.setLanguageKey("gtpp.enabledFixEntitySetHealth").setRequiresMcRestart(true);
@@ -80,6 +90,12 @@ public class AsmConfig {
enableCofhPatch = prop.getBoolean(false);
propOrderDebug.add(prop.getName());
+ prop = config.get("debug", "enableOreDictPatch", false);
+ prop.comment = "Enable/Disable Forge OreDictionary Patch (Useful for Development)";
+ prop.setLanguageKey("gtpp.enableOreDictPatch").setRequiresMcRestart(true);
+ enableOreDictPatch = prop.getBoolean(false);
+ propOrderDebug.add(prop.getName());
+
@@ -168,15 +184,15 @@ public class AsmConfig {
config.save();
}
- FMLLog.log(Level.INFO, "[GT++ ASM] Chunk Debugging - Enabled: "+enableChunkDebugging, new Object[0]);
- FMLLog.log(Level.INFO, "[GT++ ASM] Gt Nbt Fix - Enabled: "+enableGtNbtFix, new Object[0]);
- FMLLog.log(Level.INFO, "[GT++ ASM] TiCon Fluid Lighting - Enabled: "+enableTiConFluidLighting, new Object[0]);
- FMLLog.log(Level.INFO, "[GT++ ASM] Gt Tooltip Fix - Enabled: "+enableGtTooltipFix, new Object[0]);
- FMLLog.log(Level.INFO, "[GT++ ASM] COFH Patch - Enabled: "+enableCofhPatch, new Object[0]);
- FMLLog.log(Level.INFO, "[GT++ ASM] Gc Fuel Changes Patch - Enabled: "+enableGcFuelChanges, new Object[0]);
- FMLLog.log(Level.INFO, "[GT++ ASM] Railcraft Fluid Flow Patch - Enabled: "+enableRcFlowFix, new Object[0]);
- FMLLog.log(Level.INFO, "[GT++ ASM] Thaumcraft Aspect Safety Patch - Enabled: "+enableTcAspectSafety, new Object[0]);
- FMLLog.log(Level.INFO, "[GT++ ASM] Fix bad usage of EntityLivingBase.setHealth Patch - Enabled: "+enabledFixEntitySetHealth, new Object[0]);
+ Preloader_Logger.INFO("Chunk Debugging - Enabled: "+enableChunkDebugging);
+ Preloader_Logger.INFO("Gt Nbt Fix - Enabled: "+enableGtNbtFix);
+ Preloader_Logger.INFO("TiCon Fluid Lighting - Enabled: "+enableTiConFluidLighting);
+ Preloader_Logger.INFO("Gt Tooltip Fix - Enabled: "+enableGtTooltipFix);
+ Preloader_Logger.INFO("COFH Patch - Enabled: "+enableCofhPatch);
+ Preloader_Logger.INFO("Gc Fuel Changes Patch - Enabled: "+enableGcFuelChanges);
+ Preloader_Logger.INFO("Railcraft Fluid Flow Patch - Enabled: "+enableRcFlowFix);
+ Preloader_Logger.INFO("Thaumcraft Aspect Safety Patch - Enabled: "+enableTcAspectSafety);
+ Preloader_Logger.INFO("Fix bad usage of EntityLivingBase.setHealth Patch - Enabled: "+enabledFixEntitySetHealth);
} catch (Exception var3) {
FMLLog.log(Level.ERROR, var3, "GT++ ASM had a problem loading it's config", new Object[0]);
diff --git a/src/Java/gtPlusPlus/preloader/asm/ClassesToTransform.java b/src/Java/gtPlusPlus/preloader/asm/ClassesToTransform.java
new file mode 100644
index 0000000000..84593f6597
--- /dev/null
+++ b/src/Java/gtPlusPlus/preloader/asm/ClassesToTransform.java
@@ -0,0 +1,74 @@
+package gtPlusPlus.preloader.asm;
+
+public class ClassesToTransform {
+
+
+ public static final String LWJGL_KEYBOARD = "org.lwjgl.input.Keyboard";
+
+
+ public static final String MINECRAFT_GAMESETTINGS = "net.minecraft.client.settings.GameSettings";
+ public static final String MINECRAFT_GAMESETTINGS_OBF = "bbj";
+
+
+ public static final String FORGE_CHUNK_MANAGER = "net.minecraftforge.common.ForgeChunkManager";
+ public static final String FORGE_ORE_DICTIONARY = "net.minecraftforge.oredict.OreDictionary";
+
+
+ public static final String COFH_ORE_DICTIONARY_ARBITER = "cofh.core.util.oredict.OreDictionaryArbiter";
+
+
+ public static final String TINKERS_FLUID_BLOCK = "tconstruct.smeltery.blocks.TConstructFluid";
+
+
+ public static final String RAILCRAFT_FLUID_HELPER = "mods.railcraft.common.fluids.FluidHelper";
+ public static final String RAILCRAFT_TILE_FLUID_LOADER = "mods.railcraft.common.blocks.machine.gamma.TileFluidLoader";
+ public static final String RAILCRAFT_INVENTORY_TOOLS = "mods.railcraft.common.util.inventory.InvTools";
+
+
+ public static final String GALACTICRAFT_FLUID_UTILS = "micdoodle8.mods.galacticraft.core.util.FluidUtil";
+ public static final String GALACTICRAFT_TILE_ENTITY_FUEL_LOADER = "micdoodle8.mods.galacticraft.core.tile.TileEntityFuelLoader";
+ public static final String GALACTICRAFT_ENTITY_AUTO_ROCKET = "micdoodle8.mods.galacticraft.api.prefab.entity.EntityAutoRocket";
+
+
+ public static final String GT_UTILITY = "gregtech.api.util.GT_Utility";
+ public static final String GT_ACHIEVEMENTS = "gregtech.loaders.misc.GT_Achievements";
+ public static final String GT_CLIENT_PROXY = "gregtech.common.GT_Client";
+ public static final String GT_PACKET_TILE_ENTITY = "gregtech.api.net.GT_Packet_TileEntity";
+ public static final String GT_BASE_META_TILE_ENTITY = "gregtech.api.metatileentity.BaseMetaTileEntity";
+ public static final String GT_MTE_CHARCOAL_PIT = "gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_Charcoal_Pit";
+ public static final String GT_ITEM_MACHINES = "gregtech.common.blocks.GT_Item_Machines";
+ public static final String GT_METAGENERATED_TOOL = "gregtech.api.items.GT_MetaGenerated_Tool";
+ public static final String GT_BLOCK_MACHINES = "gregtech.common.blocks.GT_Block_Machines";
+ public static final String GT_MTE_HATCH_INPUTBUS = "gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus";
+ public static final String GT_MTE_HATCH_OUTPUTBUS = "gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus";
+ public static final String GT_METAPIPE_ITEM = "gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Item";
+ public static final String GT_METAPIPE_FLUID = "gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid";
+ public static final String GT_METAPIPE_FRAME = "gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Frame";
+
+
+ public static final String GTPP_MTE_HATCH_SUPER_INPUT_BUS = "gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Input";
+ public static final String GTPP_MTE_HATCH_SUPER_OUTPUT_BUS = "gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Output";
+ public static final String NAME = "";
+
+
+ public static final String THAUMCRAFT_ITEM_WISP_ESSENCE = "thaumcraft.common.items.ItemWispEssence";
+
+ public static final String IC2_ITEM_ARMOUR_HAZMAT = "ic2.core.item.armor.ItemArmorHazmat";
+ public static final String IC2_BLOCK_BASE_TILE_ENTITY = "ic2.core.block.BlockTileEntity";
+ public static final String IC2_BLOCK_MACHINE1 = "ic2.core.block.machine.BlockMachine";
+ public static final String IC2_BLOCK_MACHINE2 = "ic2.core.block.machine.BlockMachine2";
+ public static final String IC2_BLOCK_MACHINE3 = "ic2.core.block.machine.BlockMachine3";
+ public static final String IC2_BLOCK_KINETIC_GENERATOR = "ic2.core.block.kineticgenerator.block.BlockKineticGenerator";
+ public static final String IC2_BLOCK_HEAT_GENERATOR = "ic2.core.block.heatgenerator.block.BlockHeatGenerator";
+ public static final String IC2_BLOCK_GENERATOR = "ic2.core.block.generator.block.BlockGenerator";
+ public static final String IC2_BLOCK_REACTOR_ACCESS_HATCH = "ic2.core.block.reactor.block.BlockReactorAccessHatch";
+ public static final String IC2_BLOCK_REACTOR_CHAMBER = "ic2.core.block.reactor.block.BlockReactorChamber";
+ public static final String IC2_BLOCK_REACTOR_FLUID_PORT = "ic2.core.block.reactor.block.BlockReactorFluidPort";
+ public static final String IC2_BLOCK_REACTOR_REDSTONE_PORT = "ic2.core.block.reactor.block.BlockReactorRedstonePort";
+ public static final String IC2_BLOCK_REACTOR_VESSEL = "ic2.core.block.reactor.block.BlockReactorVessel";
+ public static final String IC2_BLOCK_PERSONAL = "ic2.core.block.personal.BlockPersonal.class";
+ public static final String IC2_BLOCK_CHARGEPAD = "ic2.core.block.wiring.BlockChargepad.class";
+ public static final String IC2_BLOCK_ELECTRIC = "ic2.core.block.wiring.BlockElectric.class";
+ public static final String IC2_BLOCK_LUMINATOR = "ic2.core.block.wiring.BlockLuminator.class";
+
+}
diff --git a/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java b/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java
index d8a4bf96f5..2a0082754a 100644
--- a/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java
+++ b/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java
@@ -2,27 +2,24 @@ package gtPlusPlus.preloader.asm;
import java.io.File;
import java.util.Arrays;
-import java.util.List;
import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
import cpw.mods.fml.common.DummyModContainer;
import cpw.mods.fml.common.LoadController;
-import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.ModMetadata;
-import cpw.mods.fml.common.event.*;
-import cpw.mods.fml.common.versioning.ArtifactVersion;
-
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.core.util.Utils;
+import cpw.mods.fml.common.event.FMLConstructionEvent;
+import cpw.mods.fml.common.event.FMLInitializationEvent;
+import cpw.mods.fml.common.event.FMLPostInitializationEvent;
+import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import gtPlusPlus.preloader.CORE_Preloader;
+import gtPlusPlus.preloader.Preloader_Logger;
import net.minecraftforge.common.config.Configuration;
public class Preloader_DummyContainer extends DummyModContainer {
public Preloader_DummyContainer() {
-
super(new ModMetadata());
ModMetadata meta = getMetadata();
meta.modId = CORE_Preloader.MODID;
@@ -35,7 +32,8 @@ public class Preloader_DummyContainer extends DummyModContainer {
meta.updateUrl = "";
meta.screenshots = new String[0];
meta.logoFile = "";
- meta.dependencies = (List<ArtifactVersion>) CORE_Preloader.DEPENDENCIES;
+ //meta.dependencies = (List<ArtifactVersion>) CORE_Preloader.DEPENDENCIES;
+ Preloader_Logger.INFO("Initializing DummyModContainer");
}
@@ -47,29 +45,26 @@ public class Preloader_DummyContainer extends DummyModContainer {
@Subscribe
public void modConstruction(FMLConstructionEvent evt){
-
- }
-
- @Subscribe
- public void init(FMLInitializationEvent evt) {
+ Preloader_Logger.INFO("Constructing DummyModContainer");
}
- @EventHandler
- public void load(final FMLInitializationEvent e) {
- Logger.INFO("[GT++ ASM] Begin resource allocation for " + CORE_Preloader.MODID + " V" + CORE_Preloader.VERSION);
- }
-
@Subscribe
public void preInit(FMLPreInitializationEvent event) {
- Logger.INFO("[GT++ ASM] Loading " + CORE_Preloader.MODID + " V" + CORE_Preloader.VERSION);
+ Preloader_Logger.INFO("Loading " + CORE_Preloader.MODID + " V" + CORE_Preloader.VERSION);
// Handle GT++ Config
handleConfigFile(event);
}
@Subscribe
+ public void init(FMLInitializationEvent evt) {
+ Preloader_Logger.INFO("Begin resource allocation for " + CORE_Preloader.MODID + " V" + CORE_Preloader.VERSION);
+
+ }
+
+ @Subscribe
public void postInit(FMLPostInitializationEvent evt) {
- Logger.INFO("[GT++ ASM] Finished loading GT++ Pre-Loader.");
+ Preloader_Logger.INFO("Finished loading.");
}
public static void handleConfigFile(final FMLPreInitializationEvent event) {
@@ -84,17 +79,17 @@ public class Preloader_DummyContainer extends DummyModContainer {
}
public static boolean getConfig(){
- final Configuration config = new Configuration( new File(Utils.getMcDir(), "config/GTplusplus/GTplusplus.cfg"));
+ final Configuration config = new Configuration( new File(gtPlusPlus.preloader.CORE_Preloader.MC_DIR, "config/GTplusplus/GTplusplus.cfg"));
if (config != null){
config.load();
// Circuits
CORE_Preloader.enableOldGTcircuits = config.getBoolean("enableOldGTcircuits", "gregtech", false, "Restores circuits and their recipes from Pre-5.09.28 times.");
CORE_Preloader.enableWatchdogBGM = config.getInt("enableWatchdogBGM", "features", 0, 0, Short.MAX_VALUE, "Set to a value greater than 0 to reduce the ticks taken to delay between BGM tracks. Acceptable Values are 1-32767, where 0 is disabled. Vanilla Uses 12,000 & 24,000. 200 is 10s.");
- Logger.INFO("GT++ Preloader - Loaded the configuration file.");
+ Preloader_Logger.INFO("Loaded the configuration file.");
return true;
}
- Logger.INFO("GT++ Preloader - Failed loading the configuration file.");
+ Preloader_Logger.INFO("Failed loading the configuration file.");
return false;
}
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java b/src/Java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java
index b208c2f8f0..6eb6070853 100644
--- a/src/Java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java
+++ b/src/Java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java
@@ -1,12 +1,16 @@
package gtPlusPlus.preloader.asm;
+import java.io.File;
import java.util.Map;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin.SortingIndex;
-
+import gtPlusPlus.preloader.CORE_Preloader;
+import gtPlusPlus.preloader.Preloader_Logger;
import gtPlusPlus.preloader.asm.transformers.Preloader_Transformer_Handler;
+import net.minecraft.launchwrapper.Launch;
+import sun.repackage.ForgeEnumHelper;
@SortingIndex(10097)
@MCVersion(value = "1.7.10")
@@ -14,6 +18,10 @@ public class Preloader_FMLLoadingPlugin implements IFMLLoadingPlugin {
//-Dfml.coreMods.load=gtPlusPlus.preloader.asm.Preloader_FMLLoadingPlugin
+ static {
+ Preloader_Logger.INFO("Initializing IFMLLoadingPlugin");
+ }
+
@Override
public String getAccessTransformerClass() {
return null;
@@ -22,7 +30,9 @@ public class Preloader_FMLLoadingPlugin implements IFMLLoadingPlugin {
@Override
public String[] getASMTransformerClass() {
//This will return the name of the class
- return new String[]{Preloader_Transformer_Handler.class.getName()};
+ return new String[]{
+ Preloader_Transformer_Handler.class.getName()
+ };
}
@Override
@@ -33,12 +43,34 @@ public class Preloader_FMLLoadingPlugin implements IFMLLoadingPlugin {
@Override
public String getSetupClass() {
+ //return Preloader_SetupClass.class.getName();
return null;
}
@Override
public void injectData(Map<String, Object> data) {
-
+ boolean isDeObf = (boolean) data.get("runtimeDeobfuscationEnabled");
+ File mcDir = (File) data.get("mcLocation");
+ //LaunchClassLoader classLoader = (LaunchClassLoader) data.get("classLoader");
+ File coremodLocation = (File) data.get("coremodLocation");
+ String deobfuscationFileName = (String) data.get("deobfuscationFileName");
+ if (mcDir != null && mcDir.exists()) {
+ CORE_Preloader.setMinecraftDirectory(mcDir);
+ Preloader_Logger.INFO("Set McDir via Preloader_SetupClass");
+ }
+ Preloader_Logger.INFO("runtimeDeobfuscationEnabled: "+isDeObf);
+ Preloader_Logger.INFO("deobfuscationFileName: "+deobfuscationFileName);
+ if (coremodLocation != null && coremodLocation.exists()) {
+ Preloader_Logger.INFO("coremodLocation: "+coremodLocation.getPath());
+ }
+ else {
+ Preloader_Logger.INFO("coremodLocation: null");
+ Preloader_Logger.ERROR("Unable to determine CoreMod location");
+ }
+ CORE_Preloader.DEV_ENVIRONMENT = (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment");
+ CORE_Preloader.DEBUG_MODE = AsmConfig.debugMode;
+ ForgeEnumHelper.setup();
+ Preloader_Logger.INFO("Running on "+gtPlusPlus.preloader.CORE_Preloader.JAVA_VERSION+" | Development Environment: "+CORE_Preloader.DEV_ENVIRONMENT);
}
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/preloader/asm/Preloader_SetupClass.java b/src/Java/gtPlusPlus/preloader/asm/Preloader_SetupClass.java
new file mode 100644
index 0000000000..a6d2b6c863
--- /dev/null
+++ b/src/Java/gtPlusPlus/preloader/asm/Preloader_SetupClass.java
@@ -0,0 +1,23 @@
+package gtPlusPlus.preloader.asm;
+
+import java.io.File;
+import java.util.Map;
+
+import cpw.mods.fml.relauncher.IFMLCallHook;
+import gtPlusPlus.preloader.CORE_Preloader;
+import gtPlusPlus.preloader.Preloader_Logger;
+
+public class Preloader_SetupClass implements IFMLCallHook {
+
+ @Override
+ public Void call() throws Exception {
+ Preloader_Logger.INFO("Executing IFMLCallHook");
+ return null;
+ }
+
+ @Override
+ public void injectData(Map<String, Object> data) {
+
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/preloader/asm/helpers/MethodHelper_GT.java b/src/Java/gtPlusPlus/preloader/asm/helpers/MethodHelper_GT.java
new file mode 100644
index 0000000000..8120df81fa
--- /dev/null
+++ b/src/Java/gtPlusPlus/preloader/asm/helpers/MethodHelper_GT.java
@@ -0,0 +1,25 @@
+package gtPlusPlus.preloader.asm.helpers;
+
+import java.util.List;
+
+import gregtech.api.enums.Materials;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+public class MethodHelper_GT {
+
+ public static final void getSubItems(GT_MetaGenerated_Tool aTool, Item var1, CreativeTabs aCreativeTab, List aList) {
+ for (int i = 0; i < 32766; i += 2) {
+ if (aTool.getToolStats(new ItemStack(aTool, 1, i)) != null) {
+ ItemStack tStack = new ItemStack(aTool, 1, i);
+ aTool.isItemStackUsable(tStack);
+ aList.add(tStack);
+ aList.add(aTool.getToolWithStats(i,1,Materials.TungstenSteel,Materials.TungstenSteel,null));
+ aList.add(aTool.getToolWithStats(i,1,Materials.Neutronium,Materials.Neutronium,null));
+ }
+ }
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java
index f71615b7c1..dce1fa15d2 100644
--- a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java
+++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java
@@ -21,7 +21,6 @@ import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.enums.SubTag;
import gregtech.api.metatileentity.BaseMetaPipeEntity;
-import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
@@ -149,7 +148,7 @@ public class ClassTransformer_GT_BlockMachines_MetaPipeEntity {
int mMode;
- public ClassTransformer_GT_BlockMachines_MetaPipeEntity(byte[] basicClass, boolean obfuscated, int aMode) {
+ public ClassTransformer_GT_BlockMachines_MetaPipeEntity(byte[] basicClass, int aMode) {
mMode = aMode;
ClassReader aTempReader = null;
ClassWriter aTempWriter = null;
diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BusPatch.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BusPatch.java
index 4394aa0f04..e123c6a9e0 100644
--- a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BusPatch.java
+++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BusPatch.java
@@ -1,6 +1,28 @@
package gtPlusPlus.preloader.asm.transformers;
-import static org.objectweb.asm.Opcodes.*;
+import static org.objectweb.asm.Opcodes.AALOAD;
+import static org.objectweb.asm.Opcodes.AASTORE;
+import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
+import static org.objectweb.asm.Opcodes.ACONST_NULL;
+import static org.objectweb.asm.Opcodes.ALOAD;
+import static org.objectweb.asm.Opcodes.ANEWARRAY;
+import static org.objectweb.asm.Opcodes.ASM5;
+import static org.objectweb.asm.Opcodes.DUP;
+import static org.objectweb.asm.Opcodes.F_FULL;
+import static org.objectweb.asm.Opcodes.GOTO;
+import static org.objectweb.asm.Opcodes.ICONST_0;
+import static org.objectweb.asm.Opcodes.ICONST_1;
+import static org.objectweb.asm.Opcodes.ICONST_2;
+import static org.objectweb.asm.Opcodes.IF_ICMPLT;
+import static org.objectweb.asm.Opcodes.ILOAD;
+import static org.objectweb.asm.Opcodes.INTEGER;
+import static org.objectweb.asm.Opcodes.INVOKESPECIAL;
+import static org.objectweb.asm.Opcodes.INVOKESTATIC;
+import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL;
+import static org.objectweb.asm.Opcodes.NEW;
+import static org.objectweb.asm.Opcodes.PUTFIELD;
+import static org.objectweb.asm.Opcodes.RETURN;
+import static org.objectweb.asm.Opcodes.UNINITIALIZED_THIS;
import org.apache.logging.log4j.Level;
import org.objectweb.asm.ClassReader;
@@ -10,13 +32,14 @@ import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import cpw.mods.fml.relauncher.FMLRelaunchLog;
+import gtPlusPlus.preloader.asm.ClassesToTransform;
public class ClassTransformer_GT_BusPatch {
- public static final String aSuperInput = "gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Input";
- public static final String aSuperOutput = "gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Output";
- public static final String aInput = "gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus";
- public static final String aOutput = "gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus";
+ private static final String aSuperInputFormatted = ClassesToTransform.GTPP_MTE_HATCH_SUPER_INPUT_BUS.replace(".", "/");
+ private static final String aSuperOutputFormatted = ClassesToTransform.GTPP_MTE_HATCH_SUPER_OUTPUT_BUS.replace(".", "/");
+ private static final String aInputFormatted = ClassesToTransform.GT_MTE_HATCH_INPUTBUS.replace(".", "/");
+ private static final String aOutputFormatted = ClassesToTransform.GT_MTE_HATCH_OUTPUTBUS.replace(".", "/");
private final boolean isValid;
private final ClassReader reader;
@@ -74,7 +97,7 @@ public class ClassTransformer_GT_BusPatch {
//GT_MetaTileEntity_Hatch_InputBus
//Constructor
- if (aClassName.equals(aInput)){
+ if (aClassName.equals(ClassesToTransform.GT_MTE_HATCH_INPUTBUS)){
//Constructor 1
{
@@ -131,14 +154,14 @@ public class ClassTransformer_GT_BusPatch {
mv.visitLineNumber(16, l4);
mv.visitVarInsn(ALOAD, 0);
mv.visitInsn(ACONST_NULL);
- mv.visitFieldInsn(PUTFIELD, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;");
+ mv.visitFieldInsn(PUTFIELD, ""+aInputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;");
Label l5 = new Label();
mv.visitLabel(l5);
mv.visitLineNumber(21, l5);
mv.visitInsn(RETURN);
Label l6 = new Label();
mv.visitLabel(l6);
- mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus;", null, l0, l6, 0);
+ mv.visitLocalVariable("this", "L"+aInputFormatted+";", null, l0, l6, 0);
mv.visitLocalVariable("aID", "I", null, l0, l6, 1);
mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l6, 2);
mv.visitLocalVariable("aNameRegional", "Ljava/lang/String;", null, l0, l6, 3);
@@ -168,14 +191,14 @@ public class ClassTransformer_GT_BusPatch {
mv.visitLineNumber(16, l1);
mv.visitVarInsn(ALOAD, 0);
mv.visitInsn(ACONST_NULL);
- mv.visitFieldInsn(PUTFIELD, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;");
+ mv.visitFieldInsn(PUTFIELD, ""+aInputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;");
Label l2 = new Label();
mv.visitLabel(l2);
mv.visitLineNumber(30, l2);
mv.visitInsn(RETURN);
Label l3 = new Label();
mv.visitLabel(l3);
- mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus;", null, l0, l3, 0);
+ mv.visitLocalVariable("this", "L"+aInputFormatted+";", null, l0, l3, 0);
mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 1);
mv.visitLocalVariable("aTier", "I", null, l0, l3, 2);
mv.visitLocalVariable("aSlots", "I", null, l0, l3, 3);
@@ -205,14 +228,14 @@ public class ClassTransformer_GT_BusPatch {
mv.visitLineNumber(16, l1);
mv.visitVarInsn(ALOAD, 0);
mv.visitInsn(ACONST_NULL);
- mv.visitFieldInsn(PUTFIELD, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;");
+ mv.visitFieldInsn(PUTFIELD, ""+aInputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;");
Label l2 = new Label();
mv.visitLabel(l2);
mv.visitLineNumber(34, l2);
mv.visitInsn(RETURN);
Label l3 = new Label();
mv.visitLabel(l3);
- mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus;", null, l0, l3, 0);
+ mv.visitLocalVariable("this", "L"+aInputFormatted+";", null, l0, l3, 0);
mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 1);
mv.visitLocalVariable("aTier", "I", null, l0, l3, 2);
mv.visitLocalVariable("aSlots", "I", null, l0, l3, 3);
@@ -231,7 +254,7 @@ public class ClassTransformer_GT_BusPatch {
//GT_MetaTileEntity_Hatch_OutputBus
//Constructor
- if (aClassName.equals(aOutput)){
+ if (aClassName.equals(ClassesToTransform.GT_MTE_HATCH_OUTPUTBUS)){
{
mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(ILjava/lang/String;Ljava/lang/String;II)V", null, null);
@@ -288,7 +311,7 @@ public class ClassTransformer_GT_BusPatch {
mv.visitInsn(RETURN);
Label l5 = new Label();
mv.visitLabel(l5);
- mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus;", null, l0, l5, 0);
+ mv.visitLocalVariable("this", "L"+aOutputFormatted+";", null, l0, l5, 0);
mv.visitLocalVariable("aID", "I", null, l0, l5, 1);
mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l5, 2);
mv.visitLocalVariable("aNameRegional", "Ljava/lang/String;", null, l0, l5, 3);
@@ -317,7 +340,7 @@ public class ClassTransformer_GT_BusPatch {
mv.visitInsn(RETURN);
Label l2 = new Label();
mv.visitLabel(l2);
- mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus;", null, l0, l2, 0);
+ mv.visitLocalVariable("this", "L"+aOutputFormatted+";", null, l0, l2, 0);
mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l2, 1);
mv.visitLocalVariable("aTier", "I", null, l0, l2, 2);
mv.visitLocalVariable("aSlots", "I", null, l0, l2, 3);
@@ -346,7 +369,7 @@ public class ClassTransformer_GT_BusPatch {
mv.visitInsn(RETURN);
Label l2 = new Label();
mv.visitLabel(l2);
- mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus;", null, l0, l2, 0);
+ mv.visitLocalVariable("this", "L"+aOutputFormatted+";", null, l0, l2, 0);
mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l2, 1);
mv.visitLocalVariable("aTier", "I", null, l0, l2, 2);
mv.visitLocalVariable("aSlots", "I", null, l0, l2, 3);
@@ -363,7 +386,7 @@ public class ClassTransformer_GT_BusPatch {
//GT_MetaTileEntity_SuperBus_Input
//Constructor
- if (aClassName.equals(aSuperInput)){
+ if (aClassName.equals(ClassesToTransform.GTPP_MTE_HATCH_SUPER_INPUT_BUS)){
{
mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(ILjava/lang/String;Ljava/lang/String;II)V", null, null);
@@ -376,20 +399,20 @@ public class ClassTransformer_GT_BusPatch {
mv.visitVarInsn(ALOAD, 2);
mv.visitVarInsn(ALOAD, 3);
mv.visitVarInsn(ILOAD, 4);
- mv.visitMethodInsn(INVOKESPECIAL, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus", "<init>", "(ILjava/lang/String;Ljava/lang/String;I)V", false);
+ mv.visitMethodInsn(INVOKESPECIAL, ""+aInputFormatted+"", "<init>", "(ILjava/lang/String;Ljava/lang/String;I)V", false);
Label l1 = new Label();
mv.visitLabel(l1);
mv.visitLineNumber(20, l1);
mv.visitVarInsn(ALOAD, 0);
mv.visitInsn(ACONST_NULL);
- mv.visitFieldInsn(PUTFIELD, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;");
+ mv.visitFieldInsn(PUTFIELD, ""+aSuperInputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;");
Label l2 = new Label();
mv.visitLabel(l2);
mv.visitLineNumber(28, l2);
mv.visitInsn(RETURN);
Label l3 = new Label();
mv.visitLabel(l3);
- mv.visitLocalVariable("this", "LgtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input;", null, l0, l3, 0);
+ mv.visitLocalVariable("this", "L"+aSuperInputFormatted+";", null, l0, l3, 0);
mv.visitLocalVariable("aID", "I", null, l0, l3, 1);
mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 2);
mv.visitLocalVariable("aNameRegional", "Ljava/lang/String;", null, l0, l3, 3);
@@ -409,23 +432,23 @@ public class ClassTransformer_GT_BusPatch {
mv.visitVarInsn(ALOAD, 1);
mv.visitVarInsn(ILOAD, 2);
mv.visitVarInsn(ILOAD, 2);
- mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input", "getSlots", "(I)I", false);
+ mv.visitMethodInsn(INVOKESTATIC, ""+aSuperInputFormatted+"", "getSlots", "(I)I", false);
mv.visitVarInsn(ALOAD, 3);
mv.visitVarInsn(ALOAD, 4);
- mv.visitMethodInsn(INVOKESPECIAL, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false);
+ mv.visitMethodInsn(INVOKESPECIAL, ""+aInputFormatted+"", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false);
Label l1 = new Label();
mv.visitLabel(l1);
mv.visitLineNumber(20, l1);
mv.visitVarInsn(ALOAD, 0);
mv.visitInsn(ACONST_NULL);
- mv.visitFieldInsn(PUTFIELD, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;");
+ mv.visitFieldInsn(PUTFIELD, ""+aSuperInputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;");
Label l2 = new Label();
mv.visitLabel(l2);
mv.visitLineNumber(28, l2);
mv.visitInsn(RETURN);
Label l3 = new Label();
mv.visitLabel(l3);
- mv.visitLocalVariable("this", "LgtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input;", null, l0, l3, 0);
+ mv.visitLocalVariable("this", "L"+aSuperInputFormatted+";", null, l0, l3, 0);
mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 1);
mv.visitLocalVariable("aTier", "I", null, l0, l3, 2);
mv.visitLocalVariable("aDescription", "Ljava/lang/String;", null, l0, l3, 3);
@@ -444,25 +467,25 @@ public class ClassTransformer_GT_BusPatch {
mv.visitVarInsn(ALOAD, 1);
mv.visitVarInsn(ILOAD, 2);
mv.visitVarInsn(ILOAD, 2);
- mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input", "getSlots", "(I)I", false);
+ mv.visitMethodInsn(INVOKESTATIC, ""+aSuperInputFormatted+"", "getSlots", "(I)I", false);
mv.visitVarInsn(ALOAD, 3);
mv.visitInsn(ICONST_0);
mv.visitInsn(AALOAD);
mv.visitVarInsn(ALOAD, 4);
- mv.visitMethodInsn(INVOKESPECIAL, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false);
+ mv.visitMethodInsn(INVOKESPECIAL, ""+aInputFormatted+"", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false);
Label l1 = new Label();
mv.visitLabel(l1);
mv.visitLineNumber(20, l1);
mv.visitVarInsn(ALOAD, 0);
mv.visitInsn(ACONST_NULL);
- mv.visitFieldInsn(PUTFIELD, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;");
+ mv.visitFieldInsn(PUTFIELD, ""+aSuperInputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;");
Label l2 = new Label();
mv.visitLabel(l2);
mv.visitLineNumber(32, l2);
mv.visitInsn(RETURN);
Label l3 = new Label();
mv.visitLabel(l3);
- mv.visitLocalVariable("this", "LgtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input;", null, l0, l3, 0);
+ mv.visitLocalVariable("this", "L"+aSuperInputFormatted+";", null, l0, l3, 0);
mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 1);
mv.visitLocalVariable("aTier", "I", null, l0, l3, 2);
mv.visitLocalVariable("aDescription", "[Ljava/lang/String;", null, l0, l3, 3);
@@ -479,7 +502,7 @@ public class ClassTransformer_GT_BusPatch {
//GT_MetaTileEntity_SuperBus_Output
//Constructor
- if (aClassName.equals(aSuperOutput)){
+ if (aClassName.equals(ClassesToTransform.GTPP_MTE_HATCH_SUPER_OUTPUT_BUS)){
{
mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(ILjava/lang/String;Ljava/lang/String;II)V", null, null);
@@ -492,20 +515,20 @@ public class ClassTransformer_GT_BusPatch {
mv.visitVarInsn(ALOAD, 2);
mv.visitVarInsn(ALOAD, 3);
mv.visitVarInsn(ILOAD, 4);
- mv.visitMethodInsn(INVOKESPECIAL, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus", "<init>", "(ILjava/lang/String;Ljava/lang/String;I)V", false);
+ mv.visitMethodInsn(INVOKESPECIAL, ""+aOutputFormatted+"", "<init>", "(ILjava/lang/String;Ljava/lang/String;I)V", false);
Label l1 = new Label();
mv.visitLabel(l1);
mv.visitLineNumber(18, l1);
mv.visitVarInsn(ALOAD, 0);
mv.visitInsn(ACONST_NULL);
- mv.visitFieldInsn(PUTFIELD, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;");
+ mv.visitFieldInsn(PUTFIELD, ""+aSuperOutputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;");
Label l2 = new Label();
mv.visitLabel(l2);
mv.visitLineNumber(26, l2);
mv.visitInsn(RETURN);
Label l3 = new Label();
mv.visitLabel(l3);
- mv.visitLocalVariable("this", "LgtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output;", null, l0, l3, 0);
+ mv.visitLocalVariable("this", "L"+aSuperOutputFormatted+";", null, l0, l3, 0);
mv.visitLocalVariable("aID", "I", null, l0, l3, 1);
mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 2);
mv.visitLocalVariable("aNameRegional", "Ljava/lang/String;", null, l0, l3, 3);
@@ -525,23 +548,23 @@ public class ClassTransformer_GT_BusPatch {
mv.visitVarInsn(ALOAD, 1);
mv.visitVarInsn(ILOAD, 2);
mv.visitVarInsn(ILOAD, 2);
- mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output", "getSlots", "(I)I", false);
+ mv.visitMethodInsn(INVOKESTATIC, ""+aSuperOutputFormatted+"", "getSlots", "(I)I", false);
mv.visitVarInsn(ALOAD, 3);
mv.visitVarInsn(ALOAD, 4);
- mv.visitMethodInsn(INVOKESPECIAL, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false);
+ mv.visitMethodInsn(INVOKESPECIAL, ""+aOutputFormatted+"", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false);
Label l1 = new Label();
mv.visitLabel(l1);
mv.visitLineNumber(18, l1);
mv.visitVarInsn(ALOAD, 0);
mv.visitInsn(ACONST_NULL);
- mv.visitFieldInsn(PUTFIELD, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;");
+ mv.visitFieldInsn(PUTFIELD, ""+aSuperOutputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;");
Label l2 = new Label();
mv.visitLabel(l2);
mv.visitLineNumber(26, l2);
mv.visitInsn(RETURN);
Label l3 = new Label();
mv.visitLabel(l3);
- mv.visitLocalVariable("this", "LgtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output;", null, l0, l3, 0);
+ mv.visitLocalVariable("this", "L"+aSuperOutputFormatted+";", null, l0, l3, 0);
mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 1);
mv.visitLocalVariable("aTier", "I", null, l0, l3, 2);
mv.visitLocalVariable("aDescription", "Ljava/lang/String;", null, l0, l3, 3);
@@ -560,25 +583,25 @@ public class ClassTransformer_GT_BusPatch {
mv.visitVarInsn(ALOAD, 1);
mv.visitVarInsn(ILOAD, 2);
mv.visitVarInsn(ILOAD, 2);
- mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output", "getSlots", "(I)I", false);
+ mv.visitMethodInsn(INVOKESTATIC, ""+aSuperOutputFormatted+"", "getSlots", "(I)I", false);
mv.visitVarInsn(ALOAD, 3);
mv.visitInsn(ICONST_0);
mv.visitInsn(AALOAD);
mv.visitVarInsn(ALOAD, 4);
- mv.visitMethodInsn(INVOKESPECIAL, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false);
+ mv.visitMethodInsn(INVOKESPECIAL, ""+aOutputFormatted+"", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false);
Label l1 = new Label();
mv.visitLabel(l1);
mv.visitLineNumber(18, l1);
mv.visitVarInsn(ALOAD, 0);
mv.visitInsn(ACONST_NULL);
- mv.visitFieldInsn(PUTFIELD, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;");
+ mv.visitFieldInsn(PUTFIELD, ""+aSuperOutputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;");
Label l2 = new Label();
mv.visitLabel(l2);
mv.visitLineNumber(30, l2);
mv.visitInsn(RETURN);
Label l3 = new Label();
mv.visitLabel(l3);
- mv.visitLocalVariable("this", "LgtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output;", null, l0, l3, 0);
+ mv.visitLocalVariable("this", "L"+aSuperOutputFormatted+";", null, l0, l3, 0);
mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 1);
mv.visitLocalVariable("aTier", "I", null, l0, l3, 2);
mv.visitLocalVariable("aDescription", "[Ljava/lang/String;", null, l0, l3, 3);
@@ -612,7 +635,7 @@ public class ClassTransformer_GT_BusPatch {
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
MethodVisitor methodVisitor;
- if ((mClassName.equals(aSuperInput) || mClassName.equals(aSuperOutput)) && access == ACC_PUBLIC && name.equals("<init>") && (desc.equals("(Ljava/lang/String;ILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V") || desc.equals("(Ljava/lang/String;I[Ljava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V"))) {
+ if ((mClassName.equals(ClassesToTransform.GTPP_MTE_HATCH_SUPER_INPUT_BUS) || mClassName.equals(ClassesToTransform.GTPP_MTE_HATCH_SUPER_OUTPUT_BUS)) && access == ACC_PUBLIC && name.equals("<init>") && (desc.equals("(Ljava/lang/String;ILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V") || desc.equals("(Ljava/lang/String;I[Ljava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V"))) {
FMLRelaunchLog.log("[GT++ ASM] Gregtech Bus Patch", Level.INFO, "Found Constructor, "+"'"+access+"', "+"'"+name+"', "+"'"+desc+"', "+"'"+signature+"'");
methodVisitor = null;
}
diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client.java
index da6abfe57c..e2d34c38e7 100644
--- a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client.java
+++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client.java
@@ -152,19 +152,24 @@ public class ClassTransformer_GT_Client {
}
if (aGregtech != null) {
+ File file = aGregtech;
+ FileInputStream fis;
+ JarInputStream jis;
try {
- File file = aGregtech;
- FileInputStream fis = new FileInputStream(file);
- JarInputStream jis = new JarInputStream(fis);
+ fis = new FileInputStream(file);
+ jis = new JarInputStream(fis);
System.out.println(jis.markSupported());
JarEntry je;
while((je=jis.getNextJarEntry())!=null){
if (je.getName().contains("GT_MetaTileEntity_AssemblyLine")) {
FMLRelaunchLog.log("[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO, "Patchable class | "+je.getName());
+ jis.close();
return true;
}
}
- jis.close();
+ if (jis != null) {
+ jis.close();
+ }
return true;
} catch (IOException e1) {
}
diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_MetaGenerated_Tool.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_MetaGenerated_Tool.java
new file mode 100644
index 0000000000..b6cd9c8d67
--- /dev/null
+++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_MetaGenerated_Tool.java
@@ -0,0 +1,116 @@
+package gtPlusPlus.preloader.asm.transformers;
+
+import static org.objectweb.asm.Opcodes.ACC_FINAL;
+import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
+import static org.objectweb.asm.Opcodes.ALOAD;
+import static org.objectweb.asm.Opcodes.ASM5;
+import static org.objectweb.asm.Opcodes.INVOKESTATIC;
+import static org.objectweb.asm.Opcodes.RETURN;
+
+import org.apache.logging.log4j.Level;
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.ClassReader;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.ClassWriter;
+import org.objectweb.asm.Label;
+import org.objectweb.asm.MethodVisitor;
+
+import gtPlusPlus.preloader.Preloader_Logger;
+
+public class ClassTransformer_GT_MetaGenerated_Tool {
+
+ private final boolean isValid;
+ private final ClassReader reader;
+ private final ClassWriter writer;
+
+ public ClassTransformer_GT_MetaGenerated_Tool(byte[] basicClass) {
+ ClassReader aTempReader = null;
+ ClassWriter aTempWriter = null;
+ aTempReader = new ClassReader(basicClass);
+ aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES);
+ aTempReader.accept(new LocalClassVisitor(aTempWriter), 0);
+ boolean completed = injectMethod("getSubItems", aTempWriter);
+ if (aTempReader != null && aTempWriter != null && completed) {
+ isValid = true;
+ } else {
+ isValid = false;
+ }
+ Preloader_Logger.LOG("GT Tool Fix", Level.INFO, "Valid? " + isValid + ".");
+ reader = aTempReader;
+ writer = aTempWriter;
+ }
+
+ public boolean isValidTransformer() {
+ return isValid;
+ }
+
+ public ClassReader getReader() {
+ return reader;
+ }
+
+ public ClassWriter getWriter() {
+ return writer;
+ }
+
+ public boolean injectMethod(String aMethodName, ClassWriter cw) {
+ MethodVisitor mv;
+ boolean didInject = false;
+ Preloader_Logger.LOG("GT Tool Fix", Level.INFO, "Injecting " + aMethodName + ".");
+ if (aMethodName.equals("getSubItems")) {
+ {
+ mv = cw.visitMethod(ACC_PUBLIC + ACC_FINAL, "getSubItems", "(Lnet/minecraft/item/Item;Lnet/minecraft/creativetab/CreativeTabs;Ljava/util/List;)V", null, null);
+ {
+ AnnotationVisitor av0 = mv.visitAnnotation("Lcpw/mods/fml/relauncher/SideOnly;", true);
+ av0.visitEnum("value", "Lcpw/mods/fml/relauncher/Side;", "CLIENT");
+ av0.visitEnd();
+ }
+ mv.visitCode();
+ Label l0 = new Label();
+ mv.visitLabel(l0);
+ mv.visitLineNumber(321, l0);
+ mv.visitVarInsn(ALOAD, 0);
+ mv.visitVarInsn(ALOAD, 1);
+ mv.visitVarInsn(ALOAD, 2);
+ mv.visitVarInsn(ALOAD, 3);
+ mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/preloader/asm/helpers/MethodHelper_GT", "getSubItems", "(Lgregtech/api/items/GT_MetaGenerated_Tool;Lnet/minecraft/item/Item;Lnet/minecraft/creativetab/CreativeTabs;Ljava/util/List;)V", false);
+ Label l1 = new Label();
+ mv.visitLabel(l1);
+ mv.visitLineNumber(322, l1);
+ mv.visitInsn(RETURN);
+ Label l2 = new Label();
+ mv.visitLabel(l2);
+ mv.visitLocalVariable("this", "Lgregtech/api/items/GT_MetaGenerated_Tool;", null, l0, l2, 0);
+ mv.visitLocalVariable("var1", "Lnet/minecraft/item/Item;", null, l0, l2, 1);
+ mv.visitLocalVariable("aCreativeTab", "Lnet/minecraft/creativetab/CreativeTabs;", null, l0, l2, 2);
+ mv.visitLocalVariable("aList", "Ljava/util/List;", null, l0, l2, 3);
+ mv.visitMaxs(4, 4);
+ mv.visitEnd();
+ didInject = true;
+ }
+
+ }
+ Preloader_Logger.LOG("GT Tool Fix", Level.INFO, "Method injection complete.");
+ return didInject;
+ }
+
+ public final class LocalClassVisitor extends ClassVisitor {
+
+ public LocalClassVisitor(ClassVisitor cv) {
+ super(ASM5, cv);
+ }
+
+ @Override
+ public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
+ MethodVisitor methodVisitor;
+ if (name.equals("getSubItems") && desc.equals("(Lnet/minecraft/item/Item;Lnet/minecraft/creativetab/CreativeTabs;Ljava/util/List;)V")) {
+ methodVisitor = null;
+ Preloader_Logger.LOG("GT Tool Fix", Level.INFO, "Found method "+name+", removing.");
+ }
+ else {
+ methodVisitor = super.visitMethod(access, name, desc, signature, exceptions);
+ }
+ return methodVisitor;
+ }
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Utility.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Utility.java
index 36c09688bc..307900ad9e 100644
--- a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Utility.java
+++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Utility.java
@@ -15,6 +15,7 @@ import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import cpw.mods.fml.relauncher.FMLRelaunchLog;
+import gtPlusPlus.core.util.Utils;
public class ClassTransformer_GT_Utility {
@@ -66,7 +67,8 @@ public class ClassTransformer_GT_Utility {
MethodVisitor mv;
boolean didInject = false;
ClassWriter cw = getWriter();
- FMLRelaunchLog.log("[GT++ ASM] Gregtech Utilities Patch", Level.INFO, "Injecting " + aMethodName + ".");
+ String aClassNameFormatted = Utils.class.getName().replace(".", "/");
+ FMLRelaunchLog.log("[GT++ ASM] Gregtech Utilities Patch", Level.INFO, "Injecting " + aMethodName + ", static replacement call to "+aClassNameFormatted+".");
if (aMethodName.equals("getTier")) {
mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "getTier", "(J)B", null, null);
mv.visitCode();
@@ -74,7 +76,7 @@ public class ClassTransformer_GT_Utility {
mv.visitLabel(l0);
mv.visitLineNumber(23, l0);
mv.visitVarInsn(LLOAD, 0);
- mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/core/util/Utils", "getTier", "(J)B", false);
+ mv.visitMethodInsn(INVOKESTATIC, aClassNameFormatted, "getTier", "(J)B", false);
mv.visitInsn(IRETURN);
Label l1 = new Label();
mv.visitLabel(l1);
diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java
index 507e2cf974..443337bd35 100644
--- a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java
+++ b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java
@@ -1,40 +1,5 @@
package gtPlusPlus.preloader.asm.transformers;
-import static org.objectweb.asm.Opcodes.*;
-
-import java.lang.reflect.Field;
-import java.util.*;
-
-import org.apache.logging.log4j.Level;
-import org.objectweb.asm.ClassVisitor;
-import org.objectweb.asm.FieldVisitor;
-import org.objectweb.asm.MethodVisitor;
-
-import cpw.mods.fml.relauncher.FMLRelaunchLog;
-
-import net.minecraft.block.Block;
-import net.minecraft.block.BlockContainer;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.item.EntityItem;
-import net.minecraft.init.Blocks;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.world.World;
-
-import gregtech.api.GregTech_API;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.BaseMetaTileEntity;
-import gregtech.api.metatileentity.MetaTileEntity;
-import gregtech.common.blocks.GT_Block_Machines;
-
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.api.objects.minecraft.BlockPos;
-import gtPlusPlus.api.objects.random.XSTR;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
-import gtPlusPlus.core.util.minecraft.NBTUtils;
-import gtPlusPlus.core.util.reflect.ReflectionUtils;
-
public class Preloader_ClassTransformer2 {
/**
@@ -48,321 +13,4 @@ public class Preloader_ClassTransformer2 {
*
*/
-
-
- public static boolean mHasSetField = false;
-
- private final static Class<BaseMetaTileEntity> customTransformer2 = BaseMetaTileEntity.class;
- public static final class GT_MetaTile_Visitor extends ClassVisitor {
- private boolean isGt_Block_Machines = false;
-
- public GT_MetaTile_Visitor(ClassVisitor cv, boolean isGt_Block_Machines) {
- super(ASM5, cv);
- this.isGt_Block_Machines = isGt_Block_Machines;
- }
-
- @Override
- public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
- FieldVisitor j = super.visitField(access, name, desc, signature, value);
- if (!mHasSetField && !isGt_Block_Machines) {
- mHasSetField = true;
- FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Injecting field 'mItemStorageNBT' into BaseMetaTileEntity.java. Access OpCode: "+access);
- j = cv.visitField(0, "mItemStorageNBT", "Lnet/minecraft/nbt/NBTTagCompound;", null, null);
- j.visitEnd();
- }
- return j;
- }
-
- @Override
- public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
- MethodVisitor methodVisitor = super.visitMethod(access, name, desc, signature, exceptions);
-
- if (isGt_Block_Machines) { //Lnet/minecraft/world/World;IIILnet/minecraft/block/Block;I)V
- if(name.equals("breakBlock") && desc.equals("(Lnet/minecraft/world/World;IIILnet/minecraft/block/Block;I)V")) {
- FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Found target method 'breakBlock' [Unobfuscated]. Access OpCode: "+access);
- return new swapBreakBlock(methodVisitor);
- }
- else if (name.equals("breakBlock") && !desc.equals("(Lnet/minecraft/world/World;IIILnet/minecraft/block/Block;I)V")) {
- FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Found target method 'breakBlock' [Obfuscated]. Access OpCode: "+access);
- return new swapBreakBlock(methodVisitor);
- }
- }
- else {
- if(name.equals("getDrops") && desc.equals("()Ljava/util/ArrayList;")) {
- FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Found target method 'getDrops'. Access OpCode: "+access);
- return new swapGetDrops(methodVisitor);
- }
- }
- return methodVisitor;
- }
-
- }
-
-
-
-
- private static final class swapGetDrops extends MethodVisitor {
-
- public swapGetDrops(MethodVisitor mv) {
- super(ASM5, mv);
- }
-
- @Override
- public void visitCode() {
- FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Fixing Greg & Blood's poor attempt at setItemNBT().");
- super.visitCode();
- //ALOAD 0
- //INVOKESTATIC gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2 getDrops (Lgregtech/api/metatileentity/BaseMetaTileEntity;)Ljava/util/ArrayList;
- //ARETURN
-
- super.visitVarInsn(ALOAD, 0);
- super.visitMethodInsn(INVOKESTATIC,
- "gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2",
- "getDrops",
- "(Lgregtech/api/metatileentity/BaseMetaTileEntity;)Ljava/util/ArrayList;",
- false);
- FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Method should now be replaced.");
- //super.visitVarInsn(ARETURN, 0);
- super.visitInsn(ARETURN);
- }
-
- }
-
- private static final class swapBreakBlock extends MethodVisitor {
-
- public swapBreakBlock(MethodVisitor mv) {
- super(ASM5, mv);
- }
-
- @Override
- public void visitCode() {
- FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Fixing breakBlock() in GT_Block_Machines.class");
- super.visitCode();
- //super.visitVarInsn(ALOAD, 0);
-
- super.visitVarInsn(ALOAD, 1);
- super.visitVarInsn(ILOAD, 2);
- super.visitVarInsn(ILOAD, 3);
- super.visitVarInsn(ILOAD, 4);
- super.visitVarInsn(ALOAD, 5);
- super.visitVarInsn(ILOAD, 6);
-
- super.visitMethodInsn(INVOKESTATIC,
- "gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2",
- "breakBlock",
- "(Lnet/minecraft/world/World;IIILnet/minecraft/block/Block;I)V",
- false);
- FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Method should now be replaced.");
- super.visitInsn(RETURN);
- }
-
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public static ArrayList<ItemStack> getDrops(BaseMetaTileEntity o) {
- Logger.INFO("BaseMetaTileEntity.getDrops(BaseMetaTileEntity(this))");
- try {
- short tID = (short) ReflectionUtils.getField(customTransformer2, "mID").get(o);
- ItemStack rStack = new ItemStack(GregTech_API.sBlockMachines, 1, tID);
-
- NBTTagCompound i = new NBTTagCompound();
-
- i = stupidFuckingNBTMap.get(new BlockPos(o.xCoord, o.yCoord, o.zCoord, o.getWorld()));
- Logger.INFO("Got NBT Tag Value from map.");
-
- NBTTagCompound tNBT = i;
- if (tNBT == null) {
- Logger.INFO("Map tag was null.");
- tNBT = generateGetDropsNBT(o);
- }
- if (!tNBT.hasNoTags()) {
- rStack.setTagCompound(tNBT);
- Logger.INFO("Iterating rStack NBT.");
- NBTUtils.tryIterateNBTData(rStack);
- }
- return new ArrayList<ItemStack>(Arrays.asList(rStack));
- }
- catch (IllegalArgumentException | IllegalAccessException a){
- Logger.REFLECTION("getDropsHack2");
- a.printStackTrace();
- }
- ArrayList<ItemStack> u = new ArrayList<ItemStack>(Arrays.asList(new ItemStack[]{ItemUtils.getSimpleStack(Blocks.bedrock)}));
- return u;
- }
-
- public static Map<BlockPos, NBTTagCompound> stupidFuckingNBTMap = new HashMap<BlockPos, NBTTagCompound>();
- public static void breakBlock(final World aWorld, final int aX, final int aY, final int aZ, final Block block,
- final int meta) {
- Logger.INFO("GT_Block_Machines.breakBlock()");
- GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
- final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (tTileEntity instanceof IGregTechTileEntity) {
- final IGregTechTileEntity tGregTechTileEntity = (IGregTechTileEntity) tTileEntity;
- final Random tRandom = new XSTR();
- GT_Block_Machines.mTemporaryTileEntity.set(tGregTechTileEntity);
-
- //Try inject this
- Logger.INFO("Hopefully saving ItemNBT data.");
-
- NBTTagCompound tNBT = new NBTTagCompound();
- tNBT = generateGetDropsNBT(tGregTechTileEntity.getMetaTileEntity().getBaseMetaTileEntity());
- tGregTechTileEntity.getMetaTileEntity().setItemNBT(tNBT);
- Field fffff;
- try {
- fffff = ReflectionUtils.getField(tGregTechTileEntity.getClass(), "mItemStorageNBT");
- if (fffff == null) {
- Logger.REFLECTION("Injected field is null.");
- }
- else {
- fffff.set(tGregTechTileEntity.getMetaTileEntity().getBaseMetaTileEntity(), tNBT);
- Logger.REFLECTION("Hopefully injected field data.");
- stupidFuckingNBTMap.put(new BlockPos(aX, aY, aZ, tGregTechTileEntity.getMetaTileEntity().getBaseMetaTileEntity().getWorld()), tNBT);
- Logger.INFO("Set NBT Tag Value to map.");
- }
- }
- catch (IllegalArgumentException | IllegalAccessException e) {
- e.printStackTrace();
- }
-
- for (int i = 0; i < tGregTechTileEntity.getSizeInventory(); ++i) {
- final ItemStack tItem = tGregTechTileEntity.getStackInSlot(i);
- if (tItem != null && tItem.stackSize > 0 && tGregTechTileEntity.isValidSlot(i)) {
-
-
-
- final EntityItem tItemEntity = new EntityItem(aWorld,
- (double) (aX + tRandom.nextFloat() * 0.8f + 0.1f),
- (double) (aY + tRandom.nextFloat() * 0.8f + 0.1f),
- (double) (aZ + tRandom.nextFloat() * 0.8f + 0.1f),
- new ItemStack(tItem.getItem(), tItem.stackSize, tItem.getItemDamage()));
- if (tItem.hasTagCompound()) {
- tItemEntity.getEntityItem().setTagCompound((NBTTagCompound) tItem.getTagCompound().copy());
- }
- tItemEntity.motionX = tRandom.nextGaussian() * 0.0500000007450581;
- tItemEntity.motionY = tRandom.nextGaussian() * 0.0500000007450581 + 0.2000000029802322;
- tItemEntity.motionZ = tRandom.nextGaussian() * 0.0500000007450581;
- aWorld.spawnEntityInWorld((Entity) tItemEntity);
- tItem.stackSize = 0;
- tGregTechTileEntity.setInventorySlotContents(i, (ItemStack) null);
- }
- }
- }
-
- //gtPlusPlus.preloader.asm.transformers.Preloader_ClassTransformer2.breakBlockWorld(aWorld, aX, aY, aZ, block, meta);
- aWorld.removeTileEntity(aX, aY, aZ);
- }
-
- public static void breakBlockWorld(World world, int aX, int aY, int aZ, Block block, int meta){
- if (block.hasTileEntity(meta) && !(block instanceof BlockContainer))
- {
- world.removeTileEntity(aX, aY, aZ);
- }
- }
-
- public static NBTTagCompound generateGetDropsNBT(IGregTechTileEntity iGregTechTileEntity) {
- Logger.INFO("generateGetDropsNBT()");
- try {
- short tID = (short) ReflectionUtils.getField(customTransformer2, "mID").get(iGregTechTileEntity);
- NBTTagCompound tRecipeStuff = (NBTTagCompound) ReflectionUtils.getField(customTransformer2, "mRecipeStuff").get(iGregTechTileEntity);
- boolean tMuffler = (boolean) ReflectionUtils.getField(customTransformer2, "mMuffler").get(iGregTechTileEntity);
- boolean tLockUpgrade = (boolean) ReflectionUtils.getField(customTransformer2, "mLockUpgrade").get(iGregTechTileEntity);
- boolean tSteamConverter = (boolean) ReflectionUtils.getField(customTransformer2, "mSteamConverter").get(iGregTechTileEntity);
- byte tColor = (byte) ReflectionUtils.getField(customTransformer2, "mColor").get(iGregTechTileEntity);
- byte tOtherUpgrades = (byte) ReflectionUtils.getField(customTransformer2, "mOtherUpgrades").get(iGregTechTileEntity);
- byte tStrongRedstone = (byte) ReflectionUtils.getField(customTransformer2, "mStrongRedstone").get(iGregTechTileEntity);
- int[] tCoverSides = (int[]) ReflectionUtils.getField(customTransformer2, "mCoverSides").get(iGregTechTileEntity);
- int[] tCoverData = (int[]) ReflectionUtils.getField(customTransformer2, "mCoverData").get(iGregTechTileEntity);
-
- NBTTagCompound mItemStorageNBT;
- MetaTileEntity tMetaTileEntity = (MetaTileEntity) ReflectionUtils.getField(customTransformer2, "mMetaTileEntity").get(iGregTechTileEntity);
- Field fffff = ReflectionUtils.getField(customTransformer2, "mItemStorageNBT");
- if (fffff == null) {
- Logger.REFLECTION("Injected field is null.");
- mItemStorageNBT = new NBTTagCompound();
- }
- else {
- Logger.REFLECTION("Injected field exists.");
- if (fffff.get(iGregTechTileEntity) != null) {
- Logger.REFLECTION("Injected field has value.");
- mItemStorageNBT = (NBTTagCompound) fffff.get(iGregTechTileEntity);
- }
- else {
- Logger.REFLECTION("Injected field has no value.");
- mItemStorageNBT = null;
- }
- }
-
- //BaseMetaTileEntity tMetaTileEntity = o;
-
- Logger.REFLECTION("tID: "+(tID != 0));
- Logger.REFLECTION("tRecipeStuff: "+(tRecipeStuff != null));
- Logger.REFLECTION("tMuffler: "+(tMuffler != false));
- Logger.REFLECTION("tLockUpgrade: "+(tLockUpgrade != false));
- Logger.REFLECTION("tSteamConverter: "+(tSteamConverter != false));
- Logger.REFLECTION("tColor: "+(tColor != 0));
- Logger.REFLECTION("tOtherUpgrades: "+(tOtherUpgrades != 0));
- Logger.REFLECTION("tCoverSides: "+(tCoverSides != null));
- Logger.REFLECTION("tCoverData: "+(tCoverData != null));
- Logger.REFLECTION("tMetaTileEntity: "+(tMetaTileEntity != null));
- Logger.REFLECTION("mItemStorageNBT: "+(mItemStorageNBT != null));
-
- //mItemStorageNBT
- NBTTagCompound tNBT = new NBTTagCompound();
-
- if (tRecipeStuff != null && !tRecipeStuff.hasNoTags()) tNBT.setTag("GT.CraftingComponents", tRecipeStuff);
- if (mItemStorageNBT != null && !mItemStorageNBT.hasNoTags()) tNBT.setTag("mItemStorageNBT", mItemStorageNBT);
- if (tMuffler) tNBT.setBoolean("mMuffler", tMuffler);
- if (tLockUpgrade) tNBT.setBoolean("mLockUpgrade", tLockUpgrade);
- if (tSteamConverter) tNBT.setBoolean("mSteamConverter", tSteamConverter);
- if (tColor > 0) tNBT.setByte("mColor", tColor);
- //if (tFluid != null) tFluid.writeToNBT(tNBT);
- //if (tFluid != null) tNBT.setTag("mFluid", tFluid);
- if (tOtherUpgrades > 0) tNBT.setByte("mOtherUpgrades", tOtherUpgrades);
- if (tStrongRedstone > 0) tNBT.setByte("mStrongRedstone", tStrongRedstone);
- for (byte i = 0; i < tCoverSides.length; i++) {
- if (tCoverSides[i] != 0) {
- tNBT.setIntArray("mCoverData", tCoverData);
- tNBT.setIntArray("mCoverSides", tCoverSides);
- break;
- }
- }
-
- //Set stack NBT
- if (!tNBT.hasNoTags()) {
- Logger.INFO("Returning Valid NBT data");
- return tNBT;
- }
- else {
- Logger.INFO("Returning Invalid NBT data");
- }
- }
- catch (IllegalArgumentException | IllegalAccessException a){
- Logger.REFLECTION("getDropsHack2");
- a.printStackTrace();
- }
- return new NBTTagCompound();
- }
-
}
diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java
index d378883665..5dc7dcfbc8 100644
--- a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java
+++ b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java
@@ -1,15 +1,65 @@
package gtPlusPlus.preloader.asm.transformers;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.COFH_ORE_DICTIONARY_ARBITER;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.FORGE_CHUNK_MANAGER;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.FORGE_ORE_DICTIONARY;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.GALACTICRAFT_ENTITY_AUTO_ROCKET;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.GALACTICRAFT_FLUID_UTILS;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.GALACTICRAFT_TILE_ENTITY_FUEL_LOADER;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.GTPP_MTE_HATCH_SUPER_INPUT_BUS;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.GTPP_MTE_HATCH_SUPER_OUTPUT_BUS;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_ACHIEVEMENTS;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_BASE_META_TILE_ENTITY;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_BLOCK_MACHINES;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_CLIENT_PROXY;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_ITEM_MACHINES;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_METAGENERATED_TOOL;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_METAPIPE_FLUID;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_METAPIPE_FRAME;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_METAPIPE_ITEM;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_MTE_CHARCOAL_PIT;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_MTE_HATCH_INPUTBUS;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_MTE_HATCH_OUTPUTBUS;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_PACKET_TILE_ENTITY;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_UTILITY;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_BASE_TILE_ENTITY;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_CHARGEPAD;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_ELECTRIC;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_GENERATOR;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_HEAT_GENERATOR;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_KINETIC_GENERATOR;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_LUMINATOR;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_MACHINE1;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_MACHINE2;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_MACHINE3;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_PERSONAL;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_REACTOR_ACCESS_HATCH;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_REACTOR_CHAMBER;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_REACTOR_FLUID_PORT;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_REACTOR_REDSTONE_PORT;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_REACTOR_VESSEL;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_ITEM_ARMOUR_HAZMAT;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.LWJGL_KEYBOARD;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.MINECRAFT_GAMESETTINGS;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.MINECRAFT_GAMESETTINGS_OBF;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.RAILCRAFT_FLUID_HELPER;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.RAILCRAFT_INVENTORY_TOOLS;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.RAILCRAFT_TILE_FLUID_LOADER;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.THAUMCRAFT_ITEM_WISP_ESSENCE;
+import static gtPlusPlus.preloader.asm.ClassesToTransform.TINKERS_FLUID_BLOCK;
+
import java.io.File;
import java.io.IOException;
-import org.apache.logging.log4j.Level;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import cpw.mods.fml.relauncher.CoreModManager;
-import cpw.mods.fml.relauncher.FMLRelaunchLog;
import cpw.mods.fml.relauncher.ReflectionHelper;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.preloader.CORE_Preloader;
+import gtPlusPlus.preloader.DevHelper;
+import gtPlusPlus.preloader.Preloader_Logger;
import gtPlusPlus.preloader.asm.AsmConfig;
import gtPlusPlus.preloader.asm.transformers.Preloader_ClassTransformer.OreDictionaryVisitor;
import net.minecraft.launchwrapper.IClassTransformer;
@@ -17,18 +67,29 @@ import net.minecraft.launchwrapper.Launch;
public class Preloader_Transformer_Handler implements IClassTransformer {
- private final boolean mEnabled = false;
public static final AsmConfig mConfig;
-
- private static final String class_Block_Machines = "gregtech.common.blocks.GT_Block_Machines";
- private static final String class_GT_MetaPipeEntity_Item = "gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Item";
- private static final String class_GT_MetaPipeEntity_Frame = "gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Frame";
- private static final String class_GT_MetaPipeEntity_Fluid = "gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid";
+ public static final AutoMap<String> IC2_WRENCH_PATCH_CLASS_NAMES = new AutoMap<String>();
static {
mConfig = new AsmConfig(new File("config/GTplusplus/asm.cfg"));
- System.out.println("[GT++ ASM] Asm Config Location: "+mConfig.config.getConfigFile().getAbsolutePath());
- System.out.println("[GT++ ASM] Is DevHelper Valid? "+gtPlusPlus.preloader.DevHelper.mIsValidHelper);
+ Preloader_Logger.INFO("Config Location: "+AsmConfig.config.getConfigFile().getAbsolutePath());
+ Preloader_Logger.INFO("Is DevHelper Valid? "+DevHelper.mIsValidHelper);
+ IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_BASE_TILE_ENTITY);
+ IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_MACHINE1);
+ IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_MACHINE2);
+ IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_MACHINE3);
+ IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_KINETIC_GENERATOR);
+ IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_HEAT_GENERATOR);
+ IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_GENERATOR);
+ IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_REACTOR_ACCESS_HATCH);
+ IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_REACTOR_CHAMBER);
+ IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_REACTOR_FLUID_PORT);
+ IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_REACTOR_REDSTONE_PORT);
+ IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_REACTOR_VESSEL);
+ IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_PERSONAL);
+ IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_CHARGEPAD);
+ IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_ELECTRIC);
+ IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_LUMINATOR);
}
private static Boolean mObf = null;
@@ -65,89 +126,88 @@ public class Preloader_Transformer_Handler implements IClassTransformer {
* Only EntityLivingBase is left untouched, as nothing else truly needs to be calling this method and avoiding forge hooks.
* May exclude all vanilla/forge class if this causes issues though.
*/
- PatchForge : if (mConfig.enabledFixEntitySetHealth && !transformedName.contains("gtPlusPlus.preloader")) {
-
- //Skip Vanilla/Forge Classes
- if (transformedName.contains("net.minecraft.") || transformedName.contains("cpw.")) {
- //break PatchForge;
- }
-
- ClassTransformer_Forge_EntityLivingBase_SetHealth aForgeHealthFix = new ClassTransformer_Forge_EntityLivingBase_SetHealth(transformedName, basicClass);
- if (aForgeHealthFix.isValidTransformer() && aForgeHealthFix.didPatchClass()) {
- FMLRelaunchLog.log("[GT++ ASM] Fix EntityLivingBase.setHealth misuse", Level.INFO, "Transforming %s", transformedName);
- basicClass = aForgeHealthFix.getWriter().toByteArray();
- }
- }
+ /* PatchForge : if (AsmConfig.enabledFixEntitySetHealth && !transformedName.contains("gtPlusPlus.preloader")) {
+
+ //Skip Vanilla/Forge Classes
+ if (transformedName.contains("net.minecraft.") || transformedName.contains("cpw.")) {
+ //break PatchForge;
+ }
+
+ ClassTransformer_Forge_EntityLivingBase_SetHealth aForgeHealthFix = new ClassTransformer_Forge_EntityLivingBase_SetHealth(transformedName, basicClass);
+ if (aForgeHealthFix.isValidTransformer() && aForgeHealthFix.didPatchClass()) {
+ Preloader_Logger.INFO("Fix EntityLivingBase.setHealth misuse", "Transforming "+transformedName);
+ basicClass = aForgeHealthFix.getWriter().toByteArray();
+ }
+ }*/
// Is this environment obfuscated? (Extra checks just in case some weird shit happens during the check)
- boolean obfuscated = checkObfuscated();
- boolean probablyShouldBeFalse = false;
+ final boolean obfuscated = checkObfuscated();
// Fix LWJGL index array out of bounds on keybinding IDs
- if ((transformedName.equals("org.lwjgl.input.Keyboard") || transformedName.equals("bbj") || transformedName.equals("net.minecraft.client.settings.GameSettings")) && mConfig.enabledLwjglKeybindingFix) {
+ if ((transformedName.equals(LWJGL_KEYBOARD) || transformedName.equals(MINECRAFT_GAMESETTINGS_OBF) || transformedName.equals(MINECRAFT_GAMESETTINGS)) && AsmConfig.enabledLwjglKeybindingFix) {
boolean isClientSettingsClass = false;
if (!transformedName.equals("org.lwjgl.input.Keyboard")) {
isClientSettingsClass = true;
}
- FMLRelaunchLog.log("[GT++ ASM] LWJGL Keybinding index out of bounds fix", Level.INFO, "Transforming %s", transformedName);
+ Preloader_Logger.INFO("LWJGL Keybinding index out of bounds fix", "Transforming "+transformedName);
return new ClassTransformer_LWJGL_Keyboard(basicClass, isClientSettingsClass).getWriter().toByteArray();
}
//Enable mapping of Tickets and loaded chunks. - Forge
- if (transformedName.equals("net.minecraftforge.common.ForgeChunkManager") && mConfig.enableChunkDebugging) {
- FMLRelaunchLog.log("[GT++ ASM] Chunkloading Patch", Level.INFO, "Transforming %s", transformedName);
- return new ClassTransformer_Forge_ChunkLoading(basicClass, probablyShouldBeFalse).getWriter().toByteArray();
+ if (transformedName.equals(FORGE_CHUNK_MANAGER) && AsmConfig.enableChunkDebugging) {
+ Preloader_Logger.INFO("Chunkloading Patch", "Transforming "+transformedName);
+ return new ClassTransformer_Forge_ChunkLoading(basicClass, false).getWriter().toByteArray();
}
// Fix the OreDictionary - Forge
- if (transformedName.equals("net.minecraftforge.oredict.OreDictionary")) {
- FMLRelaunchLog.log("[GT++ ASM] OreDictTransformer", Level.INFO, "Transforming %s", transformedName);
+ if (transformedName.equals(FORGE_ORE_DICTIONARY) && AsmConfig.enableOreDictPatch) {
+ Preloader_Logger.INFO("OreDictTransformer", "Transforming "+transformedName);
ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
new ClassReader(basicClass).accept(new OreDictionaryVisitor(classWriter), 0);
return classWriter.toByteArray();
}
// Fix the OreDictionary COFH
- if (transformedName.equals("cofh.core.util.oredict.OreDictionaryArbiter") && (mConfig.enableCofhPatch || !obfuscated)) {
- FMLRelaunchLog.log("[GT++ ASM] COFH", Level.INFO, "Transforming %s", transformedName);
+ if (transformedName.equals(COFH_ORE_DICTIONARY_ARBITER) && (AsmConfig.enableCofhPatch || !obfuscated)) {
+ Preloader_Logger.INFO("COFH", "Transforming "+transformedName);
return new ClassTransformer_COFH_OreDictionaryArbiter(basicClass).getWriter().toByteArray();
}
// Fix Tinkers Fluids
- if (transformedName.equals("tconstruct.smeltery.blocks.TConstructFluid") && mConfig.enableTiConFluidLighting) {
- FMLRelaunchLog.log("[GT++ ASM] Bright Fluids", Level.INFO, "Transforming %s", transformedName);
+ if (transformedName.equals(TINKERS_FLUID_BLOCK) && AsmConfig.enableTiConFluidLighting) {
+ Preloader_Logger.INFO("Bright Fluids", "Transforming "+transformedName);
return new ClassTransformer_TiConFluids("getLightValue", obfuscated, basicClass).getWriter().toByteArray();
}
//Fix RC stuff
//Patching PROCESS_VOLUME to allow more transfer limits
- if (transformedName.equals("mods.railcraft.common.fluids.FluidHelper") && (mConfig.enableRcFlowFix && mConfig.maxRailcraftTankProcessVolume != 4000)) {
- FMLRelaunchLog.log("[GT++ ASM] Railcraft PROCESS_VOLUME Patch", Level.INFO, "Transforming %s", transformedName);
+ if (transformedName.equals(RAILCRAFT_FLUID_HELPER) && (AsmConfig.enableRcFlowFix && AsmConfig.maxRailcraftTankProcessVolume != 4000)) {
+ Preloader_Logger.INFO("Railcraft PROCESS_VOLUME Patch", "Transforming "+transformedName);
return new ClassTransformer_Railcraft_FluidHelper(basicClass, obfuscated).getWriter().toByteArray();
}
//Patching TRANSFER_RATE in Fluid Loaders/Unloaders
- if ((transformedName.equals("mods.railcraft.common.blocks.machine.gamma.TileFluidLoader") && mConfig.maxRailcraftFluidLoaderFlow != 20) || (transformedName.equals("mods.railcraft.common.blocks.machine.gamma.TileFluidUnloader") && mConfig.maxRailcraftFluidUnloaderFlow != 80)) {
- FMLRelaunchLog.log("[GT++ ASM] Railcraft TRANSFER_RATE Patch", Level.INFO, "Transforming %s", transformedName);
+ if ((transformedName.equals(RAILCRAFT_TILE_FLUID_LOADER) && AsmConfig.maxRailcraftFluidLoaderFlow != 20) || (transformedName.equals("mods.railcraft.common.blocks.machine.gamma.TileFluidUnloader") && AsmConfig.maxRailcraftFluidUnloaderFlow != 80)) {
+ Preloader_Logger.INFO("Railcraft TRANSFER_RATE Patch", "Transforming "+transformedName);
return new ClassTransformer_Railcraft_FluidCartHandling(basicClass, obfuscated, transformedName).getWriter().toByteArray();
}
//Fix Weird glitch involving negative itemstacks.
- if (transformedName.equals("mods.railcraft.common.util.inventory.InvTools") && mConfig.enableRcItemDupeFix) {
- FMLRelaunchLog.log("[GT++ ASM] Railcraft negative ItemStack Fix", Level.INFO, "Transforming %s", transformedName);
+ if (transformedName.equals(RAILCRAFT_INVENTORY_TOOLS) && AsmConfig.enableRcItemDupeFix) {
+ Preloader_Logger.INFO("Railcraft negative ItemStack Fix", "Transforming "+transformedName);
return new ClassTransformer_Railcraft_InvTools(basicClass, obfuscated).getWriter().toByteArray();
}
//Fix GC stuff
- if (mConfig.enableGcFuelChanges) {
- if (transformedName.equals("micdoodle8.mods.galacticraft.core.util.FluidUtil")) {
- FMLRelaunchLog.log("[GT++ ASM] Galacticraft FluidUtils Patch", Level.INFO, "Transforming %s", transformedName);
- return new ClassTransformer_GC_FluidUtil(basicClass, probablyShouldBeFalse).getWriter().toByteArray();
+ if (AsmConfig.enableGcFuelChanges) {
+ if (transformedName.equals(GALACTICRAFT_FLUID_UTILS)) {
+ Preloader_Logger.INFO("Galacticraft FluidUtils Patch", "Transforming "+transformedName);
+ return new ClassTransformer_GC_FluidUtil(basicClass, false).getWriter().toByteArray();
}
- if (transformedName.equals("micdoodle8.mods.galacticraft.core.tile.TileEntityFuelLoader")) {
- FMLRelaunchLog.log("[GT++ ASM] Galacticraft Fuel_Loader Patch", Level.INFO, "Transforming %s", transformedName);
- return new ClassTransformer_GC_FuelLoader(basicClass, probablyShouldBeFalse).getWriter().toByteArray();
+ if (transformedName.equals(GALACTICRAFT_TILE_ENTITY_FUEL_LOADER)) {
+ Preloader_Logger.INFO("Galacticraft Fuel_Loader Patch", "Transforming "+transformedName);
+ return new ClassTransformer_GC_FuelLoader(basicClass, false).getWriter().toByteArray();
}
- if (transformedName.equals("micdoodle8.mods.galacticraft.api.prefab.entity.EntityAutoRocket")) {
- FMLRelaunchLog.log("[GT++ ASM] Galacticraft EntityAutoRocket Patch", Level.INFO, "Transforming %s", transformedName);
- return new ClassTransformer_GC_EntityAutoRocket(basicClass, probablyShouldBeFalse).getWriter().toByteArray();
+ if (transformedName.equals(GALACTICRAFT_ENTITY_AUTO_ROCKET)) {
+ Preloader_Logger.INFO("Galacticraft EntityAutoRocket Patch", "Transforming "+transformedName);
+ return new ClassTransformer_GC_EntityAutoRocket(basicClass, false).getWriter().toByteArray();
}
}
@@ -161,42 +221,46 @@ public class Preloader_Transformer_Handler implements IClassTransformer {
*/
//Make GT_Utilities safer
- if (transformedName.equals("gtPlusPlus.preloader.asm.transformers.ClassTransformer_GT_Utility")) {
- FMLRelaunchLog.log("[GT++ ASM] Gregtech Utilities Patch", Level.INFO, "Transforming %s", transformedName);
+ if (transformedName.equals(GT_UTILITY)) {
+ Preloader_Logger.INFO("Gregtech Utilities Patch", "Transforming "+transformedName);
return new ClassTransformer_GT_Utility(basicClass, transformedName).getWriter().toByteArray();
}
//Inject Custom constructors for Busses
- if (transformedName.equals(ClassTransformer_GT_BusPatch.aInput) || transformedName.equals(ClassTransformer_GT_BusPatch.aOutput) || transformedName.equals(ClassTransformer_GT_BusPatch.aSuperInput) || transformedName.equals(ClassTransformer_GT_BusPatch.aSuperOutput)) {
- FMLRelaunchLog.log("[GT++ ASM] Gregtech Bus Patch", Level.INFO, "Transforming %s", transformedName);
+ if (transformedName.equals(GT_MTE_HATCH_INPUTBUS) || transformedName.equals(GT_MTE_HATCH_OUTPUTBUS) || transformedName.equals(GTPP_MTE_HATCH_SUPER_INPUT_BUS) || transformedName.equals(GTPP_MTE_HATCH_SUPER_OUTPUT_BUS)) {
+ Preloader_Logger.INFO("Gregtech Bus Patch", "Transforming "+transformedName);
return new ClassTransformer_GT_BusPatch(basicClass, transformedName).getWriter().toByteArray();
}
//Try patch achievements
- if (transformedName.equals("gregtech.loaders.misc.GT_Achievements")) {
- FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Transforming %s", transformedName);
+ if (transformedName.equals(GT_ACHIEVEMENTS)) {
+ Preloader_Logger.INFO("Gregtech Achievements Patch", "Transforming "+transformedName);
return new ClassTransformer_GT_Achievements_CrashFix(basicClass, obfuscated).getWriter().toByteArray();
}
//Fix bad handling of a loop left from original decompilation
//Also Fix Achievements, although currently disabled.
- if (transformedName.equals("gregtech.common.GT_Client")) {
- FMLRelaunchLog.log("[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO, "Transforming %s", transformedName);
+ if (transformedName.equals(GT_CLIENT_PROXY)) {
+ Preloader_Logger.INFO("Gregtech Client Proxy Patch", "Transforming "+transformedName);
return new ClassTransformer_GT_Client(basicClass, obfuscated).getByteArray();
}
//Make GT packets safer, fill them with debug info.
- if (transformedName.equals("gregtech.api.net.GT_Packet_TileEntity")) {
- FMLRelaunchLog.log("[GT++ ASM] Gregtech GT_Packet_TileEntity Patch", Level.INFO, "Transforming %s", transformedName);
+ if (transformedName.equals(GT_PACKET_TILE_ENTITY)) {
+ Preloader_Logger.INFO("Gregtech GT_Packet_TileEntity Patch", "Transforming "+transformedName);
return new ClassTransformer_GT_Packet_TileEntity(basicClass, obfuscated).getWriter().toByteArray();
}
//Make the setting of GT Tiles safer, so as not to crash the client.
- if (transformedName.equals("gregtech.api.metatileentity.BaseMetaTileEntity")) {
- FMLRelaunchLog.log("[GT++ ASM] Gregtech setMetaTileEntity Patch", Level.INFO, "Transforming %s", transformedName);
+ if (transformedName.equals(GT_BASE_META_TILE_ENTITY)) {
+ Preloader_Logger.INFO("Gregtech setMetaTileEntity Patch", "Transforming "+transformedName);
return new ClassTransformer_GT_BaseMetaTileEntity(basicClass).getWriter().toByteArray();
}
-
+ //Add extra tools if we're in a dev environment.
+ if (transformedName.equals(GT_METAGENERATED_TOOL) && CORE_Preloader.DEV_ENVIRONMENT) {
+ Preloader_Logger.INFO("Gregtech Additional Tools Patch", "Transforming "+transformedName);
+ return new ClassTransformer_GT_MetaGenerated_Tool(basicClass).getWriter().toByteArray();
+ }
//Fix log handling on the charcoal pit
- if (transformedName.equals("gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_Charcoal_Pit") && mConfig.enableGtCharcoalPitFix) {
- FMLRelaunchLog.log("[GT++ ASM] GT Charcoal Pit Fix", Level.INFO, "Transforming %s", transformedName);
+ if (transformedName.equals(GT_MTE_CHARCOAL_PIT) && AsmConfig.enableGtCharcoalPitFix) {
+ Preloader_Logger.INFO("GT Charcoal Pit Fix", "Transforming "+transformedName);
return new ClassTransformer_GT_CharcoalPit(basicClass, obfuscated).getWriter().toByteArray();
}
@@ -204,71 +268,53 @@ public class Preloader_Transformer_Handler implements IClassTransformer {
//Patching Meta Tile Tooltips
- if (transformedName.equals("gregtech.common.blocks.GT_Item_Machines") && mConfig.enableGtTooltipFix) {
- FMLRelaunchLog.log("[GT++ ASM] Gregtech Tooltip Patch", Level.INFO, "Transforming %s", transformedName);
- return new ClassTransformer_GT_ItemMachines_Tooltip(basicClass, probablyShouldBeFalse).getWriter().toByteArray();
+ if (transformedName.equals(GT_ITEM_MACHINES) && AsmConfig.enableGtTooltipFix) {
+ Preloader_Logger.INFO("Gregtech Tooltip Patch", "Transforming "+transformedName);
+ return new ClassTransformer_GT_ItemMachines_Tooltip(basicClass, false).getWriter().toByteArray();
}
- if (transformedName.equals(class_Block_Machines)) {
+ if (transformedName.equals(GT_BLOCK_MACHINES)) {
//Fix GT NBT Persistency issue
- FMLRelaunchLog.log("[GT++ ASM] Gregtech NBT Persistency Patch", Level.INFO, "Transforming %s", transformedName);
- byte[] g = new ClassTransformer_GT_BlockMachines_NBT(basicClass, probablyShouldBeFalse).getWriter().toByteArray();
- FMLRelaunchLog.log("[GT++ ASM] Gregtech getTileEntityBaseType Patch", Level.INFO, "Transforming %s", transformedName);
- return new ClassTransformer_GT_BlockMachines_MetaPipeEntity(g, probablyShouldBeFalse, 0).getWriter().toByteArray();
+ Preloader_Logger.INFO("Gregtech NBT Persistency Patch", "Transforming "+transformedName);
+ byte[] g = new ClassTransformer_GT_BlockMachines_NBT(basicClass, false).getWriter().toByteArray();
+ Preloader_Logger.INFO("Gregtech getTileEntityBaseType Patch", "Transforming "+transformedName);
+ return new ClassTransformer_GT_BlockMachines_MetaPipeEntity(g, 0).getWriter().toByteArray();
}
- if (transformedName.equals(class_GT_MetaPipeEntity_Item) || transformedName.equals(class_GT_MetaPipeEntity_Frame) || transformedName.equals(class_GT_MetaPipeEntity_Fluid)) {
- FMLRelaunchLog.log("[GT++ ASM] Gregtech getTileEntityBaseType Patch", Level.INFO, "Transforming %s", transformedName);
+ if (transformedName.equals(GT_METAPIPE_ITEM) || transformedName.equals(GT_METAPIPE_FRAME) || transformedName.equals(GT_METAPIPE_FLUID)) {
+ Preloader_Logger.INFO("Gregtech getTileEntityBaseType Patch", "Transforming "+transformedName);
int mode = 0;
- if (transformedName.equals(class_GT_MetaPipeEntity_Item)) {
+ if (transformedName.equals(GT_METAPIPE_ITEM)) {
mode = 1;
}
- else if (transformedName.equals(class_GT_MetaPipeEntity_Frame)) {
+ else if (transformedName.equals(GT_METAPIPE_FRAME)) {
mode = 2;
}
else {
mode = 3;
}
- return new ClassTransformer_GT_BlockMachines_MetaPipeEntity(basicClass, probablyShouldBeFalse, mode).getWriter().toByteArray();
+ return new ClassTransformer_GT_BlockMachines_MetaPipeEntity(basicClass, mode).getWriter().toByteArray();
}
- String[] aIC2ClassNames = new String[] {
- "ic2.core.block.BlockTileEntity",
- "ic2.core.block.machine.BlockMachine",
- "ic2.core.block.machine.BlockMachine2",
- "ic2.core.block.machine.BlockMachine3",
- "ic2.core.block.kineticgenerator.block.BlockKineticGenerator",
- "ic2.core.block.heatgenerator.block.BlockHeatGenerator",
- "ic2.core.block.generator.block.BlockGenerator",
- "ic2.core.block.reactor.block.BlockReactorAccessHatch",
- "ic2.core.block.reactor.block.BlockReactorChamber",
- "ic2.core.block.reactor.block.BlockReactorFluidPort",
- "ic2.core.block.reactor.block.BlockReactorRedstonePort",
- "ic2.core.block.reactor.block.BlockReactorVessel",
- "ic2.core.block.personal.BlockPersonal.class",
- "ic2.core.block.wiring.BlockChargepad.class",
- "ic2.core.block.wiring.BlockElectric.class",
- "ic2.core.block.wiring.BlockLuminator.class",
- };
-
- //Fix IC2 Shit
- for (String y : aIC2ClassNames) {
+
+ //Fix IC2 Wrench Harvesting
+ for (String y : IC2_WRENCH_PATCH_CLASS_NAMES) {
if (transformedName.equals(y)) {
- FMLRelaunchLog.log("[GT++ ASM] IC2 getHarvestTool Patch", Level.INFO, "Transforming %s", transformedName);
+ Preloader_Logger.INFO("IC2 getHarvestTool Patch", "Transforming "+transformedName);
return new ClassTransformer_IC2_GetHarvestTool(basicClass, obfuscated, transformedName).getWriter().toByteArray();
}
}
//Fix IC2 Hazmat
- if (transformedName.equals("ic2.core.item.armor.ItemArmorHazmat")) {
- FMLRelaunchLog.log("[GT++ ASM] IC2 Hazmat Patch", Level.INFO, "Transforming %s", transformedName);
+ if (transformedName.equals(IC2_ITEM_ARMOUR_HAZMAT)) {
+ Preloader_Logger.INFO("IC2 Hazmat Patch", "Transforming "+transformedName);
return new ClassTransformer_IC2_Hazmat(basicClass, transformedName).getWriter().toByteArray();
}
//Fix Thaumcraft Shit
//Patching ItemWispEssence to allow invalid item handling
- if (transformedName.equals("thaumcraft.common.items.ItemWispEssence") && mConfig.enableTcAspectSafety) {
- FMLRelaunchLog.log("[GT++ ASM] Thaumcraft WispEssence_Patch", Level.INFO, "Transforming %s", transformedName);
+ if (transformedName.equals(THAUMCRAFT_ITEM_WISP_ESSENCE) && AsmConfig.enableTcAspectSafety) {
+ Preloader_Logger.INFO("Thaumcraft WispEssence_Patch", "Transforming "+transformedName);
return new ClassTransformer_TC_ItemWispEssence(basicClass, obfuscated).getWriter().toByteArray();
}
diff --git a/src/Java/gtPlusPlus/xmod/bartcrops/abstracts/BaseAestheticCrop.java b/src/Java/gtPlusPlus/xmod/bartcrops/abstracts/BaseAestheticCrop.java
index cddce7beb4..f62b429acb 100644
--- a/src/Java/gtPlusPlus/xmod/bartcrops/abstracts/BaseAestheticCrop.java
+++ b/src/Java/gtPlusPlus/xmod/bartcrops/abstracts/BaseAestheticCrop.java
@@ -1,6 +1,6 @@
package gtPlusPlus.xmod.bartcrops.abstracts;
-import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.preloader.CORE_Preloader;
import ic2.api.crops.ICropTile;
public abstract class BaseAestheticCrop extends BaseHarvestableCrop {
@@ -27,7 +27,7 @@ public abstract class BaseAestheticCrop extends BaseHarvestableCrop {
}
public int growthDuration(ICropTile crop) {
- return CORE.DEBUG ? 1 : 225;
+ return CORE_Preloader.DEBUG_MODE ? 1 : 225;
}
public byte getSizeAfterHarvest(ICropTile crop) {
diff --git a/src/Java/gtPlusPlus/xmod/bartcrops/abstracts/BaseHarvestableCrop.java b/src/Java/gtPlusPlus/xmod/bartcrops/abstracts/BaseHarvestableCrop.java
index fee6cf654c..e877233c67 100644
--- a/src/Java/gtPlusPlus/xmod/bartcrops/abstracts/BaseHarvestableCrop.java
+++ b/src/Java/gtPlusPlus/xmod/bartcrops/abstracts/BaseHarvestableCrop.java
@@ -1,6 +1,6 @@
package gtPlusPlus.xmod.bartcrops.abstracts;
-import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.preloader.CORE_Preloader;
import ic2.api.crops.ICropTile;
public abstract class BaseHarvestableCrop extends BaseCrop {
@@ -44,7 +44,7 @@ public abstract class BaseHarvestableCrop extends BaseCrop {
public int growthDuration(ICropTile crop) {
short r;
- if (CORE.DEBUG) {
+ if (CORE_Preloader.DEBUG_MODE) {
r = 1;
} else if (crop.getSize() == 2) {
r = 200;
diff --git a/src/Java/gtPlusPlus/xmod/bartcrops/crops/Crop_Hemp.java b/src/Java/gtPlusPlus/xmod/bartcrops/crops/Crop_Hemp.java
index a921182d66..95e2766aae 100644
--- a/src/Java/gtPlusPlus/xmod/bartcrops/crops/Crop_Hemp.java
+++ b/src/Java/gtPlusPlus/xmod/bartcrops/crops/Crop_Hemp.java
@@ -1,9 +1,9 @@
package gtPlusPlus.xmod.bartcrops.crops;
import gtPlusPlus.core.item.ModItems;
-import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.preloader.CORE_Preloader;
import gtPlusPlus.xmod.bartcrops.abstracts.BaseAestheticCrop;
import ic2.api.crops.ICropTile;
import net.minecraft.item.ItemStack;
@@ -29,7 +29,7 @@ public class Crop_Hemp extends BaseAestheticCrop {
ret = 225;
}*/
- if (CORE.DEBUG) {
+ if (CORE_Preloader.DEBUG_MODE) {
ret = 1;
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java
index 663804bc81..1cb499479f 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java
@@ -23,7 +23,9 @@ import gtPlusPlus.api.helpers.GregtechPlusPlus_API.Multiblock_API;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.api.objects.data.Pair;
+import gtPlusPlus.api.objects.minecraft.multi.NoEUBonusMultiBehaviour;
import gtPlusPlus.api.objects.minecraft.multi.NoOutputBonusMultiBehaviour;
+import gtPlusPlus.api.objects.minecraft.multi.NoSpeedBonusMultiBehaviour;
import gtPlusPlus.australia.gen.gt.WorldGen_GT_Australia;
import gtPlusPlus.core.handler.COMPAT_HANDLER;
import gtPlusPlus.core.handler.OldCircuitHandler;
@@ -37,6 +39,7 @@ import gtPlusPlus.core.util.minecraft.RecipeUtils;
import gtPlusPlus.core.util.reflect.AddGregtechRecipe;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
import gtPlusPlus.everglades.gen.gt.WorldGen_GT;
+import gtPlusPlus.xmod.gregtech.api.enums.CustomOrePrefix;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials;
import gtPlusPlus.xmod.gregtech.api.util.GTPP_Config;
import gtPlusPlus.xmod.gregtech.api.world.GTPP_Worldgen;
@@ -78,8 +81,7 @@ public class HANDLER_GT {
OldCircuitHandler.preInit();
}
- GregtechFluidHandler.run();
-
+ GregtechFluidHandler.run();
}
public static void init(){
@@ -131,6 +133,8 @@ public class HANDLER_GT {
// Register the No-Bonus Special Behaviour.
Multiblock_API.registerSpecialMultiBehaviour(new NoOutputBonusMultiBehaviour());
+ Multiblock_API.registerSpecialMultiBehaviour(new NoSpeedBonusMultiBehaviour());
+ Multiblock_API.registerSpecialMultiBehaviour(new NoEUBonusMultiBehaviour());
//Register some custom recipe maps for any enabled multiblocks.
//MultiblockRecipeMapHandler.run();
@@ -149,6 +153,13 @@ public class HANDLER_GT {
WoodCentrifuging.processLogsForMethane();
}
+ public static void addNewOrePrefixes() {
+ for (CustomOrePrefix aPrefixTest : CustomOrePrefix.values()) {
+ Logger.INFO("Adding "+aPrefixTest.name()+" to OrePrefixes Enum.");
+ Logger.INFO("Injecting: "+aPrefixTest.addToEnum());
+ }
+ }
+
private static void convertPyroToCokeOven() {
if (ReflectionUtils.doesFieldExist(GT_Recipe.GT_Recipe_Map.class, "sPyrolyseRecipes")) {
int aCount = 0;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomOrePrefix.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomOrePrefix.java
new file mode 100644
index 0000000000..9647b00578
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomOrePrefix.java
@@ -0,0 +1,112 @@
+package gtPlusPlus.xmod.gregtech.api.enums;
+
+import static gregtech.api.enums.GT_Values.B;
+
+import gregtech.api.enums.OrePrefixes;
+import net.minecraftforge.common.util.EnumHelper;
+
+public enum CustomOrePrefix {
+
+ milled("Milled Ores", "Milled ", " Ore", true, true, false, false, false, false, false, false, false, true, B[3], -1, 64, -1);
+
+ private final String mRegularLocalName;
+ private final String mLocalizedMaterialPre;
+ private final String mLocalizedMaterialPost;
+ private final boolean mIsUnificatable;
+ private final boolean mIsMaterialBased;
+ private final boolean mIsSelfReferencing;
+ private final boolean mIsContainer;
+ private final boolean mDontUnificateActively;
+ private final boolean mIsUsedForBlocks;
+ private final boolean mAllowNormalRecycling;
+ private final boolean mGenerateDefaultItem;
+ private final boolean mIsEnchantable;
+ private final boolean mIsUsedForOreProcessing;
+ private final int mMaterialGenerationBits;
+ private final long mMaterialAmount;
+ private final int mDefaultStackSize;
+ private final int mTextureindex;
+
+ private OrePrefixes mSelfReference;
+
+ private CustomOrePrefix(
+ String aRegularLocalName,
+ String aLocalizedMaterialPre,
+ String aLocalizedMaterialPost,
+ boolean aIsUnificatable,
+ boolean aIsMaterialBased,
+ boolean aIsSelfReferencing,
+ boolean aIsContainer,
+ boolean aDontUnificateActively,
+ boolean aIsUsedForBlocks,
+ boolean aAllowNormalRecycling,
+ boolean aGenerateDefaultItem,
+ boolean aIsEnchantable,
+ boolean aIsUsedForOreProcessing,
+ int aMaterialGenerationBits,
+ long aMaterialAmount,
+ int aDefaultStackSize,
+ int aTextureindex) {
+
+ mRegularLocalName = aRegularLocalName;
+ mLocalizedMaterialPre = aLocalizedMaterialPre;
+ mLocalizedMaterialPost = aLocalizedMaterialPost;
+ mIsUnificatable = aIsUnificatable;
+ mIsMaterialBased = aIsMaterialBased;
+ mIsSelfReferencing = aIsSelfReferencing;
+ mIsContainer = aIsContainer;
+ mDontUnificateActively = aDontUnificateActively;
+ mIsUsedForBlocks = aIsUsedForBlocks;
+ mAllowNormalRecycling = aAllowNormalRecycling;
+ mGenerateDefaultItem = aGenerateDefaultItem;
+ mIsEnchantable = aIsEnchantable;
+ mIsUsedForOreProcessing = aIsUsedForOreProcessing;
+ mMaterialGenerationBits = aMaterialGenerationBits;
+ mMaterialAmount = aMaterialAmount;
+ mDefaultStackSize = aDefaultStackSize;
+ mTextureindex = aTextureindex;
+
+ }
+
+ public final boolean addToEnum() {
+
+ mSelfReference = EnumHelper.addEnum(OrePrefixes.class, this.name(),
+ new Class[] {
+ String.class,
+ String.class, String.class, boolean.class,
+ boolean.class, boolean.class, boolean.class,
+ boolean.class, boolean.class, boolean.class,
+ boolean.class, boolean.class, boolean.class,
+ int.class, long.class, int.class, int.class
+ },
+ new Object[] {
+ mRegularLocalName,
+ mLocalizedMaterialPre,
+ mLocalizedMaterialPost,
+ mIsUnificatable,
+ mIsMaterialBased,
+ mIsSelfReferencing,
+ mIsContainer,
+ mDontUnificateActively,
+ mIsUsedForBlocks,
+ mAllowNormalRecycling,
+ mGenerateDefaultItem,
+ mIsEnchantable,
+ mIsUsedForOreProcessing,
+ mMaterialGenerationBits,
+ mMaterialAmount,
+ mDefaultStackSize,
+ mTextureindex});
+
+ return mSelfReference != null;
+ }
+
+ public static final boolean checkEntryWasAdded(CustomOrePrefix aCustomPrefixObject) {
+ return aCustomPrefixObject.mSelfReference != null;
+ }
+
+ public OrePrefixes get() {
+ return mSelfReference;
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java
index cd4b0947e4..504533c406 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java
@@ -2,13 +2,14 @@ package gtPlusPlus.xmod.gregtech.api.enums;
import static gregtech.api.enums.GT_Values.W;
-import gregtech.api.util.*;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.api.util.GT_Utility;
import gtPlusPlus.xmod.gregtech.api.interfaces.GregtechItemContainer;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraftforge.fluids.Fluid;
/**
* Class containing all non-OreDict Items of GregTech.
@@ -130,6 +131,19 @@ public enum GregtechItemList implements GregtechItemContainer {
Farm_Processor_ZPM,
Farm_Processor_UV,
+ // Upgrade chip for Distillus
+ Distillus_Upgrade_Chip,
+
+
+ // Chips used to nerf my multis via custom behavioural attachments
+ Chip_MultiNerf_NoOutputBonus,
+ Chip_MultiNerf_NoSpeedBonus,
+ Chip_MultiNerf_NoEuBonus,
+
+ // Milling Balls
+ Milling_Ball_Alumina,
+ Milling_Ball_Soapstone,
+
//----------------------------------------------------------------------------
@@ -308,7 +322,9 @@ public enum GregtechItemList implements GregtechItemContainer {
Machine_Adv_ImplosionCompressor,
Machine_Adv_DistillationTower,
-
+ //Advanced Assembly Line
+ Machine_Adv_AssemblyLine,
+
//Advanced Vacuum Freezer
Industrial_Cryogenic_Freezer,
Casing_AdvancedVacuum,
@@ -343,7 +359,9 @@ public enum GregtechItemList implements GregtechItemContainer {
//Larger Turbines
Large_Steam_Turbine, Large_HPSteam_Turbine,
- Casing_Turbine_Shaft, Casing_Turbine_LP, Casing_Turbine_HP,
+ Casing_Turbine_Shaft,
+ Casing_Turbine_LP, Casing_Turbine_HP,
+ Casing_Turbine_Gas, Casing_Turbine_Plasma,
//Large Vacuum Furnace
Casing_Vacuum_Furnace,
@@ -352,6 +370,15 @@ public enum GregtechItemList implements GregtechItemContainer {
// Large Rocket Engine
Casing_RocketEngine,
Controller_RocketEngine,
+
+ // Large Semi-Fluid
+ Controller_LargeSemifluidGenerator,
+
+ // IsaMill
+ Controller_IsaMill_Controller,
+ Casing_IsaMill_Casing,
+ Casing_IsaMill_Gearbox,
+ Casing_IsaMill_Pipe,
//----------------------------------------------------------------------------
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SteamCondenser.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SteamCondenser.java
index f472fc9edb..e3f2f9d41b 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SteamCondenser.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SteamCondenser.java
@@ -1,11 +1,10 @@
package gtPlusPlus.xmod.gregtech.api.gui;
-import net.minecraft.entity.player.InventoryPlayer;
-
import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-
import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.preloader.CORE_Preloader;
+import net.minecraft.entity.player.InventoryPlayer;
public class GUI_SteamCondenser extends GT_GUIContainerMetaTile_Machine
{
@@ -20,7 +19,7 @@ public class GUI_SteamCondenser extends GT_GUIContainerMetaTile_Machine
protected void drawGuiContainerForegroundLayer(final int par1, final int par2)
{
this.fontRendererObj.drawString("Condenser", 8, 4, 4210752);
- if (CORE.DEBUG){
+ if (CORE_Preloader.DEBUG_MODE){
this.tickTime = ((CONTAINER_SteamCondenser)this.mContainer).mTickingTime;
this.fontRendererObj.drawString("Tick Time: "+this.tickTime, 8, 12, 4210752);
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java
index cb889e0233..688433b3ac 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java
@@ -1,5 +1,7 @@
package gtPlusPlus.xmod.gregtech.api.interfaces.internal;
+import gregtech.api.enums.Materials;
+import gtPlusPlus.core.material.Material;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
@@ -272,6 +274,7 @@ public interface IGregtech_RecipeAdder {
public boolean addIrLaserRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput, int time, long eu);
public boolean addChemicalPlantRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int time, long eu, int aTier);
+ public boolean addChemicalPlantRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int[] aChances, int time, long eu, int aTier);
public boolean addBlastRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int time, long eu, int aHeat);
@@ -282,6 +285,9 @@ public interface IGregtech_RecipeAdder {
public boolean addDistilleryRecipe(ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, ItemStack aSolidOutput, int aDuration, int aEUt, boolean aHidden);
public boolean addPulverisationRecipe(final ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, final ItemStack aOutput3);
+
+ public boolean addMillingRecipe(Materials aMat, int aEU);
+ public boolean addMillingRecipe(Material aMat, int aEU);
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
index ef5429af62..ea14320f93 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
@@ -16,7 +16,6 @@ import org.apache.commons.lang3.ArrayUtils;
import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.Materials;
-import gregtech.api.enums.TAE;
import gregtech.api.gui.GT_Container_MultiMachine;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
@@ -56,6 +55,7 @@ import gtPlusPlus.core.recipe.common.CI;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.preloader.CORE_Preloader;
import gtPlusPlus.preloader.asm.AsmConfig;
import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine;
import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine_NoPlayerInventory;
@@ -90,7 +90,7 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult
Logger.MACHINE_INFO("Found .08 findRecipe method? "+(a08 != null));
Logger.MACHINE_INFO("Found .09 findRecipe method? "+(a09 != null));
- if (CORE.DEBUG) {
+ if (CORE_Preloader.DEBUG_MODE) {
aLogger = ReflectionUtils.getMethod(Logger.class, "INFO", String.class);
}
else {
@@ -2213,7 +2213,7 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult
}
}
- return super.addDynamoToMachineList(aTileEntity, aBaseCasingIndex);
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
}
@@ -2536,9 +2536,10 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult
boolean isHatch = false;
if (aBaseMetaTileEntity != null) {
- if (aCasingID < 64) {
+ // Unsure why this check exists?
+ /*if (aCasingID < 64) {
aCasingID = TAE.GTPP_INDEX(aCasingID);
- }
+ }*/
isHatch = this.addToMachineList(aBaseMetaTileEntity, aCasingID);
if (isHatch) {
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
index ef013fa3a2..76100df0de 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
@@ -15,6 +15,7 @@ import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
+import gregtech.api.enums.TAE;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.BaseMetaTileEntity;
import gregtech.api.util.GT_LanguageManager;
@@ -118,7 +119,10 @@ public class Meta_GT_Proxy {
public static void postInit() {
mAssemblyAchievements = new AchievementHandler();
- fixIC2FluidNames();
+ fixIC2FluidNames();
+
+ // Finalise TAE
+ TAE.finalizeTAE();
}
@SuppressWarnings("deprecation")
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java
index cd4c3fe7d2..c4b2e4f738 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java
@@ -23,7 +23,10 @@ extends GregtechMetaCasingBlocksAbstract {
public GregtechMetaCasingBlocks() {
super(GregtechMetaCasingItems.class, "miscutils.blockcasings", GT_Material_Casings.INSTANCE);
for (byte i = 0; i < 16; i = (byte) (i + 1)) {
- TAE.registerTextures(new GT_CopiedBlockTexture(this, 6, i));
+ if (i == 2 || i == 3 || i == 4) {
+ continue;
+ }
+ TAE.registerTexture(0, i, new GT_CopiedBlockTexture(this, 6, i));
}
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Centrifuge Casing");
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Structural Coke Oven Casing");
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java
index 528aed2029..596643e06c 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java
@@ -32,7 +32,7 @@ extends GregtechMetaCasingBlocksAbstract {
public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) {
int meta = aStack.getItemDamage();
int tier = GregtechMetaTileEntity_PowerSubStationController.getCellTier(field_150939_a, meta);
- if (tier > 0) {
+ if (meta == 7 && tier > 0) {
long capacity = GregtechMetaTileEntity_PowerSubStationController.getCapacityFromCellTier(tier);
aList.add("Energy Storage: " + GT_Utility.formatNumbers(capacity));
}
@@ -43,7 +43,10 @@ extends GregtechMetaCasingBlocksAbstract {
public GregtechMetaCasingBlocks2() {
super(GregtechMetaCasingItemBlocks2.class, "gtplusplus.blockcasings.2", GT_Material_Casings.INSTANCE);
for (byte i = 0; i < 16; i = (byte) (i + 1)) {
- TAE.registerTextures(new GT_CopiedBlockTexture(this, 6, i));
+ if (i == 4 || i == 10 || i == 11 || i == 12 || i == 14) {
+ continue;
+ }
+ TAE.registerTexture(1, i, new GT_CopiedBlockTexture(this, 6, i));
}
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Thermal Processing Casing");
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Hastelloy-N Sealant Block");
@@ -59,7 +62,7 @@ extends GregtechMetaCasingBlocksAbstract {
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Thermal Containment Casing");
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", "Autocrafter Frame");
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", "Cutting Factory Frame");
- GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", "Tesla Containment Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", ""); // Unused
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", "Sterile Farm Casing"); //Tree Farmer Textures
GregtechItemList.Casing_ThermalCentrifuge.set(new ItemStack(this, 1, 0));
GregtechItemList.Casing_Refinery_External.set(new ItemStack(this, 1, 1));
@@ -75,7 +78,7 @@ extends GregtechMetaCasingBlocksAbstract {
GregtechItemList.Casing_ThermalContainment.set(new ItemStack(this, 1, 11));
GregtechItemList.Casing_Autocrafter.set(new ItemStack(this, 1, 12));
GregtechItemList.Casing_CuttingFactoryFrame.set(new ItemStack(this, 1, 13));
- GregtechItemList.Casing_TeslaTower.set(new ItemStack(this, 1, 14));
+ //GregtechItemList.Casing_TeslaTower.set(new ItemStack(this, 1, 14));
GregtechItemList.Casing_PLACEHOLDER_TreeFarmer.set(new ItemStack(this, 1, 15)); //Tree Farmer Textures
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java
index 8e6a55c9c5..8cd6dd0ca8 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java
@@ -1,27 +1,23 @@
package gtPlusPlus.xmod.gregtech.common.blocks;
-import gregtech.api.util.GT_Utility;
-import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.storage.GregtechMetaTileEntity_PowerSubStationController;
-import net.minecraft.block.Block;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.IIcon;
-import net.minecraft.world.IBlockAccess;
+import java.util.List;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.enums.TAE;
-import gregtech.api.enums.Textures;
import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_Utility;
import gregtech.common.blocks.GT_Material_Casings;
-
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.CasingTextureHandler3;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
-
-import java.util.List;
-
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.storage.GregtechMetaTileEntity_PowerSubStationController;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
public class GregtechMetaCasingBlocks3
extends GregtechMetaCasingBlocksAbstract {
@@ -50,7 +46,7 @@ extends GregtechMetaCasingBlocksAbstract {
public GregtechMetaCasingBlocks3() {
super(GregtechMetaCasingItemBlocks3.class, "gtplusplus.blockcasings.3", GT_Material_Casings.INSTANCE);
for (byte i = 0; i < 16; i = (byte) (i + 1)) {
- TAE.registerTextures(new GT_CopiedBlockTexture(this, 6, i));
+ TAE.registerTexture(2, i, new GT_CopiedBlockTexture(this, 6, i));
}
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Aquatic Casing");
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Inconel Reinforced Casing");
@@ -66,7 +62,7 @@ extends GregtechMetaCasingBlocksAbstract {
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Volcanus Casing");
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", "Fusion Machine Casing MK III");
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", "Advanced Fusion Coil");
- GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", "Unnamed");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", "Unnamed"); // Can Use, don't change texture (Used for Fusion MK4)
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", "Containment Casing");
GregtechItemList.Casing_FishPond.set(new ItemStack(this, 1, 0));
GregtechItemList.Casing_Extruder.set(new ItemStack(this, 1, 1));
@@ -365,28 +361,6 @@ extends GregtechMetaCasingBlocksAbstract {
}
return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon();
}
- switch (tMeta) {
- case 9 : {
- return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon();
- }
- case 10 : {
- return Textures.BlockIcons.MACHINE_CASING_CLEAN_STAINLESSSTEEL.getIcon();
- }
- case 11 : {
- return Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon();
- }
- case 12 : {
- return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
- }
- case 14 : {
- return TexturesGtBlock.TEXTURE_CASING_FUSION_CASING_ULTRA.getIcon();
- }
- case 15 : {
- return TexturesGtBlock.TEXTURE_MAGIC_PANEL_A.getIcon();
- }
- default : {
- return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon();
- }
- }
+ return CasingTextureHandler3.getIcon(aSide, tMeta);
}
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java
index b624649789..a357bd9103 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java
@@ -22,40 +22,33 @@ extends GregtechMetaCasingBlocksAbstract {
public GregtechMetaCasingBlocks4() {
super(GregtechMetaCasingItems.class, "gtplusplus.blockcasings.4", GT_Material_Casings.INSTANCE);
for (byte i = 0; i < 16; i = (byte) (i + 1)) {
- TAE.registerTextures(new GT_CopiedBlockTexture(this, 6, i));
+ if (i == 2 || i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 9 || i == 12 || i == 13 || i == 14 || i == 15) {
+ continue;
+ }
+ TAE.registerTexture(3, i, new GT_CopiedBlockTexture(this, 6, i));
}
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Naquadah Reactor Base"); //48
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Reactor Piping");
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Naquadah Containment Chamber");
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Tempered Arc Furnace Casing");
- GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Structural Solar Casing");
- GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Salt Containment Casing");
- GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Thermal Containment Casing");
- GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Turbine Shaft");
- GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Low Pressure Turbine Casing");
- GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "High Pressure Turbine Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", ""); // Unused
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "Vacuum Casing");
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Turbodyne Casing");
- GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", "");
- GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", "");
- GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", "");
- GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", " ");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", ""); // Unused
GregtechItemList.Casing_Naq_Reactor_A.set(new ItemStack(this, 1, 0));
GregtechItemList.Casing_Naq_Reactor_B.set(new ItemStack(this, 1, 1));
GregtechItemList.Casing_Naq_Reactor_C.set(new ItemStack(this, 1, 2));
GregtechItemList.Casing_Industrial_Arc_Furnace.set(new ItemStack(this, 1, 3));
- GregtechItemList.Casing_SolarTower_Structural.set(new ItemStack(this, 1, 4));
- GregtechItemList.Casing_SolarTower_SaltContainment.set(new ItemStack(this, 1, 5));
- GregtechItemList.Casing_SolarTower_HeatContainment.set(new ItemStack(this, 1, 6));
- GregtechItemList.Casing_Turbine_Shaft.set(new ItemStack(this, 1, 7));
- GregtechItemList.Casing_Turbine_LP.set(new ItemStack(this, 1, 8));
- GregtechItemList.Casing_Turbine_HP.set(new ItemStack(this, 1, 9));
GregtechItemList.Casing_Vacuum_Furnace.set(new ItemStack(this, 1, 10));
GregtechItemList.Casing_RocketEngine.set(new ItemStack(this, 1, 11));
- /*GregtechItemList.Casing_Autocrafter.set(new ItemStack(this, 1, 12));
- GregtechItemList.Casing_CuttingFactoryFrame.set(new ItemStack(this, 1, 13));
- GregtechItemList.Casing_TeslaTower.set(new ItemStack(this, 1, 14));
- GregtechItemList.Casing_PLACEHOLDER_TreeFarmer.set(new ItemStack(this, 1, 15));*/
}
private static final LargeTurbineTextureHandler mTurbineTextures = new LargeTurbineTextureHandler();
@@ -76,67 +69,43 @@ extends GregtechMetaCasingBlocksAbstract {
//Texture ID's. case 0 == ID[57]
if ((aMeta >= 0) && (aMeta < 16)) {
switch (aMeta) {
- //Centrifuge
case 0:
return TexturesGtBlock.Casing_Trinium_Titanium.getIcon();
- //Coke Oven Frame
case 1:
return TexturesGtBlock.TEXTURE_TECH_C.getIcon();
- //Coke Oven Casing Tier 1
case 2:
return TexturesGtBlock.TEXTURE_ORGANIC_PANEL_A_GLOWING.getIcon();
- //Coke Oven Casing Tier 2
case 3:
return TexturesGtBlock.TEXTURE_METAL_PANEL_A.getIcon();
- //Material Press Casings
case 4:
- return TexturesGtBlock.Casing_Material_MaragingSteel.getIcon();
- //Sifter Structural
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
case 5:
- return TexturesGtBlock.Casing_Material_Stellite.getIcon();
- //Sifter Sieve
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
case 6:
- return TexturesGtBlock.Casing_Machine_Simple_Top.getIcon();
-
-
- //Vanadium Radox Battery
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
case 7:
- return TexturesGtBlock.Casing_Redox_1.getIcon();
- //Power Sub-Station Casing
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
case 8:
- return TexturesGtBlock.Casing_Machine_Simple_Top.getIcon();
- //Cyclotron Coil
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
case 9:
- return TexturesGtBlock.Casing_Material_MaragingSteel.getIcon();
-
-
- //Cyclotron External Casing
- case 10:
-
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ case 10:
if (aSide <2) {
return TexturesGtBlock.TEXTURE_STONE_RED_B.getIcon();
}
else {
return TexturesGtBlock.TEXTURE_STONE_RED_A.getIcon();
}
-
- //Multitank Exterior Casing
case 11:
return TexturesGtBlock.TEXTURE_CASING_ROCKETDYNE.getIcon();
- //Reactor Casing I
case 12:
- return TexturesGtBlock.Casing_Machine_Simple_Top.getIcon();
- //Reactor Casing II
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
case 13:
- if (aSide <2) {
- return TexturesGtBlock.TEXTURE_TECH_A.getIcon();
- }
- else {
- return TexturesGtBlock.TEXTURE_TECH_B.getIcon();
- }
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
case 14:
- return TexturesGtBlock.Casing_Material_RedSteel.getIcon();
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
case 15:
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
default:
return TexturesGtBlock.Casing_Material_MaragingSteel.getIcon();
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java
new file mode 100644
index 0000000000..f3ad1de188
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java
@@ -0,0 +1,77 @@
+package gtPlusPlus.xmod.gregtech.common.blocks;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.objects.GT_CopiedBlockTexture;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.common.blocks.GT_Material_Casings;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGrinderMultiblock;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+
+
+public class GregtechMetaCasingBlocks5
+extends GregtechMetaCasingBlocksAbstract {
+
+ //84, 90, 91, 92, 94, 114, 116, 117, 118, 119, 120, 121, 124, 125, 126, 127
+ private static final TexturesGrinderMultiblock mGrinderOverlayHandler = new TexturesGrinderMultiblock();
+
+ public GregtechMetaCasingBlocks5() {
+ super(GregtechMetaCasingItems.class, "gtplusplus.blockcasings.5", GT_Material_Casings.INSTANCE);
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "IsaMill Exterior Casing"); // IsaMill Casing
+ TAE.registerTexture(0, 2, new GT_CopiedBlockTexture(this, 6, 0));
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "IsaMill Piping"); // IsaMill Pipe
+ TAE.registerTexture(0, 3, new GT_CopiedBlockTexture(this, 6, 0));
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "IsaMill Gearbox"); // IsaMill Gearbox
+ TAE.registerTexture(0, 4, new GT_CopiedBlockTexture(this, 6, 0));
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", ""); // Unused
+ GregtechItemList.Casing_IsaMill_Casing.set(new ItemStack(this, 1, 0));
+ GregtechItemList.Casing_IsaMill_Pipe.set(new ItemStack(this, 1, 1));
+ GregtechItemList.Casing_IsaMill_Gearbox.set(new ItemStack(this, 1, 2));
+ }
+
+ @Override
+ public IIcon getIcon(final int aSide, final int aMeta) {
+ return getStaticIcon(aSide, aMeta);
+ }
+
+
+ public static IIcon getStaticIcon(final int aSide, final int aMeta) {
+ if ((aMeta >= 0) && (aMeta < 16)) {
+ switch (aMeta) {
+ case 0:
+ return TexturesGtBlock.TEXTURE_CASING_GRINDING_MILL.getIcon();
+ case 1:
+ return TexturesGtBlock.TEXTURE_PIPE_GRINDING_MILL.getIcon();
+ case 2:
+ return TexturesGtBlock.TEXTURE_GEARBOX_GRINDING_MILL.getIcon();
+
+ }
+ }
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide) {
+ final GregtechMetaCasingBlocks5 i = this;
+ return mGrinderOverlayHandler.handleCasingsGT(aWorld, xCoord, yCoord, zCoord, aSide, i);
+ }
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings.java
new file mode 100644
index 0000000000..be180bf4e9
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings.java
@@ -0,0 +1,97 @@
+package gtPlusPlus.xmod.gregtech.common.blocks;
+
+import java.util.List;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.common.blocks.GT_Material_Casings;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+
+public class GregtechMetaSpecialMultiCasings extends GregtechMetaCasingBlocksAbstract {
+
+
+ public static class SpecialCasingItemBlock extends GregtechMetaCasingItems {
+
+ public SpecialCasingItemBlock(Block par1) {
+ super(par1);
+ }
+
+ @Override
+ public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) {
+ int aMeta = aStack.getItemDamage();
+ if (aMeta < 10) {
+ //aList.add("Tier: "+GT_Values.VN[aMeta]);
+ }
+ super.addInformation(aStack, aPlayer, aList, aF3_H);
+ }
+ }
+
+ public GregtechMetaSpecialMultiCasings() {
+ super(SpecialCasingItemBlock.class, "gtplusplus.blockspecialcasings.1", GT_Material_Casings.INSTANCE);
+ for (byte i = 0; i < 16; i = (byte) (i + 1)) {
+ //TAE.registerTextures(new GT_CopiedBlockTexture(this, 6, i));
+ // Don't register these Textures, They already exist within vanilla GT. (May not exist in 5.08)
+ }
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Turbine Shaft");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Reinforced Steam Turbine Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Reinforced HP Steam Turbine Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Reinforced Gas Turbine Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Reinforced Plasma Turbine Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Tesla Containment Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Structural Solar Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Salt Containment Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Thermally Insulated Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", ""); // Unused
+
+ GregtechItemList.Casing_Turbine_Shaft.set(new ItemStack(this, 1, 0));
+ GregtechItemList.Casing_Turbine_LP.set(new ItemStack(this, 1, 1));
+ GregtechItemList.Casing_Turbine_HP.set(new ItemStack(this, 1, 2));
+ GregtechItemList.Casing_Turbine_Gas.set(new ItemStack(this, 1, 3));
+ GregtechItemList.Casing_Turbine_Plasma.set(new ItemStack(this, 1, 4));
+ GregtechItemList.Casing_TeslaTower.set(new ItemStack(this, 1, 5));
+ GregtechItemList.Casing_SolarTower_Structural.set(new ItemStack(this, 1, 6));
+ GregtechItemList.Casing_SolarTower_SaltContainment.set(new ItemStack(this, 1, 7));
+ GregtechItemList.Casing_SolarTower_HeatContainment.set(new ItemStack(this, 1, 8));
+ }
+
+ public IIcon getIcon(int aSide, int aMeta) {
+
+ switch (aMeta) {
+
+ case 0:
+ return TexturesGtBlock.Casing_Redox_1.getIcon();
+ case 1:
+ return Textures.BlockIcons.MACHINE_CASING_TURBINE.getIcon();
+ case 2:
+ return Textures.BlockIcons.MACHINE_CASING_CLEAN_STAINLESSSTEEL.getIcon();
+ case 3:
+ return Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon();
+ case 4:
+ return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
+ case 5:
+ return TexturesGtBlock.Casing_Material_RedSteel.getIcon();
+ case 6:
+ return TexturesGtBlock.Casing_Material_MaragingSteel.getIcon();
+ case 7:
+ return TexturesGtBlock.Casing_Material_Stellite.getIcon();
+ case 8:
+ return TexturesGtBlock.Casing_Machine_Simple_Top.getIcon();
+
+ }
+
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaTieredCasingBlocks1.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaTieredCasingBlocks1.java
index f09285d514..240af72a3b 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaTieredCasingBlocks1.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaTieredCasingBlocks1.java
@@ -66,7 +66,7 @@ public class GregtechMetaTieredCasingBlocks1 extends GregtechMetaCasingBlocksAbs
//GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", "");
//GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", "");
//GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", "");
- //GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", " ");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", "Placeholder Block");
GregtechItemList.GTPP_Casing_ULV.set(new ItemStack(this, 1, 0));
GregtechItemList.GTPP_Casing_LV.set(new ItemStack(this, 1, 1));
@@ -93,9 +93,9 @@ public class GregtechMetaTieredCasingBlocks1 extends GregtechMetaCasingBlocksAbs
}
switch (aMeta) {
case 10:
- return Textures.BlockIcons.MACHINE_BRONZEPLATEDBRICKS.getIcon();
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
case 11:
- return Textures.BlockIcons.MACHINE_HEATPROOFCASING.getIcon();
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
case 12:
return Textures.BlockIcons.RENDERING_ERROR.getIcon();
case 13:
@@ -103,9 +103,9 @@ public class GregtechMetaTieredCasingBlocks1 extends GregtechMetaCasingBlocksAbs
case 14:
return Textures.BlockIcons.RENDERING_ERROR.getIcon();
case 15:
- return Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR.getIcon();
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
}
- return TexturesGtBlock.TEXTURE_CASING_TIERED_ULV.getIcon();
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
}
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java
index 1c7109fad2..c980997c64 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java
@@ -9,47 +9,32 @@ public class CasingTextureHandler2 {
public static IIcon getIcon(final int aSide, final int aMeta) { //Texture ID's. case 0 == ID[57]
if ((aMeta >= 0) && (aMeta < 16)) {
switch (aMeta) {
- //Centrifuge
case 0:
return TexturesGtBlock.Casing_Material_RedSteel.getIcon();
- //Coke Oven Frame
case 1:
return TexturesGtBlock.Casing_Material_HastelloyX.getIcon();
- //Coke Oven Casing Tier 1
case 2:
return TexturesGtBlock.Casing_Material_HastelloyN.getIcon();
- //Coke Oven Casing Tier 2
case 3:
return TexturesGtBlock.Casing_Material_Fluid_IncoloyDS.getIcon();
- //Material Press Casings
case 4:
- return TexturesGtBlock.Casing_Material_Grisium.getIcon();
- //Sifter Structural
+ return TexturesGtBlock.Casing_Material_Grisium.getIcon();
case 5:
return TexturesGtBlock.Casing_Machine_Metal_Panel_A.getIcon();
- //Sifter Sieve
case 6:
return TexturesGtBlock.Casing_Machine_Metal_Grate_A.getIcon();
-
- //Vanadium Radox Battery
case 7:
return TexturesGtBlock.Casing_Redox_1.getIcon();
- //Power Sub-Station Casing
case 8:
return TexturesGtBlock.Casing_Machine_Metal_Sheet_A.getIcon();
- //Cyclotron Coil
case 9:
return TexturesGtBlock.Overlay_Machine_Cyber_A.getIcon();
- //Cyclotron External Casing
case 10:
return Textures.BlockIcons.MACHINE_CASING_RADIATIONPROOF.getIcon();
- //Multitank Exterior Casing
case 11:
return TexturesGtBlock.Casing_Material_Tantalloy61.getIcon();
- //Reactor Casing I
case 12:
return TexturesGtBlock.Casing_Machine_Simple_Top.getIcon();
- //Reactor Casing II
case 13:
if (aSide <2) {
return TexturesGtBlock.TEXTURE_TECH_A.getIcon();
@@ -58,18 +43,9 @@ public class CasingTextureHandler2 {
return TexturesGtBlock.TEXTURE_TECH_B.getIcon();
}
case 14:
- return TexturesGtBlock.Casing_Material_RedSteel.getIcon();
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
case 15:
- return TexturesGtBlock.Casing_Machine_Acacia_Log.getIcon();
- /*if (aSide <2) {
- if (aSide == 1) {
- return TexturesGtBlock.Casing_Machine_Podzol.getIcon();
- }
- return TexturesGtBlock.Casing_Machine_Acacia_Log.getIcon();
- }
- else {
- return TexturesGtBlock.Casing_Machine_Farm_Manager.getIcon();
- }*/
+ return TexturesGtBlock.Casing_Machine_Acacia_Log.getIcon();
default:
return TexturesGtBlock.Overlay_UU_Matter.getIcon();
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java
new file mode 100644
index 0000000000..02900c300b
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java
@@ -0,0 +1,411 @@
+package gtPlusPlus.xmod.gregtech.common.blocks.textures;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks5;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IsaMill;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+
+public class TexturesGrinderMultiblock {
+
+ private static CustomIcon GT8_1_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE1");
+ private static CustomIcon GT8_1 = new CustomIcon("iconsets/Grinder/GRINDER1");
+ private static CustomIcon GT8_2_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE2");
+ private static CustomIcon GT8_2 = new CustomIcon("iconsets/Grinder/GRINDER2");
+ private static CustomIcon GT8_3_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE3");
+ private static CustomIcon GT8_3 = new CustomIcon("iconsets/Grinder/GRINDER3");
+ private static CustomIcon GT8_4_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE4");
+ private static CustomIcon GT8_4 = new CustomIcon("iconsets/Grinder/GRINDER4");
+ private static CustomIcon GT8_5_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE5");
+ private static CustomIcon GT8_5 = new CustomIcon("iconsets/Grinder/GRINDER5");
+ private static CustomIcon GT8_6_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE6");
+ private static CustomIcon GT8_6 = new CustomIcon("iconsets/Grinder/GRINDER6");
+ private static CustomIcon GT8_7_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE7");
+ private static CustomIcon GT8_7 = new CustomIcon("iconsets/Grinder/GRINDER7");
+ private static CustomIcon GT8_8_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE8");
+ private static CustomIcon GT8_8 = new CustomIcon("iconsets/Grinder/GRINDER8");
+ private static CustomIcon GT8_9_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE9");
+ private static CustomIcon GT8_9 = new CustomIcon("iconsets/Grinder/GRINDER9");
+
+ private static CustomIcon frontFace_0 = (GT8_1);
+ private static CustomIcon frontFaceActive_0 = (GT8_1_Active);
+ private static CustomIcon frontFace_1 = (GT8_2);
+ private static CustomIcon frontFaceActive_1 = (GT8_2_Active);
+ private static CustomIcon frontFace_2 = (GT8_3);
+ private static CustomIcon frontFaceActive_2 = (GT8_3_Active);
+ private static CustomIcon frontFace_3 = (GT8_4);
+ private static CustomIcon frontFaceActive_3 = (GT8_4_Active);
+ private static CustomIcon frontFace_4 = (GT8_5);
+ private static CustomIcon frontFaceActive_4 = (GT8_5_Active);
+ private static CustomIcon frontFace_5 = (GT8_6);
+ private static CustomIcon frontFaceActive_5 = (GT8_6_Active);
+ private static CustomIcon frontFace_6 = (GT8_7);
+ private static CustomIcon frontFaceActive_6 = (GT8_7_Active);
+ private static CustomIcon frontFace_7 = (GT8_8);
+ private static CustomIcon frontFaceActive_7 = (GT8_8_Active);
+ private static CustomIcon frontFace_8 = (GT8_9);
+ private static CustomIcon frontFaceActive_8 = (GT8_9_Active);
+
+ CustomIcon[] GRINDER = new CustomIcon[]{
+ frontFace_0,
+ frontFace_1,
+ frontFace_2,
+ frontFace_3,
+ frontFace_4,
+ frontFace_5,
+ frontFace_6,
+ frontFace_7,
+ frontFace_8
+ };
+
+ CustomIcon[] GRINDER_ACTIVE = new CustomIcon[]{
+ frontFaceActive_0,
+ frontFaceActive_1,
+ frontFaceActive_2,
+ frontFaceActive_3,
+ frontFaceActive_4,
+ frontFaceActive_5,
+ frontFaceActive_6,
+ frontFaceActive_7,
+ frontFaceActive_8
+ };
+
+ public IIcon handleCasingsGT(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide, final GregtechMetaCasingBlocks5 i) {
+ final int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord);
+ if (tMeta != 0) {
+ return GregtechMetaCasingBlocks5.getStaticIcon(aSide, tMeta);
+ }
+ final int tStartIndex = tMeta == 6 ? 1 : 13;
+ if (tMeta == 0) {
+ if ((aSide == 2) || (aSide == 3)) {
+ TileEntity tTileEntity;
+ IMetaTileEntity tMetaTileEntity;
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) {
+ return getIconByIndex(tMetaTileEntity, 0);
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) {
+ return getIconByIndex(tMetaTileEntity, 3);
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) {
+ return getIconByIndex(tMetaTileEntity, 6);
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) {
+ return getIconByIndex(tMetaTileEntity, 1);
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) {
+ return getIconByIndex(tMetaTileEntity, 7);
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) {
+ return getIconByIndex(tMetaTileEntity, 8);
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) {
+ return getIconByIndex(tMetaTileEntity, 5);
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) {
+ return getIconByIndex(tMetaTileEntity, 2);
+ }
+ } else if ((aSide == 4) || (aSide == 5)) {
+ TileEntity tTileEntity;
+ Object tMetaTileEntity;
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) {
+ return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 0);
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) {
+ return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 3);
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) {
+ return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 6);
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) {
+ return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 1);
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) {
+ return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 7);
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) {
+ return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 8);
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) {
+ return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 5);
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) {
+ return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 2);
+ }
+ }
+ return TexturesGtBlock.TEXTURE_CASING_GRINDING_MILL.getIcon();
+ }
+ final boolean[] tConnectedSides = {(aWorld.getBlock(xCoord, yCoord - 1, zCoord) == i) && (aWorld.getBlockMetadata(xCoord, yCoord - 1, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord + 1, zCoord) == i) && (aWorld.getBlockMetadata(xCoord, yCoord + 1, zCoord) == tMeta), (aWorld.getBlock(xCoord + 1, yCoord, zCoord) == i) && (aWorld.getBlockMetadata(xCoord + 1, yCoord, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord, zCoord + 1) == i) && (aWorld.getBlockMetadata(xCoord, yCoord, zCoord + 1) == tMeta), (aWorld.getBlock(xCoord - 1, yCoord, zCoord) == i) && (aWorld.getBlockMetadata(xCoord - 1, yCoord, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord, zCoord - 1) == i) && (aWorld.getBlockMetadata(xCoord, yCoord, zCoord - 1) == tMeta)};
+ switch (aSide) {
+ case 0:
+ if (tConnectedSides[0]) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (!tConnectedSides[2])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
+ }
+ if ((!tConnectedSides[5]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon();
+ }
+ case 1:
+ if (tConnectedSides[1]) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (!tConnectedSides[4])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
+ }
+ if ((!tConnectedSides[3]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon();
+ }
+ case 2:
+ if (tConnectedSides[5]) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (!tConnectedSides[4])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon();
+ }
+ case 3:
+ if (tConnectedSides[3]) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (!tConnectedSides[4])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon();
+ }
+ case 4:
+ if (tConnectedSides[4]) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon();
+ }
+ if ((!tConnectedSides[3]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
+ }
+ case 5:
+ if (tConnectedSides[2]) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon();
+ }
+ if ((!tConnectedSides[3]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
+ }
+ break;
+ }
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+
+ public boolean isCentrifugeRunning(IMetaTileEntity aTile) {
+ if (aTile == null) {
+ return false;
+ }
+ else {
+ return aTile.getBaseMetaTileEntity().isActive();
+ }
+
+
+ }
+
+ public boolean isUsingAnimatedTexture(IMetaTileEntity aMetaTileEntity) {
+ return true;
+ }
+
+ public IIcon getIconByIndex(IMetaTileEntity aMetaTileEntity, int aIndex) {
+ if (isCentrifugeRunning(aMetaTileEntity)) {
+ return this.GRINDER_ACTIVE[aIndex].getIcon();
+ }
+
+ return this.GRINDER[aIndex].getIcon();
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java
index 0e25057d35..7903da8c6d 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java
@@ -280,7 +280,13 @@ public class TexturesGtBlock {
public static final CustomIcon TEXTURE_CASING_ADVANCED_CRYOGENIC = new CustomIcon("TileEntities/MACHINE_CASING_ADVANCED_CRYOGENIC");
public static final CustomIcon TEXTURE_CASING_ADVANCED_VOLCNUS = new CustomIcon("TileEntities/MACHINE_CASING_ADVANCED_VOLCANUS");
public static final CustomIcon TEXTURE_CASING_ROCKETDYNE = new CustomIcon("TileEntities/MACHINE_CASING_ROCKETDYNE");
+ public static final CustomIcon TEXTURE_CASING_GRINDING_MILL = new CustomIcon("TileEntities/MACHINE_CASING_GRINDING_FACTORY");
+ // Custom Pipes
+ public static final CustomIcon TEXTURE_PIPE_GRINDING_MILL = new CustomIcon("TileEntities/MACHINE_CASING_PIPE_T1");
+
+ // Custom Gearboxes
+ public static final CustomIcon TEXTURE_GEARBOX_GRINDING_MILL = new CustomIcon("TileEntities/MACHINE_CASING_GEARBOX_T1");
public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II = new CustomIcon("iconsets/MACHINE_CASING_FUSION_3");
public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_INNER = new CustomIcon("iconsets/MACHINE_CASING_FUSION_COIL_II");
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java
index 5d4cf5ea94..232d4e2cd7 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java
@@ -363,6 +363,15 @@ public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 {
for (int aIndex=0;aIndex<10;aIndex++){
aTransParts[aIndex].set(this.addItem(aStartID++, "Transmission Component ("+GT_Values.VN[aIndex]+")", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, aIndex), getTcAspectStack(TC_Aspects.MACHINA, aIndex), getTcAspectStack(TC_Aspects.MAGNETO, aIndex)}));
}
+
+ // Distillus Chip
+ GregtechItemList.Distillus_Upgrade_Chip.set(this.addItem(151, "Upgrade Chip", "Used to upgrade Distillus to Tier 2"));
+
+
+ GregtechItemList.Chip_MultiNerf_NoOutputBonus.set(this.addItem(160, "No-Bonus Chip", "You won't like using this"));
+ GregtechItemList.Chip_MultiNerf_NoSpeedBonus.set(this.addItem(161, "No-Bonus Chip", "You won't like using this"));
+ GregtechItemList.Chip_MultiNerf_NoEuBonus.set(this.addItem(162, "No-Bonus Chip", "You won't like using this"));
+
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java
index 9f50cf6d91..bd9708108b 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java
@@ -8,6 +8,7 @@ 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_BasicGenerator;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
@@ -15,10 +16,9 @@ import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map;
import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.GTPP_MTE_BasicLosslessGenerator;
import net.minecraft.item.ItemStack;
-public class GT_MetaTileEntity_SemiFluidGenerator extends GTPP_MTE_BasicLosslessGenerator{
+public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_BasicGenerator {
public static final int BASE_POLLUTION = 2;
public int mEfficiency;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java
index 0939a9e6be..360939eb41 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java
@@ -72,9 +72,9 @@ public class GregtechMetaTileEntity_IndustrialPlatePress extends GregtechMeta_Mu
@Override
public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
if (aSide == aFacing) {
- return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(4)], new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)};
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[50], new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)};
}
- return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(4)]};
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[50]};
}
@Override
@@ -148,7 +148,7 @@ public class GregtechMetaTileEntity_IndustrialPlatePress extends GregtechMeta_Mu
Block aBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j);
int aMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j);
- if (!isValidBlockForStructure(tTileEntity, 4, true, aBlock, aMeta,
+ if (!isValidBlockForStructure(tTileEntity, 50, true, aBlock, aMeta,
ModBlocks.blockCasingsMisc, 4)) {
Logger.INFO("Bad material press casing");
return false;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java
index ca6eeda207..40d12356d8 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java
@@ -238,7 +238,7 @@ extends GregtechMeta_MultiBlockBase {
public byte getCasingTextureIndex() {
- return (byte) TAE.GTPP_INDEX(20);
+ return (byte) TAE.GTPP_INDEX(11);
}
private boolean addToMachineList(final IGregTechTileEntity tTileEntity) {
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java
new file mode 100644
index 0000000000..d06b7ed0d1
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java
@@ -0,0 +1,404 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import java.util.HashSet;
+import java.util.List;
+
+import gregtech.api.enums.TAE;
+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.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.Recipe_GT;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.minecraft.BlockPos;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.EntityUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
+import net.minecraft.block.Block;
+import net.minecraft.entity.EntityLivingBase;
+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.DamageSource;
+import net.minecraft.world.World;
+import net.minecraft.world.chunk.Chunk;
+
+public class GregtechMetaTileEntity_IsaMill extends GregtechMeta_MultiBlockBase {
+
+ protected int fuelConsumption = 0;
+ protected int fuelValue = 0;
+ protected int fuelRemaining = 0;
+ protected boolean boostEu = false;
+
+ private static ITexture frontFace;
+ private static ITexture frontFaceActive;
+
+ private static final DamageSource mIsaMillDamageSource = new DamageSource("gtpp.grinder").setDamageBypassesArmor();
+
+ public GregtechMetaTileEntity_IsaMill(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ frontFaceActive = new GT_RenderedTexture(new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE5"));
+ frontFace = new GT_RenderedTexture(new CustomIcon("iconsets/Grinder/GRINDER5"));
+ }
+
+ public GregtechMetaTileEntity_IsaMill(String aName) {
+ super(aName);
+ }
+
+ public String[] getTooltip() {
+ return new String[]{
+ "Controller Block for the Large Grinding Machine",
+ "Engine Intake Casings must not be obstructed in front (only air blocks)",
+ "Supply Semifluid Fuels and 2000L of Lubricant per hour to run.",
+ "Supply 80L of Oxygen per second to boost output (optional).",
+ "Default: Produces 2048EU/t at 100% efficiency",
+ "Boosted: Produces 6144EU/t at 150% efficiency",
+ "Size(WxHxD): 3x3x4, Controller (front centered)",
+ "3x3x4 of Stable Titanium Machine Casing (hollow, Min 16!)",
+ "All hatches except dynamo can replace any Stable Titanium casing in middle two segments",
+ "2x Steel Gear Box Machine Casing inside the Hollow Casing",
+ "8x Engine Intake Machine Casing (around controller)",
+ "2x Input Hatch (Fuel/Lubricant)",
+ "1x Maintenance Hatch",
+ "1x Muffler Hatch",
+ "1x Dynamo Hatch (back centered)",
+ };
+ }
+
+
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return new ITexture[]{
+ Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(2)],
+ aFacing == aSide ? aActive ? frontFaceActive : frontFace : Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(2)]};
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return getMaxEfficiency(aStack) > 0;
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeDieselEngine.png");
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return Recipe_GT.Gregtech_Recipe_Map.sOreMillRecipes;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (aTick % 20 == 0) {
+ checkForEntities(aBaseMetaTileEntity, aTick);
+ }
+ }
+
+ private final AutoMap<BlockPos> mFrontBlockPosCache = new AutoMap<BlockPos>();
+
+ public void checkForEntities(IGregTechTileEntity aBaseMetaTileEntity, long aTime) {
+
+ if (aTime % 100 == 0) {
+ mFrontBlockPosCache.clear();
+ }
+ if (mFrontBlockPosCache.isEmpty()) {
+ byte tSide = aBaseMetaTileEntity.getBackFacing();
+ int aTileX = aBaseMetaTileEntity.getXCoord();
+ int aTileY = aBaseMetaTileEntity.getYCoord();
+ int aTileZ = aBaseMetaTileEntity.getZCoord();
+ boolean xFacing = (tSide == 4 || tSide == 5);
+ boolean zFacing = (tSide == 2 || tSide == 3);
+
+ // Check Casings
+ int aDepthOffset = (tSide == 2 || tSide == 4) ? 1 : -1;
+ for (int aHorizontalOffset = -1; aHorizontalOffset < 2; aHorizontalOffset++) {
+ for (int aVerticalOffset = -1; aVerticalOffset < 2; aVerticalOffset++) {
+ int aX = !xFacing ? (aTileX + aHorizontalOffset) : (aTileX + aDepthOffset);
+ int aY = aTileY + aVerticalOffset;
+ int aZ = !zFacing ? (aTileZ + aHorizontalOffset) : (aTileZ + aDepthOffset);
+ mFrontBlockPosCache.add(new BlockPos(aX, aY, aZ, aBaseMetaTileEntity.getWorld()));
+ }
+ }
+ }
+
+ AutoMap<EntityLivingBase> aEntities = getEntities(mFrontBlockPosCache, aBaseMetaTileEntity.getWorld());
+ if (!aEntities.isEmpty()) {
+ for (EntityLivingBase aFoundEntity : aEntities) {
+ if (aFoundEntity instanceof EntityPlayer) {
+ EntityPlayer aPlayer = (EntityPlayer) aFoundEntity;
+ if (PlayerUtils.isCreative(aPlayer) || !PlayerUtils.canTakeDamage(aPlayer)) {
+ continue;
+ }
+ else {
+ if (aFoundEntity.getHealth() > 0) {
+ EntityUtils.doDamage(aFoundEntity, mIsaMillDamageSource, (int) (aFoundEntity.getMaxHealth() / 5));
+ if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive())) {
+ generateParticles(aFoundEntity);
+ }
+ }
+ }
+ }
+ if (aFoundEntity.getHealth() > 0) {
+ EntityUtils.doDamage(aFoundEntity, mIsaMillDamageSource, Math.max(1, (int) (aFoundEntity.getMaxHealth() / 3)));
+ if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive())) {
+ generateParticles(aFoundEntity);
+ }
+ }
+ }
+ }
+ }
+
+ private static final AutoMap<EntityLivingBase> getEntities(AutoMap<BlockPos> aPositionsToCheck, World aWorld){
+ AutoMap<EntityLivingBase> aEntities = new AutoMap<EntityLivingBase>();
+ HashSet<Chunk> aChunksToCheck = new HashSet<Chunk>();
+ if (!aPositionsToCheck.isEmpty()) {
+ Chunk aLocalChunk;
+ for (BlockPos aPos : aPositionsToCheck) {
+ aLocalChunk = aWorld.getChunkFromBlockCoords(aPos.xPos, aPos.zPos);
+ aChunksToCheck.add(aLocalChunk);
+ }
+ }
+ if (!aChunksToCheck.isEmpty()) {
+ AutoMap<EntityLivingBase> aEntitiesFound = new AutoMap<EntityLivingBase>();
+ for (Chunk aChunk : aChunksToCheck) {
+ if (aChunk.isChunkLoaded) {
+ List[] aEntityLists = aChunk.entityLists;
+ for (List aEntitySubList : aEntityLists) {
+ for (Object aEntity : aEntitySubList) {
+ if (aEntity instanceof EntityLivingBase) {
+ EntityLivingBase aPlayer = (EntityLivingBase) aEntity;
+ aEntitiesFound.add(aPlayer);
+ }
+ }
+ }
+ }
+ }
+ if (!aEntitiesFound.isEmpty()) {
+ for (EntityLivingBase aEntity : aEntitiesFound) {
+ BlockPos aPlayerPos = EntityUtils.findBlockPosOfEntity(aEntity);
+ for (BlockPos aBlockSpaceToCheck : aPositionsToCheck) {
+ if (aBlockSpaceToCheck.equals(aPlayerPos)) {
+ aEntities.add(aEntity);
+ }
+ }
+ }
+ }
+ }
+ return aEntities;
+ }
+
+ private static void generateParticles(EntityLivingBase aEntity) {
+ BlockPos aPlayerPosBottom = EntityUtils.findBlockPosOfEntity(aEntity);
+ BlockPos aPlayerPosTop = aPlayerPosBottom.getUp();
+ AutoMap<BlockPos> aEntityPositions = new AutoMap<BlockPos>();
+ aEntityPositions.add(aPlayerPosBottom);
+ aEntityPositions.add(aPlayerPosTop);
+ for (int i = 0; i < 64; i++) {
+ BlockPos aEffectPos = aEntityPositions.get(aEntity.height > 1f ? MathUtils.randInt(0, 1) : 0);
+ float aOffsetX = MathUtils.randFloat(-0.35f, 0.35f);
+ float aOffsetY = MathUtils.randFloat(-0.25f, 0.35f);
+ float aOffsetZ = MathUtils.randFloat(-0.35f, 0.35f);
+ aEntity.worldObj.spawnParticle("reddust", aEffectPos.xPos + aOffsetX, aEffectPos.yPos + 0.3f + aOffsetY, aEffectPos.zPos + aOffsetZ, 0.0D, 0.0D, 0.0D);
+ }
+ }
+
+ @Override
+ public boolean isFacingValid(final byte aFacing) {
+ return aFacing > 1;
+ }
+
+ @Override
+ public boolean checkRecipe(ItemStack aStack) {
+ return checkRecipeGeneric();
+ }
+
+ @Override
+ public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ byte tSide = aBaseMetaTileEntity.getBackFacing();
+ int aTileX = aBaseMetaTileEntity.getXCoord();
+ int aTileY = aBaseMetaTileEntity.getYCoord();
+ int aTileZ = aBaseMetaTileEntity.getZCoord();
+ boolean xFacing = (tSide == 4 || tSide == 5);
+ boolean zFacing = (tSide == 2 || tSide == 3);
+ int aCasingCount = 0;
+ // Check Intake Hatches
+ for (int aHorizontalOffset = -1; aHorizontalOffset < 2; aHorizontalOffset++) {
+ for (int aVerticalOffset = -1; aVerticalOffset < 2; aVerticalOffset++) {
+ if (aHorizontalOffset == 0 && aVerticalOffset == 0) {
+ continue;
+ }
+ int aX = !xFacing ? (aTileX + aHorizontalOffset) : aTileX;
+ int aY = aTileY + aVerticalOffset;
+ int aZ = !zFacing ? (aTileZ + aHorizontalOffset) : aTileZ;
+ Block aIntakeBlock = aBaseMetaTileEntity.getBlock(aX, aY, aZ);
+ int aIntakeMeta = aBaseMetaTileEntity.getMetaID(aX, aY, aZ);
+ if (!isValidBlockForStructure(null, 0, false, aIntakeBlock, aIntakeMeta, getIntakeBlock(), getIntakeMeta())) {
+ return false; // Not intake casing surrounding controller
+ }
+ }
+ }
+ // Check Casings
+ int aStartDepthOffset = (tSide == 2 || tSide == 4) ? -1 : 1;
+ int aFinishDepthOffset = (tSide == 2 || tSide == 4) ? -8 : 8;
+ for (int aDepthOffset = aStartDepthOffset; aDepthOffset != aFinishDepthOffset;) {
+ for (int aHorizontalOffset = -1; aHorizontalOffset < 2; aHorizontalOffset++) {
+ for (int aVerticalOffset = -1; aVerticalOffset < 2; aVerticalOffset++) {
+ if (aHorizontalOffset == 0 && aVerticalOffset == 0) {
+ continue;
+ }
+ int aX = !xFacing ? (aTileX + aHorizontalOffset) : (aTileX + aDepthOffset);
+ int aY = aTileY + aVerticalOffset;
+ int aZ = !zFacing ? (aTileZ + aHorizontalOffset) : (aTileZ + aDepthOffset);
+ Block aCasingBlock = aBaseMetaTileEntity.getBlock(aX, aY, aZ);
+ int aCasingMeta = aBaseMetaTileEntity.getMetaID(aX, aY, aZ);
+ IGregTechTileEntity aTileEntity = aBaseMetaTileEntity.getIGregTechTileEntity(aX, aY, aZ);
+ if (aTileEntity != null) {
+ final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity != null) {
+ if (aMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill) {
+ Logger.INFO("Don't be cheeky, only one controller per Mill.");
+ return false;
+ }
+ }
+ }
+
+ if (!isValidBlockForStructure(aTileEntity, getCasingTextureIndex(), true, aCasingBlock, aCasingMeta, getCasingBlock(), getCasingMeta())) {
+ Logger.INFO("Bad casing.");
+ return false; // Not valid casing
+ }
+ else {
+ if (aTileEntity == null) {
+ aCasingCount++;
+ }
+ }
+ }
+ }
+ // Count Backwards for 2 axis
+ if (aStartDepthOffset == -1) {
+ aDepthOffset--;
+ }
+ // Count Forwards for 2 axis
+ else {
+ aDepthOffset++;
+ }
+ }
+
+ // Check Gear Boxes
+ for (int aInternalDepthAxis = 1; aInternalDepthAxis < 7; aInternalDepthAxis++) {
+ if(aBaseMetaTileEntity.getBlockAtSideAndDistance(tSide, aInternalDepthAxis) != getGearboxBlock() || aBaseMetaTileEntity.getMetaIDAtSideAndDistance(tSide, aInternalDepthAxis) != getGearboxMeta()) {
+ Logger.INFO("Missing Gearbox at depth "+aInternalDepthAxis);
+ return false;
+ }
+ }
+ return aCasingCount >= 48;
+ }
+
+ public Block getCasingBlock() {
+ return ModBlocks.blockCasings5Misc;
+ }
+
+ public byte getCasingMeta() {
+ return 0;
+ }
+
+ public Block getIntakeBlock() {
+ return ModBlocks.blockCasings5Misc;
+ }
+
+ public byte getIntakeMeta() {
+ return 0;
+ }
+
+ public Block getGearboxBlock() {
+ return ModBlocks.blockCasings5Misc;
+ }
+
+ public byte getGearboxMeta() {
+ return 2;
+ }
+
+ public byte getCasingTextureIndex() {
+ return 66;
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IsaMill(this.mName);
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack) {
+ return 1;
+ }
+
+ public int getMaxEfficiency(ItemStack aStack) {
+ return boostEu ? 20000 : 10000;
+ }
+
+ @Override
+ public int getPollutionPerTick(ItemStack aStack) {
+ return 64;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public String[] getExtraInfoData() {
+ return new String[]{
+ "IsaMill Grinding Machine",
+ "Current Efficiency: " + (mEfficiency / 100) + "%",
+ getIdealStatus() == getRepairStatus() ? "No Maintainance issues" : "Needs Maintainance"
+ };
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Grinding Machine";
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 1;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java
new file mode 100644
index 0000000000..eab997adb4
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java
@@ -0,0 +1,623 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced;
+
+import java.util.ArrayList;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.TAE;
+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_Hatch;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DataAccess;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.util.minecraft.LangUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Naquadah;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_Adv_AssemblyLine
+ extends GregtechMeta_MultiBlockBase {
+
+ public ArrayList<GT_MetaTileEntity_Hatch_DataAccess> mDataAccessHatches = new ArrayList<GT_MetaTileEntity_Hatch_DataAccess>();
+
+ public static String[] mCasingName = new String[5];
+ private final int CASING_TEXTURE_ID = TAE.getIndexFromPage(0, 13);
+ private final int META_BaseCasing = 0; //4
+ private final int META_ContainmentCasing = 15; //3
+ private final int META_Shielding = 13; //1
+ private final int META_PipeCasing = 1; //4
+ private final int META_IntegralCasing = 6; //0
+ private final int META_ContainmentChamberCasing = 2; //4
+
+
+ public GregtechMetaTileEntity_Adv_AssemblyLine(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0);
+ mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1);
+ mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2);
+ mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15);
+ mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(1), 13);
+ }
+
+ public GregtechMetaTileEntity_Adv_AssemblyLine(String aName) {
+ super(aName);
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_Adv_AssemblyLine(this.mName);
+ }
+
+ public String[] getTooltip() {
+ if (mCasingName[0].toLowerCase().contains(".name")) {
+ mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0);
+ }
+ if (mCasingName[1].toLowerCase().contains(".name")) {
+ mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1);
+ }
+ if (mCasingName[2].toLowerCase().contains(".name")) {
+ mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2);
+ }
+ if (mCasingName[3].toLowerCase().contains(".name")) {
+ mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15);
+ }
+ if (mCasingName[4].toLowerCase().contains(".name")) {
+ mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(1), 13);
+ }
+ return new String[]{
+ "Advanced Integrated Assembly Line"
+ };
+ }
+
+ private Block getCasing(int casingID) {
+ if (casingID == 1) {
+ return ModBlocks.blockCasingsMisc;
+ }
+ else if (casingID == 2) {
+ return ModBlocks.blockCasings2Misc;
+ }
+ else if (casingID == 3) {
+ return ModBlocks.blockCasings3Misc;
+ }
+ else if (casingID == 4) {
+ return ModBlocks.blockCasings4Misc;
+ }
+ else {
+ return ModBlocks.blockCasingsTieredGTPP;
+ }
+ }
+
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[16], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE)};
+ }
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[16]};
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "AssemblyLine.png");
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return null;
+ }
+
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ public boolean isFacingValid(byte aFacing) {
+ return aFacing > 1;
+ }
+
+ public boolean checkRecipe(ItemStack aStack) {
+ if(GT_Values.D1)System.out.println("Start ALine recipe check");
+ ArrayList<ItemStack> tDataStickList = getDataItems(2);
+ if (tDataStickList.size() == 0) return false;
+ if(GT_Values.D1)System.out.println("Stick accepted, " + tDataStickList.size() + " Data Sticks found");
+
+ ItemStack tStack[] = new ItemStack[15];
+ FluidStack[] tFluids = new FluidStack[4];
+ boolean findRecipe = false;
+ nextDS:for (ItemStack tDataStick : tDataStickList){
+ NBTTagCompound tTag = tDataStick.getTagCompound();
+ if (tTag == null) continue;
+ for (int i = 0; i < 15; i++) {
+ int count = tTag.getInteger("a"+i);
+ if (!tTag.hasKey("" + i) && count <= 0) continue;
+ if (mInputBusses.get(i) == null) {
+ continue nextDS;
+ }
+
+ ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0);
+ boolean flag = true;
+ if (count > 0) {
+ for (int j = 0; j < count; j++) {
+ tStack[i] = GT_Utility.loadItem(tTag, "a" + i + ":" + j);
+ if (tStack[i] == null) continue;
+ if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName());
+ if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) {
+ flag = false;
+ break;
+ }
+ }
+ }
+ if (flag) {
+ tStack[i] = GT_Utility.loadItem(tTag, "" + i);
+ if (tStack[i] == null) {
+ flag = false;
+ continue;
+ }
+ if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName());
+ if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) {
+ flag = false;
+ }
+ }
+ if(GT_Values.D1) System.out.println(i + (flag ? " not accepted" : " accepted"));
+ if (flag) continue nextDS;
+ }
+
+ if(GT_Values.D1)System.out.println("All Items done, start fluid check");
+ for (int i = 0; i < 4; i++) {
+ if (!tTag.hasKey("f" + i)) continue;
+ tFluids[i] = GT_Utility.loadFluid(tTag, "f" + i);
+ if (tFluids[i] == null) continue;
+ if(GT_Values.D1)System.out.println("Fluid "+i+" "+tFluids[i].getUnlocalizedName());
+ if (mInputHatches.get(i) == null) {
+ continue nextDS;
+ }
+ FluidStack fluidInHatch = mInputHatches.get(i).mFluid;
+ if (fluidInHatch == null || !GT_Utility.areFluidsEqual(fluidInHatch, tFluids[i], true) || fluidInHatch.amount < tFluids[i].amount) {
+ if(GT_Values.D1)System.out.println(i+" not accepted");
+ continue nextDS;
+ }
+ if(GT_Values.D1)System.out.println(i+" accepted");
+ }
+
+ if(GT_Values.D1)System.out.println("Input accepted, check other values");
+ if (!tTag.hasKey("output")) continue;
+ mOutputItems = new ItemStack[]{GT_Utility.loadItem(tTag, "output")};
+ if (mOutputItems[0] == null || !GT_Utility.isStackValid(mOutputItems[0]))
+ continue;
+
+ if (!tTag.hasKey("time")) continue;
+ mMaxProgresstime = tTag.getInteger("time");
+ if (mMaxProgresstime <= 0) continue;
+
+ if (!tTag.hasKey("eu")) continue;
+ mEUt = tTag.getInteger("eu");
+
+ if(GT_Values.D1)System.out.println("Find avaiable recipe");
+ findRecipe = true;
+ break;
+ }
+ if (!findRecipe) return false;
+
+ if(GT_Values.D1)System.out.println("All checked start consuming inputs");
+ for (int i = 0; i < 15; i++) {
+ if (tStack[i] == null) continue;
+ ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0);
+ stackInSlot.stackSize -= tStack[i].stackSize;
+ }
+
+ for (int i = 0; i < 4; i++) {
+ if (tFluids[i] == null) continue;
+ mInputHatches.get(i).mFluid.amount -= tFluids[i].amount;
+ if (mInputHatches.get(i).mFluid.amount <= 0) {
+ mInputHatches.get(i).mFluid = null;
+ }
+ }
+ if(GT_Values.D1)System.out.println("Check overclock");
+
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(getMaxInputVoltage()));
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+ if (mEUt <= 16) {
+ this.mEUt = (mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (mMaxProgresstime / (1 << tTier - 1));
+ } else {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 2;
+ }
+ }
+ if (this.mEUt > 0) {
+ this.mEUt = -this.mEUt;
+ }
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+ updateSlots();
+ if(GT_Values.D1)System.out.println("Recipe sucessfull");
+ return true;
+ }
+
+ public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
+ super.startSoundLoop(aIndex, aX, aY, aZ);
+ if (aIndex == 20) {
+ GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(212), 10, 1.0F, aX, aY, aZ);
+ }
+ }
+
+ public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 4;
+ int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 4;
+
+ // Counts for all Casing Types
+ int aBaseCasingCount = 0;
+ int aContainmentCasingCount = 0;
+ int aShieldingCount = 0;
+ int aPipeCount = 0;
+ int aIntegralCasingCount = 0;
+ int aContainmentChamberCount = 0;
+
+ // Bottom Layer
+ aBaseCasingCount += checkEntireLayer(aBaseMetaTileEntity, getCasing(4), META_BaseCasing, -7, xDir, zDir);
+ log("Bottom Layer is Valid. Moving to Layer 1.");
+
+ // Layer 1
+ aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -6, xDir, zDir);
+ aIntegralCasingCount += checkIntegralRing(aBaseMetaTileEntity, getCasing(0), this.META_IntegralCasing, -6, xDir, zDir);
+ aContainmentChamberCount += checkContainmentRing(aBaseMetaTileEntity, getCasing(4), this.META_ContainmentChamberCasing, -6, xDir, zDir);
+ log("Layer 1 is Valid. Moving to Layer 2.");
+
+ // Layer 2
+ aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -5, xDir, zDir);
+ aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -5, xDir, zDir);
+ log("Layer 2 is Valid. Moving to Layer 3.");
+
+ // Layer 3
+ aContainmentCasingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(3), this.META_ContainmentCasing, -4, xDir, zDir);
+ aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -4, xDir, zDir);
+ log("Layer 3 is Valid. Moving to Layer 4.");
+
+ // Layer 4
+ aContainmentCasingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(3), this.META_ContainmentCasing, -3, xDir, zDir);
+ aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -3, xDir, zDir);
+ log("Layer 4 is Valid. Moving to Layer 5.");
+
+ // Layer 5
+ aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -2, xDir, zDir);
+ aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -2, xDir, zDir);
+ log("Layer 5 is Valid. Moving to Layer 6.");
+
+ // Layer 6
+ aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -1, xDir, zDir);
+ aIntegralCasingCount += checkIntegralRing(aBaseMetaTileEntity, getCasing(0), this.META_IntegralCasing, -1, xDir, zDir);
+ aContainmentChamberCount += checkContainmentRing(aBaseMetaTileEntity, getCasing(4), this.META_ContainmentChamberCasing, -1, xDir, zDir);
+ log("Layer 6 is Valid. Moving to Top Layer.");
+
+ // Top Layer
+ aBaseCasingCount += checkEntireLayer(aBaseMetaTileEntity, getCasing(4), META_BaseCasing, 0, xDir, zDir);
+
+ log("Found "+aBaseCasingCount+" "+mCasingName[0]+"s");
+ log("Found "+aShieldingCount+" "+mCasingName[4]+"s");
+ log("Found "+aPipeCount+" "+mCasingName[1]+"s");
+ log("Found "+aContainmentCasingCount+" "+mCasingName[3]+"s");
+ log("Found "+aIntegralCasingCount+" "+LangUtils.getLocalizedNameOfBlock(getCasing(0), 6)+"s");
+ log("Found "+aContainmentChamberCount+" "+mCasingName[2]+"s");
+
+ // Try mesage player
+ String aOwnerName = this.getBaseMetaTileEntity().getOwnerName();
+ EntityPlayer aOwner = null;
+ if (aOwnerName != null && aOwnerName.length() > 0) {
+ aOwner = PlayerUtils.getPlayer(aOwnerName);
+ }
+
+ if (aShieldingCount != 128) {
+ log("Not enough "+mCasingName[4]+"s, require 128.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[4]+"s, require 128.");
+ }
+ return false;
+ }
+ if (aPipeCount != 20) {
+ log("Not enough "+mCasingName[1]+"s, require 20.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[1]+"s, require 20.");
+ }
+ return false;
+ }
+ if (aContainmentCasingCount != 64) {
+ log("Not enough "+mCasingName[3]+"s, require 64.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[3]+"s, require 64.");
+ }
+ return false;
+ }
+ if (aContainmentChamberCount != 42) {
+ log("Not enough "+mCasingName[2]+"s, require 42.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[2]+"s, require 42.");
+ }
+ return false;
+ }
+ if (aBaseCasingCount < 140) {
+ log("Not enough "+mCasingName[0]+"s, require 140 at a minimum.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[0]+"s, require 140 at a minimum.");
+ }
+ return false;
+ }
+ if (aIntegralCasingCount != 48) {
+ log("Not enough "+LangUtils.getLocalizedNameOfBlock(getCasing(0), 6)+"s, require 48.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+LangUtils.getLocalizedNameOfBlock(getCasing(0), 6)+"s, require 48.");
+ }
+ return false;
+ }
+ log("LNR Formed.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Large Naquadah Reactor has formed successfully.");
+ }
+ return true;
+ }
+
+ public boolean addNaquadahHatchToMachineInput(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ }
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return false;
+ }
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) {
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
+ return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity);
+ }
+ return false;
+ }
+
+ public int checkEntireLayer(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -4; x < 5; x++) {
+ for (int z = -4; z < 5; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 4 && z == 4) || (x == -4 && z == -4) || (x == 4 && z == -4) || (x == -4 && z == 4)) {
+ continue;
+ }
+ // Skip controller
+ if (aY == 0 && x == 0 && z == 0) {
+ continue;
+ }
+
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, true, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Layer has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
+ }
+ }
+ }
+ return aCasingCount;
+ }
+
+ public int checkOuterRing(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -4; x < 5; x++) {
+ for (int z = -4; z < 5; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 4 && z == 4) || (x == -4 && z == -4) || (x == 4 && z == -4) || (x == -4 && z == 4)) {
+ continue;
+ }
+
+ // If we are on the 5x5 ring, proceed
+ if ((x > -4 && x < 4 ) && (z > -4 && z < 4)) {
+ if ((x == 3 && z == 3) || (x == -3 && z == -3) || (x == 3 && z == -3) || (x == -3 && z == 3)) {
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ }
+ else {
+ continue;
+ }
+ }
+
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Layer has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
+ }
+ }
+ }
+ return aCasingCount;
+ }
+ public int checkIntegralRing(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -3; x < 4; x++) {
+ for (int z = -3; z < 4; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 3 && z == 3) || (x == -3 && z == -3) || (x == 3 && z == -3) || (x == -3 && z == 3)) {
+ continue;
+ }
+
+ // If we are on the 5x5 ring, proceed
+ if ((x > -3 && x < 3 ) && (z > -3 && z < 3)) {
+ if ((x == 2 && z == 2) || (x == -2 && z == -2) || (x == 2 && z == -2) || (x == -2 && z == 2)) {
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ }
+ else {
+ continue;
+ }
+ }
+
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Layer has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
+ }
+ }
+ }
+ return aCasingCount;
+ }
+
+ public int checkPipes(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -1; x < 2; x++) {
+ for (int z = -1; z < 2; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 1 && z == 1) || (x == -1 && z == -1) || (x == 1 && z == -1) || (x == -1 && z == 1) || (x == 0 && z == 0)) {
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Pipe has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
+ };
+ }
+ }
+ }
+ return aCasingCount;
+ }
+
+ public int checkContainmentRing(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -2; x < 3; x++) {
+ for (int z = -2; z < 3; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 2 && z == 2) || (x == -2 && z == -2) || (x == 2 && z == -2) || (x == -2 && z == 2)) {
+ continue;
+ }
+
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Layer has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
+ }
+ }
+ }
+ return aCasingCount;
+ }
+
+ /**
+ * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb
+ */
+ private boolean isCorrectDataItem(ItemStack aStack, int state){
+ if ((state & 1) != 0 && ItemList.Circuit_Integrated.isStackEqual(aStack, true, true)) return true;
+ if ((state & 2) != 0 && ItemList.Tool_DataStick.isStackEqual(aStack, false, true)) return true;
+ if ((state & 4) != 0 && ItemList.Tool_DataOrb.isStackEqual(aStack, false, true)) return true;
+ return false;
+ }
+
+ /**
+ * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb
+ */
+ public ArrayList<ItemStack> getDataItems(int state) {
+ ArrayList<ItemStack> rList = new ArrayList<ItemStack>();
+ if (GT_Utility.isStackValid(mInventory[1]) && isCorrectDataItem(mInventory[1], state)) {
+ rList.add(mInventory[1]);
+ }
+ for (GT_MetaTileEntity_Hatch_DataAccess tHatch : mDataAccessHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ for (int i = 0; i < tHatch.getBaseMetaTileEntity().getSizeInventory(); i++) {
+ if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null
+ && isCorrectDataItem(tHatch.getBaseMetaTileEntity().getStackInSlot(i), state))
+ rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i));
+ }
+ }
+ }
+ return rList;
+ }
+
+ public boolean addDataAccessToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) return false;
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) return false;
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) {
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
+ return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity);
+ }
+ return false;
+ }
+
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ public int getPollutionPerTick(ItemStack aStack) {
+ return 0;
+ }
+
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Assembly Line";
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 0;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java
index e5387d8c6f..46ba445586 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java
@@ -1,5 +1,9 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced;
+import java.util.ArrayList;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
@@ -8,13 +12,16 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
-import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
@@ -23,94 +30,86 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
-import org.apache.commons.lang3.ArrayUtils;
-
-import java.util.ArrayList;
public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_MultiBlockBase {
-
- private static final int CASING_INDEX = 49;
-
- private short mControllerY = 0;
-
- private byte mMode = 0;
-
- public GregtechMetaTileEntity_Adv_DistillationTower(int aID, String aName, String aNameRegional) {
- super(aID, aName, aNameRegional);
- }
-
- public GregtechMetaTileEntity_Adv_DistillationTower(String aName) {
- super(aName);
- }
-
- public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GregtechMetaTileEntity_Adv_DistillationTower(this.mName);
- }
-
- public String[] getTooltip() {
+
+ private short mControllerY = 0;
+ private byte mMode = 0;
+ private boolean mUpgraded = false;
+
+ public GregtechMetaTileEntity_Adv_DistillationTower(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_Adv_DistillationTower(String aName) {
+ super(aName);
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_Adv_DistillationTower(this.mName);
+ }
+
+ public String[] getTooltip() {
String s = "Max parallel dictated by tower tier and mode";
String s1 = "DTower Mode: T1=4, T2=12";
String s2 = "Distilery Mode: Tower Tier * (4*InputTier)";
- return new String[]{
- "Controller Block for the Advanced Distillation Tower",
- "T1 constructed identical to standard DT",
- "T2 is currently disabled.",
- "T2 is not variable height",
- "Size(WxHxD): 3x26x3",
- "Controller (Front bottom)",
- "1x Input Hatch (Any bottom layer casing)",
- "24x Output Hatch (One per layer except bottom/top layer)",
- "1x Output Bus (Any bottom layer casing)",
- "1x Maintenance Hatch (Any casing)",
- "1x Energy Hatch (Any casing)",
- "Integral Framework I's for the rest",
- s,
- s1,
- s2};
- }
-
- public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- if (aSide == aFacing) {
- return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[CASING_INDEX], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER)};
- }
- return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[CASING_INDEX]};
- }
-
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "DistillationTower.png");
- }
-
- public GT_Recipe.GT_Recipe_Map getRecipeMap() {
- return mMode == 0 ? GT_Recipe.GT_Recipe_Map.sDistillationRecipes : GT_Recipe.GT_Recipe_Map.sDistilleryRecipes;
- }
-
- public boolean isCorrectMachinePart(ItemStack aStack) {
- return true;
- }
-
- public boolean isFacingValid(byte aFacing) {
- return aFacing > 1;
- }
-
- public int getMaxEfficiency(ItemStack aStack) {
- return 10000;
- }
-
- public int getPollutionPerTick(ItemStack aStack) {
+ return new String[]{
+ "Controller Block for the Advanced Distillation Tower",
+ "T1 constructed identical to standard DT",
+ "Place Distillus Upgrade Chip into Controller GUI to upgrade to T2",
+ "T2 is not variable height",
+ "Size(WxHxD): 3x26x3",
+ "Controller (Front bottom)",
+ "1x Input Hatch (Any bottom layer casing)",
+ "24x Output Hatch (One per layer except bottom/top layer)",
+ "1x Output Bus (Any bottom layer casing)",
+ "1x Maintenance Hatch (Any casing)",
+ "1x Energy Hatch (Any casing)",
+ "Integral Framework I's for the rest",
+ s,
+ s1,
+ s2};
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName()+(mUpgraded ? " T2" : ""), "MultiblockDisplay.png");
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return mMode == 0 ? GT_Recipe.GT_Recipe_Map.sDistillationRecipes : GT_Recipe.GT_Recipe_Map.sDistilleryRecipes;
+ }
+
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ public boolean isFacingValid(byte aFacing) {
+ return aFacing > 1;
+ }
+
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ public int getPollutionPerTick(ItemStack aStack) {
return this.mMode == 1 ? 12 : 24;
- }
-
+ }
+
@Override
public void saveNBTData(NBTTagCompound aNBT) {
aNBT.setByte("mMode", mMode);
+ aNBT.setInteger("mCasingTier", this.mCasingTier);
+ aNBT.setBoolean("mUpgraded", mUpgraded);
super.saveNBTData(aNBT);
}
@Override
public void loadNBTData(NBTTagCompound aNBT) {
mMode = aNBT.getByte("mMode");
+ mCasingTier = aNBT.getInteger("mCasingTier");
+ mUpgraded = aNBT.getBoolean("mUpgraded");
super.loadNBTData(aNBT);
- }
+ }
@Override
public String getSound() {
@@ -134,44 +133,44 @@ public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_M
}
}
- public int getDamageToComponent(ItemStack aStack) {
- return 0;
- }
-
- public boolean explodesOnComponentBreak(ItemStack aStack) {
- return false;
- }
-
- @Override
- public boolean addOutput(FluidStack aLiquid) {
- if (aLiquid == null) return false;
- FluidStack tLiquid = aLiquid.copy();
- for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) {
- if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? tHatch.outputsSteam() : tHatch.outputsLiquids()) {
- if (tHatch.getBaseMetaTileEntity().getYCoord() == this.mControllerY + 1) {
- int tAmount = tHatch.fill(tLiquid, false);
- if (tAmount >= tLiquid.amount) {
- return tHatch.fill(tLiquid, true) >= tLiquid.amount;
- } else if (tAmount > 0) {
- tLiquid.amount = tLiquid.amount - tHatch.fill(tLiquid, true);
- }
- }
- }
- }
- return false;
- }
-
- @Override
- protected void addFluidOutputs(FluidStack[] mOutputFluids2) {
- for (int i = 0; i < mOutputFluids2.length; i++) {
- if (mOutputHatches.size() > i && mOutputHatches.get(i) != null && mOutputFluids2[i] != null && isValidMetaTileEntity(mOutputHatches.get(i))) {
- if (mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord() == this.mControllerY + 1 + i) {
- mOutputHatches.get(i).fill(mOutputFluids2[i], true);
- }
- }
- }
-
- }
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean addOutput(FluidStack aLiquid) {
+ if (aLiquid == null) return false;
+ FluidStack tLiquid = aLiquid.copy();
+ for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) {
+ if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? tHatch.outputsSteam() : tHatch.outputsLiquids()) {
+ if (tHatch.getBaseMetaTileEntity().getYCoord() == this.mControllerY + 1) {
+ int tAmount = tHatch.fill(tLiquid, false);
+ if (tAmount >= tLiquid.amount) {
+ return tHatch.fill(tLiquid, true) >= tLiquid.amount;
+ } else if (tAmount > 0) {
+ tLiquid.amount = tLiquid.amount - tHatch.fill(tLiquid, true);
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ protected void addFluidOutputs(FluidStack[] mOutputFluids2) {
+ for (int i = 0; i < mOutputFluids2.length; i++) {
+ if (mOutputHatches.size() > i && mOutputHatches.get(i) != null && mOutputFluids2[i] != null && isValidMetaTileEntity(mOutputHatches.get(i))) {
+ if (mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord() == this.mControllerY + 1 + i) {
+ mOutputHatches.get(i).fill(mOutputFluids2[i], true);
+ }
+ }
+ }
+
+ }
@Override
public boolean hasSlotInGUI() {
@@ -192,34 +191,40 @@ public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_M
public String getMachineType() {
return "Distillery, Distillation Tower";
}
-
+
@Override
- public boolean checkRecipe(final ItemStack aStack) {
- for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) {
- ArrayList<ItemStack> tBusItems = new ArrayList<ItemStack>();
- tBus.mRecipeMap = getRecipeMap();
- if (isValidMetaTileEntity(tBus)) {
- for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) {
- if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null)
- tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i));
- }
- }
- ItemStack[] inputs = new ItemStack[tBusItems.size()];
- int slot = 0;
- for (ItemStack g : tBusItems) {
- inputs[slot++] = g;
- }
- if (inputs.length > 0) {
- int para = (4* GT_Utility.getTier(this.getMaxInputVoltage()));
- log("Recipe. ["+inputs.length+"]["+para+"]");
- if (checkRecipeGeneric(inputs, new FluidStack[]{}, para, 100, 250, 10000)) {
- log("Recipe 2.");
- return true;
- }
- }
+ public boolean checkRecipe(final ItemStack aStack) {
+ // Run standard recipe handling for distillery recipes
+ if (mMode == 1) {
+ return this.checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), 100);
+ }
+ else {
+ for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) {
+ ArrayList<ItemStack> tBusItems = new ArrayList<ItemStack>();
+ tBus.mRecipeMap = getRecipeMap();
+ if (isValidMetaTileEntity(tBus)) {
+ for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) {
+ if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null)
+ tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i));
+ }
+ }
+ ItemStack[] inputs = new ItemStack[tBusItems.size()];
+ int slot = 0;
+ for (ItemStack g : tBusItems) {
+ inputs[slot++] = g;
+ }
+ if (inputs.length > 0) {
+ int para = (4* GT_Utility.getTier(this.getMaxInputVoltage()));
+ log("Recipe. ["+inputs.length+"]["+para+"]");
+ if (checkRecipeGeneric(inputs, new FluidStack[]{}, para, 100, 250, 10000)) {
+ log("Recipe 2.");
+ return true;
+ }
+ }
+ }
+ return false;
}
- return false;
}
@Override
@@ -251,28 +256,28 @@ public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_M
}
return false;
}
-
+
private int getTierOfTower() {
- return 1;
+ return mUpgraded ? 2 : 1;
}
-
+
private boolean checkTierOneTower(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- mControllerY = aBaseMetaTileEntity.getYCoord();
- int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
- int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
- int y = 0; //height
- int casingAmount = 0;
- boolean reachedTop = false;
-
- for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width
+ mControllerY = aBaseMetaTileEntity.getYCoord();
+ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
+ int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
+ int y = 0; //height
+ int casingAmount = 0;
+ boolean reachedTop = false;
+
+ for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width
for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth
if (x != 0 || z != 0) {
IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z);
Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z);
- if (!addInputToMachineList(tileEntity, CASING_INDEX)
- && !addOutputToMachineList(tileEntity, CASING_INDEX)
- && !addMaintenanceToMachineList(tileEntity, CASING_INDEX)
- && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) {
+ if (!addInputToMachineList(tileEntity, getCasingTextureID())
+ && !addOutputToMachineList(tileEntity, getCasingTextureID())
+ && !addMaintenanceToMachineList(tileEntity, getCasingTextureID())
+ && !addEnergyInputToMachineList(tileEntity, getCasingTextureID())) {
if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) {
casingAmount++;
} else {
@@ -282,55 +287,55 @@ public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_M
}
}
}
- y++;
-
- while (y < 12 && !reachedTop) {
- for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width
- for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth
- IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z);
- Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z);
- if (aBaseMetaTileEntity.getAirOffset(x, y, z)) {
- if (x != xDir || z != zDir) {
- return false;
- }
- } else {
- if (x == xDir && z == zDir) {
- reachedTop = true;
- }
- if (!addOutputToMachineList(tileEntity, CASING_INDEX)
- && !addMaintenanceToMachineList(tileEntity, CASING_INDEX)
- && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) {
- if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) {
- casingAmount++;
- } else {
- return false;
- }
- }
- }
- }
- }
- y++;
- }
- return casingAmount >= 7 * y - 5 && y >= 3 && y <= 12 && reachedTop;
- }
-
+ y++;
+
+ while (y < 12 && !reachedTop) {
+ for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width
+ for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth
+ IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z);
+ Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z);
+ if (aBaseMetaTileEntity.getAirOffset(x, y, z)) {
+ if (x != xDir || z != zDir) {
+ return false;
+ }
+ } else {
+ if (x == xDir && z == zDir) {
+ reachedTop = true;
+ }
+ if (!addOutputToMachineList(tileEntity, getCasingTextureID())
+ && !addMaintenanceToMachineList(tileEntity, getCasingTextureID())
+ && !addEnergyInputToMachineList(tileEntity, getCasingTextureID())) {
+ if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) {
+ casingAmount++;
+ } else {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ y++;
+ }
+ return casingAmount >= 7 * y - 5 && y >= 3 && y <= 12 && reachedTop;
+ }
+
private boolean checkTierTwoTower(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- mControllerY = aBaseMetaTileEntity.getYCoord();
- int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
- int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
- int y = 0; //height
- int casingAmount = 0;
- boolean reachedTop = false;
-
- for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width
+ mControllerY = aBaseMetaTileEntity.getYCoord();
+ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
+ int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
+ int y = 0; //height
+ int casingAmount = 0;
+ boolean reachedTop = false;
+
+ for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width
for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth
if (x != 0 || z != 0) {
IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z);
Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z);
- if (!addInputToMachineList(tileEntity, CASING_INDEX)
- && !addOutputToMachineList(tileEntity, CASING_INDEX)
- && !addMaintenanceToMachineList(tileEntity, CASING_INDEX)
- && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) {
+ if (!addInputToMachineList(tileEntity, getCasingTextureID())
+ && !addOutputToMachineList(tileEntity, getCasingTextureID())
+ && !addMaintenanceToMachineList(tileEntity, getCasingTextureID())
+ && !addEnergyInputToMachineList(tileEntity, getCasingTextureID())) {
if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) {
casingAmount++;
} else {
@@ -340,36 +345,165 @@ public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_M
}
}
}
- y++;
-
- while (y < 12 && !reachedTop) {
- for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width
- for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth
- IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z);
- Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z);
- if (aBaseMetaTileEntity.getAirOffset(x, y, z)) {
- if (x != xDir || z != zDir) {
- return false;
- }
- } else {
- if (x == xDir && z == zDir) {
- reachedTop = true;
- }
- if (!addOutputToMachineList(tileEntity, CASING_INDEX)
- && !addMaintenanceToMachineList(tileEntity, CASING_INDEX)
- && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) {
- if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) {
- casingAmount++;
- } else {
- return false;
- }
- }
- }
- }
- }
- y++;
- }
- return casingAmount >= 7 * y - 5 && y >= 3 && y <= 12 && reachedTop;
- }
-
+ y++;
+
+ while (y < 12 && !reachedTop) {
+ for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width
+ for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth
+ IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z);
+ Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z);
+ if (aBaseMetaTileEntity.getAirOffset(x, y, z)) {
+ if (x != xDir || z != zDir) {
+ return false;
+ }
+ } else {
+ if (x == xDir && z == zDir) {
+ reachedTop = true;
+ }
+ if (!addOutputToMachineList(tileEntity, getCasingTextureID())
+ && !addMaintenanceToMachineList(tileEntity, getCasingTextureID())
+ && !addEnergyInputToMachineList(tileEntity, getCasingTextureID())) {
+ if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) {
+ casingAmount++;
+ } else {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ y++;
+ }
+ return casingAmount >= 7 * y - 5 && y >= 3 && y <= 12 && reachedTop;
+ }
+
+
+ private int mCasingTier = 0;
+
+ private int getMachineCasingTier() {
+ return mCasingTier;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+
+ ITexture aOriginalTexture;
+
+ // Check things exist client side (The worst code ever)
+ if (aBaseMetaTileEntity.getWorld() != null) {
+
+ }
+ // Check the Tier Client Side
+ int aTier = mCasingTier;
+
+ if (aTier == 0) {
+ aOriginalTexture = Textures.BlockIcons.CASING_BLOCKS[49];
+ }
+ else if (aTier == 1) {
+ aOriginalTexture = Textures.BlockIcons.CASING_BLOCKS[43];
+ }
+ else {
+ aOriginalTexture = Textures.BlockIcons.CASING_BLOCKS[49];
+ }
+
+ if (aSide == aFacing) {
+ return new ITexture[]{aOriginalTexture, new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER)};
+ }
+ return new ITexture[]{aOriginalTexture};
+ }
+
+ private int getCasingTextureID() {
+ // Check the Tier Client Side
+ int aTier = mCasingTier;
+
+ if (aTier == 1) {
+ return 49;
+ }
+ else if (aTier == 2) {
+ return 43;
+ }
+ else {
+ return 49;
+ }
+ }
+
+ public boolean addToMachineList(IGregTechTileEntity aTileEntity) {
+ int aMaxTier = getMachineCasingTier();
+ final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_TieredMachineBlock) {
+ GT_MetaTileEntity_TieredMachineBlock aMachineBlock = (GT_MetaTileEntity_TieredMachineBlock) aMetaTileEntity;
+ int aTileTier = aMachineBlock.mTier;
+ if (aTileTier > aMaxTier) {
+ Logger.INFO("Hatch tier too high.");
+ return false;
+ }
+ else {
+ return addToMachineList(aTileEntity, getCasingTextureID());
+ }
+ }
+ else {
+ Logger.INFO("Bad Tile Entity being added to hatch map."); // Shouldn't ever happen, but.. ya know..
+ return false;
+ }
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (aTick % 20 == 0 && !mUpgraded) {
+ ItemStack aGuiStack = this.getGUIItemStack();
+ if (aGuiStack != null) {
+ if (GT_Utility.areStacksEqual(aGuiStack, GregtechItemList.Distillus_Upgrade_Chip.get(1))) {
+ this.mUpgraded = true;
+ ItemUtils.depleteStack(aGuiStack);
+ }
+ }
+ }
+ // Silly Client Syncing
+ if (aBaseMetaTileEntity.isClientSide()) {
+ this.mCasingTier = getCasingTierOnClientSide();
+ }
+ }
+
+
+
+ @SideOnly(Side.CLIENT)
+ private final int getCasingTierOnClientSide() {
+ if (this == null || this.getBaseMetaTileEntity().getWorld() == null) {
+ return 0;
+ }
+ try {
+ Block aInitStructureCheck;
+ int aInitStructureCheckMeta;
+ IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity();
+ if (aBaseMetaTileEntity == null || aBaseMetaTileEntity.getWorld() == null || aBaseMetaTileEntity.getWorld().getChunkFromBlockCoords(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getZCoord()) == null) {
+ return 0;
+ }
+ for (int i=1;i<10;i++) {
+ aInitStructureCheck = aBaseMetaTileEntity.getBlockOffset(0, i, 0);
+ aInitStructureCheckMeta = aBaseMetaTileEntity.getMetaIDOffset(0, i, 0);
+ if (aInitStructureCheck == null) {
+ continue;
+ }
+ if (aInitStructureCheck == GregTech_API.sBlockCasings4 && aInitStructureCheckMeta == 1) {
+ return 0;
+ }
+ else if (aInitStructureCheck == ModBlocks.blockCasingsTieredGTPP) {
+ return 1;
+ }
+ }
+ }
+ catch (Throwable t) {
+ //t.printStackTrace();
+ }
+ return 0;
+
+ }
+
+ @Override
+ public void setItemNBT(NBTTagCompound aNBT) {
+ aNBT.setBoolean("mUpgraded", mUpgraded);
+ super.setItemNBT(aNBT);
+ }
+
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java
index b8e6d0c252..01243343b4 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java
@@ -154,11 +154,11 @@ public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase {
public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
if (aSide == aFacing) {
- return new ITexture[] { Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(28)],
+ return new ITexture[] { Textures.BlockIcons.CASING_BLOCKS[TAE.getIndexFromPage(0, 10)],
new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER_ACTIVE
: Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER) };
}
- return new ITexture[] { Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(28)] };
+ return new ITexture[] { Textures.BlockIcons.CASING_BLOCKS[TAE.getIndexFromPage(0, 10)] };
}
@Override
@@ -179,7 +179,7 @@ public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase {
Block aBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j);
int aMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j);
- if (!isValidBlockForStructure(tTileEntity, TAE.GTPP_INDEX(28), true, aBlock, aMeta,
+ if (!isValidBlockForStructure(tTileEntity, TAE.getIndexFromPage(0, 10), true, aBlock, aMeta,
ModBlocks.blockCasings2Misc, 12)) {
Logger.INFO("Bad Autcrafter casing");
return false;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java
index 6e7039f8ca..45077f4cf7 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java
@@ -251,7 +251,7 @@ extends GregtechMeta_MultiBlockBase
Block aBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j);
int aMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j);
- if (!isValidBlockForStructure(tTileEntity, 1, true, aBlock, aMeta,
+ if (!isValidBlockForStructure(tTileEntity, TAE.getIndexFromPage(0, 1), true, aBlock, aMeta,
ModBlocks.blockCasings2Misc, 11)) {
log("Bad Thermal Boiler casing");
return false;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java
index cb8b7590ee..579a26dc16 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java
@@ -87,18 +87,18 @@ public class GregtechMTE_MiniFusionPlant extends GregtechMeta_MultiBlockBase {
public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
if (aSide == this.getBaseMetaTileEntity().getBackFacing()) {
- return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(28)],
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(10)],
Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[(int) this.getInputTier()]};
}
if (aSide == 1) {
- return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(28)],
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(10)],
Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[(int) this.getOutputTier()]};
}
if (aSide == aFacing) {
- return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(28)],
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(10)],
new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER)};
}
- return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(28)]};
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(10)]};
}
@@ -166,7 +166,7 @@ public class GregtechMTE_MiniFusionPlant extends GregtechMeta_MultiBlockBase {
if (h != 0 || (xDir + i != 0 || zDir + j != 0) && (i != 0 || j != 0)) {
IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i,
h, zDir + j);
- if (this.addToMachineList(tTileEntity, TAE.GTPP_INDEX(28))) {
+ if (this.addToMachineList(tTileEntity, TAE.GTPP_INDEX(10))) {
tAmount++;
}
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java
index 6070e3604a..f7cf3839fb 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java
@@ -210,7 +210,7 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas
final int aMeta = getBaseMetaTileEntity().getMetaID(aX, aY, aZ);
final IGregTechTileEntity tTileEntity2 = getBaseMetaTileEntity().getIGregTechTileEntity(aX, aY, aZ);
- boolean debug = isValidBlockForStructure(tTileEntity2, TAE.GTPP_INDEX(26), true, aBlock, aMeta, getCasing(), getCasingMeta());
+ boolean debug = isValidBlockForStructure(tTileEntity2, 44, true, aBlock, aMeta, getCasing(), getCasingMeta());
/*if (!debug) {
this.getBaseMetaTileEntity().getWorld().setBlock(aX, aY, aZ, ModBlocks.blockCompressedObsidian);
@@ -275,12 +275,12 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
ITexture[] sTexture;
if (aSide == aFacing) {
- sTexture = new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_RADIATIONPROOF, Dyes.getModulation(-1, Dyes._NULL.mRGBa)), new GT_RenderedTexture(getIconOverlay())};
+ sTexture = new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[44], new GT_RenderedTexture(getIconOverlay())};
} else {
if (!aActive) {
- sTexture = new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_RADIATIONPROOF, Dyes.getModulation(-1, Dyes._NULL.mRGBa))};
+ sTexture = new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[44]};
} else {
- sTexture = new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_RADIATIONPROOF, Dyes.getModulation(-1, Dyes._NULL.mRGBa))};
+ sTexture = new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[44]};
}
}
return sTexture;
@@ -467,22 +467,22 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas
public boolean turnCasingActive(final boolean status) {
if (this.mEnergyHatches != null) {
for (final GT_MetaTileEntity_Hatch_Muffler hatch : this.mMufflerHatches) {
- hatch.mMachineBlock = status ? (byte) TAE.GTPP_INDEX(26) : (byte) TAE.GTPP_INDEX(26);
+ hatch.mMachineBlock = status ? (byte) 44 : (byte) 44;
}
}
if (this.mOutputHatches != null) {
for (final GT_MetaTileEntity_Hatch_Output hatch : this.mOutputHatches) {
- hatch.mMachineBlock = status ? (byte) TAE.GTPP_INDEX(26) : (byte) TAE.GTPP_INDEX(26);
+ hatch.mMachineBlock = status ? (byte) 44 : (byte) 44;
}
}
if (this.mInputHatches != null) {
for (final GT_MetaTileEntity_Hatch_Input hatch : this.mInputHatches) {
- hatch.mMachineBlock = status ? (byte) TAE.GTPP_INDEX(26) : (byte) TAE.GTPP_INDEX(26);
+ hatch.mMachineBlock = status ? (byte) 44 : (byte) 44;
}
}
if (this.mMaintenanceHatches != null) {
for (final GT_MetaTileEntity_Hatch_Maintenance hatch : this.mMaintenanceHatches) {
- hatch.mMachineBlock = status ? (byte) TAE.GTPP_INDEX(26) : (byte) TAE.GTPP_INDEX(26);
+ hatch.mMachineBlock = status ? (byte) 44 : (byte) 44;
}
}
return true;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java
new file mode 100644
index 0000000000..2425e86c30
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java
@@ -0,0 +1,317 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Materials;
+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_Hatch_Dynamo;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_LargeSemifluidGenerator extends GregtechMeta_MultiBlockBase {
+
+ protected int fuelConsumption = 0;
+ protected int fuelValue = 0;
+ protected int fuelRemaining = 0;
+ protected boolean boostEu = false;
+
+ public GregtechMetaTileEntity_LargeSemifluidGenerator(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_LargeSemifluidGenerator(String aName) {
+ super(aName);
+ }
+
+ public String[] getTooltip() {
+ return new String[]{
+ "Controller Block for the Large Semifluid Generator",
+ "Engine Intake Casings must not be obstructed in front (only air blocks)",
+ "Supply Semifluid Fuels and 2000L of Lubricant per hour to run.",
+ "Supply 80L of Oxygen per second to boost output (optional).",
+ "Default: Produces 2048EU/t at 100% efficiency",
+ "Boosted: Produces 6144EU/t at 150% efficiency",
+ "Size(WxHxD): 3x3x4, Controller (front centered)",
+ "3x3x4 of Stable Titanium Machine Casing (hollow, Min 16!)",
+ "All hatches except dynamo can replace any Stable Titanium casing in middle two segments",
+ "2x Steel Gear Box Machine Casing inside the Hollow Casing",
+ "8x Engine Intake Machine Casing (around controller)",
+ "2x Input Hatch (Fuel/Lubricant)",
+ "1x Maintenance Hatch",
+ "1x Muffler Hatch",
+ "1x Dynamo Hatch (back centered)",
+ };
+ }
+
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[50], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE)};
+ }
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[50]};
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return getMaxEfficiency(aStack) > 0;
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeDieselEngine.png");
+ }
+
+ @Override
+ public boolean checkRecipe(ItemStack aStack) {
+ ArrayList<FluidStack> tFluids = getStoredFluids();
+ Collection<GT_Recipe> tRecipeList = Gregtech_Recipe_Map.sSemiFluidLiquidFuels.mRecipeList;
+
+ if(tFluids.size() > 0 && tRecipeList != null) { //Does input hatch have a semifluid fuel?
+ for (FluidStack hatchFluid1 : tFluids) { //Loops through hatches
+ for(GT_Recipe aFuel : tRecipeList) { //Loops through semifluid fuel recipes
+ FluidStack tLiquid;
+ if ((tLiquid = GT_Utility.getFluidForFilledItem(aFuel.getRepresentativeInput(0), true)) != null) { //Create fluidstack from current recipe
+ if (hatchFluid1.isFluidEqual(tLiquid)) { //Has a semifluid fluid
+ fuelConsumption = tLiquid.amount = boostEu ? (4096 / aFuel.mSpecialValue) : (2048 / aFuel.mSpecialValue); //Calc fuel consumption
+ if(depleteInput(tLiquid)) { //Deplete that amount
+ boostEu = depleteInput(Materials.Oxygen.getGas(4L));
+ if(tFluids.contains(Materials.Lubricant.getFluid(2L))) { //Has lubricant?
+ //Deplete Lubricant. 2000L should = 1 hour of runtime (if baseEU = 2048)
+ if(mRuntime % 72 == 0 || mRuntime == 0) {
+ depleteInput(Materials.Lubricant.getFluid(boostEu ? 2 : 1));
+ }
+ }
+ else {
+ return false;
+ }
+
+ fuelValue = aFuel.mSpecialValue;
+ fuelRemaining = hatchFluid1.amount; //Record available fuel
+ this.mEUt = mEfficiency < 2000 ? 0 : 2048; //Output 0 if startup is less than 20%
+ this.mProgresstime = 1;
+ this.mMaxProgresstime = 1;
+ this.mEfficiencyIncrease = 15;
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ this.mEUt = 0;
+ this.mEfficiency = 0;
+ return false;
+ }
+
+ @Override
+ public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ byte tSide = aBaseMetaTileEntity.getBackFacing();
+ int aTileX = aBaseMetaTileEntity.getXCoord();
+ int aTileY = aBaseMetaTileEntity.getYCoord();
+ int aTileZ = aBaseMetaTileEntity.getZCoord();
+ boolean xFacing = (tSide == 4 || tSide == 5);
+ boolean zFacing = (tSide == 2 || tSide == 3);
+ int aCasingCount = 0;
+ // Check Intake Hatches
+ for (int aHorizontalOffset = -1; aHorizontalOffset < 2; aHorizontalOffset++) {
+ for (int aVerticalOffset = -1; aVerticalOffset < 2; aVerticalOffset++) {
+ if (aHorizontalOffset == 0 && aVerticalOffset == 0) {
+ continue;
+ }
+ int aX = !xFacing ? (aTileX + aHorizontalOffset) : aTileX;
+ int aY = aTileY + aVerticalOffset;
+ int aZ = !zFacing ? (aTileZ + aHorizontalOffset) : aTileZ;
+ Block aIntakeBlock = aBaseMetaTileEntity.getBlock(aX, aY, aZ);
+ int aIntakeMeta = aBaseMetaTileEntity.getMetaID(aX, aY, aZ);
+ if (!isValidBlockForStructure(null, 0, false, aIntakeBlock, aIntakeMeta, getIntakeBlock(), getIntakeMeta())) {
+ return false; // Not intake casing surrounding controller
+ }
+ }
+ }
+ // Check Casings
+ int aStartDepthOffset = (tSide == 2 || tSide == 4) ? -1 : 1;
+ int aFinishDepthOffset = (tSide == 2 || tSide == 4) ? -4 : 4;
+ for (int aDepthOffset = aStartDepthOffset; aDepthOffset != aFinishDepthOffset;) {
+ for (int aHorizontalOffset = -1; aHorizontalOffset < 2; aHorizontalOffset++) {
+ for (int aVerticalOffset = -1; aVerticalOffset < 2; aVerticalOffset++) {
+ if (aHorizontalOffset == 0 && aVerticalOffset == 0) {
+ continue;
+ }
+ int aX = !xFacing ? (aTileX + aHorizontalOffset) : (aTileX + aDepthOffset);
+ int aY = aTileY + aVerticalOffset;
+ int aZ = !zFacing ? (aTileZ + aHorizontalOffset) : (aTileZ + aDepthOffset);
+ Block aCasingBlock = aBaseMetaTileEntity.getBlock(aX, aY, aZ);
+ int aCasingMeta = aBaseMetaTileEntity.getMetaID(aX, aY, aZ);
+ IGregTechTileEntity aTileEntity = getBaseMetaTileEntity().getIGregTechTileEntity(aX, aY, aZ);
+ // Side areas
+ if (aDepthOffset < 3) {
+ if (!isValidBlockForStructure(aTileEntity, getCasingTextureIndex(), true, aCasingBlock, aCasingMeta, getCasingBlock(), getCasingMeta())) {
+ return false; // Not valid casing
+ }
+ else {
+ if (aTileEntity == null) {
+ aCasingCount++;
+ }
+ }
+ }
+ else {
+ if (!isValidBlockForStructure(null, 0, false, aCasingBlock, aCasingMeta, getCasingBlock(), getCasingMeta())) {
+ return false; // Not valid casing
+ }
+ else {
+ aCasingCount++;
+ }
+ }
+ }
+ }
+ // Count Backwards for 2 axis
+ if (aStartDepthOffset == -1) {
+ aDepthOffset--;
+ }
+ // Count Forwards for 2 axis
+ else {
+ aDepthOffset++;
+ }
+ }
+
+ // Check Gear Boxes
+ if(aBaseMetaTileEntity.getBlockAtSideAndDistance(tSide, 1) != getGearboxBlock() && aBaseMetaTileEntity.getBlockAtSideAndDistance(tSide, 2) != getGearboxBlock()) {
+ return false;
+ }
+ if(aBaseMetaTileEntity.getMetaIDAtSideAndDistance(tSide, 1) != getGearboxMeta() && aBaseMetaTileEntity.getMetaIDAtSideAndDistance(tSide, 2) != getGearboxMeta()) {
+ return false;
+ }
+
+ // Check Dynamo
+ this.mDynamoHatches.clear();
+ IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 3);
+ if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) {
+ if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Dynamo)) {
+ this.addDynamoToMachineList(tTileEntity, getCasingTextureIndex());
+ } else {
+ return false;
+ }
+ }
+ return aCasingCount >= 16;
+ }
+
+ public Block getCasingBlock() {
+ return GregTech_API.sBlockCasings4;
+ }
+
+ public byte getCasingMeta() {
+ return 2;
+ }
+
+ public Block getIntakeBlock() {
+ return GregTech_API.sBlockCasings4;
+ }
+
+ public byte getIntakeMeta() {
+ return 13;
+ }
+
+ public Block getGearboxBlock() {
+ return GregTech_API.sBlockCasings2;
+ }
+
+ public byte getGearboxMeta() {
+ return 3;
+ }
+
+ public byte getCasingTextureIndex() {
+ return 50;
+ }
+
+ private boolean addToMachineList(IGregTechTileEntity tTileEntity) {
+ return ((addMaintenanceToMachineList(tTileEntity, getCasingTextureIndex())) || (addInputToMachineList(tTileEntity, getCasingTextureIndex())) || (addOutputToMachineList(tTileEntity, getCasingTextureIndex())) || (addMufflerToMachineList(tTileEntity, getCasingTextureIndex())));
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_LargeSemifluidGenerator(this.mName);
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack) {
+ return 1;
+ }
+
+ public int getMaxEfficiency(ItemStack aStack) {
+ return boostEu ? 20000 : 10000;
+ }
+
+ @Override
+ public int getPollutionPerTick(ItemStack aStack) {
+ return 64;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public String[] getExtraInfoData() {
+ return new String[]{
+ "Large Semifluid Generator",
+ "Current Output: " + mEUt * mEfficiency / 10000 + " EU/t",
+ "Fuel Consumption: " + fuelConsumption + "L/t",
+ "Fuel Value: " + fuelValue + " EU/L",
+ "Fuel Remaining: " + fuelRemaining + " Litres",
+ "Current Efficiency: " + (mEfficiency / 100) + "%",
+ getIdealStatus() == getRepairStatus() ? "No Maintainance issues" : "Needs Maintainance"};
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Semifluid Generator";
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 0;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java
index 24db72fbe0..4a508f2f0f 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java
@@ -72,7 +72,7 @@ public class GregtechMetaTileEntity_Refinery extends GregtechMeta_MultiBlockBase
return "MatterFabricator";
}
- private static final GT_Recipe_Map mGregTypeRecipeMap = new GT_Recipe_Map(new HashSet<GT_Recipe>(), "internal.recipe.fissionfuel", "Fission Fuel Processing", null, RES_PATH_GUI + "basicmachines/FissionFuel", 0, 0, 0, 4, 1, E, 1, E, true, true);
+ private static final GT_Recipe_Map mGregTypeRecipeMap = new GT_Recipe_Map(new HashSet<GT_Recipe>(), "internal.recipe.fissionfuel", "Nuclear Fuel Processing", null, RES_PATH_GUI + "basicmachines/FissionFuel", 0, 0, 0, 4, 1, E, 1, E, true, false);
@Override
public GT_Recipe_Map getRecipeMap() {
@@ -242,6 +242,12 @@ public class GregtechMetaTileEntity_Refinery extends GregtechMeta_MultiBlockBase
(this.mOutputBusses.size() != 1) || (this.mMufflerHatches.size() != 1) ||
(this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() != 1)){
Logger.INFO("Wrong Hatch count.");
+ Logger.INFO("I-Hatch Count: "+this.mInputHatches.size());
+ Logger.INFO("O-Hatch Count: "+this.mOutputHatches.size());
+ Logger.INFO("O-Bus Count: "+this.mOutputBusses.size());
+ Logger.INFO("Muffler Count: "+this.mMufflerHatches.size());
+ Logger.INFO("Maint Count: "+this.mMaintenanceHatches.size());
+ Logger.INFO("Energy Count: "+this.mEnergyHatches.size());
return false;
}
if (this.mMufflerHatches.size() == 1){
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java
index 60c0ade62f..81d1581724 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java
@@ -1,12 +1,8 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.chemplant;
-import static gregtech.api.enums.GT_Values.E;
import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
-import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
import java.util.List;
import org.apache.commons.lang3.ArrayUtils;
@@ -14,28 +10,17 @@ import org.apache.commons.lang3.ArrayUtils;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.GregTech_API;
-import gregtech.api.enums.ItemList;
-import gregtech.api.enums.Materials;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
-import gregtech.api.objects.GT_ItemStack;
import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
-import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.Recipe_GT;
-import gtPlusPlus.api.helpers.GregtechPlusPlus_API.Multiblock_API;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
-import gtPlusPlus.api.objects.minecraft.multi.SpecialMultiBehaviour;
-import gtPlusPlus.core.item.chemistry.AgriculturalChem;
-import gtPlusPlus.core.item.chemistry.GenericChem;
-import gtPlusPlus.core.item.chemistry.general.ItemGenericChemBase;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.recipe.common.CI;
import gtPlusPlus.core.util.math.MathUtils;
@@ -45,7 +30,6 @@ import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
import gtPlusPlus.xmod.gregtech.common.StaticFields59;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import net.minecraft.block.Block;
-import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
@@ -755,7 +739,6 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase {
if (aBaseMetaTileEntity.isClientSide()) {
this.mSolidCasingTier = getCasingTierOnClientSide();
}
-
}
@Override
@@ -820,13 +803,13 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase {
int tMaxParrallelCatalyst = aMaxParallelRecipes;
ItemStack tCatalystRecipe = findCatalyst(tRecipe.mInputs);
if (tCatalystRecipe != null) {
- log("needs catalyst");
+ log("has catalyst");
tCatalysts = new ArrayList<ItemStack>();
tMaxParrallelCatalyst = getCatalysts(aItemInputs, tCatalystRecipe, aMaxParallelRecipes,tCatalysts);
}
if (tMaxParrallelCatalyst == 0) {
- log("found not enough catalists catalyst");
+ log("found not enough catalysts");
return false;
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java
index 535dfb3faa..a8af3dcb11 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java
@@ -1,32 +1,27 @@
package gtPlusPlus.xmod.gregtech.loaders;
-import gregtech.api.enums.TAE;
-import gregtech.api.enums.Textures;
-
-import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks;
import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks2;
import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks3;
import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks4;
+import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks5;
+import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaSpecialMultiCasings;
import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaTieredCasingBlocks1;
public class Gregtech_Blocks {
public static void run(){
-
- //Logger.INFO("Expanding Gregtech Texture Array from 128 -> 1024.");
- boolean didExpand = TAE.hookGtTextures();
- //Logger.INFO("Did Texture Array expand correctly? "+didExpand);
- Logger.INFO("|======| Texture Array Length: "+Textures.BlockIcons.CASING_BLOCKS.length+" |======|");
//Casing Blocks
ModBlocks.blockCasingsMisc = new GregtechMetaCasingBlocks();
ModBlocks.blockCasings2Misc = new GregtechMetaCasingBlocks2();
ModBlocks.blockCasings3Misc = new GregtechMetaCasingBlocks3();
ModBlocks.blockCasings4Misc = new GregtechMetaCasingBlocks4();
-
+ ModBlocks.blockCasings5Misc = new GregtechMetaCasingBlocks5();
+
ModBlocks.blockCasingsTieredGTPP = new GregtechMetaTieredCasingBlocks1();
+ ModBlocks.blockSpecialMultiCasings = new GregtechMetaSpecialMultiCasings();
}
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java
index 2b4e52abb9..3c74c4166d 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java
@@ -210,11 +210,11 @@ public class RecipeGen_Fluids extends RecipeGen_Base {
// Shape_Mold_Ring,
- ItemList mold_Rod = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Rod", null);
- ItemList mold_Rod_Long = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Rod_Long", null);
- ItemList mold_Bolt = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Bolt", null);
- ItemList mold_Screw = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Screw", null);
- ItemList mold_Ring = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Ring", null);
+ ItemList mold_Rod = ItemUtils.getValueOfItemList("Shape_Mold_Rod", null);
+ ItemList mold_Rod_Long = ItemUtils.getValueOfItemList("Shape_Mold_Rod_Long", null);
+ ItemList mold_Bolt = ItemUtils.getValueOfItemList("Shape_Mold_Bolt", null);
+ ItemList mold_Screw = ItemUtils.getValueOfItemList("Shape_Mold_Screw", null);
+ ItemList mold_Ring = ItemUtils.getValueOfItemList("Shape_Mold_Ring", null);
// Rod
if (ItemUtils.checkForInvalidItems(material.getRod(1)))
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java
index bb3d93172c..cc3130af98 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java
@@ -23,10 +23,12 @@ import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.material.MaterialGenerator;
import gtPlusPlus.core.recipe.common.CI;
import gtPlusPlus.core.util.data.ArrayUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.MaterialUtils;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
import gtPlusPlus.xmod.gregtech.api.interfaces.internal.IGregtech_RecipeAdder;
@@ -1183,6 +1185,11 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder {
@Override
public boolean addChemicalPlantRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int time, long eu, int aTier) {
+ return addChemicalPlantRecipe(aInputs, aInputFluids, aOutputs, aFluidOutputs, new int[] {}, time, eu, aTier);
+ }
+
+ @Override
+ public boolean addChemicalPlantRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int[] aChances, int time, long eu, int aTier) {
if (aInputs.length > 4 || aInputFluids.length > 4 || aOutputs.length > 4 || aFluidOutputs.length > 2) {
Logger.INFO("Inputs: "+ItemUtils.getArrayStackNames(aInputs));
@@ -1198,7 +1205,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder {
aInputs,
aOutputs,
null,
- new int[] {},
+ aChances,
aInputFluids,
aFluidOutputs,
time,
@@ -1304,6 +1311,93 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder {
}
+ @Override
+ public boolean addMillingRecipe(Materials aMat, int aEU) {
+ return addMillingRecipe(MaterialUtils.generateMaterialFromGtENUM(aMat), aEU);
+ }
+
+ @Override
+ public boolean addMillingRecipe(Material aMat, int aEU) {
+
+ ItemStack aOreStack = aMat.getOre(16);
+ ItemStack aCrushedStack = aMat.getCrushed(16);
+
+ ItemStack aMilledStackOres1 = aMat.getMilled(64);
+ ItemStack aMilledStackCrushed1 = aMat.getMilled(48);
+ ItemStack aMilledStackOres2 = aMat.getMilled(48);
+ ItemStack aMilledStackCrushed2 = aMat.getMilled(32);
+
+ ItemStack aMillingBall_Alumina = GregtechItemList.Milling_Ball_Alumina.get(0);
+ ItemStack aMillingBall_Soapstone = GregtechItemList.Milling_Ball_Soapstone.get(0);
+
+ // Inputs
+ ItemStack[] aInputsOre1 = new ItemStack[] {
+ CI.getNumberedCircuit(10),
+ aOreStack,
+ aMillingBall_Alumina
+ };
+
+ ItemStack[] aInputsOre2 = new ItemStack[] {
+ CI.getNumberedCircuit(11),
+ aOreStack,
+ aMillingBall_Soapstone
+ };
+
+ ItemStack[] aInputsCrushed1 = new ItemStack[] {
+ CI.getNumberedCircuit(10),
+ aCrushedStack,
+ aMillingBall_Alumina
+ };
+
+ ItemStack[] aInputsCrushed2 = new ItemStack[] {
+ CI.getNumberedCircuit(11),
+ aCrushedStack,
+ aMillingBall_Soapstone
+ };
+
+ // Outputs
+ ItemStack[] aOutputsOre1 = new ItemStack[] {
+ aMilledStackOres1
+ };
+
+ ItemStack[] aOutputsOre2 = new ItemStack[] {
+ aMilledStackOres2
+ };
+
+ ItemStack[] aOutputsCrushed1 = new ItemStack[] {
+ aMilledStackCrushed1
+ };
+
+ ItemStack[] aOutputsCrushed2 = new ItemStack[] {
+ aMilledStackCrushed2
+ };
+
+ ItemStack[][] aInputArray = new ItemStack[][] {aInputsOre1, aInputsOre2, aInputsCrushed1, aInputsCrushed2};
+ ItemStack[][] aOutputArray = new ItemStack[][] {aOutputsOre1, aOutputsOre2, aOutputsCrushed1, aOutputsCrushed2};
+ int[] aTime = new int[] {6000, 7500, 7500, 9000};
+
+ int aSize = Recipe_GT.Gregtech_Recipe_Map.sOreMillRecipes.mRecipeList.size();
+ int aSize2 = aSize;
+
+ for (int i=0;i<4;i++) {
+ Recipe_GT aOreRecipe = new Recipe_GT(
+ false,
+ aInputArray[i],
+ aOutputArray[i],
+ null,
+ new int[] {},
+ null,
+ null,
+ aTime[i],
+ aEU,
+ 0);
+ Recipe_GT.Gregtech_Recipe_Map.sOreMillRecipes.add(aOreRecipe);
+ }
+
+ aSize = Recipe_GT.Gregtech_Recipe_Map.sOreMillRecipes.mRecipeList.size();
+ return aSize > aSize2;
+ }
+
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java
index 3490e8d8be..5d2f5b414d 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java
@@ -197,7 +197,7 @@ public class GregtechComponentAssembler {
ItemStack Input[] = { wireStack, cableStack, rodStack, magrodStack };
return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF,
- ItemList.valueOf("Electric_Motor_" + GT_Values.VN[tier]).get(1), (tier * 40),
+ CI.getElectricMotor(tier, 1), (tier * 40),
((int) GT_Values.V[tier] / 16) * 15);
}
catch (Throwable t) {
@@ -213,12 +213,12 @@ public class GregtechComponentAssembler {
ItemStack rodStack = ItemUtils.getGregtechOreStack(OrePrefixes.stick, mat, 2);
ItemStack plateStack = ItemUtils.getGregtechOreStack(OrePrefixes.plate, mat, 3);
ItemStack gearStack = ItemUtils.getGregtechOreStack(OrePrefixes.gearGtSmall, mat, 1);
- ItemStack motorStack = ItemList.valueOf("Electric_Motor_" + GT_Values.VN[tier]).get(1);
+ ItemStack motorStack = CI.getElectricMotor(tier, 1);
ItemStack Input[] = { plateStack, cableStack, rodStack, gearStack, motorStack };
return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF,
- ItemList.valueOf("Electric_Piston_" + GT_Values.VN[tier]).get(1), (tier * 40),
+ CI.getElectricPiston(tier, 1), (tier * 40),
((int) GT_Values.V[tier] / 16) * 15);
}
catch (Throwable t) {
@@ -230,7 +230,7 @@ public class GregtechComponentAssembler {
try {
OrePrefixes prefixCable = OrePrefixes.cableGt01;
ItemStack cableStack = ItemUtils.getGregtechOreStack(prefixCable, cable, 1);
- ItemStack motorStack = ItemList.valueOf("Electric_Motor_" + GT_Values.VN[tier]).get(2);
+ ItemStack motorStack = CI.getElectricMotor(tier, 2);
boolean mAdd[];
final ArrayList<ItemStack> oreDictList = OreDictionary.getOres("plateAnyRubber");
if (!oreDictList.isEmpty()) {
@@ -241,7 +241,7 @@ public class GregtechComponentAssembler {
returnValue.stackSize = 6;
ItemStack Input[] = { cableStack, motorStack, returnValue };
mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF,
- ItemList.valueOf("Conveyor_Module_" + GT_Values.VN[tier]).get(1), (tier * 40),
+ CI.getConveyor(tier, 1), (tier * 40),
((int) GT_Values.V[tier] / 16) * 15);
}
int added = 0;
@@ -261,7 +261,7 @@ public class GregtechComponentAssembler {
ItemStack Input[] = { cableStack, motorStack,
ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateRubber", 6) };
return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF,
- ItemList.valueOf("Conveyor_Module_" + GT_Values.VN[tier]).get(1), (tier * 40),
+ CI.getConveyor(tier, 1), (tier * 40),
((int) GT_Values.V[tier] / 16) * 15);
}
@@ -277,7 +277,7 @@ public class GregtechComponentAssembler {
ItemStack screwStack = ItemUtils.getGregtechOreStack(OrePrefixes.screw, main, 1);
ItemStack rotorStack = ItemUtils.getGregtechOreStack(OrePrefixes.rotor, main, 1);
ItemStack pipeStack = ItemUtils.getGregtechOreStack(OrePrefixes.pipeMedium, pipe, 1);
- ItemStack motorStack = ItemList.valueOf("Electric_Motor_" + GT_Values.VN[tier]).get(1);
+ ItemStack motorStack = CI.getElectricMotor(tier, 1);
boolean mAdd[];
final ArrayList<ItemStack> oreDictList = OreDictionary.getOres("ringAnyRubber");
if (!oreDictList.isEmpty()) {
@@ -288,7 +288,7 @@ public class GregtechComponentAssembler {
returnValue.stackSize = 2;
ItemStack Input[] = { cableStack, screwStack, rotorStack, pipeStack, motorStack, returnValue };
mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF,
- ItemList.valueOf("Electric_Pump_" + GT_Values.VN[tier]).get(1), (tier * 40),
+ CI.getElectricPump(tier, 1), (tier * 40),
((int) GT_Values.V[tier] / 16) * 15);
}
int added = 0;
@@ -308,7 +308,7 @@ public class GregtechComponentAssembler {
ItemStack Input[] = { cableStack, screwStack, rotorStack, pipeStack, motorStack,
ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ringRubber", 2) };
return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF,
- ItemList.valueOf("Electric_Pump_" + GT_Values.VN[tier]).get(1), (tier * 40),
+ CI.getElectricPump(tier, 1), (tier * 40),
((int) GT_Values.V[tier] / 16) * 15);
}
@@ -322,8 +322,8 @@ public class GregtechComponentAssembler {
try {
ItemStack cableStack = ItemUtils.getGregtechOreStack(OrePrefixes.cableGt01, cable, 3);
ItemStack rodStack = ItemUtils.getGregtechOreStack(OrePrefixes.stick, stick, 2);
- ItemStack motorStack = ItemList.valueOf("Electric_Motor_" + GT_Values.VN[tier]).get(2);
- ItemStack pistonStack = ItemList.valueOf("Electric_Piston_" + GT_Values.VN[tier]).get(1);
+ ItemStack motorStack = CI.getElectricMotor(tier, 2);
+ ItemStack pistonStack = CI.getElectricPiston(tier, 1);
boolean mAdd[];
final ItemStack oreDictList[] = CI.getAllCircuitsOfTier(tier);
@@ -335,7 +335,7 @@ public class GregtechComponentAssembler {
returnValue.stackSize = 1;
ItemStack Input[] = { returnValue, cableStack, rodStack, pistonStack, motorStack };
mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF,
- ItemList.valueOf("Robot_Arm_" + GT_Values.VN[tier]).get(1), (tier * 40),
+ CI.getRobotArm(tier, 1), (tier * 40),
((int) GT_Values.V[tier] / 16) * 15);
}
for (boolean y : mAdd) {
@@ -353,7 +353,7 @@ public class GregtechComponentAssembler {
else {
ItemStack Input[] = { ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(tier), 1), cableStack, rodStack, pistonStack, motorStack };
return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF,
- ItemList.valueOf("Robot_Arm_" + GT_Values.VN[tier]).get(1), (tier * 40),
+ CI.getRobotArm(tier, 1), (tier * 40),
((int) GT_Values.V[tier] / 16) * 15);
}
@@ -381,8 +381,8 @@ public class GregtechComponentAssembler {
else
mWT = "01";
- ItemStack eyeQuantum = ItemList.valueOf("QuantumEye").get(1);
- ItemStack starQuantum = ItemList.valueOf("QuantumStar").get(1);
+ ItemStack eyeQuantum = ItemUtils.getValueOfItemList("QuantumEye", 1, ItemUtils.getSimpleStack(Items.ender_eye, 4));
+ ItemStack starQuantum = ItemUtils.getValueOfItemList("QuantumStar", 1, ItemUtils.getSimpleStack(Items.nether_star, 4));
if (tier == 1)
gem = ItemUtils.getSimpleStack(Items.ender_pearl);
@@ -410,7 +410,7 @@ public class GregtechComponentAssembler {
returnValue.stackSize = 4;
ItemStack Input[] = { returnValue, wireStack, gem };
mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF,
- ItemList.valueOf("Field_Generator_" + GT_Values.VN[tier]).get(1), (tier * 40),
+ CI.getFieldGenerator(tier, 1), (tier * 40),
((int) GT_Values.V[tier] / 16) * 15);
}
for (boolean y : mAdd) {
@@ -428,7 +428,7 @@ public class GregtechComponentAssembler {
else {
ItemStack Input[] = { ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(tier), 4), wireStack, gem };
return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF,
- ItemList.valueOf("Field_Generator_" + GT_Values.VN[tier]).get(1), (tier * 40),
+ CI.getFieldGenerator(tier, 1), (tier * 40),
((int) GT_Values.V[tier] / 16) * 15);
}
@@ -454,7 +454,7 @@ public class GregtechComponentAssembler {
returnValue.stackSize = 2;
ItemStack Input[] = { returnValue, cableStack, gemstack, magrodStack };
mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF,
- ItemList.valueOf("Emitter_" + GT_Values.VN[tier]).get(1), (tier * 40),
+ CI.getEmitter(tier, 1), (tier * 40),
((int) GT_Values.V[tier] / 16) * 15);
}
for (boolean y : mAdd) {
@@ -472,7 +472,7 @@ public class GregtechComponentAssembler {
else {
ItemStack Input[] = { ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(tier), 2), cableStack, gemstack, magrodStack };
return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF,
- ItemList.valueOf("Emitter_" + GT_Values.VN[tier]).get(1), (tier * 40),
+ CI.getEmitter(tier, 1), (tier * 40),
((int) GT_Values.V[tier] / 16) * 15);
}
@@ -500,7 +500,7 @@ public class GregtechComponentAssembler {
returnValue.stackSize = 1;
ItemStack Input[] = { gemStack, cableStack, returnValue, magrodStack };
mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF,
- ItemList.valueOf("Sensor_" + GT_Values.VN[tier]).get(1), (tier * 40),
+ CI.getSensor(tier, 1), (tier * 40),
((int) GT_Values.V[tier] / 16) * 15);
}
for (boolean y : mAdd) {
@@ -518,7 +518,7 @@ public class GregtechComponentAssembler {
else {
ItemStack Input[] = { gemStack, cableStack, magrodStack, ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(tier), 1) };
return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF,
- ItemList.valueOf("Sensor_" + GT_Values.VN[tier]).get(1), (tier * 40),
+ CI.getSensor(tier, 1), (tier * 40),
((int) GT_Values.V[tier] / 16) * 15);
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java
index 54e4fbf024..2c622b9d8e 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java
@@ -5,8 +5,8 @@ import java.lang.reflect.InvocationTargetException;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_AirIntake;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ControlCore;
@@ -23,12 +23,9 @@ public class GregtechCustomHatches {
if (gtPlusPlus.core.lib.LoadedMods.Gregtech) {
Logger.INFO("Gregtech5u Content | Registering Custom Fluid Hatches.");
run1();
-
- //No pollution in 5.08
- if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) {
+ if (PollutionUtils.isPollutionEnabled()) {
run2();
- }
-
+ }
run3();
}
}
@@ -201,32 +198,31 @@ public class GregtechCustomHatches {
Class<?> aBusEntity = aClass;
Constructor<?> constructor;
try {
- constructor = aBusEntity.getConstructor(int.class, String.class, String.class, int.class, int.class);
+ constructor = aBusEntity.getConstructor(int.class, String.class, String.class, int.class, int.class);
if (constructor != null) {
- Object aPipe;
+ Object aBus;
try {
- aPipe = constructor.newInstance(
+ aBus = constructor.newInstance(
aID, aUnlocalName,
aLocalName,
aTier,
(1+ aTier) * 32);
- if (aPipe == null) {
- //Logger.INFO("Failed to Generate "+aMaterial+" Hexadecuple pipes.");
+ if (aBus == null) {
+ Logger.INFO("Failed to Generate "+aLocalName+".");
}
else {
Logger.INFO("Generated "+aLocalName+".");
- return aPipe;
- //GT_OreDictUnificator.registerOre("pipeHexadecuple" + aMaterial, aPipe.getStackForm(1L));
+ return aBus;
}
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException
| InvocationTargetException e) {
- //Logger.INFO("Failed to Generate "+aMaterial+" Hexadecuple pipes. [Ecx]");
e.printStackTrace();
+ Logger.INFO("Failed to Generate "+aLocalName+".");
}
}
} catch (NoSuchMethodException | SecurityException e1) {
- // TODO Auto-generated catch block
e1.printStackTrace();
+ Logger.INFO("Failed to Generate "+aLocalName+".");
}
return null;
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java
index 86cbdb75fa..67c54a7699 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java
@@ -1,8 +1,10 @@
package gtPlusPlus.xmod.gregtech.registration.gregtech;
import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialVacuumFreezer;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_AssemblyLine;
import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_DistillationTower;
import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_EBF;
import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_Fusion_MK4;
@@ -24,6 +26,9 @@ public class GregtechFactoryGradeReplacementMultis {
//31021
GregtechItemList.Machine_Adv_DistillationTower.set(new GregtechMetaTileEntity_Adv_DistillationTower(31021, "multimachine.adv.distillationtower", "Dangote Distillus").getStackForm(1L));
+ if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) {
+ GregtechItemList.Machine_Adv_AssemblyLine.set(new GregtechMetaTileEntity_Adv_AssemblyLine(31024, "multimachine.adv.assemblyline", "Compound Fabricator").getStackForm(1L));
+ }
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFuelRefinery.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFuelRefinery.java
index 1787b57014..bbe23b542c 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFuelRefinery.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFuelRefinery.java
@@ -20,7 +20,7 @@ public class GregtechIndustrialFuelRefinery {
private static void run1() {
// Industrial Maceration Stack Multiblock
GregtechItemList.Industrial_FuelRefinery.set(new GregtechMetaTileEntity_Refinery(835,
- "industrialrefinery.controller.tier.single", "Fission Fuel Processing Plant").getStackForm(1L));
+ "industrialrefinery.controller.tier.single", "Reactor Fuel Processing Plant").getStackForm(1L));
}
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIsaMill.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIsaMill.java
new file mode 100644
index 0000000000..9c5fb483a7
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIsaMill.java
@@ -0,0 +1,14 @@
+package gtPlusPlus.xmod.gregtech.registration.gregtech;
+
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IsaMill;
+
+public class GregtechIsaMill {
+
+ public static void run(){
+
+ GregtechItemList.Controller_IsaMill_Controller.set(new GregtechMetaTileEntity_IsaMill(31027, "gtpp.multimachine.isamill", "IsaMill Grinding Machine").getStackForm(1L));
+
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java
index 2d548a57b7..5a7d3a50d7 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java
@@ -12,7 +12,7 @@ import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.lib.LoadedMods;
import gtPlusPlus.core.material.ALLOY;
import gtPlusPlus.core.recipe.common.CI;
-import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GregtechMetaTileEntityRocketFuelGenerator;
import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_LargeRocketEngine;
@@ -28,13 +28,13 @@ public class GregtechRocketFuelGenerator {
}
}
-
+
private static void run1() {
GregtechItemList.Controller_RocketEngine.set(
new GregtechMetaTileEntity_LargeRocketEngine(996, "gtpp.multimachine.rocketengine", "Rocketdyne F-1A Engine").getStackForm(1L));
- ItemList aDieselEngine = Utils.getValueOfItemList("Machine_Multi_DieselEngine", ItemList.Machine_Multi_LargeBoiler_TungstenSteel);
+ ItemList aDieselEngine = ItemUtils.getValueOfItemList("Machine_Multi_DieselEngine", ItemList.Machine_Multi_LargeBoiler_TungstenSteel);
GT_ModHandler.addCraftingRecipe(
GregtechItemList.Controller_RocketEngine.get(1L),
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSemiFluidgenerators.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSemiFluidgenerators.java
index c4141a6a77..6b38415db1 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSemiFluidgenerators.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSemiFluidgenerators.java
@@ -2,6 +2,7 @@ package gtPlusPlus.xmod.gregtech.registration.gregtech;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GT_MetaTileEntity_SemiFluidGenerator;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_LargeSemifluidGenerator;
public class GregtechSemiFluidgenerators {
@@ -12,6 +13,8 @@ public class GregtechSemiFluidgenerators {
"Advanced Semi-Fluid Generator", 2).getStackForm(1L));
GregtechItemList.Generator_SemiFluid_HV.set(new GT_MetaTileEntity_SemiFluidGenerator(839, "basicgenerator.semifluid.tier.03",
"Turbo Semi-Fluid Generator", 3).getStackForm(1L));
+ GregtechItemList.Controller_LargeSemifluidGenerator.set(new GregtechMetaTileEntity_LargeSemifluidGenerator(31026, "gtpp.multimachine.semifluidgenerator", "Large Semifluid Burner").getStackForm(1L));
+
}
}
diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java b/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java
index f23a5db6fe..4f1006693e 100644
--- a/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java
+++ b/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java
@@ -159,7 +159,9 @@ public class ThaumcraftUtils {
rResearch.setItemTriggers(aResearchTriggers);
rResearch.setHidden();
}
- rResearch.setPages((TC_ResearchPage_Wrapper[]) tPages.toArray(new TC_ResearchPage_Wrapper[tPages.size()]));
+
+ Object[] aVarArgs = (TC_ResearchPage_Wrapper[]) tPages.toArray(new TC_ResearchPage_Wrapper[tPages.size()]);
+ rResearch.setPages(aVarArgs);
return rResearch.registerResearchItem();
}
diff --git a/src/Java/sun/repackage/AccessorGenerator.java b/src/Java/sun/repackage/AccessorGenerator.java
new file mode 100644
index 0000000000..054d90be78
--- /dev/null
+++ b/src/Java/sun/repackage/AccessorGenerator.java
@@ -0,0 +1,715 @@
+/*
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.lang.reflect.*;
+
+/** Shared functionality for all accessor generators */
+
+class AccessorGenerator implements ClassFileConstants {
+ static final Unsafe unsafe = Unsafe.getUnsafe();
+
+ // Constants because there's no way to say "short integer constant",
+ // i.e., "1S"
+ protected static final short S0 = (short) 0;
+ protected static final short S1 = (short) 1;
+ protected static final short S2 = (short) 2;
+ protected static final short S3 = (short) 3;
+ protected static final short S4 = (short) 4;
+ protected static final short S5 = (short) 5;
+ protected static final short S6 = (short) 6;
+
+ // Instance variables for shared functionality between
+ // FieldAccessorGenerator and MethodAccessorGenerator
+ protected ClassFileAssembler asm;
+ protected int modifiers;
+ protected short thisClass;
+ protected short superClass;
+ protected short targetClass;
+ // Common constant pool entries to FieldAccessor and MethodAccessor
+ protected short throwableClass;
+ protected short classCastClass;
+ protected short nullPointerClass;
+ protected short illegalArgumentClass;
+ protected short invocationTargetClass;
+ protected short initIdx;
+ protected short initNameAndTypeIdx;
+ protected short initStringNameAndTypeIdx;
+ protected short nullPointerCtorIdx;
+ protected short illegalArgumentCtorIdx;
+ protected short illegalArgumentStringCtorIdx;
+ protected short invocationTargetCtorIdx;
+ protected short superCtorIdx;
+ protected short objectClass;
+ protected short toStringIdx;
+ protected short codeIdx;
+ protected short exceptionsIdx;
+ // Boxing
+ protected short booleanIdx;
+ protected short booleanCtorIdx;
+ protected short booleanUnboxIdx;
+ protected short byteIdx;
+ protected short byteCtorIdx;
+ protected short byteUnboxIdx;
+ protected short characterIdx;
+ protected short characterCtorIdx;
+ protected short characterUnboxIdx;
+ protected short doubleIdx;
+ protected short doubleCtorIdx;
+ protected short doubleUnboxIdx;
+ protected short floatIdx;
+ protected short floatCtorIdx;
+ protected short floatUnboxIdx;
+ protected short integerIdx;
+ protected short integerCtorIdx;
+ protected short integerUnboxIdx;
+ protected short longIdx;
+ protected short longCtorIdx;
+ protected short longUnboxIdx;
+ protected short shortIdx;
+ protected short shortCtorIdx;
+ protected short shortUnboxIdx;
+
+ protected final short NUM_COMMON_CPOOL_ENTRIES = (short) 30;
+ protected final short NUM_BOXING_CPOOL_ENTRIES = (short) 72;
+
+ // Requires that superClass has been set up
+ protected void emitCommonConstantPoolEntries() {
+ // + [UTF-8] "java/lang/Throwable"
+ // + [CONSTANT_Class_info] for above
+ // + [UTF-8] "java/lang/ClassCastException"
+ // + [CONSTANT_Class_info] for above
+ // + [UTF-8] "java/lang/NullPointerException"
+ // + [CONSTANT_Class_info] for above
+ // + [UTF-8] "java/lang/IllegalArgumentException"
+ // + [CONSTANT_Class_info] for above
+ // + [UTF-8] "java/lang/InvocationTargetException"
+ // + [CONSTANT_Class_info] for above
+ // + [UTF-8] "<init>"
+ // + [UTF-8] "()V"
+ // + [CONSTANT_NameAndType_info] for above
+ // + [CONSTANT_Methodref_info] for NullPointerException's constructor
+ // + [CONSTANT_Methodref_info] for IllegalArgumentException's constructor
+ // + [UTF-8] "(Ljava/lang/String;)V"
+ // + [CONSTANT_NameAndType_info] for "<init>(Ljava/lang/String;)V"
+ // + [CONSTANT_Methodref_info] for IllegalArgumentException's constructor taking a String
+ // + [UTF-8] "(Ljava/lang/Throwable;)V"
+ // + [CONSTANT_NameAndType_info] for "<init>(Ljava/lang/Throwable;)V"
+ // + [CONSTANT_Methodref_info] for InvocationTargetException's constructor
+ // + [CONSTANT_Methodref_info] for "super()"
+ // + [UTF-8] "java/lang/Object"
+ // + [CONSTANT_Class_info] for above
+ // + [UTF-8] "toString"
+ // + [UTF-8] "()Ljava/lang/String;"
+ // + [CONSTANT_NameAndType_info] for "toString()Ljava/lang/String;"
+ // + [CONSTANT_Methodref_info] for Object's toString method
+ // + [UTF-8] "Code"
+ // + [UTF-8] "Exceptions"
+ asm.emitConstantPoolUTF8("java/lang/Throwable");
+ asm.emitConstantPoolClass(asm.cpi());
+ throwableClass = asm.cpi();
+ asm.emitConstantPoolUTF8("java/lang/ClassCastException");
+ asm.emitConstantPoolClass(asm.cpi());
+ classCastClass = asm.cpi();
+ asm.emitConstantPoolUTF8("java/lang/NullPointerException");
+ asm.emitConstantPoolClass(asm.cpi());
+ nullPointerClass = asm.cpi();
+ asm.emitConstantPoolUTF8("java/lang/IllegalArgumentException");
+ asm.emitConstantPoolClass(asm.cpi());
+ illegalArgumentClass = asm.cpi();
+ asm.emitConstantPoolUTF8("java/lang/reflect/InvocationTargetException");
+ asm.emitConstantPoolClass(asm.cpi());
+ invocationTargetClass = asm.cpi();
+ asm.emitConstantPoolUTF8("<init>");
+ initIdx = asm.cpi();
+ asm.emitConstantPoolUTF8("()V");
+ asm.emitConstantPoolNameAndType(initIdx, asm.cpi());
+ initNameAndTypeIdx = asm.cpi();
+ asm.emitConstantPoolMethodref(nullPointerClass, initNameAndTypeIdx);
+ nullPointerCtorIdx = asm.cpi();
+ asm.emitConstantPoolMethodref(illegalArgumentClass, initNameAndTypeIdx);
+ illegalArgumentCtorIdx = asm.cpi();
+ asm.emitConstantPoolUTF8("(Ljava/lang/String;)V");
+ asm.emitConstantPoolNameAndType(initIdx, asm.cpi());
+ initStringNameAndTypeIdx = asm.cpi();
+ asm.emitConstantPoolMethodref(illegalArgumentClass, initStringNameAndTypeIdx);
+ illegalArgumentStringCtorIdx = asm.cpi();
+ asm.emitConstantPoolUTF8("(Ljava/lang/Throwable;)V");
+ asm.emitConstantPoolNameAndType(initIdx, asm.cpi());
+ asm.emitConstantPoolMethodref(invocationTargetClass, asm.cpi());
+ invocationTargetCtorIdx = asm.cpi();
+ asm.emitConstantPoolMethodref(superClass, initNameAndTypeIdx);
+ superCtorIdx = asm.cpi();
+ asm.emitConstantPoolUTF8("java/lang/Object");
+ asm.emitConstantPoolClass(asm.cpi());
+ objectClass = asm.cpi();
+ asm.emitConstantPoolUTF8("toString");
+ asm.emitConstantPoolUTF8("()Ljava/lang/String;");
+ asm.emitConstantPoolNameAndType(sub(asm.cpi(), S1), asm.cpi());
+ asm.emitConstantPoolMethodref(objectClass, asm.cpi());
+ toStringIdx = asm.cpi();
+ asm.emitConstantPoolUTF8("Code");
+ codeIdx = asm.cpi();
+ asm.emitConstantPoolUTF8("Exceptions");
+ exceptionsIdx = asm.cpi();
+ }
+
+ /** Constant pool entries required to be able to box/unbox primitive
+ types. Note that we don't emit these if we don't need them. */
+ protected void emitBoxingContantPoolEntries() {
+ // * [UTF-8] "java/lang/Boolean"
+ // * [CONSTANT_Class_info] for above
+ // * [UTF-8] "(Z)V"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "booleanValue"
+ // * [UTF-8] "()Z"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "java/lang/Byte"
+ // * [CONSTANT_Class_info] for above
+ // * [UTF-8] "(B)V"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "byteValue"
+ // * [UTF-8] "()B"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "java/lang/Character"
+ // * [CONSTANT_Class_info] for above
+ // * [UTF-8] "(C)V"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "charValue"
+ // * [UTF-8] "()C"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "java/lang/Double"
+ // * [CONSTANT_Class_info] for above
+ // * [UTF-8] "(D)V"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "doubleValue"
+ // * [UTF-8] "()D"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "java/lang/Float"
+ // * [CONSTANT_Class_info] for above
+ // * [UTF-8] "(F)V"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "floatValue"
+ // * [UTF-8] "()F"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "java/lang/Integer"
+ // * [CONSTANT_Class_info] for above
+ // * [UTF-8] "(I)V"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "intValue"
+ // * [UTF-8] "()I"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "java/lang/Long"
+ // * [CONSTANT_Class_info] for above
+ // * [UTF-8] "(J)V"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "longValue"
+ // * [UTF-8] "()J"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "java/lang/Short"
+ // * [CONSTANT_Class_info] for above
+ // * [UTF-8] "(S)V"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "shortValue"
+ // * [UTF-8] "()S"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // Boolean
+ asm.emitConstantPoolUTF8("java/lang/Boolean");
+ asm.emitConstantPoolClass(asm.cpi());
+ booleanIdx = asm.cpi();
+ asm.emitConstantPoolUTF8("(Z)V");
+ asm.emitConstantPoolNameAndType(initIdx, asm.cpi());
+ asm.emitConstantPoolMethodref(sub(asm.cpi(), S2), asm.cpi());
+ booleanCtorIdx = asm.cpi();
+ asm.emitConstantPoolUTF8("booleanValue");
+ asm.emitConstantPoolUTF8("()Z");
+ asm.emitConstantPoolNameAndType(sub(asm.cpi(), S1), asm.cpi());
+ asm.emitConstantPoolMethodref(sub(asm.cpi(), S6), asm.cpi());
+ booleanUnboxIdx = asm.cpi();
+
+ // Byte
+ asm.emitConstantPoolUTF8("java/lang/Byte");
+ asm.emitConstantPoolClass(asm.cpi());
+ byteIdx = asm.cpi();
+ asm.emitConstantPoolUTF8("(B)V");
+ asm.emitConstantPoolNameAndType(initIdx, asm.cpi());
+ asm.emitConstantPoolMethodref(sub(asm.cpi(), S2), asm.cpi());
+ byteCtorIdx = asm.cpi();
+ asm.emitConstantPoolUTF8("byteValue");
+ asm.emitConstantPoolUTF8("()B");
+ asm.emitConstantPoolNameAndType(sub(asm.cpi(), S1), asm.cpi());
+ asm.emitConstantPoolMethodref(sub(asm.cpi(), S6), asm.cpi());
+ byteUnboxIdx = asm.cpi();
+
+ // Character
+ asm.emitConstantPoolUTF8("java/lang/Character");
+ asm.emitConstantPoolClass(asm.cpi());
+ characterIdx = asm.cpi();
+ asm.emitConstantPoolUTF8("(C)V");
+ asm.emitConstantPoolNameAndType(initIdx, asm.cpi());
+ asm.emitConstantPoolMethodref(sub(asm.cpi(), S2), asm.cpi());
+ characterCtorIdx = asm.cpi();
+ asm.emitConstantPoolUTF8("charValue");
+ asm.emitConstantPoolUTF8("()C");
+ asm.emitConstantPoolNameAndType(sub(asm.cpi(), S1), asm.cpi());
+ asm.emitConstantPoolMethodref(sub(asm.cpi(), S6), asm.cpi());
+ characterUnboxIdx = asm.cpi();
+
+ // Double
+ asm.emitConstantPoolUTF8("java/lang/Double");
+ asm.emitConstantPoolClass(asm.cpi());
+ doubleIdx = asm.cpi();
+ asm.emitConstantPoolUTF8("(D)V");
+ asm.emitConstantPoolNameAndType(initIdx, asm.cpi());
+ asm.emitConstantPoolMethodref(sub(asm.cpi(), S2), asm.cpi());
+ doubleCtorIdx = asm.cpi();
+ asm.emitConstantPoolUTF8("doubleValue");
+ asm.emitConstantPoolUTF8("()D");
+ asm.emitConstantPoolNameAndType(sub(asm.cpi(), S1), asm.cpi());
+ asm.emitConstantPoolMethodref(sub(asm.cpi(), S6), asm.cpi());
+ doubleUnboxIdx = asm.cpi();
+
+ // Float
+ asm.emitConstantPoolUTF8("java/lang/Float");
+ asm.emitConstantPoolClass(asm.cpi());
+ floatIdx = asm.cpi();
+ asm.emitConstantPoolUTF8("(F)V");
+ asm.emitConstantPoolNameAndType(initIdx, asm.cpi());
+ asm.emitConstantPoolMethodref(sub(asm.cpi(), S2), asm.cpi());
+ floatCtorIdx = asm.cpi();
+ asm.emitConstantPoolUTF8("floatValue");
+ asm.emitConstantPoolUTF8("()F");
+ asm.emitConstantPoolNameAndType(sub(asm.cpi(), S1), asm.cpi());
+ asm.emitConstantPoolMethodref(sub(asm.cpi(), S6), asm.cpi());
+ floatUnboxIdx = asm.cpi();
+
+ // Integer
+ asm.emitConstantPoolUTF8("java/lang/Integer");
+ asm.emitConstantPoolClass(asm.cpi());
+ integerIdx = asm.cpi();
+ asm.emitConstantPoolUTF8("(I)V");
+ asm.emitConstantPoolNameAndType(initIdx, asm.cpi());
+ asm.emitConstantPoolMethodref(sub(asm.cpi(), S2), asm.cpi());
+ integerCtorIdx = asm.cpi();
+ asm.emitConstantPoolUTF8("intValue");
+ asm.emitConstantPoolUTF8("()I");
+ asm.emitConstantPoolNameAndType(sub(asm.cpi(), S1), asm.cpi());
+ asm.emitConstantPoolMethodref(sub(asm.cpi(), S6), asm.cpi());
+ integerUnboxIdx = asm.cpi();
+
+ // Long
+ asm.emitConstantPoolUTF8("java/lang/Long");
+ asm.emitConstantPoolClass(asm.cpi());
+ longIdx = asm.cpi();
+ asm.emitConstantPoolUTF8("(J)V");
+ asm.emitConstantPoolNameAndType(initIdx, asm.cpi());
+ asm.emitConstantPoolMethodref(sub(asm.cpi(), S2), asm.cpi());
+ longCtorIdx = asm.cpi();
+ asm.emitConstantPoolUTF8("longValue");
+ asm.emitConstantPoolUTF8("()J");
+ asm.emitConstantPoolNameAndType(sub(asm.cpi(), S1), asm.cpi());
+ asm.emitConstantPoolMethodref(sub(asm.cpi(), S6), asm.cpi());
+ longUnboxIdx = asm.cpi();
+
+ // Short
+ asm.emitConstantPoolUTF8("java/lang/Short");
+ asm.emitConstantPoolClass(asm.cpi());
+ shortIdx = asm.cpi();
+ asm.emitConstantPoolUTF8("(S)V");
+ asm.emitConstantPoolNameAndType(initIdx, asm.cpi());
+ asm.emitConstantPoolMethodref(sub(asm.cpi(), S2), asm.cpi());
+ shortCtorIdx = asm.cpi();
+ asm.emitConstantPoolUTF8("shortValue");
+ asm.emitConstantPoolUTF8("()S");
+ asm.emitConstantPoolNameAndType(sub(asm.cpi(), S1), asm.cpi());
+ asm.emitConstantPoolMethodref(sub(asm.cpi(), S6), asm.cpi());
+ shortUnboxIdx = asm.cpi();
+ }
+
+ // Necessary because of Java's annoying promotion rules
+ protected static short add(short s1, short s2) {
+ return (short) (s1 + s2);
+ }
+
+ protected static short sub(short s1, short s2) {
+ return (short) (s1 - s2);
+ }
+
+ protected boolean isStatic() {
+ return Modifier.isStatic(modifiers);
+ }
+
+ protected boolean isPrivate() {
+ return Modifier.isPrivate(modifiers);
+ }
+
+ /** Returns class name in "internal" form (i.e., '/' separators
+ instead of '.') */
+ protected static String getClassName
+ (Class<?> c, boolean addPrefixAndSuffixForNonPrimitiveTypes)
+ {
+ if (c.isPrimitive()) {
+ if (c == Boolean.TYPE) {
+ return "Z";
+ } else if (c == Byte.TYPE) {
+ return "B";
+ } else if (c == Character.TYPE) {
+ return "C";
+ } else if (c == Double.TYPE) {
+ return "D";
+ } else if (c == Float.TYPE) {
+ return "F";
+ } else if (c == Integer.TYPE) {
+ return "I";
+ } else if (c == Long.TYPE) {
+ return "J";
+ } else if (c == Short.TYPE) {
+ return "S";
+ } else if (c == Void.TYPE) {
+ return "V";
+ }
+ throw new InternalError("Should have found primitive type");
+ } else if (c.isArray()) {
+ return "[" + getClassName(c.getComponentType(), true);
+ } else {
+ if (addPrefixAndSuffixForNonPrimitiveTypes) {
+ return internalize("L" + c.getName() + ";");
+ } else {
+ return internalize(c.getName());
+ }
+ }
+ }
+
+ private static String internalize(String className) {
+ return className.replace('.', '/');
+ }
+
+ protected void emitConstructor() {
+ // Generate code into fresh code buffer
+ ClassFileAssembler cb = new ClassFileAssembler();
+ // 0 incoming arguments
+ cb.setMaxLocals(1);
+ cb.opc_aload_0();
+ cb.opc_invokespecial(superCtorIdx, 0, 0);
+ cb.opc_return();
+
+ // Emit method
+ emitMethod(initIdx, cb.getMaxLocals(), cb, null, null);
+ }
+
+ // The descriptor's index in the constant pool must be (1 +
+ // nameIdx). "numArgs" must indicate ALL arguments, including the
+ // implicit "this" argument; double and long arguments each count
+ // as 2 in this count. The code buffer must NOT contain the code
+ // length. The exception table may be null, but if non-null must
+ // NOT contain the exception table's length. The checked exception
+ // indices may be null.
+ protected void emitMethod(short nameIdx,
+ int numArgs,
+ ClassFileAssembler code,
+ ClassFileAssembler exceptionTable,
+ short[] checkedExceptionIndices)
+ {
+ int codeLen = code.getLength();
+ int excLen = 0;
+ if (exceptionTable != null) {
+ excLen = exceptionTable.getLength();
+ if ((excLen % 8) != 0) {
+ throw new IllegalArgumentException("Illegal exception table");
+ }
+ }
+ int attrLen = 12 + codeLen + excLen;
+ excLen = excLen / 8; // No-op if no exception table
+
+ asm.emitShort(ACC_PUBLIC);
+ asm.emitShort(nameIdx);
+ asm.emitShort(add(nameIdx, S1));
+ if (checkedExceptionIndices == null) {
+ // Code attribute only
+ asm.emitShort(S1);
+ } else {
+ // Code and Exceptions attributes
+ asm.emitShort(S2);
+ }
+ // Code attribute
+ asm.emitShort(codeIdx);
+ asm.emitInt(attrLen);
+ asm.emitShort(code.getMaxStack());
+ asm.emitShort((short) Math.max(numArgs, code.getMaxLocals()));
+ asm.emitInt(codeLen);
+ asm.append(code);
+ asm.emitShort((short) excLen);
+ if (exceptionTable != null) {
+ asm.append(exceptionTable);
+ }
+ asm.emitShort(S0); // No additional attributes for Code attribute
+ if (checkedExceptionIndices != null) {
+ // Exceptions attribute
+ asm.emitShort(exceptionsIdx);
+ asm.emitInt(2 + 2 * checkedExceptionIndices.length);
+ asm.emitShort((short) checkedExceptionIndices.length);
+ for (int i = 0; i < checkedExceptionIndices.length; i++) {
+ asm.emitShort(checkedExceptionIndices[i]);
+ }
+ }
+ }
+
+ protected short indexForPrimitiveType(Class<?> type) {
+ if (type == Boolean.TYPE) {
+ return booleanIdx;
+ } else if (type == Byte.TYPE) {
+ return byteIdx;
+ } else if (type == Character.TYPE) {
+ return characterIdx;
+ } else if (type == Double.TYPE) {
+ return doubleIdx;
+ } else if (type == Float.TYPE) {
+ return floatIdx;
+ } else if (type == Integer.TYPE) {
+ return integerIdx;
+ } else if (type == Long.TYPE) {
+ return longIdx;
+ } else if (type == Short.TYPE) {
+ return shortIdx;
+ }
+ throw new InternalError("Should have found primitive type");
+ }
+
+ protected short ctorIndexForPrimitiveType(Class<?> type) {
+ if (type == Boolean.TYPE) {
+ return booleanCtorIdx;
+ } else if (type == Byte.TYPE) {
+ return byteCtorIdx;
+ } else if (type == Character.TYPE) {
+ return characterCtorIdx;
+ } else if (type == Double.TYPE) {
+ return doubleCtorIdx;
+ } else if (type == Float.TYPE) {
+ return floatCtorIdx;
+ } else if (type == Integer.TYPE) {
+ return integerCtorIdx;
+ } else if (type == Long.TYPE) {
+ return longCtorIdx;
+ } else if (type == Short.TYPE) {
+ return shortCtorIdx;
+ }
+ throw new InternalError("Should have found primitive type");
+ }
+
+ /** Returns true for widening or identity conversions for primitive
+ types only */
+ protected static boolean canWidenTo(Class<?> type, Class<?> otherType) {
+ if (!type.isPrimitive()) {
+ return false;
+ }
+
+ // Widening conversions (from JVM spec):
+ // byte to short, int, long, float, or double
+ // short to int, long, float, or double
+ // char to int, long, float, or double
+ // int to long, float, or double
+ // long to float or double
+ // float to double
+
+ if (type == Boolean.TYPE) {
+ if (otherType == Boolean.TYPE) {
+ return true;
+ }
+ } else if (type == Byte.TYPE) {
+ if ( otherType == Byte.TYPE
+ || otherType == Short.TYPE
+ || otherType == Integer.TYPE
+ || otherType == Long.TYPE
+ || otherType == Float.TYPE
+ || otherType == Double.TYPE) {
+ return true;
+ }
+ } else if (type == Short.TYPE) {
+ if ( otherType == Short.TYPE
+ || otherType == Integer.TYPE
+ || otherType == Long.TYPE
+ || otherType == Float.TYPE
+ || otherType == Double.TYPE) {
+ return true;
+ }
+ } else if (type == Character.TYPE) {
+ if ( otherType == Character.TYPE
+ || otherType == Integer.TYPE
+ || otherType == Long.TYPE
+ || otherType == Float.TYPE
+ || otherType == Double.TYPE) {
+ return true;
+ }
+ } else if (type == Integer.TYPE) {
+ if ( otherType == Integer.TYPE
+ || otherType == Long.TYPE
+ || otherType == Float.TYPE
+ || otherType == Double.TYPE) {
+ return true;
+ }
+ } else if (type == Long.TYPE) {
+ if ( otherType == Long.TYPE
+ || otherType == Float.TYPE
+ || otherType == Double.TYPE) {
+ return true;
+ }
+ } else if (type == Float.TYPE) {
+ if ( otherType == Float.TYPE
+ || otherType == Double.TYPE) {
+ return true;
+ }
+ } else if (type == Double.TYPE) {
+ if (otherType == Double.TYPE) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /** Emits the widening bytecode for the given primitive conversion
+ (or none if the identity conversion). Requires that a primitive
+ conversion exists; i.e., canWidenTo must have already been
+ called and returned true. */
+ protected static void emitWideningBytecodeForPrimitiveConversion
+ (ClassFileAssembler cb,
+ Class<?> fromType,
+ Class<?> toType)
+ {
+ // Note that widening conversions for integral types (i.e., "b2s",
+ // "s2i") are no-ops since values on the Java stack are
+ // sign-extended.
+
+ // Widening conversions (from JVM spec):
+ // byte to short, int, long, float, or double
+ // short to int, long, float, or double
+ // char to int, long, float, or double
+ // int to long, float, or double
+ // long to float or double
+ // float to double
+
+ if ( fromType == Byte.TYPE
+ || fromType == Short.TYPE
+ || fromType == Character.TYPE
+ || fromType == Integer.TYPE) {
+ if (toType == Long.TYPE) {
+ cb.opc_i2l();
+ } else if (toType == Float.TYPE) {
+ cb.opc_i2f();
+ } else if (toType == Double.TYPE) {
+ cb.opc_i2d();
+ }
+ } else if (fromType == Long.TYPE) {
+ if (toType == Float.TYPE) {
+ cb.opc_l2f();
+ } else if (toType == Double.TYPE) {
+ cb.opc_l2d();
+ }
+ } else if (fromType == Float.TYPE) {
+ if (toType == Double.TYPE) {
+ cb.opc_f2d();
+ }
+ }
+
+ // Otherwise, was identity or no-op conversion. Fall through.
+ }
+
+ protected short unboxingMethodForPrimitiveType(Class<?> primType) {
+ if (primType == Boolean.TYPE) {
+ return booleanUnboxIdx;
+ } else if (primType == Byte.TYPE) {
+ return byteUnboxIdx;
+ } else if (primType == Character.TYPE) {
+ return characterUnboxIdx;
+ } else if (primType == Short.TYPE) {
+ return shortUnboxIdx;
+ } else if (primType == Integer.TYPE) {
+ return integerUnboxIdx;
+ } else if (primType == Long.TYPE) {
+ return longUnboxIdx;
+ } else if (primType == Float.TYPE) {
+ return floatUnboxIdx;
+ } else if (primType == Double.TYPE) {
+ return doubleUnboxIdx;
+ }
+ throw new InternalError("Illegal primitive type " + primType.getName());
+ }
+
+ protected static final Class<?>[] primitiveTypes = new Class<?>[] {
+ Boolean.TYPE,
+ Byte.TYPE,
+ Character.TYPE,
+ Short.TYPE,
+ Integer.TYPE,
+ Long.TYPE,
+ Float.TYPE,
+ Double.TYPE
+ };
+
+ /** We don't consider "Void" to be a primitive type */
+ protected static boolean isPrimitive(Class<?> c) {
+ return (c.isPrimitive() && c != Void.TYPE);
+ }
+
+ protected int typeSizeInStackSlots(Class<?> c) {
+ if (c == Void.TYPE) {
+ return 0;
+ }
+ if (c == Long.TYPE || c == Double.TYPE) {
+ return 2;
+ }
+ return 1;
+ }
+
+ private ClassFileAssembler illegalArgumentCodeBuffer;
+ protected ClassFileAssembler illegalArgumentCodeBuffer() {
+ if (illegalArgumentCodeBuffer == null) {
+ illegalArgumentCodeBuffer = new ClassFileAssembler();
+ illegalArgumentCodeBuffer.opc_new(illegalArgumentClass);
+ illegalArgumentCodeBuffer.opc_dup();
+ illegalArgumentCodeBuffer.opc_invokespecial(illegalArgumentCtorIdx, 0, 0);
+ illegalArgumentCodeBuffer.opc_athrow();
+ }
+
+ return illegalArgumentCodeBuffer;
+ }
+}
diff --git a/src/Java/sun/repackage/BootstrapConstructorAccessorImpl.java b/src/Java/sun/repackage/BootstrapConstructorAccessorImpl.java
new file mode 100644
index 0000000000..b7b5a72372
--- /dev/null
+++ b/src/Java/sun/repackage/BootstrapConstructorAccessorImpl.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.lang.reflect.InvocationTargetException;
+
+import java.lang.reflect.Constructor;
+
+/** Uses Unsafe.allocateObject() to instantiate classes; only used for
+ bootstrapping. */
+
+class BootstrapConstructorAccessorImpl extends ConstructorAccessorImpl {
+ private final Constructor<?> constructor;
+
+ BootstrapConstructorAccessorImpl(Constructor<?> c) {
+ this.constructor = c;
+ }
+
+ public Object newInstance(Object[] args)
+ throws IllegalArgumentException, InvocationTargetException
+ {
+ try {
+ return UnsafeFieldAccessorImpl.unsafe.
+ allocateInstance(constructor.getDeclaringClass());
+ } catch (InstantiationException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+}
diff --git a/src/Java/sun/repackage/ByteVector.java b/src/Java/sun/repackage/ByteVector.java
new file mode 100644
index 0000000000..7c6cc5cc12
--- /dev/null
+++ b/src/Java/sun/repackage/ByteVector.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+/** A growable array of bytes. */
+
+interface ByteVector {
+ public int getLength();
+ public byte get(int index);
+ public void put(int index, byte value);
+ public void add(byte value);
+ public void trim();
+ public byte[] getData();
+}
diff --git a/src/Java/sun/repackage/ByteVectorFactory.java b/src/Java/sun/repackage/ByteVectorFactory.java
new file mode 100644
index 0000000000..110373db8b
--- /dev/null
+++ b/src/Java/sun/repackage/ByteVectorFactory.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+class ByteVectorFactory {
+ static ByteVector create() {
+ return new ByteVectorImpl();
+ }
+
+ static ByteVector create(int sz) {
+ return new ByteVectorImpl(sz);
+ }
+}
diff --git a/src/Java/sun/repackage/ByteVectorImpl.java b/src/Java/sun/repackage/ByteVectorImpl.java
new file mode 100644
index 0000000000..b04667ce53
--- /dev/null
+++ b/src/Java/sun/repackage/ByteVectorImpl.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+class ByteVectorImpl implements ByteVector {
+ private byte[] data;
+ private int pos;
+
+ public ByteVectorImpl() {
+ this(100);
+ }
+
+ public ByteVectorImpl(int sz) {
+ data = new byte[sz];
+ pos = -1;
+ }
+
+ public int getLength() {
+ return pos + 1;
+ }
+
+ public byte get(int index) {
+ if (index >= data.length) {
+ resize(index);
+ pos = index;
+ }
+ return data[index];
+ }
+
+ public void put(int index, byte value) {
+ if (index >= data.length) {
+ resize(index);
+ pos = index;
+ }
+ data[index] = value;
+ }
+
+ public void add(byte value) {
+ if (++pos >= data.length) {
+ resize(pos);
+ }
+ data[pos] = value;
+ }
+
+ public void trim() {
+ if (pos != data.length - 1) {
+ byte[] newData = new byte[pos + 1];
+ System.arraycopy(data, 0, newData, 0, pos + 1);
+ data = newData;
+ }
+ }
+
+ public byte[] getData() {
+ return data;
+ }
+
+ private void resize(int minSize) {
+ if (minSize <= 2 * data.length) {
+ minSize = 2 * data.length;
+ }
+ byte[] newData = new byte[minSize];
+ System.arraycopy(data, 0, newData, 0, data.length);
+ data = newData;
+ }
+}
diff --git a/src/Java/sun/repackage/CallerSensitive.java b/src/Java/sun/repackage/CallerSensitive.java
new file mode 100644
index 0000000000..9a9a07171b
--- /dev/null
+++ b/src/Java/sun/repackage/CallerSensitive.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
+
+/**
+ * A method annotated @CallerSensitive is sensitive to its calling class,
+ * via {@link sun.repackage.Reflection#getCallerClass Reflection.getCallerClass},
+ * or via some equivalent.
+ *
+ * @author John R. Rose
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({METHOD})
+public @interface CallerSensitive {
+}
diff --git a/src/Java/sun/repackage/ClassDefiner.java b/src/Java/sun/repackage/ClassDefiner.java
new file mode 100644
index 0000000000..e9b3cb2e1d
--- /dev/null
+++ b/src/Java/sun/repackage/ClassDefiner.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/** Utility class which assists in calling Unsafe.defineClass() by
+ creating a new class loader which delegates to the one needed in
+ order for proper resolution of the given bytecodes to occur. */
+
+class ClassDefiner {
+ static final Unsafe unsafe = Unsafe.getUnsafe();
+
+ /** <P> We define generated code into a new class loader which
+ delegates to the defining loader of the target class. It is
+ necessary for the VM to be able to resolve references to the
+ target class from the generated bytecodes, which could not occur
+ if the generated code was loaded into the bootstrap class
+ loader. </P>
+
+ <P> There are two primary reasons for creating a new loader
+ instead of defining these bytecodes directly into the defining
+ loader of the target class: first, it avoids any possible
+ security risk of having these bytecodes in the same loader.
+ Second, it allows the generated bytecodes to be unloaded earlier
+ than would otherwise be possible, decreasing run-time
+ footprint. </P>
+ */
+ static Class<?> defineClass(String name, byte[] bytes, int off, int len,
+ final ClassLoader parentClassLoader)
+ {
+ ClassLoader newLoader = AccessController.doPrivileged(
+ new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run() {
+ return new DelegatingClassLoader(parentClassLoader);
+ }
+ });
+ return unsafe.defineClass(name, bytes, off, len, newLoader, null);
+ }
+}
+
+
+// NOTE: this class's name and presence are known to the virtual
+// machine as of the fix for 4474172.
+class DelegatingClassLoader extends ClassLoader {
+ DelegatingClassLoader(ClassLoader parent) {
+ super(parent);
+ }
+}
diff --git a/src/Java/sun/repackage/ClassFileAssembler.java b/src/Java/sun/repackage/ClassFileAssembler.java
new file mode 100644
index 0000000000..f17be6824e
--- /dev/null
+++ b/src/Java/sun/repackage/ClassFileAssembler.java
@@ -0,0 +1,671 @@
+/*
+ * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+class ClassFileAssembler implements ClassFileConstants {
+ private ByteVector vec;
+ private short cpIdx = 0;
+
+ public ClassFileAssembler() {
+ this(ByteVectorFactory.create());
+ }
+
+ public ClassFileAssembler(ByteVector vec) {
+ this.vec = vec;
+ }
+
+ public ByteVector getData() {
+ return vec;
+ }
+
+ /** Length in bytes */
+ public short getLength() {
+ return (short) vec.getLength();
+ }
+
+ public void emitMagicAndVersion() {
+ emitInt(0xCAFEBABE);
+ emitShort((short) 0);
+ emitShort((short) 49);
+ }
+
+ public void emitInt(int val) {
+ emitByte((byte) (val >> 24));
+ emitByte((byte) ((val >> 16) & 0xFF));
+ emitByte((byte) ((val >> 8) & 0xFF));
+ emitByte((byte) (val & 0xFF));
+ }
+
+ public void emitShort(short val) {
+ emitByte((byte) ((val >> 8) & 0xFF));
+ emitByte((byte) (val & 0xFF));
+ }
+
+ // Support for labels; package-private
+ void emitShort(short bci, short val) {
+ vec.put(bci, (byte) ((val >> 8) & 0xFF));
+ vec.put(bci + 1, (byte) (val & 0xFF));
+ }
+
+ public void emitByte(byte val) {
+ vec.add(val);
+ }
+
+ public void append(ClassFileAssembler asm) {
+ append(asm.vec);
+ }
+
+ public void append(ByteVector vec) {
+ for (int i = 0; i < vec.getLength(); i++) {
+ emitByte(vec.get(i));
+ }
+ }
+
+ /** Keeps track of the current (one-based) constant pool index;
+ incremented after emitting one of the following constant pool
+ entries. Can fetch the current constant pool index for use in
+ later entries. Index points at the last valid constant pool
+ entry; initially invalid. It is illegal to fetch the constant
+ pool index before emitting at least one constant pool entry. */
+ public short cpi() {
+ if (cpIdx == 0) {
+ throw new RuntimeException("Illegal use of ClassFileAssembler");
+ }
+ return cpIdx;
+ }
+
+ public void emitConstantPoolUTF8(String str) {
+ // NOTE: can not use str.getBytes("UTF-8") here because of
+ // bootstrapping issues with the character set converters.
+ byte[] bytes = UTF8.encode(str);
+ emitByte(CONSTANT_Utf8);
+ emitShort((short) bytes.length);
+ for (int i = 0; i < bytes.length; i++) {
+ emitByte(bytes[i]);
+ }
+ cpIdx++;
+ }
+
+ public void emitConstantPoolClass(short index) {
+ emitByte(CONSTANT_Class);
+ emitShort(index);
+ cpIdx++;
+ }
+
+ public void emitConstantPoolNameAndType(short nameIndex, short typeIndex) {
+ emitByte(CONSTANT_NameAndType);
+ emitShort(nameIndex);
+ emitShort(typeIndex);
+ cpIdx++;
+ }
+
+ public void emitConstantPoolFieldref
+ (short classIndex, short nameAndTypeIndex)
+ {
+ emitByte(CONSTANT_Fieldref);
+ emitShort(classIndex);
+ emitShort(nameAndTypeIndex);
+ cpIdx++;
+ }
+
+ public void emitConstantPoolMethodref
+ (short classIndex, short nameAndTypeIndex)
+ {
+ emitByte(CONSTANT_Methodref);
+ emitShort(classIndex);
+ emitShort(nameAndTypeIndex);
+ cpIdx++;
+ }
+
+ public void emitConstantPoolInterfaceMethodref
+ (short classIndex, short nameAndTypeIndex)
+ {
+ emitByte(CONSTANT_InterfaceMethodref);
+ emitShort(classIndex);
+ emitShort(nameAndTypeIndex);
+ cpIdx++;
+ }
+
+ public void emitConstantPoolString(short utf8Index) {
+ emitByte(CONSTANT_String);
+ emitShort(utf8Index);
+ cpIdx++;
+ }
+
+ //----------------------------------------------------------------------
+ // Opcodes. Keeps track of maximum stack and locals. Make a new
+ // assembler for each piece of assembled code, then append the
+ // result to the previous assembler's class file.
+ //
+
+ private int stack = 0;
+ private int maxStack = 0;
+ private int maxLocals = 0;
+
+ private void incStack() {
+ setStack(stack + 1);
+ }
+
+ private void decStack() {
+ --stack;
+ }
+
+ public short getMaxStack() {
+ return (short) maxStack;
+ }
+
+ public short getMaxLocals() {
+ return (short) maxLocals;
+ }
+
+ /** It's necessary to be able to specify the number of arguments at
+ the beginning of the method (which translates to the initial
+ value of max locals) */
+ public void setMaxLocals(int maxLocals) {
+ this.maxLocals = maxLocals;
+ }
+
+ /** Needed to do flow control. Returns current stack depth. */
+ public int getStack() {
+ return stack;
+ }
+
+ /** Needed to do flow control. */
+ public void setStack(int value) {
+ stack = value;
+ if (stack > maxStack) {
+ maxStack = stack;
+ }
+ }
+
+ ///////////////
+ // Constants //
+ ///////////////
+
+ public void opc_aconst_null() {
+ emitByte(opc_aconst_null);
+ incStack();
+ }
+
+ public void opc_sipush(short constant) {
+ emitByte(opc_sipush);
+ emitShort(constant);
+ incStack();
+ }
+
+ public void opc_ldc(byte cpIdx) {
+ emitByte(opc_ldc);
+ emitByte(cpIdx);
+ incStack();
+ }
+
+ /////////////////////////////////////
+ // Local variable loads and stores //
+ /////////////////////////////////////
+
+ public void opc_iload_0() {
+ emitByte(opc_iload_0);
+ if (maxLocals < 1) maxLocals = 1;
+ incStack();
+ }
+
+ public void opc_iload_1() {
+ emitByte(opc_iload_1);
+ if (maxLocals < 2) maxLocals = 2;
+ incStack();
+ }
+
+ public void opc_iload_2() {
+ emitByte(opc_iload_2);
+ if (maxLocals < 3) maxLocals = 3;
+ incStack();
+ }
+
+ public void opc_iload_3() {
+ emitByte(opc_iload_3);
+ if (maxLocals < 4) maxLocals = 4;
+ incStack();
+ }
+
+ public void opc_lload_0() {
+ emitByte(opc_lload_0);
+ if (maxLocals < 2) maxLocals = 2;
+ incStack();
+ incStack();
+ }
+
+ public void opc_lload_1() {
+ emitByte(opc_lload_1);
+ if (maxLocals < 3) maxLocals = 3;
+ incStack();
+ incStack();
+ }
+
+ public void opc_lload_2() {
+ emitByte(opc_lload_2);
+ if (maxLocals < 4) maxLocals = 4;
+ incStack();
+ incStack();
+ }
+
+ public void opc_lload_3() {
+ emitByte(opc_lload_3);
+ if (maxLocals < 5) maxLocals = 5;
+ incStack();
+ incStack();
+ }
+
+ public void opc_fload_0() {
+ emitByte(opc_fload_0);
+ if (maxLocals < 1) maxLocals = 1;
+ incStack();
+ }
+
+ public void opc_fload_1() {
+ emitByte(opc_fload_1);
+ if (maxLocals < 2) maxLocals = 2;
+ incStack();
+ }
+
+ public void opc_fload_2() {
+ emitByte(opc_fload_2);
+ if (maxLocals < 3) maxLocals = 3;
+ incStack();
+ }
+
+ public void opc_fload_3() {
+ emitByte(opc_fload_3);
+ if (maxLocals < 4) maxLocals = 4;
+ incStack();
+ }
+
+ public void opc_dload_0() {
+ emitByte(opc_dload_0);
+ if (maxLocals < 2) maxLocals = 2;
+ incStack();
+ incStack();
+ }
+
+ public void opc_dload_1() {
+ emitByte(opc_dload_1);
+ if (maxLocals < 3) maxLocals = 3;
+ incStack();
+ incStack();
+ }
+
+ public void opc_dload_2() {
+ emitByte(opc_dload_2);
+ if (maxLocals < 4) maxLocals = 4;
+ incStack();
+ incStack();
+ }
+
+ public void opc_dload_3() {
+ emitByte(opc_dload_3);
+ if (maxLocals < 5) maxLocals = 5;
+ incStack();
+ incStack();
+ }
+
+ public void opc_aload_0() {
+ emitByte(opc_aload_0);
+ if (maxLocals < 1) maxLocals = 1;
+ incStack();
+ }
+
+ public void opc_aload_1() {
+ emitByte(opc_aload_1);
+ if (maxLocals < 2) maxLocals = 2;
+ incStack();
+ }
+
+ public void opc_aload_2() {
+ emitByte(opc_aload_2);
+ if (maxLocals < 3) maxLocals = 3;
+ incStack();
+ }
+
+ public void opc_aload_3() {
+ emitByte(opc_aload_3);
+ if (maxLocals < 4) maxLocals = 4;
+ incStack();
+ }
+
+ public void opc_aaload() {
+ emitByte(opc_aaload);
+ decStack();
+ }
+
+ public void opc_astore_0() {
+ emitByte(opc_astore_0);
+ if (maxLocals < 1) maxLocals = 1;
+ decStack();
+ }
+
+ public void opc_astore_1() {
+ emitByte(opc_astore_1);
+ if (maxLocals < 2) maxLocals = 2;
+ decStack();
+ }
+
+ public void opc_astore_2() {
+ emitByte(opc_astore_2);
+ if (maxLocals < 3) maxLocals = 3;
+ decStack();
+ }
+
+ public void opc_astore_3() {
+ emitByte(opc_astore_3);
+ if (maxLocals < 4) maxLocals = 4;
+ decStack();
+ }
+
+ ////////////////////////
+ // Stack manipulation //
+ ////////////////////////
+
+ public void opc_pop() {
+ emitByte(opc_pop);
+ decStack();
+ }
+
+ public void opc_dup() {
+ emitByte(opc_dup);
+ incStack();
+ }
+
+ public void opc_dup_x1() {
+ emitByte(opc_dup_x1);
+ incStack();
+ }
+
+ public void opc_swap() {
+ emitByte(opc_swap);
+ }
+
+ ///////////////////////////////
+ // Widening conversions only //
+ ///////////////////////////////
+
+ public void opc_i2l() {
+ emitByte(opc_i2l);
+ }
+
+ public void opc_i2f() {
+ emitByte(opc_i2f);
+ }
+
+ public void opc_i2d() {
+ emitByte(opc_i2d);
+ }
+
+ public void opc_l2f() {
+ emitByte(opc_l2f);
+ }
+
+ public void opc_l2d() {
+ emitByte(opc_l2d);
+ }
+
+ public void opc_f2d() {
+ emitByte(opc_f2d);
+ }
+
+ //////////////////
+ // Control flow //
+ //////////////////
+
+ public void opc_ifeq(short bciOffset) {
+ emitByte(opc_ifeq);
+ emitShort(bciOffset);
+ decStack();
+ }
+
+ /** Control flow with forward-reference BCI. Stack assumes
+ straight-through control flow. */
+ public void opc_ifeq(Label l) {
+ short instrBCI = getLength();
+ emitByte(opc_ifeq);
+ l.add(this, instrBCI, getLength(), getStack() - 1);
+ emitShort((short) -1); // Must be patched later
+ }
+
+ public void opc_if_icmpeq(short bciOffset) {
+ emitByte(opc_if_icmpeq);
+ emitShort(bciOffset);
+ setStack(getStack() - 2);
+ }
+
+ /** Control flow with forward-reference BCI. Stack assumes straight
+ control flow. */
+ public void opc_if_icmpeq(Label l) {
+ short instrBCI = getLength();
+ emitByte(opc_if_icmpeq);
+ l.add(this, instrBCI, getLength(), getStack() - 2);
+ emitShort((short) -1); // Must be patched later
+ }
+
+ public void opc_goto(short bciOffset) {
+ emitByte(opc_goto);
+ emitShort(bciOffset);
+ }
+
+ /** Control flow with forward-reference BCI. Stack assumes straight
+ control flow. */
+ public void opc_goto(Label l) {
+ short instrBCI = getLength();
+ emitByte(opc_goto);
+ l.add(this, instrBCI, getLength(), getStack());
+ emitShort((short) -1); // Must be patched later
+ }
+
+ public void opc_ifnull(short bciOffset) {
+ emitByte(opc_ifnull);
+ emitShort(bciOffset);
+ decStack();
+ }
+
+ /** Control flow with forward-reference BCI. Stack assumes straight
+ control flow. */
+ public void opc_ifnull(Label l) {
+ short instrBCI = getLength();
+ emitByte(opc_ifnull);
+ l.add(this, instrBCI, getLength(), getStack() - 1);
+ emitShort((short) -1); // Must be patched later
+ decStack();
+ }
+
+ public void opc_ifnonnull(short bciOffset) {
+ emitByte(opc_ifnonnull);
+ emitShort(bciOffset);
+ decStack();
+ }
+
+ /** Control flow with forward-reference BCI. Stack assumes straight
+ control flow. */
+ public void opc_ifnonnull(Label l) {
+ short instrBCI = getLength();
+ emitByte(opc_ifnonnull);
+ l.add(this, instrBCI, getLength(), getStack() - 1);
+ emitShort((short) -1); // Must be patched later
+ decStack();
+ }
+
+ /////////////////////////
+ // Return instructions //
+ /////////////////////////
+
+ public void opc_ireturn() {
+ emitByte(opc_ireturn);
+ setStack(0);
+ }
+
+ public void opc_lreturn() {
+ emitByte(opc_lreturn);
+ setStack(0);
+ }
+
+ public void opc_freturn() {
+ emitByte(opc_freturn);
+ setStack(0);
+ }
+
+ public void opc_dreturn() {
+ emitByte(opc_dreturn);
+ setStack(0);
+ }
+
+ public void opc_areturn() {
+ emitByte(opc_areturn);
+ setStack(0);
+ }
+
+ public void opc_return() {
+ emitByte(opc_return);
+ setStack(0);
+ }
+
+ //////////////////////
+ // Field operations //
+ //////////////////////
+
+ public void opc_getstatic(short fieldIndex, int fieldSizeInStackSlots) {
+ emitByte(opc_getstatic);
+ emitShort(fieldIndex);
+ setStack(getStack() + fieldSizeInStackSlots);
+ }
+
+ public void opc_putstatic(short fieldIndex, int fieldSizeInStackSlots) {
+ emitByte(opc_putstatic);
+ emitShort(fieldIndex);
+ setStack(getStack() - fieldSizeInStackSlots);
+ }
+
+ public void opc_getfield(short fieldIndex, int fieldSizeInStackSlots) {
+ emitByte(opc_getfield);
+ emitShort(fieldIndex);
+ setStack(getStack() + fieldSizeInStackSlots - 1);
+ }
+
+ public void opc_putfield(short fieldIndex, int fieldSizeInStackSlots) {
+ emitByte(opc_putfield);
+ emitShort(fieldIndex);
+ setStack(getStack() - fieldSizeInStackSlots - 1);
+ }
+
+ ////////////////////////
+ // Method invocations //
+ ////////////////////////
+
+ /** Long and double arguments and return types count as 2 arguments;
+ other values count as 1. */
+ public void opc_invokevirtual(short methodIndex,
+ int numArgs,
+ int numReturnValues)
+ {
+ emitByte(opc_invokevirtual);
+ emitShort(methodIndex);
+ setStack(getStack() - numArgs - 1 + numReturnValues);
+ }
+
+ /** Long and double arguments and return types count as 2 arguments;
+ other values count as 1. */
+ public void opc_invokespecial(short methodIndex,
+ int numArgs,
+ int numReturnValues)
+ {
+ emitByte(opc_invokespecial);
+ emitShort(methodIndex);
+ setStack(getStack() - numArgs - 1 + numReturnValues);
+ }
+
+ /** Long and double arguments and return types count as 2 arguments;
+ other values count as 1. */
+ public void opc_invokestatic(short methodIndex,
+ int numArgs,
+ int numReturnValues)
+ {
+ emitByte(opc_invokestatic);
+ emitShort(methodIndex);
+ setStack(getStack() - numArgs + numReturnValues);
+ }
+
+ /** Long and double arguments and return types count as 2 arguments;
+ other values count as 1. */
+ public void opc_invokeinterface(short methodIndex,
+ int numArgs,
+ byte count,
+ int numReturnValues)
+ {
+ emitByte(opc_invokeinterface);
+ emitShort(methodIndex);
+ emitByte(count);
+ emitByte((byte) 0);
+ setStack(getStack() - numArgs - 1 + numReturnValues);
+ }
+
+ //////////////////
+ // Array length //
+ //////////////////
+
+ public void opc_arraylength() {
+ emitByte(opc_arraylength);
+ }
+
+ /////////
+ // New //
+ /////////
+
+ public void opc_new(short classIndex) {
+ emitByte(opc_new);
+ emitShort(classIndex);
+ incStack();
+ }
+
+ ////////////
+ // Athrow //
+ ////////////
+
+ public void opc_athrow() {
+ emitByte(opc_athrow);
+ setStack(1);
+ }
+
+ //////////////////////////////
+ // Checkcast and instanceof //
+ //////////////////////////////
+
+ /** Assumes the checkcast succeeds */
+ public void opc_checkcast(short classIndex) {
+ emitByte(opc_checkcast);
+ emitShort(classIndex);
+ }
+
+ public void opc_instanceof(short classIndex) {
+ emitByte(opc_instanceof);
+ emitShort(classIndex);
+ }
+}
diff --git a/src/Java/sun/repackage/ClassFileConstants.java b/src/Java/sun/repackage/ClassFileConstants.java
new file mode 100644
index 0000000000..7c08b9d533
--- /dev/null
+++ b/src/Java/sun/repackage/ClassFileConstants.java
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+/** Minimal set of class file constants for assembly of field and
+ method accessors. */
+
+interface ClassFileConstants {
+ // Constants
+ public static final byte opc_aconst_null = (byte) 0x1;
+ public static final byte opc_sipush = (byte) 0x11;
+ public static final byte opc_ldc = (byte) 0x12;
+
+ // Local variable loads and stores
+ public static final byte opc_iload_0 = (byte) 0x1a;
+ public static final byte opc_iload_1 = (byte) 0x1b;
+ public static final byte opc_iload_2 = (byte) 0x1c;
+ public static final byte opc_iload_3 = (byte) 0x1d;
+ public static final byte opc_lload_0 = (byte) 0x1e;
+ public static final byte opc_lload_1 = (byte) 0x1f;
+ public static final byte opc_lload_2 = (byte) 0x20;
+ public static final byte opc_lload_3 = (byte) 0x21;
+ public static final byte opc_fload_0 = (byte) 0x22;
+ public static final byte opc_fload_1 = (byte) 0x23;
+ public static final byte opc_fload_2 = (byte) 0x24;
+ public static final byte opc_fload_3 = (byte) 0x25;
+ public static final byte opc_dload_0 = (byte) 0x26;
+ public static final byte opc_dload_1 = (byte) 0x27;
+ public static final byte opc_dload_2 = (byte) 0x28;
+ public static final byte opc_dload_3 = (byte) 0x29;
+ public static final byte opc_aload_0 = (byte) 0x2a;
+ public static final byte opc_aload_1 = (byte) 0x2b;
+ public static final byte opc_aload_2 = (byte) 0x2c;
+ public static final byte opc_aload_3 = (byte) 0x2d;
+ public static final byte opc_aaload = (byte) 0x32;
+ public static final byte opc_astore_0 = (byte) 0x4b;
+ public static final byte opc_astore_1 = (byte) 0x4c;
+ public static final byte opc_astore_2 = (byte) 0x4d;
+ public static final byte opc_astore_3 = (byte) 0x4e;
+
+ // Stack manipulation
+ public static final byte opc_pop = (byte) 0x57;
+ public static final byte opc_dup = (byte) 0x59;
+ public static final byte opc_dup_x1 = (byte) 0x5a;
+ public static final byte opc_swap = (byte) 0x5f;
+
+ // Conversions
+ public static final byte opc_i2l = (byte) 0x85;
+ public static final byte opc_i2f = (byte) 0x86;
+ public static final byte opc_i2d = (byte) 0x87;
+ public static final byte opc_l2i = (byte) 0x88;
+ public static final byte opc_l2f = (byte) 0x89;
+ public static final byte opc_l2d = (byte) 0x8a;
+ public static final byte opc_f2i = (byte) 0x8b;
+ public static final byte opc_f2l = (byte) 0x8c;
+ public static final byte opc_f2d = (byte) 0x8d;
+ public static final byte opc_d2i = (byte) 0x8e;
+ public static final byte opc_d2l = (byte) 0x8f;
+ public static final byte opc_d2f = (byte) 0x90;
+ public static final byte opc_i2b = (byte) 0x91;
+ public static final byte opc_i2c = (byte) 0x92;
+ public static final byte opc_i2s = (byte) 0x93;
+
+ // Control flow
+ public static final byte opc_ifeq = (byte) 0x99;
+ public static final byte opc_if_icmpeq = (byte) 0x9f;
+ public static final byte opc_goto = (byte) 0xa7;
+
+ // Return instructions
+ public static final byte opc_ireturn = (byte) 0xac;
+ public static final byte opc_lreturn = (byte) 0xad;
+ public static final byte opc_freturn = (byte) 0xae;
+ public static final byte opc_dreturn = (byte) 0xaf;
+ public static final byte opc_areturn = (byte) 0xb0;
+ public static final byte opc_return = (byte) 0xb1;
+
+ // Field operations
+ public static final byte opc_getstatic = (byte) 0xb2;
+ public static final byte opc_putstatic = (byte) 0xb3;
+ public static final byte opc_getfield = (byte) 0xb4;
+ public static final byte opc_putfield = (byte) 0xb5;
+
+ // Method invocations
+ public static final byte opc_invokevirtual = (byte) 0xb6;
+ public static final byte opc_invokespecial = (byte) 0xb7;
+ public static final byte opc_invokestatic = (byte) 0xb8;
+ public static final byte opc_invokeinterface = (byte) 0xb9;
+
+ // Array length
+ public static final byte opc_arraylength = (byte) 0xbe;
+
+ // New
+ public static final byte opc_new = (byte) 0xbb;
+
+ // Athrow
+ public static final byte opc_athrow = (byte) 0xbf;
+
+ // Checkcast and instanceof
+ public static final byte opc_checkcast = (byte) 0xc0;
+ public static final byte opc_instanceof = (byte) 0xc1;
+
+ // Ifnull and ifnonnull
+ public static final byte opc_ifnull = (byte) 0xc6;
+ public static final byte opc_ifnonnull = (byte) 0xc7;
+
+ // Constant pool tags
+ public static final byte CONSTANT_Class = (byte) 7;
+ public static final byte CONSTANT_Fieldref = (byte) 9;
+ public static final byte CONSTANT_Methodref = (byte) 10;
+ public static final byte CONSTANT_InterfaceMethodref = (byte) 11;
+ public static final byte CONSTANT_NameAndType = (byte) 12;
+ public static final byte CONSTANT_String = (byte) 8;
+ public static final byte CONSTANT_Utf8 = (byte) 1;
+
+ // Access flags
+ public static final short ACC_PUBLIC = (short) 0x0001;
+}
diff --git a/src/Java/sun/repackage/ConstructorAccessor.java b/src/Java/sun/repackage/ConstructorAccessor.java
new file mode 100644
index 0000000000..988fb8e5fc
--- /dev/null
+++ b/src/Java/sun/repackage/ConstructorAccessor.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.lang.reflect.InvocationTargetException;
+
+/** This interface provides the declaration for
+ java.lang.reflect.Constructor.invoke(). Each Constructor object is
+ configured with a (possibly dynamically-generated) class which
+ implements this interface. */
+
+public interface ConstructorAccessor {
+ /** Matches specification in {@link java.lang.reflect.Constructor} */
+ public Object newInstance(Object[] args)
+ throws InstantiationException,
+ IllegalArgumentException,
+ InvocationTargetException;
+}
diff --git a/src/Java/sun/repackage/ConstructorAccessorImpl.java b/src/Java/sun/repackage/ConstructorAccessorImpl.java
new file mode 100644
index 0000000000..22f9d54080
--- /dev/null
+++ b/src/Java/sun/repackage/ConstructorAccessorImpl.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.lang.reflect.InvocationTargetException;
+
+/** Package-private implementation of the ConstructorAccessor
+ interface which has access to all classes and all fields,
+ regardless of language restrictions. See MagicAccessorImpl. */
+
+abstract class ConstructorAccessorImpl extends MagicAccessorImpl
+ implements ConstructorAccessor {
+ /** Matches specification in {@link java.lang.reflect.Constructor} */
+ public abstract Object newInstance(Object[] args)
+ throws InstantiationException,
+ IllegalArgumentException,
+ InvocationTargetException;
+}
diff --git a/src/Java/sun/repackage/DelegatingConstructorAccessorImpl.java b/src/Java/sun/repackage/DelegatingConstructorAccessorImpl.java
new file mode 100644
index 0000000000..81a1d4ffc6
--- /dev/null
+++ b/src/Java/sun/repackage/DelegatingConstructorAccessorImpl.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.lang.reflect.InvocationTargetException;
+
+/** Delegates its invocation to another ConstructorAccessorImpl and can
+ change its delegate at run time. */
+
+class DelegatingConstructorAccessorImpl extends ConstructorAccessorImpl {
+ private ConstructorAccessorImpl delegate;
+
+ DelegatingConstructorAccessorImpl(ConstructorAccessorImpl delegate) {
+ setDelegate(delegate);
+ }
+
+ public Object newInstance(Object[] args)
+ throws InstantiationException,
+ IllegalArgumentException,
+ InvocationTargetException
+ {
+ return delegate.newInstance(args);
+ }
+
+ void setDelegate(ConstructorAccessorImpl delegate) {
+ this.delegate = delegate;
+ }
+}
diff --git a/src/Java/sun/repackage/DelegatingMethodAccessorImpl.java b/src/Java/sun/repackage/DelegatingMethodAccessorImpl.java
new file mode 100644
index 0000000000..05c825f327
--- /dev/null
+++ b/src/Java/sun/repackage/DelegatingMethodAccessorImpl.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.lang.reflect.InvocationTargetException;
+
+/** Delegates its invocation to another MethodAccessorImpl and can
+ change its delegate at run time. */
+
+class DelegatingMethodAccessorImpl extends MethodAccessorImpl {
+ private MethodAccessorImpl delegate;
+
+ DelegatingMethodAccessorImpl(MethodAccessorImpl delegate) {
+ setDelegate(delegate);
+ }
+
+ public Object invoke(Object obj, Object[] args)
+ throws IllegalArgumentException, InvocationTargetException
+ {
+ return delegate.invoke(obj, args);
+ }
+
+ void setDelegate(MethodAccessorImpl delegate) {
+ this.delegate = delegate;
+ }
+}
diff --git a/src/Java/sun/repackage/FieldAccessor.java b/src/Java/sun/repackage/FieldAccessor.java
new file mode 100644
index 0000000000..6c8e2e16d3
--- /dev/null
+++ b/src/Java/sun/repackage/FieldAccessor.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+/** This interface provides the declarations for the accessor methods
+ of java.lang.reflect.Field. Each Field object is configured with a
+ (possibly dynamically-generated) class which implements this
+ interface. */
+
+public interface FieldAccessor {
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public Object get(Object obj) throws IllegalArgumentException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public boolean getBoolean(Object obj) throws IllegalArgumentException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public byte getByte(Object obj) throws IllegalArgumentException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public char getChar(Object obj) throws IllegalArgumentException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public short getShort(Object obj) throws IllegalArgumentException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public int getInt(Object obj) throws IllegalArgumentException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public long getLong(Object obj) throws IllegalArgumentException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public float getFloat(Object obj) throws IllegalArgumentException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public double getDouble(Object obj) throws IllegalArgumentException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException;
+}
diff --git a/src/Java/sun/repackage/FieldAccessorImpl.java b/src/Java/sun/repackage/FieldAccessorImpl.java
new file mode 100644
index 0000000000..d49a49e79d
--- /dev/null
+++ b/src/Java/sun/repackage/FieldAccessorImpl.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+/** Package-private implementation of the FieldAccessor interface
+ which has access to all classes and all fields, regardless of
+ language restrictions. See MagicAccessorImpl. */
+
+abstract class FieldAccessorImpl extends MagicAccessorImpl
+ implements FieldAccessor {
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public abstract Object get(Object obj)
+ throws IllegalArgumentException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public abstract boolean getBoolean(Object obj)
+ throws IllegalArgumentException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public abstract byte getByte(Object obj)
+ throws IllegalArgumentException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public abstract char getChar(Object obj)
+ throws IllegalArgumentException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public abstract short getShort(Object obj)
+ throws IllegalArgumentException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public abstract int getInt(Object obj)
+ throws IllegalArgumentException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public abstract long getLong(Object obj)
+ throws IllegalArgumentException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public abstract float getFloat(Object obj)
+ throws IllegalArgumentException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public abstract double getDouble(Object obj)
+ throws IllegalArgumentException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public abstract void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public abstract void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public abstract void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public abstract void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public abstract void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public abstract void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public abstract void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public abstract void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException;
+
+ /** Matches specification in {@link java.lang.reflect.Field} */
+ public abstract void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException;
+}
diff --git a/src/Java/sun/repackage/ForgeEnumHelper.java b/src/Java/sun/repackage/ForgeEnumHelper.java
new file mode 100644
index 0000000000..2f7732574c
--- /dev/null
+++ b/src/Java/sun/repackage/ForgeEnumHelper.java
@@ -0,0 +1,70 @@
+package sun.repackage;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.preloader.Preloader_Logger;
+import net.minecraftforge.common.util.EnumHelper;
+
+public class ForgeEnumHelper {
+ private static Object reflectionFactory = null;
+ private static Method newConstructorAccessor = null;
+ private static Method newInstance = null;
+ private static Method newFieldAccessor = null;
+ private static Method fieldAccessorSet = null;
+ private static boolean isSetup = false;
+
+
+ public static void setup()
+ {
+ if (isSetup)
+ {
+ return;
+ }
+
+ try
+ {
+
+ Preloader_Logger.INFO("Patching Fields in Forge's EnumHelper.");
+
+ Class aRefFac = ReflectionUtils.getClass("sun.repackage.ReflectionFactory");
+ Class aConAcc = ReflectionUtils.getClass("sun.repackage.ConstructorAccessor");
+ Class aFieAcc = ReflectionUtils.getClass("sun.repackage.FieldAccessor");
+
+ Method getReflectionFactory = ReflectionUtils.getMethod(aRefFac, "getReflectionFactory", new Class[] {});
+ reflectionFactory = ReflectionUtils.invokeNonBool(aRefFac, getReflectionFactory, new Object[] {});
+ newConstructorAccessor = ReflectionUtils.getMethod(aRefFac, "newConstructorAccessor", new Class[] {Constructor.class});
+ newFieldAccessor = ReflectionUtils.getMethod(aRefFac, "newFieldAccessor", new Class[] {Field.class, boolean.class});
+ newInstance = ReflectionUtils.getMethod(aConAcc, "newInstance", new Class[] {Object[].class});
+ fieldAccessorSet = ReflectionUtils.getMethod(aFieAcc, "set", new Class[] {Object.class, Object.class});
+
+ Field aIsSetup = ReflectionUtils.getField(EnumHelper.class, "isSetup");
+ Field aReflectionFactory = ReflectionUtils.getField(EnumHelper.class, "reflectionFactory");
+ Field aNewConstructorAccessor = ReflectionUtils.getField(EnumHelper.class, "newConstructorAccessor");
+ Field aNewInstance = ReflectionUtils.getField(EnumHelper.class, "newInstance");
+ Field aNewFieldAccessor = ReflectionUtils.getField(EnumHelper.class, "newFieldAccessor");
+ Field aFieldAccessorSet = ReflectionUtils.getField(EnumHelper.class, "fieldAccessorSet");
+
+ ReflectionUtils.setField(EnumHelper.class, aIsSetup, true);
+ ReflectionUtils.setField(EnumHelper.class, aReflectionFactory, reflectionFactory);
+ ReflectionUtils.setField(EnumHelper.class, aNewConstructorAccessor, newConstructorAccessor);
+ ReflectionUtils.setField(EnumHelper.class, aNewInstance, newInstance);
+ ReflectionUtils.setField(EnumHelper.class, aNewFieldAccessor, newFieldAccessor);
+ ReflectionUtils.setField(EnumHelper.class, aFieldAccessorSet, fieldAccessorSet);
+
+ Preloader_Logger.INFO("Finished patching Fields in Forge's EnumHelper.");
+
+ Preloader_Logger.INFO("Testing: "+ReflectionUtils.getFieldValue(aReflectionFactory).getClass().getCanonicalName());
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ isSetup = true;
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/sun/repackage/InstantiationExceptionConstructorAccessorImpl.java b/src/Java/sun/repackage/InstantiationExceptionConstructorAccessorImpl.java
new file mode 100644
index 0000000000..ca9ca1cff3
--- /dev/null
+++ b/src/Java/sun/repackage/InstantiationExceptionConstructorAccessorImpl.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.lang.reflect.InvocationTargetException;
+
+/** Throws an InstantiationException with given error message upon
+ newInstance() call */
+
+class InstantiationExceptionConstructorAccessorImpl
+ extends ConstructorAccessorImpl {
+ private final String message;
+
+ InstantiationExceptionConstructorAccessorImpl(String message) {
+ this.message = message;
+ }
+
+ public Object newInstance(Object[] args)
+ throws InstantiationException,
+ IllegalArgumentException,
+ InvocationTargetException
+ {
+ if (message == null) {
+ throw new InstantiationException();
+ }
+ throw new InstantiationException(message);
+ }
+}
diff --git a/src/Java/sun/repackage/Label.java b/src/Java/sun/repackage/Label.java
new file mode 100644
index 0000000000..86acf54fe6
--- /dev/null
+++ b/src/Java/sun/repackage/Label.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/** Allows forward references in bytecode streams emitted by
+ ClassFileAssembler. Assumes that the start of the method body is
+ the first byte in the assembler's buffer. May be used at more than
+ one branch site. */
+
+class Label {
+ static class PatchInfo {
+ PatchInfo(ClassFileAssembler asm,
+ short instrBCI,
+ short patchBCI,
+ int stackDepth)
+ {
+ this.asm = asm;
+ this.instrBCI = instrBCI;
+ this.patchBCI = patchBCI;
+ this.stackDepth = stackDepth;
+ }
+ // This won't work for more than one assembler anyway, so this is
+ // unnecessary
+ final ClassFileAssembler asm;
+ final short instrBCI;
+ final short patchBCI;
+ final int stackDepth;
+ }
+ private List<PatchInfo> patches = new ArrayList<>();
+
+ public Label() {
+ }
+
+ void add(ClassFileAssembler asm,
+ short instrBCI,
+ short patchBCI,
+ int stackDepth)
+ {
+ patches.add(new PatchInfo(asm, instrBCI, patchBCI, stackDepth));
+ }
+
+ public void bind() {
+ for (PatchInfo patch : patches){
+ short curBCI = patch.asm.getLength();
+ short offset = (short) (curBCI - patch.instrBCI);
+ patch.asm.emitShort(patch.patchBCI, offset);
+ patch.asm.setStack(patch.stackDepth);
+ }
+ }
+}
diff --git a/src/Java/sun/repackage/LangReflectAccess.java b/src/Java/sun/repackage/LangReflectAccess.java
new file mode 100644
index 0000000000..0adfc3cfe2
--- /dev/null
+++ b/src/Java/sun/repackage/LangReflectAccess.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.lang.reflect.*;
+
+/** An interface which gives privileged packages Java-level access to
+ internals of java.lang.reflect. */
+
+public interface LangReflectAccess {
+ /** Creates a new java.lang.reflect.Field. Access checks as per
+ java.lang.reflect.AccessibleObject are not overridden. */
+ public Field newField(Class<?> declaringClass,
+ String name,
+ Class<?> type,
+ int modifiers,
+ int slot,
+ String signature,
+ byte[] annotations);
+
+ /** Creates a new java.lang.reflect.Method. Access checks as per
+ java.lang.reflect.AccessibleObject are not overridden. */
+ public Method newMethod(Class<?> declaringClass,
+ String name,
+ Class<?>[] parameterTypes,
+ Class<?> returnType,
+ Class<?>[] checkedExceptions,
+ int modifiers,
+ int slot,
+ String signature,
+ byte[] annotations,
+ byte[] parameterAnnotations,
+ byte[] annotationDefault);
+
+ /** Creates a new java.lang.reflect.Constructor. Access checks as
+ per java.lang.reflect.AccessibleObject are not overridden. */
+ public <T> Constructor<T> newConstructor(Class<T> declaringClass,
+ Class<?>[] parameterTypes,
+ Class<?>[] checkedExceptions,
+ int modifiers,
+ int slot,
+ String signature,
+ byte[] annotations,
+ byte[] parameterAnnotations);
+
+ /** Gets the MethodAccessor object for a java.lang.reflect.Method */
+ public MethodAccessor getMethodAccessor(Method m);
+
+ /** Sets the MethodAccessor object for a java.lang.reflect.Method */
+ public void setMethodAccessor(Method m, MethodAccessor accessor);
+
+ /** Gets the ConstructorAccessor object for a
+ java.lang.reflect.Constructor */
+ public ConstructorAccessor getConstructorAccessor(Constructor<?> c);
+
+ /** Sets the ConstructorAccessor object for a
+ java.lang.reflect.Constructor */
+ public void setConstructorAccessor(Constructor<?> c,
+ ConstructorAccessor accessor);
+
+ /** Gets the byte[] that encodes TypeAnnotations on an Executable. */
+ public byte[] getExecutableTypeAnnotationBytes(Executable ex);
+
+ /** Gets the "slot" field from a Constructor (used for serialization) */
+ public int getConstructorSlot(Constructor<?> c);
+
+ /** Gets the "signature" field from a Constructor (used for serialization) */
+ public String getConstructorSignature(Constructor<?> c);
+
+ /** Gets the "annotations" field from a Constructor (used for serialization) */
+ public byte[] getConstructorAnnotations(Constructor<?> c);
+
+ /** Gets the "parameterAnnotations" field from a Constructor (used for serialization) */
+ public byte[] getConstructorParameterAnnotations(Constructor<?> c);
+
+ //
+ // Copying routines, needed to quickly fabricate new Field,
+ // Method, and Constructor objects from templates
+ //
+
+ /** Makes a "child" copy of a Method */
+ public Method copyMethod(Method arg);
+
+ /** Makes a "child" copy of a Field */
+ public Field copyField(Field arg);
+
+ /** Makes a "child" copy of a Constructor */
+ public <T> Constructor<T> copyConstructor(Constructor<T> arg);
+}
diff --git a/src/Java/sun/repackage/MagicAccessorImpl.java b/src/Java/sun/repackage/MagicAccessorImpl.java
new file mode 100644
index 0000000000..2a335cb08c
--- /dev/null
+++ b/src/Java/sun/repackage/MagicAccessorImpl.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+/** <P> MagicAccessorImpl (named for parity with FieldAccessorImpl and
+ others, not because it actually implements an interface) is a
+ marker class in the hierarchy. All subclasses of this class are
+ "magically" granted access by the VM to otherwise inaccessible
+ fields and methods of other classes. It is used to hold the code
+ for dynamically-generated FieldAccessorImpl and MethodAccessorImpl
+ subclasses. (Use of the word "unsafe" was avoided in this class's
+ name to avoid confusion with sun.misc.Unsafe.) </P>
+
+ <P> The bug fix for 4486457 also necessitated disabling
+ verification for this class and all subclasses, as opposed to just
+ SerializationConstructorAccessorImpl and subclasses, to avoid
+ having to indicate to the VM which of these dynamically-generated
+ stub classes were known to be able to pass the verifier. </P>
+
+ <P> Do not change the name of this class without also changing the
+ VM's code. </P> */
+
+class MagicAccessorImpl {
+}
diff --git a/src/Java/sun/repackage/MethodAccessor.java b/src/Java/sun/repackage/MethodAccessor.java
new file mode 100644
index 0000000000..9d70011beb
--- /dev/null
+++ b/src/Java/sun/repackage/MethodAccessor.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.lang.reflect.InvocationTargetException;
+
+/** This interface provides the declaration for
+ java.lang.reflect.Method.invoke(). Each Method object is
+ configured with a (possibly dynamically-generated) class which
+ implements this interface.
+*/
+
+public interface MethodAccessor {
+ /** Matches specification in {@link java.lang.reflect.Method} */
+ public Object invoke(Object obj, Object[] args)
+ throws IllegalArgumentException, InvocationTargetException;
+}
diff --git a/src/Java/sun/repackage/MethodAccessorGenerator.java b/src/Java/sun/repackage/MethodAccessorGenerator.java
new file mode 100644
index 0000000000..21eae8174f
--- /dev/null
+++ b/src/Java/sun/repackage/MethodAccessorGenerator.java
@@ -0,0 +1,780 @@
+/*
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/** Generator for sun.reflect.MethodAccessor and
+ sun.reflect.ConstructorAccessor objects using bytecodes to
+ implement reflection. A java.lang.reflect.Method or
+ java.lang.reflect.Constructor object can delegate its invoke or
+ newInstance method to an accessor using native code or to one
+ generated by this class. (Methods and Constructors were merged
+ together in this class to ensure maximum code sharing.) */
+
+class MethodAccessorGenerator extends AccessorGenerator {
+
+ private static final short NUM_BASE_CPOOL_ENTRIES = (short) 12;
+ // One for invoke() plus one for constructor
+ private static final short NUM_METHODS = (short) 2;
+ // Only used if forSerialization is true
+ private static final short NUM_SERIALIZATION_CPOOL_ENTRIES = (short) 2;
+
+ private static volatile int methodSymnum = 0;
+ private static volatile int constructorSymnum = 0;
+ private static volatile int serializationConstructorSymnum = 0;
+
+ private Class<?> declaringClass;
+ private Class<?>[] parameterTypes;
+ private Class<?> returnType;
+ private boolean isConstructor;
+ private boolean forSerialization;
+
+ private short targetMethodRef;
+ private short invokeIdx;
+ private short invokeDescriptorIdx;
+ // Constant pool index of CONSTANT_Class_info for first
+ // non-primitive parameter type. Should be incremented by 2.
+ private short nonPrimitiveParametersBaseIdx;
+
+ MethodAccessorGenerator() {
+ }
+
+ /** This routine is not thread-safe */
+ public MethodAccessor generateMethod(Class<?> declaringClass,
+ String name,
+ Class<?>[] parameterTypes,
+ Class<?> returnType,
+ Class<?>[] checkedExceptions,
+ int modifiers)
+ {
+ return (MethodAccessor) generate(declaringClass,
+ name,
+ parameterTypes,
+ returnType,
+ checkedExceptions,
+ modifiers,
+ false,
+ false,
+ null);
+ }
+
+ /** This routine is not thread-safe */
+ public ConstructorAccessor generateConstructor(Class<?> declaringClass,
+ Class<?>[] parameterTypes,
+ Class<?>[] checkedExceptions,
+ int modifiers)
+ {
+ return (ConstructorAccessor) generate(declaringClass,
+ "<init>",
+ parameterTypes,
+ Void.TYPE,
+ checkedExceptions,
+ modifiers,
+ true,
+ false,
+ null);
+ }
+
+ /** This routine is not thread-safe */
+ public SerializationConstructorAccessorImpl
+ generateSerializationConstructor(Class<?> declaringClass,
+ Class<?>[] parameterTypes,
+ Class<?>[] checkedExceptions,
+ int modifiers,
+ Class<?> targetConstructorClass)
+ {
+ return (SerializationConstructorAccessorImpl)
+ generate(declaringClass,
+ "<init>",
+ parameterTypes,
+ Void.TYPE,
+ checkedExceptions,
+ modifiers,
+ true,
+ true,
+ targetConstructorClass);
+ }
+
+ /** This routine is not thread-safe */
+ private MagicAccessorImpl generate(final Class<?> declaringClass,
+ String name,
+ Class<?>[] parameterTypes,
+ Class<?> returnType,
+ Class<?>[] checkedExceptions,
+ int modifiers,
+ boolean isConstructor,
+ boolean forSerialization,
+ Class<?> serializationTargetClass)
+ {
+ ByteVector vec = ByteVectorFactory.create();
+ asm = new ClassFileAssembler(vec);
+ this.declaringClass = declaringClass;
+ this.parameterTypes = parameterTypes;
+ this.returnType = returnType;
+ this.modifiers = modifiers;
+ this.isConstructor = isConstructor;
+ this.forSerialization = forSerialization;
+
+ asm.emitMagicAndVersion();
+
+ // Constant pool entries:
+ // ( * = Boxing information: optional)
+ // (+ = Shared entries provided by AccessorGenerator)
+ // (^ = Only present if generating SerializationConstructorAccessor)
+ // [UTF-8] [This class's name]
+ // [CONSTANT_Class_info] for above
+ // [UTF-8] "sun/reflect/{MethodAccessorImpl,ConstructorAccessorImpl,SerializationConstructorAccessorImpl}"
+ // [CONSTANT_Class_info] for above
+ // [UTF-8] [Target class's name]
+ // [CONSTANT_Class_info] for above
+ // ^ [UTF-8] [Serialization: Class's name in which to invoke constructor]
+ // ^ [CONSTANT_Class_info] for above
+ // [UTF-8] target method or constructor name
+ // [UTF-8] target method or constructor signature
+ // [CONSTANT_NameAndType_info] for above
+ // [CONSTANT_Methodref_info or CONSTANT_InterfaceMethodref_info] for target method
+ // [UTF-8] "invoke" or "newInstance"
+ // [UTF-8] invoke or newInstance descriptor
+ // [UTF-8] descriptor for type of non-primitive parameter 1
+ // [CONSTANT_Class_info] for type of non-primitive parameter 1
+ // ...
+ // [UTF-8] descriptor for type of non-primitive parameter n
+ // [CONSTANT_Class_info] for type of non-primitive parameter n
+ // + [UTF-8] "java/lang/Exception"
+ // + [CONSTANT_Class_info] for above
+ // + [UTF-8] "java/lang/ClassCastException"
+ // + [CONSTANT_Class_info] for above
+ // + [UTF-8] "java/lang/NullPointerException"
+ // + [CONSTANT_Class_info] for above
+ // + [UTF-8] "java/lang/IllegalArgumentException"
+ // + [CONSTANT_Class_info] for above
+ // + [UTF-8] "java/lang/InvocationTargetException"
+ // + [CONSTANT_Class_info] for above
+ // + [UTF-8] "<init>"
+ // + [UTF-8] "()V"
+ // + [CONSTANT_NameAndType_info] for above
+ // + [CONSTANT_Methodref_info] for NullPointerException's constructor
+ // + [CONSTANT_Methodref_info] for IllegalArgumentException's constructor
+ // + [UTF-8] "(Ljava/lang/String;)V"
+ // + [CONSTANT_NameAndType_info] for "<init>(Ljava/lang/String;)V"
+ // + [CONSTANT_Methodref_info] for IllegalArgumentException's constructor taking a String
+ // + [UTF-8] "(Ljava/lang/Throwable;)V"
+ // + [CONSTANT_NameAndType_info] for "<init>(Ljava/lang/Throwable;)V"
+ // + [CONSTANT_Methodref_info] for InvocationTargetException's constructor
+ // + [CONSTANT_Methodref_info] for "super()"
+ // + [UTF-8] "java/lang/Object"
+ // + [CONSTANT_Class_info] for above
+ // + [UTF-8] "toString"
+ // + [UTF-8] "()Ljava/lang/String;"
+ // + [CONSTANT_NameAndType_info] for "toString()Ljava/lang/String;"
+ // + [CONSTANT_Methodref_info] for Object's toString method
+ // + [UTF-8] "Code"
+ // + [UTF-8] "Exceptions"
+ // * [UTF-8] "java/lang/Boolean"
+ // * [CONSTANT_Class_info] for above
+ // * [UTF-8] "(Z)V"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "booleanValue"
+ // * [UTF-8] "()Z"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "java/lang/Byte"
+ // * [CONSTANT_Class_info] for above
+ // * [UTF-8] "(B)V"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "byteValue"
+ // * [UTF-8] "()B"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "java/lang/Character"
+ // * [CONSTANT_Class_info] for above
+ // * [UTF-8] "(C)V"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "charValue"
+ // * [UTF-8] "()C"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "java/lang/Double"
+ // * [CONSTANT_Class_info] for above
+ // * [UTF-8] "(D)V"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "doubleValue"
+ // * [UTF-8] "()D"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "java/lang/Float"
+ // * [CONSTANT_Class_info] for above
+ // * [UTF-8] "(F)V"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "floatValue"
+ // * [UTF-8] "()F"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "java/lang/Integer"
+ // * [CONSTANT_Class_info] for above
+ // * [UTF-8] "(I)V"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "intValue"
+ // * [UTF-8] "()I"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "java/lang/Long"
+ // * [CONSTANT_Class_info] for above
+ // * [UTF-8] "(J)V"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "longValue"
+ // * [UTF-8] "()J"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "java/lang/Short"
+ // * [CONSTANT_Class_info] for above
+ // * [UTF-8] "(S)V"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+ // * [UTF-8] "shortValue"
+ // * [UTF-8] "()S"
+ // * [CONSTANT_NameAndType_info] for above
+ // * [CONSTANT_Methodref_info] for above
+
+ short numCPEntries = NUM_BASE_CPOOL_ENTRIES + NUM_COMMON_CPOOL_ENTRIES;
+ boolean usesPrimitives = usesPrimitiveTypes();
+ if (usesPrimitives) {
+ numCPEntries += NUM_BOXING_CPOOL_ENTRIES;
+ }
+ if (forSerialization) {
+ numCPEntries += NUM_SERIALIZATION_CPOOL_ENTRIES;
+ }
+
+ // Add in variable-length number of entries to be able to describe
+ // non-primitive parameter types and checked exceptions.
+ numCPEntries += (short) (2 * numNonPrimitiveParameterTypes());
+
+ asm.emitShort(add(numCPEntries, S1));
+
+ final String generatedName = generateName(isConstructor, forSerialization);
+ asm.emitConstantPoolUTF8(generatedName);
+ asm.emitConstantPoolClass(asm.cpi());
+ thisClass = asm.cpi();
+ if (isConstructor) {
+ if (forSerialization) {
+ asm.emitConstantPoolUTF8
+ ("sun/reflect/SerializationConstructorAccessorImpl");
+ } else {
+ asm.emitConstantPoolUTF8("sun/reflect/ConstructorAccessorImpl");
+ }
+ } else {
+ asm.emitConstantPoolUTF8("sun/reflect/MethodAccessorImpl");
+ }
+ asm.emitConstantPoolClass(asm.cpi());
+ superClass = asm.cpi();
+ asm.emitConstantPoolUTF8(getClassName(declaringClass, false));
+ asm.emitConstantPoolClass(asm.cpi());
+ targetClass = asm.cpi();
+ short serializationTargetClassIdx = (short) 0;
+ if (forSerialization) {
+ asm.emitConstantPoolUTF8(getClassName(serializationTargetClass, false));
+ asm.emitConstantPoolClass(asm.cpi());
+ serializationTargetClassIdx = asm.cpi();
+ }
+ asm.emitConstantPoolUTF8(name);
+ asm.emitConstantPoolUTF8(buildInternalSignature());
+ asm.emitConstantPoolNameAndType(sub(asm.cpi(), S1), asm.cpi());
+ if (isInterface()) {
+ asm.emitConstantPoolInterfaceMethodref(targetClass, asm.cpi());
+ } else {
+ if (forSerialization) {
+ asm.emitConstantPoolMethodref(serializationTargetClassIdx, asm.cpi());
+ } else {
+ asm.emitConstantPoolMethodref(targetClass, asm.cpi());
+ }
+ }
+ targetMethodRef = asm.cpi();
+ if (isConstructor) {
+ asm.emitConstantPoolUTF8("newInstance");
+ } else {
+ asm.emitConstantPoolUTF8("invoke");
+ }
+ invokeIdx = asm.cpi();
+ if (isConstructor) {
+ asm.emitConstantPoolUTF8("([Ljava/lang/Object;)Ljava/lang/Object;");
+ } else {
+ asm.emitConstantPoolUTF8
+ ("(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;");
+ }
+ invokeDescriptorIdx = asm.cpi();
+
+ // Output class information for non-primitive parameter types
+ nonPrimitiveParametersBaseIdx = add(asm.cpi(), S2);
+ for (int i = 0; i < parameterTypes.length; i++) {
+ Class<?> c = parameterTypes[i];
+ if (!isPrimitive(c)) {
+ asm.emitConstantPoolUTF8(getClassName(c, false));
+ asm.emitConstantPoolClass(asm.cpi());
+ }
+ }
+
+ // Entries common to FieldAccessor, MethodAccessor and ConstructorAccessor
+ emitCommonConstantPoolEntries();
+
+ // Boxing entries
+ if (usesPrimitives) {
+ emitBoxingContantPoolEntries();
+ }
+
+ if (asm.cpi() != numCPEntries) {
+ throw new InternalError("Adjust this code (cpi = " + asm.cpi() +
+ ", numCPEntries = " + numCPEntries + ")");
+ }
+
+ // Access flags
+ asm.emitShort(ACC_PUBLIC);
+
+ // This class
+ asm.emitShort(thisClass);
+
+ // Superclass
+ asm.emitShort(superClass);
+
+ // Interfaces count and interfaces
+ asm.emitShort(S0);
+
+ // Fields count and fields
+ asm.emitShort(S0);
+
+ // Methods count and methods
+ asm.emitShort(NUM_METHODS);
+
+ emitConstructor();
+ emitInvoke();
+
+ // Additional attributes (none)
+ asm.emitShort(S0);
+
+ // Load class
+ vec.trim();
+ final byte[] bytes = vec.getData();
+ // Note: the class loader is the only thing that really matters
+ // here -- it's important to get the generated code into the
+ // same namespace as the target class. Since the generated code
+ // is privileged anyway, the protection domain probably doesn't
+ // matter.
+ return AccessController.doPrivileged(
+ new PrivilegedAction<MagicAccessorImpl>() {
+ public MagicAccessorImpl run() {
+ try {
+ return (MagicAccessorImpl)
+ ClassDefiner.defineClass
+ (generatedName,
+ bytes,
+ 0,
+ bytes.length,
+ declaringClass.getClassLoader()).newInstance();
+ } catch (InstantiationException | IllegalAccessException e) {
+ throw new InternalError(e);
+ }
+ }
+ });
+ }
+
+ /** This emits the code for either invoke() or newInstance() */
+ private void emitInvoke() {
+ // NOTE that this code will only handle 65535 parameters since we
+ // use the sipush instruction to get the array index on the
+ // operand stack.
+ if (parameterTypes.length > 65535) {
+ throw new InternalError("Can't handle more than 65535 parameters");
+ }
+
+ // Generate code into fresh code buffer
+ ClassFileAssembler cb = new ClassFileAssembler();
+ if (isConstructor) {
+ // 1 incoming argument
+ cb.setMaxLocals(2);
+ } else {
+ // 2 incoming arguments
+ cb.setMaxLocals(3);
+ }
+
+ short illegalArgStartPC = 0;
+
+ if (isConstructor) {
+ // Instantiate target class before continuing
+ // new <target class type>
+ // dup
+ cb.opc_new(targetClass);
+ cb.opc_dup();
+ } else {
+ // Setup before iterating down argument list
+ if (isPrimitive(returnType)) {
+ // new <boxing type for primitive type>
+ // dup
+ // ... (see below:)
+ // invokespecial <constructor for boxing type for primitive type>
+ // areturn
+ cb.opc_new(indexForPrimitiveType(returnType));
+ cb.opc_dup();
+ }
+
+ // Get target object on operand stack if necessary.
+
+ // We need to do an explicit null check here; we won't see
+ // NullPointerExceptions from the invoke bytecode, since it's
+ // covered by an exception handler.
+ if (!isStatic()) {
+ // aload_1
+ // ifnonnull <checkcast label>
+ // new <NullPointerException>
+ // dup
+ // invokespecial <NullPointerException ctor>
+ // athrow
+ // <checkcast label:>
+ // aload_1
+ // checkcast <target class's type>
+ cb.opc_aload_1();
+ Label l = new Label();
+ cb.opc_ifnonnull(l);
+ cb.opc_new(nullPointerClass);
+ cb.opc_dup();
+ cb.opc_invokespecial(nullPointerCtorIdx, 0, 0);
+ cb.opc_athrow();
+ l.bind();
+ illegalArgStartPC = cb.getLength();
+ cb.opc_aload_1();
+ cb.opc_checkcast(targetClass);
+ }
+ }
+
+ // Have to check length of incoming array and throw
+ // IllegalArgumentException if not correct. A concession to the
+ // JCK (isn't clearly specified in the spec): we allow null in the
+ // case where the argument list is zero length.
+ // if no-arg:
+ // aload_2 | aload_1 (Method | Constructor)
+ // ifnull <success label>
+ // aload_2 | aload_1
+ // arraylength
+ // sipush <num parameter types>
+ // if_icmpeq <success label>
+ // new <IllegalArgumentException>
+ // dup
+ // invokespecial <IllegalArgumentException ctor>
+ // athrow
+ // <success label:>
+ Label successLabel = new Label();
+ if (parameterTypes.length == 0) {
+ if (isConstructor) {
+ cb.opc_aload_1();
+ } else {
+ cb.opc_aload_2();
+ }
+ cb.opc_ifnull(successLabel);
+ }
+ if (isConstructor) {
+ cb.opc_aload_1();
+ } else {
+ cb.opc_aload_2();
+ }
+ cb.opc_arraylength();
+ cb.opc_sipush((short) parameterTypes.length);
+ cb.opc_if_icmpeq(successLabel);
+ cb.opc_new(illegalArgumentClass);
+ cb.opc_dup();
+ cb.opc_invokespecial(illegalArgumentCtorIdx, 0, 0);
+ cb.opc_athrow();
+ successLabel.bind();
+
+ // Iterate through incoming actual parameters, ensuring that each
+ // is compatible with the formal parameter type, and pushing the
+ // actual on the operand stack (unboxing and widening if necessary).
+
+ short paramTypeCPIdx = nonPrimitiveParametersBaseIdx;
+ Label nextParamLabel = null;
+ byte count = 1; // both invokeinterface opcode's "count" as well as
+ // num args of other invoke bytecodes
+ for (int i = 0; i < parameterTypes.length; i++) {
+ Class<?> paramType = parameterTypes[i];
+ count += (byte) typeSizeInStackSlots(paramType);
+ if (nextParamLabel != null) {
+ nextParamLabel.bind();
+ nextParamLabel = null;
+ }
+ // aload_2 | aload_1
+ // sipush <index>
+ // aaload
+ if (isConstructor) {
+ cb.opc_aload_1();
+ } else {
+ cb.opc_aload_2();
+ }
+ cb.opc_sipush((short) i);
+ cb.opc_aaload();
+ if (isPrimitive(paramType)) {
+ // Unboxing code.
+ // Put parameter into temporary local variable
+ // astore_3 | astore_2
+ if (isConstructor) {
+ cb.opc_astore_2();
+ } else {
+ cb.opc_astore_3();
+ }
+
+ // repeat for all possible widening conversions:
+ // aload_3 | aload_2
+ // instanceof <primitive boxing type>
+ // ifeq <next unboxing label>
+ // aload_3 | aload_2
+ // checkcast <primitive boxing type> // Note: this is "redundant",
+ // // but necessary for the verifier
+ // invokevirtual <unboxing method>
+ // <widening conversion bytecode, if necessary>
+ // goto <next parameter label>
+ // <next unboxing label:> ...
+ // last unboxing label:
+ // new <IllegalArgumentException>
+ // dup
+ // invokespecial <IllegalArgumentException ctor>
+ // athrow
+
+ Label l = null; // unboxing label
+ nextParamLabel = new Label();
+
+ for (int j = 0; j < primitiveTypes.length; j++) {
+ Class<?> c = primitiveTypes[j];
+ if (canWidenTo(c, paramType)) {
+ if (l != null) {
+ l.bind();
+ }
+ // Emit checking and unboxing code for this type
+ if (isConstructor) {
+ cb.opc_aload_2();
+ } else {
+ cb.opc_aload_3();
+ }
+ cb.opc_instanceof(indexForPrimitiveType(c));
+ l = new Label();
+ cb.opc_ifeq(l);
+ if (isConstructor) {
+ cb.opc_aload_2();
+ } else {
+ cb.opc_aload_3();
+ }
+ cb.opc_checkcast(indexForPrimitiveType(c));
+ cb.opc_invokevirtual(unboxingMethodForPrimitiveType(c),
+ 0,
+ typeSizeInStackSlots(c));
+ emitWideningBytecodeForPrimitiveConversion(cb,
+ c,
+ paramType);
+ cb.opc_goto(nextParamLabel);
+ }
+ }
+
+ if (l == null) {
+ throw new InternalError
+ ("Must have found at least identity conversion");
+ }
+
+ // Fell through; given object is null or invalid. According to
+ // the spec, we can throw IllegalArgumentException for both of
+ // these cases.
+
+ l.bind();
+ cb.opc_new(illegalArgumentClass);
+ cb.opc_dup();
+ cb.opc_invokespecial(illegalArgumentCtorIdx, 0, 0);
+ cb.opc_athrow();
+ } else {
+ // Emit appropriate checkcast
+ cb.opc_checkcast(paramTypeCPIdx);
+ paramTypeCPIdx = add(paramTypeCPIdx, S2);
+ // Fall through to next argument
+ }
+ }
+ // Bind last goto if present
+ if (nextParamLabel != null) {
+ nextParamLabel.bind();
+ }
+
+ short invokeStartPC = cb.getLength();
+
+ // OK, ready to perform the invocation.
+ if (isConstructor) {
+ cb.opc_invokespecial(targetMethodRef, count, 0);
+ } else {
+ if (isStatic()) {
+ cb.opc_invokestatic(targetMethodRef,
+ count,
+ typeSizeInStackSlots(returnType));
+ } else {
+ if (isInterface()) {
+ if (isPrivate()) {
+ cb.opc_invokespecial(targetMethodRef, count, 0);
+ } else {
+ cb.opc_invokeinterface(targetMethodRef,
+ count,
+ count,
+ typeSizeInStackSlots(returnType));
+ }
+ } else {
+ cb.opc_invokevirtual(targetMethodRef,
+ count,
+ typeSizeInStackSlots(returnType));
+ }
+ }
+ }
+
+ short invokeEndPC = cb.getLength();
+
+ if (!isConstructor) {
+ // Box return value if necessary
+ if (isPrimitive(returnType)) {
+ cb.opc_invokespecial(ctorIndexForPrimitiveType(returnType),
+ typeSizeInStackSlots(returnType),
+ 0);
+ } else if (returnType == Void.TYPE) {
+ cb.opc_aconst_null();
+ }
+ }
+ cb.opc_areturn();
+
+ // We generate two exception handlers; one which is responsible
+ // for catching ClassCastException and NullPointerException and
+ // throwing IllegalArgumentException, and the other which catches
+ // all java/lang/Throwable objects thrown from the target method
+ // and wraps them in InvocationTargetExceptions.
+
+ short classCastHandler = cb.getLength();
+
+ // ClassCast, etc. exception handler
+ cb.setStack(1);
+ cb.opc_invokespecial(toStringIdx, 0, 1);
+ cb.opc_new(illegalArgumentClass);
+ cb.opc_dup_x1();
+ cb.opc_swap();
+ cb.opc_invokespecial(illegalArgumentStringCtorIdx, 1, 0);
+ cb.opc_athrow();
+
+ short invocationTargetHandler = cb.getLength();
+
+ // InvocationTargetException exception handler
+ cb.setStack(1);
+ cb.opc_new(invocationTargetClass);
+ cb.opc_dup_x1();
+ cb.opc_swap();
+ cb.opc_invokespecial(invocationTargetCtorIdx, 1, 0);
+ cb.opc_athrow();
+
+ // Generate exception table. We cover the entire code sequence
+ // with an exception handler which catches ClassCastException and
+ // converts it into an IllegalArgumentException.
+
+ ClassFileAssembler exc = new ClassFileAssembler();
+
+ exc.emitShort(illegalArgStartPC); // start PC
+ exc.emitShort(invokeStartPC); // end PC
+ exc.emitShort(classCastHandler); // handler PC
+ exc.emitShort(classCastClass); // catch type
+
+ exc.emitShort(illegalArgStartPC); // start PC
+ exc.emitShort(invokeStartPC); // end PC
+ exc.emitShort(classCastHandler); // handler PC
+ exc.emitShort(nullPointerClass); // catch type
+
+ exc.emitShort(invokeStartPC); // start PC
+ exc.emitShort(invokeEndPC); // end PC
+ exc.emitShort(invocationTargetHandler); // handler PC
+ exc.emitShort(throwableClass); // catch type
+
+ emitMethod(invokeIdx, cb.getMaxLocals(), cb, exc,
+ new short[] { invocationTargetClass });
+ }
+
+ private boolean usesPrimitiveTypes() {
+ // We need to emit boxing/unboxing constant pool information if
+ // the method takes a primitive type for any of its parameters or
+ // returns a primitive value (except void)
+ if (returnType.isPrimitive()) {
+ return true;
+ }
+ for (int i = 0; i < parameterTypes.length; i++) {
+ if (parameterTypes[i].isPrimitive()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private int numNonPrimitiveParameterTypes() {
+ int num = 0;
+ for (int i = 0; i < parameterTypes.length; i++) {
+ if (!parameterTypes[i].isPrimitive()) {
+ ++num;
+ }
+ }
+ return num;
+ }
+
+ private boolean isInterface() {
+ return declaringClass.isInterface();
+ }
+
+ private String buildInternalSignature() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("(");
+ for (int i = 0; i < parameterTypes.length; i++) {
+ buf.append(getClassName(parameterTypes[i], true));
+ }
+ buf.append(")");
+ buf.append(getClassName(returnType, true));
+ return buf.toString();
+ }
+
+ private static synchronized String generateName(boolean isConstructor,
+ boolean forSerialization)
+ {
+ if (isConstructor) {
+ if (forSerialization) {
+ int num = ++serializationConstructorSymnum;
+ return "sun/reflect/GeneratedSerializationConstructorAccessor" + num;
+ } else {
+ int num = ++constructorSymnum;
+ return "sun/reflect/GeneratedConstructorAccessor" + num;
+ }
+ } else {
+ int num = ++methodSymnum;
+ return "sun/reflect/GeneratedMethodAccessor" + num;
+ }
+ }
+}
diff --git a/src/Java/sun/repackage/MethodAccessorImpl.java b/src/Java/sun/repackage/MethodAccessorImpl.java
new file mode 100644
index 0000000000..63f7b56aab
--- /dev/null
+++ b/src/Java/sun/repackage/MethodAccessorImpl.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.lang.reflect.InvocationTargetException;
+
+/** <P> Package-private implementation of the MethodAccessor interface
+ which has access to all classes and all fields, regardless of
+ language restrictions. See MagicAccessor. </P>
+
+ <P> This class is known to the VM; do not change its name without
+ also changing the VM's code. </P>
+
+ <P> NOTE: ALL methods of subclasses are skipped during security
+ walks up the stack. The assumption is that the only such methods
+ that will persistently show up on the stack are the implementing
+ methods for java.lang.reflect.Method.invoke(). </P>
+*/
+
+abstract class MethodAccessorImpl extends MagicAccessorImpl
+ implements MethodAccessor {
+ /** Matches specification in {@link java.lang.reflect.Method} */
+ public abstract Object invoke(Object obj, Object[] args)
+ throws IllegalArgumentException, InvocationTargetException;
+}
diff --git a/src/Java/sun/repackage/NativeConstructorAccessorImpl.java b/src/Java/sun/repackage/NativeConstructorAccessorImpl.java
new file mode 100644
index 0000000000..3acc91e956
--- /dev/null
+++ b/src/Java/sun/repackage/NativeConstructorAccessorImpl.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.lang.reflect.*;
+
+/** Used only for the first few invocations of a Constructor;
+ afterward, switches to bytecode-based implementation */
+
+class NativeConstructorAccessorImpl extends ConstructorAccessorImpl {
+ private final Constructor<?> c;
+ private DelegatingConstructorAccessorImpl parent;
+ private int numInvocations;
+
+ NativeConstructorAccessorImpl(Constructor<?> c) {
+ this.c = c;
+ }
+
+ public Object newInstance(Object[] args)
+ throws InstantiationException,
+ IllegalArgumentException,
+ InvocationTargetException
+ {
+ // We can't inflate a constructor belonging to a vm-anonymous class
+ // because that kind of class can't be referred to by name, hence can't
+ // be found from the generated bytecode.
+ if (++numInvocations > ReflectionFactory.inflationThreshold()
+ && !ReflectUtil.isVMAnonymousClass(c.getDeclaringClass())) {
+ ConstructorAccessorImpl acc = (ConstructorAccessorImpl)
+ new MethodAccessorGenerator().
+ generateConstructor(c.getDeclaringClass(),
+ c.getParameterTypes(),
+ c.getExceptionTypes(),
+ c.getModifiers());
+ parent.setDelegate(acc);
+ }
+
+ return newInstance0(c, args);
+ }
+
+ void setParent(DelegatingConstructorAccessorImpl parent) {
+ this.parent = parent;
+ }
+
+ private static native Object newInstance0(Constructor<?> c, Object[] args)
+ throws InstantiationException,
+ IllegalArgumentException,
+ InvocationTargetException;
+}
diff --git a/src/Java/sun/repackage/NativeMethodAccessorImpl.java b/src/Java/sun/repackage/NativeMethodAccessorImpl.java
new file mode 100644
index 0000000000..20b6ce9fb0
--- /dev/null
+++ b/src/Java/sun/repackage/NativeMethodAccessorImpl.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.lang.reflect.*;
+
+/** Used only for the first few invocations of a Method; afterward,
+ switches to bytecode-based implementation */
+
+class NativeMethodAccessorImpl extends MethodAccessorImpl {
+ private final Method method;
+ private DelegatingMethodAccessorImpl parent;
+ private int numInvocations;
+
+ NativeMethodAccessorImpl(Method method) {
+ this.method = method;
+ }
+
+ public Object invoke(Object obj, Object[] args)
+ throws IllegalArgumentException, InvocationTargetException
+ {
+ // We can't inflate methods belonging to vm-anonymous classes because
+ // that kind of class can't be referred to by name, hence can't be
+ // found from the generated bytecode.
+ if (++numInvocations > ReflectionFactory.inflationThreshold()
+ && !ReflectUtil.isVMAnonymousClass(method.getDeclaringClass())) {
+ MethodAccessorImpl acc = (MethodAccessorImpl)
+ new MethodAccessorGenerator().
+ generateMethod(method.getDeclaringClass(),
+ method.getName(),
+ method.getParameterTypes(),
+ method.getReturnType(),
+ method.getExceptionTypes(),
+ method.getModifiers());
+ parent.setDelegate(acc);
+ }
+
+ return invoke0(method, obj, args);
+ }
+
+ void setParent(DelegatingMethodAccessorImpl parent) {
+ this.parent = parent;
+ }
+
+ private static native Object invoke0(Method m, Object obj, Object[] args);
+}
diff --git a/src/Java/sun/repackage/PermissionFactory.java b/src/Java/sun/repackage/PermissionFactory.java
new file mode 100644
index 0000000000..66f614cc9d
--- /dev/null
+++ b/src/Java/sun/repackage/PermissionFactory.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.security.Permission;
+
+/**
+ * A factory object that creates Permission objects.
+ */
+
+public interface PermissionFactory<T extends Permission> {
+ T newPermission(String name);
+}
diff --git a/src/Java/sun/repackage/ReflectUtil.java b/src/Java/sun/repackage/ReflectUtil.java
new file mode 100644
index 0000000000..c34b075a73
--- /dev/null
+++ b/src/Java/sun/repackage/ReflectUtil.java
@@ -0,0 +1,338 @@
+/*
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package sun.repackage;
+
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Proxy;
+
+public final class ReflectUtil {
+
+ private ReflectUtil() {
+ }
+
+ public static Class<?> forName(String name)
+ throws ClassNotFoundException {
+ checkPackageAccess(name);
+ return Class.forName(name);
+ }
+
+ public static Object newInstance(Class<?> cls)
+ throws InstantiationException, IllegalAccessException {
+ checkPackageAccess(cls);
+ return cls.newInstance();
+ }
+
+ /*
+ * Reflection.ensureMemberAccess is overly-restrictive
+ * due to a bug. We awkwardly work around it for now.
+ */
+ public static void ensureMemberAccess(Class<?> currentClass,
+ Class<?> memberClass,
+ Object target,
+ int modifiers)
+ throws IllegalAccessException
+ {
+ if (target == null && Modifier.isProtected(modifiers)) {
+ int mods = modifiers;
+ mods = mods & (~Modifier.PROTECTED);
+ mods = mods | Modifier.PUBLIC;
+
+ /*
+ * See if we fail because of class modifiers
+ */
+ Reflection.ensureMemberAccess(currentClass,
+ memberClass,
+ target,
+ mods);
+ try {
+ /*
+ * We're still here so class access was ok.
+ * Now try with default field access.
+ */
+ mods = mods & (~Modifier.PUBLIC);
+ Reflection.ensureMemberAccess(currentClass,
+ memberClass,
+ target,
+ mods);
+ /*
+ * We're still here so access is ok without
+ * checking for protected.
+ */
+ return;
+ } catch (IllegalAccessException e) {
+ /*
+ * Access failed but we're 'protected' so
+ * if the test below succeeds then we're ok.
+ */
+ if (isSubclassOf(currentClass, memberClass)) {
+ return;
+ } else {
+ throw e;
+ }
+ }
+ } else {
+ Reflection.ensureMemberAccess(currentClass,
+ memberClass,
+ target,
+ modifiers);
+ }
+ }
+
+ private static boolean isSubclassOf(Class<?> queryClass,
+ Class<?> ofClass)
+ {
+ while (queryClass != null) {
+ if (queryClass == ofClass) {
+ return true;
+ }
+ queryClass = queryClass.getSuperclass();
+ }
+ return false;
+ }
+
+ /**
+ * Does a conservative approximation of member access check. Use this if
+ * you don't have an actual 'userland' caller Class/ClassLoader available.
+ * This might be more restrictive than a precise member access check where
+ * you have a caller, but should never allow a member access that is
+ * forbidden.
+ *
+ * @param m the {@code Member} about to be accessed
+ */
+ public static void conservativeCheckMemberAccess(Member m) throws SecurityException{
+ final SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ return;
+
+ // Check for package access on the declaring class.
+ //
+ // In addition, unless the member and the declaring class are both
+ // public check for access declared member permissions.
+ //
+ // This is done regardless of ClassLoader relations between the {@code
+ // Member m} and any potential caller.
+
+ final Class<?> declaringClass = m.getDeclaringClass();
+
+ checkPackageAccess(declaringClass);
+
+ if (Modifier.isPublic(m.getModifiers()) &&
+ Modifier.isPublic(declaringClass.getModifiers()))
+ return;
+
+ // Check for declared member access.
+ sm.checkPermission(SecurityConstants.CHECK_MEMBER_ACCESS_PERMISSION);
+ }
+
+ /**
+ * Checks package access on the given class.
+ *
+ * If it is a {@link Proxy#isProxyClass(java.lang.Class)} that implements
+ * a non-public interface (i.e. may be in a non-restricted package),
+ * also check the package access on the proxy interfaces.
+ */
+ public static void checkPackageAccess(Class<?> clazz) {
+ checkPackageAccess(clazz.getName());
+ if (isNonPublicProxyClass(clazz)) {
+ checkProxyPackageAccess(clazz);
+ }
+ }
+
+ /**
+ * Checks package access on the given classname.
+ * This method is typically called when the Class instance is not
+ * available and the caller attempts to load a class on behalf
+ * the true caller (application).
+ */
+ public static void checkPackageAccess(String name) {
+ SecurityManager s = System.getSecurityManager();
+ if (s != null) {
+ String cname = name.replace('/', '.');
+ if (cname.startsWith("[")) {
+ int b = cname.lastIndexOf('[') + 2;
+ if (b > 1 && b < cname.length()) {
+ cname = cname.substring(b);
+ }
+ }
+ int i = cname.lastIndexOf('.');
+ if (i != -1) {
+ s.checkPackageAccess(cname.substring(0, i));
+ }
+ }
+ }
+
+ public static boolean isPackageAccessible(Class<?> clazz) {
+ try {
+ checkPackageAccess(clazz);
+ } catch (SecurityException e) {
+ return false;
+ }
+ return true;
+ }
+
+ // Returns true if p is an ancestor of cl i.e. class loader 'p' can
+ // be found in the cl's delegation chain
+ private static boolean isAncestor(ClassLoader p, ClassLoader cl) {
+ ClassLoader acl = cl;
+ do {
+ acl = acl.getParent();
+ if (p == acl) {
+ return true;
+ }
+ } while (acl != null);
+ return false;
+ }
+
+ /**
+ * Returns true if package access check is needed for reflective
+ * access from a class loader 'from' to classes or members in
+ * a class defined by class loader 'to'. This method returns true
+ * if 'from' is not the same as or an ancestor of 'to'. All code
+ * in a system domain are granted with all permission and so this
+ * method returns false if 'from' class loader is a class loader
+ * loading system classes. On the other hand, if a class loader
+ * attempts to access system domain classes, it requires package
+ * access check and this method will return true.
+ */
+ public static boolean needsPackageAccessCheck(ClassLoader from, ClassLoader to) {
+ if (from == null || from == to)
+ return false;
+
+ if (to == null)
+ return true;
+
+ return !isAncestor(from, to);
+ }
+
+ /**
+ * Check package access on the proxy interfaces that the given proxy class
+ * implements.
+ *
+ * @param clazz Proxy class object
+ */
+ public static void checkProxyPackageAccess(Class<?> clazz) {
+ SecurityManager s = System.getSecurityManager();
+ if (s != null) {
+ // check proxy interfaces if the given class is a proxy class
+ if (Proxy.isProxyClass(clazz)) {
+ for (Class<?> intf : clazz.getInterfaces()) {
+ checkPackageAccess(intf);
+ }
+ }
+ }
+ }
+
+ /**
+ * Access check on the interfaces that a proxy class implements and throw
+ * {@code SecurityException} if it accesses a restricted package from
+ * the caller's class loader.
+ *
+ * @param ccl the caller's class loader
+ * @param interfaces the list of interfaces that a proxy class implements
+ */
+ public static void checkProxyPackageAccess(ClassLoader ccl,
+ Class<?>... interfaces)
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ for (Class<?> intf : interfaces) {
+ ClassLoader cl = intf.getClassLoader();
+ if (needsPackageAccessCheck(ccl, cl)) {
+ checkPackageAccess(intf);
+ }
+ }
+ }
+ }
+
+ // Note that bytecode instrumentation tools may exclude 'sun.*'
+ // classes but not generated proxy classes and so keep it in com.sun.*
+ public static final String PROXY_PACKAGE = "com.sun.proxy";
+
+ /**
+ * Test if the given class is a proxy class that implements
+ * non-public interface. Such proxy class may be in a non-restricted
+ * package that bypasses checkPackageAccess.
+ */
+ public static boolean isNonPublicProxyClass(Class<?> cls) {
+ String name = cls.getName();
+ int i = name.lastIndexOf('.');
+ String pkg = (i != -1) ? name.substring(0, i) : "";
+ return Proxy.isProxyClass(cls) && !pkg.equals(PROXY_PACKAGE);
+ }
+
+ /**
+ * Check if the given method is a method declared in the proxy interface
+ * implemented by the given proxy instance.
+ *
+ * @param proxy a proxy instance
+ * @param method an interface method dispatched to a InvocationHandler
+ *
+ * @throws IllegalArgumentException if the given proxy or method is invalid.
+ */
+ public static void checkProxyMethod(Object proxy, Method method) {
+ // check if it is a valid proxy instance
+ if (proxy == null || !Proxy.isProxyClass(proxy.getClass())) {
+ throw new IllegalArgumentException("Not a Proxy instance");
+}
+ if (Modifier.isStatic(method.getModifiers())) {
+ throw new IllegalArgumentException("Can't handle static method");
+ }
+
+ Class<?> c = method.getDeclaringClass();
+ if (c == Object.class) {
+ String name = method.getName();
+ if (name.equals("hashCode") || name.equals("equals") || name.equals("toString")) {
+ return;
+ }
+ }
+
+ if (isSuperInterface(proxy.getClass(), c)) {
+ return;
+ }
+
+ // disallow any method not declared in one of the proxy intefaces
+ throw new IllegalArgumentException("Can't handle: " + method);
+ }
+
+ private static boolean isSuperInterface(Class<?> c, Class<?> intf) {
+ for (Class<?> i : c.getInterfaces()) {
+ if (i == intf) {
+ return true;
+ }
+ if (isSuperInterface(i, intf)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean isVMAnonymousClass(Class<?> cls) {
+ return cls.getName().indexOf("/") > -1;
+ }
+}
diff --git a/src/Java/sun/repackage/Reflection.java b/src/Java/sun/repackage/Reflection.java
new file mode 100644
index 0000000000..8a679db6ec
--- /dev/null
+++ b/src/Java/sun/repackage/Reflection.java
@@ -0,0 +1,361 @@
+/*
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.lang.reflect.*;
+import java.util.HashMap;
+import java.util.Map;
+
+/** Common utility routines used by both java.lang and
+ java.lang.reflect */
+
+public class Reflection {
+
+ /** Used to filter out fields and methods from certain classes from public
+ view, where they are sensitive or they may contain VM-internal objects.
+ These Maps are updated very rarely. Rather than synchronize on
+ each access, we use copy-on-write */
+ private static volatile Map<Class<?>,String[]> fieldFilterMap;
+ private static volatile Map<Class<?>,String[]> methodFilterMap;
+
+ static {
+ Map<Class<?>,String[]> map = new HashMap<Class<?>,String[]>();
+ map.put(Reflection.class,
+ new String[] {"fieldFilterMap", "methodFilterMap"});
+ map.put(System.class, new String[] {"security"});
+ map.put(Class.class, new String[] {"classLoader"});
+ fieldFilterMap = map;
+
+ methodFilterMap = new HashMap<>();
+ }
+
+ /** Returns the class of the caller of the method calling this method,
+ ignoring frames associated with java.lang.reflect.Method.invoke()
+ and its implementation. */
+ @CallerSensitive
+ public static native Class<?> getCallerClass();
+
+ /**
+ * @deprecated This method will be removed in JDK 9.
+ * This method is a private JDK API and retained temporarily for
+ * existing code to run until a replacement API is defined.
+ */
+ @Deprecated
+ public static native Class<?> getCallerClass(int depth);
+
+ /** Retrieves the access flags written to the class file. For
+ inner classes these flags may differ from those returned by
+ Class.getModifiers(), which searches the InnerClasses
+ attribute to find the source-level access flags. This is used
+ instead of Class.getModifiers() for run-time access checks due
+ to compatibility reasons; see 4471811. Only the values of the
+ low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be
+ valid. */
+ public static native int getClassAccessFlags(Class<?> c);
+
+ /** A quick "fast-path" check to try to avoid getCallerClass()
+ calls. */
+ public static boolean quickCheckMemberAccess(Class<?> memberClass,
+ int modifiers)
+ {
+ return Modifier.isPublic(getClassAccessFlags(memberClass) & modifiers);
+ }
+
+ public static void ensureMemberAccess(Class<?> currentClass,
+ Class<?> memberClass,
+ Object target,
+ int modifiers)
+ throws IllegalAccessException
+ {
+ if (currentClass == null || memberClass == null) {
+ throw new InternalError();
+ }
+
+ if (!verifyMemberAccess(currentClass, memberClass, target, modifiers)) {
+ throw new IllegalAccessException("Class " + currentClass.getName() +
+ " can not access a member of class " +
+ memberClass.getName() +
+ " with modifiers \"" +
+ Modifier.toString(modifiers) +
+ "\"");
+ }
+ }
+
+ public static boolean verifyMemberAccess(Class<?> currentClass,
+ // Declaring class of field
+ // or method
+ Class<?> memberClass,
+ // May be NULL in case of statics
+ Object target,
+ int modifiers)
+ {
+ // Verify that currentClass can access a field, method, or
+ // constructor of memberClass, where that member's access bits are
+ // "modifiers".
+
+ boolean gotIsSameClassPackage = false;
+ boolean isSameClassPackage = false;
+
+ if (currentClass == memberClass) {
+ // Always succeeds
+ return true;
+ }
+
+ if (!Modifier.isPublic(getClassAccessFlags(memberClass))) {
+ isSameClassPackage = isSameClassPackage(currentClass, memberClass);
+ gotIsSameClassPackage = true;
+ if (!isSameClassPackage) {
+ return false;
+ }
+ }
+
+ // At this point we know that currentClass can access memberClass.
+
+ if (Modifier.isPublic(modifiers)) {
+ return true;
+ }
+
+ boolean successSoFar = false;
+
+ if (Modifier.isProtected(modifiers)) {
+ // See if currentClass is a subclass of memberClass
+ if (isSubclassOf(currentClass, memberClass)) {
+ successSoFar = true;
+ }
+ }
+
+ if (!successSoFar && !Modifier.isPrivate(modifiers)) {
+ if (!gotIsSameClassPackage) {
+ isSameClassPackage = isSameClassPackage(currentClass,
+ memberClass);
+ gotIsSameClassPackage = true;
+ }
+
+ if (isSameClassPackage) {
+ successSoFar = true;
+ }
+ }
+
+ if (!successSoFar) {
+ return false;
+ }
+
+ if (Modifier.isProtected(modifiers)) {
+ // Additional test for protected members: JLS 6.6.2
+ Class<?> targetClass = (target == null ? memberClass : target.getClass());
+ if (targetClass != currentClass) {
+ if (!gotIsSameClassPackage) {
+ isSameClassPackage = isSameClassPackage(currentClass, memberClass);
+ gotIsSameClassPackage = true;
+ }
+ if (!isSameClassPackage) {
+ if (!isSubclassOf(targetClass, currentClass)) {
+ return false;
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+
+ private static boolean isSameClassPackage(Class<?> c1, Class<?> c2) {
+ return isSameClassPackage(c1.getClassLoader(), c1.getName(),
+ c2.getClassLoader(), c2.getName());
+ }
+
+ /** Returns true if two classes are in the same package; classloader
+ and classname information is enough to determine a class's package */
+ private static boolean isSameClassPackage(ClassLoader loader1, String name1,
+ ClassLoader loader2, String name2)
+ {
+ if (loader1 != loader2) {
+ return false;
+ } else {
+ int lastDot1 = name1.lastIndexOf('.');
+ int lastDot2 = name2.lastIndexOf('.');
+ if ((lastDot1 == -1) || (lastDot2 == -1)) {
+ // One of the two doesn't have a package. Only return true
+ // if the other one also doesn't have a package.
+ return (lastDot1 == lastDot2);
+ } else {
+ int idx1 = 0;
+ int idx2 = 0;
+
+ // Skip over '['s
+ if (name1.charAt(idx1) == '[') {
+ do {
+ idx1++;
+ } while (name1.charAt(idx1) == '[');
+ if (name1.charAt(idx1) != 'L') {
+ // Something is terribly wrong. Shouldn't be here.
+ throw new InternalError("Illegal class name " + name1);
+ }
+ }
+ if (name2.charAt(idx2) == '[') {
+ do {
+ idx2++;
+ } while (name2.charAt(idx2) == '[');
+ if (name2.charAt(idx2) != 'L') {
+ // Something is terribly wrong. Shouldn't be here.
+ throw new InternalError("Illegal class name " + name2);
+ }
+ }
+
+ // Check that package part is identical
+ int length1 = lastDot1 - idx1;
+ int length2 = lastDot2 - idx2;
+
+ if (length1 != length2) {
+ return false;
+ }
+ return name1.regionMatches(false, idx1, name2, idx2, length1);
+ }
+ }
+ }
+
+ static boolean isSubclassOf(Class<?> queryClass,
+ Class<?> ofClass)
+ {
+ while (queryClass != null) {
+ if (queryClass == ofClass) {
+ return true;
+ }
+ queryClass = queryClass.getSuperclass();
+ }
+ return false;
+ }
+
+ // fieldNames must contain only interned Strings
+ public static synchronized void registerFieldsToFilter(Class<?> containingClass,
+ String ... fieldNames) {
+ fieldFilterMap =
+ registerFilter(fieldFilterMap, containingClass, fieldNames);
+ }
+
+ // methodNames must contain only interned Strings
+ public static synchronized void registerMethodsToFilter(Class<?> containingClass,
+ String ... methodNames) {
+ methodFilterMap =
+ registerFilter(methodFilterMap, containingClass, methodNames);
+ }
+
+ private static Map<Class<?>,String[]> registerFilter(Map<Class<?>,String[]> map,
+ Class<?> containingClass, String ... names) {
+ if (map.get(containingClass) != null) {
+ throw new IllegalArgumentException
+ ("Filter already registered: " + containingClass);
+ }
+ map = new HashMap<Class<?>,String[]>(map);
+ map.put(containingClass, names);
+ return map;
+ }
+
+ public static Field[] filterFields(Class<?> containingClass,
+ Field[] fields) {
+ if (fieldFilterMap == null) {
+ // Bootstrapping
+ return fields;
+ }
+ return (Field[])filter(fields, fieldFilterMap.get(containingClass));
+ }
+
+ public static Method[] filterMethods(Class<?> containingClass, Method[] methods) {
+ if (methodFilterMap == null) {
+ // Bootstrapping
+ return methods;
+ }
+ return (Method[])filter(methods, methodFilterMap.get(containingClass));
+ }
+
+ private static Member[] filter(Member[] members, String[] filteredNames) {
+ if ((filteredNames == null) || (members.length == 0)) {
+ return members;
+ }
+ int numNewMembers = 0;
+ for (Member member : members) {
+ boolean shouldSkip = false;
+ for (String filteredName : filteredNames) {
+ if (member.getName() == filteredName) {
+ shouldSkip = true;
+ break;
+ }
+ }
+ if (!shouldSkip) {
+ ++numNewMembers;
+ }
+ }
+ Member[] newMembers =
+ (Member[])Array.newInstance(members[0].getClass(), numNewMembers);
+ int destIdx = 0;
+ for (Member member : members) {
+ boolean shouldSkip = false;
+ for (String filteredName : filteredNames) {
+ if (member.getName() == filteredName) {
+ shouldSkip = true;
+ break;
+ }
+ }
+ if (!shouldSkip) {
+ newMembers[destIdx++] = member;
+ }
+ }
+ return newMembers;
+ }
+
+ /**
+ * Tests if the given method is caller-sensitive and the declaring class
+ * is defined by either the bootstrap class loader or extension class loader.
+ */
+ public static boolean isCallerSensitive(Method m) {
+ final ClassLoader loader = m.getDeclaringClass().getClassLoader();
+ if (isSystemDomainLoader(loader) || isExtClassLoader(loader)) {
+ return m.isAnnotationPresent(CallerSensitive.class);
+ }
+ return false;
+ }
+
+ private static boolean isExtClassLoader(ClassLoader loader) {
+ ClassLoader cl = ClassLoader.getSystemClassLoader();
+ while (cl != null) {
+ if (cl.getParent() == null && cl == loader) {
+ return true;
+ }
+ cl = cl.getParent();
+ }
+ return false;
+ }
+
+
+
+ /**
+ * Returns true if the given class loader is in the system domain
+ * in which all permissions are granted.
+ */
+ public static boolean isSystemDomainLoader(ClassLoader loader) {
+ return loader == null;
+ }
+}
diff --git a/src/Java/sun/repackage/ReflectionFactory.java b/src/Java/sun/repackage/ReflectionFactory.java
new file mode 100644
index 0000000000..a1e35a70bb
--- /dev/null
+++ b/src/Java/sun/repackage/ReflectionFactory.java
@@ -0,0 +1,706 @@
+/*
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.io.Externalizable;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamClass;
+import java.io.OptionalDataException;
+import java.io.Serializable;
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.reflect.Field;
+import java.lang.reflect.Executable;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
+import java.security.AccessController;
+import java.security.Permission;
+import java.security.PrivilegedAction;
+import java.util.Objects;
+
+
+/** <P> The master factory for all reflective objects, both those in
+ java.lang.reflect (Fields, Methods, Constructors) as well as their
+ delegates (FieldAccessors, MethodAccessors, ConstructorAccessors).
+ </P>
+
+ <P> The methods in this class are extremely unsafe and can cause
+ subversion of both the language and the verifier. For this reason,
+ they are all instance methods, and access to the constructor of
+ this factory is guarded by a security check, in similar style to
+ sun.misc.Unsafe. </P>
+*/
+
+public class ReflectionFactory {
+
+ private static boolean initted = false;
+ private static final Permission reflectionFactoryAccessPerm
+ = new RuntimePermission("reflectionFactoryAccess");
+ private static final ReflectionFactory soleInstance = new ReflectionFactory();
+ // Provides access to package-private mechanisms in java.lang.reflect
+ private static volatile LangReflectAccess langReflectAccess;
+
+ /* Method for static class initializer <clinit>, or null */
+ private static volatile Method hasStaticInitializerMethod;
+
+ //
+ // "Inflation" mechanism. Loading bytecodes to implement
+ // Method.invoke() and Constructor.newInstance() currently costs
+ // 3-4x more than an invocation via native code for the first
+ // invocation (though subsequent invocations have been benchmarked
+ // to be over 20x faster). Unfortunately this cost increases
+ // startup time for certain applications that use reflection
+ // intensively (but only once per class) to bootstrap themselves.
+ // To avoid this penalty we reuse the existing JVM entry points
+ // for the first few invocations of Methods and Constructors and
+ // then switch to the bytecode-based implementations.
+ //
+ // Package-private to be accessible to NativeMethodAccessorImpl
+ // and NativeConstructorAccessorImpl
+ private static boolean noInflation = false;
+ private static int inflationThreshold = 15;
+
+ private ReflectionFactory() {}
+
+ /**
+ * A convenience class for acquiring the capability to instantiate
+ * reflective objects. Use this instead of a raw call to {@link
+ * #getReflectionFactory} in order to avoid being limited by the
+ * permissions of your callers.
+ *
+ * <p>An instance of this class can be used as the argument of
+ * <code>AccessController.doPrivileged</code>.
+ */
+ public static final class GetReflectionFactoryAction
+ implements PrivilegedAction<ReflectionFactory> {
+ public ReflectionFactory run() {
+ return getReflectionFactory();
+ }
+ }
+
+ /**
+ * Provides the caller with the capability to instantiate reflective
+ * objects.
+ *
+ * <p> First, if there is a security manager, its
+ * <code>checkPermission</code> method is called with a {@link
+ * java.lang.RuntimePermission} with target
+ * <code>"reflectionFactoryAccess"</code>. This may result in a
+ * security exception.
+ *
+ * <p> The returned <code>ReflectionFactory</code> object should be
+ * carefully guarded by the caller, since it can be used to read and
+ * write private data and invoke private methods, as well as to load
+ * unverified bytecodes. It must never be passed to untrusted code.
+ *
+ * @exception SecurityException if a security manager exists and its
+ * <code>checkPermission</code> method doesn't allow
+ * access to the RuntimePermission "reflectionFactoryAccess". */
+ public static ReflectionFactory getReflectionFactory() {
+ SecurityManager security = System.getSecurityManager();
+ if (security != null) {
+ // TO DO: security.checkReflectionFactoryAccess();
+ security.checkPermission(reflectionFactoryAccessPerm);
+ }
+ return soleInstance;
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ // Routines used by java.lang.reflect
+ //
+ //
+
+ /** Called only by java.lang.reflect.Modifier's static initializer */
+ public void setLangReflectAccess(LangReflectAccess access) {
+ langReflectAccess = access;
+ }
+
+ /**
+ * Note: this routine can cause the declaring class for the field
+ * be initialized and therefore must not be called until the
+ * first get/set of this field.
+ * @param field the field
+ * @param override true if caller has overridden aaccessibility
+ */
+ public FieldAccessor newFieldAccessor(Field field, boolean override) {
+ checkInitted();
+ return UnsafeFieldAccessorFactory.newFieldAccessor(field, override);
+ }
+
+ public MethodAccessor newMethodAccessor(Method method) {
+ checkInitted();
+
+ if (noInflation && !ReflectUtil.isVMAnonymousClass(method.getDeclaringClass())) {
+ return new MethodAccessorGenerator().
+ generateMethod(method.getDeclaringClass(),
+ method.getName(),
+ method.getParameterTypes(),
+ method.getReturnType(),
+ method.getExceptionTypes(),
+ method.getModifiers());
+ } else {
+ NativeMethodAccessorImpl acc =
+ new NativeMethodAccessorImpl(method);
+ DelegatingMethodAccessorImpl res =
+ new DelegatingMethodAccessorImpl(acc);
+ acc.setParent(res);
+ return res;
+ }
+ }
+
+ public ConstructorAccessor newConstructorAccessor(Constructor<?> c) {
+ checkInitted();
+
+ Class<?> declaringClass = c.getDeclaringClass();
+ if (Modifier.isAbstract(declaringClass.getModifiers())) {
+ return new InstantiationExceptionConstructorAccessorImpl(null);
+ }
+ if (declaringClass == Class.class) {
+ return new InstantiationExceptionConstructorAccessorImpl
+ ("Can not instantiate java.lang.Class");
+ }
+ // Bootstrapping issue: since we use Class.newInstance() in
+ // the ConstructorAccessor generation process, we have to
+ // break the cycle here.
+ if (Reflection.isSubclassOf(declaringClass,
+ ConstructorAccessorImpl.class)) {
+ return new BootstrapConstructorAccessorImpl(c);
+ }
+
+ if (noInflation && !ReflectUtil.isVMAnonymousClass(c.getDeclaringClass())) {
+ return new MethodAccessorGenerator().
+ generateConstructor(c.getDeclaringClass(),
+ c.getParameterTypes(),
+ c.getExceptionTypes(),
+ c.getModifiers());
+ } else {
+ NativeConstructorAccessorImpl acc =
+ new NativeConstructorAccessorImpl(c);
+ DelegatingConstructorAccessorImpl res =
+ new DelegatingConstructorAccessorImpl(acc);
+ acc.setParent(res);
+ return res;
+ }
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ // Routines used by java.lang
+ //
+ //
+
+ /** Creates a new java.lang.reflect.Field. Access checks as per
+ java.lang.reflect.AccessibleObject are not overridden. */
+ public Field newField(Class<?> declaringClass,
+ String name,
+ Class<?> type,
+ int modifiers,
+ int slot,
+ String signature,
+ byte[] annotations)
+ {
+ return langReflectAccess().newField(declaringClass,
+ name,
+ type,
+ modifiers,
+ slot,
+ signature,
+ annotations);
+ }
+
+ /** Creates a new java.lang.reflect.Method. Access checks as per
+ java.lang.reflect.AccessibleObject are not overridden. */
+ public Method newMethod(Class<?> declaringClass,
+ String name,
+ Class<?>[] parameterTypes,
+ Class<?> returnType,
+ Class<?>[] checkedExceptions,
+ int modifiers,
+ int slot,
+ String signature,
+ byte[] annotations,
+ byte[] parameterAnnotations,
+ byte[] annotationDefault)
+ {
+ return langReflectAccess().newMethod(declaringClass,
+ name,
+ parameterTypes,
+ returnType,
+ checkedExceptions,
+ modifiers,
+ slot,
+ signature,
+ annotations,
+ parameterAnnotations,
+ annotationDefault);
+ }
+
+ /** Creates a new java.lang.reflect.Constructor. Access checks as
+ per java.lang.reflect.AccessibleObject are not overridden. */
+ public Constructor<?> newConstructor(Class<?> declaringClass,
+ Class<?>[] parameterTypes,
+ Class<?>[] checkedExceptions,
+ int modifiers,
+ int slot,
+ String signature,
+ byte[] annotations,
+ byte[] parameterAnnotations)
+ {
+ return langReflectAccess().newConstructor(declaringClass,
+ parameterTypes,
+ checkedExceptions,
+ modifiers,
+ slot,
+ signature,
+ annotations,
+ parameterAnnotations);
+ }
+
+ /** Gets the MethodAccessor object for a java.lang.reflect.Method */
+ public MethodAccessor getMethodAccessor(Method m) {
+ return langReflectAccess().getMethodAccessor(m);
+ }
+
+ /** Sets the MethodAccessor object for a java.lang.reflect.Method */
+ public void setMethodAccessor(Method m, MethodAccessor accessor) {
+ langReflectAccess().setMethodAccessor(m, accessor);
+ }
+
+ /** Gets the ConstructorAccessor object for a
+ java.lang.reflect.Constructor */
+ public ConstructorAccessor getConstructorAccessor(Constructor<?> c) {
+ return langReflectAccess().getConstructorAccessor(c);
+ }
+
+ /** Sets the ConstructorAccessor object for a
+ java.lang.reflect.Constructor */
+ public void setConstructorAccessor(Constructor<?> c,
+ ConstructorAccessor accessor)
+ {
+ langReflectAccess().setConstructorAccessor(c, accessor);
+ }
+
+ /** Makes a copy of the passed method. The returned method is a
+ "child" of the passed one; see the comments in Method.java for
+ details. */
+ public Method copyMethod(Method arg) {
+ return langReflectAccess().copyMethod(arg);
+ }
+
+ /** Makes a copy of the passed field. The returned field is a
+ "child" of the passed one; see the comments in Field.java for
+ details. */
+ public Field copyField(Field arg) {
+ return langReflectAccess().copyField(arg);
+ }
+
+ /** Makes a copy of the passed constructor. The returned
+ constructor is a "child" of the passed one; see the comments
+ in Constructor.java for details. */
+ public <T> Constructor<T> copyConstructor(Constructor<T> arg) {
+ return langReflectAccess().copyConstructor(arg);
+ }
+
+ /** Gets the byte[] that encodes TypeAnnotations on an executable.
+ */
+ public byte[] getExecutableTypeAnnotationBytes(Executable ex) {
+ return langReflectAccess().getExecutableTypeAnnotationBytes(ex);
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ // Routines used by serialization
+ //
+ //
+
+ /**
+ * Returns an accessible constructor capable of creating instances
+ * of the given class, initialized by the given constructor.
+ *
+ * @param classToInstantiate the class to instantiate
+ * @param constructorToCall the constructor to call
+ * @return an accessible constructor
+ */
+ public Constructor<?> newConstructorForSerialization
+ (Class<?> classToInstantiate, Constructor<?> constructorToCall)
+ {
+ // Fast path
+ if (constructorToCall.getDeclaringClass() == classToInstantiate) {
+ return constructorToCall;
+ }
+ return generateConstructor(classToInstantiate, constructorToCall);
+ }
+
+ /**
+ * Returns an accessible no-arg constructor for a class.
+ * The no-arg constructor is found searching the class and its supertypes.
+ *
+ * @param cl the class to instantiate
+ * @return a no-arg constructor for the class or {@code null} if
+ * the class or supertypes do not have a suitable no-arg constructor
+ */
+ public final Constructor<?> newConstructorForSerialization(Class<?> cl) {
+ Class<?> initCl = cl;
+ while (Serializable.class.isAssignableFrom(initCl)) {
+ if ((initCl = initCl.getSuperclass()) == null) {
+ return null;
+ }
+ }
+ Constructor<?> constructorToCall;
+ try {
+ constructorToCall = initCl.getDeclaredConstructor();
+ int mods = constructorToCall.getModifiers();
+ if ((mods & Modifier.PRIVATE) != 0 ||
+ ((mods & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 &&
+ !packageEquals(cl, initCl))) {
+ return null;
+ }
+ } catch (NoSuchMethodException ex) {
+ return null;
+ }
+ return generateConstructor(cl, constructorToCall);
+ }
+
+ private final Constructor<?> generateConstructor(Class<?> classToInstantiate,
+ Constructor<?> constructorToCall) {
+
+
+ ConstructorAccessor acc = new MethodAccessorGenerator().
+ generateSerializationConstructor(classToInstantiate,
+ constructorToCall.getParameterTypes(),
+ constructorToCall.getExceptionTypes(),
+ constructorToCall.getModifiers(),
+ constructorToCall.getDeclaringClass());
+ Constructor<?> c = newConstructor(constructorToCall.getDeclaringClass(),
+ constructorToCall.getParameterTypes(),
+ constructorToCall.getExceptionTypes(),
+ constructorToCall.getModifiers(),
+ langReflectAccess().
+ getConstructorSlot(constructorToCall),
+ langReflectAccess().
+ getConstructorSignature(constructorToCall),
+ langReflectAccess().
+ getConstructorAnnotations(constructorToCall),
+ langReflectAccess().
+ getConstructorParameterAnnotations(constructorToCall));
+ setConstructorAccessor(c, acc);
+ c.setAccessible(true);
+ return c;
+ }
+
+ /**
+ * Returns an accessible no-arg constructor for an externalizable class to be
+ * initialized using a public no-argument constructor.
+ *
+ * @param cl the class to instantiate
+ * @return A no-arg constructor for the class; returns {@code null} if
+ * the class does not implement {@link java.io.Externalizable}
+ */
+ public final Constructor<?> newConstructorForExternalization(Class<?> cl) {
+ if (!Externalizable.class.isAssignableFrom(cl)) {
+ return null;
+ }
+ try {
+ Constructor<?> cons = cl.getConstructor();
+ cons.setAccessible(true);
+ return cons;
+ } catch (NoSuchMethodException ex) {
+ return null;
+ }
+ }
+
+ /**
+ * Returns a direct MethodHandle for the {@code readObject} method on
+ * a Serializable class.
+ * The first argument of {@link MethodHandle#invoke} is the serializable
+ * object and the second argument is the {@code ObjectInputStream} passed to
+ * {@code readObject}.
+ *
+ * @param cl a Serializable class
+ * @return a direct MethodHandle for the {@code readObject} method of the class or
+ * {@code null} if the class does not have a {@code readObject} method
+ */
+ public final MethodHandle readObjectForSerialization(Class<?> cl) {
+ return findReadWriteObjectForSerialization(cl, "readObject", ObjectInputStream.class);
+ }
+
+ /**
+ * Returns a direct MethodHandle for the {@code readObjectNoData} method on
+ * a Serializable class.
+ * The first argument of {@link MethodHandle#invoke} is the serializable
+ * object and the second argument is the {@code ObjectInputStream} passed to
+ * {@code readObjectNoData}.
+ *
+ * @param cl a Serializable class
+ * @return a direct MethodHandle for the {@code readObjectNoData} method
+ * of the class or {@code null} if the class does not have a
+ * {@code readObjectNoData} method
+ */
+ public final MethodHandle readObjectNoDataForSerialization(Class<?> cl) {
+ return findReadWriteObjectForSerialization(cl, "readObjectNoData", ObjectInputStream.class);
+ }
+
+ /**
+ * Returns a direct MethodHandle for the {@code writeObject} method on
+ * a Serializable class.
+ * The first argument of {@link MethodHandle#invoke} is the serializable
+ * object and the second argument is the {@code ObjectOutputStream} passed to
+ * {@code writeObject}.
+ *
+ * @param cl a Serializable class
+ * @return a direct MethodHandle for the {@code writeObject} method of the class or
+ * {@code null} if the class does not have a {@code writeObject} method
+ */
+ public final MethodHandle writeObjectForSerialization(Class<?> cl) {
+ return findReadWriteObjectForSerialization(cl, "writeObject", ObjectOutputStream.class);
+ }
+
+ private final MethodHandle findReadWriteObjectForSerialization(Class<?> cl,
+ String methodName,
+ Class<?> streamClass) {
+ if (!Serializable.class.isAssignableFrom(cl)) {
+ return null;
+ }
+
+ try {
+ Method meth = cl.getDeclaredMethod(methodName, streamClass);
+ int mods = meth.getModifiers();
+ if (meth.getReturnType() != Void.TYPE ||
+ Modifier.isStatic(mods) ||
+ !Modifier.isPrivate(mods)) {
+ return null;
+ }
+ meth.setAccessible(true);
+ return MethodHandles.lookup().unreflect(meth);
+ } catch (NoSuchMethodException ex) {
+ return null;
+ } catch (IllegalAccessException ex1) {
+ throw new InternalError("Error", ex1);
+ }
+ }
+
+ /**
+ * Returns a direct MethodHandle for the {@code readResolve} method on
+ * a serializable class.
+ * The single argument of {@link MethodHandle#invoke} is the serializable
+ * object.
+ *
+ * @param cl the Serializable class
+ * @return a direct MethodHandle for the {@code readResolve} method of the class or
+ * {@code null} if the class does not have a {@code readResolve} method
+ */
+ public final MethodHandle readResolveForSerialization(Class<?> cl) {
+ return getReplaceResolveForSerialization(cl, "readResolve");
+ }
+
+ /**
+ * Returns a direct MethodHandle for the {@code writeReplace} method on
+ * a serializable class.
+ * The single argument of {@link MethodHandle#invoke} is the serializable
+ * object.
+ *
+ * @param cl the Serializable class
+ * @return a direct MethodHandle for the {@code writeReplace} method of the class or
+ * {@code null} if the class does not have a {@code writeReplace} method
+ */
+ public final MethodHandle writeReplaceForSerialization(Class<?> cl) {
+ return getReplaceResolveForSerialization(cl, "writeReplace");
+ }
+
+ /**
+ * Returns a direct MethodHandle for the {@code writeReplace} method on
+ * a serializable class.
+ * The single argument of {@link MethodHandle#invoke} is the serializable
+ * object.
+ *
+ * @param cl the Serializable class
+ * @return a direct MethodHandle for the {@code writeReplace} method of the class or
+ * {@code null} if the class does not have a {@code writeReplace} method
+ */
+ private MethodHandle getReplaceResolveForSerialization(Class<?> cl,
+ String methodName) {
+ if (!Serializable.class.isAssignableFrom(cl)) {
+ return null;
+ }
+
+ Class<?> defCl = cl;
+ while (defCl != null) {
+ try {
+ Method m = defCl.getDeclaredMethod(methodName);
+ if (m.getReturnType() != Object.class) {
+ return null;
+ }
+ int mods = m.getModifiers();
+ if (Modifier.isStatic(mods) | Modifier.isAbstract(mods)) {
+ return null;
+ } else if (Modifier.isPublic(mods) | Modifier.isProtected(mods)) {
+ // fall through
+ } else if (Modifier.isPrivate(mods) && (cl != defCl)) {
+ return null;
+ } else if (!packageEquals(cl, defCl)) {
+ return null;
+ }
+ try {
+ // Normal return
+ m.setAccessible(true);
+ return MethodHandles.lookup().unreflect(m);
+ } catch (IllegalAccessException ex0) {
+ // setAccessible should prevent IAE
+ throw new InternalError("Error", ex0);
+ }
+ } catch (NoSuchMethodException ex) {
+ defCl = defCl.getSuperclass();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns true if the class has a static initializer.
+ * The presence of a static initializer is used to compute the serialVersionUID.
+ * @param cl a serializable classLook
+ * @return {@code true} if the class has a static initializer,
+ * otherwise {@code false}
+ */
+ public final boolean hasStaticInitializerForSerialization(Class<?> cl) {
+ Method m = hasStaticInitializerMethod;
+ if (m == null) {
+ try {
+ m = ObjectStreamClass.class.getDeclaredMethod("hasStaticInitializer",
+ new Class<?>[]{Class.class});
+ m.setAccessible(true);
+ hasStaticInitializerMethod = m;
+ } catch (NoSuchMethodException ex) {
+ throw new InternalError("No such method hasStaticInitializer on "
+ + ObjectStreamClass.class, ex);
+ }
+ }
+ try {
+ return (Boolean) m.invoke(null, cl);
+ } catch (InvocationTargetException | IllegalAccessException ex) {
+ throw new InternalError("Exception invoking hasStaticInitializer", ex);
+ }
+ }
+
+ /**
+ * Returns a new OptionalDataException with {@code eof} set to {@code true}
+ * or {@code false}.
+ * @param bool the value of {@code eof} in the created OptionalDataException
+ * @return a new OptionalDataException
+ */
+ public final OptionalDataException newOptionalDataExceptionForSerialization(boolean bool) {
+ try {
+ Constructor<OptionalDataException> boolCtor =
+ OptionalDataException.class.getDeclaredConstructor(Boolean.TYPE);
+ boolCtor.setAccessible(true);
+ return boolCtor.newInstance(bool);
+ } catch (NoSuchMethodException | InstantiationException|
+ IllegalAccessException|InvocationTargetException ex) {
+ throw new InternalError("unable to create OptionalDataException", ex);
+ }
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ // Internals only below this point
+ //
+
+ static int inflationThreshold() {
+ return inflationThreshold;
+ }
+
+ /** We have to defer full initialization of this class until after
+ the static initializer is run since java.lang.reflect.Method's
+ static initializer (more properly, that for
+ java.lang.reflect.AccessibleObject) causes this class's to be
+ run, before the system properties are set up. */
+ private static void checkInitted() {
+ if (initted) return;
+ AccessController.doPrivileged(
+ new PrivilegedAction<Void>() {
+ public Void run() {
+ // Tests to ensure the system properties table is fully
+ // initialized. This is needed because reflection code is
+ // called very early in the initialization process (before
+ // command-line arguments have been parsed and therefore
+ // these user-settable properties installed.) We assume that
+ // if System.out is non-null then the System class has been
+ // fully initialized and that the bulk of the startup code
+ // has been run.
+
+ if (System.out == null) {
+ // java.lang.System not yet fully initialized
+ return null;
+ }
+
+ String val = System.getProperty("sun.reflect.noInflation");
+ if (val != null && val.equals("true")) {
+ noInflation = true;
+ }
+
+ val = System.getProperty("sun.reflect.inflationThreshold");
+ if (val != null) {
+ try {
+ inflationThreshold = Integer.parseInt(val);
+ } catch (NumberFormatException e) {
+ throw new RuntimeException("Unable to parse property sun.reflect.inflationThreshold", e);
+ }
+ }
+
+ initted = true;
+ return null;
+ }
+ });
+ }
+
+ private static LangReflectAccess langReflectAccess() {
+ if (langReflectAccess == null) {
+ // Call a static method to get class java.lang.reflect.Modifier
+ // initialized. Its static initializer will cause
+ // setLangReflectAccess() to be called from the context of the
+ // java.lang.reflect package.
+ Modifier.isPublic(Modifier.PUBLIC);
+ }
+ return langReflectAccess;
+ }
+
+ /**
+ * Returns true if classes are defined in the classloader and same package, false
+ * otherwise.
+ * @param cl1 a class
+ * @param cl2 another class
+ * @returns true if the two classes are in the same classloader and package
+ */
+ private static boolean packageEquals(Class<?> cl1, Class<?> cl2) {
+ return cl1.getClassLoader() == cl2.getClassLoader() &&
+ Objects.equals(cl1.getPackage(), cl2.getPackage());
+ }
+
+}
diff --git a/src/Java/sun/repackage/SecurityConstants.java b/src/Java/sun/repackage/SecurityConstants.java
new file mode 100644
index 0000000000..da2829cac1
--- /dev/null
+++ b/src/Java/sun/repackage/SecurityConstants.java
@@ -0,0 +1,227 @@
+/*
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.net.NetPermission;
+import java.net.SocketPermission;
+import java.security.AllPermission;
+import java.security.Permission;
+import java.security.SecurityPermission;
+
+/**
+ * Permission constants and string constants used to create permissions
+ * used throughout the JDK.
+ */
+public final class SecurityConstants {
+ // Cannot create one of these
+ private SecurityConstants () {
+ }
+
+ // Commonly used string constants for permission actions used by
+ // SecurityManager. Declare here for shortcut when checking permissions
+ // in FilePermission, SocketPermission, and PropertyPermission.
+
+ public static final String FILE_DELETE_ACTION = "delete";
+ public static final String FILE_EXECUTE_ACTION = "execute";
+ public static final String FILE_READ_ACTION = "read";
+ public static final String FILE_WRITE_ACTION = "write";
+ public static final String FILE_READLINK_ACTION = "readlink";
+
+ public static final String SOCKET_RESOLVE_ACTION = "resolve";
+ public static final String SOCKET_CONNECT_ACTION = "connect";
+ public static final String SOCKET_LISTEN_ACTION = "listen";
+ public static final String SOCKET_ACCEPT_ACTION = "accept";
+ public static final String SOCKET_CONNECT_ACCEPT_ACTION = "connect,accept";
+
+ public static final String PROPERTY_RW_ACTION = "read,write";
+ public static final String PROPERTY_READ_ACTION = "read";
+ public static final String PROPERTY_WRITE_ACTION = "write";
+
+ // Permission constants used in the various checkPermission() calls in JDK.
+
+ // java.lang.Class, java.lang.SecurityManager, java.lang.System,
+ // java.net.URLConnection, java.security.AllPermission, java.security.Policy,
+ // sun.security.provider.PolicyFile
+ public static final AllPermission ALL_PERMISSION = new AllPermission();
+
+ /**
+ * AWT Permissions used in the JDK.
+ */
+ public static class AWT {
+ private AWT() { }
+
+ /**
+ * The class name of the factory to create java.awt.AWTPermission objects.
+ */
+ private static final String AWTFactory = "sun.awt.AWTPermissionFactory";
+
+ /**
+ * The PermissionFactory to create AWT permissions (or null if AWT is
+ * not present)
+ */
+ private static final PermissionFactory<?> factory = permissionFactory();
+
+ private static PermissionFactory<?> permissionFactory() {
+ Class<?> c;
+ try {
+ c = Class.forName(AWTFactory, false, AWT.class.getClassLoader());
+ } catch (ClassNotFoundException e) {
+ // not available
+ return null;
+ }
+ // AWT present
+ try {
+ return (PermissionFactory<?>)c.newInstance();
+ } catch (ReflectiveOperationException x) {
+ throw new InternalError(x);
+ }
+ }
+
+ private static Permission newAWTPermission(String name) {
+ return (factory == null) ? null : factory.newPermission(name);
+ }
+
+ // java.lang.SecurityManager
+ public static final Permission TOPLEVEL_WINDOW_PERMISSION =
+ newAWTPermission("showWindowWithoutWarningBanner");
+
+ // java.lang.SecurityManager
+ public static final Permission ACCESS_CLIPBOARD_PERMISSION =
+ newAWTPermission("accessClipboard");
+
+ // java.lang.SecurityManager
+ public static final Permission CHECK_AWT_EVENTQUEUE_PERMISSION =
+ newAWTPermission("accessEventQueue");
+
+ // java.awt.Dialog
+ public static final Permission TOOLKIT_MODALITY_PERMISSION =
+ newAWTPermission("toolkitModality");
+
+ // java.awt.Robot
+ public static final Permission READ_DISPLAY_PIXELS_PERMISSION =
+ newAWTPermission("readDisplayPixels");
+
+ // java.awt.Robot
+ public static final Permission CREATE_ROBOT_PERMISSION =
+ newAWTPermission("createRobot");
+
+ // java.awt.MouseInfo
+ public static final Permission WATCH_MOUSE_PERMISSION =
+ newAWTPermission("watchMousePointer");
+
+ // java.awt.Window
+ public static final Permission SET_WINDOW_ALWAYS_ON_TOP_PERMISSION =
+ newAWTPermission("setWindowAlwaysOnTop");
+
+ // java.awt.Toolkit
+ public static final Permission ALL_AWT_EVENTS_PERMISSION =
+ newAWTPermission("listenToAllAWTEvents");
+
+ // java.awt.SystemTray
+ public static final Permission ACCESS_SYSTEM_TRAY_PERMISSION =
+ newAWTPermission("accessSystemTray");
+ }
+
+ // java.net.URL
+ public static final NetPermission SPECIFY_HANDLER_PERMISSION =
+ new NetPermission("specifyStreamHandler");
+
+ // java.net.ProxySelector
+ public static final NetPermission SET_PROXYSELECTOR_PERMISSION =
+ new NetPermission("setProxySelector");
+
+ // java.net.ProxySelector
+ public static final NetPermission GET_PROXYSELECTOR_PERMISSION =
+ new NetPermission("getProxySelector");
+
+ // java.net.CookieHandler
+ public static final NetPermission SET_COOKIEHANDLER_PERMISSION =
+ new NetPermission("setCookieHandler");
+
+ // java.net.CookieHandler
+ public static final NetPermission GET_COOKIEHANDLER_PERMISSION =
+ new NetPermission("getCookieHandler");
+
+ // java.net.ResponseCache
+ public static final NetPermission SET_RESPONSECACHE_PERMISSION =
+ new NetPermission("setResponseCache");
+
+ // java.net.ResponseCache
+ public static final NetPermission GET_RESPONSECACHE_PERMISSION =
+ new NetPermission("getResponseCache");
+
+ // java.net.ServerSocket, java.net.Socket
+ public static final NetPermission SET_SOCKETIMPL_PERMISSION =
+ new NetPermission("setSocketImpl");
+
+ // java.lang.SecurityManager, sun.applet.AppletPanel, sun.misc.Launcher
+ public static final RuntimePermission CREATE_CLASSLOADER_PERMISSION =
+ new RuntimePermission("createClassLoader");
+
+ // java.lang.SecurityManager
+ public static final RuntimePermission CHECK_MEMBER_ACCESS_PERMISSION =
+ new RuntimePermission("accessDeclaredMembers");
+
+ // java.lang.SecurityManager, sun.applet.AppletSecurity
+ public static final RuntimePermission MODIFY_THREAD_PERMISSION =
+ new RuntimePermission("modifyThread");
+
+ // java.lang.SecurityManager, sun.applet.AppletSecurity
+ public static final RuntimePermission MODIFY_THREADGROUP_PERMISSION =
+ new RuntimePermission("modifyThreadGroup");
+
+ // java.lang.Class
+ public static final RuntimePermission GET_PD_PERMISSION =
+ new RuntimePermission("getProtectionDomain");
+
+ // java.lang.Class, java.lang.ClassLoader, java.lang.Thread
+ public static final RuntimePermission GET_CLASSLOADER_PERMISSION =
+ new RuntimePermission("getClassLoader");
+
+ // java.lang.Thread
+ public static final RuntimePermission STOP_THREAD_PERMISSION =
+ new RuntimePermission("stopThread");
+
+ // java.lang.Thread
+ public static final RuntimePermission GET_STACK_TRACE_PERMISSION =
+ new RuntimePermission("getStackTrace");
+
+ // java.security.AccessControlContext
+ public static final SecurityPermission CREATE_ACC_PERMISSION =
+ new SecurityPermission("createAccessControlContext");
+
+ // java.security.AccessControlContext
+ public static final SecurityPermission GET_COMBINER_PERMISSION =
+ new SecurityPermission("getDomainCombiner");
+
+ // java.security.Policy, java.security.ProtectionDomain
+ public static final SecurityPermission GET_POLICY_PERMISSION =
+ new SecurityPermission ("getPolicy");
+
+ // java.lang.SecurityManager
+ public static final SocketPermission LOCAL_LISTEN_PERMISSION =
+ new SocketPermission("localhost:0", SOCKET_LISTEN_ACTION);
+}
diff --git a/src/Java/sun/repackage/SerializationConstructorAccessorImpl.java b/src/Java/sun/repackage/SerializationConstructorAccessorImpl.java
new file mode 100644
index 0000000000..c07a4f82a1
--- /dev/null
+++ b/src/Java/sun/repackage/SerializationConstructorAccessorImpl.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+/** <P> Java serialization (in java.io) expects to be able to
+ instantiate a class and invoke a no-arg constructor of that
+ class's first non-Serializable superclass. This is not a valid
+ operation according to the VM specification; one can not (for
+ classes A and B, where B is a subclass of A) write "new B;
+ invokespecial A()" without getting a verification error. </P>
+
+ <P> In all other respects, the bytecode-based reflection framework
+ can be reused for this purpose. This marker class was originally
+ known to the VM and verification disabled for it and all
+ subclasses, but the bug fix for 4486457 necessitated disabling
+ verification for all of the dynamically-generated bytecodes
+ associated with reflection. This class has been left in place to
+ make future debugging easier. </P> */
+
+abstract class SerializationConstructorAccessorImpl
+ extends ConstructorAccessorImpl {
+}
diff --git a/src/Java/sun/repackage/UTF8.java b/src/Java/sun/repackage/UTF8.java
new file mode 100644
index 0000000000..0ff75f5f44
--- /dev/null
+++ b/src/Java/sun/repackage/UTF8.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+/** It is necessary to use a "bootstrap" UTF-8 encoder for encoding
+ constant pool entries because the character set converters rely on
+ Class.newInstance(). */
+
+class UTF8 {
+ // This encoder is not quite correct. It does not handle surrogate pairs.
+ static byte[] encode(String str) {
+ int len = str.length();
+ byte[] res = new byte[utf8Length(str)];
+ int utf8Idx = 0;
+ try {
+ for (int i = 0; i < len; i++) {
+ int c = str.charAt(i) & 0xFFFF;
+ if (c >= 0x0001 && c <= 0x007F) {
+ res[utf8Idx++] = (byte) c;
+ } else if (c == 0x0000 ||
+ (c >= 0x0080 && c <= 0x07FF)) {
+ res[utf8Idx++] = (byte) (0xC0 + (c >> 6));
+ res[utf8Idx++] = (byte) (0x80 + (c & 0x3F));
+ } else {
+ res[utf8Idx++] = (byte) (0xE0 + (c >> 12));
+ res[utf8Idx++] = (byte) (0x80 + ((c >> 6) & 0x3F));
+ res[utf8Idx++] = (byte) (0x80 + (c & 0x3F));
+ }
+ }
+ } catch (ArrayIndexOutOfBoundsException e) {
+ throw new InternalError
+ ("Bug in sun.reflect bootstrap UTF-8 encoder", e);
+ }
+ return res;
+ }
+
+ private static int utf8Length(String str) {
+ int len = str.length();
+ int utf8Len = 0;
+ for (int i = 0; i < len; i++) {
+ int c = str.charAt(i) & 0xFFFF;
+ if (c >= 0x0001 && c <= 0x007F) {
+ utf8Len += 1;
+ } else if (c == 0x0000 ||
+ (c >= 0x0080 && c <= 0x07FF)) {
+ utf8Len += 2;
+ } else {
+ utf8Len += 3;
+ }
+ }
+ return utf8Len;
+ }
+}
diff --git a/src/Java/sun/repackage/Unsafe.java b/src/Java/sun/repackage/Unsafe.java
new file mode 100644
index 0000000000..38b00b54df
--- /dev/null
+++ b/src/Java/sun/repackage/Unsafe.java
@@ -0,0 +1,1146 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.security.*;
+
+import sun.repackage.CallerSensitive;
+import sun.repackage.Reflection;
+
+import java.lang.reflect.*;
+
+
+/**
+ * A collection of methods for performing low-level, unsafe operations.
+ * Although the class and all methods are public, use of this class is
+ * limited because only trusted code can obtain instances of it.
+ *
+ * @author John R. Rose
+ * @see #getUnsafe
+ */
+
+public final class Unsafe {
+
+ private static native void registerNatives();
+ static {
+ registerNatives();
+ sun.repackage.Reflection.registerMethodsToFilter(Unsafe.class, "getUnsafe");
+ }
+
+ private Unsafe() {}
+
+ private static final Unsafe theUnsafe = new Unsafe();
+
+ /**
+ * Provides the caller with the capability of performing unsafe
+ * operations.
+ *
+ * <p> The returned <code>Unsafe</code> object should be carefully guarded
+ * by the caller, since it can be used to read and write data at arbitrary
+ * memory addresses. It must never be passed to untrusted code.
+ *
+ * <p> Most methods in this class are very low-level, and correspond to a
+ * small number of hardware instructions (on typical machines). Compilers
+ * are encouraged to optimize these methods accordingly.
+ *
+ * <p> Here is a suggested idiom for using unsafe operations:
+ *
+ * <blockquote><pre>
+ * class MyTrustedClass {
+ * private static final Unsafe unsafe = Unsafe.getUnsafe();
+ * ...
+ * private long myCountAddress = ...;
+ * public int getCount() { return unsafe.getByte(myCountAddress); }
+ * }
+ * </pre></blockquote>
+ *
+ * (It may assist compilers to make the local variable be
+ * <code>final</code>.)
+ *
+ * @exception SecurityException if a security manager exists and its
+ * <code>checkPropertiesAccess</code> method doesn't allow
+ * access to the system properties.
+ */
+ @CallerSensitive
+ public static Unsafe getUnsafe() {
+ Class<?> caller = Reflection.getCallerClass();
+ if (!Reflection.isSystemDomainLoader(caller.getClassLoader()))
+ throw new SecurityException("Unsafe");
+ return theUnsafe;
+ }
+
+ /// peek and poke operations
+ /// (compilers should optimize these to memory ops)
+
+ // These work on object fields in the Java heap.
+ // They will not work on elements of packed arrays.
+
+ /**
+ * Fetches a value from a given Java variable.
+ * More specifically, fetches a field or array element within the given
+ * object <code>o</code> at the given offset, or (if <code>o</code> is
+ * null) from the memory address whose numerical value is the given
+ * offset.
+ * <p>
+ * The results are undefined unless one of the following cases is true:
+ * <ul>
+ * <li>The offset was obtained from {@link #objectFieldOffset} on
+ * the {@link java.lang.reflect.Field} of some Java field and the object
+ * referred to by <code>o</code> is of a class compatible with that
+ * field's class.
+ *
+ * <li>The offset and object reference <code>o</code> (either null or
+ * non-null) were both obtained via {@link #staticFieldOffset}
+ * and {@link #staticFieldBase} (respectively) from the
+ * reflective {@link Field} representation of some Java field.
+ *
+ * <li>The object referred to by <code>o</code> is an array, and the offset
+ * is an integer of the form <code>B+N*S</code>, where <code>N</code> is
+ * a valid index into the array, and <code>B</code> and <code>S</code> are
+ * the values obtained by {@link #arrayBaseOffset} and {@link
+ * #arrayIndexScale} (respectively) from the array's class. The value
+ * referred to is the <code>N</code><em>th</em> element of the array.
+ *
+ * </ul>
+ * <p>
+ * If one of the above cases is true, the call references a specific Java
+ * variable (field or array element). However, the results are undefined
+ * if that variable is not in fact of the type returned by this method.
+ * <p>
+ * This method refers to a variable by means of two parameters, and so
+ * it provides (in effect) a <em>double-register</em> addressing mode
+ * for Java variables. When the object reference is null, this method
+ * uses its offset as an absolute address. This is similar in operation
+ * to methods such as {@link #getInt(long)}, which provide (in effect) a
+ * <em>single-register</em> addressing mode for non-Java variables.
+ * However, because Java variables may have a different layout in memory
+ * from non-Java variables, programmers should not assume that these
+ * two addressing modes are ever equivalent. Also, programmers should
+ * remember that offsets from the double-register addressing mode cannot
+ * be portably confused with longs used in the single-register addressing
+ * mode.
+ *
+ * @param o Java heap object in which the variable resides, if any, else
+ * null
+ * @param offset indication of where the variable resides in a Java heap
+ * object, if any, else a memory address locating the variable
+ * statically
+ * @return the value fetched from the indicated Java variable
+ * @throws RuntimeException No defined exceptions are thrown, not even
+ * {@link NullPointerException}
+ */
+ public native int getInt(Object o, long offset);
+
+ /**
+ * Stores a value into a given Java variable.
+ * <p>
+ * The first two parameters are interpreted exactly as with
+ * {@link #getInt(Object, long)} to refer to a specific
+ * Java variable (field or array element). The given value
+ * is stored into that variable.
+ * <p>
+ * The variable must be of the same type as the method
+ * parameter <code>x</code>.
+ *
+ * @param o Java heap object in which the variable resides, if any, else
+ * null
+ * @param offset indication of where the variable resides in a Java heap
+ * object, if any, else a memory address locating the variable
+ * statically
+ * @param x the value to store into the indicated Java variable
+ * @throws RuntimeException No defined exceptions are thrown, not even
+ * {@link NullPointerException}
+ */
+ public native void putInt(Object o, long offset, int x);
+
+ /**
+ * Fetches a reference value from a given Java variable.
+ * @see #getInt(Object, long)
+ */
+ public native Object getObject(Object o, long offset);
+
+ /**
+ * Stores a reference value into a given Java variable.
+ * <p>
+ * Unless the reference <code>x</code> being stored is either null
+ * or matches the field type, the results are undefined.
+ * If the reference <code>o</code> is non-null, car marks or
+ * other store barriers for that object (if the VM requires them)
+ * are updated.
+ * @see #putInt(Object, int, int)
+ */
+ public native void putObject(Object o, long offset, Object x);
+
+ /** @see #getInt(Object, long) */
+ public native boolean getBoolean(Object o, long offset);
+ /** @see #putInt(Object, int, int) */
+ public native void putBoolean(Object o, long offset, boolean x);
+ /** @see #getInt(Object, long) */
+ public native byte getByte(Object o, long offset);
+ /** @see #putInt(Object, int, int) */
+ public native void putByte(Object o, long offset, byte x);
+ /** @see #getInt(Object, long) */
+ public native short getShort(Object o, long offset);
+ /** @see #putInt(Object, int, int) */
+ public native void putShort(Object o, long offset, short x);
+ /** @see #getInt(Object, long) */
+ public native char getChar(Object o, long offset);
+ /** @see #putInt(Object, int, int) */
+ public native void putChar(Object o, long offset, char x);
+ /** @see #getInt(Object, long) */
+ public native long getLong(Object o, long offset);
+ /** @see #putInt(Object, int, int) */
+ public native void putLong(Object o, long offset, long x);
+ /** @see #getInt(Object, long) */
+ public native float getFloat(Object o, long offset);
+ /** @see #putInt(Object, int, int) */
+ public native void putFloat(Object o, long offset, float x);
+ /** @see #getInt(Object, long) */
+ public native double getDouble(Object o, long offset);
+ /** @see #putInt(Object, int, int) */
+ public native void putDouble(Object o, long offset, double x);
+
+ /**
+ * This method, like all others with 32-bit offsets, was native
+ * in a previous release but is now a wrapper which simply casts
+ * the offset to a long value. It provides backward compatibility
+ * with bytecodes compiled against 1.4.
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public int getInt(Object o, int offset) {
+ return getInt(o, (long)offset);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public void putInt(Object o, int offset, int x) {
+ putInt(o, (long)offset, x);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public Object getObject(Object o, int offset) {
+ return getObject(o, (long)offset);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public void putObject(Object o, int offset, Object x) {
+ putObject(o, (long)offset, x);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public boolean getBoolean(Object o, int offset) {
+ return getBoolean(o, (long)offset);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public void putBoolean(Object o, int offset, boolean x) {
+ putBoolean(o, (long)offset, x);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public byte getByte(Object o, int offset) {
+ return getByte(o, (long)offset);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public void putByte(Object o, int offset, byte x) {
+ putByte(o, (long)offset, x);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public short getShort(Object o, int offset) {
+ return getShort(o, (long)offset);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public void putShort(Object o, int offset, short x) {
+ putShort(o, (long)offset, x);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public char getChar(Object o, int offset) {
+ return getChar(o, (long)offset);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public void putChar(Object o, int offset, char x) {
+ putChar(o, (long)offset, x);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public long getLong(Object o, int offset) {
+ return getLong(o, (long)offset);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public void putLong(Object o, int offset, long x) {
+ putLong(o, (long)offset, x);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public float getFloat(Object o, int offset) {
+ return getFloat(o, (long)offset);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public void putFloat(Object o, int offset, float x) {
+ putFloat(o, (long)offset, x);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public double getDouble(Object o, int offset) {
+ return getDouble(o, (long)offset);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public void putDouble(Object o, int offset, double x) {
+ putDouble(o, (long)offset, x);
+ }
+
+ // These work on values in the C heap.
+
+ /**
+ * Fetches a value from a given memory address. If the address is zero, or
+ * does not point into a block obtained from {@link #allocateMemory}, the
+ * results are undefined.
+ *
+ * @see #allocateMemory
+ */
+ public native byte getByte(long address);
+
+ /**
+ * Stores a value into a given memory address. If the address is zero, or
+ * does not point into a block obtained from {@link #allocateMemory}, the
+ * results are undefined.
+ *
+ * @see #getByte(long)
+ */
+ public native void putByte(long address, byte x);
+
+ /** @see #getByte(long) */
+ public native short getShort(long address);
+ /** @see #putByte(long, byte) */
+ public native void putShort(long address, short x);
+ /** @see #getByte(long) */
+ public native char getChar(long address);
+ /** @see #putByte(long, byte) */
+ public native void putChar(long address, char x);
+ /** @see #getByte(long) */
+ public native int getInt(long address);
+ /** @see #putByte(long, byte) */
+ public native void putInt(long address, int x);
+ /** @see #getByte(long) */
+ public native long getLong(long address);
+ /** @see #putByte(long, byte) */
+ public native void putLong(long address, long x);
+ /** @see #getByte(long) */
+ public native float getFloat(long address);
+ /** @see #putByte(long, byte) */
+ public native void putFloat(long address, float x);
+ /** @see #getByte(long) */
+ public native double getDouble(long address);
+ /** @see #putByte(long, byte) */
+ public native void putDouble(long address, double x);
+
+ /**
+ * Fetches a native pointer from a given memory address. If the address is
+ * zero, or does not point into a block obtained from {@link
+ * #allocateMemory}, the results are undefined.
+ *
+ * <p> If the native pointer is less than 64 bits wide, it is extended as
+ * an unsigned number to a Java long. The pointer may be indexed by any
+ * given byte offset, simply by adding that offset (as a simple integer) to
+ * the long representing the pointer. The number of bytes actually read
+ * from the target address maybe determined by consulting {@link
+ * #addressSize}.
+ *
+ * @see #allocateMemory
+ */
+ public native long getAddress(long address);
+
+ /**
+ * Stores a native pointer into a given memory address. If the address is
+ * zero, or does not point into a block obtained from {@link
+ * #allocateMemory}, the results are undefined.
+ *
+ * <p> The number of bytes actually written at the target address maybe
+ * determined by consulting {@link #addressSize}.
+ *
+ * @see #getAddress(long)
+ */
+ public native void putAddress(long address, long x);
+
+ /// wrappers for malloc, realloc, free:
+
+ /**
+ * Allocates a new block of native memory, of the given size in bytes. The
+ * contents of the memory are uninitialized; they will generally be
+ * garbage. The resulting native pointer will never be zero, and will be
+ * aligned for all value types. Dispose of this memory by calling {@link
+ * #freeMemory}, or resize it with {@link #reallocateMemory}.
+ *
+ * @throws IllegalArgumentException if the size is negative or too large
+ * for the native size_t type
+ *
+ * @throws OutOfMemoryError if the allocation is refused by the system
+ *
+ * @see #getByte(long)
+ * @see #putByte(long, byte)
+ */
+ public native long allocateMemory(long bytes);
+
+ /**
+ * Resizes a new block of native memory, to the given size in bytes. The
+ * contents of the new block past the size of the old block are
+ * uninitialized; they will generally be garbage. The resulting native
+ * pointer will be zero if and only if the requested size is zero. The
+ * resulting native pointer will be aligned for all value types. Dispose
+ * of this memory by calling {@link #freeMemory}, or resize it with {@link
+ * #reallocateMemory}. The address passed to this method may be null, in
+ * which case an allocation will be performed.
+ *
+ * @throws IllegalArgumentException if the size is negative or too large
+ * for the native size_t type
+ *
+ * @throws OutOfMemoryError if the allocation is refused by the system
+ *
+ * @see #allocateMemory
+ */
+ public native long reallocateMemory(long address, long bytes);
+
+ /**
+ * Sets all bytes in a given block of memory to a fixed value
+ * (usually zero).
+ *
+ * <p>This method determines a block's base address by means of two parameters,
+ * and so it provides (in effect) a <em>double-register</em> addressing mode,
+ * as discussed in {@link #getInt(Object,long)}. When the object reference is null,
+ * the offset supplies an absolute base address.
+ *
+ * <p>The stores are in coherent (atomic) units of a size determined
+ * by the address and length parameters. If the effective address and
+ * length are all even modulo 8, the stores take place in 'long' units.
+ * If the effective address and length are (resp.) even modulo 4 or 2,
+ * the stores take place in units of 'int' or 'short'.
+ *
+ * @since 1.7
+ */
+ public native void setMemory(Object o, long offset, long bytes, byte value);
+
+ /**
+ * Sets all bytes in a given block of memory to a fixed value
+ * (usually zero). This provides a <em>single-register</em> addressing mode,
+ * as discussed in {@link #getInt(Object,long)}.
+ *
+ * <p>Equivalent to <code>setMemory(null, address, bytes, value)</code>.
+ */
+ public void setMemory(long address, long bytes, byte value) {
+ setMemory(null, address, bytes, value);
+ }
+
+ /**
+ * Sets all bytes in a given block of memory to a copy of another
+ * block.
+ *
+ * <p>This method determines each block's base address by means of two parameters,
+ * and so it provides (in effect) a <em>double-register</em> addressing mode,
+ * as discussed in {@link #getInt(Object,long)}. When the object reference is null,
+ * the offset supplies an absolute base address.
+ *
+ * <p>The transfers are in coherent (atomic) units of a size determined
+ * by the address and length parameters. If the effective addresses and
+ * length are all even modulo 8, the transfer takes place in 'long' units.
+ * If the effective addresses and length are (resp.) even modulo 4 or 2,
+ * the transfer takes place in units of 'int' or 'short'.
+ *
+ * @since 1.7
+ */
+ public native void copyMemory(Object srcBase, long srcOffset,
+ Object destBase, long destOffset,
+ long bytes);
+ /**
+ * Sets all bytes in a given block of memory to a copy of another
+ * block. This provides a <em>single-register</em> addressing mode,
+ * as discussed in {@link #getInt(Object,long)}.
+ *
+ * Equivalent to <code>copyMemory(null, srcAddress, null, destAddress, bytes)</code>.
+ */
+ public void copyMemory(long srcAddress, long destAddress, long bytes) {
+ copyMemory(null, srcAddress, null, destAddress, bytes);
+ }
+
+ /**
+ * Disposes of a block of native memory, as obtained from {@link
+ * #allocateMemory} or {@link #reallocateMemory}. The address passed to
+ * this method may be null, in which case no action is taken.
+ *
+ * @see #allocateMemory
+ */
+ public native void freeMemory(long address);
+
+ /// random queries
+
+ /**
+ * This constant differs from all results that will ever be returned from
+ * {@link #staticFieldOffset}, {@link #objectFieldOffset},
+ * or {@link #arrayBaseOffset}.
+ */
+ public static final int INVALID_FIELD_OFFSET = -1;
+
+ /**
+ * Returns the offset of a field, truncated to 32 bits.
+ * This method is implemented as follows:
+ * <blockquote><pre>
+ * public int fieldOffset(Field f) {
+ * if (Modifier.isStatic(f.getModifiers()))
+ * return (int) staticFieldOffset(f);
+ * else
+ * return (int) objectFieldOffset(f);
+ * }
+ * </pre></blockquote>
+ * @deprecated As of 1.4.1, use {@link #staticFieldOffset} for static
+ * fields and {@link #objectFieldOffset} for non-static fields.
+ */
+ @Deprecated
+ public int fieldOffset(Field f) {
+ if (Modifier.isStatic(f.getModifiers()))
+ return (int) staticFieldOffset(f);
+ else
+ return (int) objectFieldOffset(f);
+ }
+
+ /**
+ * Returns the base address for accessing some static field
+ * in the given class. This method is implemented as follows:
+ * <blockquote><pre>
+ * public Object staticFieldBase(Class c) {
+ * Field[] fields = c.getDeclaredFields();
+ * for (int i = 0; i < fields.length; i++) {
+ * if (Modifier.isStatic(fields[i].getModifiers())) {
+ * return staticFieldBase(fields[i]);
+ * }
+ * }
+ * return null;
+ * }
+ * </pre></blockquote>
+ * @deprecated As of 1.4.1, use {@link #staticFieldBase(Field)}
+ * to obtain the base pertaining to a specific {@link Field}.
+ * This method works only for JVMs which store all statics
+ * for a given class in one place.
+ */
+ @Deprecated
+ public Object staticFieldBase(Class<?> c) {
+ Field[] fields = c.getDeclaredFields();
+ for (int i = 0; i < fields.length; i++) {
+ if (Modifier.isStatic(fields[i].getModifiers())) {
+ return staticFieldBase(fields[i]);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Report the location of a given field in the storage allocation of its
+ * class. Do not expect to perform any sort of arithmetic on this offset;
+ * it is just a cookie which is passed to the unsafe heap memory accessors.
+ *
+ * <p>Any given field will always have the same offset and base, and no
+ * two distinct fields of the same class will ever have the same offset
+ * and base.
+ *
+ * <p>As of 1.4.1, offsets for fields are represented as long values,
+ * although the Sun JVM does not use the most significant 32 bits.
+ * However, JVM implementations which store static fields at absolute
+ * addresses can use long offsets and null base pointers to express
+ * the field locations in a form usable by {@link #getInt(Object,long)}.
+ * Therefore, code which will be ported to such JVMs on 64-bit platforms
+ * must preserve all bits of static field offsets.
+ * @see #getInt(Object, long)
+ */
+ public native long staticFieldOffset(Field f);
+
+ /**
+ * Report the location of a given static field, in conjunction with {@link
+ * #staticFieldBase}.
+ * <p>Do not expect to perform any sort of arithmetic on this offset;
+ * it is just a cookie which is passed to the unsafe heap memory accessors.
+ *
+ * <p>Any given field will always have the same offset, and no two distinct
+ * fields of the same class will ever have the same offset.
+ *
+ * <p>As of 1.4.1, offsets for fields are represented as long values,
+ * although the Sun JVM does not use the most significant 32 bits.
+ * It is hard to imagine a JVM technology which needs more than
+ * a few bits to encode an offset within a non-array object,
+ * However, for consistency with other methods in this class,
+ * this method reports its result as a long value.
+ * @see #getInt(Object, long)
+ */
+ public native long objectFieldOffset(Field f);
+
+ /**
+ * Report the location of a given static field, in conjunction with {@link
+ * #staticFieldOffset}.
+ * <p>Fetch the base "Object", if any, with which static fields of the
+ * given class can be accessed via methods like {@link #getInt(Object,
+ * long)}. This value may be null. This value may refer to an object
+ * which is a "cookie", not guaranteed to be a real Object, and it should
+ * not be used in any way except as argument to the get and put routines in
+ * this class.
+ */
+ public native Object staticFieldBase(Field f);
+
+ /**
+ * Detect if the given class may need to be initialized. This is often
+ * needed in conjunction with obtaining the static field base of a
+ * class.
+ * @return false only if a call to {@code ensureClassInitialized} would have no effect
+ */
+ public native boolean shouldBeInitialized(Class<?> c);
+
+ /**
+ * Ensure the given class has been initialized. This is often
+ * needed in conjunction with obtaining the static field base of a
+ * class.
+ */
+ public native void ensureClassInitialized(Class<?> c);
+
+ /**
+ * Report the offset of the first element in the storage allocation of a
+ * given array class. If {@link #arrayIndexScale} returns a non-zero value
+ * for the same class, you may use that scale factor, together with this
+ * base offset, to form new offsets to access elements of arrays of the
+ * given class.
+ *
+ * @see #getInt(Object, long)
+ * @see #putInt(Object, long, int)
+ */
+ public native int arrayBaseOffset(Class<?> arrayClass);
+
+ /** The value of {@code arrayBaseOffset(boolean[].class)} */
+ public static final int ARRAY_BOOLEAN_BASE_OFFSET
+ = theUnsafe.arrayBaseOffset(boolean[].class);
+
+ /** The value of {@code arrayBaseOffset(byte[].class)} */
+ public static final int ARRAY_BYTE_BASE_OFFSET
+ = theUnsafe.arrayBaseOffset(byte[].class);
+
+ /** The value of {@code arrayBaseOffset(short[].class)} */
+ public static final int ARRAY_SHORT_BASE_OFFSET
+ = theUnsafe.arrayBaseOffset(short[].class);
+
+ /** The value of {@code arrayBaseOffset(char[].class)} */
+ public static final int ARRAY_CHAR_BASE_OFFSET
+ = theUnsafe.arrayBaseOffset(char[].class);
+
+ /** The value of {@code arrayBaseOffset(int[].class)} */
+ public static final int ARRAY_INT_BASE_OFFSET
+ = theUnsafe.arrayBaseOffset(int[].class);
+
+ /** The value of {@code arrayBaseOffset(long[].class)} */
+ public static final int ARRAY_LONG_BASE_OFFSET
+ = theUnsafe.arrayBaseOffset(long[].class);
+
+ /** The value of {@code arrayBaseOffset(float[].class)} */
+ public static final int ARRAY_FLOAT_BASE_OFFSET
+ = theUnsafe.arrayBaseOffset(float[].class);
+
+ /** The value of {@code arrayBaseOffset(double[].class)} */
+ public static final int ARRAY_DOUBLE_BASE_OFFSET
+ = theUnsafe.arrayBaseOffset(double[].class);
+
+ /** The value of {@code arrayBaseOffset(Object[].class)} */
+ public static final int ARRAY_OBJECT_BASE_OFFSET
+ = theUnsafe.arrayBaseOffset(Object[].class);
+
+ /**
+ * Report the scale factor for addressing elements in the storage
+ * allocation of a given array class. However, arrays of "narrow" types
+ * will generally not work properly with accessors like {@link
+ * #getByte(Object, int)}, so the scale factor for such classes is reported
+ * as zero.
+ *
+ * @see #arrayBaseOffset
+ * @see #getInt(Object, long)
+ * @see #putInt(Object, long, int)
+ */
+ public native int arrayIndexScale(Class<?> arrayClass);
+
+ /** The value of {@code arrayIndexScale(boolean[].class)} */
+ public static final int ARRAY_BOOLEAN_INDEX_SCALE
+ = theUnsafe.arrayIndexScale(boolean[].class);
+
+ /** The value of {@code arrayIndexScale(byte[].class)} */
+ public static final int ARRAY_BYTE_INDEX_SCALE
+ = theUnsafe.arrayIndexScale(byte[].class);
+
+ /** The value of {@code arrayIndexScale(short[].class)} */
+ public static final int ARRAY_SHORT_INDEX_SCALE
+ = theUnsafe.arrayIndexScale(short[].class);
+
+ /** The value of {@code arrayIndexScale(char[].class)} */
+ public static final int ARRAY_CHAR_INDEX_SCALE
+ = theUnsafe.arrayIndexScale(char[].class);
+
+ /** The value of {@code arrayIndexScale(int[].class)} */
+ public static final int ARRAY_INT_INDEX_SCALE
+ = theUnsafe.arrayIndexScale(int[].class);
+
+ /** The value of {@code arrayIndexScale(long[].class)} */
+ public static final int ARRAY_LONG_INDEX_SCALE
+ = theUnsafe.arrayIndexScale(long[].class);
+
+ /** The value of {@code arrayIndexScale(float[].class)} */
+ public static final int ARRAY_FLOAT_INDEX_SCALE
+ = theUnsafe.arrayIndexScale(float[].class);
+
+ /** The value of {@code arrayIndexScale(double[].class)} */
+ public static final int ARRAY_DOUBLE_INDEX_SCALE
+ = theUnsafe.arrayIndexScale(double[].class);
+
+ /** The value of {@code arrayIndexScale(Object[].class)} */
+ public static final int ARRAY_OBJECT_INDEX_SCALE
+ = theUnsafe.arrayIndexScale(Object[].class);
+
+ /**
+ * Report the size in bytes of a native pointer, as stored via {@link
+ * #putAddress}. This value will be either 4 or 8. Note that the sizes of
+ * other primitive types (as stored in native memory blocks) is determined
+ * fully by their information content.
+ */
+ public native int addressSize();
+
+ /** The value of {@code addressSize()} */
+ public static final int ADDRESS_SIZE = theUnsafe.addressSize();
+
+ /**
+ * Report the size in bytes of a native memory page (whatever that is).
+ * This value will always be a power of two.
+ */
+ public native int pageSize();
+
+
+ /// random trusted operations from JNI:
+
+ /**
+ * Tell the VM to define a class, without security checks. By default, the
+ * class loader and protection domain come from the caller's class.
+ */
+ public native Class<?> defineClass(String name, byte[] b, int off, int len,
+ ClassLoader loader,
+ ProtectionDomain protectionDomain);
+
+ /**
+ * Define a class but do not make it known to the class loader or system dictionary.
+ * <p>
+ * For each CP entry, the corresponding CP patch must either be null or have
+ * the a format that matches its tag:
+ * <ul>
+ * <li>Integer, Long, Float, Double: the corresponding wrapper object type from java.lang
+ * <li>Utf8: a string (must have suitable syntax if used as signature or name)
+ * <li>Class: any java.lang.Class object
+ * <li>String: any object (not just a java.lang.String)
+ * <li>InterfaceMethodRef: (NYI) a method handle to invoke on that call site's arguments
+ * </ul>
+ * @params hostClass context for linkage, access control, protection domain, and class loader
+ * @params data bytes of a class file
+ * @params cpPatches where non-null entries exist, they replace corresponding CP entries in data
+ */
+ public native Class<?> defineAnonymousClass(Class<?> hostClass, byte[] data, Object[] cpPatches);
+
+
+ /** Allocate an instance but do not run any constructor.
+ Initializes the class if it has not yet been. */
+ public native Object allocateInstance(Class<?> cls)
+ throws InstantiationException;
+
+ /** Lock the object. It must get unlocked via {@link #monitorExit}. */
+ @Deprecated
+ public native void monitorEnter(Object o);
+
+ /**
+ * Unlock the object. It must have been locked via {@link
+ * #monitorEnter}.
+ */
+ @Deprecated
+ public native void monitorExit(Object o);
+
+ /**
+ * Tries to lock the object. Returns true or false to indicate
+ * whether the lock succeeded. If it did, the object must be
+ * unlocked via {@link #monitorExit}.
+ */
+ @Deprecated
+ public native boolean tryMonitorEnter(Object o);
+
+ /** Throw the exception without telling the verifier. */
+ public native void throwException(Throwable ee);
+
+
+ /**
+ * Atomically update Java variable to <tt>x</tt> if it is currently
+ * holding <tt>expected</tt>.
+ * @return <tt>true</tt> if successful
+ */
+ public final native boolean compareAndSwapObject(Object o, long offset,
+ Object expected,
+ Object x);
+
+ /**
+ * Atomically update Java variable to <tt>x</tt> if it is currently
+ * holding <tt>expected</tt>.
+ * @return <tt>true</tt> if successful
+ */
+ public final native boolean compareAndSwapInt(Object o, long offset,
+ int expected,
+ int x);
+
+ /**
+ * Atomically update Java variable to <tt>x</tt> if it is currently
+ * holding <tt>expected</tt>.
+ * @return <tt>true</tt> if successful
+ */
+ public final native boolean compareAndSwapLong(Object o, long offset,
+ long expected,
+ long x);
+
+ /**
+ * Fetches a reference value from a given Java variable, with volatile
+ * load semantics. Otherwise identical to {@link #getObject(Object, long)}
+ */
+ public native Object getObjectVolatile(Object o, long offset);
+
+ /**
+ * Stores a reference value into a given Java variable, with
+ * volatile store semantics. Otherwise identical to {@link #putObject(Object, long, Object)}
+ */
+ public native void putObjectVolatile(Object o, long offset, Object x);
+
+ /** Volatile version of {@link #getInt(Object, long)} */
+ public native int getIntVolatile(Object o, long offset);
+
+ /** Volatile version of {@link #putInt(Object, long, int)} */
+ public native void putIntVolatile(Object o, long offset, int x);
+
+ /** Volatile version of {@link #getBoolean(Object, long)} */
+ public native boolean getBooleanVolatile(Object o, long offset);
+
+ /** Volatile version of {@link #putBoolean(Object, long, boolean)} */
+ public native void putBooleanVolatile(Object o, long offset, boolean x);
+
+ /** Volatile version of {@link #getByte(Object, long)} */
+ public native byte getByteVolatile(Object o, long offset);
+
+ /** Volatile version of {@link #putByte(Object, long, byte)} */
+ public native void putByteVolatile(Object o, long offset, byte x);
+
+ /** Volatile version of {@link #getShort(Object, long)} */
+ public native short getShortVolatile(Object o, long offset);
+
+ /** Volatile version of {@link #putShort(Object, long, short)} */
+ public native void putShortVolatile(Object o, long offset, short x);
+
+ /** Volatile version of {@link #getChar(Object, long)} */
+ public native char getCharVolatile(Object o, long offset);
+
+ /** Volatile version of {@link #putChar(Object, long, char)} */
+ public native void putCharVolatile(Object o, long offset, char x);
+
+ /** Volatile version of {@link #getLong(Object, long)} */
+ public native long getLongVolatile(Object o, long offset);
+
+ /** Volatile version of {@link #putLong(Object, long, long)} */
+ public native void putLongVolatile(Object o, long offset, long x);
+
+ /** Volatile version of {@link #getFloat(Object, long)} */
+ public native float getFloatVolatile(Object o, long offset);
+
+ /** Volatile version of {@link #putFloat(Object, long, float)} */
+ public native void putFloatVolatile(Object o, long offset, float x);
+
+ /** Volatile version of {@link #getDouble(Object, long)} */
+ public native double getDoubleVolatile(Object o, long offset);
+
+ /** Volatile version of {@link #putDouble(Object, long, double)} */
+ public native void putDoubleVolatile(Object o, long offset, double x);
+
+ /**
+ * Version of {@link #putObjectVolatile(Object, long, Object)}
+ * that does not guarantee immediate visibility of the store to
+ * other threads. This method is generally only useful if the
+ * underlying field is a Java volatile (or if an array cell, one
+ * that is otherwise only accessed using volatile accesses).
+ */
+ public native void putOrderedObject(Object o, long offset, Object x);
+
+ /** Ordered/Lazy version of {@link #putIntVolatile(Object, long, int)} */
+ public native void putOrderedInt(Object o, long offset, int x);
+
+ /** Ordered/Lazy version of {@link #putLongVolatile(Object, long, long)} */
+ public native void putOrderedLong(Object o, long offset, long x);
+
+ /**
+ * Unblock the given thread blocked on <tt>park</tt>, or, if it is
+ * not blocked, cause the subsequent call to <tt>park</tt> not to
+ * block. Note: this operation is "unsafe" solely because the
+ * caller must somehow ensure that the thread has not been
+ * destroyed. Nothing special is usually required to ensure this
+ * when called from Java (in which there will ordinarily be a live
+ * reference to the thread) but this is not nearly-automatically
+ * so when calling from native code.
+ * @param thread the thread to unpark.
+ *
+ */
+ public native void unpark(Object thread);
+
+ /**
+ * Block current thread, returning when a balancing
+ * <tt>unpark</tt> occurs, or a balancing <tt>unpark</tt> has
+ * already occurred, or the thread is interrupted, or, if not
+ * absolute and time is not zero, the given time nanoseconds have
+ * elapsed, or if absolute, the given deadline in milliseconds
+ * since Epoch has passed, or spuriously (i.e., returning for no
+ * "reason"). Note: This operation is in the Unsafe class only
+ * because <tt>unpark</tt> is, so it would be strange to place it
+ * elsewhere.
+ */
+ public native void park(boolean isAbsolute, long time);
+
+ /**
+ * Gets the load average in the system run queue assigned
+ * to the available processors averaged over various periods of time.
+ * This method retrieves the given <tt>nelem</tt> samples and
+ * assigns to the elements of the given <tt>loadavg</tt> array.
+ * The system imposes a maximum of 3 samples, representing
+ * averages over the last 1, 5, and 15 minutes, respectively.
+ *
+ * @params loadavg an array of double of size nelems
+ * @params nelems the number of samples to be retrieved and
+ * must be 1 to 3.
+ *
+ * @return the number of samples actually retrieved; or -1
+ * if the load average is unobtainable.
+ */
+ public native int getLoadAverage(double[] loadavg, int nelems);
+
+ // The following contain CAS-based Java implementations used on
+ // platforms not supporting native instructions
+
+ /**
+ * Atomically adds the given value to the current value of a field
+ * or array element within the given object <code>o</code>
+ * at the given <code>offset</code>.
+ *
+ * @param o object/array to update the field/element in
+ * @param offset field/element offset
+ * @param delta the value to add
+ * @return the previous value
+ * @since 1.8
+ */
+ public final int getAndAddInt(Object o, long offset, int delta) {
+ int v;
+ do {
+ v = getIntVolatile(o, offset);
+ } while (!compareAndSwapInt(o, offset, v, v + delta));
+ return v;
+ }
+
+ /**
+ * Atomically adds the given value to the current value of a field
+ * or array element within the given object <code>o</code>
+ * at the given <code>offset</code>.
+ *
+ * @param o object/array to update the field/element in
+ * @param offset field/element offset
+ * @param delta the value to add
+ * @return the previous value
+ * @since 1.8
+ */
+ public final long getAndAddLong(Object o, long offset, long delta) {
+ long v;
+ do {
+ v = getLongVolatile(o, offset);
+ } while (!compareAndSwapLong(o, offset, v, v + delta));
+ return v;
+ }
+
+ /**
+ * Atomically exchanges the given value with the current value of
+ * a field or array element within the given object <code>o</code>
+ * at the given <code>offset</code>.
+ *
+ * @param o object/array to update the field/element in
+ * @param offset field/element offset
+ * @param newValue new value
+ * @return the previous value
+ * @since 1.8
+ */
+ public final int getAndSetInt(Object o, long offset, int newValue) {
+ int v;
+ do {
+ v = getIntVolatile(o, offset);
+ } while (!compareAndSwapInt(o, offset, v, newValue));
+ return v;
+ }
+
+ /**
+ * Atomically exchanges the given value with the current value of
+ * a field or array element within the given object <code>o</code>
+ * at the given <code>offset</code>.
+ *
+ * @param o object/array to update the field/element in
+ * @param offset field/element offset
+ * @param newValue new value
+ * @return the previous value
+ * @since 1.8
+ */
+ public final long getAndSetLong(Object o, long offset, long newValue) {
+ long v;
+ do {
+ v = getLongVolatile(o, offset);
+ } while (!compareAndSwapLong(o, offset, v, newValue));
+ return v;
+ }
+
+ /**
+ * Atomically exchanges the given reference value with the current
+ * reference value of a field or array element within the given
+ * object <code>o</code> at the given <code>offset</code>.
+ *
+ * @param o object/array to update the field/element in
+ * @param offset field/element offset
+ * @param newValue new value
+ * @return the previous value
+ * @since 1.8
+ */
+ public final Object getAndSetObject(Object o, long offset, Object newValue) {
+ Object v;
+ do {
+ v = getObjectVolatile(o, offset);
+ } while (!compareAndSwapObject(o, offset, v, newValue));
+ return v;
+ }
+
+
+ /**
+ * Ensures lack of reordering of loads before the fence
+ * with loads or stores after the fence.
+ * @since 1.8
+ */
+ public native void loadFence();
+
+ /**
+ * Ensures lack of reordering of stores before the fence
+ * with loads or stores after the fence.
+ * @since 1.8
+ */
+ public native void storeFence();
+
+ /**
+ * Ensures lack of reordering of loads or stores before the fence
+ * with loads or stores after the fence.
+ * @since 1.8
+ */
+ public native void fullFence();
+
+ /**
+ * Throws IllegalAccessError; for use by the VM.
+ * @since 1.8
+ */
+ private static void throwIllegalAccessError() {
+ throw new IllegalAccessError();
+ }
+
+}
diff --git a/src/Java/sun/repackage/UnsafeFieldAccessorFactory.java b/src/Java/sun/repackage/UnsafeFieldAccessorFactory.java
new file mode 100644
index 0000000000..d52b36c42c
--- /dev/null
+++ b/src/Java/sun/repackage/UnsafeFieldAccessorFactory.java
@@ -0,0 +1,4446 @@
+/*
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+
+class UnsafeFieldAccessorFactory {
+ static FieldAccessor newFieldAccessor(Field field, boolean override) {
+ Class<?> type = field.getType();
+ boolean isStatic = Modifier.isStatic(field.getModifiers());
+ boolean isFinal = Modifier.isFinal(field.getModifiers());
+ boolean isVolatile = Modifier.isVolatile(field.getModifiers());
+ boolean isQualified = isFinal || isVolatile;
+ boolean isReadOnly = isFinal && (isStatic || !override);
+ if (isStatic) {
+ // This code path does not guarantee that the field's
+ // declaring class has been initialized, but it must be
+ // before performing reflective operations.
+ UnsafeFieldAccessorImpl.unsafe.ensureClassInitialized(field.getDeclaringClass());
+
+ if (!isQualified) {
+ if (type == Boolean.TYPE) {
+ return new UnsafeStaticBooleanFieldAccessorImpl(field);
+ } else if (type == Byte.TYPE) {
+ return new UnsafeStaticByteFieldAccessorImpl(field);
+ } else if (type == Short.TYPE) {
+ return new UnsafeStaticShortFieldAccessorImpl(field);
+ } else if (type == Character.TYPE) {
+ return new UnsafeStaticCharacterFieldAccessorImpl(field);
+ } else if (type == Integer.TYPE) {
+ return new UnsafeStaticIntegerFieldAccessorImpl(field);
+ } else if (type == Long.TYPE) {
+ return new UnsafeStaticLongFieldAccessorImpl(field);
+ } else if (type == Float.TYPE) {
+ return new UnsafeStaticFloatFieldAccessorImpl(field);
+ } else if (type == Double.TYPE) {
+ return new UnsafeStaticDoubleFieldAccessorImpl(field);
+ } else {
+ return new UnsafeStaticObjectFieldAccessorImpl(field);
+ }
+ } else {
+ if (type == Boolean.TYPE) {
+ return new UnsafeQualifiedStaticBooleanFieldAccessorImpl(field, isReadOnly);
+ } else if (type == Byte.TYPE) {
+ return new UnsafeQualifiedStaticByteFieldAccessorImpl(field, isReadOnly);
+ } else if (type == Short.TYPE) {
+ return new UnsafeQualifiedStaticShortFieldAccessorImpl(field, isReadOnly);
+ } else if (type == Character.TYPE) {
+ return new UnsafeQualifiedStaticCharacterFieldAccessorImpl(field, isReadOnly);
+ } else if (type == Integer.TYPE) {
+ return new UnsafeQualifiedStaticIntegerFieldAccessorImpl(field, isReadOnly);
+ } else if (type == Long.TYPE) {
+ return new UnsafeQualifiedStaticLongFieldAccessorImpl(field, isReadOnly);
+ } else if (type == Float.TYPE) {
+ return new UnsafeQualifiedStaticFloatFieldAccessorImpl(field, isReadOnly);
+ } else if (type == Double.TYPE) {
+ return new UnsafeQualifiedStaticDoubleFieldAccessorImpl(field, isReadOnly);
+ } else {
+ return new UnsafeQualifiedStaticObjectFieldAccessorImpl(field, isReadOnly);
+ }
+ }
+ } else {
+ if (!isQualified) {
+ if (type == Boolean.TYPE) {
+ return new UnsafeBooleanFieldAccessorImpl(field);
+ } else if (type == Byte.TYPE) {
+ return new UnsafeByteFieldAccessorImpl(field);
+ } else if (type == Short.TYPE) {
+ return new UnsafeShortFieldAccessorImpl(field);
+ } else if (type == Character.TYPE) {
+ return new UnsafeCharacterFieldAccessorImpl(field);
+ } else if (type == Integer.TYPE) {
+ return new UnsafeIntegerFieldAccessorImpl(field);
+ } else if (type == Long.TYPE) {
+ return new UnsafeLongFieldAccessorImpl(field);
+ } else if (type == Float.TYPE) {
+ return new UnsafeFloatFieldAccessorImpl(field);
+ } else if (type == Double.TYPE) {
+ return new UnsafeDoubleFieldAccessorImpl(field);
+ } else {
+ return new UnsafeObjectFieldAccessorImpl(field);
+ }
+ } else {
+ if (type == Boolean.TYPE) {
+ return new UnsafeQualifiedBooleanFieldAccessorImpl(field, isReadOnly);
+ } else if (type == Byte.TYPE) {
+ return new UnsafeQualifiedByteFieldAccessorImpl(field, isReadOnly);
+ } else if (type == Short.TYPE) {
+ return new UnsafeQualifiedShortFieldAccessorImpl(field, isReadOnly);
+ } else if (type == Character.TYPE) {
+ return new UnsafeQualifiedCharacterFieldAccessorImpl(field, isReadOnly);
+ } else if (type == Integer.TYPE) {
+ return new UnsafeQualifiedIntegerFieldAccessorImpl(field, isReadOnly);
+ } else if (type == Long.TYPE) {
+ return new UnsafeQualifiedLongFieldAccessorImpl(field, isReadOnly);
+ } else if (type == Float.TYPE) {
+ return new UnsafeQualifiedFloatFieldAccessorImpl(field, isReadOnly);
+ } else if (type == Double.TYPE) {
+ return new UnsafeQualifiedDoubleFieldAccessorImpl(field, isReadOnly);
+ } else {
+ return new UnsafeQualifiedObjectFieldAccessorImpl(field, isReadOnly);
+ }
+ }
+ }
+ }
+
+ public static abstract class UnsafeStaticFieldAccessorImpl extends UnsafeFieldAccessorImpl {
+ static {
+ Reflection.registerFieldsToFilter(UnsafeStaticFieldAccessorImpl.class,
+ new String[] { "base" });
+ }
+
+ protected final Object base; // base
+
+ UnsafeStaticFieldAccessorImpl(Field field) {
+ super(field);
+ base = unsafe.staticFieldBase(field);
+ }
+ }
+
+
+ public static class UnsafeStaticBooleanFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl {
+ UnsafeStaticBooleanFieldAccessorImpl(Field field) {
+ super(field);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Boolean(getBoolean(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ return unsafe.getBoolean(base, fieldOffset);
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ throw newGetIntIllegalArgumentException();
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ throw newGetLongIllegalArgumentException();
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ throw newGetFloatIllegalArgumentException();
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ throw newGetDoubleIllegalArgumentException();
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Boolean) {
+ unsafe.putBoolean(base, fieldOffset, ((Boolean) value).booleanValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(z);
+ }
+ unsafe.putBoolean(base, fieldOffset, z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeStaticByteFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl {
+ UnsafeStaticByteFieldAccessorImpl(Field field) {
+ super(field);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Byte(getByte(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ return unsafe.getByte(base, fieldOffset);
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ return getByte(obj);
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ return getByte(obj);
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ return getByte(obj);
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ return getByte(obj);
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return getByte(obj);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Byte) {
+ unsafe.putByte(base, fieldOffset, ((Byte) value).byteValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(b);
+ }
+ unsafe.putByte(base, fieldOffset, b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeStaticCharacterFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl {
+ UnsafeStaticCharacterFieldAccessorImpl(Field field) {
+ super(field);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Character(getChar(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ return unsafe.getChar(base, fieldOffset);
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ return getChar(obj);
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ return getChar(obj);
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ return getChar(obj);
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return getChar(obj);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Character) {
+ unsafe.putChar(base, fieldOffset, ((Character) value).charValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(c);
+ }
+ unsafe.putChar(base, fieldOffset, c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeStaticDoubleFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl {
+ UnsafeStaticDoubleFieldAccessorImpl(Field field) {
+ super(field);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Double(getDouble(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ throw newGetIntIllegalArgumentException();
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ throw newGetLongIllegalArgumentException();
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ throw newGetFloatIllegalArgumentException();
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return unsafe.getDouble(base, fieldOffset);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Byte) {
+ unsafe.putDouble(base, fieldOffset, ((Byte) value).byteValue());
+ return;
+ }
+ if (value instanceof Short) {
+ unsafe.putDouble(base, fieldOffset, ((Short) value).shortValue());
+ return;
+ }
+ if (value instanceof Character) {
+ unsafe.putDouble(base, fieldOffset, ((Character) value).charValue());
+ return;
+ }
+ if (value instanceof Integer) {
+ unsafe.putDouble(base, fieldOffset, ((Integer) value).intValue());
+ return;
+ }
+ if (value instanceof Long) {
+ unsafe.putDouble(base, fieldOffset, ((Long) value).longValue());
+ return;
+ }
+ if (value instanceof Float) {
+ unsafe.putDouble(base, fieldOffset, ((Float) value).floatValue());
+ return;
+ }
+ if (value instanceof Double) {
+ unsafe.putDouble(base, fieldOffset, ((Double) value).doubleValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setDouble(obj, b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setDouble(obj, c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setDouble(obj, s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setDouble(obj, i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setDouble(obj, l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setDouble(obj, f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(d);
+ }
+ unsafe.putDouble(base, fieldOffset, d);
+ }
+ }
+
+ public static class UnsafeStaticFloatFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl {
+ UnsafeStaticFloatFieldAccessorImpl(Field field) {
+ super(field);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Float(getFloat(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ throw newGetIntIllegalArgumentException();
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ throw newGetLongIllegalArgumentException();
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ return unsafe.getFloat(base, fieldOffset);
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return getFloat(obj);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Byte) {
+ unsafe.putFloat(base, fieldOffset, ((Byte) value).byteValue());
+ return;
+ }
+ if (value instanceof Short) {
+ unsafe.putFloat(base, fieldOffset, ((Short) value).shortValue());
+ return;
+ }
+ if (value instanceof Character) {
+ unsafe.putFloat(base, fieldOffset, ((Character) value).charValue());
+ return;
+ }
+ if (value instanceof Integer) {
+ unsafe.putFloat(base, fieldOffset, ((Integer) value).intValue());
+ return;
+ }
+ if (value instanceof Long) {
+ unsafe.putFloat(base, fieldOffset, ((Long) value).longValue());
+ return;
+ }
+ if (value instanceof Float) {
+ unsafe.putFloat(base, fieldOffset, ((Float) value).floatValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setFloat(obj, b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setFloat(obj, c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setFloat(obj, s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setFloat(obj, i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setFloat(obj, l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(f);
+ }
+ unsafe.putFloat(base, fieldOffset, f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeStaticIntegerFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl {
+ UnsafeStaticIntegerFieldAccessorImpl(Field field) {
+ super(field);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Integer(getInt(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ return unsafe.getInt(base, fieldOffset);
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ return getInt(obj);
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ return getInt(obj);
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return getInt(obj);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Byte) {
+ unsafe.putInt(base, fieldOffset, ((Byte) value).byteValue());
+ return;
+ }
+ if (value instanceof Short) {
+ unsafe.putInt(base, fieldOffset, ((Short) value).shortValue());
+ return;
+ }
+ if (value instanceof Character) {
+ unsafe.putInt(base, fieldOffset, ((Character) value).charValue());
+ return;
+ }
+ if (value instanceof Integer) {
+ unsafe.putInt(base, fieldOffset, ((Integer) value).intValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setInt(obj, b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setInt(obj, c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setInt(obj, s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(i);
+ }
+ unsafe.putInt(base, fieldOffset, i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeStaticLongFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl {
+ UnsafeStaticLongFieldAccessorImpl(Field field) {
+ super(field);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Long(getLong(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ throw newGetIntIllegalArgumentException();
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ return unsafe.getLong(base, fieldOffset);
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ return getLong(obj);
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return getLong(obj);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Byte) {
+ unsafe.putLong(base, fieldOffset, ((Byte) value).byteValue());
+ return;
+ }
+ if (value instanceof Short) {
+ unsafe.putLong(base, fieldOffset, ((Short) value).shortValue());
+ return;
+ }
+ if (value instanceof Character) {
+ unsafe.putLong(base, fieldOffset, ((Character) value).charValue());
+ return;
+ }
+ if (value instanceof Integer) {
+ unsafe.putLong(base, fieldOffset, ((Integer) value).intValue());
+ return;
+ }
+ if (value instanceof Long) {
+ unsafe.putLong(base, fieldOffset, ((Long) value).longValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setLong(obj, b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setLong(obj, c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setLong(obj, s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setLong(obj, i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(l);
+ }
+ unsafe.putLong(base, fieldOffset, l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeStaticObjectFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl {
+ UnsafeStaticObjectFieldAccessorImpl(Field field) {
+ super(field);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return unsafe.getObject(base, fieldOffset);
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ throw newGetIntIllegalArgumentException();
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ throw newGetLongIllegalArgumentException();
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ throw newGetFloatIllegalArgumentException();
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ throw newGetDoubleIllegalArgumentException();
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value != null) {
+ if (!field.getType().isAssignableFrom(value.getClass())) {
+ throwSetIllegalArgumentException(value);
+ }
+ }
+ unsafe.putObject(base, fieldOffset, value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeStaticShortFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl {
+ UnsafeStaticShortFieldAccessorImpl(Field field) {
+ super(field);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Short(getShort(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ return unsafe.getShort(base, fieldOffset);
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ return getShort(obj);
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ return getShort(obj);
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ return getShort(obj);
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return getShort(obj);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Byte) {
+ unsafe.putShort(base, fieldOffset, ((Byte) value).byteValue());
+ return;
+ }
+ if (value instanceof Short) {
+ unsafe.putShort(base, fieldOffset, ((Short) value).shortValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setShort(obj, b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(s);
+ }
+ unsafe.putShort(base, fieldOffset, s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeQualifiedBooleanFieldAccessorImpl
+ extends UnsafeQualifiedFieldAccessorImpl
+ {
+ UnsafeQualifiedBooleanFieldAccessorImpl(Field field, boolean isReadOnly) {
+ super(field, isReadOnly);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Boolean(getBoolean(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ ensureObj(obj);
+ return unsafe.getBooleanVolatile(obj, fieldOffset);
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ throw newGetIntIllegalArgumentException();
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ throw newGetLongIllegalArgumentException();
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ throw newGetFloatIllegalArgumentException();
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ throw newGetDoubleIllegalArgumentException();
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Boolean) {
+ unsafe.putBooleanVolatile(obj, fieldOffset, ((Boolean) value).booleanValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(z);
+ }
+ unsafe.putBooleanVolatile(obj, fieldOffset, z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeQualifiedByteFieldAccessorImpl
+ extends UnsafeQualifiedFieldAccessorImpl
+ {
+ UnsafeQualifiedByteFieldAccessorImpl(Field field, boolean isReadOnly) {
+ super(field, isReadOnly);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Byte(getByte(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ ensureObj(obj);
+ return unsafe.getByteVolatile(obj, fieldOffset);
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ return getByte(obj);
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ return getByte(obj);
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ return getByte(obj);
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ return getByte(obj);
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return getByte(obj);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Byte) {
+ unsafe.putByteVolatile(obj, fieldOffset, ((Byte) value).byteValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(b);
+ }
+ unsafe.putByteVolatile(obj, fieldOffset, b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeQualifiedCharacterFieldAccessorImpl
+ extends UnsafeQualifiedFieldAccessorImpl
+ {
+ UnsafeQualifiedCharacterFieldAccessorImpl(Field field, boolean isReadOnly) {
+ super(field, isReadOnly);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Character(getChar(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ ensureObj(obj);
+ return unsafe.getCharVolatile(obj, fieldOffset);
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ return getChar(obj);
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ return getChar(obj);
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ return getChar(obj);
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return getChar(obj);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Character) {
+ unsafe.putCharVolatile(obj, fieldOffset, ((Character) value).charValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(c);
+ }
+ unsafe.putCharVolatile(obj, fieldOffset, c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeQualifiedDoubleFieldAccessorImpl
+ extends UnsafeQualifiedFieldAccessorImpl
+ {
+ UnsafeQualifiedDoubleFieldAccessorImpl(Field field, boolean isReadOnly) {
+ super(field, isReadOnly);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Double(getDouble(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ throw newGetIntIllegalArgumentException();
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ throw newGetLongIllegalArgumentException();
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ throw newGetFloatIllegalArgumentException();
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ ensureObj(obj);
+ return unsafe.getDoubleVolatile(obj, fieldOffset);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Byte) {
+ unsafe.putDoubleVolatile(obj, fieldOffset, ((Byte) value).byteValue());
+ return;
+ }
+ if (value instanceof Short) {
+ unsafe.putDoubleVolatile(obj, fieldOffset, ((Short) value).shortValue());
+ return;
+ }
+ if (value instanceof Character) {
+ unsafe.putDoubleVolatile(obj, fieldOffset, ((Character) value).charValue());
+ return;
+ }
+ if (value instanceof Integer) {
+ unsafe.putDoubleVolatile(obj, fieldOffset, ((Integer) value).intValue());
+ return;
+ }
+ if (value instanceof Long) {
+ unsafe.putDoubleVolatile(obj, fieldOffset, ((Long) value).longValue());
+ return;
+ }
+ if (value instanceof Float) {
+ unsafe.putDoubleVolatile(obj, fieldOffset, ((Float) value).floatValue());
+ return;
+ }
+ if (value instanceof Double) {
+ unsafe.putDoubleVolatile(obj, fieldOffset, ((Double) value).doubleValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setDouble(obj, b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setDouble(obj, c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setDouble(obj, s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setDouble(obj, i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setDouble(obj, l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setDouble(obj, f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(d);
+ }
+ unsafe.putDoubleVolatile(obj, fieldOffset, d);
+ }
+ }
+
+ public static class UnsafeQualifiedFloatFieldAccessorImpl
+ extends UnsafeQualifiedFieldAccessorImpl
+ {
+ UnsafeQualifiedFloatFieldAccessorImpl(Field field, boolean isReadOnly) {
+ super(field, isReadOnly);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Float(getFloat(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ throw newGetIntIllegalArgumentException();
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ throw newGetLongIllegalArgumentException();
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ ensureObj(obj);
+ return unsafe.getFloatVolatile(obj, fieldOffset);
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return getFloat(obj);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Byte) {
+ unsafe.putFloatVolatile(obj, fieldOffset, ((Byte) value).byteValue());
+ return;
+ }
+ if (value instanceof Short) {
+ unsafe.putFloatVolatile(obj, fieldOffset, ((Short) value).shortValue());
+ return;
+ }
+ if (value instanceof Character) {
+ unsafe.putFloatVolatile(obj, fieldOffset, ((Character) value).charValue());
+ return;
+ }
+ if (value instanceof Integer) {
+ unsafe.putFloatVolatile(obj, fieldOffset, ((Integer) value).intValue());
+ return;
+ }
+ if (value instanceof Long) {
+ unsafe.putFloatVolatile(obj, fieldOffset, ((Long) value).longValue());
+ return;
+ }
+ if (value instanceof Float) {
+ unsafe.putFloatVolatile(obj, fieldOffset, ((Float) value).floatValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setFloat(obj, b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setFloat(obj, c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setFloat(obj, s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setFloat(obj, i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setFloat(obj, l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(f);
+ }
+ unsafe.putFloatVolatile(obj, fieldOffset, f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeQualifiedIntegerFieldAccessorImpl
+ extends UnsafeQualifiedFieldAccessorImpl
+ {
+ UnsafeQualifiedIntegerFieldAccessorImpl(Field field, boolean isReadOnly) {
+ super(field, isReadOnly);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Integer(getInt(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ ensureObj(obj);
+ return unsafe.getIntVolatile(obj, fieldOffset);
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ return getInt(obj);
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ return getInt(obj);
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return getInt(obj);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Byte) {
+ unsafe.putIntVolatile(obj, fieldOffset, ((Byte) value).byteValue());
+ return;
+ }
+ if (value instanceof Short) {
+ unsafe.putIntVolatile(obj, fieldOffset, ((Short) value).shortValue());
+ return;
+ }
+ if (value instanceof Character) {
+ unsafe.putIntVolatile(obj, fieldOffset, ((Character) value).charValue());
+ return;
+ }
+ if (value instanceof Integer) {
+ unsafe.putIntVolatile(obj, fieldOffset, ((Integer) value).intValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setInt(obj, b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setInt(obj, c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setInt(obj, s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(i);
+ }
+ unsafe.putIntVolatile(obj, fieldOffset, i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeQualifiedLongFieldAccessorImpl
+ extends UnsafeQualifiedFieldAccessorImpl
+ {
+ UnsafeQualifiedLongFieldAccessorImpl(Field field, boolean isReadOnly) {
+ super(field, isReadOnly);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Long(getLong(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ throw newGetIntIllegalArgumentException();
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ ensureObj(obj);
+ return unsafe.getLongVolatile(obj, fieldOffset);
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ return getLong(obj);
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return getLong(obj);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Byte) {
+ unsafe.putLongVolatile(obj, fieldOffset, ((Byte) value).byteValue());
+ return;
+ }
+ if (value instanceof Short) {
+ unsafe.putLongVolatile(obj, fieldOffset, ((Short) value).shortValue());
+ return;
+ }
+ if (value instanceof Character) {
+ unsafe.putLongVolatile(obj, fieldOffset, ((Character) value).charValue());
+ return;
+ }
+ if (value instanceof Integer) {
+ unsafe.putLongVolatile(obj, fieldOffset, ((Integer) value).intValue());
+ return;
+ }
+ if (value instanceof Long) {
+ unsafe.putLongVolatile(obj, fieldOffset, ((Long) value).longValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setLong(obj, b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setLong(obj, c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setLong(obj, s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setLong(obj, i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(l);
+ }
+ unsafe.putLongVolatile(obj, fieldOffset, l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeQualifiedObjectFieldAccessorImpl
+ extends UnsafeQualifiedFieldAccessorImpl
+ {
+ UnsafeQualifiedObjectFieldAccessorImpl(Field field, boolean isReadOnly) {
+ super(field, isReadOnly);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ ensureObj(obj);
+ return unsafe.getObjectVolatile(obj, fieldOffset);
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ throw newGetIntIllegalArgumentException();
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ throw newGetLongIllegalArgumentException();
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ throw newGetFloatIllegalArgumentException();
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ throw newGetDoubleIllegalArgumentException();
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value != null) {
+ if (!field.getType().isAssignableFrom(value.getClass())) {
+ throwSetIllegalArgumentException(value);
+ }
+ }
+ unsafe.putObjectVolatile(obj, fieldOffset, value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeQualifiedShortFieldAccessorImpl
+ extends UnsafeQualifiedFieldAccessorImpl
+ {
+ UnsafeQualifiedShortFieldAccessorImpl(Field field, boolean isReadOnly) {
+ super(field, isReadOnly);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Short(getShort(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ ensureObj(obj);
+ return unsafe.getShortVolatile(obj, fieldOffset);
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ return getShort(obj);
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ return getShort(obj);
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ return getShort(obj);
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return getShort(obj);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Byte) {
+ unsafe.putShortVolatile(obj, fieldOffset, ((Byte) value).byteValue());
+ return;
+ }
+ if (value instanceof Short) {
+ unsafe.putShortVolatile(obj, fieldOffset, ((Short) value).shortValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setShort(obj, b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(s);
+ }
+ unsafe.putShortVolatile(obj, fieldOffset, s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeBooleanFieldAccessorImpl extends UnsafeFieldAccessorImpl {
+ UnsafeBooleanFieldAccessorImpl(Field field) {
+ super(field);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Boolean(getBoolean(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ ensureObj(obj);
+ return unsafe.getBoolean(obj, fieldOffset);
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ throw newGetIntIllegalArgumentException();
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ throw newGetLongIllegalArgumentException();
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ throw newGetFloatIllegalArgumentException();
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ throw newGetDoubleIllegalArgumentException();
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Boolean) {
+ unsafe.putBoolean(obj, fieldOffset, ((Boolean) value).booleanValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(z);
+ }
+ unsafe.putBoolean(obj, fieldOffset, z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeByteFieldAccessorImpl extends UnsafeFieldAccessorImpl {
+ UnsafeByteFieldAccessorImpl(Field field) {
+ super(field);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Byte(getByte(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ ensureObj(obj);
+ return unsafe.getByte(obj, fieldOffset);
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ return getByte(obj);
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ return getByte(obj);
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ return getByte(obj);
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ return getByte(obj);
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return getByte(obj);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Byte) {
+ unsafe.putByte(obj, fieldOffset, ((Byte) value).byteValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(b);
+ }
+ unsafe.putByte(obj, fieldOffset, b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeCharacterFieldAccessorImpl extends UnsafeFieldAccessorImpl {
+ UnsafeCharacterFieldAccessorImpl(Field field) {
+ super(field);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Character(getChar(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ ensureObj(obj);
+ return unsafe.getChar(obj, fieldOffset);
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ return getChar(obj);
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ return getChar(obj);
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ return getChar(obj);
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return getChar(obj);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Character) {
+ unsafe.putChar(obj, fieldOffset, ((Character) value).charValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(c);
+ }
+ unsafe.putChar(obj, fieldOffset, c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeDoubleFieldAccessorImpl extends UnsafeFieldAccessorImpl {
+ UnsafeDoubleFieldAccessorImpl(Field field) {
+ super(field);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Double(getDouble(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ throw newGetIntIllegalArgumentException();
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ throw newGetLongIllegalArgumentException();
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ throw newGetFloatIllegalArgumentException();
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ ensureObj(obj);
+ return unsafe.getDouble(obj, fieldOffset);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Byte) {
+ unsafe.putDouble(obj, fieldOffset, ((Byte) value).byteValue());
+ return;
+ }
+ if (value instanceof Short) {
+ unsafe.putDouble(obj, fieldOffset, ((Short) value).shortValue());
+ return;
+ }
+ if (value instanceof Character) {
+ unsafe.putDouble(obj, fieldOffset, ((Character) value).charValue());
+ return;
+ }
+ if (value instanceof Integer) {
+ unsafe.putDouble(obj, fieldOffset, ((Integer) value).intValue());
+ return;
+ }
+ if (value instanceof Long) {
+ unsafe.putDouble(obj, fieldOffset, ((Long) value).longValue());
+ return;
+ }
+ if (value instanceof Float) {
+ unsafe.putDouble(obj, fieldOffset, ((Float) value).floatValue());
+ return;
+ }
+ if (value instanceof Double) {
+ unsafe.putDouble(obj, fieldOffset, ((Double) value).doubleValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setDouble(obj, b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setDouble(obj, c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setDouble(obj, s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setDouble(obj, i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setDouble(obj, l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setDouble(obj, f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(d);
+ }
+ unsafe.putDouble(obj, fieldOffset, d);
+ }
+ }
+
+ public static class UnsafeFloatFieldAccessorImpl extends UnsafeFieldAccessorImpl {
+ UnsafeFloatFieldAccessorImpl(Field field) {
+ super(field);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Float(getFloat(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ throw newGetIntIllegalArgumentException();
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ throw newGetLongIllegalArgumentException();
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ ensureObj(obj);
+ return unsafe.getFloat(obj, fieldOffset);
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return getFloat(obj);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Byte) {
+ unsafe.putFloat(obj, fieldOffset, ((Byte) value).byteValue());
+ return;
+ }
+ if (value instanceof Short) {
+ unsafe.putFloat(obj, fieldOffset, ((Short) value).shortValue());
+ return;
+ }
+ if (value instanceof Character) {
+ unsafe.putFloat(obj, fieldOffset, ((Character) value).charValue());
+ return;
+ }
+ if (value instanceof Integer) {
+ unsafe.putFloat(obj, fieldOffset, ((Integer) value).intValue());
+ return;
+ }
+ if (value instanceof Long) {
+ unsafe.putFloat(obj, fieldOffset, ((Long) value).longValue());
+ return;
+ }
+ if (value instanceof Float) {
+ unsafe.putFloat(obj, fieldOffset, ((Float) value).floatValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setFloat(obj, b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setFloat(obj, c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setFloat(obj, s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setFloat(obj, i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setFloat(obj, l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(f);
+ }
+ unsafe.putFloat(obj, fieldOffset, f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+
+
+ public static class UnsafeIntegerFieldAccessorImpl extends UnsafeFieldAccessorImpl {
+ UnsafeIntegerFieldAccessorImpl(Field field) {
+ super(field);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Integer(getInt(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ ensureObj(obj);
+ return unsafe.getInt(obj, fieldOffset);
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ return getInt(obj);
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ return getInt(obj);
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return getInt(obj);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Byte) {
+ unsafe.putInt(obj, fieldOffset, ((Byte) value).byteValue());
+ return;
+ }
+ if (value instanceof Short) {
+ unsafe.putInt(obj, fieldOffset, ((Short) value).shortValue());
+ return;
+ }
+ if (value instanceof Character) {
+ unsafe.putInt(obj, fieldOffset, ((Character) value).charValue());
+ return;
+ }
+ if (value instanceof Integer) {
+ unsafe.putInt(obj, fieldOffset, ((Integer) value).intValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setInt(obj, b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setInt(obj, c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setInt(obj, s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(i);
+ }
+ unsafe.putInt(obj, fieldOffset, i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeLongFieldAccessorImpl extends UnsafeFieldAccessorImpl {
+ UnsafeLongFieldAccessorImpl(Field field) {
+ super(field);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Long(getLong(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ throw newGetIntIllegalArgumentException();
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ ensureObj(obj);
+ return unsafe.getLong(obj, fieldOffset);
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ return getLong(obj);
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return getLong(obj);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Byte) {
+ unsafe.putLong(obj, fieldOffset, ((Byte) value).byteValue());
+ return;
+ }
+ if (value instanceof Short) {
+ unsafe.putLong(obj, fieldOffset, ((Short) value).shortValue());
+ return;
+ }
+ if (value instanceof Character) {
+ unsafe.putLong(obj, fieldOffset, ((Character) value).charValue());
+ return;
+ }
+ if (value instanceof Integer) {
+ unsafe.putLong(obj, fieldOffset, ((Integer) value).intValue());
+ return;
+ }
+ if (value instanceof Long) {
+ unsafe.putLong(obj, fieldOffset, ((Long) value).longValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setLong(obj, b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setLong(obj, c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setLong(obj, s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setLong(obj, i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(l);
+ }
+ unsafe.putLong(obj, fieldOffset, l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeObjectFieldAccessorImpl extends UnsafeFieldAccessorImpl {
+ UnsafeObjectFieldAccessorImpl(Field field) {
+ super(field);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ ensureObj(obj);
+ return unsafe.getObject(obj, fieldOffset);
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ throw newGetIntIllegalArgumentException();
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ throw newGetLongIllegalArgumentException();
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ throw newGetFloatIllegalArgumentException();
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ throw newGetDoubleIllegalArgumentException();
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value != null) {
+ if (!field.getType().isAssignableFrom(value.getClass())) {
+ throwSetIllegalArgumentException(value);
+ }
+ }
+ unsafe.putObject(obj, fieldOffset, value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeShortFieldAccessorImpl extends UnsafeFieldAccessorImpl {
+ UnsafeShortFieldAccessorImpl(Field field) {
+ super(field);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Short(getShort(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ ensureObj(obj);
+ return unsafe.getShort(obj, fieldOffset);
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ return getShort(obj);
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ return getShort(obj);
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ return getShort(obj);
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return getShort(obj);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Byte) {
+ unsafe.putShort(obj, fieldOffset, ((Byte) value).byteValue());
+ return;
+ }
+ if (value instanceof Short) {
+ unsafe.putShort(obj, fieldOffset, ((Short) value).shortValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setShort(obj, b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ ensureObj(obj);
+ if (isFinal) {
+ throwFinalFieldIllegalAccessException(s);
+ }
+ unsafe.putShort(obj, fieldOffset, s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+
+ public static class UnsafeQualifiedStaticBooleanFieldAccessorImpl
+ extends UnsafeQualifiedStaticFieldAccessorImpl
+ {
+ UnsafeQualifiedStaticBooleanFieldAccessorImpl(Field field, boolean isReadOnly) {
+ super(field, isReadOnly);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Boolean(getBoolean(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ return unsafe.getBooleanVolatile(base, fieldOffset);
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ throw newGetIntIllegalArgumentException();
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ throw newGetLongIllegalArgumentException();
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ throw newGetFloatIllegalArgumentException();
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ throw newGetDoubleIllegalArgumentException();
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Boolean) {
+ unsafe.putBooleanVolatile(base, fieldOffset, ((Boolean) value).booleanValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(z);
+ }
+ unsafe.putBooleanVolatile(base, fieldOffset, z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeQualifiedStaticByteFieldAccessorImpl
+ extends UnsafeQualifiedStaticFieldAccessorImpl
+ {
+ UnsafeQualifiedStaticByteFieldAccessorImpl(Field field, boolean isReadOnly) {
+ super(field, isReadOnly);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Byte(getByte(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ return unsafe.getByteVolatile(base, fieldOffset);
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ return getByte(obj);
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ return getByte(obj);
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ return getByte(obj);
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ return getByte(obj);
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return getByte(obj);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Byte) {
+ unsafe.putByteVolatile(base, fieldOffset, ((Byte) value).byteValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(b);
+ }
+ unsafe.putByteVolatile(base, fieldOffset, b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeQualifiedStaticCharacterFieldAccessorImpl
+ extends UnsafeQualifiedStaticFieldAccessorImpl
+ {
+ UnsafeQualifiedStaticCharacterFieldAccessorImpl(Field field, boolean isReadOnly) {
+ super(field, isReadOnly);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Character(getChar(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ return unsafe.getCharVolatile(base, fieldOffset);
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ return getChar(obj);
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ return getChar(obj);
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ return getChar(obj);
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return getChar(obj);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Character) {
+ unsafe.putCharVolatile(base, fieldOffset, ((Character) value).charValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(c);
+ }
+ unsafe.putCharVolatile(base, fieldOffset, c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeQualifiedStaticDoubleFieldAccessorImpl
+ extends UnsafeQualifiedStaticFieldAccessorImpl
+ {
+ UnsafeQualifiedStaticDoubleFieldAccessorImpl(Field field, boolean isReadOnly) {
+ super(field, isReadOnly);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Double(getDouble(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ throw newGetIntIllegalArgumentException();
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ throw newGetLongIllegalArgumentException();
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ throw newGetFloatIllegalArgumentException();
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return unsafe.getDoubleVolatile(base, fieldOffset);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Byte) {
+ unsafe.putDoubleVolatile(base, fieldOffset, ((Byte) value).byteValue());
+ return;
+ }
+ if (value instanceof Short) {
+ unsafe.putDoubleVolatile(base, fieldOffset, ((Short) value).shortValue());
+ return;
+ }
+ if (value instanceof Character) {
+ unsafe.putDoubleVolatile(base, fieldOffset, ((Character) value).charValue());
+ return;
+ }
+ if (value instanceof Integer) {
+ unsafe.putDoubleVolatile(base, fieldOffset, ((Integer) value).intValue());
+ return;
+ }
+ if (value instanceof Long) {
+ unsafe.putDoubleVolatile(base, fieldOffset, ((Long) value).longValue());
+ return;
+ }
+ if (value instanceof Float) {
+ unsafe.putDoubleVolatile(base, fieldOffset, ((Float) value).floatValue());
+ return;
+ }
+ if (value instanceof Double) {
+ unsafe.putDoubleVolatile(base, fieldOffset, ((Double) value).doubleValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setDouble(obj, b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setDouble(obj, c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setDouble(obj, s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setDouble(obj, i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setDouble(obj, l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setDouble(obj, f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(d);
+ }
+ unsafe.putDoubleVolatile(base, fieldOffset, d);
+ }
+ }
+
+ public static class UnsafeQualifiedStaticFloatFieldAccessorImpl
+ extends UnsafeQualifiedStaticFieldAccessorImpl
+ {
+ UnsafeQualifiedStaticFloatFieldAccessorImpl(Field field, boolean isReadOnly) {
+ super(field, isReadOnly);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Float(getFloat(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ throw newGetIntIllegalArgumentException();
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ throw newGetLongIllegalArgumentException();
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ return unsafe.getFloatVolatile(base, fieldOffset);
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return getFloat(obj);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Byte) {
+ unsafe.putFloatVolatile(base, fieldOffset, ((Byte) value).byteValue());
+ return;
+ }
+ if (value instanceof Short) {
+ unsafe.putFloatVolatile(base, fieldOffset, ((Short) value).shortValue());
+ return;
+ }
+ if (value instanceof Character) {
+ unsafe.putFloatVolatile(base, fieldOffset, ((Character) value).charValue());
+ return;
+ }
+ if (value instanceof Integer) {
+ unsafe.putFloatVolatile(base, fieldOffset, ((Integer) value).intValue());
+ return;
+ }
+ if (value instanceof Long) {
+ unsafe.putFloatVolatile(base, fieldOffset, ((Long) value).longValue());
+ return;
+ }
+ if (value instanceof Float) {
+ unsafe.putFloatVolatile(base, fieldOffset, ((Float) value).floatValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setFloat(obj, b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setFloat(obj, c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setFloat(obj, s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setFloat(obj, i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setFloat(obj, l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(f);
+ }
+ unsafe.putFloatVolatile(base, fieldOffset, f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeQualifiedStaticIntegerFieldAccessorImpl
+ extends UnsafeQualifiedStaticFieldAccessorImpl
+ {
+ UnsafeQualifiedStaticIntegerFieldAccessorImpl(Field field, boolean isReadOnly) {
+ super(field, isReadOnly);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Integer(getInt(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ return unsafe.getIntVolatile(base, fieldOffset);
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ return getInt(obj);
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ return getInt(obj);
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return getInt(obj);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Byte) {
+ unsafe.putIntVolatile(base, fieldOffset, ((Byte) value).byteValue());
+ return;
+ }
+ if (value instanceof Short) {
+ unsafe.putIntVolatile(base, fieldOffset, ((Short) value).shortValue());
+ return;
+ }
+ if (value instanceof Character) {
+ unsafe.putIntVolatile(base, fieldOffset, ((Character) value).charValue());
+ return;
+ }
+ if (value instanceof Integer) {
+ unsafe.putIntVolatile(base, fieldOffset, ((Integer) value).intValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setInt(obj, b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setInt(obj, c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setInt(obj, s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(i);
+ }
+ unsafe.putIntVolatile(base, fieldOffset, i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeQualifiedStaticLongFieldAccessorImpl
+ extends UnsafeQualifiedStaticFieldAccessorImpl
+ {
+ UnsafeQualifiedStaticLongFieldAccessorImpl(Field field, boolean isReadOnly) {
+ super(field, isReadOnly);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Long(getLong(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ throw newGetIntIllegalArgumentException();
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ return unsafe.getLongVolatile(base, fieldOffset);
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ return getLong(obj);
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return getLong(obj);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Byte) {
+ unsafe.putLongVolatile(base, fieldOffset, ((Byte) value).byteValue());
+ return;
+ }
+ if (value instanceof Short) {
+ unsafe.putLongVolatile(base, fieldOffset, ((Short) value).shortValue());
+ return;
+ }
+ if (value instanceof Character) {
+ unsafe.putLongVolatile(base, fieldOffset, ((Character) value).charValue());
+ return;
+ }
+ if (value instanceof Integer) {
+ unsafe.putLongVolatile(base, fieldOffset, ((Integer) value).intValue());
+ return;
+ }
+ if (value instanceof Long) {
+ unsafe.putLongVolatile(base, fieldOffset, ((Long) value).longValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setLong(obj, b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setLong(obj, c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setLong(obj, s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setLong(obj, i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(l);
+ }
+ unsafe.putLongVolatile(base, fieldOffset, l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeQualifiedStaticObjectFieldAccessorImpl
+ extends UnsafeQualifiedStaticFieldAccessorImpl
+ {
+ UnsafeQualifiedStaticObjectFieldAccessorImpl(Field field, boolean isReadOnly) {
+ super(field, isReadOnly);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return unsafe.getObjectVolatile(base, fieldOffset);
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ throw newGetShortIllegalArgumentException();
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ throw newGetIntIllegalArgumentException();
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ throw newGetLongIllegalArgumentException();
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ throw newGetFloatIllegalArgumentException();
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ throw newGetDoubleIllegalArgumentException();
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value != null) {
+ if (!field.getType().isAssignableFrom(value.getClass())) {
+ throwSetIllegalArgumentException(value);
+ }
+ }
+ unsafe.putObjectVolatile(base, fieldOffset, value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+ public static class UnsafeQualifiedStaticShortFieldAccessorImpl
+ extends UnsafeQualifiedStaticFieldAccessorImpl
+ {
+ UnsafeQualifiedStaticShortFieldAccessorImpl(Field field, boolean isReadOnly) {
+ super(field, isReadOnly);
+ }
+
+ public Object get(Object obj) throws IllegalArgumentException {
+ return new Short(getShort(obj));
+ }
+
+ public boolean getBoolean(Object obj) throws IllegalArgumentException {
+ throw newGetBooleanIllegalArgumentException();
+ }
+
+ public byte getByte(Object obj) throws IllegalArgumentException {
+ throw newGetByteIllegalArgumentException();
+ }
+
+ public char getChar(Object obj) throws IllegalArgumentException {
+ throw newGetCharIllegalArgumentException();
+ }
+
+ public short getShort(Object obj) throws IllegalArgumentException {
+ return unsafe.getShortVolatile(base, fieldOffset);
+ }
+
+ public int getInt(Object obj) throws IllegalArgumentException {
+ return getShort(obj);
+ }
+
+ public long getLong(Object obj) throws IllegalArgumentException {
+ return getShort(obj);
+ }
+
+ public float getFloat(Object obj) throws IllegalArgumentException {
+ return getShort(obj);
+ }
+
+ public double getDouble(Object obj) throws IllegalArgumentException {
+ return getShort(obj);
+ }
+
+ public void set(Object obj, Object value)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(value);
+ }
+ if (value == null) {
+ throwSetIllegalArgumentException(value);
+ }
+ if (value instanceof Byte) {
+ unsafe.putShortVolatile(base, fieldOffset, ((Byte) value).byteValue());
+ return;
+ }
+ if (value instanceof Short) {
+ unsafe.putShortVolatile(base, fieldOffset, ((Short) value).shortValue());
+ return;
+ }
+ throwSetIllegalArgumentException(value);
+ }
+
+ public void setBoolean(Object obj, boolean z)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(z);
+ }
+
+ public void setByte(Object obj, byte b)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ setShort(obj, b);
+ }
+
+ public void setChar(Object obj, char c)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(c);
+ }
+
+ public void setShort(Object obj, short s)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ if (isReadOnly) {
+ throwFinalFieldIllegalAccessException(s);
+ }
+ unsafe.putShortVolatile(base, fieldOffset, s);
+ }
+
+ public void setInt(Object obj, int i)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(i);
+ }
+
+ public void setLong(Object obj, long l)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(l);
+ }
+
+ public void setFloat(Object obj, float f)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(f);
+ }
+
+ public void setDouble(Object obj, double d)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ throwSetIllegalArgumentException(d);
+ }
+ }
+
+
+}
diff --git a/src/Java/sun/repackage/UnsafeFieldAccessorImpl.java b/src/Java/sun/repackage/UnsafeFieldAccessorImpl.java
new file mode 100644
index 0000000000..fbcc99bae9
--- /dev/null
+++ b/src/Java/sun/repackage/UnsafeFieldAccessorImpl.java
@@ -0,0 +1,205 @@
+/*
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+
+/** Base class for sun.misc.Unsafe-based FieldAccessors. The
+ observation is that there are only nine types of fields from the
+ standpoint of reflection code: the eight primitive types and
+ Object. Using class Unsafe instead of generated bytecodes saves
+ memory and loading time for the dynamically-generated
+ FieldAccessors. */
+
+abstract class UnsafeFieldAccessorImpl extends FieldAccessorImpl {
+ static final Unsafe unsafe = Unsafe.getUnsafe();
+
+ protected final Field field;
+ protected final long fieldOffset;
+ protected final boolean isFinal;
+
+ UnsafeFieldAccessorImpl(Field field) {
+ this.field = field;
+ if (Modifier.isStatic(field.getModifiers()))
+ fieldOffset = unsafe.staticFieldOffset(field);
+ else
+ fieldOffset = unsafe.objectFieldOffset(field);
+ isFinal = Modifier.isFinal(field.getModifiers());
+ }
+
+ protected void ensureObj(Object o) {
+ // NOTE: will throw NullPointerException, as specified, if o is null
+ if (!field.getDeclaringClass().isAssignableFrom(o.getClass())) {
+ throwSetIllegalArgumentException(o);
+ }
+ }
+
+ private String getQualifiedFieldName() {
+ return field.getDeclaringClass().getName() + "." +field.getName();
+ }
+
+ protected IllegalArgumentException newGetIllegalArgumentException(String type) {
+ return new IllegalArgumentException(
+ "Attempt to get "+field.getType().getName()+" field \"" +
+ getQualifiedFieldName() + "\" with illegal data type conversion to "+type
+ );
+ }
+
+ protected void throwFinalFieldIllegalAccessException(String attemptedType,
+ String attemptedValue)
+ throws IllegalAccessException {
+ throw new IllegalAccessException(getSetMessage(attemptedType, attemptedValue));
+
+ }
+ protected void throwFinalFieldIllegalAccessException(Object o) throws IllegalAccessException {
+ throwFinalFieldIllegalAccessException(o != null ? o.getClass().getName() : "", "");
+ }
+
+ protected void throwFinalFieldIllegalAccessException(boolean z) throws IllegalAccessException {
+ throwFinalFieldIllegalAccessException("boolean", Boolean.toString(z));
+ }
+
+ protected void throwFinalFieldIllegalAccessException(char b) throws IllegalAccessException {
+ throwFinalFieldIllegalAccessException("char", Character.toString(b));
+ }
+
+ protected void throwFinalFieldIllegalAccessException(byte b) throws IllegalAccessException {
+ throwFinalFieldIllegalAccessException("byte", Byte.toString(b));
+ }
+
+ protected void throwFinalFieldIllegalAccessException(short b) throws IllegalAccessException {
+ throwFinalFieldIllegalAccessException("short", Short.toString(b));
+ }
+
+ protected void throwFinalFieldIllegalAccessException(int i) throws IllegalAccessException {
+ throwFinalFieldIllegalAccessException("int", Integer.toString(i));
+ }
+
+ protected void throwFinalFieldIllegalAccessException(long i) throws IllegalAccessException {
+ throwFinalFieldIllegalAccessException("long", Long.toString(i));
+ }
+
+ protected void throwFinalFieldIllegalAccessException(float f) throws IllegalAccessException {
+ throwFinalFieldIllegalAccessException("float", Float.toString(f));
+ }
+
+ protected void throwFinalFieldIllegalAccessException(double f) throws IllegalAccessException {
+ throwFinalFieldIllegalAccessException("double", Double.toString(f));
+ }
+
+ protected IllegalArgumentException newGetBooleanIllegalArgumentException() {
+ return newGetIllegalArgumentException("boolean");
+ }
+
+ protected IllegalArgumentException newGetByteIllegalArgumentException() {
+ return newGetIllegalArgumentException("byte");
+ }
+
+ protected IllegalArgumentException newGetCharIllegalArgumentException() {
+ return newGetIllegalArgumentException("char");
+ }
+
+ protected IllegalArgumentException newGetShortIllegalArgumentException() {
+ return newGetIllegalArgumentException("short");
+ }
+
+ protected IllegalArgumentException newGetIntIllegalArgumentException() {
+ return newGetIllegalArgumentException("int");
+ }
+
+ protected IllegalArgumentException newGetLongIllegalArgumentException() {
+ return newGetIllegalArgumentException("long");
+ }
+
+ protected IllegalArgumentException newGetFloatIllegalArgumentException() {
+ return newGetIllegalArgumentException("float");
+ }
+
+ protected IllegalArgumentException newGetDoubleIllegalArgumentException() {
+ return newGetIllegalArgumentException("double");
+ }
+
+ protected String getSetMessage(String attemptedType, String attemptedValue) {
+ String err = "Can not set";
+ if (Modifier.isStatic(field.getModifiers()))
+ err += " static";
+ if (isFinal)
+ err += " final";
+ err += " " + field.getType().getName() + " field " + getQualifiedFieldName() + " to ";
+ if (attemptedValue.length() > 0) {
+ err += "(" + attemptedType + ")" + attemptedValue;
+ } else {
+ if (attemptedType.length() > 0)
+ err += attemptedType;
+ else
+ err += "null value";
+ }
+ return err;
+ }
+
+ protected void throwSetIllegalArgumentException(String attemptedType,
+ String attemptedValue) {
+ throw new IllegalArgumentException(getSetMessage(attemptedType,attemptedValue));
+ }
+
+ protected void throwSetIllegalArgumentException(Object o) {
+ throwSetIllegalArgumentException(o != null ? o.getClass().getName() : "", "");
+ }
+
+ protected void throwSetIllegalArgumentException(boolean b) {
+ throwSetIllegalArgumentException("boolean", Boolean.toString(b));
+ }
+
+ protected void throwSetIllegalArgumentException(byte b) {
+ throwSetIllegalArgumentException("byte", Byte.toString(b));
+ }
+
+ protected void throwSetIllegalArgumentException(char c) {
+ throwSetIllegalArgumentException("char", Character.toString(c));
+ }
+
+ protected void throwSetIllegalArgumentException(short s) {
+ throwSetIllegalArgumentException("short", Short.toString(s));
+ }
+
+ protected void throwSetIllegalArgumentException(int i) {
+ throwSetIllegalArgumentException("int", Integer.toString(i));
+ }
+
+ protected void throwSetIllegalArgumentException(long l) {
+ throwSetIllegalArgumentException("long", Long.toString(l));
+ }
+
+ protected void throwSetIllegalArgumentException(float f) {
+ throwSetIllegalArgumentException("float", Float.toString(f));
+ }
+
+ protected void throwSetIllegalArgumentException(double d) {
+ throwSetIllegalArgumentException("double", Double.toString(d));
+ }
+
+}
diff --git a/src/Java/sun/repackage/UnsafeQualifiedFieldAccessorImpl.java b/src/Java/sun/repackage/UnsafeQualifiedFieldAccessorImpl.java
new file mode 100644
index 0000000000..d60c3696dd
--- /dev/null
+++ b/src/Java/sun/repackage/UnsafeQualifiedFieldAccessorImpl.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.lang.reflect.Field;
+
+/**
+ * Base class for sun.misc.Unsafe-based FieldAccessors for fields with
+ * final or volatile qualifiers. These differ from unqualified
+ * versions in that (1) they check for read-only status (2) they use
+ * the volatile forms of Unsafe get/put methods. (When accessed via
+ * reflection, finals act as slightly "lighter" forms of volatiles. So
+ * the volatile forms are heavier than necessary in terms of
+ * underlying reordering rules and memory barriers, but preserve
+ * correctness.)
+ */
+
+abstract class UnsafeQualifiedFieldAccessorImpl
+ extends UnsafeFieldAccessorImpl
+{
+ protected final boolean isReadOnly;
+
+ UnsafeQualifiedFieldAccessorImpl(Field field, boolean isReadOnly) {
+ super(field);
+ this.isReadOnly = isReadOnly;
+ }
+}
diff --git a/src/Java/sun/repackage/UnsafeQualifiedStaticFieldAccessorImpl.java b/src/Java/sun/repackage/UnsafeQualifiedStaticFieldAccessorImpl.java
new file mode 100644
index 0000000000..c68b6c9cbd
--- /dev/null
+++ b/src/Java/sun/repackage/UnsafeQualifiedStaticFieldAccessorImpl.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.lang.reflect.Field;
+
+/** Base class for sun.misc.Unsafe-based FieldAccessors for final or
+ volatile static fields. */
+
+abstract class UnsafeQualifiedStaticFieldAccessorImpl
+ extends UnsafeStaticFieldAccessorImpl
+{
+ protected final boolean isReadOnly;
+
+ UnsafeQualifiedStaticFieldAccessorImpl(Field field, boolean isReadOnly) {
+ super(field);
+ this.isReadOnly = isReadOnly;
+ }
+}
diff --git a/src/Java/sun/repackage/UnsafeStaticFieldAccessorImpl.java b/src/Java/sun/repackage/UnsafeStaticFieldAccessorImpl.java
new file mode 100644
index 0000000000..06a91d752c
--- /dev/null
+++ b/src/Java/sun/repackage/UnsafeStaticFieldAccessorImpl.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.repackage;
+
+import java.lang.reflect.Field;
+
+/** Base class for sun.misc.Unsafe-based FieldAccessors for static
+ fields. The observation is that there are only nine types of
+ fields from the standpoint of reflection code: the eight primitive
+ types and Object. Using class Unsafe instead of generated
+ bytecodes saves memory and loading time for the
+ dynamically-generated FieldAccessors. */
+
+abstract class UnsafeStaticFieldAccessorImpl extends UnsafeFieldAccessorImpl {
+ static {
+ Reflection.registerFieldsToFilter(UnsafeStaticFieldAccessorImpl.class,
+ new String[] { "base" });
+ }
+
+ protected final Object base; // base
+
+ UnsafeStaticFieldAccessorImpl(Field field) {
+ super(field);
+ base = unsafe.staticFieldBase(field);
+ }
+}