From 45b4268871356df527e55055441bf87e099d8d3a Mon Sep 17 00:00:00 2001 From: FN-FAL113 <88238718+FN-FAL113@users.noreply.github.com> Date: Mon, 31 Jan 2022 09:16:17 +0800 Subject: [PATCH 01/18] Industrial miner fix --- .../items/multiblocks/miner/MiningTask.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/MiningTask.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/MiningTask.java index 60a15a4b7..0cbebe109 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/MiningTask.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/MiningTask.java @@ -312,10 +312,17 @@ class MiningTask implements Runnable { ItemStack item = inv.getContents()[i]; if (fuelType.test(item)) { - ItemUtils.consumeItem(item, false); + /* + * Fixes #3336 + * Respects the state of the miner if there are + * no any errors during #setPistonState + */ + if (running) { + ItemUtils.consumeItem(item, false); - if (miner instanceof AdvancedIndustrialMiner) { - inv.addItem(new ItemStack(Material.BUCKET)); + if (miner instanceof AdvancedIndustrialMiner) { + inv.addItem(new ItemStack(Material.BUCKET)); + } } return fuelType.getTicks(); From 6cc4695e8cc8792da4a5a082be161aa2e79c52d8 Mon Sep 17 00:00:00 2001 From: FN-FAL113 <88238718+FN-FAL113@users.noreply.github.com> Date: Mon, 31 Jan 2022 10:11:00 +0800 Subject: [PATCH 02/18] Remove nested condition --- .../items/multiblocks/miner/MiningTask.java | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/MiningTask.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/MiningTask.java index 0cbebe109..8db4e1375 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/MiningTask.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/MiningTask.java @@ -311,18 +311,16 @@ class MiningTask implements Runnable { for (MachineFuel fuelType : miner.fuelTypes) { ItemStack item = inv.getContents()[i]; - if (fuelType.test(item)) { - /* - * Fixes #3336 - * Respects the state of the miner if there are - * no any errors during #setPistonState - */ - if (running) { - ItemUtils.consumeItem(item, false); + /* + * Fixes #3336 + * Respects the state of the miner if there are + * no any errors during #setPistonState + */ + if (fuelType.test(item) && running) { + ItemUtils.consumeItem(item, false); - if (miner instanceof AdvancedIndustrialMiner) { - inv.addItem(new ItemStack(Material.BUCKET)); - } + if (miner instanceof AdvancedIndustrialMiner) { + inv.addItem(new ItemStack(Material.BUCKET)); } return fuelType.getTicks(); From b00286e6072bc050bc2a93cfdf5582dda07aa99f Mon Sep 17 00:00:00 2001 From: FN-FAL113 <88238718+FN-FAL113@users.noreply.github.com> Date: Mon, 31 Jan 2022 18:12:56 +0800 Subject: [PATCH 03/18] Update src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/MiningTask.java Co-authored-by: TheBusyBiscuit --- .../implementation/items/multiblocks/miner/MiningTask.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/MiningTask.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/MiningTask.java index 8db4e1375..da31690ed 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/MiningTask.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/MiningTask.java @@ -314,7 +314,7 @@ class MiningTask implements Runnable { /* * Fixes #3336 * Respects the state of the miner if there are - * no any errors during #setPistonState + * no errors during #setPistonState */ if (fuelType.test(item) && running) { ItemUtils.consumeItem(item, false); From de5524ad9ab8754d71c64481cf29520654d991a9 Mon Sep 17 00:00:00 2001 From: FN-FAL113 Date: Sat, 5 Mar 2022 11:51:45 +0800 Subject: [PATCH 04/18] Fix pedestal bug --- .../listeners/AncientAltarListener.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java index 7c2a865a0..aeae13ef9 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java @@ -156,8 +156,19 @@ public class AncientAltarListener implements Listener { Slimefun.runSync(() -> removedItems.remove(uuid), 30L); entity.remove(); - p.getInventory().addItem(pedestalItem.getOriginalItemStack(entity)); p.playSound(pedestal.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1F, 1F); + + /* + * Fixes #3476 + * Drop the item instead if the player's + * inventory is full + */ + if (p.getInventory().firstEmpty() != -1) { + p.getInventory().addItem(pedestalItem.getOriginalItemStack(entity)); + + } else { + p.getWorld().dropItem(pedestal.getLocation().add(0, 1, 0), pedestalItem.getOriginalItemStack(entity)); + } } } From 9ea414bd04d08049585482f3705465fd7ef9c72f Mon Sep 17 00:00:00 2001 From: FN-FAL113 Date: Mon, 7 Mar 2022 08:39:19 +0800 Subject: [PATCH 05/18] Update AncientAltarListener.java --- .../slimefun4/implementation/listeners/AncientAltarListener.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java index aeae13ef9..44f940a4f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java @@ -165,7 +165,6 @@ public class AncientAltarListener implements Listener { */ if (p.getInventory().firstEmpty() != -1) { p.getInventory().addItem(pedestalItem.getOriginalItemStack(entity)); - } else { p.getWorld().dropItem(pedestal.getLocation().add(0, 1, 0), pedestalItem.getOriginalItemStack(entity)); } From a11ca349fa9bbd30b8d780976af3c5cb2726c58c Mon Sep 17 00:00:00 2001 From: FN-FAL113 Date: Tue, 8 Mar 2022 10:06:58 +0800 Subject: [PATCH 06/18] Use the return value of addItem as basis for dropping left overs --- .../listeners/AncientAltarListener.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java index 44f940a4f..abfdfee54 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java @@ -160,13 +160,13 @@ public class AncientAltarListener implements Listener { /* * Fixes #3476 - * Drop the item instead if the player's - * inventory is full + * Drop the item instead if the player's inventory is full and + * no stack space left else add remaining items from the returned map value */ - if (p.getInventory().firstEmpty() != -1) { - p.getInventory().addItem(pedestalItem.getOriginalItemStack(entity)); - } else { - p.getWorld().dropItem(pedestal.getLocation().add(0, 1, 0), pedestalItem.getOriginalItemStack(entity)); + for (Map.Entry stackEntry : p.getInventory().addItem(pedestalItem.getOriginalItemStack(entity)).entrySet()) { + if (stackEntry != null) { + p.getWorld().dropItem(pedestal.getLocation().add(0, 1, 0), stackEntry.getValue().clone()); + } } } } From 82941dd8e89bbfcd87bcfef6749c2786453a1647 Mon Sep 17 00:00:00 2001 From: FN-FAL113 Date: Tue, 8 Mar 2022 10:10:54 +0800 Subject: [PATCH 07/18] fix a little typo from a comment --- .../implementation/listeners/AncientAltarListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java index abfdfee54..19284fd6d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java @@ -115,7 +115,7 @@ public class AncientAltarListener implements Listener { return; } - // Make altarinuse simply because that was the last block clicked. + // Make altar in use simply because that was the last block clicked. altarsInUse.add(b.getLocation()); e.cancel(); From f657016aa8764daaa5a9dac0421ece4f6128d308 Mon Sep 17 00:00:00 2001 From: FN-FAL113 Date: Tue, 8 Mar 2022 10:12:05 +0800 Subject: [PATCH 08/18] Update fix comment --- .../implementation/listeners/AncientAltarListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java index 19284fd6d..0c42be294 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java @@ -161,7 +161,7 @@ public class AncientAltarListener implements Listener { /* * Fixes #3476 * Drop the item instead if the player's inventory is full and - * no stack space left else add remaining items from the returned map value + * no stack space left else add the item in the inventory */ for (Map.Entry stackEntry : p.getInventory().addItem(pedestalItem.getOriginalItemStack(entity)).entrySet()) { if (stackEntry != null) { From de36da446f1c1204e26ab4388ad6af2efffa202e Mon Sep 17 00:00:00 2001 From: FN-FAL113 Date: Tue, 8 Mar 2022 21:05:52 +0800 Subject: [PATCH 09/18] assign return value to a variable and loop values --- .../implementation/listeners/AncientAltarListener.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java index 0c42be294..8ed9f26f8 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java @@ -161,12 +161,12 @@ public class AncientAltarListener implements Listener { /* * Fixes #3476 * Drop the item instead if the player's inventory is full and - * no stack space left else add the item in the inventory + * no stack space left else add remaining items from the returned map value */ - for (Map.Entry stackEntry : p.getInventory().addItem(pedestalItem.getOriginalItemStack(entity)).entrySet()) { - if (stackEntry != null) { - p.getWorld().dropItem(pedestal.getLocation().add(0, 1, 0), stackEntry.getValue().clone()); - } + Map remainingItemMap = p.getInventory().addItem(pedestalItem.getOriginalItemStack(entity)); + + for (ItemStack item : remainingItemMap.values()) { + p.getWorld().dropItem(pedestal.getLocation().add(0, 1, 0), item.clone()); } } } From 3c0dadef337eb12fe6857a3a782c2925e70de899 Mon Sep 17 00:00:00 2001 From: FN-FAL113 Date: Wed, 9 Mar 2022 08:21:20 +0800 Subject: [PATCH 10/18] Added missing map import --- .../slimefun4/implementation/listeners/AncientAltarListener.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java index 8ed9f26f8..4187d19b6 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Optional; import java.util.Set; import java.util.UUID; +import java.util.Map; import javax.annotation.Nonnull; import javax.annotation.ParametersAreNonnullByDefault; From 280440857bac949c33d48555d1090d96036a3ece Mon Sep 17 00:00:00 2001 From: Jeffrey Kosse Date: Wed, 9 Mar 2022 21:22:08 +0100 Subject: [PATCH 11/18] fixes #3483 --- .../implementation/listeners/MiddleClickListener.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MiddleClickListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MiddleClickListener.java index e30697a76..343c90ab3 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MiddleClickListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MiddleClickListener.java @@ -46,7 +46,8 @@ public class MiddleClickListener implements Listener { // get the block the player is looking at for later Block b = player.getTargetBlockExact(5); - if (!isActualMiddleClick(e, b)) { + // Fixes: #3483 + if (b == null || !isActualMiddleClick(e, b)) { return; } From 52aa81419f2f5206206a0fe25ec8ab05b1af1a68 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Thu, 10 Mar 2022 00:16:41 +0100 Subject: [PATCH 12/18] [CI skip] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc27b7d47..d5e7bd87a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,6 +66,7 @@ * Fixed "LogBlock" integration * Fixed "Lands" integration * Fixed #3133 +* Fixed #3483 ## Release Candidate 30 (31 Dec 2021) https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#30 From 9387f28446f9f3aeabee2f3ff3f107bacf40f7b5 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Thu, 10 Mar 2022 20:40:47 +0100 Subject: [PATCH 13/18] [CI skip] Updated auto-squash workflow --- .github/workflows/auto-squash.yml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto-squash.yml b/.github/workflows/auto-squash.yml index a310b8930..6823ab079 100644 --- a/.github/workflows/auto-squash.yml +++ b/.github/workflows/auto-squash.yml @@ -12,9 +12,9 @@ on: status: {} jobs: - autosquash: + autosquash-crowdin: - name: Auto squash + name: Auto squash (Crowdin) runs-on: ubuntu-latest ## Only run this on the main repo @@ -31,3 +31,23 @@ jobs: MERGE_DELETE_BRANCH: true MERGE_LABELS: '📄 Translations Update' MERGE_COMMIT_MESSAGE: '[CI skip] New locale updates from Crowdin' + + autosquash-renovate: + + name: Auto squash (Renovate) + runs-on: ubuntu-latest + + ## Only run this on the main repo + if: github.event.pull_request.head.repo.full_name == 'Slimefun/Slimefun4' + + steps: + - name: Auto squash + uses: pascalgn/automerge-action@v0.14.3 + env: + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} + UPDATE_RETRIES: 0 + MERGE_METHOD: squash + MERGE_FORKS: false + MERGE_DELETE_BRANCH: true + MERGE_LABELS: '🚨 Dependency Update' + MERGE_COMMIT_MESSAGE: '[CI skip] ${{ github.event.pull_request.title }}' From 32054f328de03138599d949830171b3fd0c42460 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 10 Mar 2022 20:44:05 +0100 Subject: [PATCH 14/18] [CI skip] Update dependency net.imprex:orebfuscator-api to v5.2.6 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7c2842ba3..30e05be73 100644 --- a/pom.xml +++ b/pom.xml @@ -491,7 +491,7 @@ net.imprex orebfuscator-api - 5.2.4 + 5.2.6 provided From f4ded6b09bb0b9f9a817dea4475bc3eaded08dcb Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Thu, 10 Mar 2022 20:45:06 +0100 Subject: [PATCH 15/18] [CI skip] Properly name this workflow --- .github/workflows/auto-squash.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-squash.yml b/.github/workflows/auto-squash.yml index 6823ab079..c52e88947 100644 --- a/.github/workflows/auto-squash.yml +++ b/.github/workflows/auto-squash.yml @@ -1,4 +1,4 @@ -name: Auto squash Crowdin updates +name: Auto squash pull requests on: pull_request_review: From cea7204994359822ce7c50cad63100c55396f872 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Thu, 10 Mar 2022 21:00:28 +0100 Subject: [PATCH 16/18] Fixed #3487 --- CHANGELOG.md | 3 +++ .../slimefun4/api/items/SlimefunItem.java | 12 +++++++---- .../guide/SurvivalSlimefunGuide.java | 21 ++++++++++++++++--- .../listeners/AncientAltarListener.java | 4 ++-- .../listeners/MiddleClickListener.java | 14 ++++++------- 5 files changed, 38 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5e7bd87a..8fd5d8023 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,6 +67,9 @@ * Fixed "Lands" integration * Fixed #3133 * Fixed #3483 +* Fixed #3469 +* Fixed #3476 +* Fixed #3487 ## Release Candidate 30 (31 Dec 2021) https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#30 diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItem.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItem.java index ec07e6143..9de395309 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItem.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItem.java @@ -663,7 +663,8 @@ public class SlimefunItem implements Placeable { /** * Sets the recipe for this {@link SlimefunItem}. * - * @param recipe The recipe for this {@link ItemStack} + * @param recipe + * The recipe for this {@link ItemStack} */ public void setRecipe(@Nonnull ItemStack[] recipe) { if (recipe == null || recipe.length != 9) { @@ -676,7 +677,8 @@ public class SlimefunItem implements Placeable { /** * Sets the {@link RecipeType} for this {@link SlimefunItem}. * - * @param type The {@link RecipeType} for this {@link SlimefunItem} + * @param type + * The {@link RecipeType} for this {@link SlimefunItem} */ public void setRecipeType(@Nonnull RecipeType type) { Validate.notNull(type, "The RecipeType is not allowed to be null!"); @@ -1135,7 +1137,8 @@ public class SlimefunItem implements Placeable { /** * Retrieve a {@link SlimefunItem} by its id. * - * @param id The id of the {@link SlimefunItem} + * @param id + * The id of the {@link SlimefunItem} * @return The {@link SlimefunItem} associated with that id. Null if non-existent */ public static @Nullable SlimefunItem getById(@Nonnull String id) { @@ -1145,7 +1148,8 @@ public class SlimefunItem implements Placeable { /** * Retrieve a {@link SlimefunItem} from an {@link ItemStack}. * - * @param item The {@link ItemStack} to check + * @param item + * The {@link ItemStack} to check * @return The {@link SlimefunItem} associated with this {@link ItemStack} if present, otherwise null */ public static @Nullable SlimefunItem getByItem(@Nullable ItemStack item) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java index 3ff27e619..047a696a6 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java @@ -33,6 +33,7 @@ import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup; import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem; import io.github.thebusybiscuit.slimefun4.api.items.groups.FlexItemGroup; import io.github.thebusybiscuit.slimefun4.api.items.groups.LockedItemGroup; +import io.github.thebusybiscuit.slimefun4.api.items.groups.SubItemGroup; import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile; import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType; import io.github.thebusybiscuit.slimefun4.api.researches.Research; @@ -360,9 +361,7 @@ public class SurvivalSlimefunGuide implements SlimefunGuideImplementation { break; } - boolean isItemGroupHidden = showHiddenItemGroupsInSearch || !slimefunItem.getItemGroup().isHidden(p); - - if (!slimefunItem.isHidden() && isItemGroupHidden && isSearchFilterApplicable(slimefunItem, searchTerm)) { + if (!slimefunItem.isHidden() && !isItemGroupHidden(p, slimefunItem) && isSearchFilterApplicable(slimefunItem, searchTerm)) { ItemStack itemstack = new CustomItemStack(slimefunItem.getItem(), meta -> { ItemGroup itemGroup = slimefunItem.getItemGroup(); meta.setLore(Arrays.asList("", ChatColor.DARK_GRAY + "\u21E8 " + ChatColor.WHITE + itemGroup.getDisplayName(p))); @@ -391,6 +390,22 @@ public class SurvivalSlimefunGuide implements SlimefunGuideImplementation { menu.open(p); } + @ParametersAreNonnullByDefault + private boolean isItemGroupHidden(Player p, SlimefunItem slimefunItem) { + if (showHiddenItemGroupsInSearch) { + return false; + } + + ItemGroup itemGroup = slimefunItem.getItemGroup(); + + // Fixes #3487 - SubItemGroups are "pseudo-hidden" + if (itemGroup instanceof SubItemGroup) { + return false; + } else { + return itemGroup.isHidden(p); + } + } + @ParametersAreNonnullByDefault private boolean isSearchFilterApplicable(SlimefunItem slimefunItem, String searchTerm) { String itemName = ChatColor.stripColor(slimefunItem.getItemName()).toLowerCase(Locale.ROOT); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java index 4187d19b6..30071db6f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java @@ -164,8 +164,8 @@ public class AncientAltarListener implements Listener { * Drop the item instead if the player's inventory is full and * no stack space left else add remaining items from the returned map value */ - Map remainingItemMap = p.getInventory().addItem(pedestalItem.getOriginalItemStack(entity)); - + Map remainingItemMap = p.getInventory().addItem(pedestalItem.getOriginalItemStack(entity)); + for (ItemStack item : remainingItemMap.values()) { p.getWorld().dropItem(pedestal.getLocation().add(0, 1, 0), item.clone()); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MiddleClickListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MiddleClickListener.java index 343c90ab3..b35d48292 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MiddleClickListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MiddleClickListener.java @@ -1,7 +1,5 @@ package io.github.thebusybiscuit.slimefun4.implementation.listeners; -import java.util.Optional; - import javax.annotation.Nonnull; import javax.annotation.ParametersAreNonnullByDefault; @@ -16,10 +14,12 @@ import org.bukkit.event.inventory.InventoryType.SlotType; import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; + import me.mrCookieSlime.Slimefun.api.BlockStorage; /** - * The {@link MiddleClickListener} is responsible for listening to the {@link InventoryCreativeEvent}. + * The {@link MiddleClickListener} is responsible for listening to + * the {@link InventoryCreativeEvent}. * * @author svr333 * @@ -30,7 +30,7 @@ public class MiddleClickListener implements Listener { plugin.getServer().getPluginManager().registerEvents(this, plugin); } - /* + /* * General Discloser: this event has really really really weird behavior on middle click. * Has been tested thoroughly to make sure it doesnt break anything else. */ @@ -58,8 +58,8 @@ public class MiddleClickListener implements Listener { if (sfItem == null) { return; } - - /* + + /* * Before giving the item to the user, check if you can swap * to the item instead (user already has item in hotbar). * This is sometimes bypassed by the client itself (not fixable though). @@ -85,7 +85,7 @@ public class MiddleClickListener implements Listener { * to the actual block that is middle clicked, while currentItem will be AIR. * * This check is really weird due to the weird nature of this event's behaviour. - * It checks if the block the player is looking at is of the same type as the cursor; + * It checks if the block the player is looking at is of the same type as the cursor, * after this we can make sure that it is a middle click outside of the inventory * currentItem should also be air, otherwise it is not outside of the inventory */ From c5f4d55b27b04b8cb031b16c8becc7cc3512bfc6 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 11 Mar 2022 12:14:04 +0100 Subject: [PATCH 17/18] [CI skip] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fd5d8023..40a83931b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,6 +70,7 @@ * Fixed #3469 * Fixed #3476 * Fixed #3487 +* Fixed #3336 (again) ## Release Candidate 30 (31 Dec 2021) https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#30 From 54cb571e1be85ae86efdbc6954e57fd9b87e6170 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 11 Mar 2022 20:05:24 +0100 Subject: [PATCH 18/18] [CI skip] Update dependency org.apache.maven.plugins:maven-compiler-plugin to v3.10.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 30e05be73..cd158c0d3 100644 --- a/pom.xml +++ b/pom.xml @@ -115,7 +115,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.10.0 + 3.10.1