From c9a10d94b6bff69fcf6ed01bb1d31540a23876e5 Mon Sep 17 00:00:00 2001 From: CursedFlames <18627001+CursedFlames@users.noreply.github.com> Date: Sun, 21 Jan 2024 19:59:14 +1300 Subject: [PATCH] update parameter names to match parchment --- .../mixin/access/common/TicketTypeAccess.java | 2 +- .../level/MixinChunkTaskPriorityQueue.java | 4 +- .../MixinChunkTaskPriorityQueueSorter.java | 4 +- .../server/level/MixinChunkTicketTracker.java | 4 +- .../server/level/MixinChunkTracker.java | 4 +- .../server/level/MixinDistanceManager.java | 34 ++--- .../MixinFixedPlayerDistanceChunkTracker.java | 4 +- .../level/MixinPlayerTicketTracker.java | 10 +- .../server/level/MixinServerPlayer.java | 4 +- .../server/level/MixinTickingTracker.java | 18 +-- .../world/level/chunk/MixinChunkAccess.java | 3 +- .../world/level/cube/MixinLevelCube.java | 4 +- .../server/level/CubicDistanceManager.java | 12 +- .../level/CubicTaskPriorityQueueSorter.java | 2 +- .../server/level/CubicTickingTracker.java | 6 +- .../world/level/chunklike/CloAccess.java | 52 +++---- .../world/level/chunklike/LevelClo.java | 22 +-- .../world/level/chunklike/ProtoClo.java | 14 +- .../world/level/cube/CubeAccess.java | 66 ++++----- .../world/level/cube/LevelCube.java | 130 +++++++++--------- .../test/world/level/cube/TestCubeAccess.java | 22 +-- 21 files changed, 211 insertions(+), 210 deletions(-) diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/access/common/TicketTypeAccess.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/access/common/TicketTypeAccess.java index c54cbabd..f6388f8f 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/access/common/TicketTypeAccess.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/access/common/TicketTypeAccess.java @@ -7,7 +7,7 @@ @Mixin(TicketType.class) public interface TicketTypeAccess { - @Invoker("") static TicketType createNew(String string, Comparator comparator, long l) { + @Invoker("") static TicketType createNew(String string, Comparator comparator, long timeout) { throw new Error("Mixin did not apply"); } } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTaskPriorityQueue.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTaskPriorityQueue.java index 33f40ec6..4afff4d0 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTaskPriorityQueue.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTaskPriorityQueue.java @@ -22,11 +22,11 @@ public void cc_setCubic() { } @Inject(method = "resortChunkTasks", at = @At("HEAD")) - private void cc_onResortChunkTasks(int p_140522_, ChunkPos p_140523_, int p_140524_, CallbackInfo ci) { + private void cc_onResortChunkTasks(int queueLevel, ChunkPos chunkPos, int ticketLevel, CallbackInfo ci) { assert !cc_isCubic; } @UsedFromASM @TransformFrom("resortChunkTasks(ILnet/minecraft/world/level/ChunkPos;I)V") - protected abstract void resortCubicTasks(int p_140522_, CloPos p_140523_, int p_140524_); + protected abstract void resortCubicTasks(int queueLevel, CloPos cloPos, int ticketLevel); } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTaskPriorityQueueSorter.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTaskPriorityQueueSorter.java index 4be4aeb5..88b68a39 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTaskPriorityQueueSorter.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTaskPriorityQueueSorter.java @@ -39,12 +39,12 @@ private Stream cc_replaceChunkPosInDebugStatus(Stream instance, Fu } @Inject(method = "onLevelChange", at = @At("HEAD")) - private void cc_onChunkOnLevelChange(ChunkPos p_140616_, IntSupplier p_140617_, int p_140618_, IntConsumer p_140619_, CallbackInfo ci) { + private void cc_onChunkOnLevelChange(ChunkPos chunkPos, IntSupplier p_140617_, int p_140618_, IntConsumer p_140619_, CallbackInfo ci) { assert !cc_isCubic; } @Override @UsedFromASM @TransformFrom("onLevelChange(Lnet/minecraft/world/level/ChunkPos;Ljava/util/function/IntSupplier;ILjava/util/function/IntConsumer;)V") - public abstract void onLevelChange(CloPos p_140616_, IntSupplier p_140617_, int p_140618_, IntConsumer p_140619_); + public abstract void onLevelChange(CloPos cloPos, IntSupplier p_140617_, int p_140618_, IntConsumer p_140619_); } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTicketTracker.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTicketTracker.java index 4cb27f4a..797df030 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTicketTracker.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTicketTracker.java @@ -9,8 +9,8 @@ @Mixin(DistanceManager.ChunkTicketTracker.class) public abstract class MixinChunkTicketTracker extends MixinChunkTracker { @Inject(method = "setLevel", at = @At("HEAD")) - private void cc_onSetLevel(long pos, int level, CallbackInfo ci) { - super.cc_onSetLevel(pos, level); + private void cc_onSetLevel(long sectionPos, int level, CallbackInfo ci) { + super.cc_onSetLevel(sectionPos, level); } // TODO if/when we replace ChunkHolder with a cubic equivalent we'll need mixins here } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTracker.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTracker.java index 8e688e9d..a05f81d5 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTracker.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTracker.java @@ -58,8 +58,8 @@ private long cc_sentinelValue() { } @ModifyConstant(method = "computeLevelFromNeighbor", constant = @Constant(intValue = 1)) - private int cc_dontIncrementLevelOnCubeChunkEdge(int constant, @Local(ordinal = 0, argsOnly = true) long fromPos, @Local(ordinal = 1, argsOnly = true) long toPos) { - if (cc_isCubic && CloPos.isCube(fromPos) && CloPos.isChunk(toPos)) return 0; + private int cc_dontIncrementLevelOnCubeChunkEdge(int constant, @Local(ordinal = 0, argsOnly = true) long startPos, @Local(ordinal = 1, argsOnly = true) long endPos) { + if (cc_isCubic && CloPos.isCube(startPos) && CloPos.isChunk(endPos)) return 0; return constant; } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinDistanceManager.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinDistanceManager.java index 13b2d6a6..9432bde4 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinDistanceManager.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinDistanceManager.java @@ -54,36 +54,36 @@ private void cc_onUseChunkPos(CallbackInfo ci){ @Override @UsedFromASM @TransformFrom("addTicket(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;ILjava/lang/Object;)V") - public abstract void addTicket(TicketType p_140793_, CloPos p_140794_, int p_140795_, T p_140796_); + public abstract void addTicket(TicketType type, CloPos pos, int level, T value); @Override @UsedFromASM @TransformFrom("removeTicket(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;ILjava/lang/Object;)V") - public abstract void removeTicket(TicketType p_140824_, CloPos p_140825_, int p_140826_, T p_140827_); + public abstract void removeTicket(TicketType type, CloPos pos, int level, T value); @Override @UsedFromASM @TransformFrom("addRegionTicket(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;ILjava/lang/Object;)V") - public abstract void addRegionTicket(TicketType p_140841_, CloPos p_140842_, int p_140843_, T p_140844_); + public abstract void addRegionTicket(TicketType type, CloPos pos, int distance, T value); @Override @UsedFromASM @TransformFrom("addRegionTicket(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;ILjava/lang/Object;Z)V") - public abstract void addRegionTicket(TicketType p_140841_, CloPos p_140842_, int p_140843_, T p_140844_, boolean forceTicks); + public abstract void addRegionTicket(TicketType type, CloPos pos, int distance, T value, boolean forceTicks); @Override @UsedFromASM @TransformFrom("removeRegionTicket(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;ILjava/lang/Object;)V") - public abstract void removeRegionTicket(TicketType p_140850_, CloPos p_140851_, int p_140852_, T p_140853_); + public abstract void removeRegionTicket(TicketType type, CloPos pos, int distance, T value); @Override @UsedFromASM @TransformFrom("removeRegionTicket(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;ILjava/lang/Object;Z)V") - public abstract void removeRegionTicket(TicketType p_140850_, CloPos p_140851_, int p_140852_, T p_140853_, boolean forceTicks); + public abstract void removeRegionTicket(TicketType type, CloPos pos, int distance, T value, boolean forceTicks); @UsedFromASM @TransformFrom("updateChunkForced(Lnet/minecraft/world/level/ChunkPos;Z)V") - protected abstract void updateCubeForced(CloPos p_140800_, boolean p_140801_); + protected abstract void updateCubeForced(CloPos pos, boolean add); /** * This function replaces a TicketType with a CubicTicketType. @@ -100,10 +100,10 @@ private TicketType cc_replaceTicketTypeOnUpdateChunkForced(Operation boolean cc_replaceTicketTypeOnAddPlayer(TickingTracker instance, TicketType p_184155_, ChunkPos p_184156_, int p_184157_, T p_184158_, SectionPos p_140803) { + private boolean cc_replaceTicketTypeOnAddPlayer(TickingTracker instance, TicketType type, ChunkPos chunkPos, int ticketLevel, T key, SectionPos sectionPos) { if(!cc_isCubic) return true; - CloPos cloPos = CloPos.section(p_140803); - ((CubicTickingTracker)instance).addTicket(CubicTicketType.PLAYER, cloPos, p_184157_, cloPos); + CloPos cloPos = CloPos.section(sectionPos); + ((CubicTickingTracker)instance).addTicket(CubicTicketType.PLAYER, cloPos, ticketLevel, cloPos); return false; } @@ -113,10 +113,10 @@ private boolean cc_replaceTicketTypeOnAddPlayer(TickingTracker instance, Tic * This requires replacing the TicketType with a CubicTicketType and the ChunkPos with a CloPos. */ @WrapWithCondition(method = "removePlayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/TickingTracker;removeTicket(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;ILjava/lang/Object;)V")) - private boolean cc_replaceTicketTypeOnRemovePlayer(TickingTracker instance, TicketType p_184169_, ChunkPos p_184170_, int p_184171_, T p_184172_, SectionPos p_140803) { + private boolean cc_replaceTicketTypeOnRemovePlayer(TickingTracker instance, TicketType type, ChunkPos chunkPos, int ticketLevel, T key, SectionPos sectionPos) { if(!cc_isCubic) return true; - CloPos cloPos = CloPos.section(p_140803); - ((CubicTickingTracker)instance).removeTicket(CubicTicketType.PLAYER, cloPos, p_184171_, cloPos); + CloPos cloPos = CloPos.section(sectionPos); + ((CubicTickingTracker)instance).removeTicket(CubicTicketType.PLAYER, cloPos, ticketLevel, cloPos); return false; } @@ -124,18 +124,18 @@ private boolean cc_replaceTicketTypeOnRemovePlayer(TickingTracker instance, * The original function expects chunkPos.toLong(), but we need to replace it with cloPos.toLong() instead. */ @WrapOperation(method = "addPlayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/ChunkPos;toLong()J")) - private long cc_replaceTicketTypeOnAddPlayer(ChunkPos chunkPos, Operation original, SectionPos p_140803) { + private long cc_replaceTicketTypeOnAddPlayer(ChunkPos chunkPos, Operation original, SectionPos sectionPos) { if(!cc_isCubic) return original.call(chunkPos); - return CloPos.section(p_140803).toLong(); + return CloPos.section(sectionPos).toLong(); } /** * The original function expects chunkPos.toLong(), but we need to replace it with cloPos.toLong() instead. */ @WrapOperation(method = "removePlayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/ChunkPos;toLong()J")) - private long cc_replaceTicketTypeOnRemovePlayer(ChunkPos chunkPos, Operation original, SectionPos p_140803) { + private long cc_replaceTicketTypeOnRemovePlayer(ChunkPos chunkPos, Operation original, SectionPos sectionPos) { if(!cc_isCubic) return original.call(chunkPos); - return CloPos.section(p_140803).toLong(); + return CloPos.section(sectionPos).toLong(); } /** diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinFixedPlayerDistanceChunkTracker.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinFixedPlayerDistanceChunkTracker.java index 7d4d6e04..1d288008 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinFixedPlayerDistanceChunkTracker.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinFixedPlayerDistanceChunkTracker.java @@ -9,8 +9,8 @@ @Mixin(DistanceManager.FixedPlayerDistanceChunkTracker.class) public abstract class MixinFixedPlayerDistanceChunkTracker extends MixinChunkTracker { @Inject(method = "setLevel", at = @At("HEAD")) - private void cc_onSetLevel(long pos, int level, CallbackInfo ci) { - super.cc_onSetLevel(pos, level); + private void cc_onSetLevel(long sectionPos, int level, CallbackInfo ci) { + super.cc_onSetLevel(sectionPos, level); } // TODO do we care about dumpChunks? diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinPlayerTicketTracker.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinPlayerTicketTracker.java index 5447faf7..7dcdd9c4 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinPlayerTicketTracker.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinPlayerTicketTracker.java @@ -30,20 +30,20 @@ public abstract class MixinPlayerTicketTracker extends MixinFixedPlayerDistanceC */ @WrapOperation(method = "onLevelChange(JIZZ)V", at = @At(value = "NEW", target = "(Lnet/minecraft/server/level/TicketType;ILjava/lang/Object;)Lnet/minecraft/server/level/Ticket;")) - private Ticket cc_onTicketConstruct(TicketType ttype, int a, Object pos, Operation original) { + private Ticket cc_onTicketConstruct(TicketType type, int ticketLevel, Object key, Operation original) { if (!cc_isCubic) - return original.call(ttype, a, pos); - return original.call(CubicTicketType.PLAYER, a, CloPos.fromLong(((ChunkPos) pos).toLong())); + return original.call(type, ticketLevel, key); + return original.call(CubicTicketType.PLAYER, ticketLevel, CloPos.fromLong(((ChunkPos) key).toLong())); } /** * This modifies the lambda inside Distance.this.ticketThrottler.onLevelChange to use a CloPos instead of a ChunkPos. */ @WrapWithCondition(method = "runAllUpdates", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ChunkTaskPriorityQueueSorter;onLevelChange(Lnet/minecraft/world/level/ChunkPos;Ljava/util/function/IntSupplier;ILjava/util/function/IntConsumer;)V")) - private boolean cc_onRunAllUpdates(ChunkTaskPriorityQueueSorter instance, ChunkPos p_140616_, IntSupplier p_140617_, int p_140618_, IntConsumer p_140619_) { + private boolean cc_onRunAllUpdates(ChunkTaskPriorityQueueSorter instance, ChunkPos chunkPos, IntSupplier p_140617_, int p_140618_, IntConsumer p_140619_) { if(!cc_isCubic) return true; ((CubicTaskPriorityQueueSorter)((DistanceManagerAccess)this$0).ticketThrottler()) - .onLevelChange(CloPos.fromLong(p_140616_.toLong()), p_140617_, p_140618_, p_140619_); + .onLevelChange(CloPos.fromLong(chunkPos.toLong()), p_140617_, p_140618_, p_140619_); return false; } } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinServerPlayer.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinServerPlayer.java index f9fed5e5..2305d040 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinServerPlayer.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinServerPlayer.java @@ -29,7 +29,7 @@ public void cc_setCubic() { */ @WrapWithCondition(method = "teleportTo(Lnet/minecraft/server/level/ServerLevel;DDDLjava/util/Set;FF)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level" + "/ServerChunkCache;addRegionTicket(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;ILjava/lang/Object;)V")) - public boolean cc_wrapAddRegionTicket(ServerChunkCache instance, TicketType ticketType, ChunkPos chunkPos, int p_8390_, T p_8391_, + public boolean cc_wrapAddRegionTicket(ServerChunkCache instance, TicketType type, ChunkPos pos, int distance, T value, @Local(ordinal = 0, argsOnly = true)double x, @Local(ordinal = 1, argsOnly = true)double y, @Local(ordinal = 2, argsOnly = true)double z) { @@ -37,7 +37,7 @@ public boolean cc_wrapAddRegionTicket(ServerChunkCache instance, TicketType< return true; } // TODO: Add once Cubic ServerChunkCache exists - //instance.addRegionTicket(ticketType, CloPos.cube(BlockPos.containing(x, y, z)), 1, this.getId()); + //instance.addRegionTicket(type, CloPos.cube(BlockPos.containing(x, y, z)), 1, this.getId()); return false; } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinTickingTracker.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinTickingTracker.java index 053c94e2..891991ec 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinTickingTracker.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinTickingTracker.java @@ -35,12 +35,12 @@ @Mixin(TickingTracker.class) public abstract class MixinTickingTracker extends MixinChunkTracker implements CubicTickingTracker { @Inject(method = "setLevel", at = @At("HEAD")) - private void cc_onSetLevel(long pos, int level, CallbackInfo ci) { - super.cc_onSetLevel(pos, level); + private void cc_onSetLevel(long chunkPos, int level, CallbackInfo ci) { + super.cc_onSetLevel(chunkPos, level); } @Inject(method = "getLevel(Lnet/minecraft/world/level/ChunkPos;)I", at = @At("HEAD")) - private void cc_onChunkGetLevel(ChunkPos p_184162_, CallbackInfoReturnable cir) { + private void cc_onChunkGetLevel(ChunkPos chunkPos, CallbackInfoReturnable cir) { assert !cc_isCubic; } @@ -50,11 +50,11 @@ private void cc_onChunkGetLevel(ChunkPos p_184162_, CallbackInfoReturnable boolean cc_onReplacePlayerTicketsLevel(TickingTracker instance, TicketType ticketType, ChunkPos pos, int a, T b) { + private boolean cc_onReplacePlayerTicketsLevel(TickingTracker instance, TicketType type, ChunkPos chunkPos, int ticketLevel, T key) { if (!cc_isCubic) return true; // if isCubic then we expect tickets to be TicketType not TicketType - var cloPos = CloPos.fromLong(pos.toLong()); - this.addTicket((TicketType) ticketType, cloPos, a, cloPos); + var cloPos = CloPos.fromLong(chunkPos.toLong()); + this.addTicket((TicketType) type, cloPos, ticketLevel, cloPos); return false; } @@ -68,11 +68,11 @@ private TicketType cc_replaceTicketType(Operation> origi } @TransformFrom("addTicket(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;ILjava/lang/Object;)V") - public abstract void addTicket(TicketType p_184155_, CloPos p_184156_, int p_184157_, T p_184158_); + public abstract void addTicket(TicketType type, CloPos cloPos, int ticketLevel, T key); @TransformFrom("removeTicket(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;ILjava/lang/Object;)V") - public abstract void removeTicket(TicketType p_184169_, CloPos p_184170_, int p_184171_, T p_184172_); + public abstract void removeTicket(TicketType type, CloPos p_184170_, int ticketLevel, T key); @TransformFrom("getLevel(Lnet/minecraft/world/level/ChunkPos;)I") - public abstract int getLevel(CloPos p_184162_); + public abstract int getLevel(CloPos cloPos); } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/level/chunk/MixinChunkAccess.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/level/chunk/MixinChunkAccess.java index 87083c13..333fd236 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/level/chunk/MixinChunkAccess.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/level/chunk/MixinChunkAccess.java @@ -19,7 +19,8 @@ public abstract class MixinChunkAccess implements CloAccess { private CloPos cc_cloPos; @Inject(method = "", at = @At("RETURN")) - private void onInit(ChunkPos chunkPos, UpgradeData p_187622_, LevelHeightAccessor p_187623_, Registry p_187624_, long p_187625_, LevelChunkSection[] p_187626_, BlendingData p_187627_, + private void onInit(ChunkPos chunkPos, UpgradeData upgradeData, LevelHeightAccessor levelHeightAccessor, Registry biomeRegistry, long inhabitedTime, LevelChunkSection[] sections, + BlendingData blendingData, CallbackInfo ci) { cc_cloPos = CloPos.chunk(chunkPos); } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/level/cube/MixinLevelCube.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/level/cube/MixinLevelCube.java index be7c74b8..cf47984c 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/level/cube/MixinLevelCube.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/level/cube/MixinLevelCube.java @@ -15,7 +15,7 @@ public abstract class MixinLevelCube extends MixinCubeAccess { * Redirect to use cube section indexing instead of chunk section indexing */ @Dynamic @Redirect(method = "cc_dasm$getBlockState", at = @At(value = "INVOKE", target = "Lio/github/opencubicchunks/cubicchunks/world/level/cube/LevelCube;getSectionIndex(I)I")) - private int cc_onGetBlockState_SectionIndex(LevelCube instance, int i, BlockPos pos) { + private int cc_onGetBlockState_SectionIndex(LevelCube instance, int y, BlockPos pos) { return Coords.blockToIndex(pos); } @@ -24,7 +24,7 @@ private int cc_onGetBlockState_SectionIndex(LevelCube instance, int i, BlockPos */ @Dynamic @Redirect(method = "cc_dasm$getFluidState(III)Lnet/minecraft/world/level/material/FluidState;", at = @At(value = "INVOKE", target = "Lio/github/opencubicchunks/cubicchunks" + "/world/level/cube/LevelCube;getSectionIndex(I)I")) - private int cc_onGetFluidState_SectionIndex(LevelCube instance, int i, int x, int y, int z) { + private int cc_onGetFluidState_SectionIndex(LevelCube instance, int yUnused, int x, int y, int z) { return Coords.blockToIndex(x, y, z); } } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CubicDistanceManager.java b/src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CubicDistanceManager.java index 5f2f7f0a..304ef32e 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CubicDistanceManager.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CubicDistanceManager.java @@ -6,20 +6,20 @@ public interface CubicDistanceManager { @UsedFromASM - void addTicket(TicketType p_140793_, CloPos p_140794_, int p_140795_, T p_140796_); + void addTicket(TicketType type, CloPos pos, int level, T value); @UsedFromASM - void removeTicket(TicketType p_140824_, CloPos p_140825_, int p_140826_, T p_140827_); + void removeTicket(TicketType type, CloPos pos, int level, T value); @UsedFromASM - void addRegionTicket(TicketType p_140841_, CloPos p_140842_, int p_140843_, T p_140844_); + void addRegionTicket(TicketType type, CloPos pos, int distance, T value); @UsedFromASM - void addRegionTicket(TicketType p_140841_, CloPos p_140842_, int p_140843_, T p_140844_, boolean forceTicks); + void addRegionTicket(TicketType type, CloPos pos, int distance, T value, boolean forceTicks); @UsedFromASM - void removeRegionTicket(TicketType p_140850_, CloPos p_140851_, int p_140852_, T p_140853_); + void removeRegionTicket(TicketType type, CloPos pos, int distance, T value); @UsedFromASM - void removeRegionTicket(TicketType p_140850_, CloPos p_140851_, int p_140852_, T p_140853_, boolean forceTicks); + void removeRegionTicket(TicketType type, CloPos pos, int distance, T value, boolean forceTicks); } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CubicTaskPriorityQueueSorter.java b/src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CubicTaskPriorityQueueSorter.java index 5059066c..ad5ab4d6 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CubicTaskPriorityQueueSorter.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CubicTaskPriorityQueueSorter.java @@ -8,5 +8,5 @@ public interface CubicTaskPriorityQueueSorter { @UsedFromASM - void onLevelChange(CloPos p_140616_, IntSupplier p_140617_, int p_140618_, IntConsumer p_140619_); + void onLevelChange(CloPos cloPos, IntSupplier p_140617_, int p_140618_, IntConsumer p_140619_); } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CubicTickingTracker.java b/src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CubicTickingTracker.java index cfdd28fe..65783b9f 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CubicTickingTracker.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CubicTickingTracker.java @@ -6,10 +6,10 @@ public interface CubicTickingTracker { @UsedFromASM - void addTicket(TicketType p_184155_, CloPos p_184156_, int p_184157_, T p_184158_); + void addTicket(TicketType type, CloPos cloPos, int ticketLevel, T key); @UsedFromASM - void removeTicket(TicketType p_184169_, CloPos p_184170_, int p_184171_, T p_184172_); + void removeTicket(TicketType type, CloPos cloPos, int ticketLevel, T key); - int getLevel(CloPos p_184162_); + int getLevel(CloPos cloPos); } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/chunklike/CloAccess.java b/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/chunklike/CloAccess.java index c5cfd1a9..13a76c30 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/chunklike/CloAccess.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/chunklike/CloAccess.java @@ -42,11 +42,11 @@ public interface CloAccess extends BlockGetter, BiomeManager.NoiseBiomeSource, LightChunk, StructureAccess { GameEventListenerRegistry getListenerRegistry(int p_251437_); - @Nullable BlockState setBlockState(BlockPos p_62087_, BlockState p_62088_, boolean p_62089_); + @Nullable BlockState setBlockState(BlockPos pos, BlockState state, boolean isMoving); - void setBlockEntity(BlockEntity p_156114_); + void setBlockEntity(BlockEntity blockEntity); - void addEntity(Entity p_62078_); + void addEntity(Entity entity); int getHighestFilledSectionIndex(); @@ -57,28 +57,28 @@ public interface CloAccess extends BlockGetter, BiomeManager.NoiseBiomeSource, L LevelChunkSection[] getSections(); - LevelChunkSection getSection(int p_187657_); + LevelChunkSection getSection(int index); Collection> getHeightmaps(); - void setHeightmap(Heightmap.Types p_62083_, long[] p_62084_); + void setHeightmap(Heightmap.Types type, long[] data); - Heightmap getOrCreateHeightmapUnprimed(Heightmap.Types p_62079_); + Heightmap getOrCreateHeightmapUnprimed(Heightmap.Types type); - boolean hasPrimedHeightmap(Heightmap.Types p_187659_); + boolean hasPrimedHeightmap(Heightmap.Types type); - int getHeight(Heightmap.Types p_62080_, int p_62081_, int p_62082_); + int getHeight(Heightmap.Types type, int x, int z); // replacement of ChunkPos getPos() CloPos cc_getCloPos(); Map getAllStarts(); - void setAllStarts(Map p_62090_); + void setAllStarts(Map structureStarts); - boolean isYSpaceEmpty(int p_62075_, int p_62076_); + boolean isYSpaceEmpty(int startY, int endY); - void setUnsaved(boolean p_62094_); + void setUnsaved(boolean unsaved); boolean isUnsaved(); @@ -86,23 +86,23 @@ public interface CloAccess extends BlockGetter, BiomeManager.NoiseBiomeSource, L ChunkStatus getHighestGeneratedStatus(); - void removeBlockEntity(BlockPos p_62101_); + void removeBlockEntity(BlockPos pos); - void markPosForPostprocessing(BlockPos p_62102_); + void markPosForPostprocessing(BlockPos pos); ShortList[] getPostProcessing(); - void addPackedPostProcess(short p_62092_, int p_62093_); + void addPackedPostProcess(short packedPosition, int index); - void setBlockEntityNbt(CompoundTag p_62091_); + void setBlockEntityNbt(CompoundTag tag); - @Nullable CompoundTag getBlockEntityNbt(BlockPos p_62103_); + @Nullable CompoundTag getBlockEntityNbt(BlockPos pos); - @Nullable CompoundTag getBlockEntityNbtForSaving(BlockPos p_62104_); + @Nullable CompoundTag getBlockEntityNbtForSaving(BlockPos pos); - void findBlocks(Predicate p_285343_, BiConsumer p_285030_); + void findBlocks(Predicate predicate, BiConsumer output); - void findBlocks(java.util.function.BiPredicate p_285343_, BiConsumer p_285030_); + void findBlocks(java.util.function.BiPredicate predicate, BiConsumer output); TickContainerAccess getBlockTicks(); @@ -116,23 +116,23 @@ public interface CloAccess extends BlockGetter, BiomeManager.NoiseBiomeSource, L @Nullable BlendingData getBlendingData(); - void setBlendingData(BlendingData p_187646_); + void setBlendingData(BlendingData blendingData); long getInhabitedTime(); - void incrementInhabitedTime(long p_187633_); + void incrementInhabitedTime(long amount); - void setInhabitedTime(long p_62099_); + void setInhabitedTime(long inhabitedTime); boolean isLightCorrect(); - void setLightCorrect(boolean p_62100_); + void setLightCorrect(boolean lightCorrect); - NoiseChunk getOrCreateNoiseChunk(Function p_223013_); + NoiseChunk getOrCreateNoiseChunk(Function noiseChunkCreator); - @Deprecated BiomeGenerationSettings carverBiome(Supplier p_223015_); + @Deprecated BiomeGenerationSettings carverBiome(Supplier carverBiomeSettingsProvider); - void fillBiomesFromNoise(BiomeResolver p_187638_, Climate.Sampler p_187639_); + void fillBiomesFromNoise(BiomeResolver resolver, Climate.Sampler sampler); boolean hasAnyStructureReferences(); diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/chunklike/LevelClo.java b/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/chunklike/LevelClo.java index bf82a65c..0cf7db61 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/chunklike/LevelClo.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/chunklike/LevelClo.java @@ -18,26 +18,26 @@ import net.minecraft.world.level.material.FluidState; public interface LevelClo extends CloAccess { - FluidState getFluidState(int p_62815_, int p_62816_, int p_62817_); + FluidState getFluidState(int x, int y, int z); @Nullable - BlockEntity getBlockEntity(BlockPos p_62868_, LevelChunk.EntityCreationType p_62869_); + BlockEntity getBlockEntity(BlockPos pos, LevelChunk.EntityCreationType creationType); - void addAndRegisterBlockEntity(BlockEntity p_156391_); + void addAndRegisterBlockEntity(BlockEntity blockEntity); - boolean isTicking(BlockPos p_156411_); + boolean isTicking(BlockPos pos); void runPostLoad(); boolean isEmpty(); void replaceWithPacketData( - FriendlyByteBuf p_187972_, CompoundTag p_187973_, Consumer p_187974_ + FriendlyByteBuf buffer, CompoundTag tag, Consumer outputTagConsumer ); - void replaceBiomes(FriendlyByteBuf p_275574_); + void replaceBiomes(FriendlyByteBuf buffer); - void setLoaded(boolean p_62914_); + void setLoaded(boolean loaded); Level getLevel(); @@ -45,15 +45,15 @@ void replaceWithPacketData( void postProcessGeneration(); - void unpackTicks(long p_187986_); + void unpackTicks(long pos); - void registerTickContainerInLevel(ServerLevel p_187959_); + void registerTickContainerInLevel(ServerLevel level); - void unregisterTickContainerFromLevel(ServerLevel p_187980_); + void unregisterTickContainerFromLevel(ServerLevel level); FullChunkStatus getFullStatus(); - void setFullStatus(Supplier p_62880_); + void setFullStatus(Supplier fullStatus); void clearAllBlockEntities(); diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/chunklike/ProtoClo.java b/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/chunklike/ProtoClo.java index cbaa3312..9b7ec2e3 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/chunklike/ProtoClo.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/chunklike/ProtoClo.java @@ -20,24 +20,24 @@ public interface ProtoClo extends CloAccess { Map getBlockEntities(); - void addEntity(CompoundTag p_63243_); + void addEntity(CompoundTag tag); List getEntities(); - void setStatus(ChunkStatus p_63187_); + void setStatus(ChunkStatus status); Map getBlockEntityNbts(); @Nullable - CarvingMask getCarvingMask(GenerationStep.Carving p_188185_); + CarvingMask getCarvingMask(GenerationStep.Carving step); - CarvingMask getOrCreateCarvingMask(GenerationStep.Carving p_188191_); + CarvingMask getOrCreateCarvingMask(GenerationStep.Carving step); - void setCarvingMask(GenerationStep.Carving p_188187_, CarvingMask p_188188_); + void setCarvingMask(GenerationStep.Carving step, CarvingMask carvingMask); - void setLightEngine(LevelLightEngine p_63210_); + void setLightEngine(LevelLightEngine lightEngine); - void setBelowZeroRetrogen(@Nullable BelowZeroRetrogen p_188184_); + void setBelowZeroRetrogen(@Nullable BelowZeroRetrogen belowZeroRetrogen); LevelChunkTicks unpackBlockTicks(); diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/cube/CubeAccess.java b/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/cube/CubeAccess.java index b2038e31..5fe01f77 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/cube/CubeAccess.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/cube/CubeAccess.java @@ -104,19 +104,19 @@ public CubeAccess( replaceMissingSections(biomeRegistry, this.sections); } - private static void replaceMissingSections(Registry p_281389_, LevelChunkSection[] p_282796_) { - for(int i = 0; i < p_282796_.length; ++i) { - if (p_282796_[i] == null) { - p_282796_[i] = new LevelChunkSection(p_281389_); + private static void replaceMissingSections(Registry biomeRegistry, LevelChunkSection[] sections) { + for(int i = 0; i < sections.length; ++i) { + if (sections[i] == null) { + sections[i] = new LevelChunkSection(biomeRegistry); } } } - @Override @Nullable public abstract BlockState setBlockState(BlockPos p_62087_, BlockState p_62088_, boolean p_62089_); + @Override @Nullable public abstract BlockState setBlockState(BlockPos pos, BlockState state, boolean isMoving); - @Override public abstract void setBlockEntity(BlockEntity p_156114_); + @Override public abstract void setBlockEntity(BlockEntity blockEntity); - @Override public abstract void addEntity(Entity p_62078_); + @Override public abstract void addEntity(Entity entity); // Next two methods are used for vanilla heightmaps/lighting/end gateways. We shouldn't need these @Override public int getHighestFilledSectionIndex() { @@ -135,25 +135,25 @@ private static void replaceMissingSections(Registry p_281389_, LevelChunk @Override public native LevelChunkSection[] getSections(); @TransformFrom(copyFrom = @CopyFrom(clazz = ChunkAccess.class), value = "getSection(I)Lnet/minecraft/world/level/chunk/LevelChunkSection;") - @Override public native LevelChunkSection getSection(int p_187657_); + @Override public native LevelChunkSection getSection(int index); // TODO (P2) heightmap methods on cubes @Override public Collection> getHeightmaps() { throw new UnsupportedOperationException(); } - @Override public void setHeightmap(Heightmap.Types p_62083_, long[] p_62084_) { + @Override public void setHeightmap(Heightmap.Types type, long[] data) { } - @Override public Heightmap getOrCreateHeightmapUnprimed(Heightmap.Types p_62079_) { + @Override public Heightmap getOrCreateHeightmapUnprimed(Heightmap.Types type) { throw new UnsupportedOperationException(); } - @Override public boolean hasPrimedHeightmap(Heightmap.Types p_187659_) { + @Override public boolean hasPrimedHeightmap(Heightmap.Types type) { return false; } - @Override public int getHeight(Heightmap.Types p_62080_, int p_62081_, int p_62082_) { + @Override public int getHeight(Heightmap.Types type, int x, int z) { return CubicChunks.SUPERFLAT_HEIGHT; } // end heightmaps @@ -174,7 +174,7 @@ private static void replaceMissingSections(Registry p_281389_, LevelChunk @Override public native Map getAllStarts(); @TransformFrom(copyFrom = @CopyFrom(clazz = ChunkAccess.class), value = "setAllStarts(Ljava/util/Map;)V") - @Override public native void setAllStarts(Map p_62090_); + @Override public native void setAllStarts(Map structureStarts); @TransformFrom(copyFrom = @CopyFrom(clazz = ChunkAccess.class), value = "getReferencesForStructure(Lnet/minecraft/world/level/levelgen/structure/Structure;)" + "Lit/unimi/dsi/fastutil/longs/LongSet;") @@ -189,13 +189,13 @@ private static void replaceMissingSections(Registry p_281389_, LevelChunk @TransformFrom(copyFrom = @CopyFrom(clazz = ChunkAccess.class), value = "setAllReferences(Ljava/util/Map;)V") @Override public native void setAllReferences(Map p_187663_); - @Override public boolean isYSpaceEmpty(int p_62075_, int p_62076_) { + @Override public boolean isYSpaceEmpty(int startY, int endY) { // TODO return false; } @TransformFrom(copyFrom = @CopyFrom(clazz = ChunkAccess.class), value = "setUnsaved(Z)V") - @Override public native void setUnsaved(boolean p_62094_); + @Override public native void setUnsaved(boolean unsaved); @TransformFrom(copyFrom = @CopyFrom(clazz = ChunkAccess.class), value = "isUnsaved()Z") @Override public native boolean isUnsaved(); @@ -207,40 +207,40 @@ private static void replaceMissingSections(Registry p_281389_, LevelChunk return this.getStatus(); } - @Override public abstract void removeBlockEntity(BlockPos p_62101_); + @Override public abstract void removeBlockEntity(BlockPos pos); @TransformFrom(copyFrom = @CopyFrom(clazz = ChunkAccess.class), value = "markPosForPostprocessing(Lnet/minecraft/core/BlockPos;)V") - @Override public native void markPosForPostprocessing(BlockPos p_62102_); + @Override public native void markPosForPostprocessing(BlockPos pos); @TransformFrom(copyFrom = @CopyFrom(clazz = ChunkAccess.class), value = "getPostProcessing()[Lit/unimi/dsi/fastutil/shorts/ShortList;") @Override public native ShortList[] getPostProcessing(); @TransformFrom(copyFrom = @CopyFrom(clazz = ChunkAccess.class), value = "addPackedPostProcess(SI)V") - @Override public native void addPackedPostProcess(short p_62092_, int p_62093_); + @Override public native void addPackedPostProcess(short packedPosition, int index); @TransformFrom(copyFrom = @CopyFrom(clazz = ChunkAccess.class), value = "setBlockEntityNbt(Lnet/minecraft/nbt/CompoundTag;)V") - @Override public native void setBlockEntityNbt(CompoundTag p_62091_); + @Override public native void setBlockEntityNbt(CompoundTag tag); @TransformFrom(copyFrom = @CopyFrom(clazz = ChunkAccess.class), value = "getBlockEntityNbt(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/nbt/CompoundTag;") - @Override @Nullable public native CompoundTag getBlockEntityNbt(BlockPos p_62103_); + @Override @Nullable public native CompoundTag getBlockEntityNbt(BlockPos pos); @TransformFrom(copyFrom = @CopyFrom(clazz = ChunkAccess.class), value = "getBlockEntityNbtForSaving(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/nbt/CompoundTag;") - @Override @Nullable public native CompoundTag getBlockEntityNbtForSaving(BlockPos p_62104_); + @Override @Nullable public native CompoundTag getBlockEntityNbtForSaving(BlockPos pos); @TransformFrom(copyFrom = @CopyFrom(clazz = ChunkAccess.class), value = "findBlockLightSources(Ljava/util/function/BiConsumer;)V") @Override public native void findBlockLightSources(BiConsumer p_285269_); @TransformFrom(copyFrom = @CopyFrom(clazz = ChunkAccess.class), value = "findBlocks(Ljava/util/function/Predicate;Ljava/util/function/BiConsumer;)V") - @Override public native void findBlocks(Predicate p_285343_, BiConsumer p_285030_); + @Override public native void findBlocks(Predicate predicate, BiConsumer output); - @Override public void findBlocks(BiPredicate p_285343_, BiConsumer p_285030_) { + @Override public void findBlocks(BiPredicate predicate, BiConsumer output) { BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); for (int y = 0; y < CubicConstants.DIAMETER_IN_SECTIONS; y++) { for (int z = 0; z < CubicConstants.DIAMETER_IN_SECTIONS; z++) { for (int x = 0; x < CubicConstants.DIAMETER_IN_SECTIONS; x++) { LevelChunkSection levelchunksection = this.getSection(Coords.sectionToIndex(x, y, z)); - if (levelchunksection.maybeHas((state) -> p_285343_.test(state, BlockPos.ZERO))) { + if (levelchunksection.maybeHas((state) -> predicate.test(state, BlockPos.ZERO))) { BlockPos blockpos = this.cloPos.cubePos().asSectionPos().offset(x, y, z).origin(); for(int sectionLocalY = 0; sectionLocalY < SectionPos.SECTION_SIZE; ++sectionLocalY) { @@ -248,8 +248,8 @@ private static void replaceMissingSections(Registry p_281389_, LevelChunk for(int sectionLocalX = 0; sectionLocalX < SectionPos.SECTION_SIZE; ++sectionLocalX) { BlockState blockstate = levelchunksection.getBlockState(sectionLocalX, sectionLocalY, sectionLocalZ); mutableBlockPos.setWithOffset(blockpos, sectionLocalX, sectionLocalY, sectionLocalZ); - if (p_285343_.test(blockstate, mutableBlockPos.immutable())) { - p_285030_.accept(mutableBlockPos, blockstate); + if (predicate.test(blockstate, mutableBlockPos.immutable())) { + output.accept(mutableBlockPos, blockstate); } } } @@ -276,22 +276,22 @@ private static void replaceMissingSections(Registry p_281389_, LevelChunk @Override @Nullable public native BlendingData getBlendingData(); @TransformFrom(copyFrom = @CopyFrom(clazz = ChunkAccess.class), value = "setBlendingData(Lnet/minecraft/world/level/levelgen/blending/BlendingData;)V") - @Override public native void setBlendingData(BlendingData p_187646_); + @Override public native void setBlendingData(BlendingData blendingData); @TransformFrom(copyFrom = @CopyFrom(clazz = ChunkAccess.class), value = "getInhabitedTime()J") @Override public native long getInhabitedTime(); @TransformFrom(copyFrom = @CopyFrom(clazz = ChunkAccess.class), value = "incrementInhabitedTime(J)V") - @Override public native void incrementInhabitedTime(long p_187633_); + @Override public native void incrementInhabitedTime(long amount); @TransformFrom(copyFrom = @CopyFrom(clazz = ChunkAccess.class), value = "setInhabitedTime(J)V") - @Override public native void setInhabitedTime(long p_62099_); + @Override public native void setInhabitedTime(long inhabitedTime); @TransformFrom(copyFrom = @CopyFrom(clazz = ChunkAccess.class), value = "isLightCorrect()Z") @Override public native boolean isLightCorrect(); @TransformFrom(copyFrom = @CopyFrom(clazz = ChunkAccess.class), value = "setLightCorrect(Z)V") - @Override public native void setLightCorrect(boolean p_62100_); + @Override public native void setLightCorrect(boolean lightCorrect); @TransformFrom(copyFrom = @CopyFrom(clazz = ChunkAccess.class), value = "getMinBuildHeight()I") @Override public native int getMinBuildHeight(); @@ -299,11 +299,11 @@ private static void replaceMissingSections(Registry p_281389_, LevelChunk @TransformFrom(copyFrom = @CopyFrom(clazz = ChunkAccess.class), value = "getHeight()I") @Override public native int getHeight(); - @Override public NoiseChunk getOrCreateNoiseChunk(Function p_223013_) { + @Override public NoiseChunk getOrCreateNoiseChunk(Function noiseChunkCreator) { throw new UnsupportedOperationException(); // TODO P3 } - @Override public BiomeGenerationSettings carverBiome(Supplier p_223015_) { + @Override public BiomeGenerationSettings carverBiome(Supplier carverBiomeSettingsProvider) { throw new UnsupportedOperationException(); // TODO P3 } @@ -311,7 +311,7 @@ private static void replaceMissingSections(Registry p_281389_, LevelChunk throw new UnsupportedOperationException(); // TODO P3 } - @Override public void fillBiomesFromNoise(BiomeResolver p_187638_, Climate.Sampler p_187639_) { + @Override public void fillBiomesFromNoise(BiomeResolver resolver, Climate.Sampler sampler) { throw new UnsupportedOperationException(); // TODO P3 } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/cube/LevelCube.java b/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/cube/LevelCube.java index 5242cc22..175b1db2 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/cube/LevelCube.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/cube/LevelCube.java @@ -78,23 +78,23 @@ public class LevelCube extends CubeAccess implements LevelClo { private final LevelChunkTicks fluidTicks; // Constructors mirroring vanilla signatures - public LevelCube(Level p_187945_, CloPos p_187946_) { - this(p_187945_, p_187946_, UpgradeData.EMPTY, new LevelChunkTicks<>(), new LevelChunkTicks<>(), 0L, null, null, null); + public LevelCube(Level level, CloPos pos) { + this(level, pos, UpgradeData.EMPTY, new LevelChunkTicks<>(), new LevelChunkTicks<>(), 0L, null, null, null); } public LevelCube( - Level p_196854_, - CloPos p_196855_, - UpgradeData p_196856_, - LevelChunkTicks p_196857_, - LevelChunkTicks p_196858_, - long p_196859_, - @Nullable LevelChunkSection[] p_196860_, - @Nullable PostLoadProcessor p_196861_, - @Nullable BlendingData p_196862_ + Level level, + CloPos pos, + UpgradeData data, + LevelChunkTicks blockTicks, + LevelChunkTicks fluidTicks, + long inhabitedTime, + @Nullable LevelChunkSection[] sections, + @Nullable PostLoadProcessor postLoad, + @Nullable BlendingData blendingData ) { - super(p_196855_, p_196856_, p_196854_, p_196854_.registryAccess().registryOrThrow(Registries.BIOME), p_196859_, p_196860_, p_196862_); - this.level = p_196854_; + super(pos, data, level, level.registryAccess().registryOrThrow(Registries.BIOME), inhabitedTime, sections, blendingData); + this.level = level; this.gameEventListenerRegistrySections = new Int2ObjectOpenHashMap<>(); for(Heightmap.Types heightmap$types : Heightmap.Types.values()) { @@ -104,46 +104,46 @@ public LevelCube( } } - this.postLoad = p_196861_; - this.blockTicks = p_196857_; - this.fluidTicks = p_196858_; + this.postLoad = postLoad; + this.blockTicks = blockTicks; + this.fluidTicks = fluidTicks; } - public LevelCube(ServerLevel p_196850_, ProtoCube p_196851_, @Nullable PostLoadProcessor p_196852_) { + public LevelCube(ServerLevel level, ProtoCube cube, @Nullable PostLoadProcessor postLoad) { this( - p_196850_, - p_196851_.cc_getCloPos(), - p_196851_.getUpgradeData(), - p_196851_.unpackBlockTicks(), - p_196851_.unpackFluidTicks(), - p_196851_.getInhabitedTime(), - p_196851_.getSections(), - p_196852_, - p_196851_.getBlendingData() + level, + cube.cc_getCloPos(), + cube.getUpgradeData(), + cube.unpackBlockTicks(), + cube.unpackFluidTicks(), + cube.getInhabitedTime(), + cube.getSections(), + postLoad, + cube.getBlendingData() ); - for(BlockEntity blockentity : p_196851_.getBlockEntities().values()) { + for(BlockEntity blockentity : cube.getBlockEntities().values()) { this.setBlockEntity(blockentity); } - this.pendingBlockEntities.putAll(p_196851_.getBlockEntityNbts()); + this.pendingBlockEntities.putAll(cube.getBlockEntityNbts()); - for(int i = 0; i < p_196851_.getPostProcessing().length; ++i) { - this.postProcessing[i] = p_196851_.getPostProcessing()[i]; + for(int i = 0; i < cube.getPostProcessing().length; ++i) { + this.postProcessing[i] = cube.getPostProcessing()[i]; } - this.setAllStarts(p_196851_.getAllStarts()); - this.setAllReferences(p_196851_.getAllReferences()); + this.setAllStarts(cube.getAllStarts()); + this.setAllReferences(cube.getAllReferences()); - for(Map.Entry entry : p_196851_.getHeightmaps()) { + for(Map.Entry entry : cube.getHeightmaps()) { if (ChunkStatus.FULL.heightmapsAfter().contains(entry.getKey())) { // TODO (P2) heightmaps // this.setHeightmap(entry.getKey(), entry.getValue().getRawData()); } } - this.skyLightSources = p_196851_.skyLightSources; - this.setLightCorrect(p_196851_.isLightCorrect()); + this.skyLightSources = cube.skyLightSources; + this.setLightCorrect(cube.isLightCorrect()); this.unsaved = true; } @@ -169,10 +169,10 @@ public LevelCube(ServerLevel p_196850_, ProtoCube p_196851_, @Nullable PostLoadP // dasm + mixin @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "getFluidState(III)Lnet/minecraft/world/level/material/FluidState;") - @Override public native FluidState getFluidState(int p_62815_, int p_62816_, int p_62817_); + @Override public native FluidState getFluidState(int x, int y, int z); // TODO might be dasm-able eventually, if we get more powerful mixin tools - @Nullable @Override public BlockState setBlockState(BlockPos pos, BlockState state, boolean p_62867_) { + @Nullable @Override public BlockState setBlockState(BlockPos pos, BlockState state, boolean isMoving) { var chunkSection = this.getSection(Coords.blockToIndex(pos)); boolean isOnlyAir = chunkSection.hasOnlyAir(); if (isOnlyAir && state.isAir()) { @@ -190,7 +190,7 @@ public LevelCube(ServerLevel p_196850_, ProtoCube p_196851_, @Nullable PostLoadP boolean flag2 = previousState.hasBlockEntity(); if (!this.level.isClientSide) { - previousState.onRemove(this.level, pos, state, p_62867_); + previousState.onRemove(this.level, pos, state, isMoving); } else if ((!previousState.is(block) || !state.hasBlockEntity()) && flag2) { this.removeBlockEntity(pos); } @@ -199,7 +199,7 @@ public LevelCube(ServerLevel p_196850_, ProtoCube p_196851_, @Nullable PostLoadP return null; } else { if (!this.level.isClientSide && !this.level.captureBlockSnapshots) { - state.onPlace(this.level, pos, previousState, p_62867_); + state.onPlace(this.level, pos, previousState, isMoving); } if (state.hasBlockEntity()) { @@ -223,47 +223,47 @@ public LevelCube(ServerLevel p_196850_, ProtoCube p_196851_, @Nullable PostLoadP } @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "addEntity(Lnet/minecraft/world/entity/Entity;)V") - @Deprecated @Override public native void addEntity(Entity p_62826_); + @Deprecated @Override public native void addEntity(Entity entity); @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "createBlockEntity(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/block/entity/BlockEntity;") - @Nullable private native BlockEntity createBlockEntity(BlockPos p_62935_); + @Nullable private native BlockEntity createBlockEntity(BlockPos pos); @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "getBlockEntity(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/block/entity/BlockEntity;") - @Override @Nullable public native BlockEntity getBlockEntity(BlockPos p_62912_); + @Override @Nullable public native BlockEntity getBlockEntity(BlockPos pos); @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "getBlockEntity(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/chunk/LevelChunk$EntityCreationType;)" + "Lnet/minecraft/world/level/block/entity/BlockEntity;") - @Nullable public native BlockEntity getBlockEntity(BlockPos p_62868_, LevelChunk.EntityCreationType p_62869_); + @Nullable public native BlockEntity getBlockEntity(BlockPos pos, LevelChunk.EntityCreationType creationType); @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "addAndRegisterBlockEntity(Lnet/minecraft/world/level/block/entity/BlockEntity;)V") - public native void addAndRegisterBlockEntity(BlockEntity p_156391_); + public native void addAndRegisterBlockEntity(BlockEntity blockEntity); @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "isInLevel()Z") private native boolean isInLevel(); @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "isTicking(Lnet/minecraft/core/BlockPos;)Z") - public native boolean isTicking(BlockPos p_156411_); + public native boolean isTicking(BlockPos pos); @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "setBlockEntity(Lnet/minecraft/world/level/block/entity/BlockEntity;)V") - @Override public native void setBlockEntity(BlockEntity p_156374_); + @Override public native void setBlockEntity(BlockEntity blockEntity); @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "getBlockEntityNbtForSaving(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/nbt/CompoundTag;") - @Override @Nullable public native CompoundTag getBlockEntityNbtForSaving(BlockPos p_62932_); + @Override @Nullable public native CompoundTag getBlockEntityNbtForSaving(BlockPos pos); @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "removeBlockEntity(Lnet/minecraft/core/BlockPos;)V") - @Override public native void removeBlockEntity(BlockPos p_62919_); + @Override public native void removeBlockEntity(BlockPos pos); // TODO maybe shouldn't be dasm @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "removeGameEventListener(Lnet/minecraft/world/level/block/entity/BlockEntity;" + "Lnet/minecraft/server/level/ServerLevel;" + ")V") - private native void removeGameEventListener(T p_223413_, ServerLevel p_223414_); + private native void removeGameEventListener(T blockEntity, ServerLevel level); @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "removeGameEventListenerRegistry(I)V") private native void removeGameEventListenerRegistry(int p_283355_); @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "removeBlockEntityTicker(Lnet/minecraft/core/BlockPos;)V") - private native void removeBlockEntityTicker(BlockPos p_156413_); + private native void removeBlockEntityTicker(BlockPos pos); @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "runPostLoad()V") public native void runPostLoad(); @@ -272,19 +272,19 @@ public LevelCube(ServerLevel p_196850_, ProtoCube p_196851_, @Nullable PostLoadP public native boolean isEmpty(); public void replaceWithPacketData( - FriendlyByteBuf p_187972_, CompoundTag p_187973_, Consumer p_187974_ + FriendlyByteBuf buffer, CompoundTag tag, Consumer outputTagConsumer ) { this.clearAllBlockEntities(); for(LevelChunkSection levelchunksection : this.sections) { - levelchunksection.read(p_187972_); + levelchunksection.read(buffer); } // TODO (P2) heightmaps - see vanilla equivalent // TODO (P2) lighting // this.initializeLightSources(); - p_187974_.accept((p_187968_, p_187969_, p_187970_) -> { + outputTagConsumer.accept((p_187968_, p_187969_, p_187970_) -> { BlockEntity blockentity = this.getBlockEntity(p_187968_, LevelChunk.EntityCreationType.IMMEDIATE); if (blockentity != null && p_187970_ != null && blockentity.getType() == p_187969_) { blockentity.handleUpdateTag(p_187970_); @@ -293,10 +293,10 @@ public void replaceWithPacketData( } @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "replaceBiomes(Lnet/minecraft/network/FriendlyByteBuf;)V") - public native void replaceBiomes(FriendlyByteBuf p_275574_); + public native void replaceBiomes(FriendlyByteBuf buffer); @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "setLoaded(Z)V") - public native void setLoaded(boolean p_62914_); + public native void setLoaded(boolean loaded); @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "getLevel()Lnet/minecraft/world/level/Level;") public native Level getLevel(); @@ -324,13 +324,13 @@ public void postProcessGeneration() { @Nullable private native BlockEntity promotePendingBlockEntity(BlockPos p_62871_, CompoundTag p_62872_); @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "unpackTicks(J)V") - public native void unpackTicks(long p_187986_); + public native void unpackTicks(long pos); @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "registerTickContainerInLevel(Lnet/minecraft/server/level/ServerLevel;)V") - public native void registerTickContainerInLevel(ServerLevel p_187959_); + public native void registerTickContainerInLevel(ServerLevel level); @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "unregisterTickContainerFromLevel(Lnet/minecraft/server/level/ServerLevel;)V") - public native void unregisterTickContainerFromLevel(ServerLevel p_187980_); + public native void unregisterTickContainerFromLevel(ServerLevel level); @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "getStatus()Lnet/minecraft/world/level/chunk/ChunkStatus;") @Override public native ChunkStatus getStatus(); @@ -339,7 +339,7 @@ public void postProcessGeneration() { public native FullChunkStatus getFullStatus(); @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "setFullStatus(Ljava/util/function/Supplier;)V") - public native void setFullStatus(Supplier p_62880_); + public native void setFullStatus(Supplier fullStatus); // TODO a bit concerning @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "clearAllBlockEntities()V") @@ -351,15 +351,15 @@ public void postProcessGeneration() { // TODO (P3): GameEvent stuff is a bit concerning @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "addGameEventListener(Lnet/minecraft/world/level/block/entity/BlockEntity;" + "Lnet/minecraft/server/level/ServerLevel;)V") - private native void addGameEventListener(T p_223416_, ServerLevel p_223417_); + private native void addGameEventListener(T blockEntity, ServerLevel level); @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "updateBlockEntityTicker(Lnet/minecraft/world/level/block/entity/BlockEntity;)V") - private native void updateBlockEntityTicker(T p_156407_); + private native void updateBlockEntityTicker(T blockEntity); @TransformFrom(copyFrom = @CopyFrom(clazz = LevelChunk.class), value = "createTicker(Lnet/minecraft/world/level/block/entity/BlockEntity;" + "Lnet/minecraft/world/level/block/entity/BlockEntityTicker;)" + "Lnet/minecraft/world/level/block/entity/TickingBlockEntity;") - private native TickingBlockEntity createTicker(T p_156376_, BlockEntityTicker p_156377_); + private native TickingBlockEntity createTicker(T blockEntity, BlockEntityTicker ticker); // TODO forge stuff // FORGE START @@ -390,7 +390,7 @@ class BoundTickingBlockEntity implements TickingBlockEnti private final BlockEntityTicker ticker; private boolean loggedInvalidBlockState; - BoundTickingBlockEntity(T p_156433_, BlockEntityTicker p_156434_) { + BoundTickingBlockEntity(T blockEntity, BlockEntityTicker ticker) { throw new IllegalStateException("DASM failed to apply"); } @@ -407,7 +407,7 @@ class BoundTickingBlockEntity implements TickingBlockEnti @FunctionalInterface public interface PostLoadProcessor { - void run(LevelCube p_196867_); + void run(LevelCube cube); } @DasmRedirect({ "cubeAccessAndDescendants" }) @@ -415,7 +415,7 @@ public interface PostLoadProcessor { public class RebindableTickingBlockEntityWrapper implements TickingBlockEntity { private TickingBlockEntity ticker; - RebindableTickingBlockEntityWrapper(TickingBlockEntity p_156447_) { + RebindableTickingBlockEntityWrapper(TickingBlockEntity ticker) { throw new IllegalStateException("DASM failed to apply"); } diff --git a/src/test/java/io/github/opencubicchunks/cubicchunks/test/world/level/cube/TestCubeAccess.java b/src/test/java/io/github/opencubicchunks/cubicchunks/test/world/level/cube/TestCubeAccess.java index a32c4581..4282f3b5 100644 --- a/src/test/java/io/github/opencubicchunks/cubicchunks/test/world/level/cube/TestCubeAccess.java +++ b/src/test/java/io/github/opencubicchunks/cubicchunks/test/world/level/cube/TestCubeAccess.java @@ -57,19 +57,19 @@ public CubeAccessTestImpl(CloPos cloPos, UpgradeData upgradeData, return null; } - @Override public @Nullable BlockState setBlockState(BlockPos blockPos, BlockState state, boolean unused) { - int sectionIndex = Coords.blockToIndex(blockPos); - int localX = Coords.blockToSectionLocal(blockPos.getX()); - int localY = Coords.blockToSectionLocal(blockPos.getY()); - int localZ = Coords.blockToSectionLocal(blockPos.getZ()); + @Override public @Nullable BlockState setBlockState(BlockPos pos, BlockState state, boolean isMoving) { + int sectionIndex = Coords.blockToIndex(pos); + int localX = Coords.blockToSectionLocal(pos.getX()); + int localY = Coords.blockToSectionLocal(pos.getY()); + int localZ = Coords.blockToSectionLocal(pos.getZ()); return this.sections[sectionIndex].setBlockState(localX, localY, localZ, state); } - @Override public void setBlockEntity(BlockEntity p_156114_) { + @Override public void setBlockEntity(BlockEntity blockEntity) { } - @Override public void addEntity(Entity p_62078_) { + @Override public void addEntity(Entity entity) { } @@ -77,7 +77,7 @@ public CubeAccessTestImpl(CloPos cloPos, UpgradeData upgradeData, return null; } - @Override public void removeBlockEntity(BlockPos p_62101_) { + @Override public void removeBlockEntity(BlockPos pos) { } @@ -93,15 +93,15 @@ public CubeAccessTestImpl(CloPos cloPos, UpgradeData upgradeData, return null; } - @Nullable @Override public BlockEntity getBlockEntity(BlockPos p_45570_) { + @Nullable @Override public BlockEntity getBlockEntity(BlockPos pos) { return null; } - @Override public BlockState getBlockState(BlockPos p_45571_) { + @Override public BlockState getBlockState(BlockPos pos) { return null; } - @Override public FluidState getFluidState(BlockPos p_45569_) { + @Override public FluidState getFluidState(BlockPos pos) { return null; } }