mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-24 05:44:27 +00:00
Apply various common one-to-one replacements
More work on common too. network package now done.
This commit is contained in:
1 parent
a0114b5112
commit
a80f724cc2
189 files changed
+1586
-1634
No files matched your search
@@ -14,7 +14,7 @@ import net.minecraft.inventory.InventoryLargeChest;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityChest;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
public final class InventoryUtils
|
||||
{
|
||||
@@ -65,7 +65,7 @@ public final class InventoryUtils
|
||||
return inv;
|
||||
}
|
||||
|
||||
public static ItemStack putStackInInventory(IInventory inventory, ItemStack itemStack, int side, boolean force)
|
||||
public static ItemStack putStackInInventory(IInventory inventory, ItemStack itemStack, EnumFacing side, boolean force)
|
||||
{
|
||||
inventory = checkChestInv(inventory);
|
||||
|
||||
@@ -128,13 +128,13 @@ public final class InventoryUtils
|
||||
}
|
||||
else {
|
||||
ISidedInventory sidedInventory = (ISidedInventory)inventory;
|
||||
int[] slots = sidedInventory.getAccessibleSlotsFromSide(ForgeDirection.OPPOSITES[side]);
|
||||
int[] slots = sidedInventory.getSlotsForFace(side.getOpposite());
|
||||
|
||||
if(slots != null && slots.length != 0)
|
||||
{
|
||||
if(force && sidedInventory instanceof TileEntityBin && ForgeDirection.OPPOSITES[side] == 0)
|
||||
if(force && sidedInventory instanceof TileEntityBin && side == EnumFacing.UP)
|
||||
{
|
||||
slots = sidedInventory.getAccessibleSlotsFromSide(1);
|
||||
slots = sidedInventory.getSlotsForFace(EnumFacing.UP);
|
||||
}
|
||||
|
||||
for(int get = 0; get <= slots.length - 1; get++)
|
||||
@@ -143,7 +143,7 @@ public final class InventoryUtils
|
||||
|
||||
if(!force)
|
||||
{
|
||||
if(!sidedInventory.isItemValidForSlot(slotID, toInsert) || !sidedInventory.canInsertItem(slotID, toInsert, ForgeDirection.OPPOSITES[side]))
|
||||
if(!sidedInventory.isItemValidForSlot(slotID, toInsert) || !sidedInventory.canInsertItem(slotID, toInsert, side.getOpposite()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -197,7 +197,7 @@ public final class InventoryUtils
|
||||
return inSlot.isItemEqual(toInsert) && ItemStack.areItemStackTagsEqual(inSlot, toInsert);
|
||||
}
|
||||
|
||||
public static InvStack takeTopItem(IInventory inventory, int side, int amount)
|
||||
public static InvStack takeTopItem(IInventory inventory, EnumFacing side, int amount)
|
||||
{
|
||||
inventory = checkChestInv(inventory);
|
||||
|
||||
@@ -216,7 +216,7 @@ public final class InventoryUtils
|
||||
}
|
||||
else {
|
||||
ISidedInventory sidedInventory = (ISidedInventory)inventory;
|
||||
int[] slots = sidedInventory.getAccessibleSlotsFromSide(ForgeDirection.OPPOSITES[side]);
|
||||
int[] slots = sidedInventory.getSlotsForFace(side.getOpposite());
|
||||
|
||||
if(slots != null)
|
||||
{
|
||||
@@ -229,7 +229,7 @@ public final class InventoryUtils
|
||||
ItemStack toSend = sidedInventory.getStackInSlot(slotID).copy();
|
||||
toSend.stackSize = Math.min(amount, toSend.stackSize);
|
||||
|
||||
if(sidedInventory.canExtractItem(slotID, toSend, ForgeDirection.OPPOSITES[side]))
|
||||
if(sidedInventory.canExtractItem(slotID, toSend, side.getOpposite()))
|
||||
{
|
||||
return new InvStack(inventory, slotID, toSend);
|
||||
}
|
||||
@@ -241,7 +241,7 @@ public final class InventoryUtils
|
||||
return null;
|
||||
}
|
||||
|
||||
public static InvStack takeDefinedItem(IInventory inventory, int side, ItemStack type, int min, int max)
|
||||
public static InvStack takeDefinedItem(IInventory inventory, EnumFacing side, ItemStack type, int min, int max)
|
||||
{
|
||||
inventory = checkChestInv(inventory);
|
||||
|
||||
@@ -275,7 +275,7 @@ public final class InventoryUtils
|
||||
}
|
||||
else {
|
||||
ISidedInventory sidedInventory = (ISidedInventory)inventory;
|
||||
int[] slots = sidedInventory.getAccessibleSlotsFromSide(ForgeDirection.OPPOSITES[side]);
|
||||
int[] slots = sidedInventory.getSlotsForFace(side.getOpposite());
|
||||
|
||||
if(slots != null && slots.length != 0)
|
||||
{
|
||||
@@ -292,7 +292,7 @@ public final class InventoryUtils
|
||||
{
|
||||
ItemStack copy = stack.copy();
|
||||
|
||||
if(sidedInventory.canExtractItem(slotID, copy, ForgeDirection.OPPOSITES[side]))
|
||||
if(sidedInventory.canExtractItem(slotID, copy, side.getOpposite()))
|
||||
{
|
||||
ret.appendStack(slotID, copy);
|
||||
}
|
||||
@@ -300,7 +300,7 @@ public final class InventoryUtils
|
||||
else {
|
||||
ItemStack copy = stack.copy();
|
||||
|
||||
if(sidedInventory.canExtractItem(slotID, copy, ForgeDirection.OPPOSITES[side]))
|
||||
if(sidedInventory.canExtractItem(slotID, copy, side.getOpposite()))
|
||||
{
|
||||
copy.stackSize = max-current;
|
||||
ret.appendStack(slotID, copy);
|
||||
@@ -324,7 +324,7 @@ public final class InventoryUtils
|
||||
return null;
|
||||
}
|
||||
|
||||
public static InvStack takeTopStack(IInventory inventory, int side, Finder id)
|
||||
public static InvStack takeTopStack(IInventory inventory, EnumFacing side, Finder id)
|
||||
{
|
||||
inventory = checkChestInv(inventory);
|
||||
|
||||
@@ -341,7 +341,7 @@ public final class InventoryUtils
|
||||
}
|
||||
else {
|
||||
ISidedInventory sidedInventory = (ISidedInventory)inventory;
|
||||
int[] slots = sidedInventory.getAccessibleSlotsFromSide(ForgeDirection.OPPOSITES[side]);
|
||||
int[] slots = sidedInventory.getSlotsForFace(side.getOpposite());
|
||||
|
||||
if(slots != null && slots.length != 0)
|
||||
{
|
||||
@@ -353,7 +353,7 @@ public final class InventoryUtils
|
||||
{
|
||||
ItemStack toSend = sidedInventory.getStackInSlot(slotID);
|
||||
|
||||
if(sidedInventory.canExtractItem(slotID, toSend, ForgeDirection.OPPOSITES[side]))
|
||||
if(sidedInventory.canExtractItem(slotID, toSend, side.getOpposite()))
|
||||
{
|
||||
return new InvStack(inventory, slotID, toSend);
|
||||
}
|
||||
@@ -365,7 +365,7 @@ public final class InventoryUtils
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean canInsert(TileEntity tileEntity, EnumColor color, ItemStack itemStack, int side, boolean force)
|
||||
public static boolean canInsert(TileEntity tileEntity, EnumColor color, ItemStack itemStack, EnumFacing side, boolean force)
|
||||
{
|
||||
if(!(tileEntity instanceof IInventory))
|
||||
{
|
||||
@@ -380,8 +380,8 @@ public final class InventoryUtils
|
||||
if(!force && tileEntity instanceof ISideConfiguration)
|
||||
{
|
||||
ISideConfiguration config = (ISideConfiguration)tileEntity;
|
||||
int tileSide = config.getOrientation();
|
||||
EnumColor configColor = config.getEjector().getInputColor(ForgeDirection.getOrientation(MekanismUtils.getBaseOrientation(side, tileSide)).getOpposite());
|
||||
EnumFacing tileSide = config.getOrientation();
|
||||
EnumColor configColor = config.getEjector().getInputColor(MekanismUtils.getBaseOrientation(side, tileSide).getOpposite());
|
||||
|
||||
if(config.getEjector().hasStrictInput() && configColor != null && configColor != color)
|
||||
{
|
||||
@@ -428,13 +428,13 @@ public final class InventoryUtils
|
||||
}
|
||||
else {
|
||||
ISidedInventory sidedInventory = (ISidedInventory)inventory;
|
||||
int[] slots = sidedInventory.getAccessibleSlotsFromSide(ForgeDirection.OPPOSITES[side]);
|
||||
int[] slots = sidedInventory.getSlotsForFace(side.getOpposite());
|
||||
|
||||
if(slots != null && slots.length != 0)
|
||||
{
|
||||
if(force && sidedInventory instanceof TileEntityBin && ForgeDirection.OPPOSITES[side] == 0)
|
||||
if(force && sidedInventory instanceof TileEntityBin && side == EnumFacing.UP)
|
||||
{
|
||||
slots = sidedInventory.getAccessibleSlotsFromSide(1);
|
||||
slots = sidedInventory.getSlotsForFace(EnumFacing.UP);
|
||||
}
|
||||
|
||||
for(int get = 0; get <= slots.length - 1; get++)
|
||||
@@ -443,7 +443,7 @@ public final class InventoryUtils
|
||||
|
||||
if(!force)
|
||||
{
|
||||
if(!sidedInventory.isItemValidForSlot(slotID, itemStack) || !sidedInventory.canInsertItem(slotID, itemStack, ForgeDirection.OPPOSITES[side]))
|
||||
if(!sidedInventory.isItemValidForSlot(slotID, itemStack) || !sidedInventory.canInsertItem(slotID, itemStack, side.getOpposite()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user