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(caster instanceof EntityPlayer){
if(toggleLock(world, pos, (EntityPlayer)caster)){ if(!world.isRemote){
BlockPos otherHalf = BlockUtils.getConnectedChest(world, pos); if(toggleLock(world, pos, (EntityPlayer)caster)){
if(otherHalf != null) toggleLock(world, otherHalf, (EntityPlayer)caster); BlockPos otherHalf = BlockUtils.getConnectedChest(world, pos);
return true; if(otherHalf != null) toggleLock(world, otherHalf, (EntityPlayer)caster);
return true;
}
} }
} }
@@ -67,11 +69,13 @@ public class ArcaneLock extends SpellRay {
// Unlocking // Unlocking
if(world.getPlayerEntityByUUID(tileentity.getTileData().getUniqueId(NBT_KEY)) == player){ if(world.getPlayerEntityByUUID(tileentity.getTileData().getUniqueId(NBT_KEY)) == player){
NBTExtras.removeUniqueId(tileentity.getTileData(), NBT_KEY); NBTExtras.removeUniqueId(tileentity.getTileData(), NBT_KEY);
world.markAndNotifyBlock(pos, null, world.getBlockState(pos), world.getBlockState(pos), 3);
return true; return true;
} }
}else{ }else{
// Locking // Locking
tileentity.getTileData().setUniqueId(NBT_KEY, player.getUniqueID()); tileentity.getTileData().setUniqueId(NBT_KEY, player.getUniqueID());
world.markAndNotifyBlock(pos, null, world.getBlockState(pos), world.getBlockState(pos), 3);
return true; return true;
} }
} }