Alloy furnace - Slag when breaking during alloying

This commit is contained in:
Emmanuel BENOîT 2016-06-23 20:44:20 +02:00
parent fab9b117ab
commit bc183d661e
2 changed files with 13 additions and 3 deletions

View file

@ -315,6 +315,7 @@ public class TBAlloyFurnaceBlock
if ( tileEntity instanceof TBAlloyFurnaceTileEntity ) { if ( tileEntity instanceof TBAlloyFurnaceTileEntity ) {
final TBAlloyFurnaceTileEntity afte = (TBAlloyFurnaceTileEntity) tileEntity; final TBAlloyFurnaceTileEntity afte = (TBAlloyFurnaceTileEntity) tileEntity;
afte.cancelAlloying( );
InventoryHelper.dropInventoryItems( worldIn , pos , afte.input ); InventoryHelper.dropInventoryItems( worldIn , pos , afte.input );
InventoryHelper.dropInventoryItems( worldIn , pos , afte.fuel ); InventoryHelper.dropInventoryItems( worldIn , pos , afte.fuel );
InventoryHelper.dropInventoryItems( worldIn , pos , afte.output ); InventoryHelper.dropInventoryItems( worldIn , pos , afte.output );

View file

@ -127,9 +127,8 @@ public class TBAlloyFurnaceTileEntity
if ( this.burnCurrent == 0 ) { if ( this.burnCurrent == 0 ) {
if ( this.alloying != null ) { if ( this.alloying != null ) {
if ( !this.startBurning( this.alloyCurrent ) ) { if ( !this.startBurning( this.alloyCurrent ) ) {
this.addOutput( new ItemStack( Materials.ITEM_SLAG , this.alloying.getTotalInputItems( ) ) ); cancelAlloying( );
this.alloying = null; this.burnCurrent = this.burnTotal = 0;
this.alloyCurrent = this.burnCurrent = this.burnTotal = 0;
} }
} else { } else {
this.burnTotal = this.burnCurrent = 0; this.burnTotal = this.burnCurrent = 0;
@ -153,6 +152,16 @@ public class TBAlloyFurnaceTileEntity
} }
public void cancelAlloying( )
{
if ( this.alloying != null ) {
this.addOutput( new ItemStack( Materials.ITEM_SLAG , this.alloying.getTotalInputItems( ) ) );
this.alloying = null;
this.alloyCurrent = 0;
}
}
public void setRecipe( final ResourceLocation location ) public void setRecipe( final ResourceLocation location )
{ {
MAlloyRecipe recipe = MAlloyRecipe.REGISTRY.getRecipe( location ); MAlloyRecipe recipe = MAlloyRecipe.REGISTRY.getRecipe( location );