tick complete

This commit is contained in:
gnembon committed 2019-05-17 23:58:33 -03:00
1 parent 59914856fb
commit 03b78b52c1
8 files changed
+338 -261

No files matched your search

@@ -13,20 +13,83 @@ import java.util.function.BooleanSupplier;
@Mixin(ServerWorld.class)
public class ServerWorld_tickMixin
{
CarpetProfiler.ProfilerToken entityToken;
CarpetProfiler.ProfilerToken currentSection;
@Inject(method = "tick", at = @At(
value = "CONSTANT",
args = "stringValue=world border"
))
private void startWeatherSection(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
{
currentSection = CarpetProfiler.start_section((World)(Object)this, "Environment", CarpetProfiler.TYPE.GENERAL);
}
@Inject(method = "tick", at = @At(
value = "CONSTANT",
args = "stringValue=world border"
))
private void stopWeatherStartChunkSection(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
{
if (currentSection != null)
{
CarpetProfiler.end_current_section(currentSection);
// we go deeper here
}
}
@Inject(method = "tick", at = @At(
value = "CONSTANT",
args = "stringValue=tickPending"
))
private void stopChunkStartBlockSection(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
{
if (currentSection != null)
{
// out of chunk
currentSection = CarpetProfiler.start_section((World) (Object) this, "Blocks", CarpetProfiler.TYPE.GENERAL);
}
}
@Inject(method = "tick", at = @At(
value = "CONSTANT",
args = "stringValue=village"
))
private void stopBlockStartVillageSection(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
{
if (currentSection != null)
{
CarpetProfiler.end_current_section(currentSection);
currentSection = CarpetProfiler.start_section((World) (Object) this, "Village", CarpetProfiler.TYPE.GENERAL);
}
}
@Inject(method = "tick", at = @At(
value = "CONSTANT",
args = "stringValue=tickPending"
))
private void stopVillageStartBlockAgainSection(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
{
if (currentSection != null)
{
CarpetProfiler.end_current_section(currentSection);
currentSection = CarpetProfiler.start_section((World) (Object) this, "Blocks", CarpetProfiler.TYPE.GENERAL);
}
}
@Inject(method = "tick", at = @At(
value = "CONSTANT",
args = "stringValue=entities"
))
private void startEntitySection(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
private void stopBlockAgainStartEntitySection(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
{
CarpetProfiler.start_section((World)(Object)this, "Entities");
if (currentSection != null)
{
CarpetProfiler.end_current_section(currentSection);
currentSection = CarpetProfiler.start_section((World) (Object) this, "Entities", CarpetProfiler.TYPE.GENERAL);
}
}
@Inject(method = "tick", at = @At("TAIL"))
private void endEntitySection(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
{
CarpetProfiler.end_current_section();
CarpetProfiler.end_current_section(currentSection);
}
}