Tweaked the Playerface System a bit, generally working beside from Items going into the Armor slots when they shouldn't

This commit is contained in:
Ellpeck 2015-08-11 00:39:57 +02:00
parent 1b3cf54155
commit a9bcf90fec
4 changed files with 8 additions and 3 deletions

View file

@ -70,6 +70,7 @@ public class BlockPhantom extends BlockContainerBase implements INameableItem{
TileEntityPhantomPlayerface phantom = (TileEntityPhantomPlayerface)tile; TileEntityPhantomPlayerface phantom = (TileEntityPhantomPlayerface)tile;
if(player.isSneaking()){ if(player.isSneaking()){
phantom.boundPlayerUUID = player.getUniqueID().toString(); phantom.boundPlayerUUID = player.getUniqueID().toString();
player.addChatComponentMessage(new ChatComponentText("Bound to "+player.getDisplayName()));
} }
} }
else if(tile instanceof IPhantomTile){ else if(tile instanceof IPhantomTile){

View file

@ -60,6 +60,7 @@ public class TileEntityBase extends TileEntity{
GameRegistry.registerTileEntity(TileEntityEnervator.class, ModUtil.MOD_ID_LOWER + ":tileEntityEnervator"); GameRegistry.registerTileEntity(TileEntityEnervator.class, ModUtil.MOD_ID_LOWER + ":tileEntityEnervator");
GameRegistry.registerTileEntity(TileEntityXPSolidifier.class, ModUtil.MOD_ID_LOWER+":tileEntityXPSolidifier"); GameRegistry.registerTileEntity(TileEntityXPSolidifier.class, ModUtil.MOD_ID_LOWER+":tileEntityXPSolidifier");
GameRegistry.registerTileEntity(TileEntityOreMagnet.class, ModUtil.MOD_ID_LOWER+":tileEntityOreMagnet"); GameRegistry.registerTileEntity(TileEntityOreMagnet.class, ModUtil.MOD_ID_LOWER+":tileEntityOreMagnet");
GameRegistry.registerTileEntity(TileEntityPhantomPlayerface.class, ModUtil.MOD_ID_LOWER+":tileEntityPhantomPlayerface");
} }
@Override @Override

View file

@ -1,11 +1,13 @@
package ellpeck.actuallyadditions.tile; package ellpeck.actuallyadditions.tile;
import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import java.util.List; import java.util.List;
import java.util.Objects;
public class TileEntityPhantomPlayerface extends TileEntityInventoryBase{ public class TileEntityPhantomPlayerface extends TileEntityInventoryBase{
@ -18,8 +20,9 @@ public class TileEntityPhantomPlayerface extends TileEntityInventoryBase{
@Override @Override
public void updateEntity(){ public void updateEntity(){
if(!this.boundPlayerBefore.equals(this.boundPlayerUUID)){ if(!Objects.equals(this.boundPlayerUUID, this.boundPlayerBefore)){
this.boundPlayerBefore = this.boundPlayerUUID; this.boundPlayerBefore = this.boundPlayerUUID;
WorldUtil.updateTileAndTilesAround(this);
} }
} }
@ -28,7 +31,7 @@ public class TileEntityPhantomPlayerface extends TileEntityInventoryBase{
if(!worldObj.isRemote && this.boundPlayerUUID != null){ if(!worldObj.isRemote && this.boundPlayerUUID != null){
List<EntityPlayer> list = MinecraftServer.getServer().getConfigurationManager().playerEntityList; List<EntityPlayer> list = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
for(EntityPlayer player : list){ for(EntityPlayer player : list){
if(!player.getUniqueID().toString().equals(this.boundPlayerUUID)){ if(player.getUniqueID().toString().equals(this.boundPlayerUUID)){
return player.inventory; return player.inventory;
} }
} }

View file

@ -59,7 +59,7 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
this.boundPosition = null; this.boundPosition = null;
} }
if((this.boundPosition != null && (this.boundBlockBefore != this.boundPosition.getBlock() || !this.boundPosition.isEqual(boundPosBefore))) || this.range != this.rangeBefore){ if(this.boundPosition != this.boundPosBefore || (this.boundPosition != null && this.boundPosition.getBlock() != this.boundBlockBefore) || this.rangeBefore != this.range){
this.rangeBefore = this.range; this.rangeBefore = this.range;
this.boundPosBefore = this.boundPosition; this.boundPosBefore = this.boundPosition;
this.boundBlockBefore = this.boundPosition == null ? null : this.boundPosition.getBlock(); this.boundBlockBefore = this.boundPosition == null ? null : this.boundPosition.getBlock();