Made all IO blocks have a blacklist instead of a whitelist by default. An empty blacklist now means: accept any item. An empty whitelist now means: don't accept any item (an empty whitelist USED to mean: accept any item).

This commit is contained in:
raoulvdberge
2018-06-01 19:55:04 +02:00
parent 423c1339ad
commit 3433f39698
9 changed files with 17 additions and 27 deletions

View File

@@ -14,6 +14,8 @@
- The Portable Grid no longer exposes a inventory for crossmod interaction, due to performance issues (raoulvdberge) - The Portable Grid no longer exposes a inventory for crossmod interaction, due to performance issues (raoulvdberge)
- The Crafting Monitor is now resizable and its size can be configured (stretched, small, medium, large) (raoulvdberge) - The Crafting Monitor is now resizable and its size can be configured (stretched, small, medium, large) (raoulvdberge)
- Removed the Wrench (raoulvdberge) - Removed the Wrench (raoulvdberge)
- Made all IO blocks have a blacklist instead of a whitelist by default (raoulvdberge)
- An empty blacklist now means: accept any item. An empty whitelist now means: don't accept any item (an empty whitelist USED to mean: accept any item) (raoulvdberge)
- Updated Russian translation (kellixon) - Updated Russian translation (kellixon)
### 1.5.34 ### 1.5.34

View File

@@ -59,7 +59,7 @@ public class NetworkNodeDestructor extends NetworkNode implements IComparable, I
private ItemHandlerUpgrade upgrades = new ItemHandlerUpgrade(4, new ItemHandlerListenerNetworkNode(this), ItemUpgrade.TYPE_SPEED, ItemUpgrade.TYPE_SILK_TOUCH, ItemUpgrade.TYPE_FORTUNE_1, ItemUpgrade.TYPE_FORTUNE_2, ItemUpgrade.TYPE_FORTUNE_3); private ItemHandlerUpgrade upgrades = new ItemHandlerUpgrade(4, new ItemHandlerListenerNetworkNode(this), ItemUpgrade.TYPE_SPEED, ItemUpgrade.TYPE_SILK_TOUCH, ItemUpgrade.TYPE_FORTUNE_1, ItemUpgrade.TYPE_FORTUNE_2, ItemUpgrade.TYPE_FORTUNE_3);
private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE; private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE;
private int mode = IFilterable.WHITELIST; private int mode = IFilterable.BLACKLIST;
private int type = IType.ITEMS; private int type = IType.ITEMS;
private boolean pickupItem = false; private boolean pickupItem = false;

View File

