aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api
diff options
context:
space:
mode:
authorTechnus <daniel112092@gmail.com>2016-09-22 23:07:35 +0200
committerTechnus <daniel112092@gmail.com>2016-09-22 23:07:35 +0200
commitdbdc4f160a9eb955a101251d1b0235d63fbf951c (patch)
treeeda06d5a70b6423d3524577d3eb72ae61c89d811 /src/main/java/gregtech/api
parent6217c0a8f4526b92204d047db65b001862880dd7 (diff)
parent41a91acd57f86d8e351dd6adb223d07498b11663 (diff)
downloadGT5-Unofficial-dbdc4f160a9eb955a101251d1b0235d63fbf951c.tar.gz
GT5-Unofficial-dbdc4f160a9eb955a101251d1b0235d63fbf951c.tar.bz2
GT5-Unofficial-dbdc4f160a9eb955a101251d1b0235d63fbf951c.zip
Merge branch 'Loading-Times' into experimental
Diffstat (limited to 'src/main/java/gregtech/api')
-rw-r--r--src/main/java/gregtech/api/GregTech_API.java17
-rw-r--r--src/main/java/gregtech/api/enums/Dyes.java2
-rw-r--r--src/main/java/gregtech/api/enums/Materials.java9
-rw-r--r--src/main/java/gregtech/api/enums/OrePrefixes.java2
-rw-r--r--src/main/java/gregtech/api/enums/TextureSet.java258
-rw-r--r--src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java6
-rw-r--r--src/main/java/gregtech/api/items/GT_EnergyArmor_Item.java4
-rw-r--r--src/main/java/gregtech/api/items/GT_MetaBase_Item.java86
-rw-r--r--src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java17
-rw-r--r--src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java11
-rw-r--r--src/main/java/gregtech/api/items/GT_Spray_Hardener_Item.java2
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java196
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java476
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseMetaTileEntityUE.java4
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java7
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java4
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java3
-rw-r--r--src/main/java/gregtech/api/objects/GT_ArrayList.java9
-rw-r--r--src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java2
-rw-r--r--src/main/java/gregtech/api/objects/GT_FluidStack.java26
-rw-r--r--src/main/java/gregtech/api/objects/GT_ItemStack.java6
-rw-r--r--src/main/java/gregtech/api/objects/ItemData.java10
-rw-r--r--src/main/java/gregtech/api/objects/XSTR.java255
-rw-r--r--src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java4
-rw-r--r--src/main/java/gregtech/api/util/GT_BaseCrop.java2
-rw-r--r--src/main/java/gregtech/api/util/GT_ModHandler.java243
-rw-r--r--src/main/java/gregtech/api/util/GT_OreDictUnificator.java5
-rw-r--r--src/main/java/gregtech/api/util/GT_PlayedSound.java2
-rw-r--r--src/main/java/gregtech/api/util/GT_Recipe.java4
-rw-r--r--src/main/java/gregtech/api/util/GT_RecipeRegistrator.java63
-rw-r--r--src/main/java/gregtech/api/util/GT_Utility.java41
-rw-r--r--src/main/java/gregtech/api/world/GT_Worldgen.java4
-rw-r--r--src/main/java/gregtech/api/world/GT_Worldgen_Boulder.java56
-rw-r--r--src/main/java/gregtech/api/world/GT_Worldgen_Ore.java11
-rw-r--r--src/main/java/gregtech/api/world/GT_Worldgen_Ore_Normal.java55
35 files changed, 1135 insertions, 767 deletions
diff --git a/src/main/java/gregtech/api/GregTech_API.java b/src/main/java/gregtech/api/GregTech_API.java
index d14b1d0773..1f211be99c 100644
--- a/src/main/java/gregtech/api/GregTech_API.java
+++ b/src/main/java/gregtech/api/GregTech_API.java
@@ -29,6 +29,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fluids.Fluid;
import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
import static gregtech.api.enums.GT_Values.*;
@@ -92,35 +93,35 @@ public class GregTech_API {
/**
* The Icon List for Covers
*/
- public static final Map<GT_ItemStack, ITexture> sCovers = new HashMap<GT_ItemStack, ITexture>();
+ public static final Map<GT_ItemStack, ITexture> sCovers = new ConcurrentHashMap<GT_ItemStack, ITexture>();
/**
* The List of Cover Behaviors for the Covers
*/
- public static final Map<GT_ItemStack, GT_CoverBehavior> sCoverBehaviors = new HashMap<GT_ItemStack, GT_CoverBehavior>();
+ public static final Map<GT_ItemStack, GT_CoverBehavior> sCoverBehaviors = new ConcurrentHashMap<GT_ItemStack, GT_CoverBehavior>();
/**
* The List of Circuit Behaviors for the Redstone Circuit Block
*/
- public static final Map<Integer, GT_CircuitryBehavior> sCircuitryBehaviors = new HashMap<Integer, GT_CircuitryBehavior>();
+ public static final Map<Integer, GT_CircuitryBehavior> sCircuitryBehaviors = new ConcurrentHashMap<Integer, GT_CircuitryBehavior>();
/**
* The List of Blocks, which can conduct Machine Block Updates
*/
- public static final Map<Block, Integer> sMachineIDs = new HashMap<Block, Integer>();
+ public static final Map<Block, Integer> sMachineIDs = new ConcurrentHashMap<Block, Integer>();
/**
* The Redstone Frequencies
*/
- public static final Map<Integer, Byte> sWirelessRedstone = new HashMap<Integer, Byte>();
+ public static final Map<Integer, Byte> sWirelessRedstone = new ConcurrentHashMap<Integer, Byte>();
/**
* The IDSU Frequencies
*/
- public static final Map<Integer, Integer> sIDSUList = new HashMap<Integer, Integer>();
+ public static final Map<Integer, Integer> sIDSUList = new ConcurrentHashMap<Integer, Integer>();
/**
* A List of all Books, which were created using @GT_Utility.getWrittenBook the original Title is the Key Value
*/
- public static final Map<String, ItemStack> sBookList = new HashMap<String, ItemStack>();
+ public static final Map<String, ItemStack> sBookList = new ConcurrentHashMap<String, ItemStack>();
/**
* The List of all Sounds used in GT, indices are in the static Block at the bottom
*/
- public static final Map<Integer, String> sSoundList = new HashMap<Integer, String>();
+ public static final Map<Integer, String> sSoundList = new ConcurrentHashMap<Integer, String>();
/**
* The List of Tools, which can be used. Accepts regular damageable Items and Electric Items
*/
diff --git a/src/main/java/gregtech/api/enums/Dyes.java b/src/main/java/gregtech/api/enums/Dyes.java
index 66c3927783..c59b310d55 100644
--- a/src/main/java/gregtech/api/enums/Dyes.java
+++ b/src/main/java/gregtech/api/enums/Dyes.java
@@ -64,7 +64,7 @@ public enum Dyes implements IColorModulationContainer {
public static Dyes get(String aColor) {
Object tObject = GT_Utility.getFieldContent(Dyes.class, aColor, false, false);
- if (tObject != null && tObject instanceof Dyes) return (Dyes) tObject;
+ if (tObject instanceof Dyes) return (Dyes) tObject;
return _NULL;
}
diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java
index 525dd0fb72..f0883196ae 100644
--- a/src/main/java/gregtech/api/enums/Materials.java
+++ b/src/main/java/gregtech/api/enums/Materials.java
@@ -1,7 +1,5 @@
package gregtech.api.enums;
-import java.util.*;
-
import cpw.mods.fml.common.Loader;
import gregtech.api.GregTech_API;
import gregtech.api.enums.TC_Aspects.TC_AspectStack;
@@ -17,6 +15,8 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
+import java.util.*;
+
import static gregtech.api.enums.GT_Values.M;
import static gregtech.api.enums.GT_Values.MOD_ID_TC;
@@ -1423,7 +1423,7 @@ public enum Materials implements IColorModulationContainer, ISubTagContainer {
public static Materials get(String aMaterialName) {
Object tObject = GT_Utility.getFieldContent(Materials.class, aMaterialName, false, false);
- if (tObject != null && tObject instanceof Materials) return (Materials) tObject;
+ if (tObject instanceof Materials) return (Materials) tObject;
return _NULL;
}
@@ -1536,7 +1536,8 @@ public enum Materials implements IColorModulationContainer, ISubTagContainer {
public boolean remove(ItemStack aStack) {
if (aStack == null) return false;
boolean temp = false;
- for (int i = 0; i < mMaterialItems.size(); i++)
+ int mMaterialItems_sS=mMaterialItems.size();
+ for (int i = 0; i < mMaterialItems_sS; i++)
if (GT_Utility.areStacksEqual(aStack, mMaterialItems.get(i))) {
mMaterialItems.remove(i--);
temp = true;
diff --git a/src/main/java/gregtech/api/enums/OrePrefixes.java b/src/main/java/gregtech/api/enums/OrePrefixes.java
index c096a51f4a..da2f76b324 100644
--- a/src/main/java/gregtech/api/enums/OrePrefixes.java
+++ b/src/main/java/gregtech/api/enums/OrePrefixes.java
@@ -639,7 +639,7 @@ public enum OrePrefixes {
public static OrePrefixes getPrefix(String aPrefixName, OrePrefixes aReplacement) {
Object tObject = GT_Utility.getFieldContent(OrePrefixes.class, aPrefixName, false, false);
- if (tObject != null && tObject instanceof OrePrefixes) return (OrePrefixes) tObject;
+ if (tObject instanceof OrePrefixes) return (OrePrefixes) tObject;
return aReplacement;
}
diff --git a/src/main/java/gregtech/api/enums/TextureSet.java b/src/main/java/gregtech/api/enums/TextureSet.java
index 4cedf08ec0..891a808553 100644
--- a/src/main/java/gregtech/api/enums/TextureSet.java
+++ b/src/main/java/gregtech/api/enums/TextureSet.java
@@ -14,136 +14,138 @@ public class TextureSet {
public final IIconContainer[] mTextures = new IIconContainer[128];
public final String mSetName;
+ private final static String aTextMatIconDir = "materialicons/";
+ private final static String aTextVoidDir = "/void";
public TextureSet(String aSetName) {
mSetName = aSetName;
- mTextures[0] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/dustTiny");
- mTextures[1] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/dustSmall");
- mTextures[2] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/dust");
- mTextures[3] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/dustImpure");
- mTextures[4] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/dustPure");
- mTextures[5] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/crushed");
- mTextures[6] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/crushedPurified");
- mTextures[7] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/crushedCentrifuged");
- mTextures[8] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/gem");
- mTextures[9] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/nugget");
- mTextures[10] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[11] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/ingot");
- mTextures[12] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/ingotHot");
- mTextures[13] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/ingotDouble");
- mTextures[14] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/ingotTriple");
- mTextures[15] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/ingotQuadruple");
- mTextures[16] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/ingotQuintuple");
- mTextures[17] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/plate");
- mTextures[18] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/plateDouble");
- mTextures[19] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/plateTriple");
- mTextures[20] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/plateQuadruple");
- mTextures[21] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/plateQuintuple");
- mTextures[22] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/plateDense");
- mTextures[23] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/stick");
- mTextures[24] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/lens");
- mTextures[25] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/round");
- mTextures[26] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/bolt");
- mTextures[27] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/screw");
- mTextures[28] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/ring");
- mTextures[29] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/foil");
- mTextures[30] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/cell");
- mTextures[31] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/cellPlasma");
- mTextures[32] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/toolHeadSword");
- mTextures[33] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/toolHeadPickaxe");
- mTextures[34] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/toolHeadShovel");
- mTextures[35] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/toolHeadAxe");
- mTextures[36] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/toolHeadHoe");
- mTextures[37] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/toolHeadHammer");
- mTextures[38] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/toolHeadFile");
- mTextures[39] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/toolHeadSaw");
- mTextures[40] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/toolHeadDrill");
- mTextures[41] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/toolHeadChainsaw");
- mTextures[42] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/toolHeadWrench");
- mTextures[43] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/toolHeadUniversalSpade");
- mTextures[44] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/toolHeadSense");
- mTextures[45] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/toolHeadPlow");
- mTextures[46] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/toolHeadArrow");
- mTextures[47] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/toolHeadScrewdriver");
- mTextures[48] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/toolHeadBuzzSaw");
- mTextures[49] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/toolHeadSoldering");
- mTextures[50] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[51] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/wireFine");
- mTextures[52] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/gearGtSmall");
- mTextures[53] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/rotor");
- mTextures[54] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/stickLong");
- mTextures[55] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/springSmall");
- mTextures[56] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/spring");
- mTextures[57] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/arrowGtWood");
- mTextures[58] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/arrowGtPlastic");
- mTextures[59] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/gemChipped");
- mTextures[60] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/gemFlawed");
- mTextures[61] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/gemFlawless");
- mTextures[62] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/gemExquisite");
- mTextures[63] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/gearGt");
- mTextures[64] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[65] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[66] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[67] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/oreSmall");
- mTextures[68] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/ore");
- mTextures[69] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/wire");
- mTextures[70] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/foil");
- mTextures[71] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/block1");
- mTextures[72] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/block2");
- mTextures[73] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/block3");
- mTextures[74] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/block4");
- mTextures[75] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/block5");
- mTextures[76] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/block6");
- mTextures[77] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/pipeSide");
- mTextures[78] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/pipeTiny");
- mTextures[79] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/pipeSmall");
- mTextures[80] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/pipeMedium");
- mTextures[81] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/pipeLarge");
- mTextures[82] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/pipeHuge");
- mTextures[83] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/frameGt");
- mTextures[84] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[85] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[86] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[87] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[88] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[89] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[90] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[91] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[92] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[93] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[94] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[95] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[96] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/crateGtDust");
- mTextures[97] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/crateGtIngot");
- mTextures[98] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/crateGtGem");
- mTextures[99] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/crateGtPlate");
- mTextures[100] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/turbineBlade");
- mTextures[101] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[102] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[103] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[104] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[105] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[106] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[107] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[108] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[109] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[110] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[111] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[112] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[113] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[114] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[115] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[116] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[117] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[118] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[119] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[120] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[121] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[122] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[123] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[124] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[125] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void");
- mTextures[126] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/handleMallet");
- mTextures[127] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/toolHeadMallet");
+ mTextures[0] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/dustTiny");
+ mTextures[1] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/dustSmall");
+ mTextures[2] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/dust");
+ mTextures[3] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/dustImpure");
+ mTextures[4] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/dustPure");
+ mTextures[5] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/crushed");
+ mTextures[6] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/crushedPurified");
+ mTextures[7] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/crushedCentrifuged");
+ mTextures[8] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/gem");
+ mTextures[9] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/nugget");
+ mTextures[10] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[11] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/ingot");
+ mTextures[12] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/ingotHot");
+ mTextures[13] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/ingotDouble");
+ mTextures[14] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/ingotTriple");
+ mTextures[15] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/ingotQuadruple");
+ mTextures[16] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/ingotQuintuple");
+ mTextures[17] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/plate");
+ mTextures[18] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/plateDouble");
+ mTextures[19] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/plateTriple");
+ mTextures[20] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/plateQuadruple");
+ mTextures[21] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/plateQuintuple");
+ mTextures[22] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/plateDense");
+ mTextures[23] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/stick");
+ mTextures[24] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/lens");
+ mTextures[25] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/round");
+ mTextures[26] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/bolt");
+ mTextures[27] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/screw");
+ mTextures[28] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/ring");
+ mTextures[29] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/foil");
+ mTextures[30] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/cell");
+ mTextures[31] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/cellPlasma");
+ mTextures[32] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/toolHeadSword");
+ mTextures[33] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/toolHeadPickaxe");
+ mTextures[34] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/toolHeadShovel");
+ mTextures[35] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/toolHeadAxe");
+ mTextures[36] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/toolHeadHoe");
+ mTextures[37] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/toolHeadHammer");
+ mTextures[38] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/toolHeadFile");
+ mTextures[39] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/toolHeadSaw");
+ mTextures[40] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/toolHeadDrill");
+ mTextures[41] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/toolHeadChainsaw");
+ mTextures[42] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/toolHeadWrench");
+ mTextures[43] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/toolHeadUniversalSpade");
+ mTextures[44] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/toolHeadSense");
+ mTextures[45] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/toolHeadPlow");
+ mTextures[46] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/toolHeadArrow");
+ mTextures[47] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/toolHeadScrewdriver");
+ mTextures[48] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/toolHeadBuzzSaw");
+ mTextures[49] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/toolHeadSoldering");
+ mTextures[50] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[51] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/wireFine");
+ mTextures[52] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/gearGtSmall");
+ mTextures[53] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/rotor");
+ mTextures[54] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/stickLong");
+ mTextures[55] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/springSmall");
+ mTextures[56] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/spring");
+ mTextures[57] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/arrowGtWood");
+ mTextures[58] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/arrowGtPlastic");
+ mTextures[59] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/gemChipped");
+ mTextures[60] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/gemFlawed");
+ mTextures[61] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/gemFlawless");
+ mTextures[62] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/gemExquisite");
+ mTextures[63] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/gearGt");
+ mTextures[64] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[65] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[66] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[67] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/oreSmall");
+ mTextures[68] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/ore");
+ mTextures[69] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/wire");
+ mTextures[70] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/foil");
+ mTextures[71] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/block1");
+ mTextures[72] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/block2");
+ mTextures[73] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/block3");
+ mTextures[74] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/block4");
+ mTextures[75] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/block5");
+ mTextures[76] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/block6");
+ mTextures[77] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/pipeSide");
+ mTextures[78] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/pipeTiny");
+ mTextures[79] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/pipeSmall");
+ mTextures[80] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/pipeMedium");
+ mTextures[81] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/pipeLarge");
+ mTextures[82] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/pipeHuge");
+ mTextures[83] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/frameGt");
+ mTextures[84] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[85] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[86] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[87] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[88] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[89] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[90] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[91] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[92] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[93] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[94] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[95] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[96] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/crateGtDust");
+ mTextures[97] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/crateGtIngot");
+ mTextures[98] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/crateGtGem");
+ mTextures[99] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/crateGtPlate");
+ mTextures[100] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/turbineBlade");
+ mTextures[101] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[102] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[103] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[104] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[105] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[106] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[107] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[108] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[109] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[110] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[111] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[112] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[113] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[114] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[115] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[116] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[117] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[118] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[119] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[120] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[121] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[122] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[123] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[124] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[125] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
+ mTextures[126] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/handleMallet");
+ mTextures[127] = new Textures.ItemIcons.CustomIcon(aTextMatIconDir + mSetName + "/toolHeadMallet");
}
} \ No newline at end of file
diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java
index 510f314d8c..54f1f484b7 100644
--- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java
+++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java
@@ -65,9 +65,9 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity {
continue;
}
}
- if (tItemPipe != null && tItemPipe instanceof BaseMetaPipeEntity) {
+ if (tItemPipe instanceof BaseMetaPipeEntity) {
IMetaTileEntity tMetaTileEntity = tItemPipe.getMetaTileEntity();
- if (tMetaTileEntity != null && tMetaTileEntity instanceof IMetaTileEntityItemPipe && tItemPipe.getCoverBehaviorAtSide(j).letsItemsOut(j, tItemPipe.getCoverIDAtSide(j), tItemPipe.getCoverDataAtSide(j), -2, tItemPipe)) {
+ if (tMetaTileEntity instanceof IMetaTileEntityItemPipe && tItemPipe.getCoverBehaviorAtSide(j).letsItemsOut(j, tItemPipe.getCoverIDAtSide(j), tItemPipe.getCoverDataAtSide(j), -2, tItemPipe)) {
scanPipes((IMetaTileEntityItemPipe) tMetaTileEntity, aMap, aStep, aSuckItems, aIgnoreCapacity);
}
}
@@ -84,7 +84,7 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity {
}
if (tItemPipe instanceof BaseMetaPipeEntity) {
IMetaTileEntity tMetaTileEntity = tItemPipe.getMetaTileEntity();
- if (tMetaTileEntity != null && tMetaTileEntity instanceof IMetaTileEntityItemPipe && tItemPipe.getCoverBehaviorAtSide(j).letsItemsIn(j, tItemPipe.getCoverIDAtSide(j), tItemPipe.getCoverDataAtSide(j), -2, tItemPipe)) {
+ if (tMetaTileEntity instanceof IMetaTileEntityItemPipe && tItemPipe.getCoverBehaviorAtSide(j).letsItemsIn(j, tItemPipe.getCoverIDAtSide(j), tItemPipe.getCoverDataAtSide(j), -2, tItemPipe)) {
scanPipes((IMetaTileEntityItemPipe) tMetaTileEntity, aMap, aStep, aSuckItems, aIgnoreCapacity);
}
}
diff --git a/src/main/java/gregtech/api/items/GT_EnergyArmor_Item.java b/src/main/java/gregtech/api/items/GT_EnergyArmor_Item.java
index 6e3c6df6e1..9ad6deb636 100644
--- a/src/main/java/gregtech/api/items/GT_EnergyArmor_Item.java
+++ b/src/main/java/gregtech/api/items/GT_EnergyArmor_Item.java
@@ -23,14 +23,14 @@ import net.minecraftforge.common.ISpecialArmor;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingFallEvent;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import static gregtech.api.enums.GT_Values.RES_PATH_ITEM;
public class GT_EnergyArmor_Item extends ItemArmor implements ISpecialArmor {
- public static Map jumpChargeMap = new HashMap();
+ public static Map jumpChargeMap = new ConcurrentHashMap();
public int mCharge, mTransfer, mTier, mDamageEnergyCost, mSpecials;
public boolean mChargeProvider;
public double mArmorAbsorbtionPercentage;
diff --git a/src/main/java/gregtech/api/items/GT_MetaBase_Item.java b/src/main/java/gregtech/api/items/GT_MetaBase_Item.java
index 98ccf8554b..fe7ac788af 100644
--- a/src/main/java/gregtech/api/items/GT_MetaBase_Item.java
+++ b/src/main/java/gregtech/api/items/GT_MetaBase_Item.java
@@ -25,15 +25,15 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
import static gregtech.api.enums.GT_Values.D1;
import static gregtech.api.enums.GT_Values.V;
public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpecialElectricItem, IElectricItemManager, IFluidContainerItem {
/* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */
- private final HashMap<Short, ArrayList<IItemBehaviour<GT_MetaBase_Item>>> mItemBehaviors = new HashMap<Short, ArrayList<IItemBehaviour<GT_MetaBase_Item>>>();
+ private final ConcurrentHashMap<Short, ArrayList<IItemBehaviour<GT_MetaBase_Item>>> mItemBehaviors = new ConcurrentHashMap<Short, ArrayList<IItemBehaviour<GT_MetaBase_Item>>>();
/**
* Creates the Item using these Parameters.
@@ -119,19 +119,18 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci
use(aStack, 0, aPlayer);
isItemStackUsable(aStack);
ArrayList<IItemBehaviour<GT_MetaBase_Item>> tList = mItemBehaviors.get((short) getDamage(aStack));
- if (tList != null) for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList)
- try {
- if (tBehavior.onLeftClickEntity(this, aStack, aPlayer, aEntity)) {
- if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem();
- return true;
- }
- if (aStack.stackSize <= 0) {
- aPlayer.destroyCurrentEquippedItem();
- return false;
- }
- } catch (Throwable e) {
- if (D1) e.printStackTrace(GT_Log.err);
+ try { if (tList != null) for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList)
+ if (tBehavior.onLeftClickEntity(this, aStack, aPlayer, aEntity)) {
+ if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem();
+ return true;
}
+ if (aStack.stackSize <= 0) {
+ aPlayer.destroyCurrentEquippedItem();
+ return false;
+ }
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
return false;
}
@@ -140,19 +139,18 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci
use(aStack, 0, aPlayer);
isItemStackUsable(aStack);
ArrayList<IItemBehaviour<GT_MetaBase_Item>> tList = mItemBehaviors.get((short) getDamage(aStack));
- if (tList != null) for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList)
- try {
- if (tBehavior.onItemUse(this, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ)) {
- if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem();
- return true;
- }
- if (aStack.stackSize <= 0) {
- aPlayer.destroyCurrentEquippedItem();
- return false;
- }
- } catch (Throwable e) {
- if (D1) e.printStackTrace(GT_Log.err);
+ try { if (tList != null) for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList)
+ if (tBehavior.onItemUse(this, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ)) {
+ if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem();
+ return true;
+ }
+ if (aStack.stackSize <= 0) {
+ aPlayer.destroyCurrentEquippedItem();
+ return false;
}
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
return false;
}
@@ -161,19 +159,18 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci
use(aStack, 0, aPlayer);
isItemStackUsable(aStack);
ArrayList<IItemBehaviour<GT_MetaBase_Item>> tList = mItemBehaviors.get((short) getDamage(aStack));
- if (tList != null) for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList)
- try {
- if (tBehavior.onItemUseFirst(this, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ)) {
- if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem();
- return true;
- }
- if (aStack.stackSize <= 0) {
- aPlayer.destroyCurrentEquippedItem();
- return false;
- }
- } catch (Throwable e) {
- if (D1) e.printStackTrace(GT_Log.err);
+ try { if (tList != null) for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList)
+ if (tBehavior.onItemUseFirst(this, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ)) {
+ if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem();
+ return true;
+ }
+ if (aStack.stackSize <= 0) {
+ aPlayer.destroyCurrentEquippedItem();
+ return false;
}
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
return false;
}
@@ -182,12 +179,11 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci
use(aStack, 0, aPlayer);
isItemStackUsable(aStack);
ArrayList<IItemBehaviour<GT_MetaBase_Item>> tList = mItemBehaviors.get((short) getDamage(aStack));
- if (tList != null) for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList)
- try {
- aStack = tBehavior.onItemRightClick(this, aStack, aWorld, aPlayer);
- } catch (Throwable e) {
- if (D1) e.printStackTrace(GT_Log.err);
- }
+ try { if (tList != null) for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList)
+ aStack = tBehavior.onItemRightClick(this, aStack, aWorld, aPlayer);
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
return aStack;
}
@@ -206,7 +202,7 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci
if (tStats[3] == -2 && tCharge <= 0) {
aList.add(EnumChatFormatting.AQUA + "Empty. You should recycle it properly." + EnumChatFormatting.GRAY);
} else {
- aList.add(EnumChatFormatting.AQUA + "" + GT_Utility.formatNumbers(tCharge) + " / " + GT_Utility.formatNumbers(Math.abs(tStats[0])) + " EU - Voltage: " + V[(int) (tStats[2] >= 0 ? tStats[2] < V.length ? tStats[2] : V.length - 1 : 1)] + EnumChatFormatting.GRAY);
+ aList.add(String.valueOf(EnumChatFormatting.AQUA) + GT_Utility.formatNumbers(tCharge) + " / " + GT_Utility.formatNumbers(Math.abs(tStats[0])) + " EU - Voltage: " + V[(int) (tStats[2] >= 0 ? tStats[2] < V.length ? tStats[2] : V.length - 1 : 1)] + EnumChatFormatting.GRAY);
}
}
}
diff --git a/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java b/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java
index a246e83d7a..9020eb09e8 100644
--- a/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java
+++ b/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java
@@ -31,6 +31,7 @@ import squeek.applecore.api.food.FoodValues;
import squeek.applecore.api.food.IEdible;
import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
import static gregtech.api.enums.GT_Values.*;
@@ -54,7 +55,7 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements
* <p/>
* You can also use the unlocalized Name gotten from getUnlocalizedName() as Key if you want to get a specific Item.
*/
- public static final HashMap<String, GT_MetaGenerated_Item> sInstances = new HashMap<String, GT_MetaGenerated_Item>();
+ public static final ConcurrentHashMap<String, GT_MetaGenerated_Item> sInstances = new ConcurrentHashMap<String, GT_MetaGenerated_Item>();
/* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */
@@ -63,10 +64,10 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements
public final BitSet mVisibleItems;
public final IIcon[][] mIconList;
- public final HashMap<Short, IFoodStat> mFoodStats = new HashMap<Short, IFoodStat>();
- public final HashMap<Short, Long[]> mElectricStats = new HashMap<Short, Long[]>();
- public final HashMap<Short, Long[]> mFluidContainerStats = new HashMap<Short, Long[]>();
- public final HashMap<Short, Short> mBurnValues = new HashMap<Short, Short>();
+ public final ConcurrentHashMap<Short, IFoodStat> mFoodStats = new ConcurrentHashMap<Short, IFoodStat>();
+ public final ConcurrentHashMap<Short, Long[]> mElectricStats = new ConcurrentHashMap<Short, Long[]>();
+ public final ConcurrentHashMap<Short, Long[]> mFluidContainerStats = new ConcurrentHashMap<Short, Long[]>();
+ public final ConcurrentHashMap<Short, Short> mBurnValues = new ConcurrentHashMap<Short, Short>();
/**
* Creates the Item using these Parameters.
@@ -299,7 +300,8 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item var1, CreativeTabs aCreativeTab, List aList) {
- for (int i = 0, j = mEnabledItems.length(); i < j; i++)
+ int j = mEnabledItems.length();
+ for (int i = 0; i < j; i++)
if (mVisibleItems.get(i) || (D1 && mEnabledItems.get(i))) {
Long[] tStats = mElectricStats.get((short) (mOffset + i));
if (tStats != null && tStats[3] < 0) {
@@ -319,7 +321,8 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements
@Override
@SideOnly(Side.CLIENT)
public final void registerIcons(IIconRegister aIconRegister) {
- for (short i = 0, j = (short) mEnabledItems.length(); i < j; i++)
+ short j = (short) mEnabledItems.length();
+ for (short i = 0; i < j; i++)
if (mEnabledItems.get(i)) {
for (byte k = 1; k < mIconList[i].length; k++) {
mIconList[i][k] = aIconRegister.registerIcon(RES_PATH_ITEM + (GT_Config.troll ? "troll" : getUnlocalizedName() + "/" + i + "/" + k));
diff --git a/src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java b/src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java
index cfbf9deb7f..112cc510f3 100644
--- a/src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java
+++ b/src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java
@@ -43,10 +43,9 @@ import net.minecraftforge.common.IShearable;
import net.minecraftforge.event.world.BlockEvent;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
-import java.util.Random;
+import java.util.concurrent.ConcurrentHashMap;
import static gregtech.api.enums.GT_Values.MOD_ID_FR;
import static gregtech.api.enums.GT_Values.MOD_ID_RC;
@@ -63,11 +62,11 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements
* <p/>
* You can also use the unlocalized Name gotten from getUnlocalizedName() as Key if you want to get a specific Item.
*/
- public static final HashMap<String, GT_MetaGenerated_Tool> sInstances = new HashMap<String, GT_MetaGenerated_Tool>();
+ public static final ConcurrentHashMap<String, GT_MetaGenerated_Tool> sInstances = new ConcurrentHashMap<String, GT_MetaGenerated_Tool>();
/* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */
- public final HashMap<Short, IToolStats> mToolStats = new HashMap<Short, IToolStats>();
+ public final ConcurrentHashMap<Short, IToolStats> mToolStats = new ConcurrentHashMap<Short, IToolStats>();
/**
* Creates the Item using these Parameters.
@@ -415,7 +414,7 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements
return true;
}
if (use(aStack, (int) aAmount, null)) {
- if (new Random().nextInt(25) == 0) {
+ if (java.util.concurrent.ThreadLocalRandom.current().nextInt(0, 25) == 0) {
long tNewDamage = getToolDamage(aStack) + aAmount;
setToolDamage(aStack, tNewDamage);
if (tNewDamage >= getToolMaxDamage(aStack)) {
@@ -606,7 +605,7 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements
return false;
}
Materials aMaterial = getPrimaryMaterial(aStack);
- HashMap<Integer, Integer> tMap = new HashMap<Integer, Integer>(), tResult = new HashMap<Integer, Integer>();
+ ConcurrentHashMap<Integer, Integer> tMap = new ConcurrentHashMap<Integer, Integer>(), tResult = new ConcurrentHashMap<Integer, Integer>();
if (aMaterial.mEnchantmentTools != null) {
tMap.put(aMaterial.mEnchantmentTools.effectId, (int) aMaterial.mEnchantmentToolsLevel);
if (aMaterial.mEnchantmentTools == Enchantment.fortune)
diff --git a/src/main/java/gregtech/api/items/GT_Spray_Hardener_Item.java b/src/main/java/gregtech/api/items/GT_Spray_Hardener_Item.java
index b9b0b7462b..926bcc60dc 100644
--- a/src/main/java/gregtech/api/items/GT_Spray_Hardener_Item.java
+++ b/src/main/java/gregtech/api/items/GT_Spray_Hardener_Item.java
@@ -50,7 +50,7 @@ public class GT_Spray_Hardener_Item extends GT_Tool_Item {
}
ItemStack tStack1 = GT_ModHandler.getIC2Item("constructionFoam", 1), tStack2 = GT_ModHandler.getIC2Item("constructionFoamWall", 1);
- if (tStack1 != null && tStack1.isItemEqual(new ItemStack(aBlock)) && tStack2 != null && tStack2.getItem() != null && tStack2.getItem() instanceof ItemBlock) {
+ if (tStack1 != null && tStack1.isItemEqual(new ItemStack(aBlock)) && tStack2 != null && tStack2.getItem() instanceof ItemBlock) {
if (GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) {
GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(102), 1.0F, -1, aX, aY, aZ);
aWorld.setBlock(aX, aY, aZ, GT_Utility.getBlockFromStack(tStack2), 7, 3);
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
index 5e6ddd77dc..9fcf3bc21b 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
@@ -180,116 +180,114 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
long tTime = System.currentTimeMillis();
- for (int tCode = 0; hasValidMetaTileEntity() && tCode >= 0; ) {
- try {
- switch (tCode) {
- case 0:
- tCode++;
- if (mTickTimer++ == 0) {
- oX = xCoord;
- oY = yCoord;
- oZ = zCoord;
- if (isServerSide()) for (byte i = 0; i < 6; i++)
- if (getCoverIDAtSide(i) != 0)
- if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i))))
- dropCover(i, i, true);
- worldObj.markTileEntityChunkModified(xCoord, yCoord, zCoord, this);
- mMetaTileEntity.onFirstTick(this);
- if (!hasValidMetaTileEntity()) return;
+ try { for (int tCode = 0; hasValidMetaTileEntity() && tCode >= 0; ) {
+ switch (tCode) {
+ case 0:
+ tCode++;
+ if (mTickTimer++ == 0) {
+ oX = xCoord;
+ oY = yCoord;
+ oZ = zCoord;
+ if (isServerSide()) for (byte i = 0; i < 6; i++)
+ if (getCoverIDAtSide(i) != 0)
+ if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i))))
+ dropCover(i, i, true);
+ worldObj.markTileEntityChunkModified(xCoord, yCoord, zCoord, this);
+ mMetaTileEntity.onFirstTick(this);
+ if (!hasValidMetaTileEntity()) return;
+ }
+ case 1:
+ tCode++;
+ if (isClientSide()) {
+ if (mColor != oColor) {
+ mMetaTileEntity.onColorChangeClient(oColor = mColor);
+ issueTextureUpdate();
}
- case 1:
- tCode++;
- if (isClientSide()) {
- if (mColor != oColor) {
- mMetaTileEntity.onColorChangeClient(oColor = mColor);
- issueTextureUpdate();
- }
- if (mNeedsUpdate) {
- worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
- //worldObj.func_147479_m(xCoord, yCoord, zCoord);
- mNeedsUpdate = false;
- }
+ if (mNeedsUpdate) {
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ //worldObj.func_147479_m(xCoord, yCoord, zCoord);
+ mNeedsUpdate = false;
}
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- if (isServerSide() && mTickTimer > 10) {
- for (byte i = (byte) (tCode - 2); i < 6; i++)
- if (getCoverIDAtSide(i) != 0) {
- tCode++;
- GT_CoverBehavior tCover = getCoverBehaviorAtSide(i);
- int tCoverTickRate = tCover.getTickRate(i, getCoverIDAtSide(i), mCoverData[i], this);
- if (tCoverTickRate > 0 && mTickTimer % tCoverTickRate == 0) {
- mCoverData[i] = tCover.doCoverThings(i, getInputRedstoneSignal(i), getCoverIDAtSide(i), mCoverData[i], this, mTickTimer);
- if (!hasValidMetaTileEntity()) return;
- }
+ }
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ if (isServerSide() && mTickTimer > 10) {
+ for (byte i = (byte) (tCode - 2); i < 6; i++)
+ if (getCoverIDAtSide(i) != 0) {
+ tCode++;
+ GT_CoverBehavior tCover = getCoverBehaviorAtSide(i);
+ int tCoverTickRate = tCover.getTickRate(i, getCoverIDAtSide(i), mCoverData[i], this);
+ if (tCoverTickRate > 0 && mTickTimer % tCoverTickRate == 0) {
+ mCoverData[i] = tCover.doCoverThings(i, getInputRedstoneSignal(i), getCoverIDAtSide(i), mCoverData[i], this, mTickTimer);
+ if (!hasValidMetaTileEntity()) return;
}
- mConnections = (byte) (mMetaTileEntity.mConnections | (mConnections & ~63));
- if ((mConnections & -64) == 64 && getRandomNumber(1000) == 0) {
- mConnections = (byte) ((mConnections & ~64) | -128);
}
+ mConnections = (byte) (mMetaTileEntity.mConnections | (mConnections & ~63));
+ if ((mConnections & -64) == 64 && getRandomNumber(1000) == 0) {
+ mConnections = (byte) ((mConnections & ~64) | -128);
+ }
+ }
+ case 8:
+ tCode = 9;
+ mMetaTileEntity.onPreTick(this, mTickTimer);
+ if (!hasValidMetaTileEntity()) return;
+ case 9:
+ tCode++;
+ if (isServerSide()) {
+ if (mTickTimer == 10) {
+ for (byte i = 0; i < 6; i++)
+ mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]);
+ issueBlockUpdate();
}
- case 8:
- tCode = 9;
- mMetaTileEntity.onPreTick(this, mTickTimer);
- if (!hasValidMetaTileEntity()) return;
- case 9:
- tCode++;
- if (isServerSide()) {
- if (mTickTimer == 10) {
- for (byte i = 0; i < 6; i++)
- mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]);
- issueBlockUpdate();
- }
- if (xCoord != oX || yCoord != oY || zCoord != oZ) {
- oX = xCoord;
- oY = yCoord;
- oZ = zCoord;
- issueClientUpdate();
- clearTileEntityBuffer();
- }
+ if (xCoord != oX || yCoord != oY || zCoord != oZ) {
+ oX = xCoord;
+ oY = yCoord;
+ oZ = zCoord;
+ issueClientUpdate();
+ clearTileEntityBuffer();
}
- case 10:
- tCode++;
- mMetaTileEntity.onPostTick(this, mTickTimer);
- if (!hasValidMetaTileEntity()) return;
- case 11:
- tCode++;
- if (isServerSide()) {
- if (mTickTimer % 10 == 0) {
- if (mSendClientData) {
- NW.sendPacketToAllPlayersInRange(worldObj, new GT_Packet_TileEntity(xCoord, (short) yCoord, zCoord, mID, mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5], oTextureData = mConnections, oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), oColor = mColor), xCoord, zCoord);
- mSendClientData = false;
- }
+ }
+ case 10:
+ tCode++;
+ mMetaTileEntity.onPostTick(this, mTickTimer);
+ if (!hasValidMetaTileEntity()) return;
+ case 11:
+ tCode++;
+ if (isServerSide()) {
+ if (mTickTimer % 10 == 0) {
+ if (mSendClientData) {
+ NW.sendPacketToAllPlayersInRange(worldObj, new GT_Packet_TileEntity(xCoord, (short) yCoord, zCoord, mID, mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5], oTextureData = mConnections, oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), oColor = mColor), xCoord, zCoord);
+ mSendClientData = false;
}
+ }
- if (mTickTimer > 10) {
- if (mConnections != oTextureData) sendBlockEvent((byte) 0, oTextureData = mConnections);
- byte tData = mMetaTileEntity.getUpdateData();
- if (tData != oUpdateData) sendBlockEvent((byte) 1, oUpdateData = tData);
- if (mColor != oColor) sendBlockEvent((byte) 2, oColor = mColor);
- tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0));
- if (tData != oRedstoneData) sendBlockEvent((byte) 3, oRedstoneData = tData);
- }
+ if (mTickTimer > 10) {
+ if (mConnections != oTextureData) sendBlockEvent((byte) 0, oTextureData = mConnections);
+ byte tData = mMetaTileEntity.getUpdateData();
+ if (tData != oUpdateData) sendBlockEvent((byte) 1, oUpdateData = tData);
+ if (mColor != oColor) sendBlockEvent((byte) 2, oColor = mColor);
+ tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0));
+ if (tData != oRedstoneData) sendBlockEvent((byte) 3, oRedstoneData = tData);
+ }
- if (mNeedsBlockUpdate) {
- worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockOffset(0, 0, 0));
- mNeedsBlockUpdate = false;
- }
+ if (mNeedsBlockUpdate) {
+ worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockOffset(0, 0, 0));
+ mNeedsBlockUpdate = false;
}
- default:
- tCode = -1;
- break;
- }
- } catch (Throwable e) {
- GT_Log.err.println("Encountered Exception while ticking MetaTileEntity in Step " + (tCode - 1) + ". The Game should've crashed now, but I prevented that. Please report immediately to GregTech Intergalactical!!!");
- e.printStackTrace(GT_Log.err);
+ }
+ default:
+ tCode = -1;
+ break;
}
+ }} catch (Throwable e) {
+ //GT_Log.err.println("Encountered Exception while ticking MetaTileEntity in Step " + (tCode - 1) + ". The Game should've crashed now, but I prevented that. Please report immediately to GregTech Intergalactical!!!");
+ e.printStackTrace(GT_Log.err);
}
if (isServerSide() && hasValidMetaTileEntity()) {
@@ -706,7 +704,7 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
}
@Override
- public ITexture[] getTexture(Block aBlock, byte aSide) {
+ public ITexture[] getTexture(Block block, byte aSide) {
ITexture rIcon = getCoverTexture(aSide);
if (rIcon != null) return new ITexture[]{rIcon};
return getTextureUncovered(aSide);
@@ -1313,4 +1311,4 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider) {
mMetaTileEntity.onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider);
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
index 1ee4ee50f6..de81b09cec 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
@@ -252,289 +252,281 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
mRunningThroughTick = true;
long tTime = System.currentTimeMillis();
- for (int tCode = 0; hasValidMetaTileEntity() && tCode >= 0; ) {
- try {
- switch (tCode) {
- case 0:
- tCode++;
- if (mTickTimer++ == 0) {
- oX = xCoord;
- oY = yCoord;
- oZ = zCoord;
- if (isServerSide()) for (byte i = 0; i < 6; i++)
- if (getCoverIDAtSide(i) != 0)
- if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i))))
- dropCover(i, i, true);
-
- worldObj.markTileEntityChunkModified(xCoord, yCoord, zCoord, this);
-
- mMetaTileEntity.onFirstTick(this);
- if (!hasValidMetaTileEntity()) {
- mRunningThroughTick = false;
- return;
- }
+ try { for (int tCode = 0; hasValidMetaTileEntity() && tCode >= 0; ) {
+ switch (tCode) {
+ case 0:
+ tCode++;
+ if (mTickTimer++ == 0) {
+ oX = xCoord;
+ oY = yCoord;
+ oZ = zCoord;
+ if (isServerSide()) for (byte i = 0; i < 6; i++)
+ if (getCoverIDAtSide(i) != 0)
+ if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i))))
+ dropCover(i, i, true);
+
+ worldObj.markTileEntityChunkModified(xCoord, yCoord, zCoord, this);
+
+ mMetaTileEntity.onFirstTick(this);
+ if (!hasValidMetaTileEntity()) {
+ mRunningThroughTick = false;
+ return;
+ }
+ }
+ case 1:
+ tCode++;
+ if (isClientSide()) {
+ if (mColor != oColor) {
+ mMetaTileEntity.onColorChangeClient(oColor = mColor);
+ issueTextureUpdate();
}
- case 1:
- tCode++;
- if (isClientSide()) {
- if (mColor != oColor) {
- mMetaTileEntity.onColorChangeClient(oColor = mColor);
- issueTextureUpdate();
- }
- if (mLightValue != oLightValueClient) {
- worldObj.setLightValue(EnumSkyBlock.Block, xCoord, yCoord, zCoord, mLightValue);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord + 1, yCoord, zCoord);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord - 1, yCoord, zCoord);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord + 1, zCoord);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord - 1, zCoord);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord + 1);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord - 1);
- oLightValueClient = mLightValue;
- issueTextureUpdate();
- }
+ if (mLightValue != oLightValueClient) {
+ worldObj.setLightValue(EnumSkyBlock.Block, xCoord, yCoord, zCoord, mLightValue);
+ worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord);
+ worldObj.updateLightByType(EnumSkyBlock.Block, xCoord + 1, yCoord, zCoord);
+ worldObj.updateLightByType(EnumSkyBlock.Block, xCoord - 1, yCoord, zCoord);
+ worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord + 1, zCoord);
+ worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord - 1, zCoord);
+ worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord + 1);
+ worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord - 1);
+ oLightValueClient = mLightValue;
+ issueTextureUpdate();
+ }
- if (mNeedsUpdate) {
- worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
- //worldObj.func_147479_m(xCoord, yCoord, zCoord);
- mNeedsUpdate = false;
- }
+ if (mNeedsUpdate) {
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ //worldObj.func_147479_m(xCoord, yCoord, zCoord);
+ mNeedsUpdate = false;
}
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- if (isServerSide() && mTickTimer > 10) {
- for (byte i = (byte) (tCode - 2); i < 6; i++)
- if (getCoverIDAtSide(i) != 0) {
- tCode++;
- GT_CoverBehavior tCover = getCoverBehaviorAtSide(i);
- int tCoverTickRate = tCover.getTickRate(i, getCoverIDAtSide(i), mCoverData[i], this);
- if (tCoverTickRate > 0 && mTickTimer % tCoverTickRate == 0) {
- mCoverData[i] = tCover.doCoverThings(i, getInputRedstoneSignal(i), getCoverIDAtSide(i), mCoverData[i], this, mTickTimer);
- if (!hasValidMetaTileEntity()) {
- mRunningThroughTick = false;
- return;
- }
+ }
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ if (isServerSide() && mTickTimer > 10) {
+ for (byte i = (byte) (tCode - 2); i < 6; i++)
+ if (getCoverIDAtSide(i) != 0) {
+ tCode++;
+ GT_CoverBehavior tCover = getCoverBehaviorAtSide(i);
+ int tCoverTickRate = tCover.getTickRate(i, getCoverIDAtSide(i), mCoverData[i], this);
+ if (tCoverTickRate > 0 && mTickTimer % tCoverTickRate == 0) {
+ mCoverData[i] = tCover.doCoverThings(i, getInputRedstoneSignal(i), getCoverIDAtSide(i), mCoverData[i], this, mTickTimer);
+ if (!hasValidMetaTileEntity()) {
+ mRunningThroughTick = false;
+ return;
}
}
+ }
+ }
+ case 8:
+ tCode = 9;
+ if (isServerSide()) {
+ if (++mAverageEUInputIndex >= mAverageEUInput.length) mAverageEUInputIndex = 0;
+ if (++mAverageEUOutputIndex >= mAverageEUOutput.length) mAverageEUOutputIndex = 0;
+
+ mAverageEUInput[mAverageEUInputIndex] = 0;
+ mAverageEUOutput[mAverageEUOutputIndex] = 0;
+ }
+ case 9:
+ tCode++;
+ mMetaTileEntity.onPreTick(this, mTickTimer);
+ if (!hasValidMetaTileEntity()) {
+ mRunningThroughTick = false;
+ return;
+ }
+ case 10:
+ tCode++;
+ if (isServerSide()) {
+ if (mRedstone != oRedstone || mTickTimer == 10) {
+ for (byte i = 0; i < 6; i++)
+ mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]);
+ oRedstone = mRedstone;
+ issueBlockUpdate();
}
- case 8:
- tCode = 9;
- if (isServerSide()) {
- if (++mAverageEUInputIndex >= mAverageEUInput.length) mAverageEUInputIndex = 0;
- if (++mAverageEUOutputIndex >= mAverageEUOutput.length) mAverageEUOutputIndex = 0;
-
- mAverageEUInput[mAverageEUInputIndex] = 0;
- mAverageEUOutput[mAverageEUOutputIndex] = 0;
+
+ if (xCoord != oX || yCoord != oY || zCoord != oZ) {
+ oX = xCoord;
+ oY = yCoord;
+ oZ = zCoord;
+ issueClientUpdate();
+ clearTileEntityBuffer();
}
- case 9:
- tCode++;
- mMetaTileEntity.onPreTick(this, mTickTimer);
- if (!hasValidMetaTileEntity()) {
- mRunningThroughTick = false;
- return;
+
+ if (mFacing != oFacing) {
+ oFacing = mFacing;
+ for (byte i = 0; i < 6; i++)
+ if (getCoverIDAtSide(i) != 0)
+ if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i))))
+ dropCover(i, i, true);
+ issueBlockUpdate();
}
- case 10:
- tCode++;
- if (isServerSide()) {
- if (mRedstone != oRedstone || mTickTimer == 10) {
- for (byte i = 0; i < 6; i++)
- mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]);
- oRedstone = mRedstone;
- issueBlockUpdate();
- }
- if (xCoord != oX || yCoord != oY || zCoord != oZ) {
- oX = xCoord;
- oY = yCoord;
- oZ = zCoord;
- issueClientUpdate();
- clearTileEntityBuffer();
- }
+ if (mTickTimer > 20 && mMetaTileEntity.isElectric()) {
+ mAcceptedAmperes = 0;
- if (mFacing != oFacing) {
- oFacing = mFacing;
- for (byte i = 0; i < 6; i++)
- if (getCoverIDAtSide(i) != 0)
- if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i))))
- dropCover(i, i, true);
- issueBlockUpdate();
+ if (getOutputVoltage() != oOutput) {
+ oOutput = getOutputVoltage();
}
- if (mTickTimer > 20 && mMetaTileEntity.isElectric()) {
- mAcceptedAmperes = 0;
-
- if (getOutputVoltage() != oOutput) {
- oOutput = getOutputVoltage();
- }
-
- if (mMetaTileEntity.isEnetOutput() || mMetaTileEntity.isEnetInput()) {
- for (byte i = 0; i < 6; i++) {
- boolean
- temp = isEnergyInputSide(i);
- if (temp != mActiveEUInputs[i]) {
- mActiveEUInputs[i] = temp;
- }
- temp = isEnergyOutputSide(i);
- if (temp != mActiveEUOutputs[i]) {
- mActiveEUOutputs[i] = temp;
- }
+ if (mMetaTileEntity.isEnetOutput() || mMetaTileEntity.isEnetInput()) {
+ for (byte i = 0; i < 6; i++) {
+ boolean
+ temp = isEnergyInputSide(i);
+ if (temp != mActiveEUInputs[i]) {
+ mActiveEUInputs[i] = temp;
+ }
+ temp = isEnergyOutputSide(i);
+ if (temp != mActiveEUOutputs[i]) {
+ mActiveEUOutputs[i] = temp;
}
}
+ }
- if (mMetaTileEntity.isEnetOutput() && oOutput > 0) {
- long tOutputVoltage = Math.max(oOutput, oOutput + (1 << GT_Utility.getTier(oOutput))), tUsableAmperage = Math.min(getOutputAmperage(), (getStoredEU() - mMetaTileEntity.getMinimumStoredEU()) / tOutputVoltage);
- if (tUsableAmperage > 0) {
- long tEU = tOutputVoltage * IEnergyConnected.Util.emitEnergyToNetwork(oOutput, tUsableAmperage, this);
- mAverageEUOutput[mAverageEUOutputIndex] += tEU;
- decreaseStoredEU(tEU, true);
- }
+ if (mMetaTileEntity.isEnetOutput() && oOutput > 0) {
+ long tOutputVoltage = Math.max(oOutput, oOutput + (1 << GT_Utility.getTier(oOutput))), tUsableAmperage = Math.min(getOutputAmperage(), (getStoredEU() - mMetaTileEntity.getMinimumStoredEU()) / tOutputVoltage);
+ if (tUsableAmperage > 0) {
+ long tEU = tOutputVoltage * IEnergyConnected.Util.emitEnergyToNetwork(oOutput, tUsableAmperage, this);
+ mAverageEUOutput[mAverageEUOutputIndex] += tEU;
+ decreaseStoredEU(tEU, true);
+ }
+ }
+ if (getEUCapacity() > 0) {
+ if (GregTech_API.sMachineFireExplosions && getRandomNumber(1000) == 0) {
+ Block tBlock = getBlockAtSide((byte) getRandomNumber(6));
+ if (tBlock instanceof BlockFire) doEnergyExplosion();
}
- if (getEUCapacity() > 0) {
- if (GregTech_API.sMachineFireExplosions && getRandomNumber(1000) == 0) {
- Block tBlock = getBlockAtSide((byte) getRandomNumber(6));
- if (tBlock != null && tBlock instanceof BlockFire) doEnergyExplosion();
- }
- if (!hasValidMetaTileEntity()) {
- mRunningThroughTick = false;
- return;
- }
+ if (!hasValidMetaTileEntity()) {
+ mRunningThroughTick = false;
+ return;
+ }
- if (getRandomNumber(1000) == 0) {
- if ((getCoverIDAtSide((byte) 1) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord) - 2 < yCoord)
- || (getCoverIDAtSide((byte) 2) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord - 1) - 1 < yCoord)
- || (getCoverIDAtSide((byte) 3) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord + 1) - 1 < yCoord)
- || (getCoverIDAtSide((byte) 4) == 0 && worldObj.getPrecipitationHeight(xCoord - 1, zCoord) - 1 < yCoord)
- || (getCoverIDAtSide((byte) 5) == 0 && worldObj.getPrecipitationHeight(xCoord + 1, zCoord) - 1 < yCoord)) {
- if (GregTech_API.sMachineRainExplosions && worldObj.isRaining() && getBiome().rainfall > 0) {
- if (getRandomNumber(10) == 0) {
- try {
- GT_Mod.instance.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather");
- } catch (Exception e) {
- }
- doEnergyExplosion();
- } else setOnFire();
- }
- if (!hasValidMetaTileEntity()) {
- mRunningThroughTick = false;
- return;
- }
- if (GregTech_API.sMachineThunderExplosions && worldObj.isThundering() && getBiome().rainfall > 0 && getRandomNumber(3) == 0) {
+ if (getRandomNumber(1000) == 0) {
+ if ((getCoverIDAtSide((byte) 1) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord) - 2 < yCoord)
+ || (getCoverIDAtSide((byte) 2) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord - 1) - 1 < yCoord)
+ || (getCoverIDAtSide((byte) 3) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord + 1) - 1 < yCoord)
+ || (getCoverIDAtSide((byte) 4) == 0 && worldObj.getPrecipitationHeight(xCoord - 1, zCoord) - 1 < yCoord)
+ || (getCoverIDAtSide((byte) 5) == 0 && worldObj.getPrecipitationHeight(xCoord + 1, zCoord) - 1 < yCoord)) {
+ if (GregTech_API.sMachineRainExplosions && worldObj.isRaining() && getBiome().rainfall > 0) {
+ if (getRandomNumber(10) == 0) {
try {
GT_Mod.instance.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather");
} catch (Exception e) {
}
doEnergyExplosion();
+ } else setOnFire();
+ }
+ if (!hasValidMetaTileEntity()) {
+ mRunningThroughTick = false;
+ return;
+ }
+ if (GregTech_API.sMachineThunderExplosions && worldObj.isThundering() && getBiome().rainfall > 0 && getRandomNumber(3) == 0) {
+ try {
+ GT_Mod.instance.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather");
+ } catch (Exception e) {
}
+ doEnergyExplosion();
}
}
}
}
+ }
- if (!hasValidMetaTileEntity()) {
- mRunningThroughTick = false;
- return;
- }
+ if (!hasValidMetaTileEntity()) {
+ mRunningThroughTick = false;
+ return;
}
- case 11:
- tCode++;
- if (isServerSide()) {
- if (mMetaTileEntity.dechargerSlotCount() > 0 && getStoredEU() < getEUCapacity()) {
- for (int i = mMetaTileEntity.dechargerSlotStartIndex(), k = mMetaTileEntity.dechargerSlotCount() + i; i < k; i++) {
- if (mMetaTileEntity.mInventory[i] != null && getStoredEU() < getEUCapacity()) {
- dischargeItem(mMetaTileEntity.mInventory[i]);
- if(ic2.api.info.Info.itemEnergy.getEnergyValue(mMetaTileEntity.mInventory[i])>0){
- if((getStoredEU() + ic2.api.info.Info.itemEnergy.getEnergyValue(mMetaTileEntity.mInventory[i]))<getEUCapacity()){
- increaseStoredEnergyUnits((long)ic2.api.info.Info.itemEnergy.getEnergyValue(mMetaTileEntity.mInventory[i]),false);
- mMetaTileEntity.mInventory[i].stackSize--;
- }
- }
- if (mMetaTileEntity.mInventory[i].stackSize <= 0)
- mMetaTileEntity.mInventory[i] = null;
- mInventoryChanged = true;
- }
+ }
+ case 11:
+ tCode++;
+ if (isServerSide()) {
+ if (mMetaTileEntity.dechargerSlotCount() > 0 && getStoredEU() < getEUCapacity()) {
+ for (int i = mMetaTileEntity.dechargerSlotStartIndex(), k = mMetaTileEntity.dechargerSlotCount() + i; i < k; i++) {
+ if (mMetaTileEntity.mInventory[i] != null && getStoredEU() < getEUCapacity()) {
+ dischargeItem(mMetaTileEntity.mInventory[i]);
+ if (mMetaTileEntity.mInventory[i].stackSize <= 0)
+ mMetaTileEntity.mInventory[i] = null;
+ mInventoryChanged = true;
}
}
}
- case 12:
- tCode++;
- if (isServerSide()) {
- if (mMetaTileEntity.rechargerSlotCount() > 0 && getStoredEU() > 0) {
- for (int i = mMetaTileEntity.rechargerSlotStartIndex(), k = mMetaTileEntity.rechargerSlotCount() + i; i < k; i++) {
- if (getStoredEU() > 0 && mMetaTileEntity.mInventory[i] != null) {
- chargeItem(mMetaTileEntity.mInventory[i]);
- if (mMetaTileEntity.mInventory[i].stackSize <= 0)
- mMetaTileEntity.mInventory[i] = null;
- mInventoryChanged = true;
- }
+ }
+ case 12:
+ tCode++;
+ if (isServerSide()) {
+ if (mMetaTileEntity.rechargerSlotCount() > 0 && getStoredEU() > 0) {
+ for (int i = mMetaTileEntity.rechargerSlotStartIndex(), k = mMetaTileEntity.rechargerSlotCount() + i; i < k; i++) {
+ if (getStoredEU() > 0 && mMetaTileEntity.mInventory[i] != null) {
+ chargeItem(mMetaTileEntity.mInventory[i]);
+ if (mMetaTileEntity.mInventory[i].stackSize <= 0)
+ mMetaTileEntity.mInventory[i] = null;
+ mInventoryChanged = true;
}
}
}
- case 13:
- tCode++;
- updateStatus();
- if (!hasValidMetaTileEntity()) {
- mRunningThroughTick = false;
- return;
- }
- case 14:
- tCode++;
- mMetaTileEntity.onPostTick(this, mTickTimer);
- if (!hasValidMetaTileEntity()) {
- mRunningThroughTick = false;
- return;
- }
- case 15:
- tCode++;
- if (isServerSide()) {
- if (mTickTimer % 10 == 0) {
- if (mSendClientData) {
- NW.sendPacketToAllPlayersInRange(worldObj, new GT_Packet_TileEntity(xCoord, (short) yCoord, zCoord, mID, mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5], oTextureData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0)), oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), oColor = mColor), xCoord, zCoord);
- mSendClientData = false;
- }
+ }
+ case 13:
+ tCode++;
+ updateStatus();
+ if (!hasValidMetaTileEntity()) {
+ mRunningThroughTick = false;
+ return;
+ }
+ case 14:
+ tCode++;
+ mMetaTileEntity.onPostTick(this, mTickTimer);
+ if (!hasValidMetaTileEntity()) {
+ mRunningThroughTick = false;
+ return;
+ }
+ case 15:
+ tCode++;
+ if (isServerSide()) {
+ if (mTickTimer % 10 == 0) {
+ if (mSendClientData) {
+ NW.sendPacketToAllPlayersInRange(worldObj, new GT_Packet_TileEntity(xCoord, (short) yCoord, zCoord, mID, mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5], oTextureData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0)), oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), oColor = mColor), xCoord, zCoord);
+ mSendClientData = false;
}
+ }
- if (mTickTimer > 10) {
- byte tData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0));
- if (tData != oTextureData) sendBlockEvent((byte) 0, oTextureData = tData);
- tData = mMetaTileEntity.getUpdateData();
- if (tData != oUpdateData) sendBlockEvent((byte) 1, oUpdateData = tData);
- if (mColor != oColor) sendBlockEvent((byte) 2, oColor = mColor);
- tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0));
- if (tData != oRedstoneData) sendBlockEvent((byte) 3, oRedstoneData = tData);
- if (mLightValue != oLightValue) {
- worldObj.setLightValue(EnumSkyBlock.Block, xCoord, yCoord, zCoord, mLightValue);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord + 1, yCoord, zCoord);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord - 1, yCoord, zCoord);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord + 1, zCoord);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord - 1, zCoord);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord + 1);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord - 1);
- issueTextureUpdate();
- sendBlockEvent((byte) 7, oLightValue = mLightValue);
- }
+ if (mTickTimer > 10) {
+ byte tData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0));
+ if (tData != oTextureData) sendBlockEvent((byte) 0, oTextureData = tData);
+ tData = mMetaTileEntity.getUpdateData();
+ if (tData != oUpdateData) sendBlockEvent((byte) 1, oUpdateData = tData);
+ if (mColor != oColor) sendBlockEvent((byte) 2, oColor = mColor);
+ tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0));
+ if (tData != oRedstoneData) sendBlockEvent((byte) 3, oRedstoneData = tData);
+ if (mLightValue != oLightValue) {
+ worldObj.setLightValue(EnumSkyBlock.Block, xCoord, yCoord, zCoord, mLightValue);
+ worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord);
+ worldObj.updateLightByType(EnumSkyBlock.Block, xCoord + 1, yCoord, zCoord);
+ worldObj.updateLightByType(EnumSkyBlock.Block, xCoord - 1, yCoord, zCoord);
+ worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord + 1, zCoord);
+ worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord - 1, zCoord);
+ worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord + 1);
+ worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord - 1);
+ issueTextureUpdate();
+ sendBlockEvent((byte) 7, oLightValue = mLightValue);
}
+ }
- if (mNeedsBlockUpdate) {
- worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockOffset(0, 0, 0));
- mNeedsBlockUpdate = false;
- }
+ if (mNeedsBlockUpdate) {
+ worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockOffset(0, 0, 0));
+ mNeedsBlockUpdate = false;
}
- default:
- tCode = -1;
- break;
- }
- } catch (Throwable e) {
- GT_Log.err.println("Encountered Exception while ticking MetaTileEntity in Step " + (tCode - 1) + ". The Game should've crashed now, but I prevented that. Please report immediately to GregTech Intergalactical!!!");
- e.printStackTrace(GT_Log.err);
- }
+ }
+ default:
+ tCode = -1;
+ break;
+ }}
+ } catch (Throwable e) {
+ //gregtech.api.util.GT_Log.err.println("Encountered Exception while ticking MetaTileEntity in Step " + (tCode - 1) + ". The Game should've crashed now, but I prevented that. Please report immediately to GregTech Intergalactical!!!");
+ e.printStackTrace(GT_Log.err);
}
if (isServerSide() && hasValidMetaTileEntity()) {
@@ -636,7 +628,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aLogLevel) {
ArrayList<String> tList = new ArrayList<String>();
if (aLogLevel > 2) {
- tList.add("Meta-ID: " +EnumChatFormatting.BLUE+mID+EnumChatFormatting.RESET + (canAccessData() ? EnumChatFormatting.GREEN+" valid"+EnumChatFormatting.RESET : EnumChatFormatting.RED+" invalid"+EnumChatFormatting.RESET) + (mMetaTileEntity == null ? EnumChatFormatting.RED+" MetaTileEntity == null!"+EnumChatFormatting.RESET : " "));
+ tList.add("Meta-ID: " +EnumChatFormatting.BLUE+ mID +EnumChatFormatting.RESET + (canAccessData() ? EnumChatFormatting.GREEN+" valid"+EnumChatFormatting.RESET : EnumChatFormatting.RED+" invalid"+EnumChatFormatting.RESET) + (mMetaTileEntity == null ? EnumChatFormatting.RED+" MetaTileEntity == null!"+EnumChatFormatting.RESET : " "));
}
if (aLogLevel > 1) {
if (mTimeStatistics.length > 0) {
@@ -1842,4 +1834,4 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider) {
mMetaTileEntity.onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider);
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntityUE.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntityUE.java
index 26388bd187..fda019f486 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntityUE.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntityUE.java
@@ -75,7 +75,7 @@ public class BaseMetaTileEntityUE extends BaseMetaTileEntity /*implements IUETil
for (byte i = 0; i < 6; i++) {
if (inputEnergyFrom(i)) {
Object tTileEntity = getTileEntityAtSide(i);
- if (tTileEntity != null && tTileEntity instanceof IConductor) {
+ if (tTileEntity instanceof IConductor) {
rSides.add(ForgeDirection.getOrientation(i));
}
}
@@ -88,7 +88,7 @@ public class BaseMetaTileEntityUE extends BaseMetaTileEntity /*implements IUETil
for (byte i = 0; i < 6; i++) {
if (outputsEnergyTo(i)) {
Object tTileEntity = getTileEntityAtSide(i);
- if (tTileEntity != null && tTileEntity instanceof IConductor) {
+ if (tTileEntity instanceof IConductor) {
rSides.add(ForgeDirection.getOrientation(i));
}
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java
index 59e38ac5d9..560ddb0947 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java
@@ -12,6 +12,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.BaseMetaPipeEntity;
import gregtech.api.metatileentity.MetaPipeEntity;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.objects.XSTR;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_Utility;
import net.minecraft.entity.Entity;
@@ -27,8 +28,8 @@ import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.Map.Entry;
+import java.util.concurrent.ConcurrentHashMap;
import static gregtech.api.enums.GT_Values.D1;
@@ -186,7 +187,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
}
if (mLastReceivedFrom == oLastReceivedFrom) {
- HashMap<IFluidHandler, ForgeDirection> tTanks = new HashMap<IFluidHandler, ForgeDirection>();
+ ConcurrentHashMap<IFluidHandler, ForgeDirection> tTanks = new ConcurrentHashMap<IFluidHandler, ForgeDirection>();
mConnections = 0;
@@ -264,7 +265,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(4), 5, 1.0F, aX, aY, aZ);
for (byte i = 0; i < 6; i++)
for (int l = 0; l < 2; ++l)
- getBaseMetaTileEntity().getWorld().spawnParticle("largesmoke", aX - 0.5 + Math.random(), aY - 0.5 + Math.random(), aZ - 0.5 + Math.random(), ForgeDirection.getOrientation(i).offsetX / 5.0, ForgeDirection.getOrientation(i).offsetY / 5.0, ForgeDirection.getOrientation(i).offsetZ / 5.0);
+ getBaseMetaTileEntity().getWorld().spawnParticle("largesmoke", aX - 0.5 + (new XSTR()).nextFloat(), aY - 0.5 + (new XSTR()).nextFloat(), aZ - 0.5 + (new XSTR()).nextFloat(), ForgeDirection.getOrientation(i).offsetX / 5.0, ForgeDirection.getOrientation(i).offsetY / 5.0, ForgeDirection.getOrientation(i).offsetZ / 5.0);
}
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java
index 7cb88cb0cd..0a3ee8d5ce 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java
@@ -19,7 +19,7 @@ import net.minecraft.tileentity.TileEntityDispenser;
import net.minecraft.tileentity.TileEntityHopper;
import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.concurrent.ConcurrentHashMap;
public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileEntityItemPipe {
public final float mThickNess;
@@ -205,7 +205,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
for (boolean temp = true; temp && !isInventoryEmpty() && pipeCapacityCheck(); ) {
temp = false;
tPipeList.clear();
- for (IMetaTileEntityItemPipe tTileEntity : GT_Utility.sortMapByValuesAcending(IMetaTileEntityItemPipe.Util.scanPipes(this, new HashMap<IMetaTileEntityItemPipe, Long>(), 0, false, false)).keySet()) {
+ for (IMetaTileEntityItemPipe tTileEntity : GT_Utility.sortMapByValuesAcending(IMetaTileEntityItemPipe.Util.scanPipes(this, new ConcurrentHashMap<IMetaTileEntityItemPipe, Long>(), 0, false, false)).keySet()) {
if (temp) break;
tPipeList.add(tTileEntity);
while (!temp && !isInventoryEmpty() && tTileEntity.sendItemStack(aBaseMetaTileEntity))
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java
index 026ecc27a5..131f52f351 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java
@@ -6,6 +6,7 @@ import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.objects.XSTR;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_Utility;
import net.minecraft.entity.EntityLivingBase;
@@ -149,7 +150,7 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE
if (aIndex == 9) {
GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(4), 5, 1.0F, aX, aY, aZ);
for (int l = 0; l < 8; ++l)
- getBaseMetaTileEntity().getWorld().spawnParticle("largesmoke", aX - 0.5 + Math.random(), aY - 0.5 + Math.random(), aZ - 0.5 + Math.random(), ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetX / 5.0, ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetY / 5.0, ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetZ / 5.0);
+ getBaseMetaTileEntity().getWorld().spawnParticle("largesmoke", aX - 0.5 + (new XSTR()).nextFloat(), aY - 0.5 + (new XSTR()).nextFloat(), aZ - 0.5 + (new XSTR()).nextFloat(), ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetX / 5.0, ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetY / 5.0, ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetZ / 5.0);
}
}
diff --git a/src/main/java/gregtech/api/objects/GT_ArrayList.java b/src/main/java/gregtech/api/objects/GT_ArrayList.java
index 5bc781e281..d16974bc78 100644
--- a/src/main/java/gregtech/api/objects/GT_ArrayList.java
+++ b/src/main/java/gregtech/api/objects/GT_ArrayList.java
@@ -6,6 +6,7 @@ import java.util.Collection;
public class GT_ArrayList<E> extends ArrayList<E> {
private static final long serialVersionUID = 1L;
+ private int size_sS;
private final boolean mAllowNulls;
@@ -17,13 +18,13 @@ public class GT_ArrayList<E> extends ArrayList<E> {
public GT_ArrayList(boolean aAllowNulls, E... aArray) {
super(Arrays.asList(aArray));
mAllowNulls = aAllowNulls;
- if (!mAllowNulls) for (int i = 0; i < size(); i++) if (get(i) == null) remove(i--);
+ if (!mAllowNulls) {size_sS=size(); for (int i = 0; i < size_sS; i++) if (get(i) == null) {remove(i--);size_sS=size();}}
}
public GT_ArrayList(boolean aAllowNulls, Collection<? extends E> aList) {
super(aList);
mAllowNulls = aAllowNulls;
- if (!mAllowNulls) for (int i = 0; i < size(); i++) if (get(i) == null) remove(i--);
+ if (!mAllowNulls) {size_sS=size(); for (int i = 0; i < size_sS; i++) if (get(i) == null) {remove(i--);size_sS=size();}}
}
@Override
@@ -46,14 +47,14 @@ public class GT_ArrayList<E> extends ArrayList<E> {
@Override
public boolean addAll(Collection<? extends E> aList) {
boolean rReturn = super.addAll(aList);
- if (!mAllowNulls) for (int i = 0; i < size(); i++) if (get(i) == null) remove(i--);
+ if (!mAllowNulls) {size_sS=size(); for (int i = 0; i < size_sS; i++) if (get(i) == null) {remove(i--);size_sS=size();}}
return rReturn;
}
@Override
public boolean addAll(int aIndex, Collection<? extends E> aList) {
boolean rReturn = super.addAll(aIndex, aList);
- if (!mAllowNulls) for (int i = 0; i < size(); i++) if (get(i) == null) remove(i--);
+ if (!mAllowNulls) {size_sS=size(); for (int i = 0; i < size_sS; i++) if (get(i) == null) {remove(i--);size_sS=size();}}
return rReturn;
}
} \ No newline at end of file
diff --git a/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java b/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java
index caf46b3980..12c2e28a37 100644
--- a/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java
+++ b/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java
@@ -36,7 +36,7 @@ public class GT_CopiedBlockTexture implements ITexture {
this(aBlock, aSide, aMeta, Dyes._NULL.mRGBa);
}
- private IIcon getIcon(int aSide) {
+ private final IIcon getIcon(int aSide) {
if (mSide == 6) return mBlock.getIcon(aSide, mMeta);
return mBlock.getIcon(mSide, mMeta);
}
diff --git a/src/main/java/gregtech/api/objects/GT_FluidStack.java b/src/main/java/gregtech/api/objects/GT_FluidStack.java
index 3f9e52818c..6ff1627ab7 100644
--- a/src/main/java/gregtech/api/objects/GT_FluidStack.java
+++ b/src/main/java/gregtech/api/objects/GT_FluidStack.java
@@ -29,28 +29,24 @@ public class GT_FluidStack extends FluidStack {
this(aFluid.getFluid(), aFluid.amount);
}
- public static synchronized void fixAllThoseFuckingFluidIDs() {
- if (ForgeVersion.getBuildVersion() < 1355) {
- while (lock) {
- try {
+ public static final synchronized void fixAllThoseFuckingFluidIDs() {
+ if (ForgeVersion.getBuildVersion() < 1355 && ForgeVersion.getRevisionVersion() < 4) {
+ try {
+ while (lock) {
Thread.sleep(1);
- } catch (InterruptedException e) {
- }
- }
+ }} catch (InterruptedException e) {}
lock = true;
for (GT_FluidStack tFluid : sAllFluidStacks) tFluid.fixFluidIDForFucksSake();
- for (Map<Fluid, ?> tMap : GregTech_API.sFluidMappings)
- try {
+ try {
+ for (Map<Fluid, ?> tMap : GregTech_API.sFluidMappings)
GT_Utility.reMap(tMap);
- } catch (Throwable e) {
- e.printStackTrace(GT_Log.err);
- }
+ } catch (Throwable e) {e.printStackTrace(GT_Log.err);}
lock = false;
}
}
- public void fixFluidIDForFucksSake() {
- if (ForgeVersion.getBuildVersion() < 1355) {
+ public final void fixFluidIDForFucksSake() {
+ if (ForgeVersion.getBuildVersion() < 1355 && ForgeVersion.getRevisionVersion() < 4) {
int fluidID;
try {
fluidID = this.getFluid().getID();
@@ -67,7 +63,7 @@ public class GT_FluidStack extends FluidStack {
@Override
public FluidStack copy() {
- if (ForgeVersion.getBuildVersion() < 1355) {
+ if (ForgeVersion.getBuildVersion() < 1355 && ForgeVersion.getRevisionVersion() < 4) {
fixFluidIDForFucksSake();
}
return new GT_FluidStack(this);
diff --git a/src/main/java/gregtech/api/objects/GT_ItemStack.java b/src/main/java/gregtech/api/objects/GT_ItemStack.java
index f865b348a0..9791cadeeb 100644
--- a/src/main/java/gregtech/api/objects/GT_ItemStack.java
+++ b/src/main/java/gregtech/api/objects/GT_ItemStack.java
@@ -24,16 +24,16 @@ public class GT_ItemStack {
this(GT_Utility.intToStack(aHashCode));
}
- public ItemStack toStack() {
+ public final ItemStack toStack() {
if (mItem == null) return null;
return new ItemStack(mItem, 1, mMetaData);
}
- public boolean isStackEqual(ItemStack aStack) {
+ public final boolean isStackEqual(ItemStack aStack) {
return GT_Utility.areStacksEqual(toStack(), aStack);
}
- public boolean isStackEqual(GT_ItemStack aStack) {
+ public final boolean isStackEqual(GT_ItemStack aStack) {
return GT_Utility.areStacksEqual(toStack(), aStack.toStack());
}
diff --git a/src/main/java/gregtech/api/objects/ItemData.java b/src/main/java/gregtech/api/objects/ItemData.java
index aedc48db5a..e4a39fd532 100644
--- a/src/main/java/gregtech/api/objects/ItemData.java
+++ b/src/main/java/gregtech/api/objects/ItemData.java
@@ -93,26 +93,26 @@ public class ItemData {
mByProducts = rList.toArray(new MaterialStack[rList.size()]);
}
- public boolean hasValidPrefixMaterialData() {
+ public final boolean hasValidPrefixMaterialData() {
return mPrefix != null && mMaterial != null && mMaterial.mMaterial != null;
}
- public boolean hasValidPrefixData() {
+ public final boolean hasValidPrefixData() {
return mPrefix != null;
}
- public boolean hasValidMaterialData() {
+ public final boolean hasValidMaterialData() {
return mMaterial != null && mMaterial.mMaterial != null;
}
- public ArrayList<MaterialStack> getAllMaterialStacks() {
+ public final ArrayList<MaterialStack> getAllMaterialStacks() {
ArrayList<MaterialStack> rList = new ArrayList();
if (hasValidMaterialData()) rList.add(mMaterial);
rList.addAll(Arrays.asList(mByProducts));
return rList;
}
- public MaterialStack getByProduct(int aIndex) {
+ public final MaterialStack getByProduct(int aIndex) {
return aIndex >= 0 && aIndex < mByProducts.length ? mByProducts[aIndex] : null;
}
diff --git a/src/main/java/gregtech/api/objects/XSTR.java b/src/main/java/gregtech/api/objects/XSTR.java
new file mode 100644
index 0000000000..2f185ac3bb
--- /dev/null
+++ b/src/main/java/gregtech/api/objects/XSTR.java
@@ -0,0 +1,255 @@
+package gregtech.api.objects;
+/**
+ * A subclass of java.util.random that implements the Xorshift random number
+ * generator
+ *
+ * - it is 30% faster than the generator from Java's library - it produces
+ * random sequences of higher quality than java.util.Random - this class also
+ * provides a clone() function
+ *
+ * Usage: XSRandom rand = new XSRandom(); //Instantiation x = rand.nextInt();
+ * //pull a random number
+ *
+ * To use the class in legacy code, you may also instantiate an XSRandom object
+ * and assign it to a java.util.Random object: java.util.Random rand = new
+ * XSRandom();
+ *
+ * for an explanation of the algorithm, see
+ * http://demesos.blogspot.com/2011/09/pseudo-random-number-generators.html
+ *
+ * @author Wilfried Elmenreich University of Klagenfurt/Lakeside Labs
+ * http://www.elmenreich.tk
+ *
+ * This code is released under the GNU Lesser General Public License Version 3
+ * http://www.gnu.org/licenses/lgpl-3.0.txt
+ */
+
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * XSTR - Xorshift ThermiteRandom
+ * Modified by Bogdan-G
+ * 03.06.2016
+ * version 0.0.4
+ */
+public class XSTR extends Random {
+
+ private static final long serialVersionUID = 6208727693524452904L;
+ private long seed;
+ private long last;
+ private static final long GAMMA = 0x9e3779b97f4a7c15L;
+ private static final int PROBE_INCREMENT = 0x9e3779b9;
+ private static final long SEEDER_INCREMENT = 0xbb67ae8584caa73bL;
+ private static final double DOUBLE_UNIT = 0x1.0p-53; // 1.0 / (1L << 53)
+ private static final float FLOAT_UNIT = 0x1.0p-24f; // 1.0f / (1 << 24)
+
+ /*
+ MODIFIED BY: Robotia
+ Modification: Implemented Random class seed generator
+ */
+ /**
+ * Creates a new pseudo random number generator. The seed is initialized to
+ * the current time, as if by
+ * <code>setSeed(System.currentTimeMillis());</code>.
+ */
+ public XSTR() {
+ this(seedUniquifier() ^ System.nanoTime());
+ }
+ private static final AtomicLong seedUniquifier
+ = new AtomicLong(8682522807148012L);
+
+ private static long seedUniquifier() {
+ // L'Ecuyer, "Tables of Linear Congruential Generators of
+ // Different Sizes and Good Lattice Structure", 1999
+ for (;;) {
+ long current = seedUniquifier.get();
+ long next = current * 181783497276652981L;
+ if (seedUniquifier.compareAndSet(current, next)) {
+ return next;
+ }
+ }
+ }
+
+ /**
+ * Creates a new pseudo random number generator, starting with the specified
+ * seed, using <code>setSeed(seed);</code>.
+ *
+ * @param seed the initial seed
+ */
+ public XSTR(long seed) {
+ this.seed = seed;
+ }
+ public boolean nextBoolean() {
+ return next(1) != 0;
+ }
+
+ public double nextDouble() {
+ return (((long)(next(26)) << 27) + next(27)) * DOUBLE_UNIT;
+ }
+ /**
+ * Returns the current state of the seed, can be used to clone the object
+ *
+ * @return the current seed
+ */
+ public synchronized long getSeed() {
+ return seed;
+ }
+
+ /**
+ * Sets the seed for this pseudo random number generator. As described
+ * above, two instances of the same random class, starting with the same
+ * seed, produce the same results, if the same methods are called.
+ *
+ * @param seed the new seed
+ */
+ public synchronized void setSeed(long seed) {
+ this.seed = seed;
+ }
+
+ /**
+ * @return Returns an XSRandom object with the same state as the original
+ */
+ @Override
+ public XSTR clone() {
+ return new XSTR(getSeed());
+ }
+
+ /**
+ * Implementation of George Marsaglia's elegant Xorshift random generator
+ * 30% faster and better quality than the built-in java.util.random see also
+ * see http://www.javamex.com/tutorials/random_numbers/xorshift.shtml
+ *
+ * @param nbits
+ * @return
+ */
+ public int next(int nbits) {
+ long x = seed;
+ x ^= (x << 21);
+ x ^= (x >>> 35);
+ x ^= (x << 4);
+ seed = x;
+ x &= ((1L << nbits) - 1);
+ return (int) x;
+ }
+ boolean haveNextNextGaussian = false;
+ double nextNextGaussian = 0;
+ synchronized public double nextGaussian() {
+ // See Knuth, ACP, Section 3.4.1 Algorithm C.
+ if (haveNextNextGaussian) {
+ haveNextNextGaussian = false;
+ return nextNextGaussian;
+ } else {
+ double v1, v2, s;
+ do {
+ v1 = 2 * nextDouble() - 1; // between -1 and 1
+ v2 = 2 * nextDouble() - 1; // between -1 and 1
+ s = v1 * v1 + v2 * v2;
+ } while (s >= 1 || s == 0);
+ double multiplier = StrictMath.sqrt(-2 * StrictMath.log(s)/s);
+ nextNextGaussian = v2 * multiplier;
+ haveNextNextGaussian = true;
+ return v1 * multiplier;
+ }
+ }
+ /**
+ * Returns a pseudorandom, uniformly distributed {@code int} value between 0
+ * (inclusive) and the specified value (exclusive), drawn from this random
+ * number generator's sequence. The general contract of {@code nextInt} is
+ * that one {@code int} value in the specified range is pseudorandomly
+ * generated and returned. All {@code bound} possible {@code int} values are
+ * produced with (approximately) equal probability. The method
+ * {@code nextInt(int bound)} is implemented by class {@code Random} as if
+ * by:
+ * <pre> {@code
+ * public int nextInt(int bound) {
+ * if (bound <= 0)
+ * throw new IllegalArgumentException("bound must be positive");
+ *
+ * if ((bound & -bound) == bound) // i.e., bound is a power of 2
+ * return (int)((bound * (long)next(31)) >> 31);
+ *
+ * int bits, val;
+ * do {
+ * bits = next(31);
+ * val = bits % bound;
+ * } while (bits - val + (bound-1) < 0);
+ * return val;
+ * }}</pre>
+ *
+ * <p>The hedge "approx
+ * imately" is used in the foregoing description only because the next
+ * method is only approximately an unbiased source of independently chosen
+ * bits. If it were a perfect source of randomly chosen bits, then the
+ * algorithm shown would choose {@code int} values from the stated range
+ * with perfect uniformity.
+ * <p>
+ * The algorithm is slightly tricky. It rejects values that would result in
+ * an uneven distribution (due to the fact that 2^31 is not divisible by n).
+ * The probability of a value being rejected depends on n. The worst case is
+ * n=2^30+1, for which the probability of a reject is 1/2, and the expected
+ * number of iterations before the loop terminates is 2.
+ * <p>
+ * The algorithm treats the case where n is a power of two specially: it
+ * returns the correct number of high-order bits from the underlying
+ * pseudo-random number generator. In the absence of special treatment, the
+ * correct number of <i>low-order</i> bits would be returned. Linear
+ * congruential pseudo-random number generators such as the one implemented
+ * by this class are known to have short periods in the sequence of values
+ * of their low-order bits. Thus, this special case greatly increases the
+ * length of the sequence of values returned by successive calls to this
+ * method if n is a small power of two.
+ *
+ * @param bound the upper bound (exclusive). Must be positive.
+ * @return the next pseudorandom, uniformly distributed {@code int} value
+ * between zero (inclusive) and {@code bound} (exclusive) from this random
+ * number generator's sequence
+ * @throws IllegalArgumentException if bound is not positive
+ * @since 1.2
+ */
+ public int nextInt(int bound) {
+ //if (bound <= 0) {
+ //throw new RuntimeException("BadBound");
+ //}
+
+ /*int r = next(31);
+ int m = bound - 1;
+ if ((bound & m) == 0) // i.e., bound is a power of 2
+ {
+ r = (int) ((bound * (long) r) >> 31);
+ } else {
+ for (int u = r;
+ u - (r = u % bound) + m < 0;
+ u = next(31))
+ ;
+ }
+ return r;*/
+ //speedup, new nextInt ~+40%
+ last = seed ^ (seed << 21);
+ last ^= (last >>> 35);
+ last ^= (last << 4);
+ seed = last;
+ int out = (int) last % bound;
+ return (out < 0) ? -out : out;
+ }
+ public int nextInt() {
+ return next(32);
+ }
+
+ public float nextFloat() {
+ return next(24) * FLOAT_UNIT;
+ }
+
+ public long nextLong() {
+ // it's okay that the bottom word remains signed.
+ return ((long)(next(32)) << 32) + next(32);
+ }
+
+ public void nextBytes(byte[] bytes_arr) {
+ for (int iba = 0, lenba = bytes_arr.length; iba < lenba; )
+ for (int rndba = nextInt(),
+ nba = Math.min(lenba - iba, Integer.SIZE/Byte.SIZE);
+ nba-- > 0; rndba >>= Byte.SIZE)
+ bytes_arr[iba++] = (byte)rndba;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java
index 0909229d82..92944d3e32 100644
--- a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java
+++ b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java
@@ -22,9 +22,9 @@ public class GT_Runnable_MachineBlockUpdate implements Runnable {
private static void stepToUpdateMachine(World aWorld, int aX, int aY, int aZ, ArrayList<ChunkPosition> aList) {
aList.add(new ChunkPosition(aX, aY, aZ));
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (tTileEntity != null && tTileEntity instanceof IMachineBlockUpdateable)
+ if (tTileEntity instanceof IMachineBlockUpdateable)
((IMachineBlockUpdateable) tTileEntity).onMachineBlockUpdate();
- if (aList.size() < 5 || (tTileEntity != null && tTileEntity instanceof IMachineBlockUpdateable) || GregTech_API.isMachineBlock(aWorld.getBlock(aX, aY, aZ), aWorld.getBlockMetadata(aX, aY, aZ))) {
+ if (aList.size() < 5 || (tTileEntity instanceof IMachineBlockUpdateable) || GregTech_API.isMachineBlock(aWorld.getBlock(aX, aY, aZ), aWorld.getBlockMetadata(aX, aY, aZ))) {
if (!aList.contains(new ChunkPosition(aX + 1, aY, aZ))) stepToUpdateMachine(aWorld, aX + 1, aY, aZ, aList);
if (!aList.contains(new ChunkPosition(aX - 1, aY, aZ))) stepToUpdateMachine(aWorld, aX - 1, aY, aZ, aList);
if (!aList.contains(new ChunkPosition(aX, aY + 1, aZ))) stepToUpdateMachine(aWorld, aX, aY + 1, aZ, aList);
diff --git a/src/main/java/gregtech/api/util/GT_BaseCrop.java b/src/main/java/gregtech/api/util/GT_BaseCrop.java
index c106816ba2..0171e35ff2 100644
--- a/src/main/java/gregtech/api/util/GT_BaseCrop.java
+++ b/src/main/java/gregtech/api/util/GT_BaseCrop.java
@@ -177,7 +177,7 @@ public class GT_BaseCrop extends CropCard implements ICropCardInfo {
@Override
public ItemStack getGain(ICropTile aCrop) {
int tDrop = 0;
- if (mSpecialDrops != null && (tDrop = new Random().nextInt((mSpecialDrops.length*2) + 2)) < mSpecialDrops.length && mSpecialDrops[tDrop] != null) {
+ if (mSpecialDrops != null && (tDrop = java.util.concurrent.ThreadLocalRandom.current().nextInt(0, (mSpecialDrops.length*2) + 2)) < mSpecialDrops.length && mSpecialDrops[tDrop] != null) {
return GT_Utility.copy(mSpecialDrops[tDrop]);
}
return GT_Utility.copy(mDrop);
diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java
index be85ca29ce..00d637398d 100644
--- a/src/main/java/gregtech/api/util/GT_ModHandler.java
+++ b/src/main/java/gregtech/api/util/GT_ModHandler.java
@@ -52,18 +52,74 @@ import static gregtech.api.enums.GT_Values.*;
public class GT_ModHandler {
public static final List<IRecipe> sSingleNonBlockDamagableRecipeList = new ArrayList<IRecipe>(1000);
private static final Map<String, ItemStack> sIC2ItemMap = new HashMap<String, ItemStack>();
- private static final List<IRecipe> sAllRecipeList = Collections.synchronizedList(new ArrayList<IRecipe>(5000)), sBufferRecipeList = new ArrayList<IRecipe>(1000);
+ private static final List<IRecipe> sAllRecipeList = /*Collections.synchronizedList(*/new ArrayList<IRecipe>(5000)/*)*/, sBufferRecipeList = new ArrayList<IRecipe>(1000);
public static volatile int VERSION = 509;
public static Collection<String> sNativeRecipeClasses = new HashSet<String>(), sSpecialRecipeClasses = new HashSet<String>();
public static GT_HashSet<GT_ItemStack> sNonReplaceableItems = new GT_HashSet<GT_ItemStack>();
public static Object sBoxableWrapper = GT_Utility.callConstructor("gregtechmod.api.util.GT_IBoxableWrapper", 0, null, false);
- private static Map<IRecipeInput, RecipeOutput> sExtractorRecipes = new HashMap<IRecipeInput, RecipeOutput>();
- private static Map<IRecipeInput, RecipeOutput> sMaceratorRecipes = new HashMap<IRecipeInput, RecipeOutput>();
- private static Map<IRecipeInput, RecipeOutput> sCompressorRecipes = new HashMap<IRecipeInput, RecipeOutput>();
- private static Map<IRecipeInput, RecipeOutput> sOreWashingRecipes = new HashMap<IRecipeInput, RecipeOutput>();
- private static Map<IRecipeInput, RecipeOutput> sThermalCentrifugeRecipes = new HashMap<IRecipeInput, RecipeOutput>();
- private static Map<IRecipeInput, RecipeOutput> sMassfabRecipes = new HashMap<IRecipeInput, RecipeOutput>();
+ private static Map<IRecipeInput, RecipeOutput> sExtractorRecipes = new /*Concurrent*/HashMap<IRecipeInput, RecipeOutput>();
+ private static Map<IRecipeInput, RecipeOutput> sMaceratorRecipes = new /*Concurrent*/HashMap<IRecipeInput, RecipeOutput>();
+ private static Map<IRecipeInput, RecipeOutput> sCompressorRecipes = new /*Concurrent*/HashMap<IRecipeInput, RecipeOutput>();
+ private static Map<IRecipeInput, RecipeOutput> sOreWashingRecipes = new /*Concurrent*/HashMap<IRecipeInput, RecipeOutput>();
+ private static Map<IRecipeInput, RecipeOutput> sThermalCentrifugeRecipes = new /*Concurrent*/HashMap<IRecipeInput, RecipeOutput>();
+ private static Map<IRecipeInput, RecipeOutput> sMassfabRecipes = new /*Concurrent*/HashMap<IRecipeInput, RecipeOutput>();
private static boolean sBufferCraftingRecipes = true;
+ public static List<Integer> sSingleNonBlockDamagableRecipeList_list = new ArrayList<Integer>(100);
+ private static boolean sSingleNonBlockDamagableRecipeList_create = true;
+ private static final ItemStack sMt1 = new ItemStack(Blocks.dirt, 1, 0), sMt2 = new ItemStack(Blocks.dirt, 1, 0);
+ private static final String s_H = "h", s_F = "f", s_I = "I", s_P = "P", s_R = "R";
+ private static final ItemStack[][]
+ sShapes1 = new ItemStack[][]{
+ {sMt1, null, sMt1, sMt1, sMt1, sMt1, null, sMt1, null},
+ {sMt1, null, sMt1, sMt1, null, sMt1, sMt1, sMt1, sMt1},
+ {null, sMt1, null, sMt1, sMt1, sMt1, sMt1, null, sMt1},
+ {sMt1, sMt1, sMt1, sMt1, null, sMt1, null, null, null},
+ {sMt1, null, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1},
+ {sMt1, sMt1, sMt1, sMt1, null, sMt1, sMt1, null, sMt1},
+ {null, null, null, sMt1, null, sMt1, sMt1, null, sMt1},
+ {null, sMt1, null, null, sMt1, null, null, sMt2, null},
+ {sMt1, sMt1, sMt1, null, sMt2, null, null, sMt2, null},
+ {null, sMt1, null, null, sMt2, null, null, sMt2, null},
+ {sMt1, sMt1, null, sMt1, sMt2, null, null, sMt2, null},
+ {null, sMt1, sMt1, null, sMt2, sMt1, null, sMt2, null},
+ {sMt1, sMt1, null, null, sMt2, null, null, sMt2, null},
+ {null, sMt1, sMt1, null, sMt2, null, null, sMt2, null},
+ {null, sMt1, null, sMt1, null, null, null, sMt1, sMt2},
+ {null, sMt1, null, null, null, sMt1, sMt2, sMt1, null},
+ {null, sMt1, null, sMt1, null, sMt1, null, null, sMt2},
+ {null, sMt1, null, sMt1, null, sMt1, sMt2, null, null},
+ {null, sMt2, null, null, sMt1, null, null, sMt1, null},
+ {null, sMt2, null, null, sMt2, null, sMt1, sMt1, sMt1},
+ {null, sMt2, null, null, sMt2, null, null, sMt1, null},
+ {null, sMt2, null, sMt1, sMt2, null, sMt1, sMt1, null},
+ {null, sMt2, null, null, sMt2, sMt1, null, sMt1, sMt1},
+ {null, sMt2, null, null, sMt2, null, sMt1, sMt1, null},
+ {sMt1, null, null, null, sMt2, null, null, null, sMt2},
+ {null, null, sMt1, null, sMt2, null, sMt2, null, null},
+ {sMt1, null, null, null, sMt2, null, null, null, null},
+ {null, null, sMt1, null, sMt2, null, null, null, null},
+ {sMt1, sMt2, null, null, null, null, null, null, null},
+ {sMt2, sMt1, null, null, null, null, null, null, null},
+ {sMt1, null, null, sMt2, null, null, null, null, null},
+ {sMt2, null, null, sMt1, null, null, null, null, null},
+ {sMt1, sMt1, sMt1, sMt1, sMt1, sMt1, null, sMt2, null},
+ {sMt1, sMt1, null, sMt1, sMt1, sMt2, sMt1, sMt1, null},
+ {null, sMt1, sMt1, sMt2, sMt1, sMt1, null, sMt1, sMt1},
+ {null, sMt2, null, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1},
+ {sMt1, sMt1, sMt1, sMt1, sMt2, sMt1, null, sMt2, null},
+ {sMt1, sMt1, null, sMt1, sMt2, sMt2, sMt1, sMt1, null},
+ {null, sMt1, sMt1, sMt2, sMt2, sMt1, null, sMt1, sMt1},
+ {null, sMt2, null, sMt1, sMt2, sMt1, sMt1, sMt1, sMt1},
+ {sMt1, null, null, null, sMt1, null, null, null, null},
+ {null, sMt1, null, sMt1, null, null, null, null, null},
+ {sMt1, sMt1, null, sMt2, null, sMt1, sMt2, null, null},
+ {null, sMt1, sMt1, sMt1, null, sMt2, null, null, sMt2}
+ };
+ public static List<Integer> sSingleNonBlockDamagableRecipeList_validsShapes1 = new ArrayList<Integer>(44);
+ public static boolean sSingleNonBlockDamagableRecipeList_validsShapes1_update = false;
+ public static List<Integer> sSingleNonBlockDamagableRecipeList_warntOutput = new ArrayList<Integer>(50);
+ public static List<Integer> sVanillaRecipeList_warntOutput = new ArrayList<Integer>(50);
+ public static final List<IRecipe> sSingleNonBlockDamagableRecipeList_verified = new ArrayList<IRecipe>(1000);
static {
sNativeRecipeClasses.add(ShapedRecipes.class.getName());
@@ -696,7 +752,7 @@ public class GT_ModHandler {
public static void stopBufferingCraftingRecipes() {
sBufferCraftingRecipes = false;
- for (IRecipe tRecipe : sBufferRecipeList) GameRegistry.addRecipe(tRecipe);
+ for (IRecipe tRecipe : sBufferRecipeList) {GameRegistry.addRecipe(tRecipe);}
sBufferRecipeList.clear();
}
@@ -865,8 +921,8 @@ public class GT_ModHandler {
if (aRecipe[idx] instanceof Boolean) {
idx++;
}
- HashMap<Character, ItemStack> tItemStackMap = new HashMap<Character, ItemStack>();
- HashMap<Character, ItemData> tItemDataMap = new HashMap<Character, ItemData>();
+ /*ConcurrentHash*/Map<Character, ItemStack> tItemStackMap = new /*ConcurrentHash*/HashMap<Character, ItemStack>();
+ /*ConcurrentHash*/Map<Character, ItemData> tItemDataMap = new /*ConcurrentHash*/HashMap<Character, ItemData>();
tItemStackMap.put(' ', null);
boolean tRemoveRecipe = true;
@@ -951,11 +1007,12 @@ public class GT_ModHandler {
if (aOnlyAddIfThereIsAnyRecipeOutputtingThis && !tThereWasARecipe) {
ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList();
- for (int i = 0; i < tList.size() && !tThereWasARecipe; i++) {
+ int tList_sS=tList.size();
+ for (int i = 0; i < tList_sS && !tThereWasARecipe; i++) {
IRecipe tRecipe = tList.get(i);
if (sSpecialRecipeClasses.contains(tRecipe.getClass().getName())) continue;
if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(tRecipe.getRecipeOutput()), aResult, true)) {
- tList.remove(i--);
+ tList.remove(i--); tList_sS=tList.size();
tThereWasARecipe = true;
}
}
@@ -1025,11 +1082,11 @@ public class GT_ModHandler {
} else if (tObject instanceof String) {
tRecipe[i] = GT_OreDictUnificator.getFirstOre(tObject, 1);
if (tRecipe[i] == null) break;
- } else if (tObject instanceof Boolean) {
+ }/* else if (tObject instanceof Boolean) {
//
} else {
throw new IllegalArgumentException();
- }
+ }*/
i++;
}
removeRecipe(tRecipe);
@@ -1091,18 +1148,16 @@ public class GT_ModHandler {
}, 3, 3);
for (int i = 0; i < aRecipe.length && i < 9; i++) aCrafting.setInventorySlotContents(i, aRecipe[i]);
ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList();
- for (int i = 0; i < tList.size(); i++) {
- try {
- for (; i < tList.size(); i++) {
+ int tList_sS=tList.size();
+ try {
+ for (int i = 0; i < tList_sS; i++) {
+ for (; i < tList_sS; i++) {
if ((!(tList.get(i) instanceof IGT_CraftingRecipe) || ((IGT_CraftingRecipe) tList.get(i)).isRemovable()) && tList.get(i).matches(aCrafting, DW)) {
rReturn = tList.get(i).getCraftingResult(aCrafting);
- if (rReturn != null) tList.remove(i--);
+ if (rReturn != null) tList.remove(i--); tList_sS=tList.size();
}
}
- } catch (Throwable e) {
- e.printStackTrace(GT_Log.err);
- }
- }
+ }} catch (Throwable e) {e.printStackTrace(GT_Log.err);}
return rReturn;
}
@@ -1121,7 +1176,8 @@ public class GT_ModHandler {
boolean rReturn = false;
ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList();
aOutput = GT_OreDictUnificator.get(aOutput);
- for (int i = 0; i < tList.size(); i++) {
+ int tList_sS=tList.size();
+ for (int i = 0; i < tList_sS; i++) {
IRecipe tRecipe = tList.get(i);
if (aNotRemoveShapelessRecipes && (tRecipe instanceof ShapelessRecipes || tRecipe instanceof ShapelessOreRecipe))
continue;
@@ -1132,7 +1188,7 @@ public class GT_ModHandler {
}
ItemStack tStack = tRecipe.getRecipeOutput();
if ((!(tRecipe instanceof IGT_CraftingRecipe) || ((IGT_CraftingRecipe) tRecipe).isRemovable()) && GT_Utility.areStacksEqual(GT_OreDictUnificator.get(tStack), aOutput, aIgnoreNBT)) {
- tList.remove(i--);
+ tList.remove(i--); tList_sS=tList.size();
rReturn = true;
}
}
@@ -1169,11 +1225,12 @@ public class GT_ModHandler {
sAllRecipeList.clear();
sAllRecipeList.addAll(tList);
}
- for (int i = 0, j = sAllRecipeList.size(); i < j; i++) {
+ int sAllRecipeList_sS=sAllRecipeList.size();
+ for (int i = 0, j = sAllRecipeList_sS; i < j; i++) {
IRecipe tRecipe = sAllRecipeList.get(i);
if (tRecipe.matches(aCrafting, aWorld)) {
if (i > 10) {
- sAllRecipeList.remove(i);
+ sAllRecipeList.remove(i); sAllRecipeList_sS=sAllRecipeList.size();
sAllRecipeList.add(i - 10, tRecipe);
}
return tRecipe.getCraftingResult(aCrafting);
@@ -1233,13 +1290,11 @@ public class GT_ModHandler {
}, 3, 3);
for (int i = 0; i < 9 && i < aRecipe.length; i++) aCrafting.setInventorySlotContents(i, aRecipe[i]);
ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList();
- for (int i = 0; i < tList.size(); i++) {
+ int tList_sS=tList.size();
+ try {
+ for (int i = 0; i < tList_sS; i++) {
temp = false;
- try {
- temp = tList.get(i).matches(aCrafting, DW);
- } catch (Throwable e) {
- e.printStackTrace(GT_Log.err);
- }
+ temp = tList.get(i).matches(aCrafting, DW);
if (temp) {
ItemStack tOutput = aUncopiedStack ? tList.get(i).getRecipeOutput() : tList.get(i).getCraftingResult(aCrafting);
if (tOutput == null || tOutput.stackSize <= 0) {
@@ -1251,7 +1306,7 @@ public class GT_ModHandler {
return GT_Utility.copy(tOutput);
}
}
- }
+ }} catch (Throwable e) {e.printStackTrace(GT_Log.err);}
return null;
}
@@ -1261,47 +1316,67 @@ public class GT_ModHandler {
* This also removes old Recipes from the List.
*/
public static ArrayList<ItemStack> getVanillyToolRecipeOutputs(ItemStack... aRecipe) {
- if (!GregTech_API.sPostloadStarted || GregTech_API.sPostloadFinished)
- sSingleNonBlockDamagableRecipeList.clear();
- if (sSingleNonBlockDamagableRecipeList.isEmpty()) {
+ ArrayList<ItemStack> rList = new ArrayList<ItemStack>();
+ if (aRecipe == null) {return rList;}
+ if (!GregTech_API.sPostloadStarted || GregTech_API.sPostloadFinished) {
+ sSingleNonBlockDamagableRecipeList.clear();sSingleNonBlockDamagableRecipeList_create = true;sSingleNonBlockDamagableRecipeList_validsShapes1.clear();}
+ if (sSingleNonBlockDamagableRecipeList_create/*sSingleNonBlockDamagableRecipeList.isEmpty()*/) {
for (IRecipe tRecipe : (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
ItemStack tStack = tRecipe.getRecipeOutput();
if (GT_Utility.isStackValid(tStack) && tStack.getMaxStackSize() == 1 && tStack.getMaxDamage() > 0 && !(tStack.getItem() instanceof ItemBlock) && !(tStack.getItem() instanceof IReactorComponent) && !isElectricItem(tStack) && !GT_Utility.isStackInList(tStack, sNonReplaceableItems)) {
- if (!(tRecipe instanceof ShapelessRecipes || tRecipe instanceof ShapelessOreRecipe)) {
- if (tRecipe instanceof ShapedOreRecipe) {
- boolean temp = true;
- for (Object tObject : ((ShapedOreRecipe) tRecipe).getInput())
- if (tObject != null) {
- if (tObject instanceof ItemStack && (((ItemStack) tObject).getItem() == null || ((ItemStack) tObject).getMaxStackSize() < 2 || ((ItemStack) tObject).getMaxDamage() > 0 || ((ItemStack) tObject).getItem() instanceof ItemBlock)) {
- temp = false;
- break;
- }
- if (tObject instanceof List && ((List) tObject).isEmpty()) {
- temp = false;
- break;
- }
+ if (tRecipe instanceof ShapedOreRecipe) {
+ boolean temp = true;
+ for (Object tObject : ((ShapedOreRecipe) tRecipe).getInput()) {
+ if (tObject != null) {
+ if (tObject instanceof ItemStack && (((ItemStack) tObject).getItem() == null || ((ItemStack) tObject).getMaxStackSize() < 2 || ((ItemStack) tObject).getMaxDamage() > 0 || ((ItemStack) tObject).getItem() instanceof ItemBlock)) {
+ temp = false;
+ break;
}
- if (temp) sSingleNonBlockDamagableRecipeList.add(tRecipe);
- } else if (tRecipe instanceof ShapedRecipes) {
- boolean temp = true;
- for (ItemStack tObject : ((ShapedRecipes) tRecipe).recipeItems) {
- if (tObject != null && (tObject.getItem() == null || tObject.getMaxStackSize() < 2 || tObject.getMaxDamage() > 0 || tObject.getItem() instanceof ItemBlock)) {
+ if (tObject instanceof List && ((List) tObject).isEmpty()) {
temp = false;
break;
}
}
- if (temp) sSingleNonBlockDamagableRecipeList.add(tRecipe);
- } else {
- sSingleNonBlockDamagableRecipeList.add(tRecipe);
}
+ if (temp) {sSingleNonBlockDamagableRecipeList.add(tRecipe);}
+ } else if (tRecipe instanceof ShapedRecipes) {
+ boolean temp = true;
+ for (ItemStack tObject : ((ShapedRecipes) tRecipe).recipeItems) {
+ if (tObject != null && (tObject.getItem() == null || tObject.getMaxStackSize() < 2 || tObject.getMaxDamage() > 0 || tObject.getItem() instanceof ItemBlock)) {
+ temp = false;
+ break;
+ }
+ }
+ if (temp) {sSingleNonBlockDamagableRecipeList.add(tRecipe);}
+ } else {
+ sSingleNonBlockDamagableRecipeList.add(tRecipe);
}
}
}
GT_Log.out.println("GT_Mod: Created a List of Tool Recipes containing " + sSingleNonBlockDamagableRecipeList.size() + " Recipes for recycling." + (sSingleNonBlockDamagableRecipeList.size() > 1024 ? " Scanning all these Recipes is the reason for the startup Lag you receive right now." : E));
+ int aList_move = sSingleNonBlockDamagableRecipeList.size();
+ sSingleNonBlockDamagableRecipeList_list.add(aList_move);
+ sSingleNonBlockDamagableRecipeList_create = false;
+ sSingleNonBlockDamagableRecipeList_validsShapes1_update = true;
+ InventoryCrafting aCrafting = new InventoryCrafting(new Container() {
+ @Override
+ public boolean canInteractWith(EntityPlayer var1) {return false;}}, 3, 3);
+ for (int i = 0; i < aList_move; i++) {
+ for (int j = 0; j < sShapes1.length; j++) {
+ ItemStack[] sRecipe = sShapes1[j];
+ for (int l = 0; l < 9 && l < sRecipe.length; l++) {aCrafting.setInventorySlotContents(l, sRecipe[l]);}
+ IRecipe vRecipe = sSingleNonBlockDamagableRecipeList.get(i);
+ if (vRecipe.matches(aCrafting, DW)) {
+ if (!(sSingleNonBlockDamagableRecipeList_validsShapes1.contains(j))) {sSingleNonBlockDamagableRecipeList_validsShapes1.add(j);}
+ sSingleNonBlockDamagableRecipeList_verified.add(vRecipe);
+ }
+ }
+ }
}
- ArrayList<ItemStack> rList = getRecipeOutputs(sSingleNonBlockDamagableRecipeList, true, aRecipe);
- if (!GregTech_API.sPostloadStarted || GregTech_API.sPostloadFinished)
- sSingleNonBlockDamagableRecipeList.clear();
+ /*ArrayList<ItemStack> */
+ if (sSingleNonBlockDamagableRecipeList_verified.size() != 0) {rList = getRecipeOutputs(sSingleNonBlockDamagableRecipeList_verified, true, aRecipe);}
+ if (!GregTech_API.sPostloadStarted || GregTech_API.sPostloadFinished) {
+ sSingleNonBlockDamagableRecipeList.clear();sSingleNonBlockDamagableRecipeList_create = true;sSingleNonBlockDamagableRecipeList_validsShapes1.clear();}
return rList;
}
@@ -1319,7 +1394,7 @@ public class GT_ModHandler {
*/
public static ArrayList<ItemStack> getRecipeOutputs(List<IRecipe> aList, boolean aDeleteFromList, ItemStack... aRecipe) {
ArrayList<ItemStack> rList = new ArrayList<ItemStack>();
- if (aRecipe == null) return rList;
+ if (aRecipe == null || aList.size() == 0) {return rList;}
boolean temp = false;
for (byte i = 0; i < aRecipe.length; i++) {
if (aRecipe[i] != null) {
@@ -1327,32 +1402,50 @@ public class GT_ModHandler {
break;
}
}
- if (!temp) return rList;
+ if (!temp) {return rList;}
InventoryCrafting aCrafting = new InventoryCrafting(new Container() {
@Override
public boolean canInteractWith(EntityPlayer var1) {
return false;
}
}, 3, 3);
- for (int i = 0; i < 9 && i < aRecipe.length; i++) aCrafting.setInventorySlotContents(i, aRecipe[i]);
- for (int i = 0; i < aList.size(); i++) {
- temp = false;
- try {
- temp = aList.get(i).matches(aCrafting, DW);
- } catch (Throwable e) {
- e.printStackTrace(GT_Log.err);
+ for (int i = 0; i < 9 && i < aRecipe.length; i++) {aCrafting.setInventorySlotContents(i, aRecipe[i]);}
+ int aList_sS=aList.size();
+ ArrayList<Integer> tempaList_list = new ArrayList<Integer>();
+ if(!aDeleteFromList) {
+ for (int i = 0; i < aList_sS; i++) {
+ IRecipe tempALg0 = aList.get(i);
+ if (tempALg0.matches(aCrafting, DW)) {
+ ItemStack tOutput = tempALg0.getCraftingResult(aCrafting);
+ if (tOutput == null || tOutput.stackSize <= 0) {
+ if (!(sVanillaRecipeList_warntOutput.contains(i))) {sVanillaRecipeList_warntOutput.add(i);}
+ } else {
+ rList.add(GT_Utility.copy(tOutput));
+ if (aDeleteFromList) {tempaList_list.add(i);}
+ }
+ }
}
- if (temp) {
- ItemStack tOutput = aList.get(i).getCraftingResult(aCrafting);
+ } else {
+ for (int i = 0; i < aList_sS; i++) {
+ IRecipe tempALg0 = aList.get(i);
+ ItemStack tOutput = tempALg0.getCraftingResult(aCrafting);
if (tOutput == null || tOutput.stackSize <= 0) {
- // Seriously, who would ever do that shit?
- if (!GregTech_API.sPostloadFinished)
- throw new GT_ItsNotMyFaultException("Seems another Mod added a Crafting Recipe with null Output. Tell the Developer of said Mod to fix that.");
+ if (!(sSingleNonBlockDamagableRecipeList_warntOutput.contains(i))) {sSingleNonBlockDamagableRecipeList_warntOutput.add(i);}
} else {
rList.add(GT_Utility.copy(tOutput));
- if (aDeleteFromList) aList.remove(i--);
+ if (aDeleteFromList) {tempaList_list.add(i);}
+ }
}
}
+ //boolean tempaList_list_b = tempaList_list.size() != 0 ? true : false;
+ if (aDeleteFromList && tempaList_list.size() != 0) {
+ List<IRecipe> tempaList_2 = new ArrayList<IRecipe>();
+ for (int i = 0; i < aList_sS; i++) {
+ int k = 0, l = 0;
+ if (tempaList_list.get(k) == i) {k++;continue;}
+ tempaList_2.add(aList.get(l));l++;
+ }
+ aList = tempaList_2;
}
return rList;
}
diff --git a/src/main/java/gregtech/api/util/GT_OreDictUnificator.java b/src/main/java/gregtech/api/util/GT_OreDictUnificator.java
index b404299fad..dddf2ec576 100644
--- a/src/main/java/gregtech/api/util/GT_OreDictUnificator.java
+++ b/src/main/java/gregtech/api/util/GT_OreDictUnificator.java
@@ -15,6 +15,7 @@ import net.minecraftforge.oredict.OreDictionary;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Map;
import java.util.Map.Entry;
import static gregtech.api.enums.GT_Values.*;
@@ -29,8 +30,8 @@ import static gregtech.api.enums.GT_Values.*;
* P.S. It is intended to be named "Unificator" and not "Unifier", because that sounds more awesome.
*/
public class GT_OreDictUnificator {
- private static final HashMap<String, ItemStack> sName2StackMap = new HashMap<String, ItemStack>();
- private static final HashMap<GT_ItemStack, ItemData> sItemStack2DataMap = new HashMap<GT_ItemStack, ItemData>();
+ private static final /*ConcurrentHash*/Map<String, ItemStack> sName2StackMap = new /*ConcurrentHash*/HashMap<String, ItemStack>();
+ private static final /*ConcurrentHash*/Map<GT_ItemStack, ItemData> sItemStack2DataMap = new /*ConcurrentHash*/HashMap<GT_ItemStack, ItemData>();
private static final GT_HashSet<GT_ItemStack> sNoUnificationList = new GT_HashSet<GT_ItemStack>();
public static volatile int VERSION = 509;
private static int isRegisteringOre = 0, isAddingOre = 0;
diff --git a/src/main/java/gregtech/api/util/GT_PlayedSound.java b/src/main/java/gregtech/api/util/GT_PlayedSound.java
index 858f3b826e..136171f7b7 100644
--- a/src/main/java/gregtech/api/util/GT_PlayedSound.java
+++ b/src/main/java/gregtech/api/util/GT_PlayedSound.java
@@ -15,7 +15,7 @@ public class GT_PlayedSound {
@Override
public boolean equals(Object aObject) {
- if (aObject != null && aObject instanceof GT_PlayedSound) {
+ if (aObject instanceof GT_PlayedSound) {
return ((GT_PlayedSound) aObject).mX == mX && ((GT_PlayedSound) aObject).mY == mY && ((GT_PlayedSound) aObject).mZ == mZ && ((GT_PlayedSound) aObject).mSoundName.equals(mSoundName);
}
return false;
diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java
index 3d45dee234..fc3b600d07 100644
--- a/src/main/java/gregtech/api/util/GT_Recipe.java
+++ b/src/main/java/gregtech/api/util/GT_Recipe.java
@@ -514,11 +514,11 @@ public class GT_Recipe {
/**
* HashMap of Recipes based on their Items
*/
- public final Map<GT_ItemStack, Collection<GT_Recipe>> mRecipeItemMap = new HashMap<GT_ItemStack, Collection<GT_Recipe>>();
+ public final Map<GT_ItemStack, Collection<GT_Recipe>> mRecipeItemMap = new /*Concurrent*/HashMap<GT_ItemStack, Collection<GT_Recipe>>();
/**
* HashMap of Recipes based on their Fluids
*/
- public final Map<Fluid, Collection<GT_Recipe>> mRecipeFluidMap = new HashMap<Fluid, Collection<GT_Recipe>>();
+ public final Map<Fluid, Collection<GT_Recipe>> mRecipeFluidMap = new /*Concurrent*/HashMap<Fluid, Collection<GT_Recipe>>();
/**
* The List of all Recipes
*/
diff --git a/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java b/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java
index 611c8d34e2..27d3aed199 100644
--- a/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java
+++ b/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java
@@ -121,6 +121,8 @@ public class GT_RecipeRegistrator {
{"Scythe", s_H + s_P + s_I, s_P + s_F + s_R, " " + " " + s_R}
};
public static volatile int VERSION = 509;
+ public static int sRodMaterialList_cycles = 0;
+ private static int i_count = 0;
public static void registerMaterialRecycling(ItemStack aStack, Materials aMaterial, long aMaterialAmount, MaterialStack aByproduct) {
if (GT_Utility.isStackInvalid(aStack)) return;
@@ -272,7 +274,7 @@ public class GT_RecipeRegistrator {
* You give this Function a Material and it will scan almost everything for adding recycling Recipes
*
* @param aMat a Material, for example an Ingot or a Gem.
- * @param aOutput the Dust you usually get from macerating aMat
+ * @param aPlate the Dust you usually get from macerating aMat
* @param aRecipeReplacing allows to replace the Recipe with a Plate variant
*/
public static synchronized void registerUsagesForMaterials(ItemStack aMat, String aPlate, boolean aRecipeReplacing) {
@@ -280,8 +282,11 @@ public class GT_RecipeRegistrator {
aMat = GT_Utility.copy(aMat);
ItemStack tStack;
ItemData aItemData = GT_OreDictUnificator.getItemData(aMat);
- if (aItemData == null || aItemData.mPrefix != OrePrefixes.ingot) aPlate = null;
+ boolean aItemData_b_0 = aItemData != null ? true : false;
+ if (!aItemData_b_0 || aItemData.mPrefix != OrePrefixes.ingot) {aPlate = null;}
if (aPlate != null && GT_OreDictUnificator.getFirstOre(aPlate, 1) == null) aPlate = null;
+ boolean aItemData_b_1 = aItemData.hasValidPrefixMaterialData() ? true : false;
+ boolean aPlate_b_0 = aPlate != null ? true : false;
sMt1.func_150996_a(aMat.getItem());
sMt1.stackSize = 1;
@@ -296,12 +301,13 @@ public class GT_RecipeRegistrator {
for (ItemStack tMat : tRecipe) {
if (tMat == sMt1) tAmount1++;
}
- if (aItemData != null && aItemData.hasValidPrefixMaterialData())
+ if (aItemData_b_0 && aItemData_b_1)
for (ItemStack tCrafted : GT_ModHandler.getRecipeOutputs(tRecipe)) {
GT_OreDictUnificator.addItemData(tCrafted, new ItemData(aItemData.mMaterial.mMaterial, aItemData.mMaterial.mAmount * tAmount1));
}
}
+ GT_ModHandler.getVanillyToolRecipeOutputs(sShapes1[0]);
for (Materials tMaterial : sRodMaterialList) {
ItemStack tMt2 = GT_OreDictUnificator.get(OrePrefixes.stick, tMaterial, 1);
if (tMt2 != null) {
@@ -309,37 +315,48 @@ public class GT_RecipeRegistrator {
sMt2.stackSize = 1;
Items.feather.setDamage(sMt2, Items.feather.getDamage(tMt2));
- for (int i = 0; i < sShapes1.length; i++) {
- ItemStack[] tRecipe = sShapes1[i];
+ if (GT_ModHandler.sSingleNonBlockDamagableRecipeList.size() == 0 || GT_ModHandler.sSingleNonBlockDamagableRecipeList_validsShapes1.size() == 0 || GT_ModHandler.sSingleNonBlockDamagableRecipeList_verified.size() == 0) { sRodMaterialList_cycles++;continue;}
+ int sShapes1_len = GT_ModHandler.sSingleNonBlockDamagableRecipeList_validsShapes1.size();
+ for (int i = 0; i < sShapes1_len; i++) {
+ int i2 = GT_ModHandler.sSingleNonBlockDamagableRecipeList_validsShapes1.get(i);
+ ItemStack[] tRecipe = sShapes1[i2];
+ if (tRecipe == null) continue;
int tAmount1 = 0, tAmount2 = 0;
for (ItemStack tMat : tRecipe) {
if (tMat == sMt1) tAmount1++;
if (tMat == sMt2) tAmount2++;
}
- for (ItemStack tCrafted : GT_ModHandler.getVanillyToolRecipeOutputs(tRecipe)) {
- if (aItemData != null && aItemData.hasValidPrefixMaterialData())
- GT_OreDictUnificator.addItemData(tCrafted, new ItemData(aItemData.mMaterial.mMaterial, aItemData.mMaterial.mAmount * tAmount1, new MaterialStack(tMaterial, OrePrefixes.stick.mMaterialAmount * tAmount2)));
-
- if (aRecipeReplacing && aPlate != null && sShapesA[i] != null && sShapesA[i].length > 1) {
- assert aItemData != null;
- if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.recipereplacements, aItemData.mMaterial.mMaterial + "." + sShapesA[i][0], true)) {
- if (null != (tStack = GT_ModHandler.removeRecipe(tRecipe))) {
- switch (sShapesA[i].length) {
- case 2:
- GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[]{sShapesA[i][1], s_P.charAt(0), aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), aItemData});
- break;
- case 3:
- GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[]{sShapesA[i][1], sShapesA[i][2], s_P.charAt(0), aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), aItemData});
- break;
- default:
- GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[]{sShapesA[i][1], sShapesA[i][2], sShapesA[i][3], s_P.charAt(0), aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), aItemData});
- break;
+ List<ItemStack> tempTest = GT_ModHandler.getVanillyToolRecipeOutputs(tRecipe);
+ if (GT_ModHandler.sSingleNonBlockDamagableRecipeList_validsShapes1_update && GT_ModHandler.sSingleNonBlockDamagableRecipeList_validsShapes1.size() != 0) {sShapes1_len = GT_ModHandler.sSingleNonBlockDamagableRecipeList_validsShapes1.size();GT_ModHandler.sSingleNonBlockDamagableRecipeList_validsShapes1_update = false;}
+ int tempTest_size_sS = tempTest.size();
+ if (tempTest_size_sS > 0) {
+ for (ItemStack tCrafted : tempTest/*GT_ModHandler.getVanillyToolRecipeOutputs(tRecipe)*/) {
+ if (aItemData_b_0 && aItemData_b_1) {
+ GT_OreDictUnificator.addItemData(tCrafted, new ItemData(aItemData.mMaterial.mMaterial, aItemData.mMaterial.mAmount * tAmount1, new MaterialStack(tMaterial, OrePrefixes.stick.mMaterialAmount * tAmount2)));
+ }
+
+ if (aRecipeReplacing && aPlate_b_0 && sShapesA[i2] != null && sShapesA[i2].length > 1) {
+ //assert aItemData != null;//dead dev code or decomp JAD?
+ if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.recipereplacements, new StringBuilder().append(aItemData.mMaterial.mMaterial).append('.').append(sShapesA[i2][0]).toString(), true)) {
+ if (null != (tStack = GT_ModHandler.removeRecipe(tRecipe))) {
+ switch (sShapesA[i].length) {
+ case 2:
+ GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[]{sShapesA[i2][1], s_P.charAt(0), aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), aItemData});
+ break;
+ case 3:
+ GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[]{sShapesA[i2][1], sShapesA[i2][2], s_P.charAt(0), aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), aItemData});
+ break;
+ default:
+ GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[]{sShapesA[i2][1], sShapesA[i2][2], sShapesA[i2][3], s_P.charAt(0), aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), aItemData});
+ break;
+ }
}
}
}
}
}
+ sRodMaterialList_cycles++;
}
}
}
diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java
index 571715907f..cfd0b4b880 100644
--- a/src/main/java/gregtech/api/util/GT_Utility.java
+++ b/src/main/java/gregtech/api/util/GT_Utility.java
@@ -20,7 +20,6 @@ import gregtech.api.objects.GT_ItemStack;
import gregtech.api.objects.ItemData;
import gregtech.api.threads.GT_Runnable_Sound;
import gregtech.common.GT_Proxy;
-import ic2.api.recipe.ICannerBottleRecipeManager;
import ic2.api.recipe.IRecipeInput;
import ic2.api.recipe.RecipeInputItemStack;
import ic2.api.recipe.RecipeInputOreDict;
@@ -84,11 +83,11 @@ public class GT_Utility {
* Forge screwed the Fluid Registry up again, so I make my own, which is also much more efficient than the stupid Stuff over there.
*/
private static final List<FluidContainerData> sFluidContainerList = new ArrayList<FluidContainerData>();
- private static final Map<GT_ItemStack, FluidContainerData> sFilledContainerToData = new HashMap<GT_ItemStack, FluidContainerData>();
- private static final Map<GT_ItemStack, Map<Fluid, FluidContainerData>> sEmptyContainerToFluidToData = new HashMap<GT_ItemStack, Map<Fluid, FluidContainerData>>();
+ private static final Map<GT_ItemStack, FluidContainerData> sFilledContainerToData = new /*Concurrent*/HashMap<GT_ItemStack, FluidContainerData>();
+ private static final Map<GT_ItemStack, Map<Fluid, FluidContainerData>> sEmptyContainerToFluidToData = new /*Concurrent*/HashMap<GT_ItemStack, Map<Fluid, FluidContainerData>>();
public static volatile int VERSION = 509;
public static boolean TE_CHECK = false, BC_CHECK = false, CHECK_ALL = true, RF_CHECK = false;
- public static Map<GT_PlayedSound, Integer> sPlayedSoundMap = new HashMap<GT_PlayedSound, Integer>();
+ public static Map<GT_PlayedSound, Integer> sPlayedSoundMap = new /*Concurrent*/HashMap<GT_PlayedSound, Integer>();
private static int sBookCount = 0;
static {
@@ -329,7 +328,7 @@ public class GT_Utility {
}
public static void sendChatToPlayer(EntityPlayer aPlayer, String aChatMessage) {
- if (aPlayer != null && aPlayer instanceof EntityPlayerMP && aChatMessage != null) {
+ if (aPlayer instanceof EntityPlayerMP && aChatMessage != null) {
aPlayer.addChatComponentMessage(new ChatComponentText(aChatMessage));
}
}
@@ -510,7 +509,7 @@ public class GT_Utility {
* @return the Amount of moved Items
*/
public static byte moveOneItemStack(Object aTileEntity1, Object aTileEntity2, byte aGrabFrom, byte aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce) {
- if (aTileEntity1 != null && aTileEntity1 instanceof IInventory)
+ if (aTileEntity1 instanceof IInventory)
return moveOneItemStack((IInventory) aTileEntity1, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, true);
return 0;
}
@@ -607,7 +606,7 @@ public class GT_Utility {
for (int i = 0; i < tGrabSlots.length; i++) tGrabSlots[i] = i;
}
- if (aTileEntity2 != null && aTileEntity2 instanceof IInventory) {
+ if (aTileEntity2 instanceof IInventory) {
for (int i = 0; i < tGrabSlots.length; i++) {
if (listContainsItem(aFilter, ((IInventory) aTileEntity1).getStackInSlot(tGrabSlots[i]), true, aInvertFilter)) {
if (isAllowedToTakeFromSlot((IInventory) aTileEntity1, tGrabSlots[i], aGrabFrom, ((IInventory) aTileEntity1).getStackInSlot(tGrabSlots[i]))) {
@@ -707,7 +706,7 @@ public class GT_Utility {
sFilledContainerToData.put(new GT_ItemStack(tData.filledContainer), tData);
Map<Fluid, FluidContainerData> tFluidToContainer = sEmptyContainerToFluidToData.get(new GT_ItemStack(tData.emptyContainer));
if (tFluidToContainer == null) {
- sEmptyContainerToFluidToData.put(new GT_ItemStack(tData.emptyContainer), tFluidToContainer = new HashMap<Fluid, FluidContainerData>());
+ sEmptyContainerToFluidToData.put(new GT_ItemStack(tData.emptyContainer), tFluidToContainer = new /*Concurrent*/HashMap<Fluid, FluidContainerData>());
GregTech_API.sFluidMappings.add(tFluidToContainer);
}
tFluidToContainer.put(tData.fluid.getFluid(), tData);
@@ -719,7 +718,7 @@ public class GT_Utility {
sFilledContainerToData.put(new GT_ItemStack(aData.filledContainer), aData);
Map<Fluid, FluidContainerData> tFluidToContainer = sEmptyContainerToFluidToData.get(new GT_ItemStack(aData.emptyContainer));
if (tFluidToContainer == null) {
- sEmptyContainerToFluidToData.put(new GT_ItemStack(aData.emptyContainer), tFluidToContainer = new HashMap<Fluid, FluidContainerData>());
+ sEmptyContainerToFluidToData.put(new GT_ItemStack(aData.emptyContainer), tFluidToContainer = new /*Concurrent*/HashMap<Fluid, FluidContainerData>());
GregTech_API.sFluidMappings.add(tFluidToContainer);
}
tFluidToContainer.put(aData.fluid.getFluid(), aData);
@@ -1020,7 +1019,7 @@ public class GT_Utility {
}
public static boolean isBlockValid(Object aBlock) {
- return aBlock != null && (aBlock instanceof Block);
+ return (aBlock instanceof Block);
}
public static boolean isBlockInvalid(Object aBlock) {
@@ -1036,7 +1035,7 @@ public class GT_Utility {
}
public static boolean isStackValid(Object aStack) {
- return aStack != null && (aStack instanceof ItemStack) && ((ItemStack) aStack).getItem() != null && ((ItemStack) aStack).stackSize >= 0;
+ return (aStack instanceof ItemStack) && ((ItemStack) aStack).getItem() != null && ((ItemStack) aStack).stackSize >= 0;
}
public static boolean isStackInvalid(Object aStack) {
@@ -1408,7 +1407,7 @@ public class GT_Utility {
* re-maps all Keys of a Map after the Keys were weakened.
*/
public static <X, Y> Map<X, Y> reMap(Map<X, Y> aMap) {
- Map<X, Y> tMap = new HashMap<X, Y>();
+ Map<X, Y> tMap = new /*Concurrent*/HashMap<X, Y>();
tMap.putAll(aMap);
aMap.clear();
aMap.putAll(tMap);
@@ -1561,15 +1560,17 @@ public class GT_Utility {
}
int tAmount = (int) (Math.pow(amount, 5) / 100);
ChunkPosition tPos = new ChunkPosition(aX/16, 1, aZ/16);
+ int[] tInts = new int[2];
if(GT_Proxy.chunkData.containsKey(tPos)){
- int[] tInts = GT_Proxy.chunkData.get(tPos);
+ tInts = GT_Proxy.chunkData.get(tPos);
if(tInts.length>0){
if(tInts[0]>=0){tAmount = tInts[0];}
}
GT_Proxy.chunkData.remove(tPos);
}
tAmount = tAmount - 5;
- GT_Proxy.chunkData.put(tPos, new int[]{tAmount});
+ tInts[0] = tAmount;
+ GT_Proxy.chunkData.put(tPos, tInts);
return new FluidStack(tFluid, tAmount);
}
@@ -1584,7 +1585,7 @@ public class GT_Utility {
Block tBlock = aWorld.getBlock(aX, aY, aZ);
- tList.add("----- X: " +EnumChatFormatting.AQUA+ aX+EnumChatFormatting.RESET + " Y: " +EnumChatFormatting.AQUA+ aY +EnumChatFormatting.RESET+ " Z: " +EnumChatFormatting.AQUA+ aZ +EnumChatFormatting.RESET+ " -----");
+ tList.add("----- X: " +EnumChatFormatting.AQUA+ aX +EnumChatFormatting.RESET + " Y: " +EnumChatFormatting.AQUA+ aY +EnumChatFormatting.RESET+ " Z: " +EnumChatFormatting.AQUA+ aZ +EnumChatFormatting.RESET+ " -----");
try {
if (tTileEntity != null && tTileEntity instanceof IInventory)
tList.add("Name: " + EnumChatFormatting.BLUE+ ((IInventory) tTileEntity).getInventoryName()+EnumChatFormatting.RESET + " MetaData: " +EnumChatFormatting.AQUA+ aWorld.getBlockMetadata(aX, aY, aZ)+EnumChatFormatting.RESET);
@@ -1690,7 +1691,7 @@ public class GT_Utility {
rEUAmount += 400;
int tValue = 0;
if (0 < (tValue = ((IMachineProgress) tTileEntity).getMaxProgress()))
- tList.add("Progress: " +EnumChatFormatting.GREEN+GT_Utility.formatNumbers(((IMachineProgress) tTileEntity).getProgress()) +EnumChatFormatting.RESET+ " ticks / " +EnumChatFormatting.YELLOW+GT_Utility.formatNumbers(tValue) +EnumChatFormatting.RESET+" ticks");
+ tList.add("Progress: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(((IMachineProgress) tTileEntity).getProgress()/20) +EnumChatFormatting.RESET+ " s / " +EnumChatFormatting.YELLOW+GT_Utility.formatNumbers(tValue/20) +EnumChatFormatting.RESET+" s");
}
} catch (Throwable e) {
if (D1) e.printStackTrace(GT_Log.err);
@@ -2010,16 +2011,14 @@ public class GT_Utility {
if (aStack != null) {
NBTTagList nbttaglist = aStack.getEnchantmentTagList();
if (nbttaglist != null) {
- for (int i = 0; i < nbttaglist.tagCount(); ++i) {
- try {
+ try {
+ for (int i = 0; i < nbttaglist.tagCount(); ++i) {
short short1 = nbttaglist.getCompoundTagAt(i).getShort("id");
short short2 = nbttaglist.getCompoundTagAt(i).getShort("lvl");
if (Enchantment.enchantmentsList[short1] != null)
aBullshitModifier.calculateModifier(Enchantment.enchantmentsList[short1], short2);
- } catch (Throwable e) {
- //
}
- }
+ } catch (Throwable e) {/**/}
}
}
}
diff --git a/src/main/java/gregtech/api/world/GT_Worldgen.java b/src/main/java/gregtech/api/world/GT_Worldgen.java
index e41e2abefe..e464c475f1 100644
--- a/src/main/java/gregtech/api/world/GT_Worldgen.java
+++ b/src/main/java/gregtech/api/world/GT_Worldgen.java
@@ -4,16 +4,16 @@ import gregtech.api.GregTech_API;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
+import java.util.concurrent.ConcurrentHashMap;
public abstract class GT_Worldgen {
public final String mWorldGenName;
public final boolean mEnabled;
- private final Map<String, Boolean> mDimensionMap = new HashMap<String, Boolean>();
+ private final Map<String, Boolean> mDimensionMap = new ConcurrentHashMap<String, Boolean>();
public GT_Worldgen(String aName, List aList, boolean aDefault) {
mWorldGenName = aName;
diff --git a/src/main/java/gregtech/api/world/GT_Worldgen_Boulder.java b/src/main/java/gregtech/api/world/GT_Worldgen_Boulder.java
index 0f54796d72..22bf17aa93 100644
--- a/src/main/java/gregtech/api/world/GT_Worldgen_Boulder.java
+++ b/src/main/java/gregtech/api/world/GT_Worldgen_Boulder.java
@@ -21,38 +21,44 @@ public class GT_Worldgen_Boulder extends GT_Worldgen_Ore {
int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), tZ = aChunkZ + aRandom.nextInt(16);
Block tBlock = aWorld.getBlock(tX, tY - 7, tZ);
if (tBlock != null && tBlock.isOpaqueCube() && aWorld.getBlock(tX, tY - 6, tZ).isAir(aWorld, tX, tY - 6, tZ)) {
- float var6 = aRandom.nextFloat() * (float) Math.PI;
- double var7 = ((tX + 8) + MathHelper.sin(var6) * mSize / 8.0F);
- double var9 = ((tX + 8) - MathHelper.sin(var6) * mSize / 8.0F);
- double var11 = ((tZ + 8) + MathHelper.cos(var6) * mSize / 8.0F);
- double var13 = ((tZ + 8) - MathHelper.cos(var6) * mSize / 8.0F);
- double var15 = (tY + aRandom.nextInt(3) - 2);
- double var17 = (tY + aRandom.nextInt(3) - 2);
+ float math_pi = 3.141593F;
+ float var6 = aRandom.nextFloat() * math_pi;
+ float var1b = mSize / 8.0F;
+ float var3b = MathHelper.sin(var6) * var1b; float var4b = MathHelper.cos(var6) * var1b;
+ float var8b = -2*var3b;float var9b = -2*var4b;
+ int var10b = (tX + 8);int var11b = (tZ + 8);
+ float var7 = (var10b + var3b);
+ float var11 = (var11b + var4b);
+ int var5b = aRandom.nextInt(3);int var6b = aRandom.nextInt(3);int var7b = var6b - var5b;
+ float var15 = (tY + var5b - 2);
+ float var12b = math_pi / mSize;
for (int var19 = 0; var19 <= mSize; ++var19) {
- double var20 = var7 + (var9 - var7) * var19 / mSize;
- double var22 = var15 + (var17 - var15) * var19 / mSize;
- double var24 = var11 + (var13 - var11) * var19 / mSize;
- double var26 = aRandom.nextDouble() * mSize / 16.0D;
- double var28 = (MathHelper.sin(var19 * (float) Math.PI / mSize) + 1.0F) * var26 + 1.0D;
- double var30 = (MathHelper.sin(var19 * (float) Math.PI / mSize) + 1.0F) * var26 + 1.0D;
- int var32 = MathHelper.floor_double(var20 - var28 / 2.0D);
- int var33 = MathHelper.floor_double(var22 - var30 / 2.0D);
- int var34 = MathHelper.floor_double(var24 - var28 / 2.0D);
- int var35 = MathHelper.floor_double(var20 + var28 / 2.0D);
- int var36 = MathHelper.floor_double(var22 + var30 / 2.0D);
- int var37 = MathHelper.floor_double(var24 + var28 / 2.0D);
+ float var2b = var19 / mSize;
+ float var20 = var7 + var8b * var2b;
+ float var22 = var15 + var7b * var2b;
+ float var24 = var11 + var9b * var2b;
+ float var26 = aRandom.nextFloat() * mSize / 16.0F;
+ float var28 = ((MathHelper.sin(var19 * var12b) + 1.0F) * var26 + 1.0F) / 2.0F;
+ int var32 = MathHelper.floor_float(var20 - var28);
+ int var33 = MathHelper.floor_float(var22 - var28);
+ int var34 = MathHelper.floor_float(var24 - var28);
+ int var35 = MathHelper.floor_float(var20 + var28);
+ int var36 = MathHelper.floor_float(var22 + var28);
+ int var37 = MathHelper.floor_float(var24 + var28);
for (int var38 = var32; var38 <= var35; ++var38) {
- double var39 = (var38 + 0.5D - var20) / (var28 / 2.0D);
- if (var39 * var39 < 1.0D) {
+ float var39 = (var38 + 0.5F - var20) / (var28);
+ float var13b = var39 * var39;
+ if (var13b < 1.0F) {
for (int var41 = var33; var41 <= var36; ++var41) {
- double var42 = (var41 + 0.5D - var22) / (var30 / 2.0D);
- if (var39 * var39 + var42 * var42 < 1.0D) {
+ float var42 = (var41 + 0.5F - var22) / (var28);
+ float var14b = var13b + var42 * var42;
+ if (var14b < 1.0F) {
for (int var44 = var34; var44 <= var37; ++var44) {
- double var45 = (var44 + 0.5D - var24) / (var28 / 2.0D);
+ float var45 = (var44 + 0.5F - var24) / (var28);
Block block = aWorld.getBlock(var38, var41, var44);
- if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && ((mAllowToGenerateinVoid && aWorld.getBlock(var38, var41, var44).isAir(aWorld, var38, var41, var44)) || (block != null && !(block instanceof BlockContainer)))) {
+ if (var14b + var45 * var45 < 1.0F && ((mAllowToGenerateinVoid && aWorld.getBlock(var38, var41, var44).isAir(aWorld, var38, var41, var44)) || (block != null && !(block instanceof BlockContainer)))) {
aWorld.setBlock(var38, var41, var44, mBlock, mBlockMeta, 0);
}
}
diff --git a/src/main/java/gregtech/api/world/GT_Worldgen_Ore.java b/src/main/java/gregtech/api/world/GT_Worldgen_Ore.java
index bdba08bfb2..e8d16526c1 100644
--- a/src/main/java/gregtech/api/world/GT_Worldgen_Ore.java
+++ b/src/main/java/gregtech/api/world/GT_Worldgen_Ore.java
@@ -11,17 +11,18 @@ public abstract class GT_Worldgen_Ore extends GT_Worldgen {
public final Block mBlock;
public final Collection<String> mBiomeList;
public final boolean mAllowToGenerateinVoid;
+ private final String aTextWorldgen = "worldgen.";
public GT_Worldgen_Ore(String aName, boolean aDefault, Block aBlock, int aBlockMeta, int aDimensionType, int aAmount, int aSize, int aProbability, int aMinY, int aMaxY, Collection<String> aBiomeList, boolean aAllowToGenerateinVoid) {
super(aName, GregTech_API.sWorldgenList, aDefault);
mDimensionType = aDimensionType;
mBlock = aBlock;
mBlockMeta = Math.min(Math.max(aBlockMeta, 0), 15);
- mProbability = GregTech_API.sWorldgenFile.get("worldgen." + mWorldGenName, "Probability", aProbability);
- mAmount = GregTech_API.sWorldgenFile.get("worldgen." + mWorldGenName, "Amount", aAmount);
- mSize = GregTech_API.sWorldgenFile.get("worldgen." + mWorldGenName, "Size", aSize);
- mMinY = GregTech_API.sWorldgenFile.get("worldgen." + mWorldGenName, "MinHeight", aMinY);
- mMaxY = GregTech_API.sWorldgenFile.get("worldgen." + mWorldGenName, "MaxHeight", aMaxY);
+ mProbability = GregTech_API.sWorldgenFile.get(aTextWorldgen + mWorldGenName, "Probability", aProbability);
+ mAmount = GregTech_API.sWorldgenFile.get(aTextWorldgen + mWorldGenName, "Amount", aAmount);
+ mSize = GregTech_API.sWorldgenFile.get(aTextWorldgen + mWorldGenName, "Size", aSize);
+ mMinY = GregTech_API.sWorldgenFile.get(aTextWorldgen + mWorldGenName, "MinHeight", aMinY);
+ mMaxY = GregTech_API.sWorldgenFile.get(aTextWorldgen + mWorldGenName, "MaxHeight", aMaxY);
if (aBiomeList == null) mBiomeList = new ArrayList<String>();
else mBiomeList = aBiomeList;
mAllowToGenerateinVoid = aAllowToGenerateinVoid;
diff --git a/src/main/java/gregtech/api/world/GT_Worldgen_Ore_Normal.java b/src/main/java/gregtech/api/world/GT_Worldgen_Ore_Normal.java
index 73b2a13d62..59ff49effb 100644
--- a/src/main/java/gregtech/api/world/GT_Worldgen_Ore_Normal.java
+++ b/src/main/java/gregtech/api/world/GT_Worldgen_Ore_Normal.java
@@ -20,38 +20,43 @@ public class GT_Worldgen_Ore_Normal extends GT_Worldgen_Ore {
for (int i = 0; i < mAmount; i++) {
int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), tZ = aChunkZ + aRandom.nextInt(16);
if (mAllowToGenerateinVoid || aWorld.getBlock(tX, tY, tZ).isAir(aWorld, tX, tY, tZ)) {
- float var6 = aRandom.nextFloat() * (float) Math.PI;
- double var7 = ((tX + 8) + MathHelper.sin(var6) * mSize / 8.0F);
- double var9 = ((tX + 8) - MathHelper.sin(var6) * mSize / 8.0F);
- double var11 = ((tZ + 8) + MathHelper.cos(var6) * mSize / 8.0F);
- double var13 = ((tZ + 8) - MathHelper.cos(var6) * mSize / 8.0F);
- double var15 = (tY + aRandom.nextInt(3) - 2);
- double var17 = (tY + aRandom.nextInt(3) - 2);
+ float math_pi = 3.141593F;float var1b = mSize / 8.0F;
+ float var6 = aRandom.nextFloat() * math_pi;
+ float var3b = MathHelper.sin(var6) * var1b; float var4b = MathHelper.cos(var6) * var1b;
+ float var8b = -2*var3b;float var9b = -2*var4b;
+ int var10b = (tX + 8);int var11b = (tZ + 8);
+ float var7 = (var10b + var3b);
+ float var11 = (var11b + var4b);
+ int var5b = aRandom.nextInt(3);int var6b = aRandom.nextInt(3);int var7b = var6b - var5b;
+ float var15 = (tY + var5b - 2);
+ float var12b = math_pi / mSize;
for (int var19 = 0; var19 <= mSize; ++var19) {
- double var20 = var7 + (var9 - var7) * var19 / mSize;
- double var22 = var15 + (var17 - var15) * var19 / mSize;
- double var24 = var11 + (var13 - var11) * var19 / mSize;
- double var26 = aRandom.nextDouble() * mSize / 16.0D;
- double var28 = (MathHelper.sin(var19 * (float) Math.PI / mSize) + 1.0F) * var26 + 1.0D;
- double var30 = (MathHelper.sin(var19 * (float) Math.PI / mSize) + 1.0F) * var26 + 1.0D;
- int var32 = MathHelper.floor_double(var20 - var28 / 2.0D);
- int var33 = MathHelper.floor_double(var22 - var30 / 2.0D);
- int var34 = MathHelper.floor_double(var24 - var28 / 2.0D);
- int var35 = MathHelper.floor_double(var20 + var28 / 2.0D);
- int var36 = MathHelper.floor_double(var22 + var30 / 2.0D);
- int var37 = MathHelper.floor_double(var24 + var28 / 2.0D);
+ float var2b = var19 / mSize;
+ float var20 = var7 + var8b * var2b;
+ float var22 = var15 + var7b * var2b;
+ float var24 = var11 + var9b * var2b;
+ float var26 = aRandom.nextFloat() * mSize / 16.0F;
+ float var28 = ((MathHelper.sin(var19 * var12b) + 1.0F) * var26 + 1.0F) / 2.0F;
+ int var32 = MathHelper.floor_float(var20 - var28);
+ int var33 = MathHelper.floor_float(var22 - var28);
+ int var34 = MathHelper.floor_float(var24 - var28);
+ int var35 = MathHelper.floor_float(var20 + var28);
+ int var36 = MathHelper.floor_float(var22 + var28);
+ int var37 = MathHelper.floor_float(var24 + var28);
for (int var38 = var32; var38 <= var35; ++var38) {
- double var39 = (var38 + 0.5D - var20) / (var28 / 2.0D);
- if (var39 * var39 < 1.0D) {
+ float var39 = (var38 + 0.5F - var20) / (var28);
+ float var13b = var39 * var39;
+ if (var13b < 1.0F) {
for (int var41 = var33; var41 <= var36; ++var41) {
- double var42 = (var41 + 0.5D - var22) / (var30 / 2.0D);
- if (var39 * var39 + var42 * var42 < 1.0D) {
+ float var42 = (var41 + 0.5F - var22) / (var28);
+ float var14b = var13b + var42 * var42;
+ if (var14b < 1.0F) {
for (int var44 = var34; var44 <= var37; ++var44) {
- double var45 = (var44 + 0.5D - var24) / (var28 / 2.0D);
+ float var45 = (var44 + 0.5F - var24) / (var28);
Block block = aWorld.getBlock(var38, var41, var44);
- if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && ((mAllowToGenerateinVoid && aWorld.getBlock(var38, var41, var44).isAir(aWorld, var38, var41, var44)) || (block != null && (block.isReplaceableOreGen(aWorld, var38, var41, var44, Blocks.stone) || block.isReplaceableOreGen(aWorld, var38, var41, var44, Blocks.end_stone) || block.isReplaceableOreGen(aWorld, var38, var41, var44, Blocks.netherrack))))) {
+ if (var14b + var45 * var45 < 1.0F && ((mAllowToGenerateinVoid && aWorld.getBlock(var38, var41, var44).isAir(aWorld, var38, var41, var44)) || (block != null && (block.isReplaceableOreGen(aWorld, var38, var41, var44, Blocks.stone) || block.isReplaceableOreGen(aWorld, var38, var41, var44, Blocks.end_stone) || block.isReplaceableOreGen(aWorld, var38, var41, var44, Blocks.netherrack))))) {
aWorld.setBlock(var38, var41, var44, mBlock, mBlockMeta, 0);
}
}