mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
Fixed player probe being broken
Thanks for help tiemo42 ^-^
This commit is contained in:
parent
bb0d64e869
commit
16d74df3cc
1 changed files with 19 additions and 13 deletions
|
@ -45,7 +45,7 @@ public class ItemPlayerProbe extends ItemBase{
|
|||
if(!world.isRemote){
|
||||
if(stack.hasTagCompound()){
|
||||
NBTTagCompound compound = stack.getTagCompound();
|
||||
if(compound.hasKey("UUID")){
|
||||
if(compound.hasKey("UUIDMost")){
|
||||
UUID id = compound.getUniqueId("UUID");
|
||||
EntityPlayer player = world.getPlayerEntityByUUID(id);
|
||||
if(player != null){
|
||||
|
@ -57,7 +57,7 @@ public class ItemPlayerProbe extends ItemBase{
|
|||
}
|
||||
else{
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
entity.addChatMessage(new TextComponentString("tooltip."+ModUtil.MOD_ID+".playerProbe.disconnect.2"));
|
||||
entity.addChatMessage(new TextComponentTranslation("tooltip."+ModUtil.MOD_ID+".playerProbe.disconnect.2"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -70,13 +70,15 @@ public class ItemPlayerProbe extends ItemBase{
|
|||
if(tile instanceof TileEntityPlayerInterface){
|
||||
if(stack.hasTagCompound()){
|
||||
NBTTagCompound compound = stack.getTagCompound();
|
||||
if(compound.hasKey("UUID")){
|
||||
if(compound.hasKey("UUIDMost")){
|
||||
if(!world.isRemote){
|
||||
TileEntityPlayerInterface face = (TileEntityPlayerInterface)tile;
|
||||
face.connectedPlayer = compound.getUniqueId("UUID");
|
||||
face.playerName = compound.getString("Name");
|
||||
face.markDirty();
|
||||
face.sendUpdate();
|
||||
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
@ -86,8 +88,10 @@ public class ItemPlayerProbe extends ItemBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity, EnumHand hand){
|
||||
public boolean itemInteractionForEntity(ItemStack aStack, EntityPlayer player, EntityLivingBase entity, EnumHand hand){
|
||||
if(!player.worldObj.isRemote){
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
if(stack != null && stack.getItem() == this){
|
||||
if(entity instanceof EntityPlayer){
|
||||
EntityPlayer playerHit = (EntityPlayer)entity;
|
||||
|
||||
|
@ -99,6 +103,8 @@ public class ItemPlayerProbe extends ItemBase{
|
|||
NBTTagCompound compound = stack.getTagCompound();
|
||||
compound.setString("Name", playerHit.getName());
|
||||
compound.setUniqueId("UUID", playerHit.getUniqueID());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue