mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-25 14:24:35 +00:00
Redesigned Filter Cards to serve as Configuration Cards, fixed inventory interaction bug, fixed Creative Energy Cube bug, added new recipes
This commit is contained in:
1 parent
668643e663
commit
866c76bafe
32 files changed
+577
-306
No files matched your search
@@ -91,14 +91,33 @@ public final class InventoryUtils
|
||||
|
||||
if(inSlot == null)
|
||||
{
|
||||
inventory.setInventorySlotContents(i, toInsert);
|
||||
inventory.markDirty();
|
||||
|
||||
return null;
|
||||
if(toInsert.stackSize <= inventory.getInventoryStackLimit())
|
||||
{
|
||||
inventory.setInventorySlotContents(i, toInsert);
|
||||
inventory.markDirty();
|
||||
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
int rejects = toInsert.stackSize - inventory.getInventoryStackLimit();
|
||||
|
||||
ItemStack toSet = toInsert.copy();
|
||||
toSet.stackSize = inventory.getInventoryStackLimit();
|
||||
|
||||
ItemStack remains = toInsert.copy();
|
||||
remains.stackSize = rejects;
|
||||
|
||||
inventory.setInventorySlotContents(i, toSet);
|
||||
inventory.markDirty();
|
||||
|
||||
toInsert = remains;
|
||||
}
|
||||
}
|
||||
else if(areItemsStackable(toInsert, inSlot) && inSlot.stackSize < inSlot.getMaxStackSize() && inSlot.stackSize < inventory.getInventoryStackLimit())
|
||||
else if(areItemsStackable(toInsert, inSlot) && inSlot.stackSize < Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit()))
|
||||
{
|
||||
if(inSlot.stackSize + toInsert.stackSize <= inSlot.getMaxStackSize())
|
||||
int max = Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit());
|
||||
|
||||
if(inSlot.stackSize + toInsert.stackSize <= max)
|
||||
{
|
||||
ItemStack toSet = toInsert.copy();
|
||||
toSet.stackSize += inSlot.stackSize;
|
||||
@@ -109,10 +128,10 @@ public final class InventoryUtils
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
int rejects = (inSlot.stackSize + toInsert.stackSize) - inSlot.getMaxStackSize();
|
||||
int rejects = (inSlot.stackSize + toInsert.stackSize) - max;
|
||||
|
||||
ItemStack toSet = toInsert.copy();
|
||||
toSet.stackSize = inSlot.getMaxStackSize();
|
||||
toSet.stackSize = max;
|
||||
|
||||
ItemStack remains = toInsert.copy();
|
||||
remains.stackSize = rejects;
|
||||
@@ -152,14 +171,33 @@ public final class InventoryUtils
|
||||
|
||||
if(inSlot == null)
|
||||
{
|
||||
inventory.setInventorySlotContents(slotID, toInsert);
|
||||
inventory.markDirty();
|
||||
|
||||
return null;
|
||||
if(toInsert.stackSize <= inventory.getInventoryStackLimit())
|
||||
{
|
||||
inventory.setInventorySlotContents(slotID, toInsert);
|
||||
inventory.markDirty();
|
||||
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
int rejects = toInsert.stackSize - inventory.getInventoryStackLimit();
|
||||
|
||||
ItemStack toSet = toInsert.copy();
|
||||
toSet.stackSize = inventory.getInventoryStackLimit();
|
||||
|
||||
ItemStack remains = toInsert.copy();
|
||||
remains.stackSize = rejects;
|
||||
|
||||
inventory.setInventorySlotContents(slotID, toSet);
|
||||
inventory.markDirty();
|
||||
|
||||
toInsert = remains;
|
||||
}
|
||||
}
|
||||
else if(areItemsStackable(toInsert, inSlot) && inSlot.stackSize < inSlot.getMaxStackSize() && inSlot.stackSize < inventory.getInventoryStackLimit())
|
||||
else if(areItemsStackable(toInsert, inSlot) && inSlot.stackSize < Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit()))
|
||||
{
|
||||
if(inSlot.stackSize + toInsert.stackSize <= inSlot.getMaxStackSize())
|
||||
int max = Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit());
|
||||
|
||||
if(inSlot.stackSize + toInsert.stackSize <= max)
|
||||
{
|
||||
ItemStack toSet = toInsert.copy();
|
||||
toSet.stackSize += inSlot.stackSize;
|
||||
@@ -170,10 +208,10 @@ public final class InventoryUtils
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
int rejects = (inSlot.stackSize + toInsert.stackSize) - inSlot.getMaxStackSize();
|
||||
int rejects = (inSlot.stackSize + toInsert.stackSize) - max;
|
||||
|
||||
ItemStack toSet = toInsert.copy();
|
||||
toSet.stackSize = inSlot.getMaxStackSize();
|
||||
toSet.stackSize = max;
|
||||
|
||||
ItemStack remains = toInsert.copy();
|
||||
remains.stackSize = rejects;
|
||||
@@ -406,16 +444,29 @@ public final class InventoryUtils
|
||||
|
||||
if(inSlot == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(areItemsStackable(itemStack, inSlot) && inSlot.stackSize < inSlot.getMaxStackSize() && inSlot.stackSize < inventory.getInventoryStackLimit())
|
||||
{
|
||||
if(inSlot.stackSize + itemStack.stackSize <= inSlot.getMaxStackSize())
|
||||
if(itemStack.stackSize <= inventory.getInventoryStackLimit())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
int rejects = (inSlot.stackSize + itemStack.stackSize) - inSlot.getMaxStackSize();
|
||||
int rejects = itemStack.stackSize - inventory.getInventoryStackLimit();
|
||||
|
||||
if(rejects < itemStack.stackSize)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(areItemsStackable(itemStack, inSlot) && inSlot.stackSize < Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit()))
|
||||
{
|
||||
int max = Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit());
|
||||
|
||||
if(inSlot.stackSize + itemStack.stackSize <= max)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
int rejects = (inSlot.stackSize + itemStack.stackSize) - max;
|
||||
|
||||
if(rejects < itemStack.stackSize)
|
||||
{
|
||||
@@ -452,16 +503,29 @@ public final class InventoryUtils
|
||||
|
||||
if(inSlot == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(areItemsStackable(itemStack, inSlot) && inSlot.stackSize < inSlot.getMaxStackSize() && inSlot.stackSize < inventory.getInventoryStackLimit())
|
||||
{
|
||||
if(inSlot.stackSize + itemStack.stackSize <= inSlot.getMaxStackSize())
|
||||
if(itemStack.stackSize <= inventory.getInventoryStackLimit())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
int rejects = (inSlot.stackSize + itemStack.stackSize) - inSlot.getMaxStackSize();
|
||||
int rejects = itemStack.stackSize - inventory.getInventoryStackLimit();
|
||||
|
||||
if(rejects < itemStack.stackSize)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(areItemsStackable(itemStack, inSlot) && inSlot.stackSize < Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit()))
|
||||
{
|
||||
int max = Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit());
|
||||
|
||||
if(inSlot.stackSize + itemStack.stackSize <= max)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
int rejects = (inSlot.stackSize + itemStack.stackSize) - max;
|
||||
|
||||
if(rejects < itemStack.stackSize)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user