From 9fa0e6109be0e2bd650457f7839c2fa35ab2c5d7 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 5 Feb 2020 13:56:51 -0400 Subject: [PATCH] 20w06a --- .../mixins/MinecraftServer_tickspeedMixin.java | 17 ++++++++--------- .../carpet/mixins/ServerWorld_tickMixin.java | 11 +++++++---- .../carpet/mixins/World_movableTEMixin.java | 16 ++++++++-------- src/main/resources/fabric.mod.json | 2 +- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/main/java/carpet/mixins/MinecraftServer_tickspeedMixin.java b/src/main/java/carpet/mixins/MinecraftServer_tickspeedMixin.java index d6629d10..75a7d43e 100644 --- a/src/main/java/carpet/mixins/MinecraftServer_tickspeedMixin.java +++ b/src/main/java/carpet/mixins/MinecraftServer_tickspeedMixin.java @@ -2,9 +2,10 @@ package carpet.mixins; import carpet.helpers.TickSpeed; import carpet.utils.CarpetProfiler; +import net.minecraft.class_4758; import net.minecraft.server.MinecraftServer; import net.minecraft.util.Util; -import net.minecraft.util.profiler.DisableableProfiler; +import net.minecraft.util.profiler.Profiler; import org.apache.logging.log4j.Logger; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -27,9 +28,9 @@ public abstract class MinecraftServer_tickspeedMixin @Shadow @Final private static Logger LOGGER; - @Shadow private boolean profilerStartQueued; + //@Shadow private boolean profilerStartQueued; - @Shadow @Final private DisableableProfiler profiler; + @Shadow @Final private Profiler profiler; @Shadow protected abstract void tick(BooleanSupplier booleanSupplier_1); @@ -43,6 +44,8 @@ public abstract class MinecraftServer_tickspeedMixin @Shadow private volatile boolean loading; + @Shadow protected abstract void method_24487(class_4758 arg); + CarpetProfiler.ProfilerToken currentSection; private float carpetMsptAccum = 0.0f; @@ -105,12 +108,8 @@ public abstract class MinecraftServer_tickspeedMixin } this.timeReference += msThisTick;//50L; - if (this.profilerStartQueued) - { - this.profilerStartQueued = false; - this.profiler.getController().enable(); - } - + class_4758 lv = class_4758.method_24341("Server"); + this.method_24487(lv); this.profiler.startTick(); this.profiler.push("tick"); this.tick(TickSpeed.time_warp_start_time != 0 ? ()->true : this::shouldKeepTicking); diff --git a/src/main/java/carpet/mixins/ServerWorld_tickMixin.java b/src/main/java/carpet/mixins/ServerWorld_tickMixin.java index 1f50c789..7a8c6dfc 100644 --- a/src/main/java/carpet/mixins/ServerWorld_tickMixin.java +++ b/src/main/java/carpet/mixins/ServerWorld_tickMixin.java @@ -23,18 +23,21 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import java.util.function.BiFunction; import java.util.function.BooleanSupplier; +import java.util.function.Supplier; @Mixin(ServerWorld.class) public abstract class ServerWorld_tickMixin extends World { + protected ServerWorld_tickMixin(LevelProperties levelProperties, DimensionType dimensionType, BiFunction chunkManagerProvider, Supplier supplier, boolean isClient) + { + super(levelProperties, dimensionType, chunkManagerProvider, supplier, isClient); + } + @Shadow protected abstract void sendBlockActions(); CarpetProfiler.ProfilerToken currentSection; - protected ServerWorld_tickMixin(LevelProperties levelProperties_1, DimensionType dimensionType_1, BiFunction biFunction_1, Profiler profiler_1, boolean boolean_1) - { - super(levelProperties_1, dimensionType_1, biFunction_1, profiler_1, boolean_1); - } + @Inject(method = "tick", at = @At( value = "CONSTANT", diff --git a/src/main/java/carpet/mixins/World_movableTEMixin.java b/src/main/java/carpet/mixins/World_movableTEMixin.java index 0cd2fbb7..c9fed646 100644 --- a/src/main/java/carpet/mixins/World_movableTEMixin.java +++ b/src/main/java/carpet/mixins/World_movableTEMixin.java @@ -29,9 +29,6 @@ public abstract class World_movableTEMixin implements WorldInterface @Shadow @Final protected LevelProperties properties; - @Shadow - @Final - private Profiler profiler; @Shadow public abstract WorldChunk getWorldChunk(BlockPos blockPos_1); @@ -49,14 +46,16 @@ public abstract class World_movableTEMixin implements WorldInterface public abstract void updateListeners(BlockPos var1, BlockState var2, BlockState var3, int var4); @Shadow - public abstract void updateNeighbors(BlockPos blockPos_1, Block block_1); + public abstract void updateNeighborsAlways(BlockPos blockPos_1, Block block_1); @Shadow public abstract void updateHorizontalAdjacent(BlockPos blockPos_1, Block block_1); @Shadow public abstract void onBlockChanged(BlockPos blockPos_1, BlockState blockState_1, BlockState blockState_2); - + + @Shadow public abstract Profiler getProfiler(); + /** * @author 2No2Name */ @@ -94,9 +93,10 @@ public abstract class World_movableTEMixin implements WorldInterface if (blockState_3 != blockState_2 && (blockState_3.getOpacity((BlockView) this, blockPos_1) != blockState_2.getOpacity((BlockView) this, blockPos_1) || blockState_3.getLuminance() != blockState_2.getLuminance() || blockState_3.hasSidedTransparency() || blockState_2.hasSidedTransparency())) { - this.profiler.push("queueCheckLight"); + Profiler profiler = getProfiler(); + profiler.push("queueCheckLight"); this.getChunkManager().getLightingProvider().checkBlock(blockPos_1); - this.profiler.pop(); + profiler.pop(); } if (blockState_3 == blockState_1) @@ -113,7 +113,7 @@ public abstract class World_movableTEMixin implements WorldInterface if (!this.isClient && (int_1 & 1) != 0) { - this.updateNeighbors(blockPos_1, blockState_2.getBlock()); + this.updateNeighborsAlways(blockPos_1, blockState_2.getBlock()); if (blockState_1.hasComparatorOutput()) { this.updateHorizontalAdjacent(blockPos_1, block_1); diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index f8709ee5..c1f116e9 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -26,7 +26,7 @@ ], "depends": { - "minecraft": "1.15.x", + "minecraft": "1.16.x", "fabricloader": ">=0.7.1" }, "suggests": {