Add basic grid block
This commit is contained in:
		@@ -1,8 +1,10 @@
 | 
			
		||||
package com.raoulvdberge.refinedstorage;
 | 
			
		||||
 | 
			
		||||
import com.raoulvdberge.refinedstorage.api.network.grid.GridType;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.network.NetworkNodeListener;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.CableNetworkNode;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.GridNetworkNode;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.diskdrive.DiskDriveNetworkNode;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.FluidStorageType;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.ItemStorageType;
 | 
			
		||||
@@ -25,6 +27,7 @@ import com.raoulvdberge.refinedstorage.tile.CableTile;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.ControllerTile;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.DiskDriveTile;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataManager;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.grid.GridTile;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.util.BlockUtils;
 | 
			
		||||
import net.minecraft.block.Block;
 | 
			
		||||
import net.minecraft.inventory.container.ContainerType;
 | 
			
		||||
@@ -67,7 +70,6 @@ public final class RS {
 | 
			
		||||
        FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(Item.class, this::onRegisterItems);
 | 
			
		||||
        FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(IRecipeSerializer.class, this::onRegisterRecipeSerializers);
 | 
			
		||||
        FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(ContainerType.class, this::onRegisterContainers);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @SubscribeEvent
 | 
			
		||||
@@ -88,6 +90,8 @@ public final class RS {
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        API.instance().getNetworkNodeRegistry().add(CableNetworkNode.ID, (tag, world, pos) -> new CableNetworkNode(world, pos));
 | 
			
		||||
 | 
			
		||||
        API.instance().getNetworkNodeRegistry().add(GridNetworkNode.ID, (tag, world, pos) -> new GridNetworkNode(world, pos, GridType.NORMAL));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @SubscribeEvent
 | 
			
		||||
@@ -103,6 +107,7 @@ public final class RS {
 | 
			
		||||
        e.getRegistry().register(new MachineCasingBlock());
 | 
			
		||||
        e.getRegistry().register(new CableBlock());
 | 
			
		||||
        e.getRegistry().register(new DiskDriveBlock());
 | 
			
		||||
        e.getRegistry().register(new GridBlock(GridType.NORMAL));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @SubscribeEvent
 | 
			
		||||
@@ -119,6 +124,10 @@ public final class RS {
 | 
			
		||||
        e.getRegistry().register(registerTileDataParameters(
 | 
			
		||||
            TileEntityType.Builder.create(DiskDriveTile::new, RSBlocks.DISK_DRIVE).build(null).setRegistryName(RS.ID, "disk_drive")
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        e.getRegistry().register(registerTileDataParameters(
 | 
			
		||||
            TileEntityType.Builder.create(() -> new GridTile(GridType.NORMAL), RSBlocks.GRID).build(null).setRegistryName(RS.ID, "grid")
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private <T extends TileEntity> TileEntityType<T> registerTileDataParameters(TileEntityType<T> t) {
 | 
			
		||||
@@ -185,6 +194,7 @@ public final class RS {
 | 
			
		||||
        e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.MACHINE_CASING));
 | 
			
		||||
        e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.CABLE));
 | 
			
		||||
        e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.DISK_DRIVE));
 | 
			
		||||
        e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.GRID));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* TODO
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,6 @@ import com.raoulvdberge.refinedstorage.block.*;
 | 
			
		||||
import net.minecraftforge.registries.ObjectHolder;
 | 
			
		||||
 | 
			
		||||
public final class RSBlocks {
 | 
			
		||||
    public static final BlockGrid GRID = new BlockGrid();
 | 
			
		||||
    public static final BlockExternalStorage EXTERNAL_STORAGE = new BlockExternalStorage();
 | 
			
		||||
    public static final BlockImporter IMPORTER = new BlockImporter();
 | 
			
		||||
    public static final BlockExporter EXPORTER = new BlockExporter();
 | 
			
		||||
@@ -43,6 +42,9 @@ public final class RSBlocks {
 | 
			
		||||
    @ObjectHolder(RS.ID + ":disk_drive")
 | 
			
		||||
    public static final DiskDriveBlock DISK_DRIVE = null;
 | 
			
		||||
 | 
			
		||||
    @ObjectHolder(RS.ID + ":grid")
 | 
			
		||||
    public static final GridBlock GRID = null;
 | 
			
		||||
 | 
			
		||||
    public static final BlockStorageMonitor STORAGE_MONITOR = new BlockStorageMonitor();
 | 
			
		||||
    public static final BlockPortableGrid PORTABLE_GRID = new BlockPortableGrid();
 | 
			
		||||
    public static final BlockCrafterManager CRAFTER_MANAGER = new BlockCrafterManager();
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@ package com.raoulvdberge.refinedstorage;
 | 
			
		||||
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.*;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.craftingmonitor.TileCraftingMonitor;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.grid.TileGrid;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.grid.GridTile;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.TilePortableGrid;
 | 
			
		||||
import net.minecraft.tileentity.TileEntityType;
 | 
			
		||||
import net.minecraftforge.registries.ObjectHolder;
 | 
			
		||||
@@ -41,8 +41,10 @@ public class RSTiles {
 | 
			
		||||
    public static final TileEntityType<TileFluidInterface> FLUID_INTERFACE = null;
 | 
			
		||||
    //@ObjectHolder(RS.ID + ":fluid_storage")
 | 
			
		||||
    public static final TileEntityType<TileFluidInterface> FLUID_STORAGE = null;
 | 
			
		||||
    //@ObjectHolder(RS.ID + ":grid")
 | 
			
		||||
    public static final TileEntityType<TileGrid> GRID = null;
 | 
			
		||||
 | 
			
		||||
    @ObjectHolder(RS.ID + ":grid")
 | 
			
		||||
    public static final TileEntityType<GridTile> GRID = null;
 | 
			
		||||
 | 
			
		||||
    //@ObjectHolder(RS.ID + ":importer")
 | 
			
		||||
    public static final TileEntityType<TileImporter> IMPORTER = null;
 | 
			
		||||
    //@ObjectHolder(RS.ID + ":interface")
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@ package com.raoulvdberge.refinedstorage.apiimpl.network.grid;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.api.network.grid.GridFactoryType;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.api.network.grid.IGridFactory;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.grid.TileGrid;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.grid.GridTile;
 | 
			
		||||
import net.minecraft.entity.player.PlayerEntity;
 | 
			
		||||
import net.minecraft.item.ItemStack;
 | 
			
		||||
import net.minecraft.tileentity.TileEntity;
 | 
			
		||||
@@ -24,8 +24,8 @@ public class GridFactoryGridBlock implements IGridFactory {
 | 
			
		||||
    public IGrid createFromBlock(PlayerEntity player, BlockPos pos) {
 | 
			
		||||
        TileEntity tile = getRelevantTile(player.getEntityWorld(), pos);
 | 
			
		||||
 | 
			
		||||
        if (tile instanceof TileGrid) {
 | 
			
		||||
            return ((TileGrid) tile).getNode();
 | 
			
		||||
        if (tile instanceof GridTile) {
 | 
			
		||||
            return ((GridTile) tile).getNode();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return null;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,5 @@
 | 
			
		||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
 | 
			
		||||
 | 
			
		||||
import com.raoulvdberge.refinedstorage.RS;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.RSBlocks;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.RSItems;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.api.network.grid.*;
 | 
			
		||||
@@ -16,7 +14,7 @@ import com.raoulvdberge.refinedstorage.api.util.IFilter;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.StorageCacheListenerGridFluid;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.StorageCacheListenerGridItem;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.block.BlockGrid;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.block.NodeBlock;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.inventory.fluid.FluidInventory;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.inventory.item.ItemHandlerBase;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.inventory.item.ItemHandlerFilter;
 | 
			
		||||
@@ -25,9 +23,8 @@ import com.raoulvdberge.refinedstorage.inventory.listener.ListenerNetworkNode;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.item.PatternItem;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataManager;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.grid.TileGrid;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.grid.GridTile;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.util.StackUtils;
 | 
			
		||||
import net.minecraft.block.BlockState;
 | 
			
		||||
import net.minecraft.entity.player.PlayerEntity;
 | 
			
		||||
import net.minecraft.entity.player.ServerPlayerEntity;
 | 
			
		||||
import net.minecraft.inventory.CraftResultInventory;
 | 
			
		||||
@@ -58,7 +55,7 @@ import java.util.HashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
 | 
			
		||||
public class NetworkNodeGrid extends NetworkNode implements IGridNetworkAware, IType {
 | 
			
		||||
public class GridNetworkNode extends NetworkNode implements IGridNetworkAware, IType {
 | 
			
		||||
    public static final String ID = "grid";
 | 
			
		||||
    public static int FACTORY_ID = 0;
 | 
			
		||||
 | 
			
		||||
@@ -102,23 +99,23 @@ public class NetworkNodeGrid extends NetworkNode implements IGridNetworkAware, I
 | 
			
		||||
 | 
			
		||||
            ItemStack pattern = getStackInSlot(slot);
 | 
			
		||||
            if (slot == 1 && !pattern.isEmpty()) {
 | 
			
		||||
                /* TODO boolean isPatternProcessing = ItemPattern.isProcessing(pattern);
 | 
			
		||||
                boolean isPatternProcessing = PatternItem.isProcessing(pattern);
 | 
			
		||||
 | 
			
		||||
                if (isPatternProcessing && isProcessingPattern()) {
 | 
			
		||||
                    for (int i = 0; i < 9; ++i) {
 | 
			
		||||
                        processingMatrix.setStackInSlot(i, StackUtils.nullToEmpty(ItemPattern.getInputSlot(pattern, i)));
 | 
			
		||||
                        processingMatrixFluids.setFluid(i, ItemPattern.getFluidInputSlot(pattern, i));
 | 
			
		||||
                        processingMatrix.setStackInSlot(i, StackUtils.nullToEmpty(PatternItem.getInputSlot(pattern, i)));
 | 
			
		||||
                        processingMatrixFluids.setFluid(i, PatternItem.getFluidInputSlot(pattern, i));
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    for (int i = 0; i < 9; ++i) {
 | 
			
		||||
                        processingMatrix.setStackInSlot(9 + i, StackUtils.nullToEmpty(ItemPattern.getOutputSlot(pattern, i)));
 | 
			
		||||
                        processingMatrixFluids.setFluid(9 + i, ItemPattern.getFluidOutputSlot(pattern, i));
 | 
			
		||||
                        processingMatrix.setStackInSlot(9 + i, StackUtils.nullToEmpty(PatternItem.getOutputSlot(pattern, i)));
 | 
			
		||||
                        processingMatrixFluids.setFluid(9 + i, PatternItem.getFluidOutputSlot(pattern, i));
 | 
			
		||||
                    }
 | 
			
		||||
                } else if (!isPatternProcessing && !isProcessingPattern()) {
 | 
			
		||||
                    for (int i = 0; i < 9; ++i) {
 | 
			
		||||
                        matrix.setInventorySlotContents(i, StackUtils.nullToEmpty(ItemPattern.getInputSlot(pattern, i)));
 | 
			
		||||
                        matrix.setInventorySlotContents(i, StackUtils.nullToEmpty(PatternItem.getInputSlot(pattern, i)));
 | 
			
		||||
                    }
 | 
			
		||||
                }*/
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -161,13 +158,17 @@ public class NetworkNodeGrid extends NetworkNode implements IGridNetworkAware, I
 | 
			
		||||
    private boolean processingPattern = false;
 | 
			
		||||
    private int processingType = IType.ITEMS;
 | 
			
		||||
 | 
			
		||||
    public NetworkNodeGrid(World world, BlockPos pos) {
 | 
			
		||||
    private final GridType gridType;
 | 
			
		||||
 | 
			
		||||
    public GridNetworkNode(World world, BlockPos pos, GridType gridType) {
 | 
			
		||||
        super(world, pos);
 | 
			
		||||
 | 
			
		||||
        this.gridType = gridType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public int getEnergyUsage() {
 | 
			
		||||
        switch (getGridType()) {
 | 
			
		||||
        /* @TODO switch (getGridType()) {
 | 
			
		||||
            case NORMAL:
 | 
			
		||||
                return RS.INSTANCE.config.gridUsage;
 | 
			
		||||
            case CRAFTING:
 | 
			
		||||
@@ -178,7 +179,8 @@ public class NetworkNodeGrid extends NetworkNode implements IGridNetworkAware, I
 | 
			
		||||
                return RS.INSTANCE.config.fluidGridUsage;
 | 
			
		||||
            default:
 | 
			
		||||
                return 0;
 | 
			
		||||
        }
 | 
			
		||||
        }*/
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setViewType(int viewType) {
 | 
			
		||||
@@ -218,7 +220,7 @@ public class NetworkNodeGrid extends NetworkNode implements IGridNetworkAware, I
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean isProcessingPattern() {
 | 
			
		||||
        return world.isRemote ? TileGrid.PROCESSING_PATTERN.getValue() : processingPattern;
 | 
			
		||||
        return world.isRemote ? GridTile.PROCESSING_PATTERN.getValue() : processingPattern;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setProcessingPattern(boolean processingPattern) {
 | 
			
		||||
@@ -227,15 +229,7 @@ public class NetworkNodeGrid extends NetworkNode implements IGridNetworkAware, I
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public GridType getGridType() {
 | 
			
		||||
        if (type == null) {
 | 
			
		||||
            BlockState state = world.getBlockState(pos);
 | 
			
		||||
 | 
			
		||||
            if (state.getBlock() == RSBlocks.GRID) {
 | 
			
		||||
                type = state.get(BlockGrid.TYPE);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return type == null ? GridType.NORMAL : type;
 | 
			
		||||
        return gridType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
@@ -454,6 +448,11 @@ public class NetworkNodeGrid extends NetworkNode implements IGridNetworkAware, I
 | 
			
		||||
        // NO OP
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean isActive() {
 | 
			
		||||
        return world.getBlockState(pos).get(NodeBlock.CONNECTED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onCrafted(PlayerEntity player) {
 | 
			
		||||
        onCrafted(this, world, player);
 | 
			
		||||
@@ -626,37 +625,37 @@ public class NetworkNodeGrid extends NetworkNode implements IGridNetworkAware, I
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public int getViewType() {
 | 
			
		||||
        return world.isRemote ? TileGrid.VIEW_TYPE.getValue() : viewType;
 | 
			
		||||
        return world.isRemote ? GridTile.VIEW_TYPE.getValue() : viewType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public int getSortingDirection() {
 | 
			
		||||
        return world.isRemote ? TileGrid.SORTING_DIRECTION.getValue() : sortingDirection;
 | 
			
		||||
        return world.isRemote ? GridTile.SORTING_DIRECTION.getValue() : sortingDirection;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public int getSortingType() {
 | 
			
		||||
        return world.isRemote ? TileGrid.SORTING_TYPE.getValue() : sortingType;
 | 
			
		||||
        return world.isRemote ? GridTile.SORTING_TYPE.getValue() : sortingType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public int getSearchBoxMode() {
 | 
			
		||||
        return world.isRemote ? TileGrid.SEARCH_BOX_MODE.getValue() : searchBoxMode;
 | 
			
		||||
        return world.isRemote ? GridTile.SEARCH_BOX_MODE.getValue() : searchBoxMode;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public int getSize() {
 | 
			
		||||
        return world.isRemote ? TileGrid.SIZE.getValue() : size;
 | 
			
		||||
        return world.isRemote ? GridTile.SIZE.getValue() : size;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public int getTabSelected() {
 | 
			
		||||
        return world.isRemote ? TileGrid.TAB_SELECTED.getValue() : tabSelected;
 | 
			
		||||
        return world.isRemote ? GridTile.TAB_SELECTED.getValue() : tabSelected;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public int getTabPage() {
 | 
			
		||||
        return world.isRemote ? TileGrid.TAB_PAGE.getValue() : Math.min(tabPage, getTotalTabPages());
 | 
			
		||||
        return world.isRemote ? GridTile.TAB_PAGE.getValue() : Math.min(tabPage, getTotalTabPages());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
@@ -666,44 +665,44 @@ public class NetworkNodeGrid extends NetworkNode implements IGridNetworkAware, I
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onViewTypeChanged(int type) {
 | 
			
		||||
        TileDataManager.setParameter(TileGrid.VIEW_TYPE, type);
 | 
			
		||||
        TileDataManager.setParameter(GridTile.VIEW_TYPE, type);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onSortingTypeChanged(int type) {
 | 
			
		||||
        TileDataManager.setParameter(TileGrid.SORTING_TYPE, type);
 | 
			
		||||
        TileDataManager.setParameter(GridTile.SORTING_TYPE, type);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onSortingDirectionChanged(int direction) {
 | 
			
		||||
        TileDataManager.setParameter(TileGrid.SORTING_DIRECTION, direction);
 | 
			
		||||
        TileDataManager.setParameter(GridTile.SORTING_DIRECTION, direction);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onSearchBoxModeChanged(int searchBoxMode) {
 | 
			
		||||
        TileDataManager.setParameter(TileGrid.SEARCH_BOX_MODE, searchBoxMode);
 | 
			
		||||
        TileDataManager.setParameter(GridTile.SEARCH_BOX_MODE, searchBoxMode);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onSizeChanged(int size) {
 | 
			
		||||
        TileDataManager.setParameter(TileGrid.SIZE, size);
 | 
			
		||||
        TileDataManager.setParameter(GridTile.SIZE, size);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onTabSelectionChanged(int tab) {
 | 
			
		||||
        TileDataManager.setParameter(TileGrid.TAB_SELECTED, tab);
 | 
			
		||||
        TileDataManager.setParameter(GridTile.TAB_SELECTED, tab);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onTabPageChanged(int page) {
 | 
			
		||||
        if (page >= 0 && page <= getTotalTabPages()) {
 | 
			
		||||
            TileDataManager.setParameter(TileGrid.TAB_PAGE, page);
 | 
			
		||||
            TileDataManager.setParameter(GridTile.TAB_PAGE, page);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public int getType() {
 | 
			
		||||
        return world.isRemote ? TileGrid.PROCESSING_TYPE.getValue() : processingType;
 | 
			
		||||
        return world.isRemote ? GridTile.PROCESSING_TYPE.getValue() : processingType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
@@ -6,8 +6,8 @@ import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.api.util.Action;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.block.BaseBlock;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.block.NodeBlock;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.config.RedstoneMode;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.util.WorldUtils;
 | 
			
		||||
import net.minecraft.block.BlockState;
 | 
			
		||||
import net.minecraft.item.Item;
 | 
			
		||||
import net.minecraft.item.ItemStack;
 | 
			
		||||
@@ -51,8 +51,6 @@ public abstract class NetworkNode implements INetworkNode, INetworkNodeVisitor {
 | 
			
		||||
    private boolean couldUpdate;
 | 
			
		||||
    private int ticksSinceUpdateChanged;
 | 
			
		||||
 | 
			
		||||
    private boolean active;
 | 
			
		||||
 | 
			
		||||
    public NetworkNode(World world, BlockPos pos) {
 | 
			
		||||
        if (world == null) {
 | 
			
		||||
            throw new IllegalArgumentException("World cannot be null");
 | 
			
		||||
@@ -93,7 +91,11 @@ public abstract class NetworkNode implements INetworkNode, INetworkNodeVisitor {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected void onConnectedStateChange(INetwork network, boolean state) {
 | 
			
		||||
        // NO OP
 | 
			
		||||
        BlockState blockState = world.getBlockState(pos);
 | 
			
		||||
 | 
			
		||||
        if (blockState.getBlock() instanceof NodeBlock && ((NodeBlock) blockState.getBlock()).hasConnectedState()) {
 | 
			
		||||
            world.setBlockState(pos, world.getBlockState(pos).with(NodeBlock.CONNECTED, state));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
@@ -126,6 +128,11 @@ public abstract class NetworkNode implements INetworkNode, INetworkNodeVisitor {
 | 
			
		||||
        throttlingDisabled = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // @TODO: DELETE.
 | 
			
		||||
    public boolean hasConnectivityState() {
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void update() {
 | 
			
		||||
        ++ticks;
 | 
			
		||||
@@ -140,10 +147,6 @@ public abstract class NetworkNode implements INetworkNode, INetworkNodeVisitor {
 | 
			
		||||
                couldUpdate = canUpdate;
 | 
			
		||||
                throttlingDisabled = false;
 | 
			
		||||
 | 
			
		||||
                if (hasConnectivityState()) {
 | 
			
		||||
                    WorldUtils.updateBlock(world, pos);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (network != null) {
 | 
			
		||||
                    onConnectedStateChange(network, canUpdate);
 | 
			
		||||
 | 
			
		||||
@@ -247,18 +250,6 @@ public abstract class NetworkNode implements INetworkNode, INetworkNodeVisitor {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean hasConnectivityState() {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean isActive() {
 | 
			
		||||
        return active;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setActive(boolean active) {
 | 
			
		||||
        this.active = active;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setOwner(@Nullable UUID owner) {
 | 
			
		||||
        this.owner = owner;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@ package com.raoulvdberge.refinedstorage.apiimpl.network.node;
 | 
			
		||||
 | 
			
		||||
import com.raoulvdberge.refinedstorage.RS;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.block.NodeBlock;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.TileCrafterManager;
 | 
			
		||||
import net.minecraft.entity.player.ServerPlayerEntity;
 | 
			
		||||
import net.minecraft.nbt.CompoundNBT;
 | 
			
		||||
@@ -80,4 +81,8 @@ public class NetworkNodeCrafterManager extends NetworkNode {
 | 
			
		||||
    public boolean hasConnectivityState() {
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean isActive() {
 | 
			
		||||
        return world.getBlockState(pos).get(NodeBlock.CONNECTED);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@ package com.raoulvdberge.refinedstorage.apiimpl.network.node;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.RS;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingManager;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingTask;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.block.NodeBlock;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.craftingmonitor.ICraftingMonitor;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.craftingmonitor.TileCraftingMonitor;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataManager;
 | 
			
		||||
@@ -75,6 +76,11 @@ public class NetworkNodeCraftingMonitor extends NetworkNode implements ICrafting
 | 
			
		||||
        return network != null ? network.getCraftingManager() : null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean isActive() {
 | 
			
		||||
        return world.getBlockState(pos).get(NodeBlock.CONNECTED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public CompoundNBT write(CompoundNBT tag) {
 | 
			
		||||
        super.write(tag);
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@ package com.raoulvdberge.refinedstorage.apiimpl.network.node;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.RS;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReader;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.cover.CoverManager;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.block.NodeBlock;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.TileReader;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
 | 
			
		||||
import net.minecraft.nbt.CompoundNBT;
 | 
			
		||||
@@ -62,6 +63,11 @@ public class NetworkNodeReader extends NetworkNode implements IReader, IGuiReade
 | 
			
		||||
        return TileReader.REDSTONE_MODE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean isActive() {
 | 
			
		||||
        return world.getBlockState(pos).get(NodeBlock.CONNECTED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean hasConnectivityState() {
 | 
			
		||||
        return true;
 | 
			
		||||
 
 | 
			
		||||
@@ -6,6 +6,7 @@ import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterCha
 | 
			
		||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterHandler;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IWriter;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.cover.CoverManager;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.block.NodeBlock;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.TileWriter;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
 | 
			
		||||
import net.minecraft.nbt.CompoundNBT;
 | 
			
		||||
@@ -94,6 +95,11 @@ public class NetworkNodeWriter extends NetworkNode implements IWriter, IGuiReade
 | 
			
		||||
        return TileWriter.REDSTONE_MODE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean isActive() {
 | 
			
		||||
        return world.getBlockState(pos).get(NodeBlock.CONNECTED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean hasConnectivityState() {
 | 
			
		||||
        return true;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,21 +1,58 @@
 | 
			
		||||
package com.raoulvdberge.refinedstorage.block;
 | 
			
		||||
 | 
			
		||||
import com.raoulvdberge.refinedstorage.RS;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.api.network.grid.GridType;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.grid.TileGrid;
 | 
			
		||||
import net.minecraft.state.EnumProperty;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.block.info.BlockDirection;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.grid.GridTile;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.util.BlockUtils;
 | 
			
		||||
import net.minecraft.block.BlockState;
 | 
			
		||||
import net.minecraft.tileentity.TileEntity;
 | 
			
		||||
import net.minecraft.util.BlockRenderLayer;
 | 
			
		||||
import net.minecraft.world.IBlockReader;
 | 
			
		||||
 | 
			
		||||
public class BlockGrid extends BlockNode {
 | 
			
		||||
    public static final EnumProperty<GridType> TYPE = EnumProperty.create("type", GridType.class);
 | 
			
		||||
import javax.annotation.Nullable;
 | 
			
		||||
 | 
			
		||||
    public BlockGrid() {
 | 
			
		||||
        super(BlockInfoBuilder.forId("grid").tileEntity(TileGrid::new).create());
 | 
			
		||||
public class GridBlock extends NodeBlock {
 | 
			
		||||
    private final GridType type;
 | 
			
		||||
 | 
			
		||||
    public GridBlock(GridType type) {
 | 
			
		||||
        super(BlockUtils.DEFAULT_ROCK_PROPERTIES);
 | 
			
		||||
 | 
			
		||||
        this.type = type;
 | 
			
		||||
 | 
			
		||||
        this.setRegistryName(RS.ID, type == GridType.NORMAL ? "grid" : type.getName() + "_grid");
 | 
			
		||||
    }
 | 
			
		||||
/*
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public BlockRenderLayer getRenderLayer() {
 | 
			
		||||
        return BlockRenderLayer.CUTOUT;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public BlockDirection getDirection() {
 | 
			
		||||
        return BlockDirection.HORIZONTAL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean hasConnectedState() {
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean hasTileEntity(BlockState state) {
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Nullable
 | 
			
		||||
    @Override
 | 
			
		||||
    public TileEntity createTileEntity(BlockState state, IBlockReader world) {
 | 
			
		||||
        return new GridTile(type);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
    @Override
 | 
			
		||||
    @OnlyIn(Dist.CLIENT)
 | 
			
		||||
    public void registerModels(IModelRegistration modelRegistration) {
 | 
			
		||||
        modelRegistration.setModel(this, GridType.NORMAL.getId(), new ModelResourceLocation(info.getId(), "connected=false,direction=north,type=normal"));
 | 
			
		||||
        modelRegistration.setModel(this, GridType.CRAFTING.getId(), new ModelResourceLocation(info.getId(), "connected=false,direction=north,type=crafting"));
 | 
			
		||||
        modelRegistration.setModel(this, GridType.PATTERN.getId(), new ModelResourceLocation(info.getId(), "connected=false,direction=north,type=pattern"));
 | 
			
		||||
        modelRegistration.setModel(this, GridType.FLUID.getId(), new ModelResourceLocation(info.getId(), "connected=false,direction=north,type=fluid"));
 | 
			
		||||
@@ -29,48 +66,8 @@ public class BlockGrid extends BlockNode {
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public BlockRenderLayer getRenderLayer() {
 | 
			
		||||
        return BlockRenderLayer.CUTOUT;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Nullable
 | 
			
		||||
    public BlockDirection getDirection() {
 | 
			
		||||
        return BlockDirection.HORIZONTAL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> items) {
 | 
			
		||||
        for (int i = 0; i <= 3; i++) {
 | 
			
		||||
            items.add(new ItemStack(this, 1, i));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected BlockStateContainer createBlockState() {
 | 
			
		||||
        return createBlockStateBuilder()
 | 
			
		||||
            .add(TYPE)
 | 
			
		||||
            .build();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public BlockState getStateFromMeta(int meta) {
 | 
			
		||||
        return getDefaultState().withProperty(TYPE, meta == 0 ? GridType.NORMAL : (meta == 1 ? GridType.CRAFTING : (meta == 2 ? GridType.PATTERN : GridType.FLUID)));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public int getMetaFromState(BlockState state) {
 | 
			
		||||
        return state.getValue(TYPE) == GridType.NORMAL ? 0 : (state.getValue(TYPE) == GridType.CRAFTING ? 1 : (state.getValue(TYPE) == GridType.PATTERN ? 2 : 3));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) {
 | 
			
		||||
        return openNetworkGui(player, world, pos, side, () -> API.instance().getGridManager().openGrid(NetworkNodeGrid.FACTORY_ID, (ServerPlayerEntity) player, pos));
 | 
			
		||||
    }*/
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean hasConnectedState() {
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -24,6 +24,10 @@ public abstract class NodeBlock extends BaseBlock {
 | 
			
		||||
 | 
			
		||||
    public NodeBlock(Block.Properties props) {
 | 
			
		||||
        super(props);
 | 
			
		||||
 | 
			
		||||
        if (hasConnectedState()) {
 | 
			
		||||
            this.setDefaultState(this.getStateContainer().getBaseState().with(CONNECTED, false));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@ import com.raoulvdberge.refinedstorage.api.network.grid.handler.IFluidGridHandle
 | 
			
		||||
import com.raoulvdberge.refinedstorage.api.network.grid.handler.IItemGridHandler;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.api.storage.IStorageCache;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.api.storage.IStorageCacheListener;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeGrid;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.GridNetworkNode;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.container.slot.filter.FilterSlot;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.container.slot.filter.FluidFilterSlot;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.container.slot.grid.CraftingGridSlot;
 | 
			
		||||
@@ -158,10 +158,10 @@ public class GridContainer extends BaseContainer implements IGridCraftingListene
 | 
			
		||||
    private void addPatternSlots() {
 | 
			
		||||
        int headerAndSlots = display.getTopHeight() + (display.getVisibleRows() * 18);
 | 
			
		||||
 | 
			
		||||
        addSlot(new SlotItemHandler(((NetworkNodeGrid) grid).getPatterns(), 0, 172, headerAndSlots + 4));
 | 
			
		||||
        addSlot(new SlotItemHandler(((NetworkNodeGrid) grid).getPatterns(), 1, 172, headerAndSlots + 40));
 | 
			
		||||
        addSlot(new SlotItemHandler(((GridNetworkNode) grid).getPatterns(), 0, 172, headerAndSlots + 4));
 | 
			
		||||
        addSlot(new SlotItemHandler(((GridNetworkNode) grid).getPatterns(), 1, 172, headerAndSlots + 40));
 | 
			
		||||
 | 
			
		||||
        transferManager.addBiTransfer(getPlayer().inventory, ((NetworkNodeGrid) grid).getPatterns());
 | 
			
		||||
        transferManager.addBiTransfer(getPlayer().inventory, ((GridNetworkNode) grid).getPatterns());
 | 
			
		||||
 | 
			
		||||
        // Processing patterns
 | 
			
		||||
        int ox = 8;
 | 
			
		||||
@@ -169,8 +169,8 @@ public class GridContainer extends BaseContainer implements IGridCraftingListene
 | 
			
		||||
        int y = headerAndSlots + 4;
 | 
			
		||||
 | 
			
		||||
        for (int i = 0; i < 9 * 2; ++i) {
 | 
			
		||||
            addSlot(new FilterSlot(((NetworkNodeGrid) grid).getProcessingMatrix(), i, x, y, FilterSlot.FILTER_ALLOW_SIZE).setEnableHandler(() -> ((NetworkNodeGrid) grid).isProcessingPattern() && ((NetworkNodeGrid) grid).getType() == IType.ITEMS));
 | 
			
		||||
            addSlot(new FluidFilterSlot(((NetworkNodeGrid) grid).getProcessingMatrixFluids(), i, x, y, FilterSlot.FILTER_ALLOW_SIZE).setEnableHandler(() -> ((NetworkNodeGrid) grid).isProcessingPattern() && ((NetworkNodeGrid) grid).getType() == IType.FLUIDS));
 | 
			
		||||
            addSlot(new FilterSlot(((GridNetworkNode) grid).getProcessingMatrix(), i, x, y, FilterSlot.FILTER_ALLOW_SIZE).setEnableHandler(() -> ((GridNetworkNode) grid).isProcessingPattern() && ((GridNetworkNode) grid).getType() == IType.ITEMS));
 | 
			
		||||
            addSlot(new FluidFilterSlot(((GridNetworkNode) grid).getProcessingMatrixFluids(), i, x, y, FilterSlot.FILTER_ALLOW_SIZE).setEnableHandler(() -> ((GridNetworkNode) grid).isProcessingPattern() && ((GridNetworkNode) grid).getType() == IType.FLUIDS));
 | 
			
		||||
 | 
			
		||||
            x += 18;
 | 
			
		||||
 | 
			
		||||
@@ -191,7 +191,7 @@ public class GridContainer extends BaseContainer implements IGridCraftingListene
 | 
			
		||||
        y = headerAndSlots + 4;
 | 
			
		||||
 | 
			
		||||
        for (int i = 0; i < 9; ++i) {
 | 
			
		||||
            addSlot(new FilterLegacySlot(grid.getCraftingMatrix(), i, x, y).setEnableHandler(() -> !((NetworkNodeGrid) grid).isProcessingPattern()));
 | 
			
		||||
            addSlot(new FilterLegacySlot(grid.getCraftingMatrix(), i, x, y).setEnableHandler(() -> !((GridNetworkNode) grid).isProcessingPattern()));
 | 
			
		||||
 | 
			
		||||
            x += 18;
 | 
			
		||||
 | 
			
		||||
@@ -201,7 +201,7 @@ public class GridContainer extends BaseContainer implements IGridCraftingListene
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        addSlot(patternResultSlot = (new DisabledLegacySlot(grid.getCraftingResult(), 0, 134, headerAndSlots + 22).setEnableHandler(() -> !((NetworkNodeGrid) grid).isProcessingPattern())));
 | 
			
		||||
        addSlot(patternResultSlot = (new DisabledLegacySlot(grid.getCraftingResult(), 0, 134, headerAndSlots + 22).setEnableHandler(() -> !((GridNetworkNode) grid).isProcessingPattern())));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public IGrid getGrid() {
 | 
			
		||||
 
 | 
			
		||||
@@ -178,12 +178,11 @@ public class PatternItem extends Item implements ICraftingPatternProvider {
 | 
			
		||||
        pattern.getTag().put(String.format(NBT_FLUID_INPUT_SLOT, slot), stack.writeToNBT(new CompoundNBT()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Nullable
 | 
			
		||||
    public static FluidStack getFluidInputSlot(ItemStack pattern, int slot) {
 | 
			
		||||
        String id = String.format(NBT_FLUID_INPUT_SLOT, slot);
 | 
			
		||||
 | 
			
		||||
        if (!pattern.hasTag() || !pattern.getTag().contains(id)) {
 | 
			
		||||
            return null;
 | 
			
		||||
            return FluidStack.EMPTY;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return FluidStack.loadFluidStackFromNBT(pattern.getTag().getCompound(id));
 | 
			
		||||
@@ -197,12 +196,11 @@ public class PatternItem extends Item implements ICraftingPatternProvider {
 | 
			
		||||
        pattern.getTag().put(String.format(NBT_FLUID_OUTPUT_SLOT, slot), stack.writeToNBT(new CompoundNBT()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Nullable
 | 
			
		||||
    public static FluidStack getFluidOutputSlot(ItemStack pattern, int slot) {
 | 
			
		||||
        String id = String.format(NBT_FLUID_OUTPUT_SLOT, slot);
 | 
			
		||||
 | 
			
		||||
        if (!pattern.hasTag() || !pattern.getTag().contains(id)) {
 | 
			
		||||
            return null;
 | 
			
		||||
            return FluidStack.EMPTY;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return FluidStack.loadFluidStackFromNBT(pattern.getTag().getCompound(id));
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@ import com.mojang.blaze3d.platform.GlStateManager;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.RS;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.api.network.grid.GridType;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeGrid;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.GridNetworkNode;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.render.ElementDrawers;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.container.GridContainer;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
 | 
			
		||||
@@ -21,7 +21,7 @@ import com.raoulvdberge.refinedstorage.screen.widget.SearchWidget;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.screen.widget.TabListWidget;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.screen.widget.sidebutton.*;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.grid.TileGrid;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.grid.GridTile;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.IPortableGrid;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.TilePortableGrid;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.util.RenderUtils;
 | 
			
		||||
@@ -86,8 +86,8 @@ public class GuiGrid extends BaseScreen<GridContainer> implements IResizableDisp
 | 
			
		||||
 | 
			
		||||
        this.scrollbar = new ScrollbarWidget(this, 174, getTopHeight(), 12, (getVisibleRows() * 18) - 2);
 | 
			
		||||
 | 
			
		||||
        if (grid instanceof NetworkNodeGrid || grid instanceof TilePortableGrid) {
 | 
			
		||||
            addSideButton(new SideButtonRedstoneMode(this, grid instanceof NetworkNodeGrid ? TileGrid.REDSTONE_MODE : TilePortableGrid.REDSTONE_MODE));
 | 
			
		||||
        if (grid instanceof GridNetworkNode || grid instanceof TilePortableGrid) {
 | 
			
		||||
            addSideButton(new SideButtonRedstoneMode(this, grid instanceof GridNetworkNode ? GridTile.REDSTONE_MODE : TilePortableGrid.REDSTONE_MODE));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        int sx = x + 80 + 1;
 | 
			
		||||
@@ -114,20 +114,20 @@ public class GuiGrid extends BaseScreen<GridContainer> implements IResizableDisp
 | 
			
		||||
        addSideButton(new SideButtonGridSize(this, () -> grid.getSize(), size -> grid.onSizeChanged(size)));
 | 
			
		||||
 | 
			
		||||
        if (grid.getGridType() == GridType.PATTERN) {
 | 
			
		||||
            processingPattern = addCheckBox(x + 7, y + getTopHeight() + (getVisibleRows() * 18) + 60, I18n.format("misc.refinedstorage.processing"), TileGrid.PROCESSING_PATTERN.getValue(), btn -> {
 | 
			
		||||
            processingPattern = addCheckBox(x + 7, y + getTopHeight() + (getVisibleRows() * 18) + 60, I18n.format("misc.refinedstorage.processing"), GridTile.PROCESSING_PATTERN.getValue(), btn -> {
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            boolean showOredict = true;
 | 
			
		||||
            if (((NetworkNodeGrid) grid).isProcessingPattern() && ((NetworkNodeGrid) grid).getType() == IType.FLUIDS) {
 | 
			
		||||
            if (((GridNetworkNode) grid).isProcessingPattern() && ((GridNetworkNode) grid).getType() == IType.FLUIDS) {
 | 
			
		||||
                showOredict = false;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (showOredict) {
 | 
			
		||||
                oredictPattern = addCheckBox(processingPattern.x + processingPattern.getWidth() + 5, y + getTopHeight() + (getVisibleRows() * 18) + 60, I18n.format("misc.refinedstorage:oredict"), TileGrid.OREDICT_PATTERN.getValue(), btn -> {
 | 
			
		||||
                oredictPattern = addCheckBox(processingPattern.x + processingPattern.getWidth() + 5, y + getTopHeight() + (getVisibleRows() * 18) + 60, I18n.format("misc.refinedstorage:oredict"), GridTile.OREDICT_PATTERN.getValue(), btn -> {
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            addSideButton(new SideButtonType(this, TileGrid.PROCESSING_TYPE));
 | 
			
		||||
            addSideButton(new SideButtonType(this, GridTile.PROCESSING_TYPE));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        updateScrollbar();
 | 
			
		||||
@@ -243,7 +243,7 @@ public class GuiGrid extends BaseScreen<GridContainer> implements IResizableDisp
 | 
			
		||||
            case CRAFTING:
 | 
			
		||||
                return RenderUtils.inBounds(82, y, 7, 7, mouseX, mouseY);
 | 
			
		||||
            case PATTERN:
 | 
			
		||||
                if (((NetworkNodeGrid) grid).isProcessingPattern()) {
 | 
			
		||||
                if (((GridNetworkNode) grid).isProcessingPattern()) {
 | 
			
		||||
                    return RenderUtils.inBounds(154, y, 7, 7, mouseX, mouseY);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
@@ -254,7 +254,7 @@ public class GuiGrid extends BaseScreen<GridContainer> implements IResizableDisp
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private boolean isOverCreatePattern(int mouseX, int mouseY) {
 | 
			
		||||
        return grid.getGridType() == GridType.PATTERN && RenderUtils.inBounds(172, getTopHeight() + (getVisibleRows() * 18) + 22, 16, 16, mouseX, mouseY) && ((NetworkNodeGrid) grid).canCreatePattern();
 | 
			
		||||
        return grid.getGridType() == GridType.PATTERN && RenderUtils.inBounds(172, getTopHeight() + (getVisibleRows() * 18) + 22, 16, 16, mouseX, mouseY) && ((GridNetworkNode) grid).canCreatePattern();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
@@ -266,7 +266,7 @@ public class GuiGrid extends BaseScreen<GridContainer> implements IResizableDisp
 | 
			
		||||
        } else if (grid.getGridType() == GridType.CRAFTING) {
 | 
			
		||||
            bindTexture(RS.ID, "gui/crafting_grid.png");
 | 
			
		||||
        } else if (grid.getGridType() == GridType.PATTERN) {
 | 
			
		||||
            bindTexture(RS.ID, "gui/pattern_grid" + (((NetworkNodeGrid) grid).isProcessingPattern() ? "_processing" : "") + ".png");
 | 
			
		||||
            bindTexture(RS.ID, "gui/pattern_grid" + (((GridNetworkNode) grid).isProcessingPattern() ? "_processing" : "") + ".png");
 | 
			
		||||
        } else {
 | 
			
		||||
            bindTexture(RS.ID, "gui/grid.png");
 | 
			
		||||
        }
 | 
			
		||||
@@ -297,7 +297,7 @@ public class GuiGrid extends BaseScreen<GridContainer> implements IResizableDisp
 | 
			
		||||
                ty = 1;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (!((NetworkNodeGrid) grid).canCreatePattern()) {
 | 
			
		||||
            if (!((GridNetworkNode) grid).canCreatePattern()) {
 | 
			
		||||
                ty = 2;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@ package com.raoulvdberge.refinedstorage.screen.widget.sidebutton;
 | 
			
		||||
 | 
			
		||||
import com.raoulvdberge.refinedstorage.api.network.grid.GridType;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeGrid;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.GridNetworkNode;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
 | 
			
		||||
import net.minecraft.client.resources.I18n;
 | 
			
		||||
import net.minecraft.util.text.TextFormatting;
 | 
			
		||||
@@ -44,13 +44,13 @@ public class SideButtonGridSortingType extends SideButton {
 | 
			
		||||
            }
 | 
			
		||||
        } else if (type == IGrid.SORTING_TYPE_ID) {
 | 
			
		||||
            type = IGrid.SORTING_TYPE_LAST_MODIFIED;
 | 
			
		||||
        } else if (type == NetworkNodeGrid.SORTING_TYPE_LAST_MODIFIED) {
 | 
			
		||||
        } else if (type == GridNetworkNode.SORTING_TYPE_LAST_MODIFIED) {
 | 
			
		||||
            if (grid.getGridType() == GridType.FLUID || /* TODO !Loader.isModLoaded(GridSorterInventoryTweaks.MOD_ID)*/false) {
 | 
			
		||||
                type = IGrid.SORTING_TYPE_QUANTITY;
 | 
			
		||||
            } else {
 | 
			
		||||
                type = IGrid.SORTING_TYPE_INVENTORYTWEAKS;
 | 
			
		||||
            }
 | 
			
		||||
        } else if (type == NetworkNodeGrid.SORTING_TYPE_INVENTORYTWEAKS) {
 | 
			
		||||
        } else if (type == GridNetworkNode.SORTING_TYPE_INVENTORYTWEAKS) {
 | 
			
		||||
            type = IGrid.SORTING_TYPE_QUANTITY;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,6 @@ import javax.annotation.Nullable;
 | 
			
		||||
public abstract class NetworkNodeTile<N extends NetworkNode> extends BaseTile implements INetworkNodeProxy<N>, IRedstoneConfigurable {
 | 
			
		||||
    public static final TileDataParameter<Integer, NetworkNodeTile> REDSTONE_MODE = RedstoneMode.createParameter();
 | 
			
		||||
 | 
			
		||||
    private static final String NBT_ACTIVE = "Active";
 | 
			
		||||
    private static final String NBT_COVERS = "Cover";
 | 
			
		||||
 | 
			
		||||
    private N clientNode;
 | 
			
		||||
@@ -56,8 +55,6 @@ public abstract class NetworkNodeTile<N extends NetworkNode> extends BaseTile im
 | 
			
		||||
            tag.put(NBT_COVERS, ((ICoverable) getNode()).getCoverManager().writeToNbt());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        tag.putBoolean(NBT_ACTIVE, getNode().canUpdate());
 | 
			
		||||
 | 
			
		||||
        return tag;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -67,8 +64,6 @@ public abstract class NetworkNodeTile<N extends NetworkNode> extends BaseTile im
 | 
			
		||||
        if (getNode() instanceof ICoverable && tag.contains(NBT_COVERS)) {
 | 
			
		||||
            ((ICoverable) getNode()).getCoverManager().readFromNbt(tag.getList(NBT_COVERS, Constants.NBT.TAG_COMPOUND));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        getNode().setActive(tag.getBoolean(NBT_ACTIVE));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,9 @@
 | 
			
		||||
package com.raoulvdberge.refinedstorage.tile.grid;
 | 
			
		||||
 | 
			
		||||
import com.raoulvdberge.refinedstorage.RSTiles;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.api.network.grid.GridType;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeGrid;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.GridNetworkNode;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.screen.grid.GuiGrid;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.NetworkNodeTile;
 | 
			
		||||
@@ -14,57 +15,57 @@ import net.minecraft.world.World;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Nonnull;
 | 
			
		||||
 | 
			
		||||
public class TileGrid extends NetworkNodeTile<NetworkNodeGrid> {
 | 
			
		||||
    public static final TileDataParameter<Integer, TileGrid> VIEW_TYPE = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getNode().getViewType(), (t, v) -> {
 | 
			
		||||
public class GridTile extends NetworkNodeTile<GridNetworkNode> {
 | 
			
		||||
    public static final TileDataParameter<Integer, GridTile> VIEW_TYPE = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getNode().getViewType(), (t, v) -> {
 | 
			
		||||
        if (IGrid.isValidViewType(v)) {
 | 
			
		||||
            t.getNode().setViewType(v);
 | 
			
		||||
            t.getNode().markDirty();
 | 
			
		||||
        }
 | 
			
		||||
    }, (initial, p) -> trySortGrid(initial));
 | 
			
		||||
    public static final TileDataParameter<Integer, TileGrid> SORTING_DIRECTION = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getNode().getSortingDirection(), (t, v) -> {
 | 
			
		||||
    public static final TileDataParameter<Integer, GridTile> SORTING_DIRECTION = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getNode().getSortingDirection(), (t, v) -> {
 | 
			
		||||
        if (IGrid.isValidSortingDirection(v)) {
 | 
			
		||||
            t.getNode().setSortingDirection(v);
 | 
			
		||||
            t.getNode().markDirty();
 | 
			
		||||
        }
 | 
			
		||||
    }, (initial, p) -> trySortGrid(initial));
 | 
			
		||||
    public static final TileDataParameter<Integer, TileGrid> SORTING_TYPE = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getNode().getSortingType(), (t, v) -> {
 | 
			
		||||
    public static final TileDataParameter<Integer, GridTile> SORTING_TYPE = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getNode().getSortingType(), (t, v) -> {
 | 
			
		||||
        if (IGrid.isValidSortingType(v)) {
 | 
			
		||||
            t.getNode().setSortingType(v);
 | 
			
		||||
            t.getNode().markDirty();
 | 
			
		||||
        }
 | 
			
		||||
    }, (initial, p) -> trySortGrid(initial));
 | 
			
		||||
    public static final TileDataParameter<Integer, TileGrid> SEARCH_BOX_MODE = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getNode().getSearchBoxMode(), (t, v) -> {
 | 
			
		||||
    public static final TileDataParameter<Integer, GridTile> SEARCH_BOX_MODE = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getNode().getSearchBoxMode(), (t, v) -> {
 | 
			
		||||
        if (IGrid.isValidSearchBoxMode(v)) {
 | 
			
		||||
            t.getNode().setSearchBoxMode(v);
 | 
			
		||||
            t.getNode().markDirty();
 | 
			
		||||
        }
 | 
			
		||||
    }, (initial, p) -> BaseScreen.executeLater(GuiGrid.class, grid -> grid.getSearchField().setMode(p)));
 | 
			
		||||
    public static final TileDataParameter<Integer, TileGrid> SIZE = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getNode().getSize(), (t, v) -> {
 | 
			
		||||
    public static final TileDataParameter<Integer, GridTile> SIZE = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getNode().getSize(), (t, v) -> {
 | 
			
		||||
        if (IGrid.isValidSize(v)) {
 | 
			
		||||
            t.getNode().setSize(v);
 | 
			
		||||
            t.getNode().markDirty();
 | 
			
		||||
        }
 | 
			
		||||
    }, (initial, p) -> BaseScreen.executeLater(GuiGrid.class, BaseScreen::init));
 | 
			
		||||
    public static final TileDataParameter<Integer, TileGrid> TAB_SELECTED = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getNode().getTabSelected(), (t, v) -> {
 | 
			
		||||
    public static final TileDataParameter<Integer, GridTile> TAB_SELECTED = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getNode().getTabSelected(), (t, v) -> {
 | 
			
		||||
        t.getNode().setTabSelected(v == t.getNode().getTabSelected() ? -1 : v);
 | 
			
		||||
        t.getNode().markDirty();
 | 
			
		||||
    }, (initial, p) -> BaseScreen.executeLater(GuiGrid.class, grid -> grid.getView().sort()));
 | 
			
		||||
    public static final TileDataParameter<Integer, TileGrid> TAB_PAGE = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getNode().getTabPage(), (t, v) -> {
 | 
			
		||||
    public static final TileDataParameter<Integer, GridTile> TAB_PAGE = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getNode().getTabPage(), (t, v) -> {
 | 
			
		||||
        if (v >= 0 && v <= t.getNode().getTotalTabPages()) {
 | 
			
		||||
            t.getNode().setTabPage(v);
 | 
			
		||||
            t.getNode().markDirty();
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
    public static final TileDataParameter<Boolean, TileGrid> OREDICT_PATTERN = new TileDataParameter<>(DataSerializers.BOOLEAN, false, t -> t.getNode().isOredictPattern(), (t, v) -> {
 | 
			
		||||
    public static final TileDataParameter<Boolean, GridTile> OREDICT_PATTERN = new TileDataParameter<>(DataSerializers.BOOLEAN, false, t -> t.getNode().isOredictPattern(), (t, v) -> {
 | 
			
		||||
        t.getNode().setOredictPattern(v);
 | 
			
		||||
        t.getNode().markDirty();
 | 
			
		||||
    }, (initial, p) -> BaseScreen.executeLater(GuiGrid.class, grid -> grid.updateOredictPattern(p)));
 | 
			
		||||
    public static final TileDataParameter<Boolean, TileGrid> PROCESSING_PATTERN = new TileDataParameter<>(DataSerializers.BOOLEAN, false, t -> t.getNode().isProcessingPattern(), (t, v) -> {
 | 
			
		||||
    public static final TileDataParameter<Boolean, GridTile> PROCESSING_PATTERN = new TileDataParameter<>(DataSerializers.BOOLEAN, false, t -> t.getNode().isProcessingPattern(), (t, v) -> {
 | 
			
		||||
        t.getNode().setProcessingPattern(v);
 | 
			
		||||
        t.getNode().clearMatrix();
 | 
			
		||||
        t.getNode().markDirty();
 | 
			
		||||
    }, (initial, p) -> BaseScreen.executeLater(GuiGrid.class, BaseScreen::init));
 | 
			
		||||
    public static final TileDataParameter<Integer, TileGrid> PROCESSING_TYPE = IType.createParameter((initial, p) -> BaseScreen.executeLater(GuiGrid.class, BaseScreen::init));
 | 
			
		||||
    public static final TileDataParameter<Integer, GridTile> PROCESSING_TYPE = IType.createParameter((initial, p) -> BaseScreen.executeLater(GuiGrid.class, BaseScreen::init));
 | 
			
		||||
 | 
			
		||||
    public static void trySortGrid(boolean initial) {
 | 
			
		||||
        if (!initial) {
 | 
			
		||||
@@ -72,9 +73,13 @@ public class TileGrid extends NetworkNodeTile<NetworkNodeGrid> {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public TileGrid() {
 | 
			
		||||
    private final GridType gridType;
 | 
			
		||||
 | 
			
		||||
    public GridTile(GridType gridType) {
 | 
			
		||||
        super(RSTiles.GRID);
 | 
			
		||||
 | 
			
		||||
        this.gridType = gridType;
 | 
			
		||||
 | 
			
		||||
        dataManager.addWatchedParameter(VIEW_TYPE);
 | 
			
		||||
        dataManager.addWatchedParameter(SORTING_DIRECTION);
 | 
			
		||||
        dataManager.addWatchedParameter(SORTING_TYPE);
 | 
			
		||||
@@ -89,8 +94,8 @@ public class TileGrid extends NetworkNodeTile<NetworkNodeGrid> {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Nonnull
 | 
			
		||||
    public NetworkNodeGrid createNode(World world, BlockPos pos) {
 | 
			
		||||
        return new NetworkNodeGrid(world, pos);
 | 
			
		||||
    public GridNetworkNode createNode(World world, BlockPos pos) {
 | 
			
		||||
        return new GridNetworkNode(world, pos, gridType);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* TODO
 | 
			
		||||
@@ -17,7 +17,7 @@ import com.raoulvdberge.refinedstorage.api.util.IFilter;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.handler.FluidGridHandlerPortable;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.handler.ItemGridHandlerPortable;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeGrid;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.GridNetworkNode;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.diskdrive.DiskDriveNetworkNode;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.*;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.disk.StorageDiskFluidPortable;
 | 
			
		||||
@@ -35,7 +35,7 @@ import com.raoulvdberge.refinedstorage.tile.config.IRedstoneConfigurable;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.config.RedstoneMode;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataManager;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.grid.TileGrid;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.tile.grid.GridTile;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.util.StackUtils;
 | 
			
		||||
import com.raoulvdberge.refinedstorage.util.WorldUtils;
 | 
			
		||||
import net.minecraft.block.BlockState;
 | 
			
		||||
@@ -73,13 +73,13 @@ public class TilePortableGrid extends BaseTile implements IGrid, IPortableGrid,
 | 
			
		||||
            t.setSortingDirection(v);
 | 
			
		||||
            t.markDirty();
 | 
			
		||||
        }
 | 
			
		||||
    }, (initial, p) -> TileGrid.trySortGrid(initial));
 | 
			
		||||
    }, (initial, p) -> GridTile.trySortGrid(initial));
 | 
			
		||||
    private static final TileDataParameter<Integer, TilePortableGrid> SORTING_TYPE = new TileDataParameter<>(DataSerializers.VARINT, 0, TilePortableGrid::getSortingType, (t, v) -> {
 | 
			
		||||
        if (IGrid.isValidSortingType(v)) {
 | 
			
		||||
            t.setSortingType(v);
 | 
			
		||||
            t.markDirty();
 | 
			
		||||
        }
 | 
			
		||||
    }, (initial, p) -> TileGrid.trySortGrid(initial));
 | 
			
		||||
    }, (initial, p) -> GridTile.trySortGrid(initial));
 | 
			
		||||
    private static final TileDataParameter<Integer, TilePortableGrid> SEARCH_BOX_MODE = new TileDataParameter<>(DataSerializers.VARINT, 0, TilePortableGrid::getSearchBoxMode, (t, v) -> {
 | 
			
		||||
        if (IGrid.isValidSearchBoxMode(v)) {
 | 
			
		||||
            t.setSearchBoxMode(v);
 | 
			
		||||
@@ -273,12 +273,12 @@ public class TilePortableGrid extends BaseTile implements IGrid, IPortableGrid,
 | 
			
		||||
 | 
			
		||||
        stack.setTag(new CompoundNBT());
 | 
			
		||||
 | 
			
		||||
        stack.getTag().putInt(NetworkNodeGrid.NBT_SORTING_DIRECTION, sortingDirection);
 | 
			
		||||
        stack.getTag().putInt(NetworkNodeGrid.NBT_SORTING_TYPE, sortingType);
 | 
			
		||||
        stack.getTag().putInt(NetworkNodeGrid.NBT_SEARCH_BOX_MODE, searchBoxMode);
 | 
			
		||||
        stack.getTag().putInt(NetworkNodeGrid.NBT_SIZE, size);
 | 
			
		||||
        stack.getTag().putInt(NetworkNodeGrid.NBT_TAB_SELECTED, tabSelected);
 | 
			
		||||
        stack.getTag().putInt(NetworkNodeGrid.NBT_TAB_PAGE, tabPage);
 | 
			
		||||
        stack.getTag().putInt(GridNetworkNode.NBT_SORTING_DIRECTION, sortingDirection);
 | 
			
		||||
        stack.getTag().putInt(GridNetworkNode.NBT_SORTING_TYPE, sortingType);
 | 
			
		||||
        stack.getTag().putInt(GridNetworkNode.NBT_SEARCH_BOX_MODE, searchBoxMode);
 | 
			
		||||
        stack.getTag().putInt(GridNetworkNode.NBT_SIZE, size);
 | 
			
		||||
        stack.getTag().putInt(GridNetworkNode.NBT_TAB_SELECTED, tabSelected);
 | 
			
		||||
        stack.getTag().putInt(GridNetworkNode.NBT_TAB_PAGE, tabPage);
 | 
			
		||||
 | 
			
		||||
        stack.getTag().put(PortableGrid.NBT_STORAGE_TRACKER, storageTracker.serializeNbt());
 | 
			
		||||
        stack.getTag().put(PortableGrid.NBT_FLUID_STORAGE_TRACKER, fluidStorageTracker.serializeNbt());
 | 
			
		||||
@@ -601,12 +601,12 @@ public class TilePortableGrid extends BaseTile implements IGrid, IPortableGrid,
 | 
			
		||||
    public CompoundNBT write(CompoundNBT tag) {
 | 
			
		||||
        super.write(tag);
 | 
			
		||||
 | 
			
		||||
        tag.putInt(NetworkNodeGrid.NBT_SORTING_DIRECTION, sortingDirection);
 | 
			
		||||
        tag.putInt(NetworkNodeGrid.NBT_SORTING_TYPE, sortingType);
 | 
			
		||||
        tag.putInt(NetworkNodeGrid.NBT_SEARCH_BOX_MODE, searchBoxMode);
 | 
			
		||||
        tag.putInt(NetworkNodeGrid.NBT_SIZE, size);
 | 
			
		||||
        tag.putInt(NetworkNodeGrid.NBT_TAB_SELECTED, tabSelected);
 | 
			
		||||
        tag.putInt(NetworkNodeGrid.NBT_TAB_PAGE, tabPage);
 | 
			
		||||
        tag.putInt(GridNetworkNode.NBT_SORTING_DIRECTION, sortingDirection);
 | 
			
		||||
        tag.putInt(GridNetworkNode.NBT_SORTING_TYPE, sortingType);
 | 
			
		||||
        tag.putInt(GridNetworkNode.NBT_SEARCH_BOX_MODE, searchBoxMode);
 | 
			
		||||
        tag.putInt(GridNetworkNode.NBT_SIZE, size);
 | 
			
		||||
        tag.putInt(GridNetworkNode.NBT_TAB_SELECTED, tabSelected);
 | 
			
		||||
        tag.putInt(GridNetworkNode.NBT_TAB_PAGE, tabPage);
 | 
			
		||||
 | 
			
		||||
        StackUtils.writeItems(disk, 0, tag);
 | 
			
		||||
        StackUtils.writeItems(filter, 1, tag);
 | 
			
		||||
@@ -629,28 +629,28 @@ public class TilePortableGrid extends BaseTile implements IGrid, IPortableGrid,
 | 
			
		||||
    public void read(CompoundNBT tag) {
 | 
			
		||||
        super.read(tag);
 | 
			
		||||
 | 
			
		||||
        if (tag.contains(NetworkNodeGrid.NBT_SORTING_DIRECTION)) {
 | 
			
		||||
            sortingDirection = tag.getInt(NetworkNodeGrid.NBT_SORTING_DIRECTION);
 | 
			
		||||
        if (tag.contains(GridNetworkNode.NBT_SORTING_DIRECTION)) {
 | 
			
		||||
            sortingDirection = tag.getInt(GridNetworkNode.NBT_SORTING_DIRECTION);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (tag.contains(NetworkNodeGrid.NBT_SORTING_TYPE)) {
 | 
			
		||||
            sortingType = tag.getInt(NetworkNodeGrid.NBT_SORTING_TYPE);
 | 
			
		||||
        if (tag.contains(GridNetworkNode.NBT_SORTING_TYPE)) {
 | 
			
		||||
            sortingType = tag.getInt(GridNetworkNode.NBT_SORTING_TYPE);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (tag.contains(NetworkNodeGrid.NBT_SEARCH_BOX_MODE)) {
 | 
			
		||||
            searchBoxMode = tag.getInt(NetworkNodeGrid.NBT_SEARCH_BOX_MODE);
 | 
			
		||||
        if (tag.contains(GridNetworkNode.NBT_SEARCH_BOX_MODE)) {
 | 
			
		||||
            searchBoxMode = tag.getInt(GridNetworkNode.NBT_SEARCH_BOX_MODE);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (tag.contains(NetworkNodeGrid.NBT_SIZE)) {
 | 
			
		||||
            size = tag.getInt(NetworkNodeGrid.NBT_SIZE);
 | 
			
		||||
        if (tag.contains(GridNetworkNode.NBT_SIZE)) {
 | 
			
		||||
            size = tag.getInt(GridNetworkNode.NBT_SIZE);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (tag.contains(NetworkNodeGrid.NBT_TAB_SELECTED)) {
 | 
			
		||||
            tabSelected = tag.getInt(NetworkNodeGrid.NBT_TAB_SELECTED);
 | 
			
		||||
        if (tag.contains(GridNetworkNode.NBT_TAB_SELECTED)) {
 | 
			
		||||
            tabSelected = tag.getInt(GridNetworkNode.NBT_TAB_SELECTED);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (tag.contains(NetworkNodeGrid.NBT_TAB_PAGE)) {
 | 
			
		||||
            tabPage = tag.getInt(NetworkNodeGrid.NBT_TAB_PAGE);
 | 
			
		||||
        if (tag.contains(GridNetworkNode.NBT_TAB_PAGE)) {
 | 
			
		||||
            tabPage = tag.getInt(GridNetworkNode.NBT_TAB_PAGE);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        StackUtils.readItems(disk, 0, tag);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										102
									
								
								src/main/resources/assets/refinedstorage/blockstates/grid.json
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										102
									
								
								src/main/resources/assets/refinedstorage/blockstates/grid.json
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							@@ -1,80 +1,36 @@
 | 
			
		||||
{
 | 
			
		||||
  "forge_marker": 1,
 | 
			
		||||
  "defaults": {
 | 
			
		||||
    "model": "refinedstorage:cube_north_cutout",
 | 
			
		||||
    "textures": {
 | 
			
		||||
      "particle": "refinedstorage:blocks/side",
 | 
			
		||||
      "east": "refinedstorage:blocks/grid/left",
 | 
			
		||||
      "south": "refinedstorage:blocks/grid/back",
 | 
			
		||||
      "west": "refinedstorage:blocks/grid/right",
 | 
			
		||||
      "up": "refinedstorage:blocks/grid/top",
 | 
			
		||||
      "down": "refinedstorage:blocks/bottom",
 | 
			
		||||
      "north_normal": "refinedstorage:blocks/grid/front",
 | 
			
		||||
      "north_crafting": "refinedstorage:blocks/grid/crafting_front",
 | 
			
		||||
      "north_pattern": "refinedstorage:blocks/grid/pattern_front",
 | 
			
		||||
      "north_fluid": "refinedstorage:blocks/grid/fluid_front",
 | 
			
		||||
      "cutout_normal": "refinedstorage:blocks/grid/cutouts/front_disconnected",
 | 
			
		||||
      "cutout_crafting": "refinedstorage:blocks/grid/cutouts/crafting_front_disconnected",
 | 
			
		||||
      "cutout_pattern": "refinedstorage:blocks/grid/cutouts/pattern_front_disconnected",
 | 
			
		||||
      "cutout_fluid": "refinedstorage:blocks/grid/cutouts/fluid_front_disconnected"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "variants": {
 | 
			
		||||
    "connected": {
 | 
			
		||||
      "true": {
 | 
			
		||||
        "textures": {
 | 
			
		||||
          "cutout_normal": "refinedstorage:blocks/grid/cutouts/front_connected",
 | 
			
		||||
          "cutout_crafting": "refinedstorage:blocks/grid/cutouts/crafting_front_connected",
 | 
			
		||||
          "cutout_pattern": "refinedstorage:blocks/grid/cutouts/pattern_front_connected",
 | 
			
		||||
          "cutout_fluid": "refinedstorage:blocks/grid/cutouts/fluid_front_connected"
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      "false": {
 | 
			
		||||
      }
 | 
			
		||||
    "connected=true,direction=north": {
 | 
			
		||||
      "model": "refinedstorage:block/grid/normal/connected",
 | 
			
		||||
      "y": 0
 | 
			
		||||
    },
 | 
			
		||||
    "type": {
 | 
			
		||||
      "normal": {
 | 
			
		||||
        "textures": {
 | 
			
		||||
          "north": "#north_normal",
 | 
			
		||||
          "cutout": "#cutout_normal"
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      "crafting": {
 | 
			
		||||
        "textures": {
 | 
			
		||||
          "north": "#north_crafting",
 | 
			
		||||
          "cutout": "#cutout_crafting"
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      "pattern": {
 | 
			
		||||
        "textures": {
 | 
			
		||||
          "north": "#north_pattern",
 | 
			
		||||
          "cutout": "#cutout_pattern"
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      "fluid": {
 | 
			
		||||
        "textures": {
 | 
			
		||||
          "north": "#north_fluid",
 | 
			
		||||
          "cutout": "#cutout_fluid",
 | 
			
		||||
          "east": "refinedstorage:blocks/grid/fluid_left",
 | 
			
		||||
          "south": "refinedstorage:blocks/grid/fluid_back",
 | 
			
		||||
          "west": "refinedstorage:blocks/grid/fluid_right",
 | 
			
		||||
          "up": "refinedstorage:blocks/grid/fluid_top"
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    "connected=true,direction=east": {
 | 
			
		||||
      "model": "refinedstorage:block/grid/normal/connected",
 | 
			
		||||
      "y": 90
 | 
			
		||||
    },
 | 
			
		||||
    "direction": {
 | 
			
		||||
      "north": {
 | 
			
		||||
        "y": 0
 | 
			
		||||
      },
 | 
			
		||||
      "east": {
 | 
			
		||||
        "y": 90
 | 
			
		||||
      },
 | 
			
		||||
      "south": {
 | 
			
		||||
        "y": 180
 | 
			
		||||
      },
 | 
			
		||||
      "west": {
 | 
			
		||||
        "y": 270
 | 
			
		||||
      }
 | 
			
		||||
    "connected=true,direction=south": {
 | 
			
		||||
      "model": "refinedstorage:block/grid/normal/connected",
 | 
			
		||||
      "y": 180
 | 
			
		||||
    },
 | 
			
		||||
    "connected=true,direction=west": {
 | 
			
		||||
      "model": "refinedstorage:block/grid/normal/connected",
 | 
			
		||||
      "y": 270
 | 
			
		||||
    },
 | 
			
		||||
    "connected=false,direction=north": {
 | 
			
		||||
      "model": "refinedstorage:block/grid/normal/disconnected",
 | 
			
		||||
      "y": 0
 | 
			
		||||
    },
 | 
			
		||||
    "connected=false,direction=east": {
 | 
			
		||||
      "model": "refinedstorage:block/grid/normal/disconnected",
 | 
			
		||||
      "y": 90
 | 
			
		||||
    },
 | 
			
		||||
    "connected=false,direction=south": {
 | 
			
		||||
      "model": "refinedstorage:block/grid/normal/disconnected",
 | 
			
		||||
      "y": 180
 | 
			
		||||
    },
 | 
			
		||||
    "connected=false,direction=west": {
 | 
			
		||||
      "model": "refinedstorage:block/grid/normal/disconnected",
 | 
			
		||||
      "y": 270
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -179,10 +179,10 @@
 | 
			
		||||
  "block.refinedstorage.controller": "Controller",
 | 
			
		||||
  "block.refinedstorage.creative_controller": "Creative Controller",
 | 
			
		||||
  "block.refinedstorage.cable": "Cable",
 | 
			
		||||
  "block.refinedstorage:grid.0": "Grid",
 | 
			
		||||
  "block.refinedstorage:grid.1": "Crafting Grid",
 | 
			
		||||
  "block.refinedstorage:grid.2": "Pattern Grid",
 | 
			
		||||
  "block.refinedstorage:grid.3": "Fluid Grid",
 | 
			
		||||
  "block.refinedstorage.grid": "Grid",
 | 
			
		||||
  "block.refinedstorage.crafting_grid": "Crafting Grid",
 | 
			
		||||
  "block.refinedstorage.pattern_grid": "Pattern Grid",
 | 
			
		||||
  "block.refinedstorage.fluid_grid": "Fluid Grid",
 | 
			
		||||
  "block.refinedstorage.disk_drive": "Disk Drive",
 | 
			
		||||
  "block.refinedstorage:disk_manipulator": "Disk Manipulator",
 | 
			
		||||
  "block.refinedstorage:external_storage": "External Storage",
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,13 @@
 | 
			
		||||
{
 | 
			
		||||
  "parent": "refinedstorage:block/cube_north_cutout",
 | 
			
		||||
  "textures": {
 | 
			
		||||
    "particle": "refinedstorage:block/side",
 | 
			
		||||
    "east": "refinedstorage:block/grid/left",
 | 
			
		||||
    "south": "refinedstorage:block/grid/back",
 | 
			
		||||
    "west": "refinedstorage:block/grid/right",
 | 
			
		||||
    "up": "refinedstorage:block/grid/top",
 | 
			
		||||
    "down": "refinedstorage:block/bottom",
 | 
			
		||||
    "north": "refinedstorage:block/grid/front",
 | 
			
		||||
    "cutout": "refinedstorage:block/grid/cutouts/front_connected"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,13 @@
 | 
			
		||||
{
 | 
			
		||||
  "parent": "refinedstorage:block/cube_north_cutout",
 | 
			
		||||
  "textures": {
 | 
			
		||||
    "particle": "refinedstorage:block/side",
 | 
			
		||||
    "east": "refinedstorage:block/grid/left",
 | 
			
		||||
    "south": "refinedstorage:block/grid/back",
 | 
			
		||||
    "west": "refinedstorage:block/grid/right",
 | 
			
		||||
    "up": "refinedstorage:block/grid/top",
 | 
			
		||||
    "down": "refinedstorage:block/bottom",
 | 
			
		||||
    "north": "refinedstorage:block/grid/front",
 | 
			
		||||
    "cutout": "refinedstorage:block/grid/cutouts/front_disconnected"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,3 @@
 | 
			
		||||
{
 | 
			
		||||
  "parent": "refinedstorage:block/grid/normal/disconnected"
 | 
			
		||||
}
 | 
			
		||||
@@ -7,14 +7,13 @@
 | 
			
		||||
  ],
 | 
			
		||||
  "key": {
 | 
			
		||||
    "P": {
 | 
			
		||||
      "item": "#improved_processor"
 | 
			
		||||
      "item": "refinedstorage:improved_processor"
 | 
			
		||||
    },
 | 
			
		||||
    "C": {
 | 
			
		||||
      "item": "#construction_core"
 | 
			
		||||
      "item": "refinedstorage:construction_core"
 | 
			
		||||
    },
 | 
			
		||||
    "G": {
 | 
			
		||||
      "type": "forge:ore_dict",
 | 
			
		||||
      "ore": "blockGlass"
 | 
			
		||||
      "tag": "forge:glass"
 | 
			
		||||
    },
 | 
			
		||||
    "E": {
 | 
			
		||||
      "item": "refinedstorage:quartz_enriched_iron"
 | 
			
		||||
@@ -23,11 +22,10 @@
 | 
			
		||||
      "item": "refinedstorage:machine_casing"
 | 
			
		||||
    },
 | 
			
		||||
    "D": {
 | 
			
		||||
      "item": "#destruction_core"
 | 
			
		||||
      "item": "refinedstorage:destruction_core"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "result": {
 | 
			
		||||
    "item": "refinedstorage:grid",
 | 
			
		||||
    "data": 0
 | 
			
		||||
    "item": "refinedstorage:grid"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user