aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/api')
-rw-r--r--src/main/java/gregtech/api/items/GT_MetaBase_Item.java1
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java7
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java35
-rw-r--r--src/main/java/gregtech/api/objects/GT_FluidStack.java26
-rw-r--r--src/main/java/gregtech/api/util/GT_ModHandler.java219
5 files changed, 191 insertions, 97 deletions
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 75cea04054..7796691540 100644
--- a/src/main/java/gregtech/api/items/GT_MetaBase_Item.java
+++ b/src/main/java/gregtech/api/items/GT_MetaBase_Item.java
@@ -39,7 +39,6 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci
* Creates the Item using these Parameters.
*
* @param aUnlocalized The Unlocalized Name of this Item.
- * @param aGeneratedPrefixList The OreDict Prefixes you want to have generated.
*/
public GT_MetaBase_Item(String aUnlocalized) {
super(aUnlocalized, "Generated Item", null, false);
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
index 686286d7d8..01ca8c0f7b 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
@@ -283,11 +283,12 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
}
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 immidietly to GregTech Intergalactical!!!");
- e.printStackTrace(gregtech.api.util.GT_Log.err);
+ //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 immidietly to GregTech Intergalactical!!!");
+ e.printStackTrace(GT_Log.err);
}
if (isServerSide() && hasValidMetaTileEntity()) {
@@ -355,7 +356,7 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
if (aValue > 16 || aValue < 0) aValue = 0;
mColor = (byte) aValue;
break;
- case 3: //int X & Y = 0 or Y; Y -> {1,2,4,8,16,32}; byte type analogy
+ case 3:
mSidedRedstone[0] = (byte) ((aValue & 1) == 1 ? 15 : 0);
mSidedRedstone[1] = (byte) ((aValue & 2) == 2 ? 15 : 0);
mSidedRedstone[2] = (byte) ((aValue & 4) == 4 ? 15 : 0);
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
index bc18ff6909..e2a23e4b41 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
@@ -249,8 +249,8 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
mRunningThroughTick = true;
long tTime = System.currentTimeMillis();
int tCode = 0;
- boolean sidetypeS = isServerSide() ? true : false;
- boolean sidetypeC = isClientSide() ? true : false;
+ boolean aSideServer = isServerSide();
+ boolean aSideClient = isClientSide();
try { for (tCode = 0; hasValidMetaTileEntity() && tCode >= 0; ) {
switch (tCode) {
@@ -260,7 +260,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
oX = xCoord;
oY = yCoord;
oZ = zCoord;
- if (sidetypeS) for (byte i = 0; i < 6; i++)
+ if (aSideServer) for (byte i = 0; i < 6; i++)
if (getCoverIDAtSide(i) != 0)
if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i))))
dropCover(i, i, true);
@@ -273,7 +273,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
}
case 1:
tCode++;
- if (isClientSide()) {
+ if (aSideClient) {
if (mColor != oColor) {
mMetaTileEntity.onColorChangeClient(oColor = mColor);
issueTextureUpdate();
@@ -304,7 +304,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
case 5:
case 6:
case 7:
- if (sidetypeS && mTickTimer > 10) {
+ if (aSideServer && mTickTimer > 10) {
for (byte i = (byte) (tCode - 2); i < 6; i++)
if (getCoverIDAtSide(i) != 0) {
tCode++;
@@ -322,7 +322,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
}
case 8:
tCode = 9;
- if (sidetypeS) {
+ if (aSideServer) {
if (++mAverageEUInputIndex >= mAverageEUInput.length) mAverageEUInputIndex = 0;
if (++mAverageEUOutputIndex >= mAverageEUOutput.length) mAverageEUOutputIndex = 0;
@@ -338,7 +338,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
}
case 10:
tCode++;
- if (sidetypeS) {
+ if (aSideServer) {
if (mRedstone != oRedstone || mTickTimer == 10) {
for (byte i = 0; i < 6; i++)
mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]);
@@ -435,7 +435,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
}
case 11:
tCode++;
- if (sidetypeS) {
+ if (aSideServer) {
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()) {
@@ -449,7 +449,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
}
case 12:
tCode++;
- if (sidetypeS) {
+ if (aSideServer) {
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) {
@@ -477,7 +477,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
}
case 15:
tCode++;
- if (sidetypeS) {
+ if (aSideServer) {
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);
@@ -517,11 +517,11 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
}
}
} 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 immidietly to GregTech Intergalactical!!!");
- e.printStackTrace(gregtech.api.util.GT_Log.err);
+ //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 immidietly to GregTech Intergalactical!!!");
+ e.printStackTrace(GT_Log.err);
}
- if (sidetypeS && hasValidMetaTileEntity()) {
+ if (aSideServer && hasValidMetaTileEntity()) {
tTime = System.currentTimeMillis() - tTime;
if (mTimeStatistics.length > 0)
mTimeStatistics[mTimeStatisticsIndex = (mTimeStatisticsIndex + 1) % mTimeStatistics.length] = (int) tTime;
@@ -580,7 +580,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
mFacing = (byte) (aValue & 7);
mActive = ((aValue & 8) != 0);
mRedstone = ((aValue & 16) != 0);
- //mLockUpgrade = ((aValue&32) != 0);
+ //mLockUpgrade = ((aValue&32) != 0);
break;
case 1:
if (hasValidMetaTileEntity()) mMetaTileEntity.onValueUpdate((byte) aValue);
@@ -589,7 +589,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
if (aValue > 16 || aValue < 0) aValue = 0;
mColor = (byte) aValue;
break;
- case 3: //int X & Y = 0 or Y; Y -> {1,2,4,8,16,32}; byte type analogy
+ case 3:
mSidedRedstone[0] = (byte) ((aValue & 1) == 1 ? 15 : 0);
mSidedRedstone[1] = (byte) ((aValue & 2) == 2 ? 15 : 0);
mSidedRedstone[2] = (byte) ((aValue & 4) == 4 ? 15 : 0);
@@ -1095,10 +1095,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
try {
mReleaseEnergy = true;
IEnergyConnected.Util.emitEnergyToNetwork(V[5], Math.max(1, getStoredEU() / V[5]), this);
- } catch (Exception e) {
- /* Fun Fact: all these "do nothing" Comments you see in my Code, are just there to let Eclipse shut up about the intended empty Brackets, but I need eclipse to yell at me in some of the regular Cases where I forget to add Code */
- GT_Log.out.println("mReleaseEnergy = true;\nIEnergyConnected.Util.emitEnergyToNetwork(V[5], Math.max(1, getStoredEU() / V[5]), this);");
- }
+ } catch (Exception e) {/* Fun Fact: all these "do nothing" Comments you see in my Code, are just there to let Eclipse shut up about the intended empty Brackets, but I need eclipse to yell at me in some of the regular Cases where I forget to add Code */}
}
mReleaseEnergy = false;
// Normal Explosion Code
diff --git a/src/main/java/gregtech/api/objects/GT_FluidStack.java b/src/main/java/gregtech/api/objects/GT_FluidStack.java
index bc1dd8f077..f4aad8ed5e 100644
--- a/src/main/java/gregtech/api/objects/GT_FluidStack.java
+++ b/src/main/java/gregtech/api/objects/GT_FluidStack.java
@@ -29,29 +29,25 @@ 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;
}
}
@Deprecated
- 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();
@@ -68,7 +64,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/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java
index 25992d2739..37b8c1e0da 100644
--- a/src/main/java/gregtech/api/util/GT_ModHandler.java
+++ b/src/main/java/gregtech/api/util/GT_ModHandler.java
@@ -1,7 +1,9 @@
package gregtech.api.util;
+import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.registry.GameRegistry;
+import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.*;
import gregtech.api.interfaces.IDamagableItem;
@@ -37,6 +39,7 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
+import java.lang.reflect.Method;
import java.util.*;
import java.util.Map.Entry;
@@ -52,18 +55,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());
@@ -499,7 +558,7 @@ public class GT_ModHandler {
if (GregTech_API.sRecipeFile.get(ConfigCategories.Machines.maceration, aInput, true)) {
GT_Utility.addSimpleIC2MachineRecipe(aInput, getMaceratorRecipeList(), null, aOutput1);
}
-
+ addMagneticraftRecipe(aInput, aOutput1, aOutput2, aChance2, aOutput3, aChance3);
RA.addPulveriserRecipe(aInput, new ItemStack[]{aOutput1, aOutput2, aOutput3}, new int[]{10000, aChance2 <= 0 ? 1000 : 100 * aChance2, aChance3 <= 0 ? 1000 : 100 * aChance3}, 400, 2);
if (!OrePrefixes.log.contains(aInput)) {
@@ -535,6 +594,31 @@ public class GT_ModHandler {
return true;
}
+ static Class tClass;
+ static Method tMethod1;
+ static Method tMethod2;
+
+ public static boolean addMagneticraftRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, int aChance2, ItemStack aOutput3, int aChance3){
+ if(GT_Mod.gregtechproxy.mMagneticraftRecipes && Loader.isModLoaded("Magneticraft")){
+ try {
+ if(tClass==null)tClass = Class.forName("com.cout970.magneticraft.api.access.MgRecipeRegister");
+ if(tMethod1==null)tMethod1 = tClass.getMethod("registerCrusherRecipe", ItemStack.class, ItemStack.class,ItemStack.class, float.class, ItemStack.class, float.class);
+ if(tMethod2==null)tMethod2 = tClass.getMethod("registerGrinderRecipe", ItemStack.class, ItemStack.class,ItemStack.class, float.class, ItemStack.class, float.class);
+
+ ItemData tData = GT_OreDictUnificator.getAssociation(aInput);
+ if(tData!=null&&tData.mPrefix!=null){
+ if(tData.mPrefix==OrePrefixes.ore||tData.mPrefix==OrePrefixes.oreBlackgranite||tData.mPrefix==OrePrefixes.oreEndstone||tData.mPrefix==OrePrefixes.oreNetherrack||tData.mPrefix==OrePrefixes.oreRedgranite){
+ tMethod1.invoke(null, aInput, aOutput1, aOutput2,(float)((float)aChance2/GT_Mod.gregtechproxy.mMagneticraftBonusOutputPercent), aOutput3,(float)((float)aChance3/GT_Mod.gregtechproxy.mMagneticraftBonusOutputPercent));
+ }else if(tData.mPrefix==OrePrefixes.crushed||tData.mPrefix==OrePrefixes.crushedCentrifuged||tData.mPrefix==OrePrefixes.crushedPurified){
+ tMethod2.invoke(null, aInput, aOutput1, aOutput2,(float)((float)aChance2/GT_Mod.gregtechproxy.mMagneticraftBonusOutputPercent), aOutput3,(float)((float)aChance3/GT_Mod.gregtechproxy.mMagneticraftBonusOutputPercent));
+ }
+ }
+
+ } catch (Exception e) {e.printStackTrace();}
+ }
+ return true;
+ }
+
/**
* Adds a Recipe to the Sawmills of GregTech and ThermalCraft
*/
@@ -696,7 +780,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 +949,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 +1035,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 +1110,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 +1176,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 +1204,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 +1216,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 +1253,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,25 +1318,23 @@ 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++) {
- temp = false;
- try {
+ int tList_sS=tList.size();
+ try {
+ for (int i = 0; i < tList_sS; i++) {
+ temp = false;
temp = tList.get(i).matches(aCrafting, DW);
- } catch (Throwable e) {
- e.printStackTrace(GT_Log.err);
- }
- if (temp) {
- ItemStack tOutput = aUncopiedStack ? tList.get(i).getRecipeOutput() : tList.get(i).getCraftingResult(aCrafting);
- if (tOutput == null || tOutput.stackSize <= 0) {
- // Seriously, who would ever do that shit?
- if (!GregTech_API.sPostloadFinished)
- throw new GT_ItsNotMyFaultException("Seems another Mod added a Crafting Recipe with null Output. Tell the Developer of said Mod to fix that.");
- } else {
- if (aUncopiedStack) return tOutput;
- return GT_Utility.copy(tOutput);
+ if (temp) {
+ ItemStack tOutput = aUncopiedStack ? tList.get(i).getRecipeOutput() : tList.get(i).getCraftingResult(aCrafting);
+ if (tOutput == null || tOutput.stackSize <= 0) {
+ // Seriously, who would ever do that shit?
+ if (!GregTech_API.sPostloadFinished)
+ throw new GT_ItsNotMyFaultException("Seems another Mod added a Crafting Recipe with null Output. Tell the Developer of said Mod to fix that.");
+ } else {
+ if (aUncopiedStack) return tOutput;
+ return GT_Utility.copy(tOutput);
+ }
}
- }
- }
+ }} catch (Throwable e) {e.printStackTrace(GT_Log.err);}
return null;
}
@@ -1317,7 +1400,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) {
@@ -1325,33 +1408,51 @@ 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;
}