Fix notify at negative Y on fabric, leave note for forge.

This commit is contained in:
wizjany 2021-07-06 18:18:58 -04:00
parent 2586600ebb
commit 1415e6f610
2 changed files with 4 additions and 4 deletions

View File

@ -117,7 +117,7 @@ public boolean updateTileEntity(BlockPos position, com.sk89q.jnbt.CompoundTag ta
@Override
public void notifyBlockUpdate(WorldChunk chunk, BlockPos position, BlockState oldState, BlockState newState) {
if (chunk.getSectionArray()[position.getY() >> ChunkStore.CHUNK_SHIFTS] != null) {
if (chunk.getSectionArray()[world.get().getSectionIndex(position.getY())] != null) {
getWorld().updateListeners(position, oldState, newState, UPDATE | NOTIFY);
}
}
@ -129,7 +129,7 @@ public boolean isChunkTicking(WorldChunk chunk) {
@Override
public void markBlockChanged(WorldChunk chunk, BlockPos position) {
if (chunk.getSectionArray()[position.getY() >> ChunkStore.CHUNK_SHIFTS] != null) {
if (chunk.getSectionArray()[world.get().getSectionIndex(position.getY())] != null) {
((ServerChunkManager) getWorld().getChunkManager()).markForUpdate(position);
}
}

View File

@ -106,7 +106,7 @@ public boolean updateTileEntity(BlockPos position, CompoundTag tag) {
@Override
public void notifyBlockUpdate(Chunk chunk, BlockPos position, BlockState oldState, BlockState newState) {
if (chunk.getSections()[position.getY() >> ChunkStore.CHUNK_SHIFTS] != null) {
if (chunk.getSections()[position.getY() >> ChunkStore.CHUNK_SHIFTS] != null) { // TODO 1.17 - world.get().getSectionIndex(position.getY())
getWorld().notifyBlockUpdate(position, oldState, newState, UPDATE | NOTIFY);
}
}
@ -118,7 +118,7 @@ public boolean isChunkTicking(Chunk chunk) {
@Override
public void markBlockChanged(Chunk chunk, BlockPos position) {
if (chunk.getSections()[position.getY() >> ChunkStore.CHUNK_SHIFTS] != null) {
if (chunk.getSections()[position.getY() >> ChunkStore.CHUNK_SHIFTS] != null) { // TODO 1.17 - world.get().getSectionIndex(position.getY())
((ServerChunkProvider) getWorld().getChunkProvider()).markBlockChanged(position);
}
}