Better naming
This commit is contained in:
@@ -3,7 +3,7 @@ package refinedstorage.storage;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import refinedstorage.block.EnumStorageType;
|
import refinedstorage.block.EnumStorageType;
|
||||||
import refinedstorage.tile.TileDiskDrive;
|
import refinedstorage.tile.TileDiskDrive;
|
||||||
import refinedstorage.tile.config.ModeConfigUtils;
|
import refinedstorage.tile.config.ModeFilter;
|
||||||
|
|
||||||
public class DiskStorage extends NBTStorage {
|
public class DiskStorage extends NBTStorage {
|
||||||
private TileDiskDrive diskDrive;
|
private TileDiskDrive diskDrive;
|
||||||
@@ -21,6 +21,6 @@ public class DiskStorage extends NBTStorage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mayPush(ItemStack stack) {
|
public boolean mayPush(ItemStack stack) {
|
||||||
return ModeConfigUtils.doesNotViolateMode(diskDrive.getInventory(), diskDrive.getModeConfig(), diskDrive.getCompare(), stack) && super.mayPush(stack);
|
return ModeFilter.violatesMode(diskDrive.getInventory(), diskDrive.getModeConfig(), diskDrive.getCompare(), stack) && super.mayPush(stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package refinedstorage.storage;
|
|||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import refinedstorage.tile.TileStorage;
|
import refinedstorage.tile.TileStorage;
|
||||||
import refinedstorage.tile.config.ModeConfigUtils;
|
import refinedstorage.tile.config.ModeFilter;
|
||||||
|
|
||||||
public class StorageBlockStorage extends NBTStorage {
|
public class StorageBlockStorage extends NBTStorage {
|
||||||
private TileStorage storage;
|
private TileStorage storage;
|
||||||
@@ -20,6 +20,6 @@ public class StorageBlockStorage extends NBTStorage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mayPush(ItemStack stack) {
|
public boolean mayPush(ItemStack stack) {
|
||||||
return ModeConfigUtils.doesNotViolateMode(storage.getInventory(), storage, storage.getCompare(), stack) && super.mayPush(stack);
|
return ModeFilter.violatesMode(storage.getInventory(), storage, storage.getCompare(), stack) && super.mayPush(stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import refinedstorage.container.ContainerDestructor;
|
|||||||
import refinedstorage.inventory.InventorySimple;
|
import refinedstorage.inventory.InventorySimple;
|
||||||
import refinedstorage.tile.config.ICompareConfig;
|
import refinedstorage.tile.config.ICompareConfig;
|
||||||
import refinedstorage.tile.config.IModeConfig;
|
import refinedstorage.tile.config.IModeConfig;
|
||||||
import refinedstorage.tile.config.ModeConfigUtils;
|
import refinedstorage.tile.config.ModeFilter;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ public class TileDestructor extends TileMachine implements ICompareConfig, IMode
|
|||||||
Block frontBlock = frontBlockState.getBlock();
|
Block frontBlock = frontBlockState.getBlock();
|
||||||
|
|
||||||
if (Item.getItemFromBlock(frontBlock) != null && !frontBlock.isAir(frontBlockState, worldObj, front)) {
|
if (Item.getItemFromBlock(frontBlock) != null && !frontBlock.isAir(frontBlockState, worldObj, front)) {
|
||||||
if (ModeConfigUtils.doesNotViolateMode(inventory, this, compare, new ItemStack(frontBlock, 1, frontBlock.getMetaFromState(frontBlockState)))) {
|
if (ModeFilter.violatesMode(inventory, this, compare, new ItemStack(frontBlock, 1, frontBlock.getMetaFromState(frontBlockState)))) {
|
||||||
List<ItemStack> drops = frontBlock.getDrops(worldObj, front, frontBlockState, 0);
|
List<ItemStack> drops = frontBlock.getDrops(worldObj, front, frontBlockState, 0);
|
||||||
|
|
||||||
worldObj.playAuxSFXAtEntity(null, 2001, front, Block.getStateId(frontBlockState));
|
worldObj.playAuxSFXAtEntity(null, 2001, front, Block.getStateId(frontBlockState));
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import refinedstorage.storage.ItemGroup;
|
|||||||
import refinedstorage.tile.config.ICompareConfig;
|
import refinedstorage.tile.config.ICompareConfig;
|
||||||
import refinedstorage.tile.config.IModeConfig;
|
import refinedstorage.tile.config.IModeConfig;
|
||||||
import refinedstorage.tile.config.IRedstoneModeConfig;
|
import refinedstorage.tile.config.IRedstoneModeConfig;
|
||||||
import refinedstorage.tile.config.ModeConfigUtils;
|
import refinedstorage.tile.config.ModeFilter;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ public class TileExternalStorage extends TileMachine implements IStorageProvider
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mayPush(ItemStack stack) {
|
public boolean mayPush(ItemStack stack) {
|
||||||
if (ModeConfigUtils.doesNotViolateMode(inventory, this, compare, stack)) {
|
if (ModeFilter.violatesMode(inventory, this, compare, stack)) {
|
||||||
IDeepStorageUnit storageUnit = getStorageUnit();
|
IDeepStorageUnit storageUnit = getStorageUnit();
|
||||||
|
|
||||||
if (storageUnit != null) {
|
if (storageUnit != null) {
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ import net.minecraft.inventory.IInventory;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import refinedstorage.RefinedStorageUtils;
|
import refinedstorage.RefinedStorageUtils;
|
||||||
|
|
||||||
public class ModeConfigUtils {
|
public class ModeFilter {
|
||||||
public static boolean doesNotViolateMode(IInventory inventory, IModeConfig mode, int compare, ItemStack stack) {
|
public static boolean violatesMode(IInventory filters, IModeConfig mode, int compare, ItemStack stack) {
|
||||||
if (mode.isWhitelist()) {
|
if (mode.isWhitelist()) {
|
||||||
int slots = 0;
|
int slots = 0;
|
||||||
|
|
||||||
for (int i = 0; i < inventory.getSizeInventory(); ++i) {
|
for (int i = 0; i < filters.getSizeInventory(); ++i) {
|
||||||
ItemStack slot = inventory.getStackInSlot(i);
|
ItemStack slot = filters.getStackInSlot(i);
|
||||||
|
|
||||||
if (slot != null) {
|
if (slot != null) {
|
||||||
slots++;
|
slots++;
|
||||||
@@ -23,8 +23,8 @@ public class ModeConfigUtils {
|
|||||||
|
|
||||||
return slots == 0;
|
return slots == 0;
|
||||||
} else if (mode.isBlacklist()) {
|
} else if (mode.isBlacklist()) {
|
||||||
for (int i = 0; i < inventory.getSizeInventory(); ++i) {
|
for (int i = 0; i < filters.getSizeInventory(); ++i) {
|
||||||
ItemStack slot = inventory.getStackInSlot(i);
|
ItemStack slot = filters.getStackInSlot(i);
|
||||||
|
|
||||||
if (slot != null && RefinedStorageUtils.compareStack(slot, stack, compare)) {
|
if (slot != null && RefinedStorageUtils.compareStack(slot, stack, compare)) {
|
||||||
return false;
|
return false;
|
||||||
Reference in New Issue
Block a user