From 3e6250e62f1de0dbd55035c23cf0660f198e6742 Mon Sep 17 00:00:00 2001 From: CursedFlames <18627001+CursedFlames@users.noreply.github.com> Date: Mon, 22 Jan 2024 15:15:48 +1300 Subject: [PATCH] update param names A few things still aren't mapped in parchment; everything else should now be mapped. --- .../core/common/world/level/MixinLevel.java | 74 +++++++++---------- .../level/MinecraftServerTestAccess.java | 4 +- .../test/world/level/TestCubicLevel.java | 44 +++++------ 3 files changed, 61 insertions(+), 61 deletions(-) diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/level/MixinLevel.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/level/MixinLevel.java index 6d148d43..ec8b9a7b 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/level/MixinLevel.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/level/MixinLevel.java @@ -38,7 +38,7 @@ @Mixin(Level.class) public abstract class MixinLevel implements CubicLevel, MarkableAsCubic, LevelAccessor { - @Shadow @Nullable public abstract ChunkAccess getChunk(int p_46502_, int p_46503_, ChunkStatus p_46504_, boolean p_46505_); + @Shadow @Nullable public abstract ChunkAccess getChunk(int x, int z, ChunkStatus requiredStatus, boolean nonnull); @Shadow public abstract long getDayTime(); @@ -53,9 +53,9 @@ public void cc_setCubic() { return cc_isCubic; } - public LevelCube cc_getCubeAt(BlockPos blockPos) { - return (LevelCube)((CubicLevelReader)this).cc_getCube(Coords.blockToCube(blockPos.getX()), Coords.blockToCube(blockPos.getY()), - Coords.blockToCube(blockPos.getZ())); + public LevelCube cc_getCubeAt(BlockPos pos) { + return (LevelCube)((CubicLevelReader)this).cc_getCube(Coords.blockToCube(pos.getX()), Coords.blockToCube(pos.getY()), + Coords.blockToCube(pos.getZ())); } public LevelCube cc_getCube(int x, int y, int z) { @@ -64,9 +64,9 @@ public LevelCube cc_getCube(int x, int y, int z) { @Nullable @Override - public CubeAccess cc_getCube(int cubeX, int cubeY, int cubeZ, ChunkStatus status, boolean forceLoad) { - CubeAccess cubeaccess = ((CubicChunkSource)this.getChunkSource()).cc_getCube(cubeX, cubeY, cubeZ, status, forceLoad); - if (cubeaccess == null && forceLoad) { + public CubeAccess cc_getCube(int cubeX, int cubeY, int cubeZ, ChunkStatus requiredStatus, boolean nonnull) { + CubeAccess cubeaccess = ((CubicChunkSource)this.getChunkSource()).cc_getCube(cubeX, cubeY, cubeZ, requiredStatus, nonnull); + if (cubeaccess == null && nonnull) { throw new IllegalStateException("Should always be able to create a cube!"); } else { return cubeaccess; @@ -76,22 +76,22 @@ public CubeAccess cc_getCube(int cubeX, int cubeY, int cubeZ, ChunkStatus status // setBlock @WrapOperation(method = "setBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;II)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level" + "/Level;getChunkAt(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/chunk/LevelChunk;")) - private LevelChunk cc_replaceLevelChunkInGetChunkAt(Level level, BlockPos blockPos, Operation original, @Share("levelCube") LocalRef levelCubeLocalRef) { + private LevelChunk cc_replaceLevelChunkInGetChunkAt(Level level, BlockPos pos, Operation original, @Share("levelCube") LocalRef levelCubeLocalRef) { if(cc_isCubic) { - levelCubeLocalRef.set(this.cc_getCubeAt(blockPos)); + levelCubeLocalRef.set(this.cc_getCubeAt(pos)); return null; } - return original.call(level, blockPos); + return original.call(level, pos); } @WrapOperation(method = "setBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;II)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/chunk/LevelChunk;setBlockState(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Z)Lnet/minecraft/world/level/block/state/BlockState;")) - private BlockState cc_replaceLevelChunkInSetBlockState(LevelChunk levelChunk, BlockPos blockPos, BlockState blockState, boolean flag1, Operation original, + private BlockState cc_replaceLevelChunkInSetBlockState(LevelChunk levelChunk, BlockPos pos, BlockState state, boolean isMoving, Operation original, @Share("levelCube") LocalRef levelCubeLocalRef) { if(cc_isCubic) { - levelCubeLocalRef.get().setBlockState(blockPos, blockState, flag1); + levelCubeLocalRef.get().setBlockState(pos, state, isMoving); return null; } - return original.call(levelChunk, blockPos, blockState, flag1); + return original.call(levelChunk, pos, state, isMoving); } @WrapWithCondition(method = "setBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;II)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;markAndNotifyBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/chunk/LevelChunk;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/state/BlockState;II)V")) @@ -109,62 +109,62 @@ private boolean cc_replaceLevelChunkInMarkAndNotifyBlock(Level level, BlockPos b // getBlockState @Inject(method = "getBlockState", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;getChunk(II)Lnet/minecraft/world/level/chunk/LevelChunk;")) - private void cc_replaceLevelChunkInGetBlockState(BlockPos blockPos, CallbackInfoReturnable cir, @Share("levelCube") LocalRef levelCubeLocalRef) { + private void cc_replaceLevelChunkInGetBlockState(BlockPos pos, CallbackInfoReturnable cir, @Share("levelCube") LocalRef levelCubeLocalRef) { if(cc_isCubic) { - levelCubeLocalRef.set(this.cc_getCubeAt(blockPos)); + levelCubeLocalRef.set(this.cc_getCubeAt(pos)); } } @WrapOperation(method = "getBlockState", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/chunk/LevelChunk;getBlockState(Lnet/minecraft/core/BlockPos;)" + "Lnet/minecraft/world/level/block/state/BlockState;")) - private BlockState cc_replaceLevelChunkInGetBlockState(LevelChunk levelChunk, BlockPos blockPos, Operation original, + private BlockState cc_replaceLevelChunkInGetBlockState(LevelChunk levelChunk, BlockPos pos, Operation original, @Share("levelCube") LocalRef levelCubeLocalRef) { if(cc_isCubic) { - return levelCubeLocalRef.get().getBlockState(blockPos); + return levelCubeLocalRef.get().getBlockState(pos); } - return original.call(levelChunk, blockPos); + return original.call(levelChunk, pos); } // getBlockEntity @Inject(method = "getBlockEntity", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;getChunkAt(Lnet/minecraft/core/BlockPos;)" + "Lnet/minecraft/world/level/chunk/LevelChunk;"), cancellable = true) - private void cc_replaceGetChunkAtInSetBlockEntity(BlockPos blockPos, CallbackInfoReturnable cir) { + private void cc_replaceGetChunkAtInSetBlockEntity(BlockPos pos, CallbackInfoReturnable cir) { if(cc_isCubic) { - cir.setReturnValue(this.cc_getCubeAt(blockPos).getBlockEntity(blockPos, LevelChunk.EntityCreationType.IMMEDIATE)); + cir.setReturnValue(this.cc_getCubeAt(pos).getBlockEntity(pos, LevelChunk.EntityCreationType.IMMEDIATE)); } } // getFluidState @WrapOperation(method = "getFluidState", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/chunk/LevelChunk;getFluidState(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/material/FluidState;")) - private FluidState cc_replaceGetChunkAtInGetFluidState(LevelChunk levelChunk, BlockPos blockPos, Operation original) { + private FluidState cc_replaceGetChunkAtInGetFluidState(LevelChunk levelChunk, BlockPos pos, Operation original) { if(cc_isCubic) { - return this.cc_getCubeAt(blockPos).getFluidState(blockPos); + return this.cc_getCubeAt(pos).getFluidState(pos); } - return original.call(levelChunk, blockPos); + return original.call(levelChunk, pos); } // setBlockEntity @Inject(method = "setBlockEntity", at = @At(value="INVOKE", target="Lnet/minecraft/world/level/Level;getChunkAt(Lnet/minecraft/core/BlockPos;)" + "Lnet/minecraft/world/level/chunk/LevelChunk;"), cancellable=true) - private void cc_replaceLevelChunkInSetBlockEntity(BlockEntity blockEntity, CallbackInfo ci, @Local(ordinal = 0) BlockPos blockPos) { + private void cc_replaceLevelChunkInSetBlockEntity(BlockEntity blockEntity, CallbackInfo ci, @Local(ordinal = 0) BlockPos pos) { if(cc_isCubic) { - this.cc_getCubeAt(blockPos).addAndRegisterBlockEntity(blockEntity); + this.cc_getCubeAt(pos).addAndRegisterBlockEntity(blockEntity); ci.cancel(); } } // removeBlockEntity @Inject(method = "removeBlockEntity", at = @At(value="INVOKE", target="Lnet/minecraft/world/level/Level;getChunkAt(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/chunk/LevelChunk;"), cancellable=true) - private void cc_replaceGetChunkAtInRemoveBlockEntity(BlockPos blockPos, CallbackInfo ci) { + private void cc_replaceGetChunkAtInRemoveBlockEntity(BlockPos pos, CallbackInfo ci) { if(cc_isCubic) { - this.cc_getCubeAt(blockPos).removeBlockEntity(blockPos); + this.cc_getCubeAt(pos).removeBlockEntity(pos); ci.cancel(); } } // isLoaded @WrapOperation(method = "isLoaded", at = @At(value="INVOKE", target="Lnet/minecraft/world/level/chunk/ChunkSource;hasChunk(II)Z")) - private boolean cc_replaceHasChunkInIsLoaded(ChunkSource chunkSource, int x, int z, Operation original, BlockPos blockPos) { + private boolean cc_replaceHasChunkInIsLoaded(ChunkSource chunkSource, int chunkX, int chunkZ, Operation original, BlockPos blockPos) { if(cc_isCubic) { return ((CubicChunkSource)this.getChunkSource()).cc_hasCube(Coords.blockToCube(blockPos.getX()), Coords.blockToCube(blockPos.getY()), Coords.blockToCube(blockPos.getZ())); } @@ -174,19 +174,19 @@ private boolean cc_replaceHasChunkInIsLoaded(ChunkSource chunkSource, int x, int // loadedAndEntityCanStandOnFace @Inject(method = "loadedAndEntityCanStandOnFace", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;getChunk(IILnet/minecraft/world/level/chunk/ChunkStatus;Z)" + "Lnet/minecraft/world/level/chunk/ChunkAccess;"), cancellable = true) - private void cc_replaceGetChunkAtInLoadedAndEntityCanStandOnFace(BlockPos blockPos, Entity entity, Direction direction, CallbackInfoReturnable cir) { + private void cc_replaceGetChunkAtInLoadedAndEntityCanStandOnFace(BlockPos pos, Entity entity, Direction direction, CallbackInfoReturnable cir) { if(cc_isCubic) { - CubeAccess cubeAccess = this.cc_getCube(Coords.blockToCube(blockPos.getX()), Coords.blockToCube(blockPos.getY()), Coords.blockToCube(blockPos.getZ()), ChunkStatus.FULL, false); - cir.setReturnValue(cubeAccess == null ? false : cubeAccess.getBlockState(blockPos).entityCanStandOnFace(this, blockPos, entity, direction)); + CubeAccess cubeAccess = this.cc_getCube(Coords.blockToCube(pos.getX()), Coords.blockToCube(pos.getY()), Coords.blockToCube(pos.getZ()), ChunkStatus.FULL, false); + cir.setReturnValue(cubeAccess == null ? false : cubeAccess.getBlockState(pos).entityCanStandOnFace(this, pos, entity, direction)); } } // blockEntityChanged @Inject(method = "blockEntityChanged", at = @At(value = "HEAD"), cancellable = true) - private void cc_replaceBlockEntityChanged(BlockPos blockPos, CallbackInfo ci) { + private void cc_replaceBlockEntityChanged(BlockPos pos, CallbackInfo ci) { if(cc_isCubic) { - if (this.cc_hasCubeAt(blockPos)) { - this.cc_getCubeAt(blockPos).setUnsaved(true); + if (this.cc_hasCubeAt(pos)) { + this.cc_getCubeAt(pos).setUnsaved(true); } ci.cancel(); } @@ -194,13 +194,13 @@ private void cc_replaceBlockEntityChanged(BlockPos blockPos, CallbackInfo ci) { // getCurrentDifficultyAt @Inject(method = "getCurrentDifficultyAt", at = @At(value = "HEAD"), cancellable = true) - private void cc_replaceGetCurrentDifficultyAt(BlockPos blockPos, CallbackInfoReturnable cir) { + private void cc_replaceGetCurrentDifficultyAt(BlockPos pos, CallbackInfoReturnable cir) { if(cc_isCubic) { long i = 0L; float f = 0.0F; - if (this.cc_hasCubeAt(blockPos)) { + if (this.cc_hasCubeAt(pos)) { f = this.getMoonBrightness(); - i = this.cc_getCubeAt(blockPos).getInhabitedTime(); + i = this.cc_getCubeAt(pos).getInhabitedTime(); } cir.setReturnValue(new DifficultyInstance(this.getDifficulty(), this.getDayTime(), i, f)); } diff --git a/src/test/java/io/github/opencubicchunks/cubicchunks/mixin/test/common/server/level/MinecraftServerTestAccess.java b/src/test/java/io/github/opencubicchunks/cubicchunks/mixin/test/common/server/level/MinecraftServerTestAccess.java index bac8adb4..357ad6d4 100644 --- a/src/test/java/io/github/opencubicchunks/cubicchunks/mixin/test/common/server/level/MinecraftServerTestAccess.java +++ b/src/test/java/io/github/opencubicchunks/cubicchunks/mixin/test/common/server/level/MinecraftServerTestAccess.java @@ -11,8 +11,8 @@ public interface MinecraftServerTestAccess { @Invoker(value = "prepareLevels") - void invoke_prepareLevels(ChunkProgressListener chunkProgressListener); + void invoke_prepareLevels(ChunkProgressListener listener); @Invoker(value = "setInitialSpawn") - void invoke_setInitialSpawn(ServerLevel serverLevel, ServerLevelData serverLevelData, boolean p_177899_, boolean p_177900_); + void invoke_setInitialSpawn(ServerLevel level, ServerLevelData levelData, boolean generateBonusChest, boolean debug); } diff --git a/src/test/java/io/github/opencubicchunks/cubicchunks/test/world/level/TestCubicLevel.java b/src/test/java/io/github/opencubicchunks/cubicchunks/test/world/level/TestCubicLevel.java index e285b5be..e65b6761 100644 --- a/src/test/java/io/github/opencubicchunks/cubicchunks/test/world/level/TestCubicLevel.java +++ b/src/test/java/io/github/opencubicchunks/cubicchunks/test/world/level/TestCubicLevel.java @@ -80,33 +80,33 @@ public static class TestLevel extends Level { ChunkSource mockChunkSource = mock(ChunkSource.class, RETURNS_DEEP_STUBS); public TestLevel( - WritableLevelData p_270739_, - ResourceKey p_270683_, - RegistryAccess p_270200_, - Holder p_270240_, - Supplier p_270692_, - boolean p_270904_, - boolean p_270470_, - long p_270248_, - int p_270466_ + WritableLevelData levelData, + ResourceKey dimension, + RegistryAccess registryAccess, + Holder dimensionTypeRegistration, + Supplier profiler, + boolean isClientSide, + boolean isDebug, + long biomeZoomSeed, + int maxChainedNeighborUpdates ) { - super(p_270739_, p_270683_, p_270200_, p_270240_, p_270692_, p_270904_, p_270470_, p_270248_, p_270466_); + super(levelData, dimension, registryAccess, dimensionTypeRegistration, profiler, isClientSide, isDebug, biomeZoomSeed, maxChainedNeighborUpdates); when(((CubicChunkSource)mockChunkSource).cc_getCube(anyInt(), anyInt(), anyInt(), anyBoolean())).thenReturn(mock(LevelCube.class)); when(((CubicChunkSource)mockChunkSource).cc_getCube(anyInt(), anyInt(), anyInt(), any(), anyBoolean())).thenReturn(mock(LevelCube.class)); } - @Override public void sendBlockUpdated(BlockPos p_46612_, BlockState p_46613_, BlockState p_46614_, int p_46615_) { + @Override public void sendBlockUpdated(BlockPos pos, BlockState oldState, BlockState newState, int flags) { } @Override - public void playSeededSound(@Nullable Player p_262953_, double p_263004_, double p_263398_, double p_263376_, Holder p_263359_, SoundSource p_263020_, float p_263055_, - float p_262914_, long p_262991_) { + public void playSeededSound(@Nullable Player player, double x, double y, double z, Holder sound, SoundSource category, float volume, + float pitch, long seed) { } @Override - public void playSeededSound(@Nullable Player p_220372_, Entity p_220373_, Holder p_263500_, SoundSource p_220375_, float p_220376_, float p_220377_, long p_220378_) { + public void playSeededSound(@Nullable Player player, Entity entity, Holder sound, SoundSource category, float volume, float pitch, long seed) { } @@ -114,7 +114,7 @@ public void playSeededSound(@Nullable Player p_220372_, Entity p_220373_, Holder return null; } - @Nullable @Override public Entity getEntity(int p_46492_) { + @Nullable @Override public Entity getEntity(int id) { return null; } @@ -122,11 +122,11 @@ public void playSeededSound(@Nullable Player p_220372_, Entity p_220373_, Holder return null; } - @Nullable @Override public MapItemSavedData getMapData(String p_46650_) { + @Nullable @Override public MapItemSavedData getMapData(String mapName) { return null; } - @Override public void setMapData(String p_151533_, MapItemSavedData p_151534_) { + @Override public void setMapData(String mapName, MapItemSavedData data) { } @@ -134,7 +134,7 @@ public void playSeededSound(@Nullable Player p_220372_, Entity p_220373_, Holder return 0; } - @Override public void destroyBlockProgress(int p_46506_, BlockPos p_46507_, int p_46508_) { + @Override public void destroyBlockProgress(int breakerId, BlockPos pos, int progress) { } @@ -162,15 +162,15 @@ public void playSeededSound(@Nullable Player p_220372_, Entity p_220373_, Holder return mockChunkSource; } - @Override public void levelEvent(@Nullable Player p_46771_, int p_46772_, BlockPos p_46773_, int p_46774_) { + @Override public void levelEvent(@Nullable Player player, int type, BlockPos pos, int data) { } - @Override public void gameEvent(GameEvent p_220404_, Vec3 p_220405_, GameEvent.Context p_220406_) { + @Override public void gameEvent(GameEvent event, Vec3 position, GameEvent.Context context) { } - @Override public float getShade(Direction p_45522_, boolean p_45523_) { + @Override public float getShade(Direction direction, boolean shade) { return 0; } @@ -178,7 +178,7 @@ public void playSeededSound(@Nullable Player p_220372_, Entity p_220373_, Holder return null; } - @Override public Holder getUncachedNoiseBiome(int p_204159_, int p_204160_, int p_204161_) { + @Override public Holder getUncachedNoiseBiome(int x, int y, int z) { return null; }