fix autocrafting logic bug with container items and processing patterns

fix message reporting missing items having their values swapped
This commit is contained in:
PrototypeTrousers
2022-08-08 19:06:50 -03:00
parent 9fdf0345b3
commit a55dbb061c
5 changed files with 12 additions and 12 deletions
@@ -33,10 +33,10 @@ public class PacketInformPlayer extends AppEngPacket
}
}
public PacketInformPlayer( IAEItemStack extra, IAEItemStack result, InfoType type ) throws IOException
public PacketInformPlayer( IAEItemStack expected, IAEItemStack actual, InfoType type ) throws IOException
{
this.reportedItem = extra;
this.actualItem = result;
this.reportedItem = expected;
this.actualItem = actual;
this.type = type;
final ByteBuf data = Unpooled.buffer();
@@ -360,21 +360,21 @@ public class CraftingTreeNode
{
for( final IAEItemStack i : this.used )
{
final IAEItemStack ex = storage.extractItems( i, Actionable.MODULATE, src );
final IAEItemStack actuallyExtracted = storage.extractItems( i, Actionable.MODULATE, src );
if( ex == null || ex.getStackSize() != i.getStackSize() )
if( actuallyExtracted == null || actuallyExtracted.getStackSize() != i.getStackSize() )
{
if( src.player().isPresent() )
{
try
{
if( ex == null )
if( actuallyExtracted == null )
{
NetworkHandler.instance().sendTo( new PacketInformPlayer( i, null, PacketInformPlayer.InfoType.NO_ITEMS_EXTRACTED ), (EntityPlayerMP) src.player().get() );
}
else
{
NetworkHandler.instance().sendTo( new PacketInformPlayer( ex, i, PacketInformPlayer.InfoType.PARTIAL_ITEM_EXTRACTION ), (EntityPlayerMP) src.player().get() );
NetworkHandler.instance().sendTo( new PacketInformPlayer( i, actuallyExtracted, PacketInformPlayer.InfoType.PARTIAL_ITEM_EXTRACTION ), (EntityPlayerMP) src.player().get() );
}
}
catch( IOException e )
@@ -385,7 +385,7 @@ public class CraftingTreeNode
throw new CraftBranchFailure( i, i.getStackSize() );
}
craftingCPUCluster.addStorage( ex );
craftingCPUCluster.addStorage( actuallyExtracted );
}
if( this.howManyEmitted > 0 )
@@ -251,7 +251,7 @@ public class CraftingTreeProcess
{
final IAEItemStack stack = entry.getKey().request( inv, entry.getValue() * amountOfTimes, src );
if( stack.getItem().hasContainerItem( stack.getDefinition() ) )
if( this.details.isCraftable() && stack.getItem().hasContainerItem( stack.getDefinition() ) )
{
final ItemStack is = Platform.getContainerItem( stack.createItemStack() );
final IAEItemStack o = AEItemStack.fromItemStack( is );
@@ -318,11 +318,11 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
{
if( result == null )
{
NetworkHandler.instance().sendTo( new PacketInformPlayer( extra, null, PacketInformPlayer.InfoType.NO_ITEMS_EXTRACTED ), (EntityPlayerMP) src.player().get() );
NetworkHandler.instance().sendTo( new PacketInformPlayer( null, extra, PacketInformPlayer.InfoType.NO_ITEMS_EXTRACTED ), (EntityPlayerMP) src.player().get() );
}
else
{
NetworkHandler.instance().sendTo( new PacketInformPlayer( extra, result, PacketInformPlayer.InfoType.PARTIAL_ITEM_EXTRACTION ), (EntityPlayerMP) src.player().get() );
NetworkHandler.instance().sendTo( new PacketInformPlayer( result, extra, PacketInformPlayer.InfoType.PARTIAL_ITEM_EXTRACTION ), (EntityPlayerMP) src.player().get() );
}
}
catch( IOException e )