fix issue with generated wool

This commit is contained in:
2023-05-29 18:44:51 +02:00
parent 012164f197
commit 5d4baa167a
2 changed files with 10 additions and 20 deletions

View File

@@ -20,7 +20,8 @@ public class BlockChangeMixin {
@Inject(at = @At("RETURN"), method = "onBlockChanged")
private void init(BlockPos pos, BlockState oldBlock, BlockState newBlock, CallbackInfo info) {
if(((ServerWorld) (Object) this).isDebugWorld())
ServerWorld world = (ServerWorld) (Object) this;
if(world.isDebugWorld()|| !world.isChunkLoaded(pos))
return;
// This code is injected into the end of ServerWorld.onBlockChanged()V
if (oldBlock.getBlock() != newBlock.getBlock()) {
@@ -28,14 +29,14 @@ public class BlockChangeMixin {
LOGGER.info("onBlockNew {} -> {}", oldBlock, newBlock);
Identifier blockId = Registries.BLOCK.getId(newBlock.getBlock());
ColourfulPortalsMod.LOGGER.info("Block change, new portal block: " + blockId);
PortalManager.onPortalBlockPlaced(((ServerWorld) (Object) this), pos, blockId);
PortalManager.onPortalBlockPlaced(world, pos, blockId);
}
if (PORTAL_BLOCKS.contains(Registries.BLOCK.getId(oldBlock.getBlock()))) {
LOGGER.info("onBlockOld {} -> {}", oldBlock, newBlock);
Identifier blockId = Registries.BLOCK.getId(oldBlock.getBlock());
ColourfulPortalsMod.LOGGER.info("Block change, removed portal block: " + blockId);
PortalManager.onPortalBlockBroken(((ServerWorld) (Object) this), pos, blockId);
PortalManager.onPortalBlockBroken(world, pos, blockId);
}
}