Skip to content

Commit

Permalink
Merge branch 'master' into apatite-chembalance
Browse files Browse the repository at this point in the history
  • Loading branch information
serenibyss authored Jan 16, 2025
2 parents 0698435 + fc5ddff commit 2b79d7a
Show file tree
Hide file tree
Showing 24 changed files with 616 additions and 828 deletions.
321 changes: 158 additions & 163 deletions src/main/java/bartworks/util/BWUtil.java

Large diffs are not rendered by default.

80 changes: 16 additions & 64 deletions src/main/java/gregtech/GTMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,7 @@ public void onPreLoad(FMLPreInitializationEvent aEvent) {
}

for (Runnable tRunnable : GregTechAPI.sBeforeGTPreload) {
try {
tRunnable.run();
} catch (Throwable e) {
e.printStackTrace(GTLog.err);
}
tRunnable.run();
}

GTPreLoad.getConfiguration(aEvent.getModConfigurationDirectory());
Expand Down Expand Up @@ -314,11 +310,7 @@ public void onPreLoad(FMLPreInitializationEvent aEvent) {
GTUIInfos.init();

for (Runnable tRunnable : GregTechAPI.sAfterGTPreload) {
try {
tRunnable.run();
} catch (Throwable e) {
e.printStackTrace(GTLog.err);
}
tRunnable.run();
}

if (FMLCommonHandler.instance()
Expand All @@ -333,11 +325,7 @@ public void onLoad(FMLInitializationEvent aEvent) {
}

for (Runnable tRunnable : GregTechAPI.sBeforeGTLoad) {
try {
tRunnable.run();
} catch (Throwable e) {
e.printStackTrace(GTLog.err);
}
tRunnable.run();
}

if (Forestry.isModLoaded())
Expand Down Expand Up @@ -374,11 +362,7 @@ public void onLoad(FMLInitializationEvent aEvent) {
GTLog.ore.println("GTMod: Load-Phase finished!");

for (Runnable tRunnable : GregTechAPI.sAfterGTLoad) {
try {
tRunnable.run();
} catch (Throwable e) {
e.printStackTrace(GTLog.err);
}
tRunnable.run();
}
}

Expand All @@ -390,11 +374,7 @@ public void onPostLoad(FMLPostInitializationEvent aEvent) {

// Seems only used by GGFab so far
for (Runnable tRunnable : GregTechAPI.sBeforeGTPostload) {
try {
tRunnable.run();
} catch (Throwable e) {
e.printStackTrace(GTLog.err);
}
tRunnable.run();
}

gregtechproxy.onPostLoad();
Expand Down Expand Up @@ -545,11 +525,7 @@ public void onPostLoad(FMLPostInitializationEvent aEvent) {
GTLog.out.println("GTMod: PostLoad-Phase finished!");
GTLog.ore.println("GTMod: PostLoad-Phase finished!");
for (Runnable tRunnable : GregTechAPI.sAfterGTPostload) {
try {
tRunnable.run();
} catch (Throwable e) {
e.printStackTrace(GTLog.err);
}
tRunnable.run();
}
GTPostLoad.addFakeRecipes();

Expand Down Expand Up @@ -580,11 +556,7 @@ public void onPostLoad(FMLPostInitializationEvent aEvent) {
public void onLoadComplete(FMLLoadCompleteEvent aEvent) {
gregtechproxy.onLoadComplete();
for (Runnable tRunnable : GregTechAPI.sGTCompleteLoad) {
try {
tRunnable.run();
} catch (Throwable e) {
e.printStackTrace(GTLog.err);
}
tRunnable.run();
}
GregTechAPI.sGTCompleteLoad = null;
GregTechAPI.sFullLoadFinished = true;
Expand All @@ -604,11 +576,7 @@ public void onServerAboutToStart(FMLServerAboutToStartEvent aEvent) {
public void onServerStarting(FMLServerStartingEvent aEvent) {

for (Runnable tRunnable : GregTechAPI.sBeforeGTServerstart) {
try {
tRunnable.run();
} catch (Throwable e) {
e.printStackTrace(GTLog.err);
}
tRunnable.run();
}

gregtechproxy.onServerStarting();
Expand Down Expand Up @@ -739,11 +707,7 @@ public void onServerStarting(FMLServerStartingEvent aEvent) {
GTLog.ore.println("GTMod: ServerStarting-Phase finished!");

for (Runnable tRunnable : GregTechAPI.sAfterGTServerstart) {
try {
tRunnable.run();
} catch (Throwable e) {
e.printStackTrace(GTLog.err);
}
tRunnable.run();
}

aEvent.registerServerCommand(new GTCommand());
Expand Down Expand Up @@ -782,36 +746,24 @@ public void doSonictronSound(ItemStack aStack, World aWorld, double aX, double a
public void onIDChangingEvent(FMLModIdMappingEvent aEvent) {
GTUtility.reInit();
GTRecipe.reInit();
try {
for (Map<?, ?> gt_itemStackMap : GregTechAPI.sItemStackMappings) {
GTUtility.reMap(gt_itemStackMap);
}
for (SetMultimap<GTItemStack, ?> gt_itemStackMap : GregTechAPI.itemStackMultiMaps) {
GTUtility.reMap(gt_itemStackMap);
}
} catch (Throwable e) {
e.printStackTrace(GTLog.err);
for (Map<?, ?> gt_itemStackMap : GregTechAPI.sItemStackMappings) {
GTUtility.reMap(gt_itemStackMap);
}
for (SetMultimap<GTItemStack, ?> gt_itemStackMap : GregTechAPI.itemStackMultiMaps) {
GTUtility.reMap(gt_itemStackMap);
}
}

@Mod.EventHandler
public void onServerStopping(FMLServerStoppingEvent aEvent) {
for (Runnable tRunnable : GregTechAPI.sBeforeGTServerstop) {
try {
tRunnable.run();
} catch (Throwable e) {
e.printStackTrace(GTLog.err);
}
tRunnable.run();
}

gregtechproxy.onServerStopping();

for (Runnable tRunnable : GregTechAPI.sAfterGTServerstop) {
try {
tRunnable.run();
} catch (Throwable e) {
e.printStackTrace(GTLog.err);
}
tRunnable.run();
}
// Interrupt IDLE Threads to close down cleanly
RunnableMachineUpdate.shutdownExecutorService();
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/gregtech/api/items/MetaBaseItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import com.gtnewhorizons.modularui.api.KeyboardUtil;

import gregtech.GTMod;
import gregtech.api.enums.SubTag;
import gregtech.api.interfaces.IItemBehaviour;
import gregtech.api.util.GTLanguageManager;
Expand Down Expand Up @@ -146,7 +147,7 @@ public boolean onLeftClickEntity(ItemStack aStack, EntityPlayer aPlayer, Entity
return false;
}
} catch (Throwable e) {
if (D1) e.printStackTrace(GTLog.err);
GTMod.GT_FML_LOGGER.error("Error left clicking entity", e);
}
return false;
}
Expand All @@ -168,7 +169,7 @@ public boolean onItemUse(ItemStack aStack, EntityPlayer aPlayer, World aWorld, i
return false;
}
} catch (Throwable e) {
if (D1) e.printStackTrace(GTLog.err);
GTMod.GT_FML_LOGGER.error("Error using item", e);
}
return false;
}
Expand Down Expand Up @@ -200,7 +201,7 @@ public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWor
return false;
}
} catch (Throwable e) {
if (D1) e.printStackTrace(GTLog.err);
GTMod.GT_FML_LOGGER.error("Error using item", e);
}
return false;
}
Expand All @@ -214,7 +215,7 @@ public ItemStack onItemRightClick(ItemStack aStack, World aWorld, EntityPlayer a
if (tList != null) for (IItemBehaviour<MetaBaseItem> tBehavior : tList)
aStack = tBehavior.onItemRightClick(this, aStack, aWorld, aPlayer);
} catch (Throwable e) {
if (D1) e.printStackTrace(GTLog.err);
GTMod.GT_FML_LOGGER.error("Error right clicking item", e);
}
return aStack;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package gregtech.api.metatileentity.implementations;

import static gregtech.api.enums.GTValues.D1;
import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM;
import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE;
import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP;
Expand Down Expand Up @@ -38,7 +37,6 @@
import gregtech.api.objects.overclockdescriber.OverclockDescriber;
import gregtech.api.objects.overclockdescriber.SteamOverclockDescriber;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GTLog;
import gregtech.api.util.GTRecipe;
import gregtech.api.util.GTUtility;
import gregtech.api.util.WorldSpawnedEventBuilder.ParticleEventBuilder;
Expand Down Expand Up @@ -167,21 +165,17 @@ && getBaseMetaTileEntity().getCoverIDAtSide(getBaseMetaTileEntity().getFrontFaci
getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 1))) {
sendSound((byte) 9);
mNeedsSteamVenting = false;
try {
for (EntityLivingBase tLiving : getBaseMetaTileEntity().getWorld()
.getEntitiesWithinAABB(
EntityLivingBase.class,
AxisAlignedBB.getBoundingBox(
getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 1),
getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 1),
getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 1),
getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 1) + 1,
getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 1) + 1,
getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 1) + 1))) {
GTUtility.applyHeatDamage(tLiving, getSteamDamage());
}
} catch (Throwable e) {
if (D1) e.printStackTrace(GTLog.err);
for (EntityLivingBase tLiving : getBaseMetaTileEntity().getWorld()
.getEntitiesWithinAABB(
EntityLivingBase.class,
AxisAlignedBB.getBoundingBox(
getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 1),
getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 1),
getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 1),
getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 1) + 1,
getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 1) + 1,
getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 1) + 1))) {
GTUtility.applyHeatDamage(tLiving, getSteamDamage());
}
}
return !mNeedsSteamVenting;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package gregtech.api.metatileentity.implementations;

