mappings
This commit is contained in:
1 parent
787eb3e41d
commit
9a4e15da48
28 files changed
+176
-149
No files matched your search
@@ -46,24 +46,23 @@ public abstract class MinecraftServer_tickspeedMixin extends ReentrantThreadExec
|
||||
|
||||
@Shadow private long nextTickTimestamp;
|
||||
|
||||
@Shadow protected abstract void method_16208();
|
||||
|
||||
@Shadow private volatile boolean loading;
|
||||
|
||||
//@Shadow protected abstract void startMonitor(TickDurationMonitor monitor);
|
||||
|
||||
@Shadow protected abstract void startMonitor();
|
||||
|
||||
@Shadow private long lastTimeReference;
|
||||
|
||||
@Shadow private boolean waitingForNextTick;
|
||||
|
||||
@Shadow public abstract Iterable<ServerWorld> getWorlds();
|
||||
|
||||
@Shadow protected abstract void endMonitor();
|
||||
|
||||
@Shadow private boolean profilerEnabled;
|
||||
@Shadow private int ticks;
|
||||
|
||||
@Shadow protected abstract void runTasksTillTickEnd();
|
||||
|
||||
@Shadow protected abstract void startTickMetrics();
|
||||
|
||||
@Shadow protected abstract void endTickMetrics();
|
||||
|
||||
@Shadow private boolean needsDebugSetup;
|
||||
CarpetProfiler.ProfilerToken currentSection;
|
||||
|
||||
private float carpetMsptAccum = 0.0f;
|
||||
@@ -125,15 +124,15 @@ public abstract class MinecraftServer_tickspeedMixin extends ReentrantThreadExec
|
||||
this.lastTimeReference = this.timeReference;
|
||||
}
|
||||
|
||||
if (this.profilerEnabled) {
|
||||
this.profilerEnabled = false;
|
||||
if (this.needsDebugSetup) {
|
||||
this.needsDebugSetup = false;
|
||||
this.profilerTimings = Pair.of(Util.getMeasuringTimeNano(), ticks);
|
||||
//this.field_33978 = new MinecraftServer.class_6414(Util.getMeasuringTimeNano(), this.ticks);
|
||||
}
|
||||
this.timeReference += msThisTick;//50L;
|
||||
//TickDurationMonitor tickDurationMonitor = TickDurationMonitor.create("Server");
|
||||
//this.startMonitor(tickDurationMonitor);
|
||||
this.startMonitor();
|
||||
this.startTickMetrics();
|
||||
this.profiler.push("tick");
|
||||
this.tick(TickSpeed.time_warp_start_time != 0 ? ()->true : this::shouldKeepTicking);
|
||||
this.profiler.swap("nextTickWait");
|
||||
@@ -144,9 +143,9 @@ public abstract class MinecraftServer_tickspeedMixin extends ReentrantThreadExec
|
||||
this.waitingForNextTick = true;
|
||||
this.nextTickTimestamp = Math.max(Util.getMeasuringTimeMs() + /*50L*/ msThisTick, this.timeReference);
|
||||
// run all tasks (this will not do a lot when warping), but that's fine since we already run them
|
||||
this.method_16208();
|
||||
this.runTasksTillTickEnd();
|
||||
this.profiler.pop();
|
||||
this.endMonitor();
|
||||
this.endTickMetrics();
|
||||
this.loading = true;
|
||||
}
|
||||
|
||||
@@ -158,7 +157,7 @@ public abstract class MinecraftServer_tickspeedMixin extends ReentrantThreadExec
|
||||
@Inject(method = "isDebugRunning", at = @At("HEAD"), cancellable = true)
|
||||
public void isCMDebugRunning(CallbackInfoReturnable<Boolean> cir)
|
||||
{
|
||||
cir.setReturnValue(profilerEnabled || profilerTimings != null);
|
||||
cir.setReturnValue(needsDebugSetup || profilerTimings != null);
|
||||
}
|
||||
@Inject(method = "stopDebug", at = @At("HEAD"), cancellable = true)
|
||||
public void stopCMDebug(CallbackInfoReturnable<ProfileResult> cir)
|
||||
@@ -232,12 +231,12 @@ public abstract class MinecraftServer_tickspeedMixin extends ReentrantThreadExec
|
||||
CarpetProfiler.end_current_section(currentSection);
|
||||
}
|
||||
|
||||
@Inject(method = "method_16208", at = @At("HEAD"))
|
||||
@Inject(method = "runTasksTillTickEnd", at = @At("HEAD"))
|
||||
private void startAsync(CallbackInfo ci)
|
||||
{
|
||||
currentSection = CarpetProfiler.start_section(null, "Async Tasks", CarpetProfiler.TYPE.GENERAL);
|
||||
}
|
||||
@Inject(method = "method_16208", at = @At(
|
||||
@Inject(method = "runTasksTillTickEnd", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/MinecraftServer;runTasks(Ljava/util/function/BooleanSupplier;)V",
|
||||
shift = At.Shift.BEFORE
|
||||
|
||||
@@ -18,6 +18,6 @@ public class ReloadCommand_reloadAppsMixin {
|
||||
private static void onReload(CommandContext<ServerCommandSource> context, CallbackInfoReturnable<Integer> cir)
|
||||
{
|
||||
// can't fetch here the reference to the server
|
||||
CarpetServer.onReload(context.getSource().getMinecraftServer());
|
||||
CarpetServer.onReload(context.getSource().getServer());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.fakes.SimpleEntityLookupInterface;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.entity.EntityLike;
|
||||
import net.minecraft.world.entity.EntityTrackingSection;
|
||||
import net.minecraft.world.entity.SectionedEntityCache;
|
||||
import net.minecraft.world.entity.SimpleEntityLookup;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Mixin(SimpleEntityLookup.class)
|
||||
public class SimpleEntityLookup_scarpetMixin<T extends EntityLike> implements SimpleEntityLookupInterface
|
||||
{
|
||||
|
||||
@Shadow @Final private SectionedEntityCache<T> cache;
|
||||
|
||||
@Override
|
||||
public List<T> getChunkEntities(ChunkPos chpos) {
|
||||
return this.cache.getTrackingSections(chpos.toLong()).flatMap(EntityTrackingSection::stream).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+8
-8
@@ -78,7 +78,7 @@ public abstract class ThreadedAnvilChunkStorage_scarpetChunkCreationMixin implem
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private ServerLightingProvider serverLightingProvider;
|
||||
private ServerLightingProvider lightingProvider;
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
@@ -289,12 +289,12 @@ public abstract class ThreadedAnvilChunkStorage_scarpetChunkCreationMixin implem
|
||||
this.currentChunkHolders.get(pos.toLong()).getChunkAt(ChunkStatus.EMPTY, (ThreadedAnvilChunkStorage) (Object) this);
|
||||
final Chunk chunk = this.getCurrentChunk(pos);
|
||||
if (!(chunk.getStatus().isAtLeast(ChunkStatus.LIGHT.getPrevious()))) return;
|
||||
((ServerLightingProviderInterface) this.serverLightingProvider).removeLightData(chunk);
|
||||
((ServerLightingProviderInterface) this.lightingProvider).removeLightData(chunk);
|
||||
this.addRelightTicket(pos);
|
||||
final CompletableFuture<?> lightFuture = this.getRegion (pos, 1, (pos_) -> ChunkStatus.LIGHT)
|
||||
.thenCompose(
|
||||
either -> either.map(
|
||||
list -> ((ServerLightingProviderInterface) this.serverLightingProvider).relight(chunk),
|
||||
list -> ((ServerLightingProviderInterface) this.lightingProvider).relight(chunk),
|
||||
unloaded -> {
|
||||
this.releaseRelightTicket(pos);
|
||||
return CompletableFuture.completedFuture(null);
|
||||
@@ -374,8 +374,8 @@ public abstract class ThreadedAnvilChunkStorage_scarpetChunkCreationMixin implem
|
||||
if (this.loadedChunks.remove(pos.toLong()) && chunk instanceof WorldChunk)
|
||||
this.world.unloadEntities((WorldChunk) chunk); // block entities only
|
||||
|
||||
((ServerLightingProviderInterface) this.serverLightingProvider).invokeUpdateChunkStatus(pos);
|
||||
((ServerLightingProviderInterface) this.serverLightingProvider).removeLightData(chunk);
|
||||
((ServerLightingProviderInterface) this.lightingProvider).invokeUpdateChunkStatus(pos);
|
||||
((ServerLightingProviderInterface) this.lightingProvider).removeLightData(chunk);
|
||||
|
||||
this.worldGenerationProgressListener.setChunkStatus(pos, null);
|
||||
}
|
||||
@@ -388,7 +388,7 @@ public abstract class ThreadedAnvilChunkStorage_scarpetChunkCreationMixin implem
|
||||
final long pos = cPos.toLong();
|
||||
|
||||
final ChunkHolder oldHolder = this.currentChunkHolders.remove(pos);
|
||||
final ChunkHolder newHolder = new ChunkHolder(cPos, oldHolder.getLevel(), world, this.serverLightingProvider, this.chunkTaskPrioritySystem, (ChunkHolder.PlayersWatchingChunkProvider) this);
|
||||
final ChunkHolder newHolder = new ChunkHolder(cPos, oldHolder.getLevel(), world, this.lightingProvider, this.chunkTaskPrioritySystem, (ChunkHolder.PlayersWatchingChunkProvider) this);
|
||||
((ChunkHolderInterface) newHolder).setDefaultProtoChunk(cPos, this.mainThreadExecutor, world);
|
||||
this.currentChunkHolders.put(pos, newHolder);
|
||||
|
||||
@@ -401,7 +401,7 @@ public abstract class ThreadedAnvilChunkStorage_scarpetChunkCreationMixin implem
|
||||
// Remove light for affected neighbors
|
||||
|
||||
for (final Chunk chunk : affectedNeighbors)
|
||||
((ServerLightingProviderInterface) this.serverLightingProvider).removeLightData(chunk);
|
||||
((ServerLightingProviderInterface) this.lightingProvider).removeLightData(chunk);
|
||||
|
||||
// Schedule relighting of neighbors
|
||||
|
||||
@@ -418,7 +418,7 @@ public abstract class ThreadedAnvilChunkStorage_scarpetChunkCreationMixin implem
|
||||
|
||||
lightFutures.add(this.getRegion (pos, 1, (pos_) -> ChunkStatus.LIGHT).thenCompose(
|
||||
either -> either.map(
|
||||
list -> ((ServerLightingProviderInterface) this.serverLightingProvider).relight(chunk),
|
||||
list -> ((ServerLightingProviderInterface) this.lightingProvider).relight(chunk),
|
||||
unloaded -> {
|
||||
this.releaseRelightTicket(pos);
|
||||
return CompletableFuture.completedFuture(null);
|
||||
|
||||
Reference in new issue
Block a user