Skip to content

Commit

Permalink
Pass proper chunk coords to BiomeArrayMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
jchung01 committed Apr 2, 2024
1 parent f9292a4 commit 864f61f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ public class MixinCommandSetBiome {

@Redirect(method = "execute", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/chunk/Chunk;setBiomeArray([B)V"))
private void reid$setBiomeArray(Chunk instance, byte[] biomeArray,
@Local BlockPos coord, @Local World world, @Local(ordinal = 4) int x,
@Local(ordinal = 5) int z, @Share("intBiomeArray") LocalRef<int[]> intBiomeArray) {
@Local BlockPos coord, @Local World world, @Local(ordinal = 4) int chunkX,
@Local(ordinal = 5) int chunkZ, @Share("intBiomeArray") LocalRef<int[]> intBiomeArray) {
// Method calls markDirty()
((INewChunk) world.getChunk(x, z)).setIntBiomeArray(Arrays.copyOf(intBiomeArray.get(), intBiomeArray.get().length));
MessageManager.sendClientsBiomeArray(world, new BlockPos(x, coord.getY(), z), Arrays.copyOf(intBiomeArray.get(), intBiomeArray.get().length));
int posX = chunkX << 4;
int posZ = chunkZ << 4;
((INewChunk) world.getChunk(chunkX, chunkZ)).setIntBiomeArray(Arrays.copyOf(intBiomeArray.get(), intBiomeArray.get().length));
MessageManager.sendClientsBiomeArray(world, new BlockPos(posX, coord.getY(), posZ), Arrays.copyOf(intBiomeArray.get(), intBiomeArray.get().length));
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/dimdev/jeid/network/MessageManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static void sendClientsBiomeChange(World world, BlockPos pos, int biomeId

public static void sendClientsBiomeArray(World world, BlockPos pos, int[] biomeArr) {
MessageManager.CHANNEL.sendToAllTracking(
new BiomeArrayMessage(pos.getX(), pos.getZ(), biomeArr),
new BiomeArrayMessage(pos.getX() >> 4, pos.getZ() >> 4, biomeArr), // Expects chunkX/Z
new NetworkRegistry.TargetPoint(world.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 0.0D) // Range ignored
);
}
Expand Down

0 comments on commit 864f61f

Please sign in to comment.