mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-23 11:49:23 +01:00
Cleanup~
This commit is contained in:
parent
cd1e323057
commit
1dbe79ac6f
2 changed files with 41 additions and 41 deletions
|
@ -39,18 +39,6 @@ public class BlockFurnaceSolar extends BlockContainerBase implements IActAddItem
|
||||||
this.setBlockBounds(0F, 0F, 0F, 1F, 3F/16F, 1F);
|
this.setBlockBounds(0F, 0F, 0F, 1F, 3F/16F, 1F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
|
||||||
if(!world.isRemote){
|
|
||||||
TileEntityFurnaceSolar generator = (TileEntityFurnaceSolar)world.getTileEntity(x, y, z);
|
|
||||||
if(generator != null){
|
|
||||||
player.addChatComponentMessage(new ChatComponentText(generator.storage.getEnergyStored()+"/"+generator.storage.getMaxEnergyStored()+" RF"));
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2){
|
||||||
return new TileEntityFurnaceSolar();
|
return new TileEntityFurnaceSolar();
|
||||||
|
@ -76,6 +64,18 @@ public class BlockFurnaceSolar extends BlockContainerBase implements IActAddItem
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||||
|
if(!world.isRemote){
|
||||||
|
TileEntityFurnaceSolar generator = (TileEntityFurnaceSolar)world.getTileEntity(x, y, z);
|
||||||
|
if(generator != null){
|
||||||
|
player.addChatComponentMessage(new ChatComponentText(generator.storage.getEnergyStored()+"/"+generator.storage.getMaxEnergyStored()+" RF"));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconReg){
|
public void registerBlockIcons(IIconRegister iconReg){
|
||||||
|
|
|
@ -40,40 +40,11 @@ public class TileEntityPhantomItemface extends TileEntityPhantomface{
|
||||||
return new int[0];
|
return new int[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public ISidedInventory getSided(){
|
|
||||||
return this.getInventory() instanceof ISidedInventory ? (ISidedInventory)this.getInventory() : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getInventoryStackLimit(){
|
public int getInventoryStackLimit(){
|
||||||
return this.isBoundThingInRange() ? this.getInventory().getInventoryStackLimit() : 0;
|
return this.isBoundThingInRange() ? this.getInventory().getInventoryStackLimit() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isBoundThingInRange(){
|
|
||||||
return super.isBoundThingInRange() && this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IInventory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IInventory getInventory(){
|
|
||||||
if(this.boundPosition != null && this.boundPosition.getWorld() != null){
|
|
||||||
TileEntity tile = boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ());
|
|
||||||
if(tile instanceof IInventory){
|
|
||||||
return (IInventory)tile;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canInsertItem(int slot, ItemStack stack, int 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.isBoundThingInRange() && (this.getSided() == null || this.getSided().canExtractItem(slot, stack, side));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return this.isBoundThingInRange() && this.getInventory().isItemValidForSlot(i, stack);
|
return this.isBoundThingInRange() && this.getInventory().isItemValidForSlot(i, stack);
|
||||||
|
@ -112,4 +83,33 @@ public class TileEntityPhantomItemface extends TileEntityPhantomface{
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBoundThingInRange(){
|
||||||
|
return super.isBoundThingInRange() && this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IInventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ISidedInventory getSided(){
|
||||||
|
return this.getInventory() instanceof ISidedInventory ? (ISidedInventory)this.getInventory() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IInventory getInventory(){
|
||||||
|
if(this.boundPosition != null && this.boundPosition.getWorld() != null){
|
||||||
|
TileEntity tile = boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ());
|
||||||
|
if(tile instanceof IInventory){
|
||||||
|
return (IInventory)tile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canInsertItem(int slot, ItemStack stack, int 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.isBoundThingInRange() && (this.getSided() == null || this.getSided().canExtractItem(slot, stack, side));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue