Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx6G
org.gradle.daemon=false


#use this if the gradle build has ' Could not find tools.jar. Please check that _____ contains a valid JDK installation '
#org.gradle.java.home=C:\\Program Files\\Eclipse Adoptium\\jdk-8.0.322.6-hotspot

# as needed run/server.properties : online-mode=false
# implementation fg.deobf("curse.maven:simple-storage-network-268495:3163007")


mod_id=storagenetwork
curse_id=268495
mod_version=1.12.1

mod_version=1.12.2
mc_version=1.20.1

# NEO
Expand All @@ -26,12 +16,9 @@ mod_group_id=com.lothrazar.storagenetwork
mapping_channel=official
mapping_version=1.20.1


flib_version=0.0.14
flib_file=5495793
patchouli_version=84
jei_version=15.3.0.4
emi_version=1.0.21
curios_version=5.7.2


Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class ScreenCableExportFilter extends AbstractContainerScreen<ContainerCa
private ButtonRequest btnMinus;
private ButtonRequest btnPlus;
private ButtonRequest btnImport;
private ButtonRequest btnAllowIgn;
private boolean isAllowlist;
private List<ItemSlotNetwork> itemSlotsGhost;
private ButtonRequest btnOperationToggle;
Expand Down Expand Up @@ -73,6 +74,10 @@ public void init() {
this.syncData(+1);
}, DEFAULT_NARRATION));
btnPlus.setTextureId(TextureEnum.PLUS);
btnAllowIgn = addRenderableWidget(new ButtonRequest(leftPos + 152, topPos + 24, "", (p) -> {
this.isAllowlist = !this.isAllowlist;
this.syncData(0);
}, DEFAULT_NARRATION));
btnImport = addRenderableWidget(new ButtonRequest(leftPos + 80, topPos + 4, "", (p) -> {
importFilterSlots();
}, DEFAULT_NARRATION));
Expand Down Expand Up @@ -115,6 +120,7 @@ public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) {
btnRedstone.setTextureId(containerCableLink.cap.needsRedstone() ? TextureEnum.REDSTONETRUE : TextureEnum.REDSTONEFALSE);
btnOperationToggle.visible = this.isOperationMode();
txtHeight.visible = btnOperationToggle.active = btnOperationToggle.visible;
btnAllowIgn.setTextureId(this.isAllowlist ? TextureEnum.ALLOWLIST : TextureEnum.IGNORELIST);
}

