mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
Made the way Phantom Tiles work more generic
This commit is contained in:
parent
945ad194ce
commit
de7c789071
6 changed files with 174 additions and 119 deletions
|
@ -4,7 +4,7 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.ActuallyAdditions;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import ellpeck.actuallyadditions.inventory.GuiHandler;
|
||||
import ellpeck.actuallyadditions.tile.IPhantomTile;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityPhantomPlacer;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityPhantomface;
|
||||
import ellpeck.actuallyadditions.util.*;
|
||||
|
@ -24,7 +24,7 @@ import net.minecraft.world.World;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockPhantomface extends BlockContainerBase implements INameableItem{
|
||||
public class BlockPhantom extends BlockContainerBase implements INameableItem{
|
||||
|
||||
public static final int FACE = 0;
|
||||
public static final int PLACER = 1;
|
||||
|
@ -35,7 +35,7 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte
|
|||
public int type;
|
||||
public int range;
|
||||
|
||||
public BlockPhantomface(int type){
|
||||
public BlockPhantom(int type){
|
||||
super(Material.rock);
|
||||
this.type = type;
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
|
@ -43,8 +43,12 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte
|
|||
this.setResistance(10.0F);
|
||||
this.setStepSound(soundTypeStone);
|
||||
|
||||
if(type == FACE || type == LIQUIFACE || type == ENERGYFACE) this.range = ConfigIntValues.PHANTOMFACE_RANGE.getValue();
|
||||
else if(type == BREAKER || type == PLACER) this.range = ConfigIntValues.PHANTOM_PLACER_RANGE.getValue();
|
||||
if(type == FACE || type == LIQUIFACE || type == ENERGYFACE){
|
||||
this.range = ConfigIntValues.PHANTOMFACE_RANGE.getValue();
|
||||
}
|
||||
else if(type == BREAKER || type == PLACER){
|
||||
this.range = ConfigIntValues.PHANTOM_PLACER_RANGE.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -58,37 +62,22 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte
|
|||
if(!world.isRemote){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile != null){
|
||||
if(tile instanceof TileEntityPhantomface){
|
||||
TileEntityPhantomface phantom = (TileEntityPhantomface)tile;
|
||||
player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomRange.desc") + ": " + phantom.range));
|
||||
if(phantom.hasBoundTile()){
|
||||
int distance = (int)Vec3.createVectorHelper(x, y, z).distanceTo(Vec3.createVectorHelper(phantom.boundPosition.getX(), phantom.boundPosition.getY(), phantom.boundPosition.getZ()));
|
||||
Item item = phantom.boundPosition.getItemBlock();
|
||||
String name = item == null ? "Absolutely Nothing" : item.getItemStackDisplayName(new ItemStack(phantom.boundPosition.getBlock(), 1, phantom.boundPosition.getMetadata()));
|
||||
player.addChatComponentMessage(new ChatComponentText(StringUtil.localizeFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.blockInfo.desc", name, phantom.boundPosition.getX(), phantom.boundPosition.getY(), phantom.boundPosition.getZ(), distance)));
|
||||
|
||||
if(phantom.isBoundTileInRage()) player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedRange.desc")));
|
||||
else player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc")));
|
||||
}
|
||||
else player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.notConnected.desc")));
|
||||
}
|
||||
|
||||
else if(tile instanceof TileEntityPhantomPlacer){
|
||||
if(player.isSneaking()){
|
||||
TileEntityPhantomPlacer phantom = (TileEntityPhantomPlacer)tile;
|
||||
player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomRange.desc") + ": " + phantom.range));
|
||||
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()));
|
||||
if(phantom.hasBoundPosition()){
|
||||
int distance = (int)Vec3.createVectorHelper(x, y, z).distanceTo(Vec3.createVectorHelper(phantom.boundPosition.getX(), phantom.boundPosition.getY(), phantom.boundPosition.getZ()));
|
||||
Item item = phantom.boundPosition.getItemBlock();
|
||||
String name = item == null ? "Absolutely Nothing" : item.getItemStackDisplayName(new ItemStack(phantom.boundPosition.getBlock(), 1, phantom.boundPosition.getMetadata()));
|
||||
player.addChatComponentMessage(new ChatComponentText(StringUtil.localizeFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.blockInfo.desc", name, phantom.boundPosition.getX(), phantom.boundPosition.getY(), phantom.boundPosition.getZ(), distance)));
|
||||
int distance = (int)Vec3.createVectorHelper(x, y, z).distanceTo(Vec3.createVectorHelper(phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ()));
|
||||
Item item = phantom.getBoundPosition().getItemBlock();
|
||||
String name = item == null ? "Absolutely Nothing" : item.getItemStackDisplayName(new ItemStack(phantom.getBoundPosition().getBlock(), 1, phantom.getBoundPosition().getMetadata()));
|
||||
player.addChatComponentMessage(new ChatComponentText(StringUtil.localizeFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.blockInfo.desc", name, phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ(), distance)));
|
||||
|
||||
if(phantom.isBoundPositionInRange()) player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedRange.desc")));
|
||||
if(phantom.isBoundThingInRange()) player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedRange.desc")));
|
||||
else player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc")));
|
||||
}
|
||||
else player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.notConnected.desc")));
|
||||
}
|
||||
else player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.PHANTOM_PLACER.ordinal(), world, x, y, z);
|
||||
else player.openGui(ActuallyAdditions.instance, phantom.getGuiID(), world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -165,11 +154,11 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte
|
|||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
|
||||
BlockUtil.addInformation(theBlock, list, 2, "");
|
||||
if(KeyUtil.isShiftPressed()){
|
||||
if(((BlockPhantomface)this.theBlock).type == LIQUIFACE){
|
||||
if(((BlockPhantom)this.theBlock).type == LIQUIFACE){
|
||||
list.add(StringUtil.ORANGE+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomLiquiface.desc.3"));
|
||||
list.add(StringUtil.ORANGE+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomLiquiface.desc.4"));
|
||||
}
|
||||
list.add(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomRange.desc") + ": " + ((BlockPhantomface)theBlock).range);
|
||||
list.add(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomRange.desc") + ": " + ((BlockPhantom)theBlock).range);
|
||||
}
|
||||
}
|
||||
|
|
@ -126,20 +126,20 @@ public class InitBlocks{
|
|||
blockCanolaPress = new BlockCanolaPress();
|
||||
BlockUtil.register(blockCanolaPress, BlockCanolaPress.TheItemBlock.class);
|
||||
|
||||
blockPhantomface = new BlockPhantomface(BlockPhantomface.FACE);
|
||||
BlockUtil.register(blockPhantomface, BlockPhantomface.TheItemBlock.class);
|
||||
blockPhantomface = new BlockPhantom(BlockPhantom.FACE);
|
||||
BlockUtil.register(blockPhantomface, BlockPhantom.TheItemBlock.class);
|
||||
|
||||
blockPhantomPlacer = new BlockPhantomface(BlockPhantomface.PLACER);
|
||||
BlockUtil.register(blockPhantomPlacer, BlockPhantomface.TheItemBlock.class);
|
||||
blockPhantomPlacer = new BlockPhantom(BlockPhantom.PLACER);
|
||||
BlockUtil.register(blockPhantomPlacer, BlockPhantom.TheItemBlock.class);
|
||||
|
||||
blockPhantomLiquiface = new BlockPhantomface(BlockPhantomface.LIQUIFACE);
|
||||
BlockUtil.register(blockPhantomLiquiface, BlockPhantomface.TheItemBlock.class);
|
||||
blockPhantomLiquiface = new BlockPhantom(BlockPhantom.LIQUIFACE);
|
||||
BlockUtil.register(blockPhantomLiquiface, BlockPhantom.TheItemBlock.class);
|
||||
|
||||
blockPhantomEnergyface = new BlockPhantomface(BlockPhantomface.ENERGYFACE);
|
||||
BlockUtil.register(blockPhantomEnergyface, BlockPhantomface.TheItemBlock.class);
|
||||
blockPhantomEnergyface = new BlockPhantom(BlockPhantom.ENERGYFACE);
|
||||
BlockUtil.register(blockPhantomEnergyface, BlockPhantom.TheItemBlock.class);
|
||||
|
||||
blockPhantomBreaker = new BlockPhantomface(BlockPhantomface.BREAKER);
|
||||
BlockUtil.register(blockPhantomBreaker, BlockPhantomface.TheItemBlock.class);
|
||||
blockPhantomBreaker = new BlockPhantom(BlockPhantom.BREAKER);
|
||||
BlockUtil.register(blockPhantomBreaker, BlockPhantom.TheItemBlock.class);
|
||||
|
||||
blockCoalGenerator = new BlockCoalGenerator();
|
||||
BlockUtil.register(blockCoalGenerator, BlockCoalGenerator.TheItemBlock.class);
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package ellpeck.actuallyadditions.tile;
|
||||
|
||||
import ellpeck.actuallyadditions.util.WorldPos;
|
||||
|
||||
public interface IPhantomTile{
|
||||
|
||||
/**
|
||||
* @return If the Phantom Tile is currently bound to anything
|
||||
*/
|
||||
boolean hasBoundPosition();
|
||||
|
||||
/**
|
||||
* @return If the Phantom Tile's bound position is in range
|
||||
*/
|
||||
boolean isBoundThingInRange();
|
||||
|
||||
/**
|
||||
* @return The position this tile is bound to
|
||||
*/
|
||||
WorldPos getBoundPosition();
|
||||
|
||||
/**
|
||||
* @return The ID of the GUI it opens, -1 if none
|
||||
*/
|
||||
int getGuiID();
|
||||
|
||||
/**
|
||||
* @return The range the tile currently has
|
||||
*/
|
||||
int getRange();
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package ellpeck.actuallyadditions.tile;
|
||||
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import ellpeck.actuallyadditions.inventory.GuiHandler;
|
||||
import ellpeck.actuallyadditions.util.WorldPos;
|
||||
import ellpeck.actuallyadditions.util.WorldUtil;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -12,7 +13,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TileEntityPhantomPlacer extends TileEntityInventoryBase{
|
||||
public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements IPhantomTile{
|
||||
|
||||
public static class TileEntityPhantomBreaker extends TileEntityPhantomPlacer{
|
||||
|
||||
|
@ -51,7 +52,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase{
|
|||
this.boundPosition = null;
|
||||
}
|
||||
|
||||
if(this.isBoundPositionInRange()){
|
||||
if(this.isBoundThingInRange()){
|
||||
if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){
|
||||
if(this.currentTime > 0){
|
||||
this.currentTime--;
|
||||
|
@ -86,7 +87,20 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase{
|
|||
}
|
||||
}
|
||||
|
||||
public boolean isBoundPositionInRange(){
|
||||
@Override
|
||||
public boolean hasBoundPosition(){
|
||||
if(this.boundPosition != null && this.boundPosition.getWorld() != null){
|
||||
if(this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IPhantomTile || (this.xCoord == this.boundPosition.getX() && this.yCoord == this.boundPosition.getY() && this.zCoord == this.boundPosition.getZ() && this.worldObj == this.boundPosition.getWorld())){
|
||||
this.boundPosition = null;
|
||||
return false;
|
||||
}
|
||||
return this.boundPosition.getWorld() == this.worldObj;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBoundThingInRange(){
|
||||
if(this.hasBoundPosition()){
|
||||
int xDif = this.boundPosition.getX()-this.xCoord;
|
||||
int yDif = this.boundPosition.getY()-this.yCoord;
|
||||
|
@ -103,15 +117,19 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase{
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean hasBoundPosition(){
|
||||
if(this.boundPosition != null && this.boundPosition.getWorld() != null){
|
||||
if(this.xCoord == this.boundPosition.getX() && this.yCoord == this.boundPosition.getY() && this.zCoord == this.boundPosition.getZ() && this.worldObj == this.boundPosition.getWorld()){
|
||||
this.boundPosition = null;
|
||||
return false;
|
||||
}
|
||||
return this.boundPosition.getWorld() == this.worldObj;
|
||||
}
|
||||
return false;
|
||||
@Override
|
||||
public WorldPos getBoundPosition(){
|
||||
return this.boundPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGuiID(){
|
||||
return GuiHandler.GuiTypes.PHANTOM_PLACER.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRange(){
|
||||
return this.range;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,7 +3,7 @@ package ellpeck.actuallyadditions.tile;
|
|||
import cofh.api.energy.IEnergyHandler;
|
||||
import cofh.api.energy.IEnergyProvider;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
import ellpeck.actuallyadditions.blocks.BlockPhantomface;
|
||||
import ellpeck.actuallyadditions.blocks.BlockPhantom;
|
||||
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import ellpeck.actuallyadditions.util.WorldPos;
|
||||
|
@ -23,7 +23,7 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public class TileEntityPhantomface extends TileEntityInventoryBase{
|
||||
public class TileEntityPhantomface extends TileEntityInventoryBase implements IPhantomTile{
|
||||
|
||||
public WorldPos boundPosition;
|
||||
|
||||
|
@ -50,29 +50,12 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
|
|||
return newRange;
|
||||
}
|
||||
|
||||
public boolean isBoundTileInRage(){
|
||||
if(this.hasBoundTile()){
|
||||
int xDif = this.boundPosition.getX()-this.xCoord;
|
||||
int yDif = this.boundPosition.getY()-this.yCoord;
|
||||
int zDif = this.boundPosition.getZ()-this.zCoord;
|
||||
|
||||
if(xDif >= -this.range && xDif <= this.range){
|
||||
if(yDif >= -this.range && yDif <= this.range){
|
||||
if(zDif >= -this.range && zDif <= this.range){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
if(!worldObj.isRemote){
|
||||
this.range = upgradeRange(defaultRange, worldObj, xCoord, yCoord, zCoord);
|
||||
|
||||
if(!this.hasBoundTile()){
|
||||
if(!this.hasBoundPosition()){
|
||||
this.boundPosition = null;
|
||||
}
|
||||
|
||||
|
@ -85,21 +68,10 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
|
|||
}
|
||||
}
|
||||
|
||||
public boolean hasBoundTile(){
|
||||
if(this.boundPosition != null && this.boundPosition.getWorld() != null){
|
||||
if(this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof TileEntityPhantomface || (this.xCoord == this.boundPosition.getX() && this.yCoord == this.boundPosition.getY() && this.zCoord == this.boundPosition.getZ() && this.worldObj == this.boundPosition.getWorld())){
|
||||
this.boundPosition = null;
|
||||
return false;
|
||||
}
|
||||
return this.boundPosition.getWorld() == this.worldObj;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
if(this.hasBoundTile()){
|
||||
if(this.hasBoundPosition()){
|
||||
compound.setInteger("XCoordOfTileStored", boundPosition.getX());
|
||||
compound.setInteger("YCoordOfTileStored", boundPosition.getY());
|
||||
compound.setInteger("ZCoordOfTileStored", boundPosition.getZ());
|
||||
|
@ -130,11 +102,56 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBoundPosition(){
|
||||
if(this.boundPosition != null && this.boundPosition.getWorld() != null){
|
||||
if(this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IPhantomTile || (this.xCoord == this.boundPosition.getX() && this.yCoord == this.boundPosition.getY() && this.zCoord == this.boundPosition.getZ() && this.worldObj == this.boundPosition.getWorld())){
|
||||
this.boundPosition = null;
|
||||
return false;
|
||||
}
|
||||
return this.boundPosition.getWorld() == this.worldObj;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBoundThingInRange(){
|
||||
if(this.hasBoundPosition()){
|
||||
int xDif = this.boundPosition.getX()-this.xCoord;
|
||||
int yDif = this.boundPosition.getY()-this.yCoord;
|
||||
int zDif = this.boundPosition.getZ()-this.zCoord;
|
||||
|
||||
if(xDif >= -this.range && xDif <= this.range){
|
||||
if(yDif >= -this.range && yDif <= this.range){
|
||||
if(zDif >= -this.range && zDif <= this.range){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorldPos getBoundPosition(){
|
||||
return this.boundPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGuiID(){
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRange(){
|
||||
return this.range;
|
||||
}
|
||||
|
||||
public static class TileEntityPhantomLiquiface extends TileEntityPhantomface implements IFluidHandler{
|
||||
|
||||
public TileEntityPhantomLiquiface(){
|
||||
super("liquiface");
|
||||
this.type = BlockPhantomface.LIQUIFACE;
|
||||
this.type = BlockPhantom.LIQUIFACE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -142,7 +159,7 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
|
|||
super.updateEntity();
|
||||
|
||||
if(!worldObj.isRemote){
|
||||
if(worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord) && this.isBoundTileInRage() && this.getHandler() != null){
|
||||
if(worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord) && this.isBoundThingInRange() && this.getHandler() != null){
|
||||
this.pushFluid(ForgeDirection.UP);
|
||||
this.pushFluid(ForgeDirection.DOWN);
|
||||
this.pushFluid(ForgeDirection.NORTH);
|
||||
|
@ -173,8 +190,8 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isBoundTileInRage(){
|
||||
return super.isBoundTileInRage() && this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IFluidHandler;
|
||||
public boolean isBoundThingInRange(){
|
||||
return super.isBoundThingInRange() && this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IFluidHandler;
|
||||
}
|
||||
|
||||
public IFluidHandler getHandler(){
|
||||
|
@ -187,35 +204,35 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
|
|||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill){
|
||||
if(this.isBoundTileInRage()) return this.getHandler().fill(from, resource, doFill);
|
||||
if(this.isBoundThingInRange()) return this.getHandler().fill(from, resource, doFill);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain){
|
||||
if(this.isBoundTileInRage()) return this.getHandler().drain(from, resource, doDrain);
|
||||
if(this.isBoundThingInRange()) return this.getHandler().drain(from, resource, doDrain);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain){
|
||||
if(this.isBoundTileInRage()) return this.getHandler().drain(from, maxDrain, doDrain);
|
||||
if(this.isBoundThingInRange()) return this.getHandler().drain(from, maxDrain, doDrain);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid){
|
||||
return this.isBoundTileInRage() && this.getHandler().canFill(from, fluid);
|
||||
return this.isBoundThingInRange() && this.getHandler().canFill(from, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid){
|
||||
return this.isBoundTileInRage() && this.getHandler().canDrain(from, fluid);
|
||||
return this.isBoundThingInRange() && this.getHandler().canDrain(from, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from){
|
||||
if(this.isBoundTileInRage()) return this.getHandler().getTankInfo(from);
|
||||
if(this.isBoundThingInRange()) return this.getHandler().getTankInfo(from);
|
||||
return new FluidTankInfo[0];
|
||||
}
|
||||
}
|
||||
|
@ -224,12 +241,12 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
|
|||
|
||||
public TileEntityPhantomEnergyface(){
|
||||
super("energyface");
|
||||
this.type = BlockPhantomface.ENERGYFACE;
|
||||
this.type = BlockPhantom.ENERGYFACE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBoundTileInRage(){
|
||||
return super.isBoundTileInRage() && (this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IEnergyReceiver || this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IEnergyProvider);
|
||||
public boolean isBoundThingInRange(){
|
||||
return super.isBoundThingInRange() && (this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IEnergyReceiver || this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IEnergyProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -237,7 +254,7 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
|
|||
super.updateEntity();
|
||||
|
||||
if(!worldObj.isRemote){
|
||||
if(this.isBoundTileInRage() && this.getProvider() != null){
|
||||
if(this.isBoundThingInRange() && this.getProvider() != null){
|
||||
this.pushEnergy(ForgeDirection.UP);
|
||||
this.pushEnergy(ForgeDirection.DOWN);
|
||||
this.pushEnergy(ForgeDirection.NORTH);
|
||||
|
@ -277,17 +294,17 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
|
|||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
|
||||
return this.isBoundTileInRage() && this.getReceiver() != null ? this.getReceiver().receiveEnergy(from, maxReceive, simulate) : 0;
|
||||
return this.isBoundThingInRange() && this.getReceiver() != null ? this.getReceiver().receiveEnergy(from, maxReceive, simulate) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate){
|
||||
return this.isBoundTileInRage() && this.getProvider() != null ? this.getProvider().extractEnergy(from, maxExtract, simulate) : 0;
|
||||
return this.isBoundThingInRange() && this.getProvider() != null ? this.getProvider().extractEnergy(from, maxExtract, simulate) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from){
|
||||
if(this.isBoundTileInRage()){
|
||||
if(this.isBoundThingInRange()){
|
||||
if(this.getProvider() != null) return this.getProvider().getEnergyStored(from);
|
||||
if(this.getReceiver() != null) return this.getReceiver().getEnergyStored(from);
|
||||
}
|
||||
|
@ -296,7 +313,7 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
|
|||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from){
|
||||
if(this.isBoundTileInRage()){
|
||||
if(this.isBoundThingInRange()){
|
||||
if(this.getProvider() != null) return this.getProvider().getMaxEnergyStored(from);
|
||||
if(this.getReceiver() != null) return this.getReceiver().getMaxEnergyStored(from);
|
||||
}
|
||||
|
@ -305,7 +322,7 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
|
|||
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from){
|
||||
if(this.isBoundTileInRage()){
|
||||
if(this.isBoundThingInRange()){
|
||||
if(this.getProvider() != null) return this.getProvider().canConnectEnergy(from);
|
||||
if(this.getReceiver() != null) return this.getReceiver().canConnectEnergy(from);
|
||||
}
|
||||
|
@ -317,7 +334,7 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
|
|||
|
||||
public TileEntityPhantomItemface(){
|
||||
super("phantomface");
|
||||
this.type = BlockPhantomface.FACE;
|
||||
this.type = BlockPhantom.FACE;
|
||||
}
|
||||
|
||||
public IInventory getInventory(){
|
||||
|
@ -329,8 +346,8 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isBoundTileInRage(){
|
||||
return super.isBoundTileInRage() && this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IInventory;
|
||||
public boolean isBoundThingInRange(){
|
||||
return super.isBoundThingInRange() && this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IInventory;
|
||||
}
|
||||
|
||||
public ISidedInventory getSided(){
|
||||
|
@ -339,7 +356,7 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
|
|||
|
||||
@Override
|
||||
public int getInventoryStackLimit(){
|
||||
return this.isBoundTileInRage() ? this.getInventory().getInventoryStackLimit() : 0;
|
||||
return this.isBoundThingInRange() ? this.getInventory().getInventoryStackLimit() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -349,33 +366,33 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
|
|||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return this.isBoundTileInRage() && this.getInventory().isItemValidForSlot(i, stack);
|
||||
return this.isBoundThingInRange() && this.getInventory().isItemValidForSlot(i, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i){
|
||||
return this.isBoundTileInRage() ? this.getInventory().getStackInSlotOnClosing(i) : null;
|
||||
return this.isBoundThingInRange() ? this.getInventory().getStackInSlotOnClosing(i) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack stack){
|
||||
if(this.isBoundTileInRage()) this.getInventory().setInventorySlotContents(i, stack);
|
||||
if(this.isBoundThingInRange()) this.getInventory().setInventorySlotContents(i, stack);
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory(){
|
||||
return this.isBoundTileInRage() ? this.getInventory().getSizeInventory() : 0;
|
||||
return this.isBoundThingInRange() ? this.getInventory().getSizeInventory() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i){
|
||||
return this.isBoundTileInRage() ? this.getInventory().getStackInSlot(i) : null;
|
||||
return this.isBoundThingInRange() ? this.getInventory().getStackInSlot(i) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j){
|
||||
return this.isBoundTileInRage() ? this.getInventory().decrStackSize(i, j) : null;
|
||||
return this.isBoundThingInRange() ? this.getInventory().decrStackSize(i, j) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -385,7 +402,7 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
|
|||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side){
|
||||
if(this.isBoundTileInRage()){
|
||||
if(this.isBoundThingInRange()){
|
||||
if(this.getSided() != null){
|
||||
return this.getSided().getAccessibleSlotsFromSide(side);
|
||||
}
|
||||
|
@ -402,12 +419,12 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
|
|||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
return this.isBoundTileInRage() && (this.getSided() == null || this.getSided().canInsertItem(slot, stack, side));
|
||||
return this.isBoundThingInRange() && (this.getSided() == null || this.getSided().canInsertItem(slot, stack, side));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return this.isBoundTileInRage() && (this.getSided() == null || this.getSided().canExtractItem(slot, stack, side));
|
||||
return this.isBoundThingInRange() && (this.getSided() == null || this.getSided().canExtractItem(slot, stack, side));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -314,7 +314,7 @@ tooltip.actuallyadditions.phantom.boundTo.desc=Bound to
|
|||
tooltip.actuallyadditions.phantom.connectedRange.desc=The Connection is fine and working.
|
||||
tooltip.actuallyadditions.phantom.connectedNoRange.desc=The Connection is obstructed: It is either not in Range, not in loaded Chunks or not the right type of Block for this Phantom Device.
|
||||
tooltip.actuallyadditions.phantom.notConnected.desc=This isn't connected to anything!
|
||||
tooltip.actuallyadditions.phantom.blockInfo.desc=The connected Block is a %s at %s, %s, %s that is %s Blocks away.
|
||||
tooltip.actuallyadditions.phantom.blockInfo.desc=The connected Block is %s at %s, %s, %s that is %s Blocks away.
|
||||
|
||||
tooltip.actuallyadditions.factory.notPart.desc=The Controller isn't part of the right Multi-Block! Look at the Controller's Description!
|
||||
tooltip.actuallyadditions.factory.works.desc=This Lava Factory is complete and can produce Lava!
|
||||
|
|
Loading…
Reference in a new issue