move penalty up the chain
This commit is contained in:
@@ -115,6 +115,7 @@ import appeng.util.item.AEItemStack;
|
|||||||
|
|
||||||
public class DualityInterface implements IGridTickable, IStorageMonitorable, IInventoryDestination, IAEAppEngInventory, IConfigManagerHost, ICraftingProvider, IUpgradeableHost
|
public class DualityInterface implements IGridTickable, IStorageMonitorable, IInventoryDestination, IAEAppEngInventory, IConfigManagerHost, ICraftingProvider, IUpgradeableHost
|
||||||
{
|
{
|
||||||
|
private int failedCraftTriesSlot[] = {0,0,0,0,0,0,0,0,0};
|
||||||
|
|
||||||
public static final int NUMBER_OF_STORAGE_SLOTS = 9;
|
public static final int NUMBER_OF_STORAGE_SLOTS = 9;
|
||||||
public static final int NUMBER_OF_CONFIG_SLOTS = 9;
|
public static final int NUMBER_OF_CONFIG_SLOTS = 9;
|
||||||
@@ -696,9 +697,9 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
throw new IllegalStateException( "bad attempt at managing inventory. ( addItems )" );
|
throw new IllegalStateException( "bad attempt at managing inventory. ( addItems )" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
changed = this.handleCrafting( x, adaptor, itemStack ) || changed;
|
changed = this.handleCrafting(x, adaptor, itemStack) || changed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( itemStack.getStackSize() < 0 )
|
else if( itemStack.getStackSize() < 0 )
|
||||||
@@ -766,8 +767,16 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
{
|
{
|
||||||
if( this.getInstalledUpgrades( Upgrades.CRAFTING ) > 0 && itemStack != null )
|
if( this.getInstalledUpgrades( Upgrades.CRAFTING ) > 0 && itemStack != null )
|
||||||
{
|
{
|
||||||
return this.craftingTracker.handleCrafting( x, itemStack.getStackSize(), itemStack, d, this.iHost.getTileEntity().getWorld(),
|
if (this.failedCraftTriesSlot[x] <= 0) {
|
||||||
|
|
||||||
|
boolean crafted = this.craftingTracker.handleCrafting( x, itemStack.getStackSize(), itemStack, d, this.iHost.getTileEntity().getWorld(),
|
||||||
this.gridProxy.getGrid(), this.gridProxy.getCrafting(), this.mySource );
|
this.gridProxy.getGrid(), this.gridProxy.getCrafting(), this.mySource );
|
||||||
|
|
||||||
|
if (crafted) this.failedCraftTriesSlot[x] = 0;
|
||||||
|
else this.failedCraftTriesSlot[x] += 20;
|
||||||
|
}
|
||||||
|
this.failedCraftTriesSlot[x] -= 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( final GridAccessException e )
|
catch( final GridAccessException e )
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ public class MultiCraftingTracker
|
|||||||
|
|
||||||
private Future<ICraftingJob>[] jobs = null;
|
private Future<ICraftingJob>[] jobs = null;
|
||||||
private ICraftingLink[] links = null;
|
private ICraftingLink[] links = null;
|
||||||
private int failedCraftTriesSlot[] = {0,0,0,0,0,0,0,0,0};
|
|
||||||
|
|
||||||
public MultiCraftingTracker( final ICraftingRequester o, final int size )
|
public MultiCraftingTracker( final ICraftingRequester o, final int size )
|
||||||
{
|
{
|
||||||
@@ -131,14 +130,10 @@ public class MultiCraftingTracker
|
|||||||
if( this.getLink( x ) == null )
|
if( this.getLink( x ) == null )
|
||||||
{
|
{
|
||||||
final IAEItemStack aisC = ais.copy();
|
final IAEItemStack aisC = ais.copy();
|
||||||
if (this.failedCraftTriesSlot[x] <= 0) {
|
aisC.setStackSize( itemToCraft );
|
||||||
aisC.setStackSize(itemToCraft);
|
|
||||||
this.setJob(x, cg.beginCraftingJob(w, g, mySrc, aisC, null));
|
this.setJob( x, cg.beginCraftingJob( w, g, mySrc, aisC, null ) );
|
||||||
}
|
|
||||||
if (getJob(x) != null) this.failedCraftTriesSlot[x] = 0;
|
|
||||||
else this.failedCraftTriesSlot[x] += 20;
|
|
||||||
}
|
}
|
||||||
this.failedCraftTriesSlot[x] -= 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ import appeng.util.item.AEItemStack;
|
|||||||
|
|
||||||
public class PartExportBus extends PartSharedItemBus implements ICraftingRequester
|
public class PartExportBus extends PartSharedItemBus implements ICraftingRequester
|
||||||
{
|
{
|
||||||
|
private int failedCraftTriesSlot[] = {0,0,0,0,0,0,0,0,0};
|
||||||
|
|
||||||
public static final ResourceLocation MODEL_BASE = new ResourceLocation( AppEng.MOD_ID, "part/export_bus_base" );
|
public static final ResourceLocation MODEL_BASE = new ResourceLocation( AppEng.MOD_ID, "part/export_bus_base" );
|
||||||
|
|
||||||
@@ -149,12 +150,18 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
|||||||
|
|
||||||
final IAEItemStack ais = this.getConfig().getAEStackInSlot( slotToExport );
|
final IAEItemStack ais = this.getConfig().getAEStackInSlot( slotToExport );
|
||||||
|
|
||||||
if( ais == null || this.itemToSend <= 0 || this.craftOnly() )
|
if( ais == null || this.itemToSend <= 0 || this.craftOnly() ) {
|
||||||
{
|
if (this.isCraftingEnabled())
|
||||||
if( this.isCraftingEnabled() )
|
|
||||||
{
|
{
|
||||||
this.didSomething = this.craftingTracker.handleCrafting( slotToExport, this.itemToSend, ais, destination, this.getTile().getWorld(),
|
if (this.failedCraftTriesSlot[x] <= 0) {
|
||||||
this.getProxy().getGrid(), cg, this.mySrc ) || this.didSomething;
|
|
||||||
|
this.didSomething = this.craftingTracker.handleCrafting(slotToExport, this.itemToSend, ais, destination, this.getTile().getWorld(),
|
||||||
|
this.getProxy().getGrid(), cg, this.mySrc) || this.didSomething;
|
||||||
|
|
||||||
|
if (this.didSomething) this.failedCraftTriesSlot[x] = 0;
|
||||||
|
else this.failedCraftTriesSlot[x] += 20;
|
||||||
|
}
|
||||||
|
this.failedCraftTriesSlot[x] -= 1;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -179,8 +186,15 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
|||||||
|
|
||||||
if( this.itemToSend == before && this.isCraftingEnabled() )
|
if( this.itemToSend == before && this.isCraftingEnabled() )
|
||||||
{
|
{
|
||||||
this.didSomething = this.craftingTracker.handleCrafting( slotToExport, this.itemToSend, ais, destination, this.getTile().getWorld(),
|
if (this.failedCraftTriesSlot[x] <= 0) {
|
||||||
this.getProxy().getGrid(), cg, this.mySrc ) || this.didSomething;
|
|
||||||
|
this.didSomething = this.craftingTracker.handleCrafting(slotToExport, this.itemToSend, ais, destination, this.getTile().getWorld(),
|
||||||
|
this.getProxy().getGrid(), cg, this.mySrc) || this.didSomething;
|
||||||
|
|
||||||
|
if (this.didSomething) this.failedCraftTriesSlot[x] = 0;
|
||||||
|
else this.failedCraftTriesSlot[x] += 20;
|
||||||
|
}
|
||||||
|
this.failedCraftTriesSlot[x] -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user