diff options
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java')
-rw-r--r-- | src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java deleted file mode 100644 index 2710f5dc78..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java +++ /dev/null @@ -1,41 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.helpers; - -import java.util.HashMap; - -import net.minecraft.block.Block; -import net.minecraftforge.event.world.BlockEvent; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import gregtech.api.GregTech_API; - -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); - } - } - } -} |