This commit is contained in:
gnembon committed 2020-04-22 17:00:31 -03:00
1 parent d749bbe3ff
commit f2e9a9de91
16 files changed
+75 -58

No files matched your search

@@ -7,12 +7,17 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(IntegratedServer.class)
public class IntegratedServerMixin
{
@Inject(method = "loadWorld", at = @At("HEAD"))
private void onSetupServerIntegrated(String string, long l, LevelGeneratorOptions levelGeneratorOptions, CallbackInfo ci) {
@Inject(method = "setupServer", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/server/integrated/IntegratedServer;loadWorld()V",
shift = At.Shift.BEFORE
))
private void onSetupServerIntegrated(CallbackInfoReturnable<Boolean> cir) {
CarpetServer.onServerLoaded((IntegratedServer) (Object) this);
}
}
@@ -14,7 +14,7 @@ public class MinecraftDedicatedServerMixin
// this.tickWorlds(booleanSupplier_1);
@Inject(method = "setupServer", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/server/dedicated/MinecraftDedicatedServer;loadWorld(Ljava/lang/String;JLnet/minecraft/world/level/LevelGeneratorOptions;)V",
target = "Lnet/minecraft/server/dedicated/MinecraftDedicatedServer;loadWorld()V",
shift = At.Shift.BEFORE
))
private void onSetupServer(CallbackInfoReturnable<Boolean> cir) {
@@ -33,7 +33,7 @@ public abstract class MinecraftServer_coreMixin
// Dedicated server only
@Inject(method = "loadWorld", at = @At("HEAD"))
private void serverLoaded(String string, long l, LevelGeneratorOptions levelGeneratorOptions, CallbackInfo ci)
private void serverLoaded(CallbackInfo ci)
{
CarpetServer.onServerLoaded((MinecraftServer) (Object) this);
}
@@ -6,6 +6,8 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.server.ServerTask;
import net.minecraft.util.Util;
import net.minecraft.util.thread.ReentrantThreadExecutor;
import net.minecraft.world.level.storage.LevelStorage;
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;
@@ -34,6 +36,8 @@ public abstract class MinecraftServer_scarpetMixin extends ReentrantThreadExecut
@Shadow public abstract boolean runTask();
@Shadow @Final protected LevelStorage.Session session;
@Override
public void forceTick(BooleanSupplier isAhead)
{
@@ -42,6 +46,12 @@ public abstract class MinecraftServer_scarpetMixin extends ReentrantThreadExecut
runTask();
}
@Override
public LevelStorage.Session getCMSession()
{
return session;
}
@Inject(method = "tick", at = @At(
value = "CONSTANT",
args = "stringValue=tallying"
@@ -52,4 +62,6 @@ public abstract class MinecraftServer_scarpetMixin extends ReentrantThreadExecut
NETHER_TICK.onTick();
ENDER_TICK.onTick();
}
}
@@ -3,6 +3,7 @@ package carpet.mixins;
import carpet.fakes.ServerChunkManagerInterface;
import carpet.utils.SpawnReporter;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import net.minecraft.class_5217;
import net.minecraft.entity.EntityCategory;
import net.minecraft.server.world.ChunkTicketManager;
import net.minecraft.server.world.ServerChunkManager;
@@ -54,7 +55,7 @@ public abstract class ServerChunkManagerMixin implements ServerChunkManagerInter
private void grabMobcaps(CallbackInfo ci,
long long_1,
long long_2,
LevelProperties levelProperties_1,
class_5217 levelProperties_1,
boolean boolean_1,
boolean boolean_2,
int int_1,
@@ -146,7 +147,7 @@ public abstract class ServerChunkManagerMixin implements ServerChunkManagerInter
@Inject(method = "tickChunks", at = @At("RETURN"))
private void onFinishSpawnWorldCycle(CallbackInfo ci)
{
LevelProperties levelProperties_1 = this.world.getLevelProperties();
class_5217 levelProperties_1 = this.world.getLevelProperties(); // levelProperies class
boolean boolean_3 = levelProperties_1.getTime() % 400L == 0L;
if (SpawnReporter.track_spawns > 0L && SpawnReporter.local_spawns != null)
{
@@ -2,6 +2,7 @@ package carpet.mixins;
import carpet.helpers.TickSpeed;
import carpet.utils.CarpetProfiler;
import net.minecraft.class_5217;
import net.minecraft.server.world.ServerChunkManager;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.level.LevelGeneratorType;
@@ -93,9 +94,10 @@ public abstract class ServerChunkManager_tickMixin
//// Tick freeze
@Redirect(method = "tickChunks", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/level/LevelProperties;getGeneratorType()Lnet/minecraft/world/level/LevelGeneratorType;"
//target = "Lnet/minecraft/world/level/LevelProperties;getGeneratorType()Lnet/minecraft/world/level/LevelGeneratorType;"
target = "Lnet/minecraft/class_5217;getGeneratorType()Lnet/minecraft/world/level/LevelGeneratorType;"
))
private LevelGeneratorType skipChunkTicking(LevelProperties levelProperties)
private LevelGeneratorType skipChunkTicking(class_5217 levelProperties)
{
if (!TickSpeed.process_entities) return LevelGeneratorType.DEBUG_ALL_BLOCK_STATES;
return levelProperties.getGeneratorType();
@@ -2,6 +2,7 @@ package carpet.mixins;
import carpet.helpers.TickSpeed;
import carpet.utils.CarpetProfiler;
import net.minecraft.class_5217;
import net.minecraft.entity.raid.RaidManager;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.profiler.Profiler;
@@ -152,9 +153,10 @@ public abstract class ServerWorld_tickMixin extends World
@Redirect(method = "tick", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/level/LevelProperties;getGeneratorType()Lnet/minecraft/world/level/LevelGeneratorType;"
target = "Lnet/minecraft/class_5217;getGeneratorType()Lnet/minecraft/world/level/LevelGeneratorType;"
//target = "Lnet/minecraft/world/level/LevelProperties;getGeneratorType()Lnet/minecraft/world/level/LevelGeneratorType;"
))
private LevelGeneratorType tickPendingBlocks(LevelProperties levelProperties)
private LevelGeneratorType tickPendingBlocks(class_5217 levelProperties)
{
if (TickSpeed.process_entities) return levelProperties.getGeneratorType();
return LevelGeneratorType.DEBUG_ALL_BLOCK_STATES;
@@ -6,6 +6,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockEntityProvider;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.class_5217;
import net.minecraft.server.world.ChunkHolder;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.profiler.Profiler;
@@ -28,7 +29,7 @@ public abstract class World_movableTEMixin implements WorldInterface
public boolean isClient;
@Shadow
@Final
protected LevelProperties properties;
protected class_5217 properties; //LevelProperties
@Shadow
public abstract WorldChunk getWorldChunk(BlockPos blockPos_1);