@Override
Expand Down Expand Up @@ -142,6 +148,11 @@ private void drawTooltips(GuiGraphics ms, final int mouseX, final int mouseY) {
ms.renderTooltip(font, Lists.newArrayList(Component.translatable("gui.storagenetwork.import")), Optional.empty(),
mouseX - leftPos, mouseY - topPos);
}
if (btnAllowIgn != null && btnAllowIgn.isMouseOver(mouseX, mouseY)) {
ms.renderTooltip(font,
Lists.newArrayList(Component.translatable(this.isAllowlist ? "gui.storagenetwork.allowlist" : "gui.storagenetwork.ignorelist")),
Optional.empty(), mouseX - leftPos, mouseY - topPos);
}
if (btnMinus != null && btnMinus.isMouseOver(mouseX, mouseY)) {
ms.renderTooltip(font, Lists.newArrayList(Component.translatable("gui.storagenetwork.priority.down")), Optional.empty(),
mouseX - leftPos, mouseY - topPos);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class TileCableExport extends TileCableWithFacing implements MenuProvider
public TileCableExport(BlockPos pos, BlockState state) {
super(SsnRegistry.Tiles.EXPORT_KABEL.get(), pos, state);
this.ioStorage = new CapabilityConnectableAutoIO(this, EnumStorageDirection.OUT);
this.ioStorage.getFilter().isAllowList = true;
this.ioStorage.getFilter().isAllowList = true; // default only; let NBT override
}

@Override
Expand All @@ -50,7 +50,6 @@ public void load(CompoundTag compound) {
super.load(compound);
this.ioStorage.deserializeNBT(compound.getCompound("ioStorage"));
ioStorage.upgrades.deserializeNBT(compound.getCompound("upgrades"));
this.ioStorage.getFilter().isAllowList = true;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ public ItemStack insertStack(ItemStack stack, boolean simulate) {
if (direction == EnumStorageDirection.IN) {
return stack;
}
if (stack != null && !stack.isEmpty() && filters != null && filters.isStackFiltered(stack)) {
return stack;
}
if (inventoryFace == null) {
return stack;
}
Expand Down Expand Up @@ -375,6 +378,39 @@ public RequestBatch runExport(TileMain main) {
if (this.ioDirection() != EnumStorageDirection.OUT) { // TODO: redundant?
return null;
}

// blacklist
if (!filters.isAllowList) {
RequestBatch batch = new RequestBatch();

for (ItemStack s : main.getNetwork().getStacks(true)) {
if (s == null || s.isEmpty()) continue;
if (filters.isStackFiltered(s)) continue;

Request req = new Request(this);

if (isStockMode()) {
try {
if (inventoryFace == null) continue;
DimPos invPos = connectable.getPos().offset(inventoryFace);
IItemHandler target = invPos.getCapability(ForgeCapabilities.ITEM_HANDLER, inventoryFace.getOpposite());
int stillNeeds = UtilInventory.containsAtLeastHowManyNeeded(target, s, s.getCount());
if (stillNeeds == 0) continue;
req.setCount(Math.min(stillNeeds, req.getCount()));
} catch (Throwable e) {
StorageNetworkMod.LOGGER.error("Error from connected block", e);
continue;
}
}

if (req.getCount() > 0) {
batch.put(s.getItem(), req);
}
}
return batch;
}

// whitelist
RequestBatch requestBatch = new RequestBatch();
for (IItemStackMatcher matcher : this.getAutoExportList()) {
if (matcher.getStack().isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public void setCraftMatrix(NetworkCraftingInventory matrixIn) {

public abstract boolean isCrafting();

public ItemStack getRemote() { // semi-abstract
return ItemStack.EMPTY;
}

public Slot getResultSlot() {
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
public class ItemRemote extends ItemFlib implements MenuProvider {

public static final String NBT_JEI = TileRequest.NBT_JEI;
public static final String NBT_BOUND = "bound";
public static final String NBT_SORT = "sort";
public static final String NBT_DOWN = "down";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.function.Supplier;
import com.lothrazar.storagenetwork.api.EnumSortType;
import com.lothrazar.storagenetwork.api.ITileNetworkSync;
import com.lothrazar.storagenetwork.gui.ContainerNetwork;
import com.lothrazar.storagenetwork.item.remote.ContainerNetworkCraftingRemote;
import com.lothrazar.storagenetwork.item.remote.ContainerNetworkRemote;
import com.lothrazar.storagenetwork.item.remote.ItemRemote;
Expand Down Expand Up @@ -35,29 +36,20 @@ public SettingsSyncMessage(BlockPos pos, boolean direction, EnumSortType sort, b
public static void handle(SettingsSyncMessage message, Supplier<NetworkEvent.Context> ctx) {
ctx.get().enqueueWork(() -> {
ServerPlayer player = ctx.get().getSender();
//TODO: how to refactor this
/// is it a block?
if (message.targetTileEntity) {
BlockEntity tileEntity = player.level().getBlockEntity(message.pos);
if (tileEntity instanceof ITileNetworkSync) {
ITileNetworkSync tile = (ITileNetworkSync) tileEntity;
if (tileEntity instanceof ITileNetworkSync tile) {
tile.setSort(message.sort);
tile.setDownwards(message.direction);
tile.setJeiSearchSynced(message.jeiSync);
tile.setAutoFocus(message.autoFocus);
tileEntity.setChanged();
}
}
else if (player.containerMenu instanceof ContainerNetworkCraftingRemote remoteContainer) {
} // else is it an item?
else if (player.containerMenu instanceof ContainerNetwork remoteContainer) {
ItemStack stackPlayerHeld = remoteContainer.getRemote();
if (stackPlayerHeld.getItem() instanceof ItemRemote) {
ItemRemote.setSort(stackPlayerHeld, message.sort);
ItemRemote.setDownwards(stackPlayerHeld, message.direction);
ItemRemote.setJeiSearchSynced(stackPlayerHeld, message.jeiSync);
ItemRemote.setAutoFocus(stackPlayerHeld, message.autoFocus);
}
}
else if (player.containerMenu instanceof ContainerNetworkRemote rcc) {
ItemStack stackPlayerHeld = rcc.getRemote();
//if it passes the instanceof check, we also know it is not-Empty
if (stackPlayerHeld.getItem() instanceof ItemRemote) {
ItemRemote.setSort(stackPlayerHeld, message.sort);
ItemRemote.setDownwards(stackPlayerHeld, message.direction);
Expand Down
3 changes: 2 additions & 1 deletion update.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"homepage": "https://www.curseforge.com/minecraft/mc-mods/simple-storage-network",
"promos": {
"1.20.1-latest": "1.12.1"
"1.20.1-latest": "1.12.2"
},
"1.20.1": {
"1.10.0":"Ported to 1.20.1, depends on flib-0.0.7+ . Fixed patchouli book. Port to new non-deprecated curios datapack tags. Includes pull requests merged into the 1.18 and 1.19 branches : Merge pull request #492 from IIpragmaII/trunk/1.18 @IIpragmaII @VasurTrekkson Improved performance for export node. fix priority german translation @lightlike . Fixed recipes not showing when pressing the JEI recipe key @Demerso. Create uk_ua.json @SKZGx "
Expand All @@ -14,5 +14,6 @@
,"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 a new Expanded Request Table and the Expanded Remote to support GUI Scale 2 or larger for players on large monitors/resolutions. Internal refactoring for Import and Export cable capabilities: item transactions are now executed inside the cable tile-entities instead of the main node tile-entity (meaning the main root node is doing less processing work, and also the network overall should have fewer wasted cycles). "
,"1.12.1": "Fix JEI/EMI recipe autocomplete"
,"1.12.2": "Fix new Expanded Remote buttons saving their settings"
}
}