mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 11:59:14 +00:00
Comparator output on seared tanks and Smeltery
Unmerged 164accessory commits #932
This commit is contained in:
1 parent
e4888147db
commit
5c78471fff
4 files changed
+59
No files matched your search
@@ -323,4 +323,22 @@ public class LavaTankBlock extends BlockContainer
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Comparator
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int comparatorSide)
|
||||
{
|
||||
return getTankLogic(world, x, y, z).comparatorStrength();
|
||||
}
|
||||
|
||||
public static LavaTankLogic getTankLogic(IBlockAccess blockAccess, int par1, int par2, int par3)
|
||||
{
|
||||
return (LavaTankLogic)blockAccess.getTileEntity(par1, par2, par3);
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -320,4 +321,31 @@ public class SmelteryBlock extends InventoryBlock
|
||||
}
|
||||
super.breakBlock(world, x, y, z, blockID, meta);
|
||||
}
|
||||
|
||||
//Comparator
|
||||
|
||||
public boolean hasComparatorInputOverride ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getComparatorInputOverride (World world, int x, int y, int z, int comparatorSide)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta == 0)
|
||||
{
|
||||
if (PHConstruct.newSmeltery)
|
||||
return 0;
|
||||
else
|
||||
return Container.calcRedstoneFromInventory(((SmelteryLogic) world.getTileEntity(x, y, z)));
|
||||
}
|
||||
if (meta == 1)
|
||||
{
|
||||
if (PHConstruct.newSmeltery)
|
||||
return 0;
|
||||
else
|
||||
return ((SmelteryDrainLogic) world.getTileEntity(x, y, z)).comparatorStrength();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -183,4 +183,9 @@ public class LavaTankLogic extends MultiServantLogic implements IFluidHandler
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
public int comparatorStrength()
|
||||
{
|
||||
return 15 * tank.getFluidAmount() / tank.getCapacity();
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package tconstruct.smeltery.logic;
|
||||
|
||||
import mantle.blocks.abstracts.MultiServantLogic;
|
||||
import mantle.blocks.iface.IFacingLogic;
|
||||
import mantle.world.CoordTuple;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
@@ -185,4 +186,11 @@ public class SmelteryDrainLogic extends MultiServantLogic implements IFluidHandl
|
||||
readFromNBT(packet.func_148857_g());
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
public int comparatorStrength()
|
||||
{
|
||||
CoordTuple master = this.getMasterPosition();
|
||||
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getTileEntity(master.x, master.y, master.z);
|
||||
return 15 * smeltery.currentLiquid / smeltery.maxLiquid;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user