Alloy furnace - Basic comparator output

This commit is contained in:
Emmanuel BENOîT 2016-06-24 10:31:03 +02:00
parent f5ed74d373
commit 11993d575b
2 changed files with 22 additions and 2 deletions

View file

@ -41,7 +41,6 @@ materials.ores No Tin
materials.ores No Zinc materials.ores No Zinc
------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------
tech.base No Alloy furnace tech.base No Alloy furnace
-> comparator output
-> search recipe -> search recipe
-> crafting recipe -> crafting recipe
-> I18n -> I18n

View file

@ -22,6 +22,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents; import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.InventoryHelper; import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -330,7 +331,6 @@ public class TBAlloyFurnaceBlock
{ {
if ( !TBAlloyFurnaceBlock.keepInventory ) { if ( !TBAlloyFurnaceBlock.keepInventory ) {
final TileEntity tileEntity = worldIn.getTileEntity( pos ); final TileEntity tileEntity = worldIn.getTileEntity( pos );
if ( tileEntity instanceof TBAlloyFurnaceTileEntity ) { if ( tileEntity instanceof TBAlloyFurnaceTileEntity ) {
final TBAlloyFurnaceTileEntity afte = (TBAlloyFurnaceTileEntity) tileEntity; final TBAlloyFurnaceTileEntity afte = (TBAlloyFurnaceTileEntity) tileEntity;
afte.cancelAlloying( ); afte.cancelAlloying( );
@ -338,9 +338,30 @@ public class TBAlloyFurnaceBlock
InventoryHelper.dropInventoryItems( worldIn , pos , afte.fuel ); InventoryHelper.dropInventoryItems( worldIn , pos , afte.fuel );
InventoryHelper.dropInventoryItems( worldIn , pos , afte.output ); InventoryHelper.dropInventoryItems( worldIn , pos , afte.output );
} }
worldIn.updateComparatorOutputLevel(pos, this);
} }
super.breakBlock( worldIn , pos , state ); super.breakBlock( worldIn , pos , state );
} }
// *************************************************************************************************
// COMPARATORS
// *************************************************************************************************
public boolean hasComparatorInputOverride( IBlockState state )
{
return true;
}
public int getComparatorInputOverride( IBlockState blockState , World worldIn , BlockPos pos )
{
TileEntity te = worldIn.getTileEntity( pos );
if ( ! ( te instanceof TBAlloyFurnaceTileEntity ) ) {
return 0;
}
return Container.calcRedstoneFromInventory( ( (TBAlloyFurnaceTileEntity) te ).output );
}
} }