fix a profiling issue

This commit is contained in:
Ellpeck 2018-10-31 12:16:42 +01:00
parent f305eb8e04
commit 3019fdff8c
4 changed files with 2 additions and 7 deletions

View file

@ -20,7 +20,6 @@ import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.common.util.INBTSerializable;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import org.apache.commons.lang3.mutable.MutableDouble;
import org.apache.commons.lang3.mutable.MutableInt; import org.apache.commons.lang3.mutable.MutableInt;
import org.apache.commons.lang3.mutable.MutableObject; import org.apache.commons.lang3.mutable.MutableObject;
@ -165,7 +164,9 @@ public class AuraChunk implements ICapabilityProvider, INBTSerializable<NBTTagCo
for (Map.Entry<BlockPos, MutableInt> entry : this.drainSpots.entrySet()) { for (Map.Entry<BlockPos, MutableInt> entry : this.drainSpots.entrySet()) {
for (IDrainSpotEffect effect : this.effects) { for (IDrainSpotEffect effect : this.effects) {
world.profiler.func_194340_a(() -> NaturesAura.MOD_ID + ":" + effect.getClass().getSimpleName());
effect.update(world, this.chunk, this, entry.getKey(), entry.getValue()); effect.update(world, this.chunk, this, entry.getKey(), entry.getValue());
world.profiler.endSection();
} }
} }
} }

View file

@ -15,7 +15,6 @@ import org.apache.commons.lang3.mutable.MutableInt;
public class GrassDieEffect implements IDrainSpotEffect { public class GrassDieEffect implements IDrainSpotEffect {
@Override @Override
public void update(World world, Chunk chunk, AuraChunk auraChunk, BlockPos pos, MutableInt spot) { public void update(World world, Chunk chunk, AuraChunk auraChunk, BlockPos pos, MutableInt spot) {
world.profiler.func_194340_a(() -> NaturesAura.MOD_ID + ":GrassDieEffect");
if (spot.intValue() < 0) { if (spot.intValue() < 0) {
int aura = AuraChunk.getAuraInArea(world, pos, 25); int aura = AuraChunk.getAuraInArea(world, pos, 25);
if (aura < 0) { if (aura < 0) {
@ -49,6 +48,5 @@ public class GrassDieEffect implements IDrainSpotEffect {
} }
} }
} }
world.profiler.endSection();
} }
} }

View file

@ -17,7 +17,6 @@ import org.apache.commons.lang3.mutable.MutableInt;
public class PlantBoostEffect implements IDrainSpotEffect { public class PlantBoostEffect implements IDrainSpotEffect {
@Override @Override
public void update(World world, Chunk chunk, AuraChunk auraChunk, BlockPos pos, MutableInt spot) { public void update(World world, Chunk chunk, AuraChunk auraChunk, BlockPos pos, MutableInt spot) {
world.profiler.func_194340_a(() -> NaturesAura.MOD_ID + ":PlantBoostEffect");
if (spot.intValue() <= 0) if (spot.intValue() <= 0)
return; return;
int aura = AuraChunk.getAuraInArea(world, pos, 25); int aura = AuraChunk.getAuraInArea(world, pos, 25);
@ -51,6 +50,5 @@ public class PlantBoostEffect implements IDrainSpotEffect {
} }
} }
} }
world.profiler.endSection();
} }
} }

View file

@ -17,7 +17,6 @@ import java.util.List;
public class ReplenishingEffect implements IDrainSpotEffect { public class ReplenishingEffect implements IDrainSpotEffect {
@Override @Override
public void update(World world, Chunk chunk, AuraChunk auraChunk, BlockPos pos, MutableInt spot) { public void update(World world, Chunk chunk, AuraChunk auraChunk, BlockPos pos, MutableInt spot) {
world.profiler.func_194340_a(() -> NaturesAura.MOD_ID + ":ReplenishingEffect");
int amount = spot.intValue(); int amount = spot.intValue();
if (amount < 0) { if (amount < 0) {
List<ISpotDrainable> tiles = new ArrayList<>(); List<ISpotDrainable> tiles = new ArrayList<>();
@ -41,6 +40,5 @@ public class ReplenishingEffect implements IDrainSpotEffect {
} }
} }
} }
world.profiler.endSection();
} }
} }