Skip to content

Commit

Permalink
Small GregTech performance improvement
Browse files Browse the repository at this point in the history
Signed-off-by: Ross Allan <rallanpcl@gmail.com>
  • Loading branch information
LunNova committed Jul 11, 2013
1 parent ebcd62d commit edb8f00
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion resources/patches-deobfuscated.xml
Expand Up @@ -932,8 +932,37 @@
<class id="gregtechmod.common.tileentities.GT_TileEntity_IDSU">
<replaceMethodCall method="remove" code="{ $_ = null; }">setEnergyVar</replaceMethodCall>
</class>
<class id="gregtechmod.api.BaseMetaTileEntity">
<replaceMethod code="{
gregtechmod.api.MetaTileEntity m = mMetaTileEntity;
return m != null &amp;&amp; m.mBaseMetaTileEntity == this;
}">hasValidMetaTileEntity</replaceMethod>
</class>
<class id="gregtechmod.api.BaseMetaTileEntityMJ">
<synchronize>updateStatus,getPowerProvider,setPowerProvider</synchronize>
<replaceMethod code="{
if (this.mMJConverter) {
buildcraft.api.power.IPowerProvider p = mProvider;
if (p == null) {
synchronized(this) {
p = mProvider;
if (p == null) {
p = buildcraft.api.power.PowerFramework.currentFramework.createPowerProvider();
mProvider = p;
p.configure(100, 1, 100, 1, 10000);
}
}
}
else {
int c = getMJCapacity();
if (c > 0) {
int s = getStoredMJ();
if (s &lt; c) {
increaseStoredMJ((int)p.useEnergy(1.0F, (float) c - s, true), true);
}
}
}
}
}">updateStatus</replaceMethod>
<replaceMethod code="{
buildcraft.api.power.IPowerProvider powerProvider = getPowerProvider();
if (powerProvider == null) {
Expand Down

0 comments on commit edb8f00

Please sign in to comment.