From 009709462e08bffc8990c50eb34b61686e252978 Mon Sep 17 00:00:00 2001 From: Muramasa Date: Sat, 13 Aug 2016 10:10:11 +0100 Subject: [PATCH] TryCatch changes --- src/main/java/gregtech/GT_Mod.java | 93 ++-- .../gregtech/api/items/GT_MetaBase_Item.java | 80 ++- .../metatileentity/BaseMetaPipeEntity.java | 200 ++++--- .../metatileentity/BaseMetaTileEntity.java | 510 +++++++++--------- .../gregtech/api/objects/GT_FluidStack.java | 22 +- .../java/gregtech/api/util/GT_Utility.java | 8 +- src/main/java/gregtech/common/GT_Client.java | 10 +- src/main/java/gregtech/common/GT_Proxy.java | 32 +- .../gregtech/common/GT_Worldgenerator.java | 8 +- .../common/blocks/GT_Block_Machines.java | 16 +- .../items/GT_IntegratedCircuit_Item.java | 8 +- .../items/behaviors/Behaviour_DataOrb.java | 2 +- .../loaders/load/GT_ItemIterator.java | 344 ++++++------ 13 files changed, 632 insertions(+), 701 deletions(-) diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index ecdc899d..0e3b6e98 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -58,8 +58,7 @@ import java.util.*; import java.util.Map.Entry; @Mod(modid = "gregtech", name = "GregTech", version = "MC1710", useMetadata = false, dependencies = "required-after:IC2; after:Forestry; after:PFAAGeologica; after:Thaumcraft; after:Railcraft; after:appliedenergistics2; after:ThermalExpansion; after:TwilightForest; after:harvestcraft; after:magicalcrops; after:BuildCraft|Transport; after:BuildCraft|Silicon; after:BuildCraft|Factory; after:BuildCraft|Energy; after:BuildCraft|Core; after:BuildCraft|Builders; after:GalacticraftCore; after:GalacticraftMars; after:GalacticraftPlanets; after:ThermalExpansion|Transport; after:ThermalExpansion|Energy; after:ThermalExpansion|Factory; after:RedPowerCore; after:RedPowerBase; after:RedPowerMachine; after:RedPowerCompat; after:RedPowerWiring; after:RedPowerLogic; after:RedPowerLighting; after:RedPowerWorld; after:RedPowerControl; after:UndergroundBiomes;") -public class GT_Mod - implements IGT_Mod { +public class GT_Mod implements IGT_Mod { public static final int VERSION = 509; public static final int REQUIRED_IC2 = 624; @Mod.Instance("gregtech") @@ -104,13 +103,11 @@ public class GT_Mod if (GregTech_API.sPreloadStarted) { return; } - for (Runnable tRunnable : GregTech_API.sBeforeGTPreload) { - try { + try { + for (Runnable tRunnable : GregTech_API.sBeforeGTPreload) { tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} File tFile = new File(new File(aEvent.getModConfigurationDirectory(), "GregTech"), "GregTech.cfg"); Configuration tMainConfig = new Configuration(tFile); tMainConfig.load(); @@ -367,13 +364,11 @@ public class GT_Mod GregTech_API.sPreloadFinished = true; GT_Log.out.println("GT_Mod: Preload-Phase finished!"); GT_Log.ore.println("GT_Mod: Preload-Phase finished!"); - for (Runnable tRunnable : GregTech_API.sAfterGTPreload) { - try { + try { + for (Runnable tRunnable : GregTech_API.sAfterGTPreload) { tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} } @Mod.EventHandler @@ -381,13 +376,11 @@ public class GT_Mod if (GregTech_API.sLoadStarted) { return; } - for (Runnable tRunnable : GregTech_API.sBeforeGTLoad) { - try { + try { + for (Runnable tRunnable : GregTech_API.sBeforeGTLoad) { tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} new GT_Bees(); @@ -400,13 +393,11 @@ public class GT_Mod GregTech_API.sLoadFinished = true; GT_Log.out.println("GT_Mod: Load-Phase finished!"); GT_Log.ore.println("GT_Mod: Load-Phase finished!"); - for (Runnable tRunnable : GregTech_API.sAfterGTLoad) { - try { + try { + for (Runnable tRunnable : GregTech_API.sAfterGTLoad) { tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} } @Mod.EventHandler @@ -414,13 +405,11 @@ public class GT_Mod if (GregTech_API.sPostloadStarted) { return; } - for (Runnable tRunnable : GregTech_API.sBeforeGTPostload) { - try { + try { + for (Runnable tRunnable : GregTech_API.sBeforeGTPostload) { tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} gregtechproxy.onPostLoad(); if (gregtechproxy.mSortToTheEnd) { gregtechproxy.registerUnificationEntries(); @@ -605,13 +594,11 @@ public class GT_Mod GregTech_API.sPostloadFinished = true; GT_Log.out.println("GT_Mod: PostLoad-Phase finished!"); GT_Log.ore.println("GT_Mod: PostLoad-Phase finished!"); - for (Runnable tRunnable : GregTech_API.sAfterGTPostload) { - try { + try { + for (Runnable tRunnable : GregTech_API.sAfterGTPostload) { tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} GT_Log.out.println("GT_Mod: Adding Fake Recipes for NEI"); if (ItemList.FR_Bee_Drone.get(1L, new Object[0]) != null) { GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.FR_Bee_Drone.getWildcard(1L, new Object[0])}, new ItemStack[]{ItemList.FR_Bee_Drone.getWithName(1L, "Scanned Drone", new Object[0])}, null, new FluidStack[]{Materials.Honey.getFluid(100L)}, null, 500, 2, 0); @@ -700,13 +687,11 @@ public class GT_Mod @Mod.EventHandler public void onServerStarting(FMLServerStartingEvent aEvent) { - for (Runnable tRunnable : GregTech_API.sBeforeGTServerstart) { - try { + try { + for (Runnable tRunnable : GregTech_API.sBeforeGTServerstart) { tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} gregtechproxy.onServerStarting(); GT_Log.out.println("GT_Mod: Unificating outputs of all known Recipe Types."); ArrayList tStacks = new ArrayList(10000); @@ -840,13 +825,11 @@ public class GT_Mod GregTech_API.mServerStarted = true; GT_Log.out.println("GT_Mod: ServerStarting-Phase finished!"); GT_Log.ore.println("GT_Mod: ServerStarting-Phase finished!"); - for (Runnable tRunnable : GregTech_API.sAfterGTServerstart) { - try { + try { + for (Runnable tRunnable : GregTech_API.sAfterGTServerstart) { tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} } @Mod.EventHandler @@ -858,14 +841,12 @@ public class GT_Mod public void onIDChangingEvent(FMLModIdMappingEvent aEvent) { GT_Utility.reInit(); GT_Recipe.reInit(); - for (Iterator i$ = GregTech_API.sItemStackMappings.iterator(); i$.hasNext(); ) { - Map tMap = (Map) i$.next(); - try { + try { + for (Iterator i$ = GregTech_API.sItemStackMappings.iterator(); i$.hasNext(); ) { + Map tMap = (Map) i$.next(); GT_Utility.reMap(tMap); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} } // public void onIDChangingEvent(FMLModIdMappingEvent aEvent) @@ -880,13 +861,11 @@ public class GT_Mod @Mod.EventHandler public void onServerStopping(FMLServerStoppingEvent aEvent) { - for (Runnable tRunnable : GregTech_API.sBeforeGTServerstop) { - try { + try { + for (Runnable tRunnable : GregTech_API.sBeforeGTServerstop) { tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} gregtechproxy.onServerStopping(); try { if ((GT_Values.D1) || (GT_Log.out != System.out)) { @@ -954,13 +933,11 @@ public class GT_Mod e.printStackTrace(GT_Log.err); } } - for (Runnable tRunnable : GregTech_API.sAfterGTServerstop) { - try { + try { + for (Runnable tRunnable : GregTech_API.sAfterGTServerstop) { tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} } public boolean isServerSide() { 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 b53b1a21..3e9fcf86 100644 --- a/src/main/java/gregtech/api/items/GT_MetaBase_Item.java +++ b/src/main/java/gregtech/api/items/GT_MetaBase_Item.java @@ -120,19 +120,18 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci use(aStack, 0, aPlayer); isItemStackUsable(aStack); ArrayList> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (IItemBehaviour 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 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; } @@ -141,19 +140,18 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci use(aStack, 0, aPlayer); isItemStackUsable(aStack); ArrayList> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (IItemBehaviour 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 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; } @@ -162,19 +160,18 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci use(aStack, 0, aPlayer); isItemStackUsable(aStack); ArrayList> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (IItemBehaviour 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 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; } @@ -183,12 +180,11 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci use(aStack, 0, aPlayer); isItemStackUsable(aStack); ArrayList> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (IItemBehaviour 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 tBehavior : tList) + aStack = tBehavior.onItemRightClick(this, aStack, aWorld, aPlayer); + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } return aStack; } diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java index 91201a2a..94207d5c 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) { + 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(); + } + + 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; + } + } + 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(); + } + + if (xCoord != oX || yCoord != oY || zCoord != oZ) { 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; + issueClientUpdate(); + clearTileEntityBuffer(); } - case 1: - tCode++; - if (isClientSide()) { - if (mColor != oColor) { - mMetaTileEntity.onColorChangeClient(oColor = mColor); - issueTextureUpdate(); + } + 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 (mNeedsUpdate) { - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - //worldObj.func_147479_m(xCoord, yCoord, zCoord); - mNeedsUpdate = 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); } - 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); - } - } - 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 (mNeedsBlockUpdate) { + worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockOffset(0, 0, 0)); + mNeedsBlockUpdate = 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 (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 immidietly 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 immidietly 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(byte aSide) { ITexture rIcon = getCoverTexture(aSide); if (rIcon != null) return new ITexture[]{rIcon}; return getTextureUncovered(aSide); diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 03553336..08240d1d 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -251,37 +251,256 @@ 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) { + 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(); + } + + 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; + } + } + 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(); + } + + if (xCoord != oX || yCoord != oY || zCoord != oZ) { oX = xCoord; oY = yCoord; oZ = zCoord; - if (isServerSide()) for (byte i = 0; i < 6; i++) + issueClientUpdate(); + clearTileEntityBuffer(); + } + + 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(); + } - worldObj.markTileEntityChunkModified(xCoord, yCoord, zCoord, this); + if (mTickTimer > 20 && mMetaTileEntity.isElectric()) { + mAcceptedAmperes = 0; - mMetaTileEntity.onFirstTick(this); - if (!hasValidMetaTileEntity()) { - mRunningThroughTick = false; - return; + 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() && 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 (!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) { + try { + GT_Mod.instance.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather"); + } catch (Exception e) { + } + doEnergyExplosion(); + } + } + } } } - case 1: - tCode++; - if (isClientSide()) { - if (mColor != oColor) { - mMetaTileEntity.onColorChangeClient(oColor = mColor); - issueTextureUpdate(); - } - if (mLightValue != oLightValueClient) { + 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 (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; + } + } + + 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); @@ -290,250 +509,23 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE 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; + sendBlockEvent((byte) 7, oLightValue = mLightValue); } } - 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; - } - } - } + if (mNeedsBlockUpdate) { + worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockOffset(0, 0, 0)); + mNeedsBlockUpdate = false; } - 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(); - } - - if (xCoord != oX || yCoord != oY || zCoord != oZ) { - oX = xCoord; - oY = yCoord; - oZ = zCoord; - issueClientUpdate(); - clearTileEntityBuffer(); - } - - 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 (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() && 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 (!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) { - try { - GT_Mod.instance.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather"); - } catch (Exception e) { - } - doEnergyExplosion(); - } - } - } - } - } - - 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])) 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; - } - } - - 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; - } - } - 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 immidietly 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 immidietly to GregTech Intergalactical!!!"); + e.printStackTrace(GT_Log.err); } if (isServerSide() && hasValidMetaTileEntity()) { diff --git a/src/main/java/gregtech/api/objects/GT_FluidStack.java b/src/main/java/gregtech/api/objects/GT_FluidStack.java index d2fdbbfb..6ff1627a 100644 --- a/src/main/java/gregtech/api/objects/GT_FluidStack.java +++ b/src/main/java/gregtech/api/objects/GT_FluidStack.java @@ -30,27 +30,23 @@ public class GT_FluidStack extends FluidStack { } public static final synchronized void fixAllThoseFuckingFluidIDs() { - if (ForgeVersion.getBuildVersion() < 1355) { - while (lock) { - try { + 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 tMap : GregTech_API.sFluidMappings) - try { + try { + for (Map 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 final void fixFluidIDForFucksSake() { - if (ForgeVersion.getBuildVersion() < 1355) { + 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/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index 43749419..309dc478 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -1993,16 +1993,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/common/GT_Client.java b/src/main/java/gregtech/common/GT_Client.java index 6e6864e7..a13f2539 100644 --- a/src/main/java/gregtech/common/GT_Client.java +++ b/src/main/java/gregtech/common/GT_Client.java @@ -204,9 +204,9 @@ public class GT_Client extends GT_Proxy public void onPostLoad() { super.onPostLoad(); - label0: - for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) - try { + try { + label0: + for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) do { if (i >= GregTech_API.METATILEENTITIES.length) continue label0; @@ -214,9 +214,7 @@ public class GT_Client extends GT_Proxy GregTech_API.METATILEENTITIES[i].getStackForm(1L).getTooltip(null, true); i++; } while (true); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} // super.onPostLoad(); diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index 4bcf6fe6..f080c339 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -483,17 +483,15 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { } } GT_Log.out.println("GT_Mod: Adding Configs specific for MetaTileEntities"); - for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) { - try { + try { + for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) { for (; i < GregTech_API.METATILEENTITIES.length; i++) { if (GregTech_API.METATILEENTITIES[i] != null) { GregTech_API.METATILEENTITIES[i].onConfigLoad(GregTech_API.sMachineFile); } } - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} GT_Log.out.println("GT_Mod: Adding Tool Usage Crafting Recipes for OreDict Items."); long tBits = GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.ONLY_ADD_IF_RESULT_IS_NOT_NULL | GT_ModHandler.RecipeBits.NOT_REMOVABLE; @@ -740,17 +738,15 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { break; } } - for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) { - try { + try { + for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) { for (; i < GregTech_API.METATILEENTITIES.length; i++) { if (GregTech_API.METATILEENTITIES[i] != null) { GregTech_API.METATILEENTITIES[i].onServerStart(); } } - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} } public void onServerStarted() { @@ -782,17 +778,15 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { File tSaveDirectory = getSaveDirectory(); GregTech_API.sWirelessRedstone.clear(); if (tSaveDirectory != null) { - for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) { - try { + try { + for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) { for (; i < GregTech_API.METATILEENTITIES.length; i++) { if (GregTech_API.METATILEENTITIES[i] != null) { GregTech_API.METATILEENTITIES[i].onWorldSave(tSaveDirectory); } } - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} } this.mUniverse = null; } @@ -1413,15 +1407,13 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { File tSaveDiretory = getSaveDirectory(); if (tSaveDiretory != null) { this.isFirstServerWorldTick = false; - for (IMetaTileEntity tMetaTileEntity : GregTech_API.METATILEENTITIES) { - try { + try { + for (IMetaTileEntity tMetaTileEntity : GregTech_API.METATILEENTITIES) { if (tMetaTileEntity != null) { tMetaTileEntity.onWorldLoad(tSaveDiretory); } - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} } } if ((aEvent.world.getTotalWorldTime() % 100L == 0L) && ((this.mItemDespawnTime != 6000) || (this.mMaxEqualEntitiesAtOneSpot > 0))) { diff --git a/src/main/java/gregtech/common/GT_Worldgenerator.java b/src/main/java/gregtech/common/GT_Worldgenerator.java index 64f034c3..1e6fc932 100644 --- a/src/main/java/gregtech/common/GT_Worldgenerator.java +++ b/src/main/java/gregtech/common/GT_Worldgenerator.java @@ -112,13 +112,11 @@ public class GT_Worldgenerator if (tBiome == null) { tBiome = BiomeGenBase.plains.biomeName; } - for (GT_Worldgen tWorldGen : GregTech_API.sWorldgenList) { - try { + try { + for (GT_Worldgen tWorldGen : GregTech_API.sWorldgenList) { tWorldGen.executeWorldgen(this.mWorld, this.mRandom, this.mBiome, this.mDimensionType, tX, tZ, this.mChunkGenerator, this.mChunkProvider); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} j++; } i++; diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java index 85afcf5e..d9c05fd1 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java @@ -212,15 +212,13 @@ public class GT_Block_Machines GregTech_API.sBlockIcons = aIconRegister; GT_Log.out.println("GT_Mod: Registering MetaTileEntity specific Textures"); - for (IMetaTileEntity tMetaTileEntity : GregTech_API.METATILEENTITIES) { - try { + try { + for (IMetaTileEntity tMetaTileEntity : GregTech_API.METATILEENTITIES) { if (tMetaTileEntity != null) { tMetaTileEntity.registerIcons(aIconRegister); } - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} GT_Log.out.println("GT_Mod: Registering Crop specific Textures"); try { for (GT_BaseCrop tCrop : GT_BaseCrop.sCropList) { @@ -231,13 +229,11 @@ public class GT_Block_Machines } GT_Log.out.println("GT_Mod: Starting Block Icon Load Phase"); System.out.println("GT_Mod: Starting Block Icon Load Phase"); - for (Runnable tRunnable : GregTech_API.sGTBlockIconload) { - try { + try { + for (Runnable tRunnable : GregTech_API.sGTBlockIconload) { tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} GT_Log.out.println("GT_Mod: Finished Block Icon Load Phase"); System.out.println("GT_Mod: Finished Block Icon Load Phase"); } diff --git a/src/main/java/gregtech/common/items/GT_IntegratedCircuit_Item.java b/src/main/java/gregtech/common/items/GT_IntegratedCircuit_Item.java index 41847190..1330a362 100644 --- a/src/main/java/gregtech/common/items/GT_IntegratedCircuit_Item.java +++ b/src/main/java/gregtech/common/items/GT_IntegratedCircuit_Item.java @@ -98,13 +98,11 @@ public class GT_IntegratedCircuit_Item GT_Log.out.println("GT_Mod: Starting Item Icon Load Phase"); System.out.println("GT_Mod: Starting Item Icon Load Phase"); GregTech_API.sItemIcons = aIconRegister; - for (Runnable tRunnable : GregTech_API.sGTItemIconload) { - try { + try { + for (Runnable tRunnable : GregTech_API.sGTItemIconload) { tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} GT_Log.out.println("GT_Mod: Finished Item Icon Load Phase"); System.out.println("GT_Mod: Finished Item Icon Load Phase"); } diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java index 995a438f..a339c5f3 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java @@ -94,7 +94,7 @@ public class Behaviour_DataOrb } public List getAdditionalToolTips(GT_MetaBase_Item aItem, List aList, ItemStack aStack) { - if (!getDataTitle(aStack).equals("")) { + if (!(getDataTitle(aStack).length() == 0)) { aList.add(getDataTitle(aStack)); aList.add(getDataName(aStack)); } diff --git a/src/main/java/gregtech/loaders/load/GT_ItemIterator.java b/src/main/java/gregtech/loaders/load/GT_ItemIterator.java index 81847f25..acbd8ca9 100644 --- a/src/main/java/gregtech/loaders/load/GT_ItemIterator.java +++ b/src/main/java/gregtech/loaders/load/GT_ItemIterator.java @@ -54,14 +54,14 @@ public class GT_ItemIterator GT_Log.out.println("GT_Mod: Scanning ItemList."); - Iterator tIterator = Item.itemRegistry.iterator(); - while (tIterator.hasNext()) { - Object tObject; - if (((tObject = tIterator.next()) instanceof Item) && (!(tObject instanceof GT_Generic_Item))) { - Item tItem = (Item) tObject; - String tName; - if ((tName = tItem.getUnlocalizedName()) != null) { - try { + try { + Iterator tIterator = Item.itemRegistry.iterator(); + while (tIterator.hasNext()) { + Object tObject; + if (((tObject = tIterator.next()) instanceof Item) && (!(tObject instanceof GT_Generic_Item))) { + Item tItem = (Item) tObject; + String tName; + if ((tName = tItem.getUnlocalizedName()) != null) { if ((tItem instanceof IToolCrowbar)) { if ((!tItem.isDamageable()) && (!GT_ModHandler.isElectricItem(new ItemStack(tItem, 1, 0)))) { if ((GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "infiniteDurabilityRCCrowbars", false)) && @@ -72,9 +72,6 @@ public class GT_ItemIterator GT_Log.out.println("GT_Mod: Registered valid RC Crowbar: " + tName); } } - } catch (Throwable e) { - } - try { if ((tItem instanceof IToolWrench)) { if ((!tItem.isDamageable()) && (!GT_ModHandler.isElectricItem(new ItemStack(tItem, 1, 0)))) { if ((GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "infiniteDurabilityBCWrenches", false)) && @@ -85,180 +82,175 @@ public class GT_ItemIterator GT_Log.out.println("GT_Mod: Registered valid BC Wrench: " + tName); } } - } catch (Throwable e) { - } - Block tBlock = GT_Utility.getBlockFromStack(new ItemStack(tItem, 1, 0)); - if (tBlock != null) { - if (tName.endsWith("beehives")) { - tBlock.setHarvestLevel("scoop", 0); - gregtech.common.tools.GT_Tool_Scoop.sBeeHiveMaterial = tBlock.getMaterial(); - } - if (OrePrefixes.stone.mDefaultStackSize < tItem.getItemStackLimit(new ItemStack(tItem, 1, 0))) { - try { + Block tBlock = GT_Utility.getBlockFromStack(new ItemStack(tItem, 1, 0)); + if (tBlock != null) { + if (tName.endsWith("beehives")) { + tBlock.setHarvestLevel("scoop", 0); + gregtech.common.tools.GT_Tool_Scoop.sBeeHiveMaterial = tBlock.getMaterial(); + } + if (OrePrefixes.stone.mDefaultStackSize < tItem.getItemStackLimit(new ItemStack(tItem, 1, 0))) { if ((tBlock.isReplaceableOreGen(GT_Values.DW, 0, 0, 0, Blocks.stone)) || (tBlock.isReplaceableOreGen(GT_Values.DW, 0, 0, 0, Blocks.netherrack)) || (tBlock.isReplaceableOreGen(GT_Values.DW, 0, 0, 0, Blocks.end_stone))) { tItem.setMaxStackSize(OrePrefixes.stone.mDefaultStackSize); } - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } } - } - if (((tItem instanceof ItemFood)) && (tItem != ItemList.IC2_Food_Can_Filled.getItem()) && (tItem != ItemList.IC2_Food_Can_Spoiled.getItem())) { - int tFoodValue = ((ItemFood) tItem).func_150905_g(new ItemStack(tItem, 1, 0)); - if (tFoodValue > 0) { - GT_Values.RA.addCannerRecipe(new ItemStack(tItem, 1, 32767), ItemList.IC2_Food_Can_Empty.get(tFoodValue, new Object[0]), ItemList.IC2_Food_Can_Filled.get(tFoodValue, new Object[0]), GT_Utility.getContainerItem(new ItemStack(tItem, 1, 0), true), tFoodValue * 100, 1); + if (((tItem instanceof ItemFood)) && (tItem != ItemList.IC2_Food_Can_Filled.getItem()) && (tItem != ItemList.IC2_Food_Can_Spoiled.getItem())) { + int tFoodValue = ((ItemFood) tItem).func_150905_g(new ItemStack(tItem, 1, 0)); + if (tFoodValue > 0) { + GT_Values.RA.addCannerRecipe(new ItemStack(tItem, 1, 32767), ItemList.IC2_Food_Can_Empty.get(tFoodValue, new Object[0]), ItemList.IC2_Food_Can_Filled.get(tFoodValue, new Object[0]), GT_Utility.getContainerItem(new ItemStack(tItem, 1, 0), true), tFoodValue * 100, 1); + } } - } - if ((tItem instanceof IFluidContainerItem)) { - GT_OreDictUnificator.addToBlacklist(new ItemStack(tItem, 1, 32767)); - } - if ((tName.equals("item.ItemSensorLocationCard")) || (tName.equals("item.ItemEnergySensorLocationCard")) || (tName.equals("item.ItemEnergyArrayLocationCard")) || (tName.equals("item.ItemTextCard"))) { - GT_Values.RA.addAssemblerRecipe(new ItemStack(tItem, 1, 32767), null, ItemList.Circuit_Basic.get(2L, new Object[0]), 200, 32); - } - if (tName.equals("item.ItemTimeCard")) { - GT_Values.RA.addAssemblerRecipe(new ItemStack(tItem, 1, 32767), null, ItemList.Circuit_Basic.get(1L, new Object[0]), 100, 32); - } - if (tName.equals("tile.ArsMagica:ore_vinteum")) { - GT_OreDictUnificator.set(OrePrefixes.ore, Materials.Vinteum, new ItemStack(tItem, 1, 0)); - } - if (tName.equals("item.ArsMagica:purified_vinteum")) { - GT_Values.RA.addFuel(new ItemStack(tItem, 1, 0), null, 256, 5); - } - if ((tName.equals("item.fieryBlood")) || (tName.equals("item.fieryTears"))) { - GT_Values.RA.addFuel(new ItemStack(tItem, 1, 0), null, 2048, 5); - } - if (tName.equals("tile.TFRoots")) { - GT_ModHandler.addPulverisationRecipe(new ItemStack(tItem, 1, 0), new ItemStack(Items.stick, 2), new ItemStack(Items.stick, 1), 30); - GT_ModHandler.addSawmillRecipe(new ItemStack(tItem, 1, 0), new ItemStack(Items.stick, 4), new ItemStack(Items.stick, 2)); - GT_Values.RA.addFuel(new ItemStack(tItem, 1, 1), new ItemStack(Items.stick, 4), 32, 5); - } - if (tName.equals("item.tconstruct.manual")) { - GT_OreDictUnificator.registerOre("bookTinkersManual", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.ArsMagica:spell_parchment")) { - GT_OreDictUnificator.registerOre("paperArsSpellParchment", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.ArsMagica:spell_recipe")) { - GT_OreDictUnificator.registerOre("paperArsSpellRecipe", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.ArsMagica:spell_book")) { - GT_OreDictUnificator.registerOre("bookArsSpells", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.myst.page")) { - GT_OreDictUnificator.registerOre("paperMystcraft", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.myst.agebook")) { - GT_OreDictUnificator.registerOre("bookMystcraftAge", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.myst.linkbook")) { - GT_OreDictUnificator.registerOre("bookMystcraftLink", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.myst.notebook")) { - GT_OreDictUnificator.registerOre("bookNotes", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.itemManuelBook")) { - GT_OreDictUnificator.registerOre("bookWritten", new ItemStack(tItem, 1, 0)); - } - if (tName.equals("item.blueprintItem")) { - GT_OreDictUnificator.registerOre("paperBlueprint", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.ccprintout")) { - GT_OreDictUnificator.registerOre("paperWritten", new ItemStack(tItem, 1, 0)); - GT_OreDictUnificator.registerOre("paperWritten", new ItemStack(tItem, 1, 1)); - GT_OreDictUnificator.registerOre("bookWritten", new ItemStack(tItem, 1, 2)); - } - if (tName.equals("item.blueprintItem")) { - GT_OreDictUnificator.registerOre("paperBlueprint", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.wirelessmap")) { - GT_OreDictUnificator.registerOre("paperMap", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.ItemResearchNotes")) { - GT_OreDictUnificator.registerOre("paperResearch", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.ItemThaumonomicon")) { - GT_OreDictUnificator.registerOre("bookThaumonomicon", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.ligniteCoal")) { - GT_OreDictUnificator.set(OrePrefixes.gem, Materials.Lignite, new ItemStack(tItem, 1, 0)); - } - if ((tName.equals("tile.extrabiomes.redrock")) || (tName.equals("tile.bop.redRocks"))) { - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Redrock, new ItemStack(tItem, 1, 0)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Redrock, new ItemStack(tItem, 1, 1)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Redrock, new ItemStack(tItem, 1, 2)); - } - if (tName.equals("tile.rpstone")) { - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Marble, new ItemStack(tItem, 1, 0)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 1)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Marble, new ItemStack(tItem, 1, 2)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 3)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 4)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 5)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 6)); - } - if (/**(tName.equals("tile.sedimentaryStone")) ||**/ ((tName.equals("tile.igneousStone")) || (tName.equals("tile.igneousStoneBrick")) || (tName.equals("tile.igneousCobblestone")))) { - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.GraniteRed, new ItemStack(tItem, 1, 0)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.GraniteBlack, new ItemStack(tItem, 1, 1)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Rhyolite, new ItemStack(tItem, 1, 2)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Andesite, new ItemStack(tItem, 1, 3)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Gabbro, new ItemStack(tItem, 1, 4)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 5)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Komatiite, new ItemStack(tItem, 1, 6)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Dacite, new ItemStack(tItem, 1, 7)); - - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.GraniteRed, new ItemStack(tItem, 1, 8)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.GraniteBlack, new ItemStack(tItem, 1, 9)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Rhyolite, new ItemStack(tItem, 1, 10)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Andesite, new ItemStack(tItem, 1, 11)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Gabbro, new ItemStack(tItem, 1, 12)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 13)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Komatiite, new ItemStack(tItem, 1, 14)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Dacite, new ItemStack(tItem, 1, 15)); - } - if ((tName.equals("tile.metamorphicStone")) || (tName.equals("tile.metamorphicStoneBrick")) || (tName.equals("tile.metamorphicCobblestone"))) { - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Gneiss, new ItemStack(tItem, 1, 0)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Eclogite, new ItemStack(tItem, 1, 1)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Marble, new ItemStack(tItem, 1, 2)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Quartzite, new ItemStack(tItem, 1, 3)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Blueschist, new ItemStack(tItem, 1, 4)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Greenschist, new ItemStack(tItem, 1, 5)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Soapstone, new ItemStack(tItem, 1, 6)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Migmatite, new ItemStack(tItem, 1, 7)); - - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Gneiss, new ItemStack(tItem, 1, 8)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Eclogite, new ItemStack(tItem, 1, 9)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Marble, new ItemStack(tItem, 1, 10)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Quartzite, new ItemStack(tItem, 1, 11)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Blueschist, new ItemStack(tItem, 1, 12)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Greenschist, new ItemStack(tItem, 1, 13)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Soapstone, new ItemStack(tItem, 1, 14)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Migmatite, new ItemStack(tItem, 1, 15)); - } - if (tName.equals("tile.blockCosmeticSolid")) { - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Obsidian, new ItemStack(tItem, 1, 0)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Obsidian, new ItemStack(tItem, 1, 1)); - GT_OreDictUnificator.registerOre(OrePrefixes.block, Materials.Thaumium, new ItemStack(tItem, 1, 4)); - } - if (tName.equals("tile.enderchest")) { - GT_OreDictUnificator.registerOre(OreDictNames.enderChest, new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("tile.autoWorkbenchBlock")) { - GT_OreDictUnificator.registerOre(OreDictNames.craftingWorkBench, new ItemStack(tItem, 1, 0)); - } - if (tName.equals("tile.pumpBlock")) { - GT_OreDictUnificator.registerOre(OreDictNames.craftingPump, new ItemStack(tItem, 1, 0)); - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "BCPump", false)) { - GT_ModHandler.removeRecipeByOutput(new ItemStack(tItem, 1, 0)); + if ((tItem instanceof IFluidContainerItem)) { + GT_OreDictUnificator.addToBlacklist(new ItemStack(tItem, 1, 32767)); + } + if ((tName.equals("item.ItemSensorLocationCard")) || (tName.equals("item.ItemEnergySensorLocationCard")) || (tName.equals("item.ItemEnergyArrayLocationCard")) || (tName.equals("item.ItemTextCard"))) { + GT_Values.RA.addAssemblerRecipe(new ItemStack(tItem, 1, 32767), null, ItemList.Circuit_Basic.get(2L, new Object[0]), 200, 32); + } + if (tName.equals("item.ItemTimeCard")) { + GT_Values.RA.addAssemblerRecipe(new ItemStack(tItem, 1, 32767), null, ItemList.Circuit_Basic.get(1L, new Object[0]), 100, 32); + } + if (tName.equals("tile.ArsMagica:ore_vinteum")) { + GT_OreDictUnificator.set(OrePrefixes.ore, Materials.Vinteum, new ItemStack(tItem, 1, 0)); + } + if (tName.equals("item.ArsMagica:purified_vinteum")) { + GT_Values.RA.addFuel(new ItemStack(tItem, 1, 0), null, 256, 5); + } + if ((tName.equals("item.fieryBlood")) || (tName.equals("item.fieryTears"))) { + GT_Values.RA.addFuel(new ItemStack(tItem, 1, 0), null, 2048, 5); + } + if (tName.equals("tile.TFRoots")) { + GT_ModHandler.addPulverisationRecipe(new ItemStack(tItem, 1, 0), new ItemStack(Items.stick, 2), new ItemStack(Items.stick, 1), 30); + GT_ModHandler.addSawmillRecipe(new ItemStack(tItem, 1, 0), new ItemStack(Items.stick, 4), new ItemStack(Items.stick, 2)); + GT_Values.RA.addFuel(new ItemStack(tItem, 1, 1), new ItemStack(Items.stick, 4), 32, 5); + } + if (tName.equals("item.tconstruct.manual")) { + GT_OreDictUnificator.registerOre("bookTinkersManual", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.ArsMagica:spell_parchment")) { + GT_OreDictUnificator.registerOre("paperArsSpellParchment", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.ArsMagica:spell_recipe")) { + GT_OreDictUnificator.registerOre("paperArsSpellRecipe", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.ArsMagica:spell_book")) { + GT_OreDictUnificator.registerOre("bookArsSpells", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.myst.page")) { + GT_OreDictUnificator.registerOre("paperMystcraft", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.myst.agebook")) { + GT_OreDictUnificator.registerOre("bookMystcraftAge", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.myst.linkbook")) { + GT_OreDictUnificator.registerOre("bookMystcraftLink", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.myst.notebook")) { + GT_OreDictUnificator.registerOre("bookNotes", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.itemManuelBook")) { + GT_OreDictUnificator.registerOre("bookWritten", new ItemStack(tItem, 1, 0)); + } + if (tName.equals("item.blueprintItem")) { + GT_OreDictUnificator.registerOre("paperBlueprint", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.ccprintout")) { + GT_OreDictUnificator.registerOre("paperWritten", new ItemStack(tItem, 1, 0)); + GT_OreDictUnificator.registerOre("paperWritten", new ItemStack(tItem, 1, 1)); + GT_OreDictUnificator.registerOre("bookWritten", new ItemStack(tItem, 1, 2)); + } + if (tName.equals("item.blueprintItem")) { + GT_OreDictUnificator.registerOre("paperBlueprint", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.wirelessmap")) { + GT_OreDictUnificator.registerOre("paperMap", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.ItemResearchNotes")) { + GT_OreDictUnificator.registerOre("paperResearch", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.ItemThaumonomicon")) { + GT_OreDictUnificator.registerOre("bookThaumonomicon", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.ligniteCoal")) { + GT_OreDictUnificator.set(OrePrefixes.gem, Materials.Lignite, new ItemStack(tItem, 1, 0)); + } + if ((tName.equals("tile.extrabiomes.redrock")) || (tName.equals("tile.bop.redRocks"))) { + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Redrock, new ItemStack(tItem, 1, 0)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Redrock, new ItemStack(tItem, 1, 1)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Redrock, new ItemStack(tItem, 1, 2)); + } + if (tName.equals("tile.rpstone")) { + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Marble, new ItemStack(tItem, 1, 0)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 1)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Marble, new ItemStack(tItem, 1, 2)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 3)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 4)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 5)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 6)); + } + if (/**(tName.equals("tile.sedimentaryStone")) ||**/ ((tName.equals("tile.igneousStone")) || (tName.equals("tile.igneousStoneBrick")) || (tName.equals("tile.igneousCobblestone")))) { + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.GraniteRed, new ItemStack(tItem, 1, 0)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.GraniteBlack, new ItemStack(tItem, 1, 1)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Rhyolite, new ItemStack(tItem, 1, 2)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Andesite, new ItemStack(tItem, 1, 3)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Gabbro, new ItemStack(tItem, 1, 4)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 5)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Komatiite, new ItemStack(tItem, 1, 6)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Dacite, new ItemStack(tItem, 1, 7)); + + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.GraniteRed, new ItemStack(tItem, 1, 8)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.GraniteBlack, new ItemStack(tItem, 1, 9)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Rhyolite, new ItemStack(tItem, 1, 10)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Andesite, new ItemStack(tItem, 1, 11)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Gabbro, new ItemStack(tItem, 1, 12)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 13)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Komatiite, new ItemStack(tItem, 1, 14)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Dacite, new ItemStack(tItem, 1, 15)); + } + if ((tName.equals("tile.metamorphicStone")) || (tName.equals("tile.metamorphicStoneBrick")) || (tName.equals("tile.metamorphicCobblestone"))) { + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Gneiss, new ItemStack(tItem, 1, 0)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Eclogite, new ItemStack(tItem, 1, 1)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Marble, new ItemStack(tItem, 1, 2)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Quartzite, new ItemStack(tItem, 1, 3)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Blueschist, new ItemStack(tItem, 1, 4)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Greenschist, new ItemStack(tItem, 1, 5)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Soapstone, new ItemStack(tItem, 1, 6)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Migmatite, new ItemStack(tItem, 1, 7)); + + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Gneiss, new ItemStack(tItem, 1, 8)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Eclogite, new ItemStack(tItem, 1, 9)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Marble, new ItemStack(tItem, 1, 10)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Quartzite, new ItemStack(tItem, 1, 11)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Blueschist, new ItemStack(tItem, 1, 12)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Greenschist, new ItemStack(tItem, 1, 13)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Soapstone, new ItemStack(tItem, 1, 14)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Migmatite, new ItemStack(tItem, 1, 15)); + } + if (tName.equals("tile.blockCosmeticSolid")) { + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Obsidian, new ItemStack(tItem, 1, 0)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Obsidian, new ItemStack(tItem, 1, 1)); + GT_OreDictUnificator.registerOre(OrePrefixes.block, Materials.Thaumium, new ItemStack(tItem, 1, 4)); + } + if (tName.equals("tile.enderchest")) { + GT_OreDictUnificator.registerOre(OreDictNames.enderChest, new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("tile.autoWorkbenchBlock")) { + GT_OreDictUnificator.registerOre(OreDictNames.craftingWorkBench, new ItemStack(tItem, 1, 0)); + } + if (tName.equals("tile.pumpBlock")) { + GT_OreDictUnificator.registerOre(OreDictNames.craftingPump, new ItemStack(tItem, 1, 0)); + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "BCPump", false)) { + GT_ModHandler.removeRecipeByOutput(new ItemStack(tItem, 1, 0)); + } + } + if (tName.equals("tile.tankBlock")) { + GT_OreDictUnificator.registerOre(OreDictNames.craftingTank, new ItemStack(tItem, 1, 0)); + } + if (tName.equals("item.drawplateDiamond")) { + GT_OreDictUnificator.registerOre(ToolDictNames.craftingToolDrawplate, new ItemStack(tItem, 1, 32767)); } - } - if (tName.equals("tile.tankBlock")) { - GT_OreDictUnificator.registerOre(OreDictNames.craftingTank, new ItemStack(tItem, 1, 0)); - } - if (tName.equals("item.drawplateDiamond")) { - GT_OreDictUnificator.registerOre(ToolDictNames.craftingToolDrawplate, new ItemStack(tItem, 1, 32767)); } } } - } + } catch (Throwable e) {/**/} } }