public static void assignMultiBlock(World world, BlockPos master, List<BlockPos> servants) {
TileEntity masterBlock = world.getTileEntity(master);
if(!(masterBlock instanceof IMasterLogic)) {
throw new IllegalArgumentException("Master must be of IMasterLogic");
}
for(BlockPos pos : servants) {
if(world.isBlockLoaded(pos)) {
TileEntity slave = world.getTileEntity(pos);
if(slave instanceof MultiServantLogic && slave.getWorld() != null) {
((MultiServantLogic) slave).overrideMaster(master);
IBlockState state = world.getBlockState(pos);
world.notifyBlockUpdate(pos, state, state, 3);
}
}
}
}
}