Skip to content

Commit d4c704c

Browse files
committed
fix(mixin): printTpsInfoWhenCantKeepUp & removeBats mixin problems
1 parent c4c579c commit d4c704c

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/main/java/io/github/optijava/opt_carpet_addition/mixins/rule/printTpsInfoWhenCantKeepUp/MinecraftServer_Mixin.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
//$$ import net.minecraft.util.TimeHelper;
1010
//#else
1111
import carpet.helpers.TickSpeed;
12-
//#endif
1312
import net.minecraft.util.math.MathHelper;
13+
//#endif
1414
import org.spongepowered.asm.mixin.Mixin;
1515
import org.spongepowered.asm.mixin.injection.At;
1616
import org.spongepowered.asm.mixin.injection.Inject;
@@ -21,7 +21,11 @@ public class MinecraftServer_Mixin {
2121

2222
@Inject(
2323
method = "runServer",
24+
//#if MC >= 12004
25+
//$$ at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V", shift = At.Shift.AFTER),
26+
//#else
2427
at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V", shift = At.Shift.AFTER),
28+
//#endif
2529
remap = false
2630
)
2731
private void injectRunServer(CallbackInfo ci) {
@@ -30,9 +34,9 @@ private void injectRunServer(CallbackInfo ci) {
3034

3135
if (OptCarpetSettings.printTpsInfoWhenCantKeepUp) {
3236
//#if MC >= 12004
33-
//$$ double mspt = (double)CarpetServer.minecraft_server.getAverageNanosPerTick() / (double) TimeHelper.MILLI_IN_NANOS;
37+
//$$ double mspt = (double) CarpetServer.minecraft_server.getAverageNanosPerTick() / (double) TimeHelper.MILLI_IN_NANOS;
3438
//$$ ServerTickManager trm = CarpetServer.minecraft_server.getTickManager();
35-
//$$ double tps = 1000.0 / Math.max(trm.isSprinting() ? 0.0 : (double)trm.getMillisPerTick(), mspt);
39+
//$$ double tps = 1000.0 / Math.max(trm.isSprinting() ? 0.0 : (double) trm.getMillisPerTick(), mspt);
3640
//$$ if (trm.isFrozen()) {
3741
//$$ tps = 0.0;
3842
//$$ }

src/main/java/io/github/optijava/opt_carpet_addition/mixins/rule/removeBats/BatEntity_Mixin.java

+4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ public class BatEntity_Mixin {
2020
at = @At("HEAD"),
2121
cancellable = true
2222
)
23+
//#if MC >= 12004
24+
//$$ private static void injectCanSpawn(EntityType<BatEntity> type, WorldAccess world, SpawnReason spawnReason, BlockPos pos, net.minecraft.util.math.random.Random random, CallbackInfoReturnable<Boolean> cir) {
25+
//#else
2326
private static void injectCanSpawn(EntityType<BatEntity> type, WorldAccess world, SpawnReason spawnReason, BlockPos pos, Random random, CallbackInfoReturnable<Boolean> cir) {
27+
//#endif
2428
if (OptCarpetSettings.removeBats) {
2529
cir.setReturnValue(false);
2630
cir.cancel();

0 commit comments

Comments
 (0)