import static gregtech.api.enums.GTValues.ALL_VALID_SIDES;
import static gregtech.api.enums.GTValues.D1;
import static gregtech.api.enums.Mods.TinkerConstruct;
import static gregtech.api.enums.Mods.Translocator;
import static gregtech.api.metatileentity.implementations.MTEFluid.Border.BOTTOM;
Expand Down Expand Up @@ -358,38 +357,30 @@ private boolean checkEnvironment(int index, IGregTechTileEntity aBaseMetaTileEnt
tFluid.amount -= 5;
sendSound((byte) 9);
if (tTemperature > 320) {
try {
for (EntityLivingBase tLiving : getBaseMetaTileEntity().getWorld()
.getEntitiesWithinAABB(
EntityLivingBase.class,
AxisAlignedBB.getBoundingBox(
getBaseMetaTileEntity().getXCoord() - 2,
getBaseMetaTileEntity().getYCoord() - 2,
getBaseMetaTileEntity().getZCoord() - 2,
getBaseMetaTileEntity().getXCoord() + 3,
getBaseMetaTileEntity().getYCoord() + 3,
getBaseMetaTileEntity().getZCoord() + 3))) {
GTUtility.applyHeatDamage(tLiving, (tTemperature - 300) / 25.0F);
}
} catch (Throwable e) {
if (D1) e.printStackTrace(GTLog.err);
for (EntityLivingBase tLiving : getBaseMetaTileEntity().getWorld()
.getEntitiesWithinAABB(
EntityLivingBase.class,
AxisAlignedBB.getBoundingBox(
getBaseMetaTileEntity().getXCoord() - 2,
getBaseMetaTileEntity().getYCoord() - 2,
getBaseMetaTileEntity().getZCoord() - 2,
getBaseMetaTileEntity().getXCoord() + 3,
getBaseMetaTileEntity().getYCoord() + 3,
getBaseMetaTileEntity().getZCoord() + 3))) {
GTUtility.applyHeatDamage(tLiving, (tTemperature - 300) / 25.0F);
}
} else if (tTemperature < 260) {
try {
for (EntityLivingBase tLiving : getBaseMetaTileEntity().getWorld()
.getEntitiesWithinAABB(
EntityLivingBase.class,
AxisAlignedBB.getBoundingBox(
getBaseMetaTileEntity().getXCoord() - 2,
getBaseMetaTileEntity().getYCoord() - 2,
getBaseMetaTileEntity().getZCoord() - 2,
getBaseMetaTileEntity().getXCoord() + 3,
getBaseMetaTileEntity().getYCoord() + 3,
getBaseMetaTileEntity().getZCoord() + 3))) {
GTUtility.applyFrostDamage(tLiving, (270 - tTemperature) / 12.5F);
}
} catch (Throwable e) {
if (D1) e.printStackTrace(GTLog.err);
for (EntityLivingBase tLiving : getBaseMetaTileEntity().getWorld()
.getEntitiesWithinAABB(
EntityLivingBase.class,
AxisAlignedBB.getBoundingBox(
getBaseMetaTileEntity().getXCoord() - 2,
getBaseMetaTileEntity().getYCoord() - 2,
getBaseMetaTileEntity().getZCoord() - 2,
getBaseMetaTileEntity().getXCoord() + 3,
getBaseMetaTileEntity().getYCoord() + 3,
getBaseMetaTileEntity().getZCoord() + 3))) {
GTUtility.applyFrostDamage(tLiving, (270 - tTemperature) / 12.5F);
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/gregtech/api/threads/RunnableSound.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;

import gregtech.GTMod;
import gregtech.api.util.GTPlayedSound;
import gregtech.api.util.GTUtility;

Expand Down Expand Up @@ -35,7 +36,7 @@ public void run() {
mWorld.playSound(mX, mY, mZ, mSoundResourceLocation.toString(), mSoundStrength, mSoundModulation, false);
GTUtility.sPlayedSoundMap.put(tSound, mTimeUntilNextSound);
} catch (Throwable e) {
/**/
GTMod.GT_FML_LOGGER.error("Could not play RunnableSound", e);
}
}
}
6 changes: 1 addition & 5 deletions src/main/java/gregtech/api/util/GTConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@ public static String getStackConfigName(ItemStack aStack) {
if (GTUtility.isStackInvalid(aStack)) return E;
Object rName = GTOreDictUnificator.getAssociation(aStack);
if (rName != null) return rName.toString();
try {
if (GTUtility.isStringValid(rName = aStack.getUnlocalizedName())) return rName.toString();
} catch (Throwable e) {
/* Do nothing */
}
if (GTUtility.isStringValid(rName = aStack.getUnlocalizedName())) return rName.toString();
String sName = aStack.getItem()
.toString();
String[] tmp = sName.split("@");
Expand Down
Loading

0 comments on commit 2b79d7a

Please sign in to comment.