Re-add the Importer
This commit is contained in:
@@ -121,6 +121,7 @@ public class ClientSetup {
|
||||
ScreenManager.registerFactory(RSContainers.STORAGE_BLOCK, StorageBlockScreen::new);
|
||||
ScreenManager.registerFactory(RSContainers.FLUID_STORAGE_BLOCK, FluidStorageBlockScreen::new);
|
||||
ScreenManager.registerFactory(RSContainers.EXTERNAL_STORAGE, ExternalStorageScreen::new);
|
||||
ScreenManager.registerFactory(RSContainers.IMPORTER, ImporterScreen::new);
|
||||
|
||||
ClientRegistry.registerKeyBinding(RSKeyBindings.FOCUS_SEARCH_BAR);
|
||||
ClientRegistry.registerKeyBinding(RSKeyBindings.CLEAR_GRID_CRAFTING_MATRIX);
|
||||
|
@@ -6,10 +6,7 @@ import com.raoulvdberge.refinedstorage.api.storage.StorageType;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.NetworkNodeListener;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.factory.GridBlockGridFactory;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.CableNetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.ExternalStorageNetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.GridNetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.*;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.diskdrive.DiskDriveNetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.storage.FluidStorageNetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.storage.StorageNetworkNode;
|
||||
@@ -116,6 +113,7 @@ public final class RS {
|
||||
API.instance().getNetworkNodeRegistry().add(FluidStorageNetworkNode.CREATIVE_FLUID_STORAGE_BLOCK_ID, (tag, world, pos) -> readAndReturn(tag, new FluidStorageNetworkNode(world, pos, FluidStorageType.CREATIVE)));
|
||||
|
||||
API.instance().getNetworkNodeRegistry().add(ExternalStorageNetworkNode.ID, (tag, world, pos) -> readAndReturn(tag, new ExternalStorageNetworkNode(world, pos)));
|
||||
API.instance().getNetworkNodeRegistry().add(ImporterNetworkNode.ID, (tag, world, pos) -> readAndReturn(tag, new ImporterNetworkNode(world, pos)));
|
||||
|
||||
API.instance().getGridManager().add(GridBlockGridFactory.ID, new GridBlockGridFactory());
|
||||
|
||||
@@ -158,6 +156,7 @@ public final class RS {
|
||||
}
|
||||
|
||||
e.getRegistry().register(new ExternalStorageBlock());
|
||||
e.getRegistry().register(new ImporterBlock());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -184,6 +183,7 @@ public final class RS {
|
||||
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new FluidStorageTile(FluidStorageType.CREATIVE), RSBlocks.CREATIVE_FLUID_STORAGE_BLOCK).build(null).setRegistryName(RS.ID, "creative_fluid_storage_block")));
|
||||
|
||||
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(ExternalStorageTile::new, RSBlocks.EXTERNAL_STORAGE).build(null).setRegistryName(RS.ID, "external_storage")));
|
||||
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(ImporterTile::new, RSBlocks.IMPORTER).build(null).setRegistryName(RS.ID, "importer")));
|
||||
}
|
||||
|
||||
private <T extends TileEntity> TileEntityType<T> registerTileDataParameters(TileEntityType<T> t) {
|
||||
@@ -203,6 +203,7 @@ public final class RS {
|
||||
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<StorageContainer, StorageTile>((windowId, inv, tile) -> new StorageContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "storage_block"));
|
||||
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<FluidStorageContainer, FluidStorageTile>((windowId, inv, tile) -> new FluidStorageContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "fluid_storage_block"));
|
||||
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<ExternalStorageContainer, ExternalStorageTile>((windowId, inv, tile) -> new ExternalStorageContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "external_storage"));
|
||||
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<ImporterContainer, ImporterTile>((windowId, inv, tile) -> new ImporterContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "importer"));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -271,6 +272,7 @@ public final class RS {
|
||||
e.getRegistry().register(new FluidStorageBlockItem(RSBlocks.CREATIVE_FLUID_STORAGE_BLOCK));
|
||||
|
||||
e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.EXTERNAL_STORAGE));
|
||||
e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.IMPORTER));
|
||||
}
|
||||
|
||||
/* TODO
|
||||
|
@@ -4,7 +4,9 @@ import com.raoulvdberge.refinedstorage.block.*;
|
||||
import net.minecraftforge.registries.ObjectHolder;
|
||||
|
||||
public final class RSBlocks {
|
||||
public static final BlockImporter IMPORTER = new BlockImporter();
|
||||
@ObjectHolder(RS.ID + ":importer")
|
||||
public static final ImporterBlock IMPORTER = null;
|
||||
|
||||
public static final BlockExporter EXPORTER = new BlockExporter();
|
||||
public static final BlockDetector DETECTOR = new BlockDetector();
|
||||
public static final BlockDestructor DESTRUCTOR = new BlockDestructor();
|
||||
|
@@ -38,8 +38,10 @@ public final class RSContainers {
|
||||
|
||||
//@ObjectHolder(RS.ID + ":fluid_interface")
|
||||
public static final ContainerType<FluidInterfaceContainer> FLUID_INTERFACE = null;
|
||||
//@ObjectHolder(RS.ID + ":importer")
|
||||
|
||||
@ObjectHolder(RS.ID + ":importer")
|
||||
public static final ContainerType<ImporterContainer> IMPORTER = null;
|
||||
|
||||
//@ObjectHolder(RS.ID + ":interface")
|
||||
public static final ContainerType<ImporterContainer> INTERFACE = null;
|
||||
//@ObjectHolder(RS.ID + ":network_transmitter")
|
||||
|
@@ -51,10 +51,11 @@ public class RSTiles {
|
||||
@ObjectHolder(RS.ID + ":fluid_grid")
|
||||
public static final TileEntityType<GridTile> FLUID_GRID = null;
|
||||
|
||||
//@ObjectHolder(RS.ID + ":importer")
|
||||
public static final TileEntityType<TileImporter> IMPORTER = null;
|
||||
@ObjectHolder(RS.ID + ":importer")
|
||||
public static final TileEntityType<ImporterTile> IMPORTER = null;
|
||||
|
||||
//@ObjectHolder(RS.ID + ":interface")
|
||||
public static final TileEntityType<TileImporter> INTERFACE = null;
|
||||
public static final TileEntityType<ImporterTile> INTERFACE = null;
|
||||
//@ObjectHolder(RS.ID + ":network_transmitter")
|
||||
public static final TileEntityType<TileNetworkTransmitter> NETWORK_TRANSMITTER = null;
|
||||
//@ObjectHolder(RS.ID + ":network_receiver")
|
||||
|
@@ -17,7 +17,7 @@ import com.raoulvdberge.refinedstorage.block.NodeBlock;
|
||||
import com.raoulvdberge.refinedstorage.inventory.fluid.FluidInventory;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.BaseItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.FilterItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.validator.ItemValidatorBasic;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.validator.ItemValidator;
|
||||
import com.raoulvdberge.refinedstorage.inventory.listener.NetworkNodeListener;
|
||||
import com.raoulvdberge.refinedstorage.item.PatternItem;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
||||
@@ -96,7 +96,7 @@ public class GridNetworkNode extends NetworkNode implements IGridNetworkAware, I
|
||||
|
||||
private Set<ICraftingGridListener> craftingListeners = new HashSet<>();
|
||||
|
||||
private BaseItemHandler patterns = new BaseItemHandler(2, new NetworkNodeListener(this), new ItemValidatorBasic(RSItems.PATTERN)) {
|
||||
private BaseItemHandler patterns = new BaseItemHandler(2, new NetworkNodeListener(this)) {
|
||||
@Override
|
||||
protected void onContentsChanged(int slot) {
|
||||
super.onContentsChanged(slot);
|
||||
@@ -142,7 +142,7 @@ public class GridNetworkNode extends NetworkNode implements IGridNetworkAware, I
|
||||
|
||||
return stack;
|
||||
}
|
||||
};
|
||||
}.addValidator(new ItemValidator(RSItems.PATTERN));
|
||||
private List<IFilter> filters = new ArrayList<>();
|
||||
private List<IGridTab> tabs = new ArrayList<>();
|
||||
private FilterItemHandler filter = new FilterItemHandler(filters, tabs, new NetworkNodeListener(this));
|
||||
|
@@ -7,8 +7,9 @@ import com.raoulvdberge.refinedstorage.inventory.fluid.FluidInventory;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.BaseItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.UpgradeItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.inventory.listener.NetworkNodeListener;
|
||||
import com.raoulvdberge.refinedstorage.item.UpgradeItem;
|
||||
import com.raoulvdberge.refinedstorage.tile.DiskDriveTile;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileImporter;
|
||||
import com.raoulvdberge.refinedstorage.tile.ImporterTile;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IWhitelistBlacklist;
|
||||
@@ -26,7 +27,7 @@ import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
||||
public class NetworkNodeImporter extends NetworkNode implements IComparable, IWhitelistBlacklist, IType {
|
||||
public class ImporterNetworkNode extends NetworkNode implements IComparable, IWhitelistBlacklist, IType {
|
||||
public static final ResourceLocation ID = new ResourceLocation(RS.ID, "importer");
|
||||
|
||||
private static final String NBT_COMPARE = "Compare";
|
||||
@@ -37,7 +38,7 @@ public class NetworkNodeImporter extends NetworkNode implements IComparable, IWh
|
||||
private BaseItemHandler itemFilters = new BaseItemHandler(9, new NetworkNodeListener(this));
|
||||
private FluidInventory fluidFilters = new FluidInventory(9, new NetworkNodeListener(this));
|
||||
|
||||
private UpgradeItemHandler upgrades = new UpgradeItemHandler(4, new NetworkNodeListener(this)/* TODO, ItemUpgrade.TYPE_SPEED, ItemUpgrade.TYPE_STACK*/);
|
||||
private UpgradeItemHandler upgrades = new UpgradeItemHandler(4, new NetworkNodeListener(this), UpgradeItem.Type.SPEED, UpgradeItem.Type.STACK);
|
||||
|
||||
private int compare = IComparer.COMPARE_NBT;
|
||||
private int mode = IWhitelistBlacklist.BLACKLIST;
|
||||
@@ -45,7 +46,7 @@ public class NetworkNodeImporter extends NetworkNode implements IComparable, IWh
|
||||
|
||||
private int currentSlot;
|
||||
|
||||
public NetworkNodeImporter(World world, BlockPos pos) {
|
||||
public ImporterNetworkNode(World world, BlockPos pos) {
|
||||
super(world, pos);
|
||||
}
|
||||
|
||||
@@ -84,10 +85,10 @@ public class NetworkNodeImporter extends NetworkNode implements IComparable, IWh
|
||||
if (!IWhitelistBlacklist.acceptsItem(itemFilters, mode, compare, stack)) {
|
||||
currentSlot++;
|
||||
} else if (ticks % upgrades.getSpeed() == 0) {
|
||||
ItemStack result = handler.extractItem(currentSlot, upgrades.getItemInteractCount(), true);
|
||||
ItemStack result = handler.extractItem(currentSlot, upgrades.getStackInteractCount(), true);
|
||||
|
||||
if (!result.isEmpty() && network.insertItem(result, result.getCount(), Action.SIMULATE).isEmpty()) {
|
||||
result = handler.extractItem(currentSlot, upgrades.getItemInteractCount(), false);
|
||||
result = handler.extractItem(currentSlot, upgrades.getStackInteractCount(), false);
|
||||
|
||||
network.insertItemTracked(result, result.getCount());
|
||||
} else {
|
||||
@@ -104,12 +105,13 @@ public class NetworkNodeImporter extends NetworkNode implements IComparable, IWh
|
||||
if (!stack.isEmpty() &&
|
||||
IWhitelistBlacklist.acceptsFluid(fluidFilters, mode, compare, stack) &&
|
||||
network.insertFluid(stack, stack.getAmount(), Action.SIMULATE).isEmpty()) {
|
||||
FluidStack toDrain = handler.drain(FluidAttributes.BUCKET_VOLUME * upgrades.getItemInteractCount(), IFluidHandler.FluidAction.EXECUTE); // TODO: is this execute?
|
||||
FluidStack toDrain = handler.drain(FluidAttributes.BUCKET_VOLUME * upgrades.getStackInteractCount(), IFluidHandler.FluidAction.SIMULATE);
|
||||
|
||||
if (!toDrain.isEmpty()) {
|
||||
FluidStack remainder = network.insertFluidTracked(toDrain, toDrain.getAmount());
|
||||
|
||||
toDrain.shrink(remainder.getAmount());
|
||||
if (!remainder.isEmpty()) {
|
||||
toDrain.shrink(remainder.getAmount());
|
||||
}
|
||||
|
||||
handler.drain(toDrain, IFluidHandler.FluidAction.EXECUTE);
|
||||
}
|
||||
@@ -212,7 +214,7 @@ public class NetworkNodeImporter extends NetworkNode implements IComparable, IWh
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return world.isRemote ? TileImporter.TYPE.getValue() : type;
|
||||
return world.isRemote ? ImporterTile.TYPE.getValue() : type;
|
||||
}
|
||||
|
||||
@Override
|
@@ -240,7 +240,7 @@ public class NetworkNodeConstructor extends NetworkNode implements IComparable,
|
||||
}
|
||||
|
||||
private void dropItem() {
|
||||
ItemStack took = network.extractItem(itemFilters.getStackInSlot(0), upgrades.getItemInteractCount(), Action.PERFORM);
|
||||
ItemStack took = network.extractItem(itemFilters.getStackInSlot(0), upgrades.getStackInteractCount(), Action.PERFORM);
|
||||
|
||||
if (!took.isEmpty()) {
|
||||
DefaultDispenseItemBehavior.doDispense(world, took, 6, getDirection(), new Position(getDispensePositionX(), getDispensePositionY(), getDispensePositionZ()));
|
||||
|
@@ -9,6 +9,7 @@ import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.BaseItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.UpgradeItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.validator.PatternItemValidator;
|
||||
import com.raoulvdberge.refinedstorage.inventory.listener.NetworkNodeListener;
|
||||
import com.raoulvdberge.refinedstorage.item.UpgradeItem;
|
||||
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||
@@ -58,7 +59,7 @@ public class NetworkNodeCrafter extends NetworkNode implements ICraftingPatternC
|
||||
private static final String NBT_LOCKED = "Locked";
|
||||
private static final String NBT_WAS_POWERED = "WasPowered";
|
||||
|
||||
private BaseItemHandler patternsInventory = new BaseItemHandler(9, new NetworkNodeListener(this), s -> isValidPatternInSlot(world, s)) {
|
||||
private BaseItemHandler patternsInventory = new BaseItemHandler(9, new NetworkNodeListener(this)) {
|
||||
@Override
|
||||
protected void onContentsChanged(int slot) {
|
||||
super.onContentsChanged(slot);
|
||||
@@ -78,11 +79,7 @@ public class NetworkNodeCrafter extends NetworkNode implements ICraftingPatternC
|
||||
public int getSlotLimit(int slot) {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
public static boolean isValidPatternInSlot(World world, ItemStack stack) {
|
||||
return stack.getItem() instanceof ICraftingPatternProvider && ((ICraftingPatternProvider) stack.getItem()).create(world, stack, null).isValid();
|
||||
}
|
||||
}.addValidator(new PatternItemValidator(world));
|
||||
|
||||
private List<ICraftingPattern> patterns = new ArrayList<>();
|
||||
|
||||
|
@@ -75,7 +75,7 @@ public class NetworkNodeExporter extends NetworkNode implements IComparable, ITy
|
||||
ItemStack slot = itemFilters.getStackInSlot(filterSlot);
|
||||
|
||||
if (!slot.isEmpty()) {
|
||||
int stackSize = upgrades.getItemInteractCount();
|
||||
int stackSize = upgrades.getStackInteractCount();
|
||||
|
||||
ItemStack took = network.extractItem(slot, Math.min(slot.getMaxStackSize(), stackSize), compare, Action.SIMULATE);
|
||||
|
||||
@@ -113,7 +113,7 @@ public class NetworkNodeExporter extends NetworkNode implements IComparable, ITy
|
||||
FluidStack stack = fluids[filterSlot];
|
||||
|
||||
if (stack != null) {
|
||||
int toExtract = FluidAttributes.BUCKET_VOLUME * upgrades.getItemInteractCount();
|
||||
int toExtract = FluidAttributes.BUCKET_VOLUME * upgrades.getStackInteractCount();
|
||||
|
||||
FluidStack stackInStorage = network.getFluidStorageCache().getList().get(stack, compare);
|
||||
|
||||
|
@@ -55,7 +55,7 @@ public class NetworkNodeFluidInterface extends NetworkNode {
|
||||
|
||||
private ProxyFluidHandler tank = new ProxyFluidHandler(tankIn, tankOut);
|
||||
|
||||
private BaseItemHandler in = new BaseItemHandler(1, new NetworkNodeListener(this), stack -> !StackUtils.getFluid(stack, true).getValue().isEmpty());
|
||||
private BaseItemHandler in = new BaseItemHandler(1, new NetworkNodeListener(this)).addValidator(stack -> !StackUtils.getFluid(stack, true).getValue().isEmpty());
|
||||
private FluidInventory out = new FluidInventory(1, TANK_CAPACITY, new NetworkNodeListener(this));
|
||||
|
||||
private UpgradeItemHandler upgrades = new UpgradeItemHandler(4, new NetworkNodeListener(this)/* TODO, ItemUpgrade.TYPE_SPEED, ItemUpgrade.TYPE_STACK, ItemUpgrade.TYPE_CRAFTING*/);
|
||||
@@ -84,7 +84,7 @@ public class NetworkNodeFluidInterface extends NetworkNode {
|
||||
}
|
||||
|
||||
if (ticks % upgrades.getSpeed() == 0) {
|
||||
FluidStack drained = tankIn.drain(FluidAttributes.BUCKET_VOLUME * upgrades.getItemInteractCount(), IFluidHandler.FluidAction.EXECUTE);
|
||||
FluidStack drained = tankIn.drain(FluidAttributes.BUCKET_VOLUME * upgrades.getStackInteractCount(), IFluidHandler.FluidAction.EXECUTE);
|
||||
|
||||
// Drain in tank
|
||||
if (!drained.isEmpty()) {
|
||||
|
@@ -68,7 +68,7 @@ public class NetworkNodeInterface extends NetworkNode implements IComparable {
|
||||
if (slot.isEmpty()) {
|
||||
currentSlot++;
|
||||
} else if (ticks % upgrades.getSpeed() == 0) {
|
||||
int size = Math.min(slot.getCount(), upgrades.getItemInteractCount());
|
||||
int size = Math.min(slot.getCount(), upgrades.getStackInteractCount());
|
||||
|
||||
ItemStack remainder = network.insertItemTracked(slot, size);
|
||||
|
||||
|
@@ -4,7 +4,7 @@ import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.RSItems;
|
||||
import com.raoulvdberge.refinedstorage.api.util.Action;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.BaseItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.validator.ItemValidatorBasic;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.validator.ItemValidator;
|
||||
import com.raoulvdberge.refinedstorage.inventory.listener.NetworkNodeListener;
|
||||
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -19,7 +19,7 @@ import javax.annotation.Nullable;
|
||||
public class NetworkNodeNetworkTransmitter extends NetworkNode {
|
||||
public static final ResourceLocation ID = new ResourceLocation(RS.ID, "network_transmitter");
|
||||
|
||||
private BaseItemHandler networkCard = new BaseItemHandler(1, new NetworkNodeListener(this), new ItemValidatorBasic(RSItems.NETWORK_CARD)) {
|
||||
private BaseItemHandler networkCard = new BaseItemHandler(1, new NetworkNodeListener(this)) {
|
||||
@Override
|
||||
protected void onContentsChanged(int slot) {
|
||||
super.onContentsChanged(slot);
|
||||
@@ -37,7 +37,7 @@ public class NetworkNodeNetworkTransmitter extends NetworkNode {
|
||||
network.getNodeGraph().invalidate(Action.PERFORM, network.world(), network.getPosition());
|
||||
}
|
||||
}
|
||||
};
|
||||
}.addValidator(new ItemValidator(RSItems.NETWORK_CARD));
|
||||
|
||||
private BlockPos receiver;
|
||||
private int receiverDimension;
|
||||
|
@@ -8,7 +8,7 @@ import com.raoulvdberge.refinedstorage.api.network.security.ISecurityCardContain
|
||||
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.security.SecurityCard;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.BaseItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.validator.ItemValidatorBasic;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.validator.ItemValidator;
|
||||
import com.raoulvdberge.refinedstorage.inventory.listener.NetworkNodeListener;
|
||||
import com.raoulvdberge.refinedstorage.item.SecurityCardItem;
|
||||
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||
@@ -31,7 +31,7 @@ public class NetworkNodeSecurityManager extends NetworkNode implements ISecurity
|
||||
private List<ISecurityCard> cards = new ArrayList<>();
|
||||
private ISecurityCard globalCard;
|
||||
|
||||
private BaseItemHandler cardsInv = new BaseItemHandler(9 * 2, new NetworkNodeListener(this), new ItemValidatorBasic(RSItems.SECURITY_CARD)) {
|
||||
private BaseItemHandler cardsInv = new BaseItemHandler(9 * 2, new NetworkNodeListener(this)) {
|
||||
@Override
|
||||
protected void onContentsChanged(int slot) {
|
||||
super.onContentsChanged(slot);
|
||||
@@ -44,8 +44,8 @@ public class NetworkNodeSecurityManager extends NetworkNode implements ISecurity
|
||||
network.getSecurityManager().invalidate();
|
||||
}
|
||||
}
|
||||
};
|
||||
private BaseItemHandler editCard = new BaseItemHandler(1, new NetworkNodeListener(this), new ItemValidatorBasic(RSItems.SECURITY_CARD));
|
||||
}.addValidator(new ItemValidator(RSItems.SECURITY_CARD));
|
||||
private BaseItemHandler editCard = new BaseItemHandler(1, new NetworkNodeListener(this)).addValidator(new ItemValidator(RSItems.SECURITY_CARD));
|
||||
|
||||
public NetworkNodeSecurityManager(World world, BlockPos pos) {
|
||||
super(world, pos);
|
||||
|
@@ -7,13 +7,13 @@ import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.IStorageProvider;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDisk;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskContainerContext;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskProvider;
|
||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.FluidStorageCache;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.ItemStorageCache;
|
||||
import com.raoulvdberge.refinedstorage.inventory.fluid.FluidInventory;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.BaseItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.validator.StorageDiskItemValidator;
|
||||
import com.raoulvdberge.refinedstorage.inventory.listener.NetworkNodeListener;
|
||||
import com.raoulvdberge.refinedstorage.tile.DiskDriveTile;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.*;
|
||||
@@ -31,7 +31,6 @@ import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class DiskDriveNetworkNode extends NetworkNode implements IStorageProvider, IComparable, IWhitelistBlacklist, IPrioritizable, IType, IAccessType, IStorageDiskContainerContext {
|
||||
public enum DiskState {
|
||||
@@ -54,8 +53,6 @@ public class DiskDriveNetworkNode extends NetworkNode implements IStorageProvide
|
||||
}
|
||||
}
|
||||
|
||||
public static final Predicate<ItemStack> VALIDATOR_STORAGE_DISK = s -> s.getItem() instanceof IStorageDiskProvider && ((IStorageDiskProvider) s.getItem()).isValid(s);
|
||||
|
||||
public static final ResourceLocation ID = new ResourceLocation(RS.ID, "disk_drive");
|
||||
|
||||
private static final String NBT_PRIORITY = "Priority";
|
||||
@@ -69,7 +66,7 @@ public class DiskDriveNetworkNode extends NetworkNode implements IStorageProvide
|
||||
private int ticksSinceBlockUpdateRequested;
|
||||
private boolean blockUpdateRequested;
|
||||
|
||||
private BaseItemHandler disks = new BaseItemHandler(8, new NetworkNodeListener(this), VALIDATOR_STORAGE_DISK) {
|
||||
private BaseItemHandler disks = new BaseItemHandler(8, new NetworkNodeListener(this)) {
|
||||
@Override
|
||||
protected void onContentsChanged(int slot) {
|
||||
super.onContentsChanged(slot);
|
||||
@@ -95,7 +92,7 @@ public class DiskDriveNetworkNode extends NetworkNode implements IStorageProvide
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}.addValidator(new StorageDiskItemValidator());
|
||||
|
||||
private BaseItemHandler itemFilters = new BaseItemHandler(9, new NetworkNodeListener(this));
|
||||
private FluidInventory fluidFilters = new FluidInventory(9, new NetworkNodeListener(this));
|
||||
|
@@ -8,11 +8,11 @@ import com.raoulvdberge.refinedstorage.api.util.Action;
|
||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||
import com.raoulvdberge.refinedstorage.api.util.StackListEntry;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.diskdrive.DiskDriveNetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.inventory.fluid.FluidInventory;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.BaseItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.ProxyItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.UpgradeItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.validator.StorageDiskItemValidator;
|
||||
import com.raoulvdberge.refinedstorage.inventory.listener.NetworkNodeListener;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileDiskManipulator;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
||||
@@ -60,8 +60,8 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
||||
|
||||
private UpgradeItemHandler upgrades = new UpgradeItemHandler(4, new NetworkNodeListener(this)/* TODO, ItemUpgrade.TYPE_SPEED, ItemUpgrade.TYPE_STACK*/) {
|
||||
@Override
|
||||
public int getItemInteractCount() {
|
||||
int count = super.getItemInteractCount();
|
||||
public int getStackInteractCount() {
|
||||
int count = super.getStackInteractCount();
|
||||
|
||||
if (type == IType.FLUIDS) {
|
||||
count *= FluidAttributes.BUCKET_VOLUME;
|
||||
@@ -71,7 +71,7 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
||||
}
|
||||
};
|
||||
|
||||
private BaseItemHandler inputDisks = new BaseItemHandler(3, new NetworkNodeListener(this), DiskDriveNetworkNode.VALIDATOR_STORAGE_DISK) {
|
||||
private BaseItemHandler inputDisks = new BaseItemHandler(3, new NetworkNodeListener(this)) {
|
||||
@Override
|
||||
protected void onContentsChanged(int slot) {
|
||||
super.onContentsChanged(slot);
|
||||
@@ -90,9 +90,9 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
||||
WorldUtils.updateBlock(world, pos);
|
||||
}
|
||||
}
|
||||
};
|
||||
}.addValidator(new StorageDiskItemValidator());
|
||||
|
||||
private BaseItemHandler outputDisks = new BaseItemHandler(3, new NetworkNodeListener(this), DiskDriveNetworkNode.VALIDATOR_STORAGE_DISK) {
|
||||
private BaseItemHandler outputDisks = new BaseItemHandler(3, new NetworkNodeListener(this)) {
|
||||
@Override
|
||||
protected void onContentsChanged(int slot) {
|
||||
super.onContentsChanged(slot);
|
||||
@@ -111,7 +111,7 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
||||
WorldUtils.updateBlock(world, pos);
|
||||
}
|
||||
}
|
||||
};
|
||||
}.addValidator(new StorageDiskItemValidator());
|
||||
|
||||
private ProxyItemHandler disks = new ProxyItemHandler(inputDisks, outputDisks);
|
||||
|
||||
@@ -176,7 +176,7 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
||||
for (int i = 0; i < stacks.size(); ++i) {
|
||||
ItemStack stack = stacks.get(i);
|
||||
|
||||
ItemStack extracted = storage.extract(stack, upgrades.getItemInteractCount(), compare, Action.PERFORM);
|
||||
ItemStack extracted = storage.extract(stack, upgrades.getStackInteractCount(), compare, Action.PERFORM);
|
||||
if (extracted.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
@@ -211,7 +211,7 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
||||
for (int i = 0; i < stacks.size(); ++i) {
|
||||
ItemStack stack = stacks.get(i);
|
||||
|
||||
ItemStack extracted = storage.extract(stack, upgrades.getItemInteractCount(), compare, Action.SIMULATE);
|
||||
ItemStack extracted = storage.extract(stack, upgrades.getStackInteractCount(), compare, Action.SIMULATE);
|
||||
if (extracted.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
@@ -239,7 +239,7 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
||||
}
|
||||
|
||||
if (toExtract != null) {
|
||||
extracted = network.extractItem(toExtract, upgrades.getItemInteractCount(), compare, Action.PERFORM);
|
||||
extracted = network.extractItem(toExtract, upgrades.getStackInteractCount(), compare, Action.PERFORM);
|
||||
}
|
||||
} else {
|
||||
while (itemFilters.getSlots() > i && extracted == null) {
|
||||
@@ -250,7 +250,7 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
||||
}
|
||||
|
||||
if (!filterStack.isEmpty()) {
|
||||
extracted = network.extractItem(filterStack, upgrades.getItemInteractCount(), compare, Action.PERFORM);
|
||||
extracted = network.extractItem(filterStack, upgrades.getStackInteractCount(), compare, Action.PERFORM);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -274,7 +274,7 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
||||
while (extracted.isEmpty() && stacks.size() > i) {
|
||||
FluidStack stack = stacks.get(i++);
|
||||
|
||||
extracted = storage.extract(stack, upgrades.getItemInteractCount(), compare, Action.PERFORM);
|
||||
extracted = storage.extract(stack, upgrades.getStackInteractCount(), compare, Action.PERFORM);
|
||||
}
|
||||
|
||||
if (extracted.isEmpty()) {
|
||||
@@ -306,7 +306,7 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
||||
for (int i = 0; i < stacks.size(); ++i) {
|
||||
FluidStack stack = stacks.get(i);
|
||||
|
||||
FluidStack extracted = storage.extract(stack, upgrades.getItemInteractCount(), compare, Action.SIMULATE);
|
||||
FluidStack extracted = storage.extract(stack, upgrades.getStackInteractCount(), compare, Action.SIMULATE);
|
||||
if (extracted.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
@@ -334,7 +334,7 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
||||
}
|
||||
|
||||
if (toExtract != null) {
|
||||
extracted = network.extractFluid(toExtract, upgrades.getItemInteractCount(), compare, Action.PERFORM);
|
||||
extracted = network.extractFluid(toExtract, upgrades.getStackInteractCount(), compare, Action.PERFORM);
|
||||
}
|
||||
} else {
|
||||
while (fluidFilters.getSlots() > i && extracted == null) {
|
||||
@@ -345,7 +345,7 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
||||
}
|
||||
|
||||
if (!filterStack.isEmpty()) {
|
||||
extracted = network.extractFluid(filterStack, upgrades.getItemInteractCount(), compare, Action.PERFORM);
|
||||
extracted = network.extractFluid(filterStack, upgrades.getStackInteractCount(), compare, Action.PERFORM);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,59 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.block;
|
||||
|
||||
public class BlockImporter extends CableBlock {
|
||||
/* TODO
|
||||
public BlockImporter() {
|
||||
super(createBuilder("importer").tileEntity(TileImporter::new).create());
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void registerModels(IModelRegistration modelRegistration) {
|
||||
modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "direction=north,down=false,east=true,north=false,south=false,up=false,west=true"));
|
||||
|
||||
registerCover(modelRegistration);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public BlockDirection getDirection() {
|
||||
return BlockDirection.ANY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CollisionGroup> getCollisions(TileEntity tile, BlockState state) {
|
||||
List<CollisionGroup> groups = super.getCollisions(tile, state);
|
||||
|
||||
switch (state.getValue(getDirection().getProperty())) {
|
||||
case NORTH:
|
||||
groups.add(ConstantsImporter.LINE_NORTH);
|
||||
break;
|
||||
case EAST:
|
||||
groups.add(ConstantsImporter.LINE_EAST);
|
||||
break;
|
||||
case SOUTH:
|
||||
groups.add(ConstantsImporter.LINE_SOUTH);
|
||||
break;
|
||||
case WEST:
|
||||
groups.add(ConstantsImporter.LINE_WEST);
|
||||
break;
|
||||
case UP:
|
||||
groups.add(ConstantsImporter.LINE_UP);
|
||||
break;
|
||||
case DOWN:
|
||||
groups.add(ConstantsImporter.LINE_DOWN);
|
||||
break;
|
||||
}
|
||||
|
||||
return groups;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) {
|
||||
if (!canAccessGui(state, world, pos, hitX, hitY, hitZ)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return openNetworkGui(RSGui.IMPORTER, player, world, pos, side);
|
||||
}*/
|
||||
}
|
@@ -100,32 +100,4 @@ public class ExternalStorageBlock extends CableBlock {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* TODO
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) {
|
||||
if (!canAccessGui(state, world, pos, hitX, hitY, hitZ)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return openNetworkGui(RSGui.EXTERNAL_STORAGE, player, world, pos, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
|
||||
super.neighborChanged(state, world, pos, block, fromPos);
|
||||
|
||||
if (!world.isRemote) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if (tile instanceof TileExternalStorage) {
|
||||
NetworkNodeExternalStorage externalStorage = ((TileExternalStorage) tile).getNode();
|
||||
|
||||
if (externalStorage.getNetwork() != null) {
|
||||
externalStorage.updateStorage(externalStorage.getNetwork());
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
@@ -0,0 +1,127 @@
|
||||
package com.raoulvdberge.refinedstorage.block;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.block.info.BlockDirection;
|
||||
import com.raoulvdberge.refinedstorage.container.ImporterContainer;
|
||||
import com.raoulvdberge.refinedstorage.container.factory.PositionalTileContainerProvider;
|
||||
import com.raoulvdberge.refinedstorage.tile.ImporterTile;
|
||||
import com.raoulvdberge.refinedstorage.util.BlockUtils;
|
||||
import com.raoulvdberge.refinedstorage.util.NetworkUtils;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.network.NetworkHooks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ImporterBlock extends CableBlock {
|
||||
private static final VoxelShape LINE_NORTH_1 = makeCuboidShape(6, 6, 4, 10, 10, 6);
|
||||
private static final VoxelShape LINE_NORTH_2 = makeCuboidShape(5, 5, 2, 11, 11, 4);
|
||||
private static final VoxelShape LINE_NORTH_3 = makeCuboidShape(3, 3, 0, 13, 13, 2);
|
||||
private static final VoxelShape LINE_NORTH = VoxelShapes.or(LINE_NORTH_1, LINE_NORTH_2, LINE_NORTH_3);
|
||||
|
||||
private static final VoxelShape LINE_EAST_1 = makeCuboidShape(10, 6, 6, 12, 10, 10);
|
||||
private static final VoxelShape LINE_EAST_2 = makeCuboidShape(12, 5, 5, 14, 11, 11);
|
||||
private static final VoxelShape LINE_EAST_3 = makeCuboidShape(14, 3, 3, 16, 13, 13);
|
||||
private static final VoxelShape LINE_EAST = VoxelShapes.or(LINE_EAST_1, LINE_EAST_2, LINE_EAST_3);
|
||||
|
||||
private static final VoxelShape LINE_SOUTH_1 = makeCuboidShape(6, 6, 10, 10, 10, 12);
|
||||
private static final VoxelShape LINE_SOUTH_2 = makeCuboidShape(5, 5, 12, 11, 11, 14);
|
||||
private static final VoxelShape LINE_SOUTH_3 = makeCuboidShape(3, 3, 14, 13, 13, 16);
|
||||
private static final VoxelShape LINE_SOUTH = VoxelShapes.or(LINE_SOUTH_1, LINE_SOUTH_2, LINE_SOUTH_3);
|
||||
|
||||
private static final VoxelShape LINE_WEST_1 = makeCuboidShape(4, 6, 6, 6, 10, 10);
|
||||
private static final VoxelShape LINE_WEST_2 = makeCuboidShape(2, 5, 5, 4, 11, 11);
|
||||
private static final VoxelShape LINE_WEST_3 = makeCuboidShape(0, 3, 3, 2, 13, 13);
|
||||
private static final VoxelShape LINE_WEST = VoxelShapes.or(LINE_WEST_1, LINE_WEST_2, LINE_WEST_3);
|
||||
|
||||
private static final VoxelShape LINE_UP_1 = makeCuboidShape(6, 10, 6, 10, 12, 10);
|
||||
private static final VoxelShape LINE_UP_2 = makeCuboidShape(5, 12, 5, 11, 14, 11);
|
||||
private static final VoxelShape LINE_UP_3 = makeCuboidShape(3, 14, 3, 13, 16, 13);
|
||||
private static final VoxelShape LINE_UP = VoxelShapes.or(LINE_UP_1, LINE_UP_2, LINE_UP_3);
|
||||
|
||||
private static final VoxelShape LINE_DOWN_1 = makeCuboidShape(6, 4, 6, 10, 6, 10);
|
||||
private static final VoxelShape LINE_DOWN_2 = makeCuboidShape(5, 2, 5, 11, 4, 11);
|
||||
private static final VoxelShape LINE_DOWN_3 = makeCuboidShape(3, 0, 3, 13, 2, 13);
|
||||
private static final VoxelShape LINE_DOWN = VoxelShapes.or(LINE_DOWN_1, LINE_DOWN_2, LINE_DOWN_3);
|
||||
|
||||
public ImporterBlock() {
|
||||
super(BlockUtils.DEFAULT_GLASS_PROPERTIES);
|
||||
|
||||
this.setRegistryName(RS.ID, "importer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockDirection getDirection() {
|
||||
return BlockDirection.ANY;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext ctx) {
|
||||
VoxelShape shape = super.getShape(state, world, pos, ctx);
|
||||
|
||||
Direction direction = state.get(getDirection().getProperty());
|
||||
|
||||
if (direction == Direction.NORTH) {
|
||||
shape = VoxelShapes.or(shape, LINE_NORTH);
|
||||
}
|
||||
|
||||
if (direction == Direction.EAST) {
|
||||
shape = VoxelShapes.or(shape, LINE_EAST);
|
||||
}
|
||||
|
||||
if (direction == Direction.SOUTH) {
|
||||
shape = VoxelShapes.or(shape, LINE_SOUTH);
|
||||
}
|
||||
|
||||
if (direction == Direction.WEST) {
|
||||
shape = VoxelShapes.or(shape, LINE_WEST);
|
||||
}
|
||||
|
||||
if (direction == Direction.UP) {
|
||||
shape = VoxelShapes.or(shape, LINE_UP);
|
||||
}
|
||||
|
||||
if (direction == Direction.DOWN) {
|
||||
shape = VoxelShapes.or(shape, LINE_DOWN);
|
||||
}
|
||||
|
||||
return shape;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||
return new ImporterTile();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||
if (!world.isRemote) {
|
||||
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
|
||||
(ServerPlayerEntity) player,
|
||||
new PositionalTileContainerProvider<ImporterTile>(
|
||||
new TranslationTextComponent("gui.refinedstorage.importer"),
|
||||
(tile, windowId, inventory, p) -> new ImporterContainer(tile, player, windowId),
|
||||
pos
|
||||
),
|
||||
pos
|
||||
));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -2,10 +2,10 @@ package com.raoulvdberge.refinedstorage.container;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RSContainers;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.CraftingPattern;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeCrafter;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeCrafterManager;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.CrafterManagerSlot;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.BaseItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.validator.PatternItemValidator;
|
||||
import com.raoulvdberge.refinedstorage.screen.IScreenInfoProvider;
|
||||
import com.raoulvdberge.refinedstorage.screen.grid.filtering.GridFilterParser;
|
||||
import com.raoulvdberge.refinedstorage.screen.grid.stack.IGridStack;
|
||||
@@ -134,7 +134,8 @@ public class CrafterManagerContainer extends BaseContainer {
|
||||
if (newContainerData == null) { // We're only resizing, get the previous inventory...
|
||||
dummy = dummyInventories.get(category.getKey());
|
||||
} else {
|
||||
dummyInventories.put(category.getKey(), dummy = new BaseItemHandler(category.getValue()) {
|
||||
dummyInventories.put(category.getKey(), dummy = new BaseItemHandler(category.getValue(), slot -> {
|
||||
}) {
|
||||
@Override
|
||||
public int getSlotLimit(int slot) {
|
||||
return 1;
|
||||
@@ -143,7 +144,7 @@ public class CrafterManagerContainer extends BaseContainer {
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) {
|
||||
if (NetworkNodeCrafter.isValidPatternInSlot(getPlayer().getEntityWorld(), stack)) {
|
||||
if (new PatternItemValidator(getPlayer().getEntityWorld()).test(stack)) {
|
||||
return super.insertItem(slot, stack, simulate);
|
||||
}
|
||||
|
||||
|
@@ -3,13 +3,13 @@ package com.raoulvdberge.refinedstorage.container;
|
||||
import com.raoulvdberge.refinedstorage.RSContainers;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.filter.FilterSlot;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.filter.FluidFilterSlot;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileImporter;
|
||||
import com.raoulvdberge.refinedstorage.tile.ImporterTile;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
public class ImporterContainer extends BaseContainer {
|
||||
public ImporterContainer(TileImporter importer, PlayerEntity player, int windowId) {
|
||||
public ImporterContainer(ImporterTile importer, PlayerEntity player, int windowId) {
|
||||
super(RSContainers.IMPORTER, importer, player, windowId);
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
|
@@ -6,34 +6,35 @@ import net.minecraftforge.items.ItemStackHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
// TODO Builder system for server and clientside listeners.
|
||||
public class BaseItemHandler extends ItemStackHandler {
|
||||
@Nullable
|
||||
private Consumer<Integer> listener;
|
||||
private final Consumer<Integer> listener;
|
||||
private final List<Predicate<ItemStack>> validators = new ArrayList<>();
|
||||
|
||||
private boolean empty = true;
|
||||
|
||||
protected Predicate<ItemStack>[] validators;
|
||||
|
||||
private boolean reading;
|
||||
|
||||
public BaseItemHandler(int size, @Nullable Consumer<Integer> listener, Predicate<ItemStack>... validators) {
|
||||
public BaseItemHandler(int size, @Nullable Consumer<Integer> listener) {
|
||||
super(size);
|
||||
|
||||
this.listener = listener;
|
||||
this.validators = validators;
|
||||
}
|
||||
|
||||
public BaseItemHandler(int size, Predicate<ItemStack>... validators) {
|
||||
this(size, null, validators);
|
||||
public BaseItemHandler addValidator(Predicate<ItemStack> validator) {
|
||||
validators.add(validator);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) {
|
||||
if (validators.length > 0) {
|
||||
if (!validators.isEmpty()) {
|
||||
for (Predicate<ItemStack> validator : validators) {
|
||||
if (validator.test(stack)) {
|
||||
return super.insertItem(slot, stack, simulate);
|
||||
|
@@ -7,7 +7,7 @@ import com.raoulvdberge.refinedstorage.apiimpl.network.grid.GridTab;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.util.FluidFilter;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.util.ItemFilter;
|
||||
import com.raoulvdberge.refinedstorage.inventory.fluid.FluidInventoryFilter;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.validator.ItemValidatorBasic;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.validator.ItemValidator;
|
||||
import com.raoulvdberge.refinedstorage.item.FilterItem;
|
||||
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
||||
import com.raoulvdberge.refinedstorage.screen.grid.GridScreen;
|
||||
@@ -26,7 +26,9 @@ public class FilterItemHandler extends BaseItemHandler {
|
||||
private List<IGridTab> tabs;
|
||||
|
||||
public FilterItemHandler(List<IFilter> filters, List<IGridTab> tabs, @Nullable Consumer<Integer> listener) {
|
||||
super(4, listener, new ItemValidatorBasic(RSItems.FILTER));
|
||||
super(4, listener);
|
||||
|
||||
this.addValidator(new ItemValidator(RSItems.FILTER));
|
||||
|
||||
this.filters = filters;
|
||||
this.tabs = tabs;
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package com.raoulvdberge.refinedstorage.inventory.item;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.validator.ItemValidatorBasic;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.validator.ItemValidatorUpgrade;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.validator.UpgradeItemValidator;
|
||||
import com.raoulvdberge.refinedstorage.item.UpgradeItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -10,10 +9,10 @@ import java.util.function.Consumer;
|
||||
|
||||
public class UpgradeItemHandler extends BaseItemHandler {
|
||||
public UpgradeItemHandler(int size, @Nullable Consumer<Integer> listener, UpgradeItem.Type... supportedUpgrades) {
|
||||
super(size, listener, new ItemValidatorBasic[supportedUpgrades.length]);
|
||||
super(size, listener);
|
||||
|
||||
for (int i = 0; i < supportedUpgrades.length; ++i) {
|
||||
this.validators[i] = new ItemValidatorUpgrade(supportedUpgrades[i]);
|
||||
addValidator(new UpgradeItemValidator(supportedUpgrades[i]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +90,7 @@ public class UpgradeItemHandler extends BaseItemHandler {
|
||||
return maxFortune;
|
||||
}
|
||||
|
||||
public int getItemInteractCount() {
|
||||
public int getStackInteractCount() {
|
||||
return hasUpgrade(UpgradeItem.Type.STACK) ? 64 : 1;
|
||||
}
|
||||
|
||||
|
@@ -5,10 +5,10 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class ItemValidatorBasic implements Predicate<ItemStack> {
|
||||
public class ItemValidator implements Predicate<ItemStack> {
|
||||
private Item item;
|
||||
|
||||
public ItemValidatorBasic(Item item) {
|
||||
public ItemValidator(Item item) {
|
||||
this.item = item;
|
||||
}
|
||||
|
@@ -0,0 +1,20 @@
|
||||
package com.raoulvdberge.refinedstorage.inventory.item.validator;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternProvider;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class PatternItemValidator implements Predicate<ItemStack> {
|
||||
private final World world;
|
||||
|
||||
public PatternItemValidator(World world) {
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(ItemStack stack) {
|
||||
return stack.getItem() instanceof ICraftingPatternProvider && ((ICraftingPatternProvider) stack.getItem()).create(world, stack, null).isValid();
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
package com.raoulvdberge.refinedstorage.inventory.item.validator;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskProvider;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class StorageDiskItemValidator implements Predicate<ItemStack> {
|
||||
@Override
|
||||
public boolean test(ItemStack stack) {
|
||||
return stack.getItem() instanceof IStorageDiskProvider && ((IStorageDiskProvider) stack.getItem()).isValid(stack);
|
||||
}
|
||||
}
|
@@ -5,10 +5,10 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class ItemValidatorUpgrade implements Predicate<ItemStack> {
|
||||
public class UpgradeItemValidator implements Predicate<ItemStack> {
|
||||
private UpgradeItem.Type type;
|
||||
|
||||
public ItemValidatorUpgrade(UpgradeItem.Type type) {
|
||||
public UpgradeItemValidator(UpgradeItem.Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
@@ -1,37 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.render.constants;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.render.collision.CollisionGroup;
|
||||
import com.raoulvdberge.refinedstorage.util.CollisionUtils;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
||||
public final class ConstantsImporter {
|
||||
public static final AxisAlignedBB LINE_NORTH_1_AABB = CollisionUtils.getBounds(6, 6, 4, 10, 10, 6);
|
||||
public static final AxisAlignedBB LINE_NORTH_2_AABB = CollisionUtils.getBounds(5, 5, 2, 11, 11, 4);
|
||||
public static final AxisAlignedBB LINE_NORTH_3_AABB = CollisionUtils.getBounds(3, 3, 0, 13, 13, 2);
|
||||
public static final CollisionGroup LINE_NORTH = new CollisionGroup().addItem(LINE_NORTH_1_AABB).addItem(LINE_NORTH_2_AABB).addItem(LINE_NORTH_3_AABB).setCanAccessGui(true);
|
||||
|
||||
public static final AxisAlignedBB LINE_EAST_1_AABB = CollisionUtils.getBounds(10, 6, 6, 12, 10, 10);
|
||||
public static final AxisAlignedBB LINE_EAST_2_AABB = CollisionUtils.getBounds(12, 5, 5, 14, 11, 11);
|
||||
public static final AxisAlignedBB LINE_EAST_3_AABB = CollisionUtils.getBounds(14, 3, 3, 16, 13, 13);
|
||||
public static final CollisionGroup LINE_EAST = new CollisionGroup().addItem(LINE_EAST_1_AABB).addItem(LINE_EAST_2_AABB).addItem(LINE_EAST_3_AABB).setCanAccessGui(true);
|
||||
|
||||
public static final AxisAlignedBB LINE_SOUTH_1_AABB = CollisionUtils.getBounds(6, 6, 10, 10, 10, 12);
|
||||
public static final AxisAlignedBB LINE_SOUTH_2_AABB = CollisionUtils.getBounds(5, 5, 12, 11, 11, 14);
|
||||
public static final AxisAlignedBB LINE_SOUTH_3_AABB = CollisionUtils.getBounds(3, 3, 14, 13, 13, 16);
|
||||
public static final CollisionGroup LINE_SOUTH = new CollisionGroup().addItem(LINE_SOUTH_1_AABB).addItem(LINE_SOUTH_2_AABB).addItem(LINE_SOUTH_3_AABB).setCanAccessGui(true);
|
||||
|
||||
public static final AxisAlignedBB LINE_WEST_1_AABB = CollisionUtils.getBounds(4, 6, 6, 6, 10, 10);
|
||||
public static final AxisAlignedBB LINE_WEST_2_AABB = CollisionUtils.getBounds(2, 5, 5, 4, 11, 11);
|
||||
public static final AxisAlignedBB LINE_WEST_3_AABB = CollisionUtils.getBounds(0, 3, 3, 2, 13, 13);
|
||||
public static final CollisionGroup LINE_WEST = new CollisionGroup().addItem(LINE_WEST_1_AABB).addItem(LINE_WEST_2_AABB).addItem(LINE_WEST_3_AABB).setCanAccessGui(true);
|
||||
|
||||
public static final AxisAlignedBB LINE_UP_1_AABB = CollisionUtils.getBounds(6, 10, 6, 10, 12, 10);
|
||||
public static final AxisAlignedBB LINE_UP_2_AABB = CollisionUtils.getBounds(5, 12, 5, 11, 14, 11);
|
||||
public static final AxisAlignedBB LINE_UP_3_AABB = CollisionUtils.getBounds(3, 14, 3, 13, 16, 13);
|
||||
public static final CollisionGroup LINE_UP = new CollisionGroup().addItem(LINE_UP_1_AABB).addItem(LINE_UP_2_AABB).addItem(LINE_UP_3_AABB).setCanAccessGui(true);
|
||||
|
||||
public static final AxisAlignedBB LINE_DOWN_1_AABB = CollisionUtils.getBounds(6, 4, 6, 10, 6, 10);
|
||||
public static final AxisAlignedBB LINE_DOWN_2_AABB = CollisionUtils.getBounds(5, 2, 5, 11, 4, 11);
|
||||
public static final AxisAlignedBB LINE_DOWN_3_AABB = CollisionUtils.getBounds(3, 0, 3, 13, 2, 13);
|
||||
public static final CollisionGroup LINE_DOWN = new CollisionGroup().addItem(LINE_DOWN_1_AABB).addItem(LINE_DOWN_2_AABB).addItem(LINE_DOWN_3_AABB).setCanAccessGui(true);
|
||||
}
|
@@ -6,24 +6,25 @@ import com.raoulvdberge.refinedstorage.screen.widget.sidebutton.ExactModeSideBut
|
||||
import com.raoulvdberge.refinedstorage.screen.widget.sidebutton.RedstoneModeSideButton;
|
||||
import com.raoulvdberge.refinedstorage.screen.widget.sidebutton.TypeSideButton;
|
||||
import com.raoulvdberge.refinedstorage.screen.widget.sidebutton.WhitelistBlacklistSideButton;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileImporter;
|
||||
import com.raoulvdberge.refinedstorage.tile.ImporterTile;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
public class GuiImporter extends BaseScreen<ImporterContainer> {
|
||||
public GuiImporter(ImporterContainer container, PlayerInventory inventory) {
|
||||
super(container, 211, 137, inventory, null);
|
||||
public class ImporterScreen extends BaseScreen<ImporterContainer> {
|
||||
public ImporterScreen(ImporterContainer container, PlayerInventory inventory, ITextComponent title) {
|
||||
super(container, 211, 137, inventory, title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostInit(int x, int y) {
|
||||
addSideButton(new RedstoneModeSideButton(this, TileImporter.REDSTONE_MODE));
|
||||
addSideButton(new RedstoneModeSideButton(this, ImporterTile.REDSTONE_MODE));
|
||||
|
||||
addSideButton(new TypeSideButton(this, TileImporter.TYPE));
|
||||
addSideButton(new TypeSideButton(this, ImporterTile.TYPE));
|
||||
|
||||
addSideButton(new WhitelistBlacklistSideButton(this, TileImporter.WHITELIST_BLACKLIST));
|
||||
addSideButton(new WhitelistBlacklistSideButton(this, ImporterTile.WHITELIST_BLACKLIST));
|
||||
|
||||
addSideButton(new ExactModeSideButton(this, TileImporter.COMPARE));
|
||||
addSideButton(new ExactModeSideButton(this, ImporterTile.COMPARE));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -39,7 +40,7 @@ public class GuiImporter extends BaseScreen<ImporterContainer> {
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, I18n.format("gui.refinedstorage:importer"));
|
||||
renderString(7, 7, I18n.format("gui.refinedstorage.importer"));
|
||||
renderString(7, 43, I18n.format("container.inventory"));
|
||||
}
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
package com.raoulvdberge.refinedstorage.tile;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RSTiles;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeImporter;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.ImporterNetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IWhitelistBlacklist;
|
||||
@@ -11,12 +11,12 @@ import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class TileImporter extends NetworkNodeTile<NetworkNodeImporter> {
|
||||
public static final TileDataParameter<Integer, TileImporter> COMPARE = IComparable.createParameter();
|
||||
public static final TileDataParameter<Integer, TileImporter> WHITELIST_BLACKLIST = IWhitelistBlacklist.createParameter();
|
||||
public static final TileDataParameter<Integer, TileImporter> TYPE = IType.createParameter();
|
||||
public class ImporterTile extends NetworkNodeTile<ImporterNetworkNode> {
|
||||
public static final TileDataParameter<Integer, ImporterTile> COMPARE = IComparable.createParameter();
|
||||
public static final TileDataParameter<Integer, ImporterTile> WHITELIST_BLACKLIST = IWhitelistBlacklist.createParameter();
|
||||
public static final TileDataParameter<Integer, ImporterTile> TYPE = IType.createParameter();
|
||||
|
||||
public TileImporter() {
|
||||
public ImporterTile() {
|
||||
super(RSTiles.IMPORTER);
|
||||
|
||||
dataManager.addWatchedParameter(COMPARE);
|
||||
@@ -26,7 +26,7 @@ public class TileImporter extends NetworkNodeTile<NetworkNodeImporter> {
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public NetworkNodeImporter createNode(World world, BlockPos pos) {
|
||||
return new NetworkNodeImporter(world, pos);
|
||||
public ImporterNetworkNode createNode(World world, BlockPos pos) {
|
||||
return new ImporterNetworkNode(world, pos);
|
||||
}
|
||||
}
|
@@ -18,7 +18,6 @@ import com.raoulvdberge.refinedstorage.api.util.IFilter;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.handler.PortableFluidGridHandler;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.handler.PortableItemGridHandler;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.diskdrive.DiskDriveNetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.PortableFluidStorageCache;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.PortableItemStorageCache;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.listener.PortableFluidGridStorageCacheListener;
|
||||
@@ -29,6 +28,7 @@ import com.raoulvdberge.refinedstorage.apiimpl.storage.tracker.FluidStorageTrack
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.tracker.ItemStorageTracker;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.BaseItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.FilterItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.validator.StorageDiskItemValidator;
|
||||
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
||||
import com.raoulvdberge.refinedstorage.screen.grid.GridScreen;
|
||||
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||
@@ -91,7 +91,8 @@ public class PortableGrid implements IGrid, IPortableGrid, IStorageDiskContainer
|
||||
StackUtils.writeItems(this, 0, stack.getTag());
|
||||
}
|
||||
};
|
||||
private BaseItemHandler disk = new BaseItemHandler(1, DiskDriveNetworkNode.VALIDATOR_STORAGE_DISK) {
|
||||
private BaseItemHandler disk = new BaseItemHandler(1, slot -> {
|
||||
}) {
|
||||
@Override
|
||||
protected void onContentsChanged(int slot) {
|
||||
super.onContentsChanged(slot);
|
||||
@@ -133,7 +134,7 @@ public class PortableGrid implements IGrid, IPortableGrid, IStorageDiskContainer
|
||||
StackUtils.writeItems(this, 4, stack.getTag());
|
||||
}
|
||||
}
|
||||
};
|
||||
}.addValidator(new StorageDiskItemValidator());
|
||||
|
||||
public PortableGrid(PlayerEntity player, ItemStack stack) {
|
||||
this.player = player;
|
||||
|
@@ -36,6 +36,7 @@ import com.raoulvdberge.refinedstorage.block.enums.PortableGridDiskState;
|
||||
import com.raoulvdberge.refinedstorage.block.enums.PortableGridType;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.BaseItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.FilterItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.validator.StorageDiskItemValidator;
|
||||
import com.raoulvdberge.refinedstorage.inventory.listener.TileListener;
|
||||
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
||||
import com.raoulvdberge.refinedstorage.screen.grid.GridScreen;
|
||||
@@ -139,7 +140,7 @@ public class TilePortableGrid extends BaseTile implements IGrid, IPortableGrid,
|
||||
private List<IFilter> filters = new ArrayList<>();
|
||||
private List<IGridTab> tabs = new ArrayList<>();
|
||||
private FilterItemHandler filter = new FilterItemHandler(filters, tabs, new TileListener(this));
|
||||
private BaseItemHandler disk = new BaseItemHandler(1, new TileListener(this), DiskDriveNetworkNode.VALIDATOR_STORAGE_DISK) {
|
||||
private BaseItemHandler disk = new BaseItemHandler(1, new TileListener(this)) {
|
||||
@Override
|
||||
protected void onContentsChanged(int slot) {
|
||||
super.onContentsChanged(slot);
|
||||
@@ -148,7 +149,7 @@ public class TilePortableGrid extends BaseTile implements IGrid, IPortableGrid,
|
||||
loadStorage();
|
||||
}
|
||||
}
|
||||
};
|
||||
}.addValidator(new StorageDiskItemValidator());
|
||||
|
||||
@Nullable
|
||||
private IStorageDisk storage;
|
||||
|
136
src/main/resources/assets/refinedstorage/blockstates/importer.json
Executable file → Normal file
136
src/main/resources/assets/refinedstorage/blockstates/importer.json
Executable file → Normal file
@@ -1,87 +1,115 @@
|
||||
{
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"textures": {
|
||||
"cable": "refinedstorage:blocks/cable",
|
||||
"particle": "refinedstorage:blocks/cable",
|
||||
"border": "refinedstorage:blocks/cable_part_border"
|
||||
"multipart": [
|
||||
{
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/cable_core"
|
||||
}
|
||||
},
|
||||
"model": "refinedstorage:cable_core",
|
||||
"uvlock": false,
|
||||
"transform": "forge:default-block"
|
||||
},
|
||||
"variants": {
|
||||
"direction": {
|
||||
"north": {
|
||||
"submodel": "refinedstorage:importer"
|
||||
{
|
||||
"when": {
|
||||
"north": true
|
||||
},
|
||||
"east": {
|
||||
"submodel": "refinedstorage:importer",
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/cable_extension"
|
||||
}
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"east": true
|
||||
},
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/cable_extension",
|
||||
"y": 90
|
||||
}
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"south": true
|
||||
},
|
||||
"south": {
|
||||
"submodel": "refinedstorage:importer",
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/cable_extension",
|
||||
"x": 180
|
||||
}
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"west": true
|
||||
},
|
||||
"west": {
|
||||
"submodel": "refinedstorage:importer",
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/cable_extension",
|
||||
"y": 270
|
||||
}
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"up": true
|
||||
},
|
||||
"up": {
|
||||
"submodel": "refinedstorage:importer",
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/cable_extension",
|
||||
"x": 270
|
||||
}
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"down": true
|
||||
},
|
||||
"down": {
|
||||
"submodel": "refinedstorage:importer",
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/cable_extension",
|
||||
"x": 90
|
||||
}
|
||||
},
|
||||
"north": {
|
||||
"true": {
|
||||
"submodel": "refinedstorage:cable_extension"
|
||||
{
|
||||
"when": {
|
||||
"direction": "north"
|
||||
},
|
||||
"false": {
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/importer"
|
||||
}
|
||||
},
|
||||
"east": {
|
||||
"true": {
|
||||
"submodel": "refinedstorage:cable_extension",
|
||||
{
|
||||
"when": {
|
||||
"direction": "east"
|
||||
},
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/importer",
|
||||
"y": 90
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"south": {
|
||||
"true": {
|
||||
"submodel": "refinedstorage:cable_extension",
|
||||
{
|
||||
"when": {
|
||||
"direction": "south"
|
||||
},
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/importer",
|
||||
"x": 180
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"west": {
|
||||
"true": {
|
||||
"submodel": "refinedstorage:cable_extension",
|
||||
{
|
||||
"when": {
|
||||
"direction": "west"
|
||||
},
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/importer",
|
||||
"y": 270
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"up": {
|
||||
"true": {
|
||||
"submodel": "refinedstorage:cable_extension",
|
||||
{
|
||||
"when": {
|
||||
"direction": "up"
|
||||
},
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/importer",
|
||||
"x": 270
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"down": {
|
||||
"true": {
|
||||
"submodel": "refinedstorage:cable_extension",
|
||||
"x": 90
|
||||
{
|
||||
"when": {
|
||||
"direction": "down"
|
||||
},
|
||||
"false": {
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/importer",
|
||||
"x": 90
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@@ -21,7 +21,7 @@
|
||||
"gui.refinedstorage.disk_drive": "Disk Drive",
|
||||
"gui.refinedstorage.disk_drive.disks": "Disks",
|
||||
"gui.refinedstorage.external_storage": "External Storage",
|
||||
"gui.refinedstorage:importer": "Importer",
|
||||
"gui.refinedstorage.importer": "Importer",
|
||||
"gui.refinedstorage:exporter": "Exporter",
|
||||
"gui.refinedstorage:detector": "Detector",
|
||||
"gui.refinedstorage:destructor": "Destructor",
|
||||
@@ -187,7 +187,7 @@
|
||||
"block.refinedstorage.disk_drive": "Disk Drive",
|
||||
"block.refinedstorage:disk_manipulator": "Disk Manipulator",
|
||||
"block.refinedstorage.external_storage": "External Storage",
|
||||
"block.refinedstorage:importer": "Importer",
|
||||
"block.refinedstorage.importer": "Importer",
|
||||
"block.refinedstorage:exporter": "Exporter",
|
||||
"block.refinedstorage:detector": "Detector",
|
||||
"block.refinedstorage.machine_casing": "Machine Casing",
|
||||
|
@@ -1,5 +1,8 @@
|
||||
{
|
||||
"__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
|
||||
"textures": {
|
||||
"border": "refinedstorage:block/cable_part_border"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "Line1",
|
||||
|
@@ -0,0 +1,441 @@
|
||||
{
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"cable": "refinedstorage:block/cable",
|
||||
"border": "refinedstorage:block/cable_part_border"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "Core",
|
||||
"from": [
|
||||
6,
|
||||
6,
|
||||
6
|
||||
],
|
||||
"to": [
|
||||
10,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
6,
|
||||
6,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
6,
|
||||
6,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
6,
|
||||
6,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
6,
|
||||
6,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
6,
|
||||
6,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
6,
|
||||
6,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Part1",
|
||||
"from": [
|
||||
10,
|
||||
6,
|
||||
6
|
||||
],
|
||||
"to": [
|
||||
16,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"rotation": {
|
||||
"angle": 0,
|
||||
"axis": "y",
|
||||
"origin": [
|
||||
16,
|
||||
8,
|
||||
9
|
||||
]
|
||||
},
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
6,
|
||||
6,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
6,
|
||||
6,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
10,
|
||||
6,
|
||||
16,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
6,
|
||||
6,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
10,
|
||||
6,
|
||||
16,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
10,
|
||||
6,
|
||||
16,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Part2",
|
||||
"from": [
|
||||
0,
|
||||
6,
|
||||
6
|
||||
],
|
||||
"to": [
|
||||
6,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"rotation": {
|
||||
"angle": 0,
|
||||
"axis": "y",
|
||||
"origin": [
|
||||
6,
|
||||
8,
|
||||
9
|
||||
]
|
||||
},
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
10,
|
||||
6,
|
||||
16,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
6,
|
||||
6,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
6,
|
||||
6,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
6,
|
||||
6,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
6,
|
||||
6,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
6,
|
||||
6,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Line1",
|
||||
"from": [
|
||||
6.0,
|
||||
6.0,
|
||||
4.0
|
||||
],
|
||||
"to": [
|
||||
10.0,
|
||||
10.0,
|
||||
6.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
4.0,
|
||||
4.0
|
||||
]
|
||||
},
|
||||
"east": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
2.0,
|
||||
4.0
|
||||
]
|
||||
},
|
||||
"south": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
4.0,
|
||||
4.0
|
||||
]
|
||||
},
|
||||
"west": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
2.0,
|
||||
4.0
|
||||
]
|
||||
},
|
||||
"up": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
4.0,
|
||||
2.0
|
||||
]
|
||||
},
|
||||
"down": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
4.0,
|
||||
2.0
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Line2",
|
||||
"from": [
|
||||
5.0,
|
||||
5.0,
|
||||
2.0
|
||||
],
|
||||
"to": [
|
||||
11.0,
|
||||
11.0,
|
||||
4.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
6.0,
|
||||
6.0
|
||||
]
|
||||
},
|
||||
"east": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
2.0,
|
||||
6.0
|
||||
]
|
||||
},
|
||||
"south": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
6.0,
|
||||
6.0
|
||||
]
|
||||
},
|
||||
"west": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
2.0,
|
||||
6.0
|
||||
]
|
||||
},
|
||||
"up": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
6.0,
|
||||
2.0
|
||||
]
|
||||
},
|
||||
"down": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
6.0,
|
||||
2.0
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Line3",
|
||||
"from": [
|
||||
3.0,
|
||||
3.0,
|
||||
0.0
|
||||
],
|
||||
"to": [
|
||||
13.0,
|
||||
13.0,
|
||||
2.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
10.0,
|
||||
10.0
|
||||
]
|
||||
},
|
||||
"east": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
2.0,
|
||||
10.0
|
||||
]
|
||||
},
|
||||
"south": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
10.0,
|
||||
10.0
|
||||
]
|
||||
},
|
||||
"west": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
2.0,
|
||||
10.0
|
||||
]
|
||||
},
|
||||
"up": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
10.0,
|
||||
2.0
|
||||
]
|
||||
},
|
||||
"down": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
10.0,
|
||||
2.0
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@@ -5,10 +5,10 @@
|
||||
"item": "refinedstorage:cable"
|
||||
},
|
||||
{
|
||||
"item": "#destruction_core"
|
||||
"item": "refinedstorage:destruction_core"
|
||||
},
|
||||
{
|
||||
"item": "#improved_processor"
|
||||
"item": "refinedstorage:improved_processor"
|
||||
}
|
||||
],
|
||||
"result": {
|
Reference in New Issue
Block a user