Set arcane lock data server-side and sync the tile entity properly, fixes #580

This commit is contained in:
Electroblob77
2021-01-03 23:18:20 +00:00
parent d8f1c5f77c
commit a3c15d673b
@@ -47,10 +47,12 @@ public class ArcaneLock extends SpellRay {
if(caster instanceof EntityPlayer){
if(toggleLock(world, pos, (EntityPlayer)caster)){
BlockPos otherHalf = BlockUtils.getConnectedChest(world, pos);
if(otherHalf != null) toggleLock(world, otherHalf, (EntityPlayer)caster);
return true;
if(!world.isRemote){
if(toggleLock(world, pos, (EntityPlayer)caster)){
BlockPos otherHalf = BlockUtils.getConnectedChest(world, pos);
if(otherHalf != null) toggleLock(world, otherHalf, (EntityPlayer)caster);
return true;
}
}
}
@@ -67,11 +69,13 @@ public class ArcaneLock extends SpellRay {
// Unlocking
if(world.getPlayerEntityByUUID(tileentity.getTileData().getUniqueId(NBT_KEY)) == player){
NBTExtras.removeUniqueId(tileentity.getTileData(), NBT_KEY);
world.markAndNotifyBlock(pos, null, world.getBlockState(pos), world.getBlockState(pos), 3);
return true;
}
}else{
// Locking
tileentity.getTileData().setUniqueId(NBT_KEY, player.getUniqueID());
world.markAndNotifyBlock(pos, null, world.getBlockState(pos), world.getBlockState(pos), 3);
return true;
}
}