diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 0db20485..695e0024 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -16,6 +16,9 @@ jobs: distribution: zulu cache: gradle - name: Build with Gradle + env: + USERNAME: ${{ secrets.USERNAME }} + READ_PACKAGES_TOKEN: ${{ secrets.READ_PACKAGES_TOKEN }} uses: nick-invision/retry@v2 with: timeout_minutes: 10 diff --git a/build.gradle b/build.gradle index 4c97bbec..c80fe7ee 100644 --- a/build.gradle +++ b/build.gradle @@ -40,6 +40,14 @@ repositories { } } maven { url "https://maven.blamejared.com/" } + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/p3pp3rf1y/sophisticatedcore") + credentials { + username = System.getenv("USERNAME") + password = System.getenv("READ_PACKAGES_TOKEN") + } + } } group = 'sophisticatedbackpacks' @@ -109,9 +117,15 @@ dependencies { if (findProject(':SophisticatedCore') != null) { implementation project(':SophisticatedCore') } else { - compileOnly fg.deobf("curse.maven:sophisticatedcore-618298:${sc_cf_file_id}") - runtimeOnly fg.deobf("curse.maven:sophisticatedcore-618298:${sc_cf_file_id}") - testImplementation fg.deobf("curse.maven:sophisticatedcore-618298:${sc_cf_file_id}") + compileOnly fg.deobf("sophisticatedcore:sophisticatedcore:${sc_version}") { + transitive = false + } + runtimeOnly fg.deobf("sophisticatedcore:sophisticatedcore:${sc_version}") { + transitive = false + } + testImplementation fg.deobf("sophisticatedcore:sophisticatedcore:${sc_version}") { + transitive = false + } } compileOnly fg.deobf("mezz.jei:jei-${jei_mc_version}:${jei_version}:api") diff --git a/gradle.properties b/gradle.properties index b2b24c96..9eba2ea7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,13 +1,13 @@ org.gradle.daemon=false minecraft_version=1.18.2 forge_version=40.1.30 -mod_version=3.18.60 +mod_version=3.18.65 jei_mc_version=1.18.2 jei_version=9.7.0+ curios_version=1.18.2-5.0.6.+ botania_version=1.18.2-430-SNAPSHOT patchouli_version=1.18.2-66 balm_cf_file_id=3914491 -sc_cf_file_id=4566111 +sc_version=1.18.2-0.5.97.+ crafting_tweaks_cf_file_id=3584842 parchment_version=1.18.1-2022.03.06-1.18.2 \ No newline at end of file diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackBlockEntity.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackBlockEntity.java index 3a0eb52c..bc30e89f 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackBlockEntity.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackBlockEntity.java @@ -25,6 +25,7 @@ import net.p3pp3rf1y.sophisticatedcore.api.IStorageWrapper; import net.p3pp3rf1y.sophisticatedcore.controller.ControllerBlockEntityBase; import net.p3pp3rf1y.sophisticatedcore.controller.IControllableStorage; +import net.p3pp3rf1y.sophisticatedcore.inventory.CachedFailedInsertInventoryHandler; import net.p3pp3rf1y.sophisticatedcore.renderdata.RenderInfo; import net.p3pp3rf1y.sophisticatedcore.renderdata.TankPosition; import net.p3pp3rf1y.sophisticatedcore.upgrades.ITickableUpgrade; @@ -146,7 +147,7 @@ public LazyOptional getCapability(Capability cap, @Nullable Direction if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { if (itemHandlerCap == null) { - itemHandlerCap = LazyOptional.of(() -> getBackpackWrapper().getInventoryForInputOutput()); + itemHandlerCap = LazyOptional.of(() -> new CachedFailedInsertInventoryHandler(getBackpackWrapper().getInventoryForInputOutput(), () -> level != null ? level.getGameTime() : 0)); } return itemHandlerCap.cast(); } else if (cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) { diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackItem.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackItem.java index a6e09c62..b1aba53e 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackItem.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackItem.java @@ -68,6 +68,7 @@ import net.p3pp3rf1y.sophisticatedcore.api.IStashStorageItem; import net.p3pp3rf1y.sophisticatedcore.api.IStorageWrapper; import net.p3pp3rf1y.sophisticatedcore.client.gui.utils.TranslationHelper; +import net.p3pp3rf1y.sophisticatedcore.settings.memory.MemorySettingsCategory; import net.p3pp3rf1y.sophisticatedcore.upgrades.ITickableUpgrade; import net.p3pp3rf1y.sophisticatedcore.upgrades.jukebox.ServerStorageSoundHandler; import net.p3pp3rf1y.sophisticatedcore.util.ColorHelper; @@ -118,7 +119,7 @@ public BlockEntityWithoutLevelRenderer getItemStackRenderer() { public void fillItemCategory(CreativeModeTab group, NonNullList items) { super.fillItemCategory(group, items); - if (!allowdedIn(group) || this != ModItems.BACKPACK.get() || !net.p3pp3rf1y.sophisticatedcore.Config.SERVER.enabledItems.isItemEnabled(this)) { + if (!allowdedIn(group) || this != ModItems.BACKPACK.get() || !net.p3pp3rf1y.sophisticatedcore.Config.COMMON.enabledItems.isItemEnabled(this)) { return; } @@ -397,8 +398,17 @@ public ItemStack stash(ItemStack storageStack, ItemStack stack) { } @Override - public boolean isItemStashable(ItemStack storageStack, ItemStack stack) { - return storageStack.getCapability(CapabilityBackpackWrapper.getCapabilityInstance()).map(wrapper -> wrapper.getInventoryForUpgradeProcessing().insertItem(stack, true).getCount() != stack.getCount()).orElse(false); + public StashResult getItemStashable(ItemStack storageStack, ItemStack stack) { + return storageStack.getCapability(CapabilityBackpackWrapper.getCapabilityInstance()).map(wrapper -> { + if (wrapper.getInventoryForUpgradeProcessing().insertItem(stack, true).getCount() == stack.getCount()) { + return StashResult.NO_SPACE; + } + if (wrapper.getInventoryHandler().getSlotTracker().getItems().contains(stack.getItem()) || wrapper.getSettingsHandler().getTypeCategory(MemorySettingsCategory.class).matchesFilter(stack)) { + return StashResult.MATCH_AND_SPACE; + } + + return StashResult.SPACE; + }).orElse(StashResult.NO_SPACE); } public record BackpackContentsTooltip(ItemStack backpack) implements TooltipComponent { diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/refill/RefillUpgradeTab.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/refill/RefillUpgradeTab.java index 7983bd91..42be27db 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/refill/RefillUpgradeTab.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/refill/RefillUpgradeTab.java @@ -130,7 +130,7 @@ private void updateTargetSlotTooltip(int mouseX, int mouseY) { private void renderTargetSlotAcronyms(PoseStack poseStack) { poseStack.pushPose(); - poseStack.translate(0, 0, 100); + poseStack.translate(0, 0, 300); getContainer().getSlots().forEach(slot -> { if (!slot.getItem().isEmpty()) { int slotIndex = slot.getSlotIndex(); diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 308e63a7..85319fab 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -60,7 +60,7 @@ side="BOTH" [[dependencies.sophisticatedbackpacks]] modId="sophisticatedcore" #mandatory mandatory=true #mandatory -versionRange="[1.18.2-0.5.61,)" #mandatory +versionRange="[1.18.2-0.5.97,)" #mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory ordering="NONE" # Side this dependency is applied on - BOTH, CLIENT or SERVER