@@ -75,7 +75,7 @@ public class NetworkNodeFluidStorage extends NetworkNode implements IGuiStorage,
private AccessType accessType = AccessType.INSERT_EXTRACT; private AccessType accessType = AccessType.INSERT_EXTRACT;
private int priority = 0; private int priority = 0;
private int compare = IComparer.COMPARE_NBT; private int compare = IComparer.COMPARE_NBT;
private int mode = IFilterable.WHITELIST; private int mode = IFilterable.BLACKLIST;
private boolean voidExcess = false; private boolean voidExcess = false;
public NetworkNodeFluidStorage(World world, BlockPos pos) { public NetworkNodeFluidStorage(World world, BlockPos pos) {

View File

@@ -37,7 +37,7 @@ public class NetworkNodeImporter extends NetworkNode implements IComparable, IFi
private ItemHandlerUpgrade upgrades = new ItemHandlerUpgrade(4, new ItemHandlerListenerNetworkNode(this), ItemUpgrade.TYPE_SPEED, ItemUpgrade.TYPE_STACK); private ItemHandlerUpgrade upgrades = new ItemHandlerUpgrade(4, new ItemHandlerListenerNetworkNode(this), ItemUpgrade.TYPE_SPEED, ItemUpgrade.TYPE_STACK);
private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE; private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE;
private int mode = IFilterable.WHITELIST; private int mode = IFilterable.BLACKLIST;
private int type = IType.ITEMS; private int type = IType.ITEMS;
private int currentSlot; private int currentSlot;

View File

@@ -74,7 +74,7 @@ public class NetworkNodeStorage extends NetworkNode implements IGuiStorage, ISto
private AccessType accessType = AccessType.INSERT_EXTRACT; private AccessType accessType = AccessType.INSERT_EXTRACT;
private int priority = 0; private int priority = 0;
private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE; private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE;
private int mode = IFilterable.WHITELIST; private int mode = IFilterable.BLACKLIST;
private boolean voidExcess = false; private boolean voidExcess = false;
public NetworkNodeStorage(World world, BlockPos pos) { public NetworkNodeStorage(World world, BlockPos pos) {

View File

@@ -87,7 +87,7 @@ public class NetworkNodeDiskDrive extends NetworkNode implements IGuiStorage, IS
private AccessType accessType = AccessType.INSERT_EXTRACT; private AccessType accessType = AccessType.INSERT_EXTRACT;
private int priority = 0; private int priority = 0;
private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE; private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE;
private int mode = IFilterable.WHITELIST; private int mode = IFilterable.BLACKLIST;
private int type = IType.ITEMS; private int type = IType.ITEMS;
private boolean voidExcess = false; private boolean voidExcess = false;

View File

@@ -40,7 +40,7 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
private static final String NBT_IO_MODE = "IOMode"; private static final String NBT_IO_MODE = "IOMode";
private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE; private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE;
private int mode = IFilterable.WHITELIST; private int mode = IFilterable.BLACKLIST;
private int type = IType.ITEMS; private int type = IType.ITEMS;
private int ioMode = IO_MODE_INSERT; private int ioMode = IO_MODE_INSERT;

View File

@@ -45,7 +45,7 @@ public class NetworkNodeExternalStorage extends NetworkNode implements IStorageP
private int priority = 0; private int priority = 0;
private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE; private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE;
private int mode = IFilterable.WHITELIST; private int mode = IFilterable.BLACKLIST;
private int type = IType.ITEMS; private int type = IType.ITEMS;
private AccessType accessType = AccessType.INSERT_EXTRACT; private AccessType accessType = AccessType.INSERT_EXTRACT;
private int networkTicks; private int networkTicks;

View File

@@ -22,29 +22,22 @@ public interface IFilterable {
}); });
} }
// @todo: Change in 1.13 to be by default blacklist, and accept all on blacklist and none on whitelist when no filter is set
static boolean canTake(IItemHandler filters, int mode, int compare, ItemStack stack) { static boolean canTake(IItemHandler filters, int mode, int compare, ItemStack stack) {
if (mode == WHITELIST) { if (mode == WHITELIST) {
int slots = 0;
for (int i = 0; i < filters.getSlots(); ++i) { for (int i = 0; i < filters.getSlots(); ++i) {
ItemStack slot = filters.getStackInSlot(i); ItemStack slot = filters.getStackInSlot(i);
if (!slot.isEmpty()) {
slots++;
if (API.instance().getComparer().isEqual(slot, stack, compare)) { if (API.instance().getComparer().isEqual(slot, stack, compare)) {
return true; return true;
} }
} }
}
return slots == 0; return false;
} else if (mode == BLACKLIST) { } else if (mode == BLACKLIST) {
for (int i = 0; i < filters.getSlots(); ++i) { for (int i = 0; i < filters.getSlots(); ++i) {
ItemStack slot = filters.getStackInSlot(i); ItemStack slot = filters.getStackInSlot(i);
if (!slot.isEmpty() && API.instance().getComparer().isEqual(slot, stack, compare)) { if (API.instance().getComparer().isEqual(slot, stack, compare)) {
return false; return false;
} }
} }
@@ -57,21 +50,15 @@ public interface IFilterable {
static boolean canTakeFluids(ItemHandlerFluid filters, int mode, int compare, FluidStack stack) { static boolean canTakeFluids(ItemHandlerFluid filters, int mode, int compare, FluidStack stack) {
if (mode == WHITELIST) { if (mode == WHITELIST) {
int slots = 0;
for (int i = 0; i < filters.getSlots(); ++i) { for (int i = 0; i < filters.getSlots(); ++i) {
FluidStack slot = filters.getFluidStackInSlot(i); FluidStack slot = filters.getFluidStackInSlot(i);
if (slot != null) { if (slot != null && API.instance().getComparer().isEqual(slot, stack, compare)) {
slots++;
if (API.instance().getComparer().isEqual(slot, stack, compare)) {
return true; return true;
} }
} }
}
return slots == 0; return false;
} else if (mode == BLACKLIST) { } else if (mode == BLACKLIST) {
for (int i = 0; i < filters.getSlots(); ++i) { for (int i = 0; i < filters.getSlots(); ++i) {
FluidStack slot = filters.getFluidStackInSlot(i); FluidStack slot = filters.getFluidStackInSlot(i);
@@ -93,6 +80,7 @@ public interface IFilterable {
return false; return false;
} }
} }
return true; return true;
} }