diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantom.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantom.java index 3dd79fb2c..834b010e3 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantom.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantom.java @@ -6,7 +6,6 @@ import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.tile.IPhantomTile; import ellpeck.actuallyadditions.tile.TileEntityPhantomPlacer; -import ellpeck.actuallyadditions.tile.TileEntityPhantomPlayerface; import ellpeck.actuallyadditions.tile.TileEntityPhantomface; import ellpeck.actuallyadditions.util.*; import net.minecraft.block.Block; @@ -32,8 +31,7 @@ public class BlockPhantom extends BlockContainerBase implements INameableItem{ PLACER, BREAKER, LIQUIFACE, - ENERGYFACE, - PLAYERFACE + ENERGYFACE } public Type type; @@ -66,14 +64,7 @@ public class BlockPhantom extends BlockContainerBase implements INameableItem{ if(!world.isRemote){ TileEntity tile = world.getTileEntity(x, y, z); if(tile != null){ - if(tile instanceof TileEntityPhantomPlayerface){ - TileEntityPhantomPlayerface phantom = (TileEntityPhantomPlayerface)tile; - if(player.isSneaking()){ - phantom.boundPlayerUUID = player.getUniqueID().toString(); - player.addChatComponentMessage(new ChatComponentText("Bound to "+player.getDisplayName())); - } - } - else if(tile instanceof IPhantomTile){ + if(tile instanceof IPhantomTile){ IPhantomTile phantom = (IPhantomTile)tile; if(player.isSneaking() || phantom.getGuiID() == -1){ player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomRange.desc") + ": " + phantom.getRange())); @@ -106,8 +97,6 @@ public class BlockPhantom extends BlockContainerBase implements INameableItem{ return new TileEntityPhantomface.TileEntityPhantomLiquiface(); case ENERGYFACE: return new TileEntityPhantomface.TileEntityPhantomEnergyface(); - case PLAYERFACE: - return new TileEntityPhantomPlayerface(); default: return new TileEntityPhantomface.TileEntityPhantomItemface(); } @@ -135,8 +124,6 @@ public class BlockPhantom extends BlockContainerBase implements INameableItem{ return "blockPhantomLiquiface"; case ENERGYFACE: return "blockPhantomEnergyface"; - case PLAYERFACE: - return "blockPhantomPlayerface"; default: return "blockPhantomface"; } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java index 640076890..3bd9d1362 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java @@ -55,7 +55,6 @@ public class InitBlocks{ public static Block blockPhantomBreaker; public static Block blockPhantomLiquiface; public static Block blockPhantomEnergyface; - public static Block blockPhantomPlayerface; public static Block blockFluidPlacer; public static Block blockFluidCollector; @@ -142,9 +141,6 @@ public class InitBlocks{ blockPhantomBreaker = new BlockPhantom(BlockPhantom.Type.BREAKER); BlockUtil.register(blockPhantomBreaker, BlockPhantom.TheItemBlock.class); - blockPhantomPlayerface = new BlockPhantom(BlockPhantom.Type.PLAYERFACE); - BlockUtil.register(blockPhantomPlayerface, BlockPhantom.TheItemBlock.class); - blockCoalGenerator = new BlockCoalGenerator(); BlockUtil.register(blockCoalGenerator, BlockCoalGenerator.TheItemBlock.class); diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java index 8e297f086..21db0ae40 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java @@ -60,7 +60,6 @@ public class TileEntityBase extends TileEntity{ GameRegistry.registerTileEntity(TileEntityEnervator.class, ModUtil.MOD_ID_LOWER + ":tileEntityEnervator"); GameRegistry.registerTileEntity(TileEntityXPSolidifier.class, ModUtil.MOD_ID_LOWER+":tileEntityXPSolidifier"); GameRegistry.registerTileEntity(TileEntityOreMagnet.class, ModUtil.MOD_ID_LOWER+":tileEntityOreMagnet"); - GameRegistry.registerTileEntity(TileEntityPhantomPlayerface.class, ModUtil.MOD_ID_LOWER+":tileEntityPhantomPlayerface"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomPlayerface.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomPlayerface.java deleted file mode 100644 index d4e736de8..000000000 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomPlayerface.java +++ /dev/null @@ -1,163 +0,0 @@ -package ellpeck.actuallyadditions.tile; - -import cofh.api.energy.EnergyStorage; -import cofh.api.energy.IEnergyReceiver; -import ellpeck.actuallyadditions.util.WorldUtil; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.server.MinecraftServer; -import net.minecraftforge.common.util.ForgeDirection; - -import java.util.List; -import java.util.Objects; - -public class TileEntityPhantomPlayerface extends TileEntityInventoryBase implements IEnergyReceiver{ - - public String boundPlayerUUID; - private String boundPlayerBefore; - - private EnergyStorage storage = new EnergyStorage(250000); - private boolean hadEnoughBefore; - private final int energyUsePerTick = 1000; - - public TileEntityPhantomPlayerface(){ - super(0, "phantomPlayerface"); - } - - @Override - public void updateEntity(){ - if(!worldObj.isRemote){ - if(!Objects.equals(this.boundPlayerUUID, this.boundPlayerBefore) || this.hadEnoughBefore != this.storage.getEnergyStored() >= energyUsePerTick){ - this.boundPlayerBefore = this.boundPlayerUUID; - this.hadEnoughBefore = this.storage.getEnergyStored() >= energyUsePerTick; - WorldUtil.updateTileAndTilesAround(this); - } - - if(this.hasEnoughEnergy() && this.hasInventory()){ - this.storage.extractEnergy(this.energyUsePerTick, false); - } - } - } - - @SuppressWarnings("unchecked") - public InventoryPlayer getInventory(){ - if(!worldObj.isRemote && this.boundPlayerUUID != null){ - List list = MinecraftServer.getServer().getConfigurationManager().playerEntityList; - for(EntityPlayer player : list){ - if(player.getUniqueID().toString().equals(this.boundPlayerUUID)){ - return player.inventory; - } - } - } - return null; - } - - public boolean hasInventory(){ - return this.getInventory() != null; - } - - private boolean hasEnoughEnergy(){ - return this.storage.getEnergyStored() >= this.energyUsePerTick; - } - - @Override - public int getInventoryStackLimit(){ - if(this.hasInventory() && this.hasEnoughEnergy()){ - return this.getInventory().getInventoryStackLimit(); - } - return 0; - } - - @Override - public boolean isItemValidForSlot(int i, ItemStack stack){ - return this.hasInventory() && this.hasEnoughEnergy() && this.getInventory().isItemValidForSlot(i, stack); - } - - @Override - public ItemStack getStackInSlotOnClosing(int i){ - if(this.hasInventory() && this.hasEnoughEnergy()){ - return this.getInventory().getStackInSlotOnClosing(i); - } - return null; - } - - @Override - public void setInventorySlotContents(int i, ItemStack stack){ - if(this.hasInventory() && this.hasEnoughEnergy()){ - this.getInventory().setInventorySlotContents(i, stack); - this.markDirty(); - } - } - - @Override - public int getSizeInventory(){ - if(this.hasInventory() && this.hasEnoughEnergy()){ - return this.getInventory().getSizeInventory(); - } - return 0; - } - - @Override - public ItemStack getStackInSlot(int i){ - if(this.hasInventory() && this.hasEnoughEnergy()){ - return this.getInventory().getStackInSlot(i); - } - return null; - } - - @Override - public ItemStack decrStackSize(int i, int j){ - if(this.hasInventory() && this.hasEnoughEnergy()){ - return this.getInventory().decrStackSize(i, j); - } - return null; - } - - @Override - public String getInventoryName(){ - return this.name; - } - - @Override - public int[] getAccessibleSlotsFromSide(int side){ - if(this.hasInventory() && this.hasEnoughEnergy()){ - int[] theInt = new int[this.getInventory().getSizeInventory()]; - for(int i = 0; i < theInt.length; i++){ - theInt[i] = i; - } - return theInt; - } - return new int[0]; - } - - @Override - public boolean canInsertItem(int slot, ItemStack stack, int side){ - return this.hasInventory() && this.hasEnoughEnergy(); - } - - @Override - public boolean canExtractItem(int slot, ItemStack stack, int side){ - return this.hasInventory() && this.hasEnoughEnergy(); - } - - @Override - public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){ - return this.storage.receiveEnergy(maxReceive, simulate); - } - - @Override - public int getEnergyStored(ForgeDirection from){ - return this.storage.getEnergyStored(); - } - - @Override - public int getMaxEnergyStored(ForgeDirection from){ - return this.storage.getMaxEnergyStored(); - } - - @Override - public boolean canConnectEnergy(ForgeDirection from){ - return true; - } -}