From 811da94737707facfeb69bdb838c1a2c71796ae5 Mon Sep 17 00:00:00 2001 From: iTrooz Date: Sat, 6 Apr 2024 20:08:43 +0200 Subject: [PATCH 1/3] fix aeadditions StorageCell counting for both items and fluids --- .../addons/appliedenergistics/AppEngApi.java | 62 +++++++++++++------ 1 file changed, 42 insertions(+), 20 deletions(-) diff --git a/src/main/java/de/srendi/advancedperipherals/common/addons/appliedenergistics/AppEngApi.java b/src/main/java/de/srendi/advancedperipherals/common/addons/appliedenergistics/AppEngApi.java index 1408aa851..10173f316 100644 --- a/src/main/java/de/srendi/advancedperipherals/common/addons/appliedenergistics/AppEngApi.java +++ b/src/main/java/de/srendi/advancedperipherals/common/addons/appliedenergistics/AppEngApi.java @@ -10,9 +10,10 @@ import appeng.api.storage.AEKeyFilter; import appeng.api.storage.IStorageProvider; import appeng.api.storage.MEStorage; +import appeng.api.storage.cells.IBasicCellItem; import appeng.blockentity.storage.DriveBlockEntity; -import appeng.items.storage.BasicStorageCell; import appeng.parts.storagebus.StorageBusPart; +import com.the9grounds.aeadditions.item.storage.StorageCell; import com.the9grounds.aeadditions.item.storage.SuperStorageCell; import dan200.computercraft.shared.util.NBTUtil; import de.srendi.advancedperipherals.AdvancedPeripherals; @@ -310,11 +311,11 @@ public static boolean isFluidCrafting(MEStorage monitor, ICraftingService grid, public static long getTotalItemStorage(IGridNode node) { long total = 0; - Iterator iterator = node.getGrid().getMachineNodes(DriveBlockEntity.class).iterator(); + // note: do not query DriveBlockEntity.class specifically here, because it will avoid subclasses, e.g. the ME Extended Drive from ExtendedAE + Iterator iterator = node.getGrid().getNodes().iterator(); while (iterator.hasNext()) { - DriveBlockEntity entity = (DriveBlockEntity) iterator.next().getService(IStorageProvider.class); - if (entity == null) + if (!(iterator.next().getService(IStorageProvider.class) instanceof DriveBlockEntity entity)) continue; InternalInventory inventory = entity.getInternalInventory(); @@ -325,7 +326,7 @@ public static long getTotalItemStorage(IGridNode node) { if (stack.isEmpty()) continue; - if (stack.getItem() instanceof BasicStorageCell cell) { + if (stack.getItem() instanceof IBasicCellItem cell) { if (cell.getKeyType().getClass().isAssignableFrom(AEKeyType.items().getClass())) { total += cell.getBytes(null); } @@ -335,6 +336,10 @@ public static long getTotalItemStorage(IGridNode node) { } } else if (APAddons.aeAdditionsLoaded && (stack.getItem() instanceof SuperStorageCell superStorageCell)) { total += superStorageCell.getKiloBytes() * 1024; + } else if (APAddons.aeAdditionsLoaded && (stack.getItem() instanceof StorageCell storageCell)) { + if (storageCell.getKeyType() != AEKeyType.items()) + continue; + total += storageCell.getKiloBytes() * 1024; } } } @@ -362,11 +367,10 @@ public static long getTotalItemStorage(IGridNode node) { public static long getTotalFluidStorage(IGridNode node) { long total = 0; - Iterator iterator = node.getGrid().getMachineNodes(DriveBlockEntity.class).iterator(); + Iterator iterator = node.getGrid().getNodes().iterator(); while (iterator.hasNext()) { - DriveBlockEntity entity = (DriveBlockEntity) iterator.next().getService(IStorageProvider.class); - if (entity == null) + if (!(iterator.next().getService(IStorageProvider.class) instanceof DriveBlockEntity entity)) continue; InternalInventory inventory = entity.getInternalInventory(); @@ -377,12 +381,16 @@ public static long getTotalFluidStorage(IGridNode node) { if (stack.isEmpty()) continue; - if (stack.getItem() instanceof BasicStorageCell cell) { + if (stack.getItem() instanceof IBasicCellItem cell) { if (cell.getKeyType().getClass().isAssignableFrom(AEKeyType.fluids().getClass())) { total += cell.getBytes(null); } } else if (APAddons.aeAdditionsLoaded && stack.getItem() instanceof SuperStorageCell superStorageCell) { total += superStorageCell.getKiloBytes() * 1024; + } else if (APAddons.aeAdditionsLoaded && (stack.getItem() instanceof StorageCell storageCell)) { + if (storageCell.getKeyType() != AEKeyType.fluids()) + continue; + total += storageCell.getKiloBytes() * 1024; } } } @@ -410,11 +418,10 @@ public static long getTotalFluidStorage(IGridNode node) { public static long getUsedItemStorage(IGridNode node) { long used = 0; - Iterator iterator = node.getGrid().getMachineNodes(DriveBlockEntity.class).iterator(); + Iterator iterator = node.getGrid().getNodes().iterator(); while (iterator.hasNext()) { - DriveBlockEntity entity = (DriveBlockEntity) iterator.next().getService(IStorageProvider.class); - if (entity == null) + if (!(iterator.next().getService(IStorageProvider.class) instanceof DriveBlockEntity entity)) continue; InternalInventory inventory = entity.getInternalInventory(); @@ -425,7 +432,7 @@ public static long getUsedItemStorage(IGridNode node) { if (stack.isEmpty()) continue; - if (stack.getItem() instanceof BasicStorageCell cell) { + if (stack.getItem() instanceof IBasicCellItem cell) { int bytesPerType = cell.getBytesPerType(null); if (cell.getKeyType().getClass().isAssignableFrom(AEKeyType.items().getClass())) { @@ -448,6 +455,14 @@ public static long getUsedItemStorage(IGridNode node) { continue; long numItemsInCell = stack.getTag().getLong("ic"); + used += numItemsInCell; + } else if (APAddons.aeAdditionsLoaded && stack.getItem() instanceof StorageCell storageCell) { + if (storageCell.getKeyType() != AEKeyType.items()) + continue; + if (stack.getTag() == null) + continue; + long numItemsInCell = stack.getTag().getLong("ic"); + used += numItemsInCell; } } @@ -472,11 +487,10 @@ public static long getUsedItemStorage(IGridNode node) { public static long getUsedFluidStorage(IGridNode node) { long used = 0; - Iterator iterator = node.getGrid().getMachineNodes(DriveBlockEntity.class).iterator(); + Iterator iterator = node.getGrid().getNodes().iterator(); while (iterator.hasNext()) { - DriveBlockEntity entity = (DriveBlockEntity) iterator.next().getService(IStorageProvider.class); - if (entity == null) + if (!(iterator.next().getService(IStorageProvider.class) instanceof DriveBlockEntity entity)) continue; InternalInventory inventory = entity.getInternalInventory(); @@ -484,7 +498,7 @@ public static long getUsedFluidStorage(IGridNode node) { for (int i = 0; i < inventory.size(); i++) { ItemStack stack = inventory.getStackInSlot(i); - if (stack.getItem() instanceof BasicStorageCell cell) { + if (stack.getItem() instanceof IBasicCellItem cell) { int bytesPerType = cell.getBytesPerType(null); if (cell.getKeyType().getClass().isAssignableFrom(AEKeyType.fluids().getClass())) { @@ -495,7 +509,15 @@ public static long getUsedFluidStorage(IGridNode node) { used += ((int) Math.ceil(((double) numBucketsInCell) / 8)) + ((long) bytesPerType * numOfType); } - } else if (APAddons.aeAdditionsLoaded && stack.getItem() instanceof SuperStorageCell superStorageCell) { + } else if (APAddons.aeAdditionsLoaded && stack.getItem() instanceof SuperStorageCell) { + if (stack.getTag() == null) + continue; + long numItemsInCell = stack.getTag().getLong("ic"); + + used += numItemsInCell; + } else if (APAddons.aeAdditionsLoaded && stack.getItem() instanceof StorageCell storageCell) { + if (storageCell.getKeyType() != AEKeyType.fluids()) + continue; if (stack.getTag() == null) continue; long numItemsInCell = stack.getTag().getLong("ic"); @@ -548,7 +570,7 @@ public static List listCells(IGridNode node) { if (stack.isEmpty()) continue; - if (stack.getItem() instanceof BasicStorageCell cell) { + if (stack.getItem() instanceof IBasicCellItem cell) { items.add(getObjectFromCell(cell, stack)); } else if (APAddons.aeThingsLoaded && stack.getItem() instanceof DISKDrive disk) { items.add(getObjectFromDisk(disk, stack)); @@ -561,7 +583,7 @@ public static List listCells(IGridNode node) { return items; } - private static Map getObjectFromCell(BasicStorageCell cell, ItemStack stack) { + private static Map getObjectFromCell(IBasicCellItem cell, ItemStack stack) { Map map = new HashMap<>(); map.put("item", ItemUtil.getRegistryKey(stack.getItem()).toString()); From 2e253bcf6303cfe8fe581434b749e64342b42715 Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Fri, 5 Apr 2024 11:41:12 +0200 Subject: [PATCH 2/3] Specify content filters for each maven repo and switch to a settings.gradle --- build.gradle | 71 ++++++++++++------------ gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle | 20 +++++++ 3 files changed, 58 insertions(+), 35 deletions(-) create mode 100644 settings.gradle diff --git a/build.gradle b/build.gradle index 36b646e88..cea635d97 100644 --- a/build.gradle +++ b/build.gradle @@ -2,39 +2,24 @@ import net.darkhax.curseforgegradle.TaskPublishCurseForge import java.text.SimpleDateFormat -buildscript { - repositories { - maven { - name = "Intelligence Minecraft" - url = "https://mvn.intelligence-modding.de/Minecraft" - } - mavenCentral() - gradlePluginPortal() - } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '6.0+', changing: true - classpath 'org.parchmentmc:librarian:1.+' - } -} - plugins { id "maven-publish" id 'net.darkhax.curseforgegradle' version '1.1.16' id 'org.jetbrains.changelog' version '1.2.1' id "com.modrinth.minotaur" version "2.+" id "org.jetbrains.kotlin.jvm" version "1.6.10" + id 'net.minecraftforge.gradle' version '[6.0.18,6.2)' + id 'org.parchmentmc.librarian.forgegradle' version '1.+' + id 'org.spongepowered.mixin' version '0.7.+' id "com.github.breadmoirai.github-release" version "2.5.2" id 'checkstyle' id 'java' } -apply plugin: 'net.minecraftforge.gradle' -apply plugin: 'org.parchmentmc.librarian.forgegradle' - java.toolchain.languageVersion = JavaLanguageVersion.of(17) wrapper { - gradleVersion = '8.1.1' + gradleVersion = '8.4' distributionType = Wrapper.DistributionType.ALL } @@ -182,45 +167,59 @@ repositories { maven { name = "Blamejared maven botania patchouli" url = 'https://maven.blamejared.com' + content { + includeGroup("vazkii.botania") + includeGroup("vazkii.patchouli") + } } maven { name = "Squiddev maven cct" url = 'https://squiddev.cc/maven/' content { includeGroup("org.squiddev") + includeGroup("cc.tweaked") includeModule("org.squiddev", "Cobalt") } } maven { name = "Theillusivec4 maven curios" url = "https://maven.theillusivec4.top/" + content { + includeGroup("top.theillusivec4.curios") + } } maven { name = "LDT Team minecolonies" url = 'https://ldtteam.jfrog.io/ldtteam/modding' + content { + includeGroup("com.ldtteam") + } } maven { name = "Modmaven Jei" url = 'https://modmaven.dev/' - } - maven { - name = "Create maven" - url = "https://maven.tterrag.com/" content { - includeGroup "com.simibubi.create" - includeGroup "com.jozufozu.flywheel" + includeGroup("mezz.jei") + includeGroup("appeng") + includeGroup("mekanism") } } maven { - name = "SirEdvin's private repository" - url = "https://repo.repsy.io/mvn/siredvin/default" + name = "Create maven" + url = "https://maven.tterrag.com/" content { - includeGroup "site.siredvin.ttoolkit" + includeGroup("com.simibubi.create") + includeGroup("com.jozufozu.flywheel") + includeGroup("com.tterrag.registrate") } } maven { name = "Shedaniel cloth" url = "https://maven.shedaniel.me/" + content { + includeGroup("dev.architectury") + includeGroup("me.shedaniel.cloth") + } } maven { url = uri("https://maven.pkg.github.com/refinedmods/refinedstorage") @@ -228,10 +227,16 @@ repositories { username = "anything" password = "\u0067hp_oGjcDFCn8jeTzIj4Ke9pLoEVtpnZMP4VQgaX" } + content { + includeModule("com.refinedmods", "refinedstorage") + } } maven { name = 'Kotlin for Forge' url = 'https://thedarkcolour.github.io/KotlinForForge/' + content { + includeModule("thedarkcolour", "kotlinforforge") + } } maven { url = "https://cursemaven.com" @@ -239,10 +244,6 @@ repositories { includeGroup "curse.maven" } } - maven { - name = "Intelligence repository" - url = "https://mvn.intelligence-modding.de/Intelligence" - } } configurations { @@ -488,6 +489,8 @@ tasks.register('publishCurseForge', TaskPublishCurseForge, { task -> addRequirement('cc-tweaked') + addModLoader("forge", "neoforge") + releaseType = "${release_type}" } }) @@ -521,7 +524,7 @@ modrinth { versionType = release_type uploadFile = jar gameVersions = [minecraft_version] - loaders = ["forge"] + loaders = ["forge", "neoforge"] dependencies { required.project "cc-tweaked" } @@ -595,4 +598,4 @@ publishing { } } } -} \ No newline at end of file +} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8707e8b50..309b4e18d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 000000000..6b39aa618 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,20 @@ +pluginManagement { + repositories { + gradlePluginPortal() + maven { + name = 'MinecraftForge' + url = 'https://maven.minecraftforge.net/' + content { + includeGroup("net.minecraftforge") + includeGroup("net.minecraftforge.gradle") + includeGroup("org.spongepowered.mixin") + includeGroup("org.spongepowered") + } + } + maven { url = 'https://maven.parchmentmc.org' } + } +} + +plugins { + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' +} \ No newline at end of file From 33c4681c983e1d0288fac8e54364bf4636314e84 Mon Sep 17 00:00:00 2001 From: srendi Date: Thu, 11 Apr 2024 11:29:39 +0200 Subject: [PATCH 3/3] Prepare changelog for next 1.19.2 release --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index febbe555a..eba055f7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] + +### Fixed +- [#559] Fixed the creation of empty nbt tags when inserting items into the ME System - @Thanks to michele-grifa! +- [#577,#570] Fixed that the RS bridge does not show `isCraftable` in `getItem` or `getPattern` - Thanks to @tomprince! +- [#570] Improved performance of ME Bridge's iterating functions by making the functions not quadratic - Thanks to @tomprince! +- [#560] Fixed stacking problems when using `getItems` from the inventory manager +- [#551] Fixed that RS Bridge's `isItemCrafting` is false when the item is not in the system +- [#536] Invalidate the energy detectors in and output energy providers to prevent the energy detector from stopping to transfer energy +- [#575] Added support for more disk cells and portable cells for the ME Bridge - Thanks to @iTrooz + +### Added +- [#571] Added `selectionMode` to the output of ME Bridge's `getCraftingCPUs` function - Thanks to @tomprince! +- [#564] Added optional parameter to `getPlayerPos` to specify the amount of decimal places to retrieve the position of - Thanks to @minecraf7771 + ## [1.19.2-0.7.34r] - 2024-02-13 ### Fixed