mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-25 14:24:35 +00:00
warning fixes, cleanups
This commit is contained in:
1 parent
2e16622b84
commit
c07ecda4de
6 files changed
+35
-13
No files matched your search
@@ -25,6 +25,7 @@ public class HashedItem {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(obj == this) return true;
|
||||
if (obj instanceof HashedItem) {
|
||||
HashedItem other = (HashedItem) obj;
|
||||
return InventoryUtils.areItemsStackable(itemStack, other.itemStack);
|
||||
|
||||
@@ -22,7 +22,10 @@ import net.minecraftforge.items.IItemHandler;
|
||||
public final class InvStack {
|
||||
|
||||
/** The TileEntity owning the container this InvStack belongs to. */
|
||||
private TileEntity tileEntity;
|
||||
private final TileEntity tileEntity;
|
||||
|
||||
/** The side of the inventory we are accessing with this InvStack. */
|
||||
private final EnumFacing side;
|
||||
|
||||
/**
|
||||
* A map associating the slot IDs in consideration to the amount of items in those slots we care
|
||||
@@ -37,9 +40,6 @@ public final class InvStack {
|
||||
/** The total amount of items tracked by this InvStack. */
|
||||
private int itemCount;
|
||||
|
||||
/** The side of the inventory we are accessing with this InvStack. */
|
||||
public EnumFacing side;
|
||||
|
||||
public InvStack(TileEntity inv, EnumFacing facing) {
|
||||
tileEntity = inv;
|
||||
side = facing;
|
||||
@@ -92,6 +92,13 @@ public final class InvStack {
|
||||
if (!InventoryUtils.isItemHandler(tileEntity, side)) {
|
||||
Mekanism.logger
|
||||
.warn("An InvStack was wrapped around a non-IItemHandler inventory. This should not happen!");
|
||||
|
||||
if (tileEntity == null) {
|
||||
Mekanism.logger.warn(" - null tile");
|
||||
} else {
|
||||
Mekanism.logger.warn(" - details: " + tileEntity + " " + tileEntity.getPos());
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,13 @@ public class StackSearcher {
|
||||
if (!InventoryUtils.isItemHandler(tileEntity, side.getOpposite())) {
|
||||
Mekanism.logger
|
||||
.warn("A StackSearcher was wrapped around a non-IItemHandler inventory. This should not happen!");
|
||||
|
||||
if (tileEntity == null) {
|
||||
Mekanism.logger.warn(" - null tile");
|
||||
} else {
|
||||
Mekanism.logger.warn(" - details: " + tileEntity + " " + tileEntity.getPos());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -49,6 +56,13 @@ public class StackSearcher {
|
||||
if (!InventoryUtils.isItemHandler(tileEntity, side.getOpposite())) {
|
||||
Mekanism.logger
|
||||
.warn("A StackSearcher was wrapped around a non-IItemHandler inventory. This should not happen!");
|
||||
|
||||
if (tileEntity == null) {
|
||||
Mekanism.logger.warn(" - null tile");
|
||||
} else {
|
||||
Mekanism.logger.warn(" - details: " + tileEntity + " " + tileEntity.getPos());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,13 @@ public class TransitRequest {
|
||||
if (!InventoryUtils.isItemHandler(tile, side.getOpposite())) {
|
||||
Mekanism.logger.warn(
|
||||
"A TransitRequest was built with a non-IItemHandler origin inventory. This should not happen!");
|
||||
|
||||
if (tile == null) {
|
||||
Mekanism.logger.warn(" - null tile");
|
||||
} else {
|
||||
Mekanism.logger.warn(" - details: " + tile + " " + tile.getPos());
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
|
||||
for (TransporterFilter filter : filters) {
|
||||
for (StackSearcher search = new StackSearcher(back, facing.getOpposite()); search.i >= 0; ) {
|
||||
InvStack invStack = filter.getStackFromInventory(search);
|
||||
|
||||
|
||||
if (invStack == null || invStack.getStack().isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package mekanism.common.util;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.base.ISideConfiguration;
|
||||
import mekanism.common.content.transporter.HashedItem;
|
||||
import mekanism.common.content.transporter.InvStack;
|
||||
@@ -43,8 +42,6 @@ public final class InventoryUtils {
|
||||
ItemStack toInsert = origInsert.copy();
|
||||
|
||||
if (!isItemHandler(tile, side.getOpposite())) {
|
||||
Mekanism.logger
|
||||
.warn("A transporter attempted to place an item in a non-IItemHandler inventory. This should not happen!");
|
||||
return TransitResponse.EMPTY;
|
||||
}
|
||||
|
||||
@@ -84,8 +81,6 @@ public final class InventoryUtils {
|
||||
InvStack ret = new InvStack(tile, side.getOpposite());
|
||||
|
||||
if (!isItemHandler(tile, side.getOpposite())) {
|
||||
Mekanism.logger
|
||||
.warn("A defined item pull was attempted from a non-IItemHandler inventory. This should not happen!");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -95,7 +90,7 @@ public final class InventoryUtils {
|
||||
ItemStack stack = inventory.extractItem(i, max, true);
|
||||
|
||||
if (!stack.isEmpty() && StackUtils.equalsWildcard(stack, type)) {
|
||||
int current = !ret.getStack().isEmpty() ? ret.getStack().getCount() : 0;
|
||||
int current = ret.getStack().getCount();
|
||||
|
||||
if (current + stack.getCount() <= max) {
|
||||
ret.appendStack(i, stack.copy());
|
||||
@@ -136,8 +131,6 @@ public final class InventoryUtils {
|
||||
}
|
||||
|
||||
if (!isItemHandler(tileEntity, side.getOpposite())) {
|
||||
Mekanism.logger
|
||||
.warn("A transporter attempted to place an item in a non-IItemHandler inventory. This should not happen!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user