Merge branch 'master' into inventory

This commit is contained in:
gnembon committed 2019-06-24 15:21:19 -03:00
commit 968110118f
4 files changed
+63 -2

No files matched your search

@@ -24,6 +24,9 @@ public abstract class ServerChunkManager_tickMixin
CarpetProfiler.ProfilerToken currentSection;
/* Replaced with ThreadedAnvilCHunkStorage_Mixin path and separately isolated spawning and random ticks here
ticket manager is not worth its own section at this point - will fall into rest, until its fixed.
@Inject(method = "tick(Ljava/util/function/BooleanSupplier;)V", at = @At(
value = "CONSTANT",
args = "stringValue=purge"
@@ -67,6 +70,25 @@ public abstract class ServerChunkManager_tickMixin
CarpetProfiler.end_current_section(currentSection);
}
}
*/
@Inject(method = "tickChunks", at = @At("HEAD"))
private void startSpawningSection(CallbackInfo ci)
{
currentSection = CarpetProfiler.start_section(world, "Spawning and Random Ticks", CarpetProfiler.TYPE.GENERAL);
}
@Inject(method = "tickChunks", at = @At("RETURN"))
private void stopSpawningSection(CallbackInfo ci)
{
if (currentSection != null)
{
CarpetProfiler.end_current_section(currentSection);
}
}
//// Tick freeze
@Redirect(method = "tickChunks", at = @At(
@@ -0,0 +1,38 @@
package carpet.mixins;
import carpet.utils.CarpetProfiler;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.server.world.ThreadedAnvilChunkStorage;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.function.BooleanSupplier;
@Mixin(ThreadedAnvilChunkStorage.class)
public class ThreadedAnvilChunkStorage_tickMixin
{
@Shadow @Final private ServerWorld world;
CarpetProfiler.ProfilerToken currentSection;
@Inject(method = "tick", at = @At("HEAD"))
private void startProfilerSection(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
{
currentSection = CarpetProfiler.start_section(world, "Unloading", CarpetProfiler.TYPE.GENERAL);
}
@Inject(method = "tick", at = @At("RETURN"))
private void stopProfilerSecion(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
{
if (currentSection != null)
{
CarpetProfiler.end_current_section(currentSection);
}
}
}