Fixed Bug: #0998 - crash with latest version of better chests
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
package appeng.integration.modules;
|
package appeng.integration.modules;
|
||||||
|
|
||||||
import net.mcft.copy.betterstorage.api.ICrateStorage;
|
import net.mcft.copy.betterstorage.api.crate.ICrateStorage;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.integration.IIntegrationModule;
|
import appeng.integration.IIntegrationModule;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package appeng.integration.modules.helpers;
|
package appeng.integration.modules.helpers;
|
||||||
|
|
||||||
import net.mcft.copy.betterstorage.api.ICrateStorage;
|
import net.mcft.copy.betterstorage.api.crate.ICrateStorage;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
@@ -34,7 +34,7 @@ public class BSCrate implements IMEInventory<IAEItemStack>
|
|||||||
if ( mode == Actionable.SIMULATE )
|
if ( mode == Actionable.SIMULATE )
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
ItemStack failed = cs.insertItems( side, input.getItemStack() );
|
ItemStack failed = cs.insertItems( input.getItemStack() );
|
||||||
if ( failed == null )
|
if ( failed == null )
|
||||||
return null;
|
return null;
|
||||||
input.setStackSize( failed.stackSize );
|
input.setStackSize( failed.stackSize );
|
||||||
@@ -46,18 +46,18 @@ public class BSCrate implements IMEInventory<IAEItemStack>
|
|||||||
{
|
{
|
||||||
if ( mode == Actionable.SIMULATE )
|
if ( mode == Actionable.SIMULATE )
|
||||||
{
|
{
|
||||||
int howMany = cs.getItemCount( side, request.getItemStack() );
|
int howMany = cs.getItemCount( request.getItemStack() );
|
||||||
return howMany > request.getStackSize() ? request : request.copy().setStackSize( howMany );
|
return howMany > request.getStackSize() ? request : request.copy().setStackSize( howMany );
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack Obtained = cs.extractItems( side, request.getItemStack() );
|
ItemStack Obtained = cs.extractItems( request.getItemStack(), (int) request.getStackSize() );
|
||||||
return AEItemStack.create( Obtained );
|
return AEItemStack.create( Obtained );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IItemList getAvailableItems(IItemList out)
|
public IItemList getAvailableItems(IItemList out)
|
||||||
{
|
{
|
||||||
for (ItemStack is : cs.getContents( side ))
|
for (ItemStack is : cs.getContents())
|
||||||
{
|
{
|
||||||
out.add( AEItemStack.create( is ) );
|
out.add( AEItemStack.create( is ) );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package appeng.integration.modules.helpers;
|
package appeng.integration.modules.helpers;
|
||||||
|
|
||||||
import net.mcft.copy.betterstorage.api.ICrateStorage;
|
import net.mcft.copy.betterstorage.api.crate.ICrateStorage;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.BaseActionSource;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package appeng.integration.modules.helpers;
|
|||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import net.mcft.copy.betterstorage.api.ICrateStorage;
|
import net.mcft.copy.betterstorage.api.crate.ICrateStorage;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import appeng.api.config.FuzzyMode;
|
import appeng.api.config.FuzzyMode;
|
||||||
@@ -28,7 +28,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||||||
{
|
{
|
||||||
ItemStack target = null;
|
ItemStack target = null;
|
||||||
|
|
||||||
for (ItemStack is : cs.getContents( side ))
|
for (ItemStack is : cs.getContents())
|
||||||
{
|
{
|
||||||
if ( is != null )
|
if ( is != null )
|
||||||
{
|
{
|
||||||
@@ -47,7 +47,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||||||
{
|
{
|
||||||
ItemStack f = Platform.cloneItemStack( target );
|
ItemStack f = Platform.cloneItemStack( target );
|
||||||
f.stackSize = how_many;
|
f.stackSize = how_many;
|
||||||
return cs.extractItems( side, f );
|
return cs.extractItems( f, how_many );
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@@ -58,7 +58,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||||||
{
|
{
|
||||||
ItemStack target = null;
|
ItemStack target = null;
|
||||||
|
|
||||||
for (ItemStack is : cs.getContents( side ))
|
for (ItemStack is : cs.getContents())
|
||||||
{
|
{
|
||||||
if ( is != null )
|
if ( is != null )
|
||||||
{
|
{
|
||||||
@@ -75,7 +75,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||||||
|
|
||||||
if ( target != null )
|
if ( target != null )
|
||||||
{
|
{
|
||||||
int cnt = cs.getItemCount( side, target );
|
int cnt = cs.getItemCount( target );
|
||||||
if ( cnt == 0 )
|
if ( cnt == 0 )
|
||||||
return null;
|
return null;
|
||||||
if ( cnt > how_many )
|
if ( cnt > how_many )
|
||||||
@@ -93,7 +93,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||||||
{
|
{
|
||||||
ItemStack target = null;
|
ItemStack target = null;
|
||||||
|
|
||||||
for (ItemStack is : cs.getContents( side ))
|
for (ItemStack is : cs.getContents())
|
||||||
{
|
{
|
||||||
if ( is != null )
|
if ( is != null )
|
||||||
{
|
{
|
||||||
@@ -112,7 +112,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||||||
{
|
{
|
||||||
ItemStack f = Platform.cloneItemStack( target );
|
ItemStack f = Platform.cloneItemStack( target );
|
||||||
f.stackSize = amount;
|
f.stackSize = amount;
|
||||||
return cs.extractItems( side, f );
|
return cs.extractItems( f, amount );
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@@ -123,7 +123,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||||||
{
|
{
|
||||||
ItemStack target = null;
|
ItemStack target = null;
|
||||||
|
|
||||||
for (ItemStack is : cs.getContents( side ))
|
for (ItemStack is : cs.getContents())
|
||||||
{
|
{
|
||||||
if ( is != null )
|
if ( is != null )
|
||||||
{
|
{
|
||||||
@@ -140,7 +140,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||||||
|
|
||||||
if ( target != null )
|
if ( target != null )
|
||||||
{
|
{
|
||||||
int cnt = cs.getItemCount( side, target );
|
int cnt = cs.getItemCount( target );
|
||||||
if ( cnt == 0 )
|
if ( cnt == 0 )
|
||||||
return null;
|
return null;
|
||||||
if ( cnt > how_many )
|
if ( cnt > how_many )
|
||||||
@@ -156,13 +156,13 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||||||
@Override
|
@Override
|
||||||
public ItemStack addItems(ItemStack A)
|
public ItemStack addItems(ItemStack A)
|
||||||
{
|
{
|
||||||
return cs.insertItems( side, A );
|
return cs.insertItems( A );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack simulateAdd(ItemStack A)
|
public ItemStack simulateAdd(ItemStack A)
|
||||||
{
|
{
|
||||||
int items = cs.spaceForItem( side, A );
|
int items = cs.getSpaceForItem( A );
|
||||||
ItemStack B = Platform.cloneItemStack( A );
|
ItemStack B = Platform.cloneItemStack( A );
|
||||||
if ( A.stackSize <= items )
|
if ( A.stackSize <= items )
|
||||||
return null;
|
return null;
|
||||||
@@ -173,13 +173,13 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||||||
@Override
|
@Override
|
||||||
public boolean containsItems()
|
public boolean containsItems()
|
||||||
{
|
{
|
||||||
return cs.getContents( side ).size() > 0;
|
return cs.getUniqueItems() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterator<ItemSlot> iterator()
|
public Iterator<ItemSlot> iterator()
|
||||||
{
|
{
|
||||||
return new StackToSlotIterator( cs.getContents( side ).iterator() );
|
return new StackToSlotIterator( cs.getContents().iterator() );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user