From 33bcd6ad7cf79c63ed4cd296227fe72a84f20bdf Mon Sep 17 00:00:00 2001 From: lothrazar Date: Sun, 1 Dec 2024 13:14:07 -0800 Subject: [PATCH] import export cable refactoring execution inside of capabilities --- .../api/IConnectableItemAutoIO.java | 24 +- .../api/IConnectableItemProcessing.java | 14 +- .../block/AbstractNetworkScreen.java | 15 -- .../storagenetwork/block/TileConnectable.java | 2 +- .../cable/processing/TileCableProcess.java | 11 +- .../exchange/ExchangeItemStackHandler.java | 2 +- .../storagenetwork/block/main/BlockMain.java | 8 +- .../block/main/NetworkModule.java | 3 + .../storagenetwork/block/main/TileMain.java | 235 +++++------------- .../CapabilityConnectableAutoIO.java | 196 +++++++++++---- .../CapabilityConnectableProcessing.java | 5 +- .../storagenetwork/gui/ContainerNetwork.java | 2 +- .../network/ClearRecipeMessage.java | 2 +- .../storagenetwork/network/InsertMessage.java | 2 +- .../storagenetwork/network/RecipeMessage.java | 2 +- .../network/RequestMessage.java | 4 +- .../storagenetwork/registry/SsnRegistry.java | 3 +- .../storagenetwork/util/UtilConnections.java | 2 + .../blockstates/process_kabel.json | 77 ++++++ .../models/block/cable_none_process.json | 8 + .../models/block/cable_side_process.json | 8 + .../models/item/process_kabel.json | 9 + .../textures/block/cable_process.png | Bin 0 -> 512 bytes .../loot_tables/blocks/process_kabel.json | 20 ++ .../storagenetwork/recipes/process_kabel.json | 25 ++ update.json | 2 +- 26 files changed, 390 insertions(+), 291 deletions(-) create mode 100644 src/main/resources/assets/storagenetwork/blockstates/process_kabel.json create mode 100644 src/main/resources/assets/storagenetwork/models/block/cable_none_process.json create mode 100644 src/main/resources/assets/storagenetwork/models/block/cable_side_process.json create mode 100644 src/main/resources/assets/storagenetwork/models/item/process_kabel.json create mode 100644 src/main/resources/assets/storagenetwork/textures/block/cable_process.png create mode 100644 src/main/resources/data/storagenetwork/loot_tables/blocks/process_kabel.json create mode 100644 src/main/resources/data/storagenetwork/recipes/process_kabel.json diff --git a/src/main/java/com/lothrazar/storagenetwork/api/IConnectableItemAutoIO.java b/src/main/java/com/lothrazar/storagenetwork/api/IConnectableItemAutoIO.java index 54cd1afb..f7ffaa44 100644 --- a/src/main/java/com/lothrazar/storagenetwork/api/IConnectableItemAutoIO.java +++ b/src/main/java/com/lothrazar/storagenetwork/api/IConnectableItemAutoIO.java @@ -4,6 +4,7 @@ import java.util.List; import com.lothrazar.storagenetwork.block.main.TileMain; import com.lothrazar.storagenetwork.capability.handler.FilterItemStackHandler; +import com.lothrazar.storagenetwork.util.RequestBatch; import net.minecraft.core.Direction; import net.minecraft.world.item.ItemStack; import net.minecraftforge.items.IItemHandler; @@ -45,23 +46,6 @@ public interface IConnectableItemAutoIO { */ ItemStack insertStack(ItemStack stack, boolean simulate); - /** - * This is called whenever its your storages turn to import another item. Use the first used slot for this if you have a slot based inventory. If its not a simulation actually remove the stack from - * your storage! - *

- * Apply your own transfer rate here! - *

- * If your ioDirection is set to IN, this should never get called, unless another malicious mod is doing it. - * - * @param size - * The size of the stack that should be extracted - * @param simulate - * Whether or not this is just a simulation - * @return The stack that has been requested, if you have it - */ - @Deprecated - ItemStack extractNextStack(int size, boolean simulate); - default IItemHandler getItemHandler() { return null; } @@ -110,7 +94,11 @@ default boolean isOperationMode() { * The network main. Use this to e.g. query amount of items. * @return Whether or not this IConnectableLink should be processed this tick. */ - boolean runNow(DimPos connectablePos, TileMain main); + boolean canRunNow(DimPos connectablePos, TileMain main); + + RequestBatch runExport(TileMain main); + + void runImport(TileMain main); /** * If this block is used with an ioDirection of OUT and has its getSupportedTransferDirection set to OUT, then this list will be consolidated by the main and available items in the network matching diff --git a/src/main/java/com/lothrazar/storagenetwork/api/IConnectableItemProcessing.java b/src/main/java/com/lothrazar/storagenetwork/api/IConnectableItemProcessing.java index 17be79ea..360b30f7 100644 --- a/src/main/java/com/lothrazar/storagenetwork/api/IConnectableItemProcessing.java +++ b/src/main/java/com/lothrazar/storagenetwork/api/IConnectableItemProcessing.java @@ -11,8 +11,6 @@ */ public interface IConnectableItemProcessing { - - Direction facingInventory(); /** @@ -24,17 +22,7 @@ public interface IConnectableItemProcessing { void setPriority(int value); - /** - * Called every tick to see if an operation should be processed now, i.e. this can be used to add cooldown times or disable operations via redstone signal. - * - * @param connectablePos - * The position of your block, including the world - * @param main - * The network main. Use this to e.g. query amount of items. - * @return Whether or not this IConnectableLink should be processed this tick. - */ - boolean runNow(TileMain main); - + void execute(TileMain main); /** * TODO: * diff --git a/src/main/java/com/lothrazar/storagenetwork/block/AbstractNetworkScreen.java b/src/main/java/com/lothrazar/storagenetwork/block/AbstractNetworkScreen.java index a5a642e0..6bad1a40 100644 --- a/src/main/java/com/lothrazar/storagenetwork/block/AbstractNetworkScreen.java +++ b/src/main/java/com/lothrazar/storagenetwork/block/AbstractNetworkScreen.java @@ -95,21 +95,6 @@ public boolean mouseScrolled(double x, double y, double mouseButton) { public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) { super.mouseClicked(mouseX, mouseY, mouseButton); getNetwork().mouseClicked(mouseX, mouseY, mouseButton); - // var size = getNetwork().getSize(); - // if (size.isCrafting()) { - // //TODO: this is part of crafting grid, to clear it out. should be its own button class - // int rectX = 63; - // int rectY = 110; - // - // // TODO: revise above - // if (isHovering(rectX, rectY, 7, 7, mouseX, mouseY)) { - // System.out.println("clear cancelled do nothing,"); - // - // // PacketRegistry.INSTANCE.sendToServer(new ClearRecipeMessage()); - // // PacketRegistry.INSTANCE.sendToServer(new RequestMessage(0, ItemStack.EMPTY, false, false)); - // return true; - // } - // } return true; } diff --git a/src/main/java/com/lothrazar/storagenetwork/block/TileConnectable.java b/src/main/java/com/lothrazar/storagenetwork/block/TileConnectable.java index 8213ed9d..f61020b4 100644 --- a/src/main/java/com/lothrazar/storagenetwork/block/TileConnectable.java +++ b/src/main/java/com/lothrazar/storagenetwork/block/TileConnectable.java @@ -84,7 +84,7 @@ public void onChunkUnloaded() { try { TileMain maybe = UtilTileEntity.getTileMainForConnectable(connectable); if (maybe != null) { - maybe.nw.setShouldRefresh(); + maybe.getNetwork().setShouldRefresh(); } } catch (Exception e) { diff --git a/src/main/java/com/lothrazar/storagenetwork/block/cable/processing/TileCableProcess.java b/src/main/java/com/lothrazar/storagenetwork/block/cable/processing/TileCableProcess.java index 399c6383..b0665d20 100644 --- a/src/main/java/com/lothrazar/storagenetwork/block/cable/processing/TileCableProcess.java +++ b/src/main/java/com/lothrazar/storagenetwork/block/cable/processing/TileCableProcess.java @@ -1,7 +1,8 @@ package com.lothrazar.storagenetwork.block.cable.processing; +import com.lothrazar.storagenetwork.api.IConnectableItemProcessing; import com.lothrazar.storagenetwork.block.TileCableWithFacing; -import com.lothrazar.storagenetwork.capability.CapabilityConnectableLink; +import com.lothrazar.storagenetwork.capability.CapabilityConnectableProcessing; import com.lothrazar.storagenetwork.registry.SsnRegistry; import com.lothrazar.storagenetwork.registry.StorageNetworkCapabilities; import net.minecraft.core.BlockPos; @@ -15,12 +16,12 @@ public class TileCableProcess extends TileCableWithFacing { - protected CapabilityConnectableLink itemStorage; + protected CapabilityConnectableProcessing itemStorage; private ProcessRequestModel processModel = new ProcessRequestModel(); public TileCableProcess(BlockPos pos, BlockState state) { super(SsnRegistry.Tiles.PROCESS_KABEL.get(), pos, state); - this.itemStorage = new CapabilityConnectableLink(this); + this.itemStorage = new CapabilityConnectableProcessing(this); } @Override @@ -45,8 +46,8 @@ public void setDirection(Direction direction) { @Override public LazyOptional getCapability(Capability capability, Direction facing) { - if (capability == StorageNetworkCapabilities.CONNECTABLE_ITEM_STORAGE_CAPABILITY) { - LazyOptional cap = LazyOptional.of(() -> itemStorage); + if (capability == StorageNetworkCapabilities.PROCESSING_CAPABILITY) { + LazyOptional cap = LazyOptional.of(() -> itemStorage); return cap.cast(); } return super.getCapability(capability, facing); diff --git a/src/main/java/com/lothrazar/storagenetwork/block/exchange/ExchangeItemStackHandler.java b/src/main/java/com/lothrazar/storagenetwork/block/exchange/ExchangeItemStackHandler.java index ca12a150..41773b55 100644 --- a/src/main/java/com/lothrazar/storagenetwork/block/exchange/ExchangeItemStackHandler.java +++ b/src/main/java/com/lothrazar/storagenetwork/block/exchange/ExchangeItemStackHandler.java @@ -47,7 +47,7 @@ public void update() { // StorageNetwork.log("exchange update started"); this.stacks.clear(); int i = 0; - for (ItemStack stack : tileMain.nw.getStacks()) { + for (ItemStack stack : tileMain.getNetwork().getStacks()) { if (i >= this.stacks.size()) { break; } diff --git a/src/main/java/com/lothrazar/storagenetwork/block/main/BlockMain.java b/src/main/java/com/lothrazar/storagenetwork/block/main/BlockMain.java index ca7857f0..02372b70 100644 --- a/src/main/java/com/lothrazar/storagenetwork/block/main/BlockMain.java +++ b/src/main/java/com/lothrazar/storagenetwork/block/main/BlockMain.java @@ -35,7 +35,7 @@ public void setPlacedBy(Level worldIn, BlockPos pos, BlockState state, LivingEnt if (!worldIn.isClientSide) { BlockEntity tileAtPos = worldIn.getBlockEntity(pos); if (tileAtPos instanceof TileMain main) { - main.nw.setShouldRefresh(); + main.getNetwork().setShouldRefresh(); } } } @@ -60,16 +60,16 @@ public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, private void displayConnections(Player playerIn, BlockEntity tileHere) { TileMain tileMain = (TileMain) tileHere; - int total = tileMain.nw.getConnectableSize(); + int total = tileMain.getNetwork().getConnectableSize(); if (total == 0) { return; } playerIn.sendSystemMessage( Component.translatable(ChatFormatting.LIGHT_PURPLE + - UtilTileEntity.lang("chat.main.emptyslots") + tileMain.nw.emptySlots())); + UtilTileEntity.lang("chat.main.emptyslots") + tileMain.getNetwork().emptySlots())); playerIn.sendSystemMessage(Component.translatable(ChatFormatting.DARK_AQUA + UtilTileEntity.lang("chat.main.connectables") + total)); - List> listDisplayStrings = tileMain.nw.getDisplayStrings(); + List> listDisplayStrings = tileMain.getNetwork().getDisplayStrings(); for (Entry e : listDisplayStrings) { playerIn.sendSystemMessage(Component.translatable(ChatFormatting.AQUA + " " + e.getValue() + ": " + e.getKey())); } diff --git a/src/main/java/com/lothrazar/storagenetwork/block/main/NetworkModule.java b/src/main/java/com/lothrazar/storagenetwork/block/main/NetworkModule.java index 5a786baf..8f0b1b0a 100644 --- a/src/main/java/com/lothrazar/storagenetwork/block/main/NetworkModule.java +++ b/src/main/java/com/lothrazar/storagenetwork/block/main/NetworkModule.java @@ -310,6 +310,9 @@ public ItemStack request(ItemStackMatcher matcher, int size, boolean simulate) { } public void executeRequestBatch(RequestBatch batch) { + if (batch == null) { + return; + } Batch availableItems = new Batch(); for (IConnectableLink storage : getSortedConnectableStorage()) { storage.addToStackProviderBatch(availableItems); diff --git a/src/main/java/com/lothrazar/storagenetwork/block/main/TileMain.java b/src/main/java/com/lothrazar/storagenetwork/block/main/TileMain.java index b5bb26db..c62fa9b8 100644 --- a/src/main/java/com/lothrazar/storagenetwork/block/main/TileMain.java +++ b/src/main/java/com/lothrazar/storagenetwork/block/main/TileMain.java @@ -1,18 +1,11 @@ package com.lothrazar.storagenetwork.block.main; -import java.util.Set; import com.lothrazar.storagenetwork.StorageNetworkMod; -import com.lothrazar.storagenetwork.api.DimPos; -import com.lothrazar.storagenetwork.api.EnumStorageDirection; -import com.lothrazar.storagenetwork.api.IConnectable; -import com.lothrazar.storagenetwork.api.IConnectableItemAutoIO; -import com.lothrazar.storagenetwork.api.IItemStackMatcher; +import com.lothrazar.storagenetwork.api.*; import com.lothrazar.storagenetwork.capability.handler.ItemStackMatcher; import com.lothrazar.storagenetwork.registry.SsnRegistry; import com.lothrazar.storagenetwork.registry.StorageNetworkCapabilities; -import com.lothrazar.storagenetwork.util.Request; import com.lothrazar.storagenetwork.util.RequestBatch; -import com.lothrazar.storagenetwork.util.UtilInventory; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.Connection; @@ -21,18 +14,20 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.items.IItemHandler; public class TileMain extends BlockEntity { //currently this has one network - public NetworkModule nw = new NetworkModule(); + private NetworkModule nw = new NetworkModule(); public TileMain(BlockPos pos, BlockState state) { super(SsnRegistry.Tiles.MASTER.get(), pos, state); } + public NetworkModule getNetwork() { + return nw; + } + @Override public CompoundTag getUpdateTag() { CompoundTag nbt = new CompoundTag(); @@ -66,11 +61,14 @@ public int insertStack(ItemStack stack, boolean simulate) { */ public ItemStack request(ItemStackMatcher matcher, int size, boolean simulate) { ItemStack result = nw.request(matcher, size, simulate); - //if not found then ? + //if not found then ? check other wireless / remote networks goes here? return result; } public void executeRequestBatch(RequestBatch batch) { + if (batch == null) { + return; + } batch.sort(); nw.executeRequestBatch(batch); } @@ -83,193 +81,76 @@ public void clearCache() { nw.ch.clearCache(); } - /** - * Pull into the network from the relevant linked cables - */ - private void updateImports() { - for (IConnectable connectable : nw.getConnectables()) { - if (connectable == null || connectable.getPos() == null) { - continue; - } - IConnectableItemAutoIO storage = connectable.getPos().getCapability(StorageNetworkCapabilities.CONNECTABLE_AUTO_IO, null); - if (storage == null) { - continue; - } - // - // We explicitely don't want to check whether this can do BOTH, because we don't - // want to import what we've just exported in updateExports(). - if (storage.ioDirection() != EnumStorageDirection.IN) { - continue; - } - // Give the storage a chance to have a cooldown or other conditions that prevent it from running - if (!storage.runNow(connectable.getPos(), this)) { - continue; - } - IItemHandler itemHandler = storage.getItemHandler(); - if (itemHandler == null) { - continue; - } - if (storage.needsRedstone()) { - boolean power = level.hasNeighborSignal(connectable.getPos().getBlockPos()); - if (power == false) { - continue; - } - } - for (int slot = 0; slot < itemHandler.getSlots(); slot++) { - if (itemHandler.getStackInSlot(slot).isEmpty()) { - continue; - } - ItemStack stackCurrent = itemHandler.getStackInSlot(slot).copy(); - // Ignore stacks that are filtered - if (storage.getFilters() == null || !storage.getFilters().isStackFiltered(stackCurrent)) { - if (storage.isStockMode()) { - int filterSize = storage.getFilters().getStackCount(stackCurrent); - BlockEntity tileEntity = level.getBlockEntity(connectable.getPos().getBlockPos().relative(storage.facingInventory())); - IItemHandler targetInventory = tileEntity.getCapability(ForgeCapabilities.ITEM_HANDLER, null).orElse(null); - //request with false to see how many even exist in there. - int chestHowMany = UtilInventory.countHowMany(targetInventory, stackCurrent); - //so if chest=37 items of that kind - //and the filter is say filterSize == 20 - //we SHOULD import 37 - //as we want the STOCK of the chest to not go less than the filter number , just down to it - if (chestHowMany > filterSize) { - int realSize = Math.min(chestHowMany - filterSize, 64); - StorageNetworkMod.log(" : stock mode import realSize = " + realSize); - stackCurrent.setCount(realSize); - } - else { - StorageNetworkMod.log(" : stock mode CANCEL: ITS NOT ENOUGH chestHowMany <= filter size "); - continue; - } - } - int extractSize = Math.min(storage.getTransferRate(), stackCurrent.getCount()); - ItemStack stackToImport = itemHandler.extractItem(slot, extractSize, true); //simulate to grab a reference - if (stackToImport.isEmpty()) { - continue; //continue back to itemHandler - } - // Then try to insert the stack into this masters network and store the number of remaining items in the stack - int countUnmoved = this.insertStack(stackToImport, true); - // Calculate how many items in the stack actually got moved - int countMoved = stackToImport.getCount() - countUnmoved; - if (countMoved <= 0) { - continue; //continue back to itemHandler - } - // Alright, simulation says we're good, let's do it! - // First extract from the storage - ItemStack actuallyExtracted = itemHandler.extractItem(slot, countMoved, false); - // Then insert into our network - this.insertStack(actuallyExtracted, false); - break; // break out of itemHandler loop, done processing this cable, so move to next - } //end of checking on filter for this stack - } - } + public static void clientTick(Level level, BlockPos blockPos, BlockState blockState, TileMain tile) {} + + public static void serverTick(Level level, BlockPos blockPos, BlockState blockState, TileMain tile) { + tile.tick(); } - private void updateProcess() { - // for (IConnectable connectable : getConnectables()) { - // if (connectable == null || connectable.getPos() == null) { - // // StorageNetwork.log("null connectable or pos : updateProcess() "); - // continue; - // } - // TileCableProcess cableProcess = connectable.getPos().getTileEntity(TileCableProcess.class); - // if (cableProcess == null) { - // continue; - // } - // cableProcess.run(); - // } + private boolean isRunnable(IConnectable connectable) { + if (connectable.needsRedstone()) { + boolean hasPower = level.hasNeighborSignal(connectable.getPos().getBlockPos()); + if (!hasPower) { + // if io tells me it needs redstone, and power is nothing, dont execute + //instead go to the next entry in the loop + return false; // needs redsone and does not have power + } + } + return true; } /** - * push OUT of the network to attached export cables. - * + * Huge refactor now all in one loop instead of three + * + * heavy lifting moved to the capabilities inside the cables, so the main node is no longer doing all the work of import cables and export cables + * + * Pull into the network from the relevant linked cables. + * + * After import, run export to push OUT of the network to attached export cables. + * + * Finally run processing at the end */ - private void updateExports() { - Set conSet = nw.getConnectables(); - RequestBatch requestBatch = new RequestBatch(); - for (IConnectable connectable : conSet) { + private void tick() { + if (level == null || level.isClientSide) { + return; + } + refresh(); + RequestBatch requestBatch = null; + for (IConnectable connectable : nw.getConnectables()) { if (connectable == null || connectable.getPos() == null) { - // StorageNetwork.log("null connectable or pos : updateExports() "); - continue; - } - IConnectableItemAutoIO storage = connectable.getPos() - .getCapability(StorageNetworkCapabilities.CONNECTABLE_AUTO_IO, null); - if (storage == null) { continue; } - // We explicitely don't want to check whether this can do BOTH, because we don't - // want to import what we've just exported in updateExports(). - if (storage.ioDirection() != EnumStorageDirection.OUT) { - continue; - } - // Give the storage a chance to have a cooldown - if (!storage.runNow(connectable.getPos(), this)) { - continue; + //does it have processing capability? + //in practice it will not have both, its either IO or processing + IConnectableItemProcessing processingCap = connectable.getPos().getCapability(StorageNetworkCapabilities.PROCESSING_CAPABILITY, null); + if (processingCap != null && isRunnable(connectable)) { + processingCap.execute(this); } - if (storage.needsRedstone()) { - boolean power = level.hasNeighborSignal(connectable.getPos().getBlockPos()); - if (power == false) { - // StorageNetwork.log(power + " Export pow here ; needs yes skip me"); - continue; + //now try running all import and export capabilities, known as IO + IConnectableItemAutoIO ioCap = connectable.getPos().getCapability(StorageNetworkCapabilities.CONNECTABLE_AUTO_IO, null); + if (ioCap != null && isRunnable(connectable)) { + // Give the storage a chance to have a cooldown or other conditions that prevent it from running + if (!ioCap.canRunNow(connectable.getPos(), this)) { + continue; // go to the next entry in the loop } - } - for (IItemStackMatcher matcher : storage.getAutoExportList()) { - if (matcher.getStack().isEmpty()) { - continue; - } - Request request = new Request(storage); - // default amt to request. can be overriden by other upgrades - // check operations upgrade for export - boolean stockMode = storage.isStockMode(); - if (stockMode) { - StorageNetworkMod.log("stockMode == TRUE ; updateExports: attempt " + matcher.getStack()); - // STOCK upgrade means - try { - BlockEntity tileEntity = level - .getBlockEntity(connectable.getPos().getBlockPos().relative(storage.facingInventory())); - IItemHandler targetInventory = tileEntity.getCapability(ForgeCapabilities.ITEM_HANDLER, null) - .orElse(null); - // request with false to see how many even exist in there. - int stillNeeds = UtilInventory.containsAtLeastHowManyNeeded(targetInventory, matcher.getStack(), - matcher.getStack().getCount()); - if (stillNeeds == 0) { - // they dont need any more, they have the stock they need - StorageNetworkMod.log("stockMode continnue; canc"); - continue; - } - request.setCount(Math.min(stillNeeds, request.getCount())); - StorageNetworkMod.log("updateExports stock mode edited value: amtToRequest = " + request.getCount()); - } - catch (Throwable e) { - StorageNetworkMod.LOGGER.error("Error thrown from a connected block" + e); - } + //it has IO, so run imports and then exports + if (ioCap.ioDirection() == EnumStorageDirection.IN) { + ioCap.runImport(this); } - if (matcher.getStack().isEmpty() || request.getCount() == 0) { - // either the thing is empty or we are requesting none - continue; + if (ioCap.ioDirection() == EnumStorageDirection.OUT) { + requestBatch = ioCap.runExport(this); } - requestBatch.put(matcher.getStack().getItem(), request); } } executeRequestBatch(requestBatch); } - public static void clientTick(Level level, BlockPos blockPos, BlockState blockState, TileMain tile) {} - - public static void serverTick(Level level, BlockPos blockPos, BlockState blockState, TileMain tile) { - tile.tick(); - } - - private void tick() { - if (level == null || level.isClientSide) { - return; - } + private void refresh() { + if (level == null) return; //refresh time in config, default 200 ticks aka 10 seconds if ((level.getGameTime() % StorageNetworkMod.CONFIG.refreshTicks() == 0) || nw.shouldRefresh()) { nw.doRefresh(this.getDimPos()); } - updateImports(); - updateExports(); - updateProcess(); } } diff --git a/src/main/java/com/lothrazar/storagenetwork/capability/CapabilityConnectableAutoIO.java b/src/main/java/com/lothrazar/storagenetwork/capability/CapabilityConnectableAutoIO.java index 3e3857a1..388cb528 100644 --- a/src/main/java/com/lothrazar/storagenetwork/capability/CapabilityConnectableAutoIO.java +++ b/src/main/java/com/lothrazar/storagenetwork/capability/CapabilityConnectableAutoIO.java @@ -4,6 +4,7 @@ import java.util.Collections; import java.util.List; import java.util.concurrent.Callable; +import com.lothrazar.storagenetwork.StorageNetworkMod; import com.lothrazar.storagenetwork.api.DimPos; import com.lothrazar.storagenetwork.api.EnumStorageDirection; import com.lothrazar.storagenetwork.api.IConnectable; @@ -16,6 +17,9 @@ import com.lothrazar.storagenetwork.capability.handler.UpgradesItemStackHandler; import com.lothrazar.storagenetwork.registry.SsnRegistry; import com.lothrazar.storagenetwork.registry.StorageNetworkCapabilities; +import com.lothrazar.storagenetwork.util.Request; +import com.lothrazar.storagenetwork.util.RequestBatch; +import com.lothrazar.storagenetwork.util.UtilInventory; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.item.ItemStack; @@ -240,49 +244,48 @@ public IItemHandler getItemHandler() { DimPos inventoryPos = connectable.getPos().offset(inventoryFace); return inventoryPos.getCapability(ForgeCapabilities.ITEM_HANDLER, inventoryFace.getOpposite()); } - - @Deprecated - @Override - public ItemStack extractNextStack(final int amtToRequestIn, boolean simulate) { - //op mode override - int amtToRequest = amtToRequestIn; - boolean operationMode = isOperationMode(); - // If this storage is configured to only export from the network, do not - // extract from the storage, but abort immediately. - if (direction == EnumStorageDirection.OUT) { - return ItemStack.EMPTY; - } - if (inventoryFace == null) { - return ItemStack.EMPTY; - } - DimPos inventoryPos = connectable.getPos().offset(inventoryFace); - // Test whether the connected block has the IItemHandler capability - IItemHandler itemHandler = inventoryPos.getCapability(ForgeCapabilities.ITEM_HANDLER, inventoryFace.getOpposite()); - if (itemHandler == null) { - return ItemStack.EMPTY; - } - for (int slot = 0; slot < itemHandler.getSlots(); slot++) { - ItemStack stack = itemHandler.getStackInSlot(slot); - if (stack == null || stack.isEmpty()) { - continue; - } - // Ignore stacks that are filtered - if (filters.isStackFiltered(stack)) { - continue; - } - if (operationMode && filters.isAllowList) { - IItemStackMatcher matcher = filters.getFirstMatcher(stack); - //if filters are also in allow list mode - //then get the filter matching stack, and get the count of that filter - if (matcher != null && matcher.getStack().getCount() > 0) { - amtToRequest = matcher.getStack().getCount(); // the 63 haha - } - } - int extractSize = Math.min(amtToRequest, stack.getCount()); - return itemHandler.extractItem(slot, extractSize, simulate); - } - return ItemStack.EMPTY; - } + // @Deprecated + // @Override + // public ItemStack extractNextStack(final int amtToRequestIn, boolean simulate) { + // //op mode override + // int amtToRequest = amtToRequestIn; + // boolean operationMode = isOperationMode(); + // // If this storage is configured to only export from the network, do not + // // extract from the storage, but abort immediately. + // if (direction == EnumStorageDirection.OUT) { + // return ItemStack.EMPTY; + // } + // if (inventoryFace == null) { + // return ItemStack.EMPTY; + // } + // DimPos inventoryPos = connectable.getPos().offset(inventoryFace); + // // Test whether the connected block has the IItemHandler capability + // IItemHandler itemHandler = inventoryPos.getCapability(ForgeCapabilities.ITEM_HANDLER, inventoryFace.getOpposite()); + // if (itemHandler == null) { + // return ItemStack.EMPTY; + // } + // for (int slot = 0; slot < itemHandler.getSlots(); slot++) { + // ItemStack stack = itemHandler.getStackInSlot(slot); + // if (stack == null || stack.isEmpty()) { + // continue; + // } + // // Ignore stacks that are filtered + // if (filters.isStackFiltered(stack)) { + // continue; + // } + // if (operationMode && filters.isAllowList) { + // IItemStackMatcher matcher = filters.getFirstMatcher(stack); + // //if filters are also in allow list mode + // //then get the filter matching stack, and get the count of that filter + // if (matcher != null && matcher.getStack().getCount() > 0) { + // amtToRequest = matcher.getStack().getCount(); // the 63 haha + // } + // } + // int extractSize = Math.min(amtToRequest, stack.getCount()); + // return itemHandler.extractItem(slot, extractSize, simulate); + // } + // return ItemStack.EMPTY; + // } @Override public boolean isStockMode() { @@ -310,7 +313,7 @@ private boolean doesPassOperationFilterLimit(TileMain master) { return true; } // TODO: Investigate whether the operation limiter should consider the filter toggles - int countYourItemInNetwork = master.nw.getAmount(new ItemStackMatcher(operationStack, filters.tags, filters.nbt)); + int countYourItemInNetwork = master.getNetwork().getAmount(new ItemStackMatcher(operationStack, filters.tags, filters.nbt)); switch (OpCompareType.get(operationType)) { case EQUAL: return countYourItemInNetwork == operationLimit; @@ -325,7 +328,7 @@ private boolean doesPassOperationFilterLimit(TileMain master) { } @Override - public boolean runNow(DimPos connectablePos, TileMain main) { + public boolean canRunNow(DimPos connectablePos, TileMain main) { int speedUpgrades = upgrades.getUpgradesOfType(SsnRegistry.Items.SPEED_UPGRADE.get()); int slowUpgrades = upgrades.getUpgradesOfType(SsnRegistry.Items.SLOW_UPGRADE.get()); int speedRatio = IO_DEFAULT_SPEED; // no upgrades @@ -366,4 +369,107 @@ public UpgradesItemStackHandler getUpgrades() { } public void extractFromSlot(int slot) {} + + @Override + public RequestBatch runExport(TileMain main) { + if (this.ioDirection() != EnumStorageDirection.OUT) { // TODO: redundant? + return null; + } + RequestBatch requestBatch = new RequestBatch(); + for (IItemStackMatcher matcher : this.getAutoExportList()) { + if (matcher.getStack().isEmpty()) { + continue; + } + Request request = new Request(this); + // default amt to request. can be overriden by other upgrades + // check operations upgrade for export + boolean stockMode = this.isStockMode(); + if (stockMode) { + StorageNetworkMod.log("stockMode == TRUE ; updateExports: attempt " + matcher.getStack()); + // STOCK upgrade means + try { + DimPos inventoryPos = connectable.getPos().offset(inventoryFace); + IItemHandler targetInventory = inventoryPos.getCapability(ForgeCapabilities.ITEM_HANDLER, inventoryFace.getOpposite()); + // request with false to see how many even exist in there. + int stillNeeds = UtilInventory.containsAtLeastHowManyNeeded(targetInventory, matcher.getStack(), + matcher.getStack().getCount()); + if (stillNeeds == 0) { + // they dont need any more, they have the stock they need + StorageNetworkMod.log("stockMode upgrade finishing transaction"); + continue; + } + request.setCount(Math.min(stillNeeds, request.getCount())); + StorageNetworkMod.log("updateExports stock mode edited value: amtToRequest = " + request.getCount()); + } + catch (Throwable e) { + StorageNetworkMod.LOGGER.error("Error thrown from a connected block" + e); + } + } + if (matcher.getStack().isEmpty() || request.getCount() == 0) { + // either the thing is empty or we are requesting none + continue; + } + requestBatch.put(matcher.getStack().getItem(), request); + } + // + return requestBatch; + } + + @Override + public void runImport(TileMain main) { + if (this.ioDirection() != EnumStorageDirection.IN) { // TODO: redundant? + return; + } + IItemHandler itemHandler = this.getItemHandler(); + if (itemHandler == null) { + return; + } + for (int slot = 0; slot < itemHandler.getSlots(); slot++) { + if (itemHandler.getStackInSlot(slot).isEmpty()) { + continue; + } + ItemStack stackCurrent = itemHandler.getStackInSlot(slot).copy(); + // Ignore stacks that are filtered + if (this.getFilters() == null || !this.getFilters().isStackFiltered(stackCurrent)) { + if (this.isStockMode()) { + int filterSize = this.getFilters().getStackCount(stackCurrent); + DimPos inventoryPos = connectable.getPos().offset(inventoryFace); + IItemHandler targetInventory = inventoryPos.getCapability(ForgeCapabilities.ITEM_HANDLER, inventoryFace.getOpposite()); + //request with false to see how many even exist in there. + int chestHowMany = UtilInventory.countHowMany(targetInventory, stackCurrent); + //so if chest=37 items of that kind + //and the filter is say filterSize == 20 + //we SHOULD import 37 + //as we want the STOCK of the chest to not go less than the filter number , just down to it + if (chestHowMany > filterSize) { + int realSize = Math.min(chestHowMany - filterSize, 64); + StorageNetworkMod.log(" : stock mode import realSize = " + realSize); + stackCurrent.setCount(realSize); + } + else { + StorageNetworkMod.log(" : stock mode CANCEL: ITS NOT ENOUGH chestHowMany <= filter size "); + continue; + } + } + int extractSize = Math.min(this.getTransferRate(), stackCurrent.getCount()); + ItemStack stackToImport = itemHandler.extractItem(slot, extractSize, true); //simulate to grab a reference + if (stackToImport.isEmpty()) { + continue; //continue back to itemHandler + } + // Then try to insert the stack into this masters network and store the number of remaining items in the stack + int countUnmoved = main.insertStack(stackToImport, true); + // Calculate how many items in the stack actually got moved + int countMoved = stackToImport.getCount() - countUnmoved; + if (countMoved <= 0) { + continue; //continue back to itemHandler + } + // Alright, simulation says we're good, let's do it! + // First extract from the storage + ItemStack actuallyExtracted = itemHandler.extractItem(slot, countMoved, false); + // Then insert into our network + main.insertStack(actuallyExtracted, false); + break; // break out of itemHandler loop, done processing this cable, so move to next + } //end of checking on filter for this stack + } + } } diff --git a/src/main/java/com/lothrazar/storagenetwork/capability/CapabilityConnectableProcessing.java b/src/main/java/com/lothrazar/storagenetwork/capability/CapabilityConnectableProcessing.java index 1662ca7e..83b3b861 100644 --- a/src/main/java/com/lothrazar/storagenetwork/capability/CapabilityConnectableProcessing.java +++ b/src/main/java/com/lothrazar/storagenetwork/capability/CapabilityConnectableProcessing.java @@ -92,8 +92,7 @@ public Direction facingInventory() { } @Override - public boolean runNow(TileMain main) { - StorageNetworkMod.log("Run Now processing cable "); - return false; + public void execute(TileMain main) { + StorageNetworkMod.log("Run Now processing cable; " + main + "..." + this); } } diff --git a/src/main/java/com/lothrazar/storagenetwork/gui/ContainerNetwork.java b/src/main/java/com/lothrazar/storagenetwork/gui/ContainerNetwork.java index 8ac90c7e..39007af5 100644 --- a/src/main/java/com/lothrazar/storagenetwork/gui/ContainerNetwork.java +++ b/src/main/java/com/lothrazar/storagenetwork/gui/ContainerNetwork.java @@ -174,7 +174,7 @@ else if (tileMain != null) { ItemStack stack = rest == 0 ? ItemStack.EMPTY : ItemHandlerHelper.copyStackWithSize(itemstack1, rest); slot.set(stack); broadcastChanges(); - List list = tileMain.nw.getSortedStacks(); + List list = tileMain.getNetwork().getSortedStacks(); if (playerIn instanceof ServerPlayer) { ServerPlayer sp = (ServerPlayer) playerIn; PacketRegistry.INSTANCE.sendTo(new StackRefreshClientMessage(list, new ArrayList<>()), diff --git a/src/main/java/com/lothrazar/storagenetwork/network/ClearRecipeMessage.java b/src/main/java/com/lothrazar/storagenetwork/network/ClearRecipeMessage.java index 009c01b6..64471e5b 100644 --- a/src/main/java/com/lothrazar/storagenetwork/network/ClearRecipeMessage.java +++ b/src/main/java/com/lothrazar/storagenetwork/network/ClearRecipeMessage.java @@ -67,7 +67,7 @@ static void clearContainerRecipe(ServerPlayer player, boolean doRefresh) { } } if (doRefresh) { - List list = root.nw.getStacks(); + List list = root.getNetwork().getStacks(); PacketRegistry.INSTANCE.sendTo(new StackRefreshClientMessage(list, new ArrayList<>()), player.connection.connection, NetworkDirection.PLAY_TO_CLIENT); container.broadcastChanges(); diff --git a/src/main/java/com/lothrazar/storagenetwork/network/InsertMessage.java b/src/main/java/com/lothrazar/storagenetwork/network/InsertMessage.java index 9134008c..f95a175a 100644 --- a/src/main/java/com/lothrazar/storagenetwork/network/InsertMessage.java +++ b/src/main/java/com/lothrazar/storagenetwork/network/InsertMessage.java @@ -54,7 +54,7 @@ else if (message.mouseButton == UtilTileEntity.MOUSE_BTN_RIGHT) { // PacketRegistry.INSTANCE.sendTo(new StackResponseClientMessage(send), player.connection.connection, NetworkDirection.PLAY_TO_CLIENT); - List list = root.nw.getStacks(); + List list = root.getNetwork().getStacks(); PacketRegistry.INSTANCE.sendTo(new StackRefreshClientMessage(list, new ArrayList<>()), player.connection.connection, NetworkDirection.PLAY_TO_CLIENT); player.containerMenu.broadcastChanges(); diff --git a/src/main/java/com/lothrazar/storagenetwork/network/RecipeMessage.java b/src/main/java/com/lothrazar/storagenetwork/network/RecipeMessage.java index 6a1a8dbc..29274e23 100644 --- a/src/main/java/com/lothrazar/storagenetwork/network/RecipeMessage.java +++ b/src/main/java/com/lothrazar/storagenetwork/network/RecipeMessage.java @@ -117,7 +117,7 @@ public static void handle(RecipeMessage message, Supplier // } //now make sure client sync happens. ctr.slotChanged(); - List list = main.nw.getStacks(); + List list = main.getNetwork().getStacks(); PacketRegistry.INSTANCE.sendTo(new StackRefreshClientMessage(list, new ArrayList<>()), player.connection.connection, NetworkDirection.PLAY_TO_CLIENT); } //end run diff --git a/src/main/java/com/lothrazar/storagenetwork/network/RequestMessage.java b/src/main/java/com/lothrazar/storagenetwork/network/RequestMessage.java index c4c56dfa..43960317 100644 --- a/src/main/java/com/lothrazar/storagenetwork/network/RequestMessage.java +++ b/src/main/java/com/lothrazar/storagenetwork/network/RequestMessage.java @@ -57,7 +57,7 @@ public static void handle(RequestMessage message, Supplier StorageNetworkMod.log("Request message cancelled, null tile"); return; } - int in = root.nw.getAmount(new ItemStackMatcher(message.stack, false, true)); + int in = root.getNetwork().getAmount(new ItemStackMatcher(message.stack, false, true)); ItemStack stack; boolean isLeftClick = message.mouseButton == UtilTileEntity.MOUSE_BTN_LEFT; boolean isRightClick = message.mouseButton == UtilTileEntity.MOUSE_BTN_RIGHT; @@ -96,7 +96,7 @@ else if (isRightClick) { player.connection.connection, NetworkDirection.PLAY_TO_CLIENT); } } - List list = root.nw.getSortedStacks(); + List list = root.getNetwork().getSortedStacks(); PacketRegistry.INSTANCE.sendTo(new StackRefreshClientMessage(list, new ArrayList<>()), player.connection.connection, NetworkDirection.PLAY_TO_CLIENT); player.containerMenu.broadcastChanges(); diff --git a/src/main/java/com/lothrazar/storagenetwork/registry/SsnRegistry.java b/src/main/java/com/lothrazar/storagenetwork/registry/SsnRegistry.java index 3622e26c..2bbed5df 100644 --- a/src/main/java/com/lothrazar/storagenetwork/registry/SsnRegistry.java +++ b/src/main/java/com/lothrazar/storagenetwork/registry/SsnRegistry.java @@ -91,7 +91,7 @@ public static class Items { public static final RegistryObject IFK = ITEMS.register("import_filter_kabel", () -> new BlockItem(Blocks.IMPORT_FILTER_KABEL.get(), new Item.Properties())); public static final RegistryObject FK = ITEMS.register("filter_kabel", () -> new BlockItem(Blocks.FILTER_KABEL.get(), new Item.Properties())); public static final RegistryObject EK = ITEMS.register("export_kabel", () -> new BlockItem(Blocks.EXPORT_KABEL.get(), new Item.Properties())); - public static final RegistryObject PK = ITEMS.register("process_kabel", () -> new BlockItem(Blocks.PROCESS_KABEL.get(), new Item.Properties())); + // public static final RegistryObject PK = ITEMS.register("process_kabel", () -> new BlockItem(Blocks.PROCESS_KABEL.get(), new Item.Properties())); public static final RegistryObject EXCHANGE = ITEMS.register("exchange", () -> new BlockItem(Blocks.EXCHANGE.get(), new Item.Properties())); public static final RegistryObject COL = ITEMS.register("collector", () -> new BlockItem(Blocks.COLLECTOR.get(), new Item.Properties())); public static final RegistryObject STACK_UPGRADE = ITEMS.register("stack_upgrade", () -> new ItemUpgrade(new Item.Properties())); @@ -124,7 +124,6 @@ public static class Tiles { public static final RegistryObject> EXCHANGE = TILES.register("exchange", () -> BlockEntityType.Builder.of(TileExchange::new, Blocks.EXCHANGE.get()).build(null)); public static final RegistryObject> COLLECTOR = TILES.register("collector", () -> BlockEntityType.Builder.of(TileCollection::new, Blocks.COLLECTOR.get()).build(null)); public static final RegistryObject> PROCESS_KABEL = TILES.register("process_kabel", () -> BlockEntityType.Builder.of(TileCableProcess::new, Blocks.PROCESS_KABEL.get()).build(null)); - } @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) diff --git a/src/main/java/com/lothrazar/storagenetwork/util/UtilConnections.java b/src/main/java/com/lothrazar/storagenetwork/util/UtilConnections.java index f78ecbc1..e08b3628 100644 --- a/src/main/java/com/lothrazar/storagenetwork/util/UtilConnections.java +++ b/src/main/java/com/lothrazar/storagenetwork/util/UtilConnections.java @@ -26,12 +26,14 @@ public static boolean isTargetAllowed(BlockState state) { return true; } + // TODO: block tag? public static boolean isCableOverride(BlockState facingState) { return facingState.is(SsnRegistry.Blocks.MASTER.get()) || facingState.is(SsnRegistry.Blocks.EXCHANGE.get()) || facingState.is(SsnRegistry.Blocks.COLLECTOR.get()) || facingState.is(SsnRegistry.Blocks.INVENTORY.get()) || facingState.is(SsnRegistry.Blocks.REQUEST.get()) + || facingState.is(SsnRegistry.Blocks.REQUEST_EXPANDED.get()) || facingState.is(SsnRegistry.Blocks.KABEL.get()); } diff --git a/src/main/resources/assets/storagenetwork/blockstates/process_kabel.json b/src/main/resources/assets/storagenetwork/blockstates/process_kabel.json new file mode 100644 index 00000000..f2a8103d --- /dev/null +++ b/src/main/resources/assets/storagenetwork/blockstates/process_kabel.json @@ -0,0 +1,77 @@ +{ + "__comment": "Copyright © InsomniaKitten 2017", + "multipart": [ + { + "when": { "down": "none" }, + "apply": { "model": "storagenetwork:block/cable_none_process", "x": 90, "uvlock": true } + }, + { + "when": { "down": "blocked" }, + "apply": { "model": "storagenetwork:block/cable_blocked", "x": 90, "uvlock": true } + }, + { + "when": { "OR": [ { "down": "cable" }, { "down": "inventory" } ] }, + "apply": { "model": "storagenetwork:block/cable_side_process", "x": 90, "uvlock": true } + }, + { + "when": { "up": "none" }, + "apply": { "model": "storagenetwork:block/cable_none_process", "x": 270, "uvlock": true } + }, + { + "when": { "up": "blocked" }, + "apply": { "model": "storagenetwork:block/cable_blocked", "x": 270, "uvlock": true } + }, + { + "when": { "OR": [ { "up": "cable" }, { "up": "inventory" } ] }, + "apply": { "model": "storagenetwork:block/cable_side_process", "x": 270, "uvlock": true } + }, + { + "when": { "north": "none" }, + "apply": { "model": "storagenetwork:block/cable_none_process" } + }, + { + "when": { "north": "blocked" }, + "apply": { "model": "storagenetwork:block/cable_blocked" } + }, + { + "when": { "OR": [ { "north": "cable" }, { "north": "inventory" } ] }, + "apply": { "model": "storagenetwork:block/cable_side_process" } + }, + { + "when": { "south": "none" }, + "apply": { "model": "storagenetwork:block/cable_none_process", "y": 180, "uvlock": true } + }, + { + "when": { "south": "blocked" }, + "apply": { "model": "storagenetwork:block/cable_blocked", "y": 180, "uvlock": true } + }, + { + "when": { "OR": [ { "south": "cable" }, { "south": "inventory" } ] }, + "apply": { "model": "storagenetwork:block/cable_side_process", "y": 180, "uvlock": true } + }, + { + "when": { "west": "none" }, + "apply": { "model": "storagenetwork:block/cable_none_process", "y": 270, "uvlock": true } + }, + { + "when": { "west": "blocked" }, + "apply": { "model": "storagenetwork:block/cable_blocked", "y": 270, "uvlock": true } + }, + { + "when": { "OR": [ { "west": "cable" }, { "west": "inventory" } ] }, + "apply": { "model": "storagenetwork:block/cable_side_process", "y": 270, "uvlock": true } + }, + { + "when": { "east": "none" }, + "apply": { "model": "storagenetwork:block/cable_none_process", "y": 90, "uvlock": true } + }, + { + "when": { "east": "blocked" }, + "apply": { "model": "storagenetwork:block/cable_blocked", "y": 90, "uvlock": true } + }, + { + "when": { "OR": [ { "east": "cable" }, { "east": "inventory" } ] }, + "apply": { "model": "storagenetwork:block/cable_side_process", "y": 90, "uvlock": true } + } + ] +} diff --git a/src/main/resources/assets/storagenetwork/models/block/cable_none_process.json b/src/main/resources/assets/storagenetwork/models/block/cable_none_process.json new file mode 100644 index 00000000..15c80c1e --- /dev/null +++ b/src/main/resources/assets/storagenetwork/models/block/cable_none_process.json @@ -0,0 +1,8 @@ +{ + "__comment": "Copyright © InsomniaKitten 2017", + "parent":"storagenetwork:parent/cable_none", + "textures": { + "particle": "storagenetwork:block/cable_process", + "texture": "storagenetwork:block/cable_process" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/storagenetwork/models/block/cable_side_process.json b/src/main/resources/assets/storagenetwork/models/block/cable_side_process.json new file mode 100644 index 00000000..44f2919b --- /dev/null +++ b/src/main/resources/assets/storagenetwork/models/block/cable_side_process.json @@ -0,0 +1,8 @@ +{ + "__comment": "Copyright © InsomniaKitten 2017", + "parent":"storagenetwork:parent/cable_side", + "textures": { + "particle": "storagenetwork:block/cable_process", + "texture": "storagenetwork:block/cable_process" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/storagenetwork/models/item/process_kabel.json b/src/main/resources/assets/storagenetwork/models/item/process_kabel.json new file mode 100644 index 00000000..6cbac529 --- /dev/null +++ b/src/main/resources/assets/storagenetwork/models/item/process_kabel.json @@ -0,0 +1,9 @@ +{ + "parent" : "storagenetwork:block/cable_none_process", + "display" : { + "gui" : { + "rotation" : [30, -45, 0], + "scale" : [0.800, 0.800, 0.800] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/storagenetwork/textures/block/cable_process.png b/src/main/resources/assets/storagenetwork/textures/block/cable_process.png new file mode 100644 index 0000000000000000000000000000000000000000..77bbbdb7fb5ce6e23c521935207d337b61d29b16 GIT binary patch literal 512 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}r0G|-o?Ck8?+S;tFtfHc#va+(AoSd4P8Vy^oovTH)Z9H|Ie6;NSbnU!# zo&141rupSO2U7ecL4LviQ2@i0J2Msnr8o;bB8wRq_;!IXqv(FKOF%)f64!{5;QX|b z^2DN4hJeJ(yb?V>*AN9$J;U$K-zNiAY)OsqO!M^AV&DLBSQ(@kSs56CEH5CIhO$Ba z(_mx2! z0mMv@eXI*0=1c;zL4XNpDic^`kfjBX1=VF}U;vWcx~|er{p69yKxVwBi(`mJaIW8N zu?7W>5M)TBS4K~flkcqE6 z{u>(im2p`(?T=2}IV)rN;@YEnwf#|H@-u34j@5OPvig0gV-`QoxuGpwWC_SxPgg&e IbxsLQ0BH|~1^@s6 literal 0 HcmV?d00001 diff --git a/src/main/resources/data/storagenetwork/loot_tables/blocks/process_kabel.json b/src/main/resources/data/storagenetwork/loot_tables/blocks/process_kabel.json new file mode 100644 index 00000000..63de611f --- /dev/null +++ b/src/main/resources/data/storagenetwork/loot_tables/blocks/process_kabel.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "name": "pool1", + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "storagenetwork:process_kabel" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/storagenetwork/recipes/process_kabel.json b/src/main/resources/data/storagenetwork/recipes/process_kabel.json new file mode 100644 index 00000000..50ec8c3d --- /dev/null +++ b/src/main/resources/data/storagenetwork/recipes/process_kabel.json @@ -0,0 +1,25 @@ +{ + + "type": "minecraft:crafting_shaped", + "group": "storagenetwork", + "pattern": [ + "nkn", + "kpk", + "nkn" + ], + "key": { + "k": { + "item": "storagenetwork:kabel" + }, + "n": { + "tags": "forge:nuggets/gold" + }, + "p": { + "item": "minecraft:observer" + } + }, + "result": { + "item": "storagenetwork:process_kabel", + "count": 4 + } +} \ No newline at end of file diff --git a/update.json b/update.json index c59c2e99..25bcd2ab 100644 --- a/update.json +++ b/update.json @@ -12,6 +12,6 @@ ,"1.11.2":"Ported the Cable Facades feature (from Minecraft 1.12.2), so that you can shift-left-click with a block on a cable to hide it with a facade. Disable this feature or ignore certain blocks with the config file" ,"1.11.3":"Fixed item tooltips not rendering in Storage Remote. Fixed visual rendering and text errors inside of import/export cables using the 'operation upgrade'" - ,"1.12.0":"Added new blocks to support large monitors and large GUI Scale resolutions, the Expanded Request Table and the Expanded Remote" + ,"1.12.0":"Added new blocks to support large monitors and large GUI Scale resolutions, the Expanded Request Table and the Expanded Remote. Import and Export cable changes: main transactions are now executed inside the cable capabilities, meaning the main root node is doing less central work so overall the network has less wasted cycles." } }