mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 07:13:28 +01:00
Fix the contain checks on the Player Probe and Player Interface
This commit is contained in:
parent
8385c5aea6
commit
d2d0afa6d7
2 changed files with 7 additions and 8 deletions
|
@ -44,18 +44,18 @@ public class ItemPlayerProbe extends ItemBase {
|
|||
public void inventoryTick(ItemStack stack, Level world, Entity entity, int itemSlot, boolean isSelected) {
|
||||
if (!world.isClientSide) {
|
||||
CompoundTag compound = stack.getOrCreateTag();
|
||||
if (compound.contains("UUIDMost")) {
|
||||
if (compound.contains("UUID")) {
|
||||
UUID id = compound.getUUID("UUID");
|
||||
Player player = world.getPlayerByUUID(id);
|
||||
if (player != null) {
|
||||
if (player.isShiftKeyDown()) {
|
||||
ItemPhantomConnector.clearStorage(stack, "UUIDLeast", "UUIDMost", "Name");
|
||||
ItemPhantomConnector.clearStorage(stack, "UUID", "Name");
|
||||
((Player) entity).displayClientMessage(Component.translatable("tooltip." + ActuallyAdditions.MODID + ".playerProbe.disconnect.1"), false);
|
||||
player.displayClientMessage(Component.translatable("tooltip." + ActuallyAdditions.MODID + ".playerProbe.notice"), false);
|
||||
//TheAchievements.GET_UNPROBED.get(player);
|
||||
}
|
||||
} else {
|
||||
ItemPhantomConnector.clearStorage(stack, "UUIDLeast", "UUIDMost", "Name");
|
||||
ItemPhantomConnector.clearStorage(stack, "UUID", "Name");
|
||||
((Player) entity).displayClientMessage(Component.translatable("tooltip." + ActuallyAdditions.MODID + ".playerProbe.disconnect.2"), false);
|
||||
}
|
||||
}
|
||||
|
@ -71,17 +71,16 @@ public class ItemPlayerProbe extends ItemBase {
|
|||
|
||||
ItemStack stack = player.getItemInHand(context.getHand());
|
||||
BlockEntity tile = context.getLevel().getBlockEntity(context.getClickedPos());
|
||||
if (tile instanceof TileEntityPlayerInterface) {
|
||||
if (tile instanceof TileEntityPlayerInterface face) {
|
||||
CompoundTag compound = stack.getOrCreateTag();
|
||||
if (compound.contains("UUIDMost")) {
|
||||
if (compound.contains("UUID")) {
|
||||
if (!context.getLevel().isClientSide) {
|
||||
TileEntityPlayerInterface face = (TileEntityPlayerInterface) tile;
|
||||
face.connectedPlayer = compound.getUUID("UUID");
|
||||
face.playerName = compound.getString("Name");
|
||||
face.setChanged();
|
||||
face.sendUpdate();
|
||||
|
||||
ItemPhantomConnector.clearStorage(stack, "UUIDLeast", "UUIDMost", "Name");
|
||||
ItemPhantomConnector.clearStorage(stack, "UUID", "Name");
|
||||
}
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ public class TileEntityPlayerInterface extends TileEntityBase implements IEnergy
|
|||
super.readSyncableNBT(compound, type);
|
||||
|
||||
this.storage.readFromNBT(compound);
|
||||
if (compound.contains("PlayerLeast") && type != NBTType.SAVE_BLOCK) {
|
||||
if (compound.contains("Player") && type != NBTType.SAVE_BLOCK) {
|
||||
this.connectedPlayer = compound.getUUID("Player");
|
||||
this.playerName = compound.getString("PlayerName");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue