Skip to content

Commit

Permalink
update param names
Browse files Browse the repository at this point in the history
A few things still aren't mapped in parchment; everything else should now be mapped.
  • Loading branch information
CursedFlames committed Jan 22, 2024
1 parent 6055543 commit 3e6250e
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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) {
Expand All @@ -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;
Expand All @@ -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<LevelChunk> original, @Share("levelCube") LocalRef<LevelCube> levelCubeLocalRef) {
private LevelChunk cc_replaceLevelChunkInGetChunkAt(Level level, BlockPos pos, Operation<LevelChunk> original, @Share("levelCube") LocalRef<LevelCube> 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<BlockState> original,
private BlockState cc_replaceLevelChunkInSetBlockState(LevelChunk levelChunk, BlockPos pos, BlockState state, boolean isMoving, Operation<BlockState> original,
@Share("levelCube") LocalRef<LevelCube> 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"))
Expand All @@ -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<BlockState> cir, @Share("levelCube") LocalRef<LevelCube> levelCubeLocalRef) {
private void cc_replaceLevelChunkInGetBlockState(BlockPos pos, CallbackInfoReturnable<BlockState> cir, @Share("levelCube") LocalRef<LevelCube> 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<BlockState> original,
private BlockState cc_replaceLevelChunkInGetBlockState(LevelChunk levelChunk, BlockPos pos, Operation<BlockState> original,
@Share("levelCube") LocalRef<LevelCube> 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<BlockEntity> cir) {
private void cc_replaceGetChunkAtInSetBlockEntity(BlockPos pos, CallbackInfoReturnable<BlockEntity> 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<FluidState> original) {
private FluidState cc_replaceGetChunkAtInGetFluidState(LevelChunk levelChunk, BlockPos pos, Operation<FluidState> 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<Boolean> original, BlockPos blockPos) {
private boolean cc_replaceHasChunkInIsLoaded(ChunkSource chunkSource, int chunkX, int chunkZ, Operation<Boolean> original, BlockPos blockPos) {
if(cc_isCubic) {
return ((CubicChunkSource)this.getChunkSource()).cc_hasCube(Coords.blockToCube(blockPos.getX()), Coords.blockToCube(blockPos.getY()), Coords.blockToCube(blockPos.getZ()));
}
Expand All @@ -174,33 +174,33 @@ 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<Boolean> cir) {
private void cc_replaceGetChunkAtInLoadedAndEntityCanStandOnFace(BlockPos pos, Entity entity, Direction direction, CallbackInfoReturnable<Boolean> 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();
}
}

// getCurrentDifficultyAt
@Inject(method = "getCurrentDifficultyAt", at = @At(value = "HEAD"), cancellable = true)
private void cc_replaceGetCurrentDifficultyAt(BlockPos blockPos, CallbackInfoReturnable<DifficultyInstance> cir) {
private void cc_replaceGetCurrentDifficultyAt(BlockPos pos, CallbackInfoReturnable<DifficultyInstance> 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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,61 +80,61 @@ public static class TestLevel extends Level {
ChunkSource mockChunkSource = mock(ChunkSource.class, RETURNS_DEEP_STUBS);

public TestLevel(
WritableLevelData p_270739_,
ResourceKey<Level> p_270683_,
RegistryAccess p_270200_,
Holder<DimensionType> p_270240_,
Supplier<ProfilerFiller> p_270692_,
boolean p_270904_,
boolean p_270470_,
long p_270248_,
int p_270466_
WritableLevelData levelData,
ResourceKey<Level> dimension,
RegistryAccess registryAccess,
Holder<DimensionType> dimensionTypeRegistration,
Supplier<ProfilerFiller> 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<SoundEvent> 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<SoundEvent> sound, SoundSource category, float volume,
float pitch, long seed) {

}

@Override
public void playSeededSound(@Nullable Player p_220372_, Entity p_220373_, Holder<SoundEvent> p_263500_, SoundSource p_220375_, float p_220376_, float p_220377_, long p_220378_) {
public void playSeededSound(@Nullable Player player, Entity entity, Holder<SoundEvent> sound, SoundSource category, float volume, float pitch, long seed) {

}

@Override public String gatherChunkSourceStats() {
return null;
}

@Nullable @Override public Entity getEntity(int p_46492_) {
@Nullable @Override public Entity getEntity(int id) {
return null;
}

@Override public TickRateManager tickRateManager() {
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) {

}

@Override public int getFreeMapId() {
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) {

}

Expand Down Expand Up @@ -162,23 +162,23 @@ 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;
}

@Override public List<? extends Player> players() {
return null;
}

@Override public Holder<Biome> getUncachedNoiseBiome(int p_204159_, int p_204160_, int p_204161_) {
@Override public Holder<Biome> getUncachedNoiseBiome(int x, int y, int z) {
return null;
}

Expand Down

0 comments on commit 3e6250e

Please sign in to comment.