aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Java/gregtech/api/util/GTPP_Recipe.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java42
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java7
4 files changed, 54 insertions, 3 deletions
diff --git a/src/Java/gregtech/api/util/GTPP_Recipe.java b/src/Java/gregtech/api/util/GTPP_Recipe.java
index 51db590d73..fbae964baf 100644
--- a/src/Java/gregtech/api/util/GTPP_Recipe.java
+++ b/src/Java/gregtech/api/util/GTPP_Recipe.java
@@ -189,7 +189,7 @@ public class GTPP_Recipe extends GT_Recipe implements IComparableRecipe {
public static void reInit() {
GT_Log.out.println("GT_Mod: Re-Unificating Recipes.");
for (final GTPP_Recipe_Map tMapEntry : GTPP_Recipe_Map.sMappings) {
- tMapEntry.reInit();
+ //tMapEntry.reInit();
if (tMapEntry != null && tMapEntry.mRecipeList != null && !tMapEntry.mRecipeList.isEmpty()) {
for (GT_Recipe aRecipe : tMapEntry.mRecipeList) {
checkRecipeOwnership(aRecipe);
@@ -197,7 +197,7 @@ public class GTPP_Recipe extends GT_Recipe implements IComparableRecipe {
}
}
for (final GTPP_Recipe_Map_Internal tMapEntry : GTPP_Recipe_Map_Internal.sMappingsEx) {
- tMapEntry.reInit();
+ //tMapEntry.reInit();
if (tMapEntry != null && tMapEntry.mRecipeList != null && !tMapEntry.mRecipeList.isEmpty()) {
for (GT_Recipe aRecipe : tMapEntry.mRecipeList) {
checkRecipeOwnership(aRecipe);
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
index 63f5043954..88c1fc8c15 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
@@ -30,8 +30,10 @@ import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.api.objects.minecraft.FormattedTooltipString;
import gtPlusPlus.core.handler.AchievementHandler;
+import gtPlusPlus.core.handler.events.BlockEventHandler;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.material.ELEMENT;
+import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.minecraft.FluidUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.minecraft.LangUtils;
@@ -41,6 +43,7 @@ import gtPlusPlus.core.util.reflect.ReflectionUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.BaseCustomTileEntity;
import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.BaseCustomPower_MTE;
import gtPlusPlus.xmod.gregtech.common.covers.CoverManager;
+import gtPlusPlus.xmod.gregtech.common.helpers.MachineUpdateHandler;
import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_WorldAccelerator;
import ic2.core.init.BlocksItems;
import ic2.core.init.InternalName;
@@ -119,6 +122,7 @@ public class Meta_GT_Proxy {
setValidHeatingCoilMetas();
PollutionUtils.setPollutionFluids();
fixIC2FluidNames();
+ Utils.registerEvent(new MachineUpdateHandler());
}
public static void postInit() {
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java
new file mode 100644
index 0000000000..0b52560e0d
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java
@@ -0,0 +1,42 @@
+package gtPlusPlus.xmod.gregtech.common.helpers;
+
+import java.util.HashMap;
+
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import gregtech.api.GregTech_API;
+import net.minecraft.block.Block;
+import net.minecraftforge.event.world.BlockEvent;
+
+public class MachineUpdateHandler {
+
+ private static final HashMap<String, Block> mBlockCache = new HashMap<String, Block>();
+
+ public static void registerBlockToCauseMachineUpdate(String aUnlocalName, Block aBlock) {
+ mBlockCache.put(aUnlocalName, aBlock);
+ }
+
+ @SubscribeEvent
+ public void onBlockEvent(BlockEvent event) {
+ Block aBlock = event.block;
+ String aUnlocalName = aBlock != null ? aBlock.getUnlocalizedName() : "NULL";
+ boolean aDoUpdate = false;
+ if (aBlock != null && aUnlocalName != null && !aUnlocalName.equals("NULL")) {
+ for (String aCachedName : mBlockCache.keySet()) {
+ if (aCachedName.equals(aUnlocalName)) {
+ aDoUpdate = true;
+ break;
+ }
+ else {
+ if (aBlock == mBlockCache.get(aCachedName)) {
+ aDoUpdate = true;
+ break;
+ }
+ }
+ }
+ if (aDoUpdate) {
+ GregTech_API.causeMachineUpdate(event.world, event.x, event.y, event.z);
+ }
+ }
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java
index 31c9636cac..2d249feaff 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java
@@ -221,6 +221,11 @@ extends GregtechMeta_MultiBlockBase {
@Override
public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
- mCuttingMode = aNBT.getBoolean("mCuttingMode");
+ if (aNBT.hasKey("mCuttingMode")) {
+ mCuttingMode = aNBT.getBoolean("mCuttingMode");
+ }
+ else {
+ mCuttingMode = true;
+ }
}
} \ No newline at end of file