diff --git a/.github/ISSUE_TEMPLATE/bug-report.yaml b/.github/ISSUE_TEMPLATE/bug-report.yaml index e1e0d1d518..fcc3435e70 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yaml +++ b/.github/ISSUE_TEMPLATE/bug-report.yaml @@ -20,6 +20,8 @@ body: options: - label: I am using the official english version of Slimefun and did not modify the jar. required: true + - label: I downloaded the official version from the new build site [Blob Builds](https://blob.build/). + required: true - label: I am using an up to date "DEV" (not "RC") version of Slimefun. required: true - label: I am aware that issues related to Slimefun addons need to be reported on their bug trackers and not here. diff --git a/.github/workflows/discord-webhook.yml b/.github/workflows/discord-webhook.yml index b424d1c383..18059867f0 100644 --- a/.github/workflows/discord-webhook.yml +++ b/.github/workflows/discord-webhook.yml @@ -23,11 +23,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v4.1.1 - - name: Set up Java JDK 17 + - name: Set up Java JDK 21 uses: actions/setup-java@v4.0.0 with: distribution: 'adopt' - java-version: '17' + java-version: '21' java-package: jdk architecture: x64 diff --git a/.github/workflows/e2e-testing.yml b/.github/workflows/e2e-testing.yml index 351249cbcb..1c77c2c25d 100644 --- a/.github/workflows/e2e-testing.yml +++ b/.github/workflows/e2e-testing.yml @@ -25,8 +25,12 @@ jobs: javaVersion: '18' - mcVersion: '1.19.4' javaVersion: '19' - - mcVersion: 'latest' + - mcVersion: '1.20.4' javaVersion: '20' + - mcVersion: '1.20.6' + javaVersion: '21' + #- mcVersion: 'latest' + # javaVersion: '21' steps: - name: Checkout repository diff --git a/.github/workflows/javadocs.yml b/.github/workflows/javadocs.yml new file mode 100644 index 0000000000..7755d9668c --- /dev/null +++ b/.github/workflows/javadocs.yml @@ -0,0 +1,37 @@ +name: Javadocs + +on: + push: + paths: + - 'src/**' + - 'pom.xml' + +permissions: + contents: read + +jobs: + build: + name: Maven build + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4.0.0 + with: + distribution: 'adopt' + java-version: '21' + java-package: jdk + architecture: x64 + + - name: Cache Maven packages + uses: actions/cache@v4 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + + - name: Build Javadocs + run: mvn javadoc:javadoc diff --git a/.github/workflows/maven-compiler.yml b/.github/workflows/maven-compiler.yml index 41f5aff546..e61904358f 100644 --- a/.github/workflows/maven-compiler.yml +++ b/.github/workflows/maven-compiler.yml @@ -27,11 +27,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v4.0.0 with: distribution: 'adopt' - java-version: '17' + java-version: '21' java-package: jdk architecture: x64 diff --git a/.github/workflows/publish-build.yml b/.github/workflows/publish-build.yml index 78665c901e..bec223fc56 100644 --- a/.github/workflows/publish-build.yml +++ b/.github/workflows/publish-build.yml @@ -15,11 +15,11 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v3.13.0 with: distribution: 'adopt' - java-version: '17' + java-version: '21' java-package: jdk architecture: x64 diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 904ebb8121..a02a240233 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -21,11 +21,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v4.0.0 with: distribution: 'adopt' - java-version: '17' + java-version: '21' java-package: jdk architecture: x64 diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 4d395db640..923db63442 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -23,11 +23,11 @@ jobs: with: fetch-depth: 0 - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v4.0.0 with: distribution: 'adopt' - java-version: '17' + java-version: '21' java-package: jdk architecture: x64 diff --git a/.gitignore b/.gitignore index e6f9d7a43c..a6d46cc670 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ /.idea/ /.vscode/ /data-storage/ +/javadocs/ dependency-reduced-pom.xml diff --git a/jitpack.yml b/jitpack.yml index 3dcd4f7383..d9a09de62d 100644 --- a/jitpack.yml +++ b/jitpack.yml @@ -1,6 +1,7 @@ before_install: - - sdk install java 17.0.1-open - - sdk use java 17.0.1-open + - sdk install java 21.0.2-open + - sdk use java 21.0.2-open + - sdk install maven jdk: - - openjdk17 + - openjdk21 diff --git a/pom.xml b/pom.xml index 2d82162def..5bc0d0d651 100644 --- a/pom.xml +++ b/pom.xml @@ -24,9 +24,12 @@ 16 16 + + 21 + 21 - 1.20.4 + 1.20.6 https://hub.spigotmc.org/javadocs/spigot/ @@ -115,7 +118,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.12.1 + 3.13.0 @@ -130,7 +133,7 @@ org.apache.maven.plugins maven-source-plugin - 3.3.0 + 3.3.1 @@ -146,7 +149,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.2.5 + 3.3.1 org.junit.jupiter:junit-jupiter @@ -235,11 +238,11 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.6.3 + 3.7.0 ${project.basedir} - docs + javadocs Slimefun4 - Javadocs Slimefun4 - Javadocs @@ -329,9 +332,19 @@ - - + + + + org.junit + junit-bom + 5.10.3 + pom + import + + + + com.google.code.findbugs @@ -344,7 +357,7 @@ com.github.baked-libs.dough dough-api - e99d02a8ff + f8ff25187d compile @@ -358,7 +371,6 @@ org.junit.jupiter junit-jupiter - 5.10.2 test @@ -375,9 +387,9 @@ - com.github.seeseemelk - MockBukkit-v1.20 - 3.65.0 + com.github.MockBukkit + MockBukkit + c7cc678834 test @@ -387,19 +399,13 @@ org.jetbrains annotations - - io.papermc.paper - paper-api - - - - + io.papermc.paper paper-api - 1.20.4-R0.1-20240205.114523-90 + 1.20.6-R0.1-SNAPSHOT test diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/MinecraftVersion.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/MinecraftVersion.java index 511df32ec3..4fc0160ac6 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/MinecraftVersion.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/MinecraftVersion.java @@ -10,10 +10,10 @@ /** * This enum holds all versions of Minecraft that we currently support. - * + * * @author TheBusyBiscuit * @author Walshy - * + * * @see Slimefun * */ @@ -47,7 +47,13 @@ public enum MinecraftVersion { * This constant represents Minecraft (Java Edition) Version 1.20 * ("The Trails & Tales Update") */ - MINECRAFT_1_20(20, "1.20.x"), + MINECRAFT_1_20(20, 0, 4, "1.20.x"), + + /** + * This constant represents Minecraft (Java Edition) Version 1.20.5 + * ("The Armored Paws Update") + */ + MINECRAFT_1_20_5(20, 5, "1.20.5+"), /** * This constant represents an exceptional state in which we were unable @@ -64,12 +70,14 @@ public enum MinecraftVersion { private final String name; private final boolean virtual; private final int majorVersion; + private final int minorVersion; + private final int maxMinorVersion; /** * This constructs a new {@link MinecraftVersion} with the given name. * This constructor forces the {@link MinecraftVersion} to be real. * It must be a real version of Minecraft. - * + * * @param majorVersion * The major version of minecraft as an {@link Integer} * @param name @@ -78,6 +86,50 @@ public enum MinecraftVersion { MinecraftVersion(int majorVersion, @Nonnull String name) { this.name = name; this.majorVersion = majorVersion; + this.minorVersion = -1; + this.maxMinorVersion = -1; + this.virtual = false; + } + + /** + * This constructs a new {@link MinecraftVersion} with the given name. + * This constructor forces the {@link MinecraftVersion} to be real. + * It must be a real version of Minecraft. + * + * @param majorVersion + * The major (minor in semver, major in MC land) version of minecraft as an {@link Integer} + * @param minor + * The minor (patch in semver, minor in MC land) version of minecraft as an {@link Integer} + * @param name + * The display name of this {@link MinecraftVersion} + */ + MinecraftVersion(int majorVersion, int minor, @Nonnull String name) { + this.name = name; + this.majorVersion = majorVersion; + this.minorVersion = minor; + this.maxMinorVersion = -1; + this.virtual = false; + } + + /** + * This constructs a new {@link MinecraftVersion} with the given name. + * This constructor forces the {@link MinecraftVersion} to be real. + * It must be a real version of Minecraft. + * + * @param majorVersion + * The major (minor in semver, major in MC land) version of minecraft as an {@link Integer} + * @param minor + * The minor (patch in semver, minor in MC land) version of minecraft as an {@link Integer} + * @param maxMinorVersion + * The maximum minor (patch) version of minecraft this version represents + * @param name + * The display name of this {@link MinecraftVersion} + */ + MinecraftVersion(int majorVersion, int minor, int maxMinorVersion, @Nonnull String name) { + this.name = name; + this.majorVersion = majorVersion; + this.minorVersion = minor; + this.maxMinorVersion = maxMinorVersion; this.virtual = false; } @@ -85,7 +137,7 @@ public enum MinecraftVersion { * This constructs a new {@link MinecraftVersion} with the given name. * A virtual {@link MinecraftVersion} (unknown or unit test) is not an actual * version of Minecraft but rather a state of the {@link Server} software. - * + * * @param name * The display name of this {@link MinecraftVersion} * @param virtual @@ -94,12 +146,14 @@ public enum MinecraftVersion { MinecraftVersion(@Nonnull String name, boolean virtual) { this.name = name; this.majorVersion = 0; + this.minorVersion = -1; + this.maxMinorVersion = -1; this.virtual = virtual; } /** * This returns the name of this {@link MinecraftVersion} in a readable format. - * + * * @return The name of this {@link MinecraftVersion} */ public @Nonnull String getName() { @@ -112,7 +166,7 @@ public enum MinecraftVersion { * a state of the {@link Server} software used. * Virtual {@link MinecraftVersion MinecraftVersions} include "UNKNOWN" and * "UNIT TEST". - * + * * @return Whether this {@link MinecraftVersion} is virtual or not */ public boolean isVirtual() { @@ -127,25 +181,49 @@ public boolean isVirtual() { * It is equivalent to the "major" version *

* Example: {@literal "1.13"} returns {@literal 13} - * + * * @param minecraftVersion * The {@link Integer} version to match - * + * * @return Whether this {@link MinecraftVersion} matches the specified version id */ public boolean isMinecraftVersion(int minecraftVersion) { - return !isVirtual() && this.majorVersion == minecraftVersion; + return this.isMinecraftVersion(minecraftVersion, -1); + } + + /** + * This tests if the given minecraft version matches with this + * {@link MinecraftVersion}. + *

+ * You can obtain the version number by doing {@link PaperLib#getMinecraftVersion()}. + * It is equivalent to the "major" version
+ * You can obtain the patch version by doing {@link PaperLib#getMinecraftPatchVersion()}. + * It is equivalent to the "minor" version + *

+ * Example: {@literal "1.13"} returns {@literal 13}
+ * Example: {@literal "1.13.2"} returns {@literal 13_2} + * + * @param minecraftVersion + * The {@link Integer} version to match + * + * @return Whether this {@link MinecraftVersion} matches the specified version id + */ + public boolean isMinecraftVersion(int minecraftVersion, int patchVersion) { + return !isVirtual() + && this.majorVersion == minecraftVersion + && (this.minorVersion == -1 || this.minorVersion <= patchVersion) + && (this.maxMinorVersion == -1 || patchVersion <= this.maxMinorVersion); } /** * This method checks whether this {@link MinecraftVersion} is newer or equal to * the given {@link MinecraftVersion}, - * + * * An unknown version will default to {@literal false}. - * + * * @param version * The {@link MinecraftVersion} to compare - * + * * @return Whether this {@link MinecraftVersion} is newer or equal to the given {@link MinecraftVersion} */ public boolean isAtLeast(@Nonnull MinecraftVersion version) { @@ -162,7 +240,7 @@ public boolean isAtLeast(@Nonnull MinecraftVersion version) { * this will essentially always return true and result in a tautology. * This is most definitely an oversight from us and should be fixed, therefore * we will trigger an exception. - * + * * In order to not disrupt server operations, this exception is only thrown during * unit tests since the oversight itself will be harmless. */ @@ -175,12 +253,12 @@ public boolean isAtLeast(@Nonnull MinecraftVersion version) { /** * This checks whether this {@link MinecraftVersion} is older than the specified {@link MinecraftVersion}. - * + * * An unknown version will default to {@literal true}. - * + * * @param version * The {@link MinecraftVersion} to compare - * + * * @return Whether this {@link MinecraftVersion} is older than the given one */ public boolean isBefore(@Nonnull MinecraftVersion version) { @@ -193,4 +271,24 @@ public boolean isBefore(@Nonnull MinecraftVersion version) { return version.ordinal() > this.ordinal(); } + /** + * Checks whether this {@link MinecraftVersion} is older than the specified minecraft and patch versions + * @param minecraftVersion The minecraft version + * @param patchVersion The patch version + * @return True if this version is before, False if this version is virtual or otherwise. + */ + public boolean isBefore(int minecraftVersion, int patchVersion) { + // unit tests or whatever + if (isVirtual()) { + return false; + } + + // major version mismatch + if (this.majorVersion != minecraftVersion) { + return this.majorVersion < minecraftVersion; + } + + return this.minorVersion == -1 ? patchVersion > 0 : this.minorVersion < patchVersion; + } + } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/RadiationDamageEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/RadiationDamageEvent.java new file mode 100644 index 0000000000..b3ef284e75 --- /dev/null +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/RadiationDamageEvent.java @@ -0,0 +1,69 @@ +package io.github.thebusybiscuit.slimefun4.api.events; + +import javax.annotation.Nonnull; + +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +/** + * The {@link RadiationDamageEvent} is called when a player takes radiation damage. + * + * @author HoosierTransfer + */ +public class RadiationDamageEvent extends Event implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + + private final Player player; + private final int exposure; + private boolean cancelled; + + /** + * This constructs a new {@link RadiationDamageEvent}. + * + * @param player The {@link Player} who took radiation damage + * @param exposure The amount of radiation exposure + */ + public RadiationDamageEvent(@Nonnull Player player, int exposure) { + this.player = player; + this.exposure = exposure; + } + + /** + * This returns the {@link Player} who took radiation damage. + * + * @return The {@link Player} who took radiation damage + */ + public @Nonnull Player getPlayer() { + return player; + } + + /** + * This returns the amount of radiation exposure. + * + * @return The amount of radiation exposure + */ + public int getExposure() { + return exposure; + } + + @Override + public boolean isCancelled() { + return cancelled; + } + + @Override + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } + + public static @Nonnull HandlerList getHandlerList() { + return handlers; + } + + @Override + public @Nonnull HandlerList getHandlers() { + return getHandlerList(); + } +} diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/TalismanActivateEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/TalismanActivateEvent.java index 775691a0a6..b8515bed47 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/TalismanActivateEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/TalismanActivateEvent.java @@ -93,4 +93,4 @@ public void setCancelled(boolean cancel) { public static @Nonnull HandlerList getHandlerList() { return handlers; } -} \ No newline at end of file +} diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/TeleportationManager.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/TeleportationManager.java index 19646ed4c0..6f65962024 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/TeleportationManager.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/TeleportationManager.java @@ -16,7 +16,6 @@ import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; import io.github.bakedlibs.dough.common.ChatColors; import io.github.bakedlibs.dough.items.CustomItemStack; @@ -27,6 +26,7 @@ import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils; import io.github.thebusybiscuit.slimefun4.utils.HeadTexture; import io.github.thebusybiscuit.slimefun4.utils.NumberUtils; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedPotionEffectType; import io.papermc.lib.PaperLib; import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu; @@ -220,7 +220,7 @@ private void onTeleport(Player p, Location destination, boolean success, boolean if (success) { // Apply Resistance Effect, if enabled if (resistance) { - p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 600, 20)); + p.addPotionEffect(new PotionEffect(VersionedPotionEffectType.RESISTANCE, 600, 20)); Slimefun.getLocalization().sendMessage(p, "machines.TELEPORTER.invulnerability"); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemGroup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemGroup.java index 0f70a46e6e..81b8f331f6 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemGroup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemGroup.java @@ -25,6 +25,7 @@ import io.github.thebusybiscuit.slimefun4.api.items.groups.SeasonalItemGroup; import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedItemFlag; /** * Represents an item group, which structure @@ -85,7 +86,7 @@ public ItemGroup(NamespacedKey key, ItemStack item, int tier) { ItemMeta meta = item.getItemMeta(); meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); meta.addItemFlags(ItemFlag.HIDE_ENCHANTS); - meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS); + meta.addItemFlags(VersionedItemFlag.HIDE_ADDITIONAL_TOOLTIP); this.item.setItemMeta(meta); this.tier = tier; } 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 d48b41236c..65592d4358 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 @@ -162,6 +162,21 @@ public SlimefunItem(ItemGroup itemGroup, SlimefunItemStack item, RecipeType reci this.recipeOutput = recipeOutput; } + /** + * This creates a new {@link SlimefunItem} from the given arguments. + * + * @param itemGroup + * The {@link ItemGroup} this {@link SlimefunItem} belongs + * to + * @param item + * The {@link SlimefunItemStack} that describes the visual + * features of our {@link SlimefunItem} + */ + @ParametersAreNonnullByDefault + public SlimefunItem(ItemGroup itemGroup, SlimefunItemStack item) { + this(itemGroup, item, RecipeType.NULL, new ItemStack[] {}); + } + // Previously deprecated constructor, now only for internal purposes @ParametersAreNonnullByDefault protected SlimefunItem(ItemGroup itemGroup, ItemStack item, String id, RecipeType recipeType, ItemStack[] recipe) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItemStack.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItemStack.java index 5604cdcfa8..611e85df6d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItemStack.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItemStack.java @@ -15,7 +15,6 @@ import org.bukkit.ChatColor; import org.bukkit.Color; import org.bukkit.Material; -import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.LeatherArmorMeta; @@ -32,6 +31,7 @@ import io.github.thebusybiscuit.slimefun4.api.exceptions.WrongItemStackException; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.utils.HeadTexture; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedItemFlag; /** * The {@link SlimefunItemStack} functions as the base for any @@ -159,7 +159,7 @@ public SlimefunItemStack(@Nonnull String id, @Nonnull Color color, @Nonnull Poti potionMeta.addCustomEffect(effect, true); if (effect.getType().equals(PotionEffectType.SATURATION)) { - im.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS); + im.addItemFlags(VersionedItemFlag.HIDE_ADDITIONAL_TOOLTIP); } } }); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/NetworkVisualizer.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/NetworkVisualizer.java index 14ab69c85f..256442972a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/NetworkVisualizer.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/NetworkVisualizer.java @@ -5,9 +5,10 @@ import org.apache.commons.lang.Validate; import org.bukkit.Color; import org.bukkit.Location; -import org.bukkit.Particle; import org.bukkit.Particle.DustOptions; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedParticle; + /** * This class represents the visualizer task of a given {@link Network}. * @@ -58,7 +59,7 @@ public void run() { * The {@link Location} of our node */ private void spawnParticles(@Nonnull Location l) { - l.getWorld().spawnParticle(Particle.REDSTONE, l.getX() + 0.5, l.getY() + 0.5, l.getZ() + 0.5, 1, 0, 0, 0, 1, particleOptions); + l.getWorld().spawnParticle(VersionedParticle.DUST, l.getX() + 0.5, l.getY() + 0.5, l.getZ() + 0.5, 1, 0, 0, 0, 1, particleOptions); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/DamageableItem.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/DamageableItem.java index 05694f3e64..74f4a5ef88 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/DamageableItem.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/DamageableItem.java @@ -13,6 +13,7 @@ import io.github.bakedlibs.dough.config.Config; import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem; import io.github.thebusybiscuit.slimefun4.utils.UnbreakingAlgorithm; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedEnchantment; /** * This interface, when attached to a {@link SlimefunItem}, provides an easy method for damaging @@ -51,7 +52,7 @@ public interface DamageableItem extends ItemAttribute { */ default void damageItem(@Nonnull Player p, @Nullable ItemStack item) { if (isDamageable() && item != null && !item.getType().isAir() && item.getAmount() > 0) { - int unbreakingLevel = item.getEnchantmentLevel(Enchantment.DURABILITY); + int unbreakingLevel = item.getEnchantmentLevel(VersionedEnchantment.UNBREAKING); if (evaluateUnbreakingEnchantment(unbreakingLevel)) { return; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/RadiationSymptom.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/RadiationSymptom.java index 2c703de40b..154b48efc4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/RadiationSymptom.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/RadiationSymptom.java @@ -10,6 +10,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.utils.RadiationUtils; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedPotionEffectType; /** * An enum of potential radiation symptoms. @@ -25,11 +26,11 @@ */ public enum RadiationSymptom { - SLOW(10, PotionEffectType.SLOW, 3), + SLOW(10, VersionedPotionEffectType.SLOWNESS, 3), WITHER_LOW(25, PotionEffectType.WITHER, 0), BLINDNESS(50, PotionEffectType.BLINDNESS, 4), WITHER_HIGH(75, PotionEffectType.WITHER, 3), - IMMINENT_DEATH(100, PotionEffectType.HARM, 49); + IMMINENT_DEATH(100, VersionedPotionEffectType.INSTANT_DAMAGE, 49); private final int minExposure; private final PotionEffect potionEffect; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java index 24abb7364c..34ff1f4a20 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java @@ -83,7 +83,7 @@ public void onExecute(@Nonnull CommandSender sender, @Nonnull String[] args) { .append(")").color(ChatColor.GRAY); } - builder.append("\n"); + builder.append("\n").event((HoverEvent) null); // @formatter:on if (Slimefun.getMetricsService().getVersion() != null) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/FireworksOption.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/FireworksOption.java index 07b757018a..64f48a0656 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/FireworksOption.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/FireworksOption.java @@ -1,5 +1,6 @@ package io.github.thebusybiscuit.slimefun4.core.guide.options; +import java.util.List; import java.util.Optional; import org.bukkit.Material; @@ -31,7 +32,13 @@ public Optional getDisplayItem(Player p, ItemStack guide) { if (registry.isResearchingEnabled() && registry.isResearchFireworkEnabled()) { boolean enabled = getSelectedOption(p, guide).orElse(true); - ItemStack item = new CustomItemStack(Material.FIREWORK_ROCKET, "&bFireworks: &" + (enabled ? "aYes" : "4No"), "", "&7You can now toggle whether you", "&7will be presented with a big firework", "&7upon researching an item.", "", "&7\u21E8 &eClick to " + (enabled ? "disable" : "enable") + " your fireworks"); + + String optionState = enabled ? "enabled" : "disabled"; + List lore = Slimefun.getLocalization().getMessages(p, "guide.options.fireworks." + optionState + ".text"); + lore.add(""); + lore.add("&7\u21E8 " + Slimefun.getLocalization().getMessage(p, "guide.options.fireworks." + optionState + ".click")); + + ItemStack item = new CustomItemStack(Material.FIREWORK_ROCKET, lore); return Optional.of(item); } else { return Optional.empty(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/GuideModeOption.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/GuideModeOption.java index f86694211d..92ede97bc9 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/GuideModeOption.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/GuideModeOption.java @@ -56,14 +56,15 @@ public Optional getDisplayItem(Player p, ItemStack guide) { } ItemMeta meta = item.getItemMeta(); - meta.setDisplayName(ChatColor.GRAY + "Slimefun Guide Type: " + ChatColor.YELLOW + ChatUtils.humanize(selectedMode.name())); + meta.setDisplayName(ChatColor.GRAY + Slimefun.getLocalization().getMessage(p, "guide.modes.selected") + + ChatColor.YELLOW + Slimefun.getLocalization().getMessage(p, "guide.modes." + selectedMode.name())); List lore = new ArrayList<>(); lore.add(""); - lore.add((selectedMode == SlimefunGuideMode.SURVIVAL_MODE ? ChatColor.GREEN : ChatColor.GRAY) + "Survival Mode"); - lore.add((selectedMode == SlimefunGuideMode.CHEAT_MODE ? ChatColor.GREEN : ChatColor.GRAY) + "Cheat Sheet"); + lore.add((selectedMode == SlimefunGuideMode.SURVIVAL_MODE ? ChatColor.GREEN : ChatColor.GRAY) + Slimefun.getLocalization().getMessage(p, "guide.modes.SURVIVAL_MODE")); + lore.add((selectedMode == SlimefunGuideMode.CHEAT_MODE ? ChatColor.GREEN : ChatColor.GRAY) + Slimefun.getLocalization().getMessage(p, "guide.modes.CHEAT_MODE")); lore.add(""); - lore.add(ChatColor.GRAY + "\u21E8 " + ChatColor.YELLOW + "Click to change the type"); + lore.add(ChatColor.GRAY + "\u21E8 " + ChatColor.YELLOW + Slimefun.getLocalization().getMessage(p, "guide.modes.change")); meta.setLore(lore); item.setItemMeta(meta); @@ -114,4 +115,4 @@ public void setSelectedOption(Player p, ItemStack guide, SlimefunGuideMode value guide.setItemMeta(SlimefunGuide.getItem(value).getItemMeta()); } -} \ No newline at end of file +} diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/MetricsService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/MetricsService.java index 67cd5a7acd..1c6d456692 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/MetricsService.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/MetricsService.java @@ -29,10 +29,10 @@ import com.google.gson.JsonElement; import com.google.gson.JsonParseException; -import com.google.gson.JsonParser; import io.github.bakedlibs.dough.common.CommonPatterns; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; +import io.github.thebusybiscuit.slimefun4.utils.JsonUtils; /** * This Class represents a Metrics Service that sends data to https://bstats.org/ @@ -204,7 +204,7 @@ private int getLatestVersion() { return -1; } - JsonElement element = JsonParser.parseString(response.body()); + JsonElement element = JsonUtils.parseString(response.body()); return element.getAsJsonObject().get("tag_name").getAsInt(); } catch (IOException | InterruptedException | JsonParseException e) { @@ -235,7 +235,6 @@ private boolean download(int version) { downloadMonitor(HttpResponse.BodyHandlers.ofFile(file.toPath())) ); - if (response.statusCode() >= 200 && response.statusCode() < 300) { plugin.getLogger().log(Level.INFO, "Successfully downloaded {0} build: #{1}", new Object[] { JAR_NAME, version }); @@ -246,6 +245,8 @@ private boolean download(int version) { metricVersion = String.valueOf(version); hasDownloadedUpdate = true; return true; + } else { + plugin.getLogger().log(Level.WARNING, "Failed to download the latest jar file from GitHub. Response code: {0}", response.statusCode()); } } catch (InterruptedException | JsonParseException e) { plugin.getLogger().log(Level.WARNING, "Failed to fetch the latest jar file from the builds page. Perhaps GitHub is down? Response: {0}", e.getMessage()); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/ThreadService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/ThreadService.java index 772b65d3fe..a5aa0c58e0 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/ThreadService.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/ThreadService.java @@ -39,7 +39,7 @@ public Thread newThread(Runnable r) { * This is a much better alternative to using * {@link BukkitScheduler#runTaskAsynchronously(org.bukkit.plugin.Plugin, Runnable)} * as this will show not only the plugin but a useful name. - * By default, Bukkit will use "Craft Scheduler Thread - - " which is nice to show the plugin but + * By default, Bukkit will use "Craft Scheduler Thread - {@literal } - {@literal }" which is nice to show the plugin but * it's impossible to track exactly what thread that is. * * @param plugin The {@link JavaPlugin} that is creating this thread @@ -60,7 +60,7 @@ public void newThread(JavaPlugin plugin, String name, Runnable runnable) { * This is a much better alternative to using * {@link BukkitScheduler#runTaskTimerAsynchronously(org.bukkit.plugin.Plugin, Runnable, long, long)} * as this will show not only the plugin but a useful name. - * By default, Bukkit will use "Craft Scheduler Thread - - " which is nice to show the plugin but + * By default, Bukkit will use "Craft Scheduler Thread - {@literal } - {@literal }" which is nice to show the plugin but * it's impossible to track exactly what thread that is. * * @param plugin The {@link JavaPlugin} that is creating this thread diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubConnector.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubConnector.java index 3d6a711b9e..6b7d89e1ea 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubConnector.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubConnector.java @@ -21,9 +21,9 @@ import com.google.gson.JsonElement; import com.google.gson.JsonParseException; -import com.google.gson.JsonParser; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; +import io.github.thebusybiscuit.slimefun4.utils.JsonUtils; /** * The {@link GitHubConnector} is used to connect to the GitHub API service. @@ -120,7 +120,7 @@ void download() { HttpRequest.newBuilder(uri).header("User-Agent", USER_AGENT).build(), HttpResponse.BodyHandlers.ofString() ); - JsonElement element = JsonParser.parseString(response.body()); + JsonElement element = JsonUtils.parseString(response.body()); if (response.statusCode() >= 200 && response.statusCode() < 300) { onSuccess(element); @@ -162,7 +162,7 @@ void download() { @Nullable private JsonElement readCacheFile() { try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))) { - return JsonParser.parseString(reader.readLine()); + return JsonUtils.parseString(reader.readLine()); } catch (IOException | JsonParseException e) { Slimefun.logger().log(Level.WARNING, "Failed to read Github cache file: {0} - {1}: {2}", new Object[] { file.getName(), e.getClass().getSimpleName(), e.getMessage() }); return null; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/Slimefun.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/Slimefun.java index 9078630db8..fe6615fb91 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/Slimefun.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/Slimefun.java @@ -530,11 +530,12 @@ private boolean isVersionUnsupported() { // Now check the actual Version of Minecraft int version = PaperLib.getMinecraftVersion(); + int patchVersion = PaperLib.getMinecraftPatchVersion(); if (version > 0) { // Check all supported versions of Minecraft for (MinecraftVersion supportedVersion : MinecraftVersion.values()) { - if (supportedVersion.isMinecraftVersion(version)) { + if (supportedVersion.isMinecraftVersion(version, patchVersion)) { minecraftVersion = supportedVersion; return false; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java index 8695759316..d3adb16e0b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java @@ -22,6 +22,7 @@ import io.github.thebusybiscuit.slimefun4.utils.ChatUtils; import io.github.thebusybiscuit.slimefun4.utils.HeadTexture; import io.github.thebusybiscuit.slimefun4.utils.LoreBuilder; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedEnchantment; import io.github.thebusybiscuit.slimefun4.utils.itemstack.ColoredFireworkStar; /** @@ -192,8 +193,8 @@ private SlimefunItems() {} GRANDPAS_WALKING_STICK.addUnsafeEnchantment(Enchantment.KNOCKBACK, 5); BLADE_OF_VAMPIRES.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, 2); - BLADE_OF_VAMPIRES.addUnsafeEnchantment(Enchantment.DURABILITY, 4); - BLADE_OF_VAMPIRES.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 2); + BLADE_OF_VAMPIRES.addUnsafeEnchantment(VersionedEnchantment.UNBREAKING, 4); + BLADE_OF_VAMPIRES.addUnsafeEnchantment(VersionedEnchantment.SHARPNESS, 2); } /* Bows */ @@ -212,8 +213,8 @@ private SlimefunItems() {} public static final SlimefunItemStack CLIMBING_PICK = new SlimefunItemStack("CLIMBING_PICK", Material.IRON_PICKAXE, "&bClimbing Pick", "", "&fAllows you to climb certain surfaces", "&fby right-clicking.", "&fEnchant this pick with Efficiency to", "&fclimb even faster!"); static { - COBALT_PICKAXE.addUnsafeEnchantment(Enchantment.DURABILITY, 10); - COBALT_PICKAXE.addUnsafeEnchantment(Enchantment.DIG_SPEED, 6); + COBALT_PICKAXE.addUnsafeEnchantment(VersionedEnchantment.UNBREAKING, 10); + COBALT_PICKAXE.addUnsafeEnchantment(VersionedEnchantment.EFFICIENCY, 6); } /* Armor */ @@ -304,7 +305,7 @@ private SlimefunItems() {} static { Map cactusEnchs = new HashMap<>(); cactusEnchs.put(Enchantment.THORNS, 3); - cactusEnchs.put(Enchantment.DURABILITY, 6); + cactusEnchs.put(VersionedEnchantment.UNBREAKING, 6); CACTUS_HELMET.addUnsafeEnchantments(cactusEnchs); CACTUS_CHESTPLATE.addUnsafeEnchantments(cactusEnchs); @@ -312,8 +313,8 @@ private SlimefunItems() {} CACTUS_BOOTS.addUnsafeEnchantments(cactusEnchs); Map damascusEnchs = new HashMap<>(); - damascusEnchs.put(Enchantment.DURABILITY, 5); - damascusEnchs.put(Enchantment.PROTECTION_ENVIRONMENTAL, 5); + damascusEnchs.put(VersionedEnchantment.UNBREAKING, 5); + damascusEnchs.put(VersionedEnchantment.PROTECTION, 5); DAMASCUS_STEEL_HELMET.addUnsafeEnchantments(damascusEnchs); DAMASCUS_STEEL_CHESTPLATE.addUnsafeEnchantments(damascusEnchs); @@ -321,8 +322,8 @@ private SlimefunItems() {} DAMASCUS_STEEL_BOOTS.addUnsafeEnchantments(damascusEnchs); Map reinforcedEnchs = new HashMap<>(); - reinforcedEnchs.put(Enchantment.DURABILITY, 9); - reinforcedEnchs.put(Enchantment.PROTECTION_ENVIRONMENTAL, 9); + reinforcedEnchs.put(VersionedEnchantment.UNBREAKING, 9); + reinforcedEnchs.put(VersionedEnchantment.PROTECTION, 9); REINFORCED_ALLOY_HELMET.addUnsafeEnchantments(reinforcedEnchs); REINFORCED_ALLOY_CHESTPLATE.addUnsafeEnchantments(reinforcedEnchs); @@ -330,22 +331,22 @@ private SlimefunItems() {} REINFORCED_ALLOY_BOOTS.addUnsafeEnchantments(reinforcedEnchs); Map gildedEnchs = new HashMap<>(); - gildedEnchs.put(Enchantment.DURABILITY, 6); - gildedEnchs.put(Enchantment.PROTECTION_ENVIRONMENTAL, 8); + gildedEnchs.put(VersionedEnchantment.UNBREAKING, 6); + gildedEnchs.put(VersionedEnchantment.PROTECTION, 8); GILDED_IRON_HELMET.addUnsafeEnchantments(gildedEnchs); GILDED_IRON_CHESTPLATE.addUnsafeEnchantments(gildedEnchs); GILDED_IRON_LEGGINGS.addUnsafeEnchantments(gildedEnchs); GILDED_IRON_BOOTS.addUnsafeEnchantments(gildedEnchs); - GOLDEN_HELMET_12K.addUnsafeEnchantment(Enchantment.DURABILITY, 10); - GOLDEN_CHESTPLATE_12K.addUnsafeEnchantment(Enchantment.DURABILITY, 10); - GOLDEN_LEGGINGS_12K.addUnsafeEnchantment(Enchantment.DURABILITY, 10); - GOLDEN_BOOTS_12K.addUnsafeEnchantment(Enchantment.DURABILITY, 10); + GOLDEN_HELMET_12K.addUnsafeEnchantment(VersionedEnchantment.UNBREAKING, 10); + GOLDEN_CHESTPLATE_12K.addUnsafeEnchantment(VersionedEnchantment.UNBREAKING, 10); + GOLDEN_LEGGINGS_12K.addUnsafeEnchantment(VersionedEnchantment.UNBREAKING, 10); + GOLDEN_BOOTS_12K.addUnsafeEnchantment(VersionedEnchantment.UNBREAKING, 10); Map slimeEnchs = new HashMap<>(); - slimeEnchs.put(Enchantment.DURABILITY, 4); - slimeEnchs.put(Enchantment.PROTECTION_ENVIRONMENTAL, 2); + slimeEnchs.put(VersionedEnchantment.UNBREAKING, 4); + slimeEnchs.put(VersionedEnchantment.PROTECTION, 2); SLIME_HELMET_STEEL.addUnsafeEnchantments(slimeEnchs); SLIME_CHESTPLATE_STEEL.addUnsafeEnchantments(slimeEnchs); @@ -353,8 +354,8 @@ private SlimefunItems() {} SLIME_BOOTS_STEEL.addUnsafeEnchantments(slimeEnchs); Map beeEnchs = new HashMap<>(); - beeEnchs.put(Enchantment.DURABILITY, 4); - beeEnchs.put(Enchantment.PROTECTION_ENVIRONMENTAL, 2); + beeEnchs.put(VersionedEnchantment.UNBREAKING, 4); + beeEnchs.put(VersionedEnchantment.PROTECTION, 2); BEE_HELMET.addUnsafeEnchantments(beeEnchs); BEE_WINGS.addUnsafeEnchantments(beeEnchs); @@ -567,10 +568,10 @@ private SlimefunItems() {} public static final SlimefunItemStack STAFF_STORM = new SlimefunItemStack("STAFF_ELEMENTAL_STORM", Material.STICK, "&6Elemental Staff &7- &8&oStorm", "", "&7Element: &8&oStorm", "", "&eRight Click&7 to summon a lightning", LoreBuilder.usesLeft(StormStaff.MAX_USES)); static { - STAFF_WIND.addUnsafeEnchantment(Enchantment.LUCK, 1); + STAFF_WIND.addUnsafeEnchantment(VersionedEnchantment.LUCK_OF_THE_SEA, 1); STAFF_FIRE.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, 5); - STAFF_WATER.addUnsafeEnchantment(Enchantment.WATER_WORKER, 1); - STAFF_STORM.addUnsafeEnchantment(Enchantment.DURABILITY, 1); + STAFF_WATER.addUnsafeEnchantment(VersionedEnchantment.AQUA_AFFINITY, 1); + STAFF_STORM.addUnsafeEnchantment(VersionedEnchantment.UNBREAKING, 1); } /* Multiblocks */ 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 851528a0df..998207b5f5 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 @@ -48,6 +48,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.tasks.AsyncRecipeChoiceTask; import io.github.thebusybiscuit.slimefun4.utils.ChatUtils; import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedItemFlag; import io.github.thebusybiscuit.slimefun4.utils.itemstack.SlimefunGuideItem; import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu; @@ -360,7 +361,7 @@ public void openSearch(PlayerProfile profile, String input, boolean addToHistory ItemStack itemstack = new CustomItemStack(slimefunItem.getItem(), meta -> { ItemGroup itemGroup = slimefunItem.getItemGroup(); meta.setLore(Arrays.asList("", ChatColor.DARK_GRAY + "\u21E8 " + ChatColor.WHITE + itemGroup.getDisplayName(p))); - meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_POTION_EFFECTS); + meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_ENCHANTS, VersionedItemFlag.HIDE_ADDITIONAL_TOOLTIP); }); menu.addItem(index, itemstack); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/MinerAndroid.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/MinerAndroid.java index be397c5055..8d041bafb5 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/MinerAndroid.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/MinerAndroid.java @@ -10,7 +10,6 @@ import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.OfflinePlayer; -import org.bukkit.Particle; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.inventory.ItemStack; @@ -24,6 +23,7 @@ import io.github.thebusybiscuit.slimefun4.core.services.sounds.SoundEffect; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.utils.InfiniteBlockGenerator; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedParticle; import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag; import me.mrCookieSlime.Slimefun.api.BlockStorage; @@ -149,7 +149,7 @@ private void breakBlock(BlockMenu menu, Collection drops, Block block // "poof" a "new" block was generated SoundEffect.MINER_ANDROID_BLOCK_GENERATION_SOUND.playAt(block); - block.getWorld().spawnParticle(Particle.SMOKE_NORMAL, block.getX() + 0.5, block.getY() + 1.25, block.getZ() + 0.5, 8, 0.5, 0.5, 0.5, 0.015); + block.getWorld().spawnParticle(VersionedParticle.SMOKE, block.getX() + 0.5, block.getY() + 1.25, block.getZ() + 0.5, 8, 0.5, 0.5, 0.5, 0.015); } else { block.setType(Material.AIR); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ProgrammableAndroid.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ProgrammableAndroid.java index 471551575b..8db9826bc7 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ProgrammableAndroid.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ProgrammableAndroid.java @@ -25,7 +25,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; @@ -55,8 +54,6 @@ import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config; import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu; -import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler; -import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.InventoryBlock; import me.mrCookieSlime.Slimefun.Objects.handlers.BlockTicker; @@ -847,18 +844,7 @@ private void constructMenu(@Nonnull BlockMenuPreset preset) { preset.drawBackground(ChestMenuUtils.getOutputSlotTexture(), OUTPUT_BORDER); for (int i : getOutputSlots()) { - preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() { - - @Override - public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) { - return false; - } - - @Override - public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor, ClickAction action) { - return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR; - } - }); + preset.addMenuClickHandler(i, ChestMenuUtils.getDefaultOutputHandler()); } preset.addItem(34, getFuelSource().getItem(), ChestMenuUtils.getEmptyClickHandler()); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/AbstractAutoCrafter.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/AbstractAutoCrafter.java index 380c7a1273..b75d3c6643 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/AbstractAutoCrafter.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/AbstractAutoCrafter.java @@ -14,7 +14,6 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.NamespacedKey; -import org.bukkit.Particle; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; @@ -41,6 +40,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.tasks.AsyncRecipeChoiceTask; import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils; import io.github.thebusybiscuit.slimefun4.utils.HeadTexture; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedParticle; import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag; import io.papermc.lib.PaperLib; import io.papermc.lib.features.blockstatesnapshot.BlockStateSnapshotResult; @@ -180,7 +180,7 @@ protected void tick(@Nonnull Block b, @Nonnull Config data) { if (craft(inv, recipe)) { // We are done crafting! Location loc = b.getLocation().add(0.5, 0.8, 0.5); - b.getWorld().spawnParticle(Particle.VILLAGER_HAPPY, loc, 6); + b.getWorld().spawnParticle(VersionedParticle.HAPPY_VILLAGER, loc, 6); removeCharge(b.getLocation(), getEnergyConsumption()); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java index 2e0d31b489..f11e7a35ad 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java @@ -8,7 +8,6 @@ import javax.annotation.ParametersAreNonnullByDefault; import org.bukkit.Material; -import org.bukkit.Particle; import org.bukkit.Tag; import org.bukkit.World.Environment; import org.bukkit.block.Block; @@ -30,6 +29,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem; import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedParticle; import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag; import me.mrCookieSlime.Slimefun.api.BlockStorage; @@ -165,7 +165,7 @@ private void generateLiquid(@Nonnull Block block, boolean isWater) { // Fixes #2877 - If water in the nether is disabled, abort and play an effect. if (isWater && block.getWorld().getEnvironment() == Environment.NETHER && !allowWaterInNether.getValue()) { // We will still consume the items but won't generate water in the Nether. - block.getWorld().spawnParticle(Particle.SMOKE_NORMAL, block.getLocation().add(0.5, 0.5, 0.5), 4); + block.getWorld().spawnParticle(VersionedParticle.SMOKE, block.getLocation().add(0.5, 0.5, 0.5), 4); SoundEffect.CRUCIBLE_GENERATE_LIQUID_SOUND.playAt(block); return; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/gadgets/MultiTool.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/gadgets/MultiTool.java index 56707206d4..d608742da4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/gadgets/MultiTool.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/gadgets/MultiTool.java @@ -1,17 +1,20 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.electric.gadgets; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; -import java.util.UUID; +import java.util.regex.Pattern; import javax.annotation.Nonnull; import javax.annotation.ParametersAreNonnullByDefault; +import io.github.bakedlibs.dough.common.ChatColors; +import io.github.bakedlibs.dough.data.persistent.PersistentDataAPI; import org.bukkit.ChatColor; +import org.bukkit.NamespacedKey; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup; import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem; @@ -22,22 +25,25 @@ import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler; import io.github.thebusybiscuit.slimefun4.core.handlers.ToolUseHandler; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedEntityType; /** * The {@link MultiTool} is an electric device which can mimic * the behaviour of any other {@link SlimefunItem}. - * - * @author TheBusyBiscuit * + * @author TheBusyBiscuit */ public class MultiTool extends SlimefunItem implements Rechargeable { private static final float COST = 0.3F; - private final Map selectedMode = new HashMap<>(); private final List modes = new ArrayList<>(); private final float capacity; + private static final NamespacedKey key = new NamespacedKey(Slimefun.instance(), "multitool_mode"); + private static final String LORE_PREFIX = ChatColors.color("&8\u21E8 &7Mode: "); + private static final Pattern REGEX = Pattern.compile(ChatColors.color("(&c&o)?" + LORE_PREFIX) + "(.+)"); + @ParametersAreNonnullByDefault public MultiTool(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, float capacity, String... items) { super(itemGroup, item, recipeType, recipe); @@ -73,17 +79,15 @@ protected ItemUseHandler getItemUseHandler() { return e -> { Player p = e.getPlayer(); ItemStack item = e.getItem(); + ItemMeta meta = item.getItemMeta(); e.cancel(); - int index = selectedMode.getOrDefault(p.getUniqueId(), 0); + int index = PersistentDataAPI.getInt(meta, key, 0); + SlimefunItem sfItem = modes.get(index).getItem(); if (!p.isSneaking()) { - if (removeItemCharge(item, COST)) { - SlimefunItem sfItem = modes.get(index).getItem(); - - if (sfItem != null) { - sfItem.callItemHandler(ItemUseHandler.class, handler -> handler.onRightClick(e)); - } + if (sfItem != null && removeItemCharge(item, COST)) { + sfItem.callItemHandler(ItemUseHandler.class, handler -> handler.onRightClick(e)); } } else { index = nextIndex(index); @@ -91,7 +95,28 @@ protected ItemUseHandler getItemUseHandler() { SlimefunItem selectedItem = modes.get(index).getItem(); String itemName = selectedItem != null ? selectedItem.getItemName() : "Unknown"; Slimefun.getLocalization().sendMessage(p, "messages.multi-tool.mode-change", true, msg -> msg.replace("%device%", "Multi Tool").replace("%mode%", ChatColor.stripColor(itemName))); - selectedMode.put(p.getUniqueId(), index); + + PersistentDataAPI.setInt(meta, key, index); + + List lore = meta.hasLore() ? meta.getLore() : new ArrayList<>(); + + boolean regexMatchFound = false; + for (int i = 0; i < lore.size(); i++) { + String line = lore.get(i); + + if (REGEX.matcher(line).matches()) { + lore.set(i, LORE_PREFIX + ChatColor.stripColor(itemName)); + regexMatchFound = true; + break; + } + } + + if (!regexMatchFound) { + lore.add(2, LORE_PREFIX + ChatColor.stripColor(itemName)); + } + + meta.setLore(lore); + item.setItemMeta(meta); } }; } @@ -109,15 +134,13 @@ private ToolUseHandler getToolUseHandler() { private EntityInteractHandler getEntityInteractionHandler() { return (e, item, offhand) -> { // Fixes #2217 - Prevent them from being used to shear entities - switch (e.getRightClicked().getType()) { - case MUSHROOM_COW: - case SHEEP: - case SNOWMAN: - Slimefun.getLocalization().sendMessage(e.getPlayer(), "messages.multi-tool.not-shears"); - e.setCancelled(true); - break; - default: - break; + EntityType type = e.getRightClicked().getType(); + if (type == VersionedEntityType.MOOSHROOM + || type == VersionedEntityType.SNOW_GOLEM + || type == EntityType.SHEEP + ) { + Slimefun.getLocalization().sendMessage(e.getPlayer(), "messages.multi-tool.not-shears"); + e.setCancelled(true); } }; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/gadgets/MultiToolMode.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/gadgets/MultiToolMode.java index 7bf079771b..d3963496d4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/gadgets/MultiToolMode.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/gadgets/MultiToolMode.java @@ -8,22 +8,43 @@ class MultiToolMode { + private final int id; + private final String itemId; private final ItemSetting item; private final ItemSetting enabled; + // TODO: Move "id" into some NamespacedKey MultiToolMode(@Nonnull MultiTool multiTool, int id, @Nonnull String itemId) { + this.id = id; + this.itemId = itemId; this.item = new ItemSetting<>(multiTool, "mode." + id + ".item", itemId); this.enabled = new ItemSetting<>(multiTool, "mode." + id + ".enabled", true); multiTool.addItemSetting(item, enabled); } + /** + * This method is deprecated and should not be used. + * + * + * @return The ID of this mode + */ + @Deprecated(since = "RC-37", forRemoval = true) + public int getId() { + return id; + } + @Nullable SlimefunItem getItem() { return SlimefunItem.getById(item.getValue()); } + @Nonnull + String getItemId() { + return itemId; + } + boolean isEnabled() { return enabled.getValue(); } -} +} \ No newline at end of file diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoBrewer.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoBrewer.java index f00676edd6..962bc2d32f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoBrewer.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoBrewer.java @@ -7,6 +7,7 @@ import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; +import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.PotionMeta; @@ -18,7 +19,7 @@ import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack; import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType; import io.github.thebusybiscuit.slimefun4.core.attributes.NotHopperable; - +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedPotionType; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe; import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu; @@ -36,22 +37,22 @@ public class AutoBrewer extends AContainer implements NotHopperable { private static final Map fermentations = new EnumMap<>(PotionType.class); static { - potionRecipes.put(Material.SUGAR, PotionType.SPEED); - potionRecipes.put(Material.RABBIT_FOOT, PotionType.JUMP); + potionRecipes.put(Material.SUGAR, VersionedPotionType.SWIFTNESS); + potionRecipes.put(Material.RABBIT_FOOT, VersionedPotionType.LEAPING); potionRecipes.put(Material.BLAZE_POWDER, PotionType.STRENGTH); - potionRecipes.put(Material.GLISTERING_MELON_SLICE, PotionType.INSTANT_HEAL); + potionRecipes.put(Material.GLISTERING_MELON_SLICE, VersionedPotionType.HEALING); potionRecipes.put(Material.SPIDER_EYE, PotionType.POISON); - potionRecipes.put(Material.GHAST_TEAR, PotionType.REGEN); + potionRecipes.put(Material.GHAST_TEAR, VersionedPotionType.REGENERATION); potionRecipes.put(Material.MAGMA_CREAM, PotionType.FIRE_RESISTANCE); potionRecipes.put(Material.PUFFERFISH, PotionType.WATER_BREATHING); potionRecipes.put(Material.GOLDEN_CARROT, PotionType.NIGHT_VISION); potionRecipes.put(Material.TURTLE_HELMET, PotionType.TURTLE_MASTER); potionRecipes.put(Material.PHANTOM_MEMBRANE, PotionType.SLOW_FALLING); - fermentations.put(PotionType.SPEED, PotionType.SLOWNESS); - fermentations.put(PotionType.JUMP, PotionType.SLOWNESS); - fermentations.put(PotionType.INSTANT_HEAL, PotionType.INSTANT_DAMAGE); - fermentations.put(PotionType.POISON, PotionType.INSTANT_DAMAGE); + fermentations.put(VersionedPotionType.SWIFTNESS, PotionType.SLOWNESS); + fermentations.put(VersionedPotionType.LEAPING, PotionType.SLOWNESS); + fermentations.put(VersionedPotionType.HEALING, VersionedPotionType.HARMING); + fermentations.put(PotionType.POISON, VersionedPotionType.HARMING); fermentations.put(PotionType.NIGHT_VISION, PotionType.INVISIBILITY); } @@ -104,8 +105,53 @@ public AutoBrewer(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipe @ParametersAreNonnullByDefault private @Nullable ItemStack brew(Material input, Material potionType, PotionMeta potion) { - PotionData data = potion.getBasePotionData(); + if (Slimefun.getMinecraftVersion().isBefore(20,2)) { + return brewPreBasePotionType(input, potionType, potion); + } + PotionType type = potion.getBasePotionType(); + if (type == PotionType.WATER) { + if (input == Material.FERMENTED_SPIDER_EYE) { + potion.setBasePotionType(PotionType.WEAKNESS); + return new ItemStack(potionType); + } else if (input == Material.NETHER_WART) { + potion.setBasePotionType(PotionType.AWKWARD); + return new ItemStack(potionType); + } else if (potionType == Material.POTION && input == Material.GUNPOWDER) { + return new ItemStack(Material.SPLASH_POTION); + } else if (potionType == Material.SPLASH_POTION && input == Material.DRAGON_BREATH) { + return new ItemStack(Material.LINGERING_POTION); + } + } else if (input == Material.FERMENTED_SPIDER_EYE) { + PotionType fermented = fermentations.get(type); + + if (fermented != null) { + potion.setBasePotionType(fermented); + return new ItemStack(potionType); + } + } else if (input == Material.REDSTONE && type.isExtendable() && !type.isUpgradeable()) { + // Fixes #3390 - Potions can only be either extended or upgraded. Not both. + potion.setBasePotionType(type); + return new ItemStack(potionType); + } else if (input == Material.GLOWSTONE_DUST && type.isUpgradeable() && !type.isExtendable()) { + // Fixes #3390 - Potions can only be either extended or upgraded. Not both. + potion.setBasePotionType(type); + return new ItemStack(potionType); + } else if (type == PotionType.AWKWARD) { + PotionType potionRecipe = potionRecipes.get(input); + + if (potionRecipe != null) { + potion.setBasePotionType(potionRecipe); + return new ItemStack(potionType); + } + } + return null; + } + + @ParametersAreNonnullByDefault + @SuppressWarnings("deprecration") + private ItemStack brewPreBasePotionType(Material input, Material potionType, PotionMeta potion) { + PotionData data = potion.getBasePotionData(); PotionType type = data.getType(); if (type == PotionType.WATER) { if (input == Material.FERMENTED_SPIDER_EYE) { @@ -142,16 +188,15 @@ public AutoBrewer(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipe return new ItemStack(potionType); } } - return null; } /** * Checks whether a given {@link Material} is a valid Potion material. - * + * * @param mat * The {@link Material} to check - * + * * @return Whether this {@link Material} is a valid potion */ private boolean isPotion(@Nonnull Material mat) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java index e3395e9f64..b535e44b40 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java @@ -44,6 +44,10 @@ protected void tick(Block b) { for (int slot : getInputSlots()) { ItemStack item = inv.getItemInSlot(slot); + if (item == null || item.getAmount() != 1) { + continue; + } + if (charge(b, inv, slot, item)) { return; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricSmeltery.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricSmeltery.java index 24e0e0c33e..2218339998 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricSmeltery.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricSmeltery.java @@ -11,7 +11,6 @@ import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; -import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.inventory.ItemStack; import io.github.bakedlibs.dough.items.CustomItemStack; @@ -25,8 +24,6 @@ import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils; import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; -import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler; -import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer; import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset; import me.mrCookieSlime.Slimefun.api.inventory.DirtyChestMenu; @@ -126,18 +123,7 @@ protected void constructMenu(BlockMenuPreset preset) { preset.addItem(22, new CustomItemStack(Material.BLACK_STAINED_GLASS_PANE, " "), ChestMenuUtils.getEmptyClickHandler()); for (int i : getOutputSlots()) { - preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() { - - @Override - public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) { - return false; - } - - @Override - public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor, ClickAction action) { - return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR; - } - }); + preset.addMenuClickHandler(i, ChestMenuUtils.getDefaultOutputHandler()); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/FluidPump.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/FluidPump.java index b0bfacd9de..729fd2ff51 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/FluidPump.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/FluidPump.java @@ -7,14 +7,13 @@ import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; +import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.data.BlockData; import org.bukkit.block.data.Levelled; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.inventory.ItemStack; import io.github.bakedlibs.dough.blocks.Vein; @@ -32,8 +31,6 @@ import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper; import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config; -import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler; -import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.InventoryBlock; import me.mrCookieSlime.Slimefun.Objects.handlers.BlockTicker; import me.mrCookieSlime.Slimefun.api.BlockStorage; @@ -100,18 +97,7 @@ private void constructMenu(@Nonnull BlockMenuPreset preset) { } for (int i : getOutputSlots()) { - preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() { - - @Override - public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) { - return false; - } - - @Override - public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor, ClickAction action) { - return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR; - } - }); + preset.addMenuClickHandler(i, ChestMenuUtils.getDefaultOutputHandler()); } } @@ -218,7 +204,11 @@ private Block findNextFluid(@Nonnull Block fluid) { case BUBBLE_COLUMN: ItemStack waterBottle = new ItemStack(Material.POTION); PotionMeta meta = (PotionMeta) waterBottle.getItemMeta(); - meta.setBasePotionData(new PotionData(PotionType.WATER)); + if (Slimefun.getMinecraftVersion().isBefore(20, 2)) { + meta.setBasePotionData(new PotionData(PotionType.WATER)); + } else { + meta.setBasePotionType(PotionType.WATER); + } waterBottle.setItemMeta(meta); return waterBottle; default: @@ -239,10 +229,10 @@ private Block findNextFluid(@Nonnull Block fluid) { /** * This method checks if the given {@link Block} is a liquid source {@link Block}. - * + * * @param block * The {@link Block} in question - * + * * @return Whether that {@link Block} is a liquid and a source {@link Block}. */ private boolean isSource(@Nonnull Block block) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/accelerators/AnimalGrowthAccelerator.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/accelerators/AnimalGrowthAccelerator.java index 68a570f8a5..1da903c425 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/accelerators/AnimalGrowthAccelerator.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/accelerators/AnimalGrowthAccelerator.java @@ -1,6 +1,5 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.accelerators; -import org.bukkit.Particle; import org.bukkit.block.Block; import org.bukkit.entity.Ageable; import org.bukkit.entity.Entity; @@ -12,6 +11,7 @@ import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems; import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedParticle; import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper; import me.mrCookieSlime.Slimefun.api.BlockStorage; @@ -54,7 +54,7 @@ protected void tick(Block b) { ageable.setAge(0); } - n.getWorld().spawnParticle(Particle.VILLAGER_HAPPY, ((LivingEntity) n).getEyeLocation(), 8, 0.2F, 0.2F, 0.2F); + n.getWorld().spawnParticle(VersionedParticle.HAPPY_VILLAGER, ((LivingEntity) n).getEyeLocation(), 8, 0.2F, 0.2F, 0.2F); return; } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/accelerators/CropGrowthAccelerator.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/accelerators/CropGrowthAccelerator.java index 5649c70c73..5cf09b31f9 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/accelerators/CropGrowthAccelerator.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/accelerators/CropGrowthAccelerator.java @@ -1,6 +1,5 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.accelerators; -import org.bukkit.Particle; import org.bukkit.block.Block; import org.bukkit.block.data.Ageable; import org.bukkit.inventory.ItemStack; @@ -10,6 +9,7 @@ import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems; import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedParticle; import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper; import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag; @@ -65,7 +65,7 @@ private boolean grow(Block machine, BlockMenu inv, Block crop) { ageable.setAge(ageable.getAge() + 1); crop.setBlockData(ageable); - crop.getWorld().spawnParticle(Particle.VILLAGER_HAPPY, crop.getLocation().add(0.5D, 0.5D, 0.5D), 4, 0.1F, 0.1F, 0.1F); + crop.getWorld().spawnParticle(VersionedParticle.HAPPY_VILLAGER, crop.getLocation().add(0.5D, 0.5D, 0.5D), 4, 0.1F, 0.1F, 0.1F); return true; } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/accelerators/TreeGrowthAccelerator.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/accelerators/TreeGrowthAccelerator.java index e6e79311db..a9332d777e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/accelerators/TreeGrowthAccelerator.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/accelerators/TreeGrowthAccelerator.java @@ -4,7 +4,6 @@ import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; -import org.bukkit.Particle; import org.bukkit.Tag; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -18,6 +17,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems; import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedParticle; import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper; import me.mrCookieSlime.Slimefun.api.BlockStorage; @@ -93,7 +93,7 @@ private boolean applyBoneMeal(Block machine, Block sapling, BlockMenu inv) { sapling.applyBoneMeal(BlockFace.UP); inv.consumeItem(slot); - sapling.getWorld().spawnParticle(Particle.VILLAGER_HAPPY, sapling.getLocation().add(0.5D, 0.5D, 0.5D), 4, 0.1F, 0.1F, 0.1F); + sapling.getWorld().spawnParticle(VersionedParticle.HAPPY_VILLAGER, sapling.getLocation().add(0.5D, 0.5D, 0.5D), 4, 0.1F, 0.1F, 0.1F); return true; } } @@ -111,7 +111,7 @@ private boolean updateSaplingData(Block machine, Block block, BlockMenu inv, Sap block.setBlockData(sapling, false); inv.consumeItem(slot); - block.getWorld().spawnParticle(Particle.VILLAGER_HAPPY, block.getLocation().add(0.5D, 0.5D, 0.5D), 4, 0.1F, 0.1F, 0.1F); + block.getWorld().spawnParticle(VersionedParticle.HAPPY_VILLAGER, block.getLocation().add(0.5D, 0.5D, 0.5D), 4, 0.1F, 0.1F, 0.1F); return true; } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/geo/GEOMiner.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/geo/GEOMiner.java index cc09eb0ac6..d21815533b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/geo/GEOMiner.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/geo/GEOMiner.java @@ -11,9 +11,7 @@ import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.block.Block; -import org.bukkit.entity.Player; import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.inventory.ItemStack; import io.github.bakedlibs.dough.items.CustomItemStack; @@ -38,8 +36,6 @@ import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils; import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config; -import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler; -import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.InventoryBlock; import me.mrCookieSlime.Slimefun.Objects.handlers.BlockTicker; import me.mrCookieSlime.Slimefun.api.BlockStorage; @@ -265,18 +261,7 @@ protected void constructMenu(@Nonnull BlockMenuPreset preset) { preset.addItem(4, new CustomItemStack(Material.BLACK_STAINED_GLASS_PANE, " "), ChestMenuUtils.getEmptyClickHandler()); for (int i : OUTPUT_SLOTS) { - preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() { - - @Override - public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) { - return false; - } - - @Override - public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor, ClickAction action) { - return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR; - } - }); + preset.addMenuClickHandler(i, ChestMenuUtils.getDefaultOutputHandler()); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/EnchantmentRune.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/EnchantmentRune.java index ce8e53f8d9..33e54e7544 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/EnchantmentRune.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/EnchantmentRune.java @@ -14,7 +14,6 @@ import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.Particle; import org.bukkit.SoundCategory; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Entity; @@ -30,6 +29,7 @@ import io.github.thebusybiscuit.slimefun4.core.services.sounds.SoundEffect; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedParticle; /** * This {@link SlimefunItem} allows you to enchant any enchantable {@link ItemStack} with a random @@ -50,6 +50,8 @@ public EnchantmentRune(ItemGroup itemGroup, SlimefunItemStack item, RecipeType r super(itemGroup, item, recipeType, recipe); for (Material mat : Material.values()) { + if (Slimefun.instance().isUnitTest() && mat.isLegacy()) continue; + List enchantments = new ArrayList<>(); for (Enchantment enchantment : Enchantment.values()) { @@ -140,7 +142,7 @@ private void addRandomEnchantment(@Nonnull Player p, @Nonnull Item rune) { // Being sure entities are still valid and not picked up or whatsoever. if (rune.isValid() && item.isValid() && itemStack.getAmount() == 1) { - l.getWorld().spawnParticle(Particle.CRIT_MAGIC, l, 1); + l.getWorld().spawnParticle(VersionedParticle.ENCHANTED_HIT, l, 1); SoundEffect.ENCHANTMENT_RUNE_ADD_ENCHANT_SOUND.playAt(l, SoundCategory.PLAYERS); item.remove(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/VillagerRune.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/VillagerRune.java index d5a3b325aa..fe5195e22c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/VillagerRune.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/VillagerRune.java @@ -22,6 +22,7 @@ import io.github.thebusybiscuit.slimefun4.core.services.sounds.SoundEffect; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedParticle; /** * This {@link SlimefunItem} allows you to reset a {@link Villager} profession. @@ -64,7 +65,7 @@ public VillagerRune(ItemGroup itemGroup, SlimefunItemStack item, RecipeType reci SoundEffect.VILLAGER_RUNE_TRANSFORM_SOUND.playAt(villager.getLocation(), SoundCategory.NEUTRAL); villager.getWorld().spawnParticle(Particle.CRIMSON_SPORE, villager.getLocation(), 10, 0, offset / 2, 0, 0); - villager.getWorld().spawnParticle(Particle.ENCHANTMENT_TABLE, villager.getLocation(), 5, 0.04, 1, 0.04); + villager.getWorld().spawnParticle(VersionedParticle.ENCHANT, villager.getLocation(), 5, 0.04, 1, 0.04); } }; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Bandage.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Bandage.java index d69ceeaa91..b87882cf6d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Bandage.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Bandage.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; import io.github.bakedlibs.dough.items.ItemUtils; import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup; @@ -17,6 +16,7 @@ import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType; import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler; import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedPotionEffectType; /** * A {@link Bandage} or Rag is a medical supply which heals the {@link Player} and extinguishes @@ -51,7 +51,7 @@ public ItemUseHandler getItemHandler() { } p.getWorld().playEffect(p.getLocation(), Effect.STEP_SOUND, Material.WHITE_WOOL); - p.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 1, healingLevel)); + p.addPotionEffect(new PotionEffect(VersionedPotionEffectType.INSTANT_HEALTH, 1, healingLevel)); p.setFireTicks(0); e.cancel(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/MedicalSupply.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/MedicalSupply.java index 2a0383001b..350376eab8 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/MedicalSupply.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/MedicalSupply.java @@ -18,6 +18,7 @@ import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack; import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType; import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedPotionEffectType; public abstract class MedicalSupply extends SimpleSlimefunItem { @@ -32,10 +33,10 @@ protected MedicalSupply(ItemGroup itemGroup, int healAmount, SlimefunItemStack i curedEffects.add(PotionEffectType.POISON); curedEffects.add(PotionEffectType.WITHER); - curedEffects.add(PotionEffectType.SLOW); - curedEffects.add(PotionEffectType.SLOW_DIGGING); + curedEffects.add(VersionedPotionEffectType.SLOWNESS); + curedEffects.add(VersionedPotionEffectType.MINING_FATIGUE); curedEffects.add(PotionEffectType.WEAKNESS); - curedEffects.add(PotionEffectType.CONFUSION); + curedEffects.add(VersionedPotionEffectType.NAUSEA); curedEffects.add(PotionEffectType.BLINDNESS); curedEffects.add(PotionEffectType.BAD_OMEN); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Splint.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Splint.java index a6495d061a..0a510ff28a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Splint.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Splint.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; import io.github.bakedlibs.dough.items.ItemUtils; import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup; @@ -17,6 +16,7 @@ import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler; import io.github.thebusybiscuit.slimefun4.core.services.sounds.SoundEffect; import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedPotionEffectType; public class Splint extends SimpleSlimefunItem { @@ -40,7 +40,7 @@ public Splint(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType } SoundEffect.SPLINT_CONSUME_SOUND.playFor(p); - p.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 1, 0)); + p.addPotionEffect(new PotionEffect(VersionedPotionEffectType.INSTANT_HEALTH, 1, 0)); e.cancel(); }; 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 5da4697970..0169f0f846 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 @@ -10,7 +10,6 @@ import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.Particle; import org.bukkit.Sound; import org.bukkit.World; import org.bukkit.block.Block; @@ -30,6 +29,7 @@ import io.github.bakedlibs.dough.scheduling.TaskQueue; import io.github.thebusybiscuit.slimefun4.core.services.sounds.SoundEffect; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedParticle; import io.papermc.lib.PaperLib; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel; @@ -341,7 +341,7 @@ private void setPistonState(@Nonnull Block block, boolean extended) { try { // Smoke Particles around the Chest for dramatic effect Location particleLoc = chest.getLocation().clone().add(0, -1, 0); - block.getWorld().spawnParticle(Particle.SMOKE_NORMAL, particleLoc, 20, 0.7, 0.7, 0.7, 0); + block.getWorld().spawnParticle(VersionedParticle.SMOKE, particleLoc, 20, 0.7, 0.7, 0.7, 0); if (block.getType() == Material.MOVING_PISTON) { // Yeah it isn't really cool when this happens diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ClimbingPick.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ClimbingPick.java index 43f0225237..265db240ed 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ClimbingPick.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ClimbingPick.java @@ -39,6 +39,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem; import io.github.thebusybiscuit.slimefun4.implementation.settings.ClimbableSurface; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedEnchantment; import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag; /** @@ -147,7 +148,7 @@ public double getClimbingSpeed(@Nonnull ItemStack item, @Nonnull Material type) double speed = getClimbingSpeed(type); if (speed > 0) { - int efficiencyLevel = item.getEnchantmentLevel(Enchantment.DIG_SPEED); + int efficiencyLevel = item.getEnchantmentLevel(VersionedEnchantment.EFFICIENCY); if (efficiencyLevel > 0) { speed += efficiencyLevel * EFFICIENCY_MODIFIER; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/weapons/ExplosiveBow.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/weapons/ExplosiveBow.java index d4cea025f5..1477549c9f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/weapons/ExplosiveBow.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/weapons/ExplosiveBow.java @@ -6,7 +6,6 @@ import javax.annotation.ParametersAreNonnullByDefault; import org.bukkit.Bukkit; -import org.bukkit.Particle; import org.bukkit.SoundCategory; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Entity; @@ -22,6 +21,7 @@ import io.github.thebusybiscuit.slimefun4.api.items.settings.IntRangeSetting; import io.github.thebusybiscuit.slimefun4.core.handlers.BowShootHandler; import io.github.thebusybiscuit.slimefun4.core.services.sounds.SoundEffect; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedParticle; /** * The {@link ExplosiveBow} is a {@link SlimefunBow} which creates a fake explosion when it hits @@ -49,7 +49,7 @@ public ExplosiveBow(ItemGroup itemGroup, SlimefunItemStack item, ItemStack[] rec @Override public BowShootHandler onShoot() { return (e, target) -> { - target.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, target.getLocation(), 1); + target.getWorld().spawnParticle(VersionedParticle.EXPLOSION, target.getLocation(), 1); SoundEffect.EXPLOSIVE_BOW_HIT_SOUND.playAt(target.getLocation(), SoundCategory.PLAYERS); int radius = range.getValue(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/weapons/IcyBow.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/weapons/IcyBow.java index 474a7277d6..b3e54f15ed 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/weapons/IcyBow.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/weapons/IcyBow.java @@ -9,13 +9,13 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion; import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup; import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack; import io.github.thebusybiscuit.slimefun4.core.handlers.BowShootHandler; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedPotionEffectType; /** * The {@link IcyBow} is a special kind of bow which slows down any @@ -48,8 +48,8 @@ public BowShootHandler onShoot() { } n.getWorld().playEffect(n.getLocation(), Effect.STEP_SOUND, Material.ICE); n.getWorld().playEffect(n.getEyeLocation(), Effect.STEP_SOUND, Material.ICE); - n.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 20 * 2, 10)); - n.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 20 * 2, -10)); + n.addPotionEffect(new PotionEffect(VersionedPotionEffectType.SLOWNESS, 20 * 2, 10)); + n.addPotionEffect(new PotionEffect(VersionedPotionEffectType.JUMP_BOOST, 20 * 2, -10)); }; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java index 12937e45a4..40b976e345 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java @@ -39,6 +39,7 @@ import io.github.thebusybiscuit.slimefun4.core.handlers.BlockPlaceHandler; import io.github.thebusybiscuit.slimefun4.core.handlers.ToolUseHandler; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedEnchantment; import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag; import me.mrCookieSlime.Slimefun.api.BlockStorage; @@ -70,18 +71,18 @@ public void onBlockPlaceExisting(BlockPlaceEvent e) { Block block = e.getBlock(); // Fixes #2636 - This will solve the "ghost blocks" issue - if (e.getBlockReplacedState().getType().isAir()) { + if (e.getBlockReplacedState().getType().isAir() && BlockStorage.hasBlockInfo(block) && !Slimefun.getTickerTask().isDeletedSoon(block.getLocation())) { SlimefunItem sfItem = BlockStorage.check(block); - if (sfItem != null && !Slimefun.getTickerTask().isDeletedSoon(block.getLocation())) { + if (sfItem != null) { for (ItemStack item : sfItem.getDrops()) { if (item != null && !item.getType().isAir()) { block.getWorld().dropItemNaturally(block.getLocation(), item); } } - - BlockStorage.clearBlockInfo(block); } + + BlockStorage.clearBlockInfo(block); } else if (BlockStorage.hasBlockInfo(e.getBlock())) { // If there is no air (e.g. grass) then don't let the block be placed e.setCancelled(true); @@ -374,7 +375,7 @@ private int getBonusDropsWithFortune(@Nullable ItemStack item, @Nonnull Block b) * directly and re use it. */ ItemMeta meta = item.getItemMeta(); - int fortuneLevel = meta.getEnchantLevel(Enchantment.LOOT_BONUS_BLOCKS); + int fortuneLevel = meta.getEnchantLevel(VersionedEnchantment.FORTUNE); if (fortuneLevel > 0 && !meta.hasEnchant(Enchantment.SILK_TOUCH)) { Random random = ThreadLocalRandom.current(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java index a01625c836..7a8b29c0df 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java @@ -49,6 +49,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.magical.talismans.MagicianTalisman; import io.github.thebusybiscuit.slimefun4.implementation.items.magical.talismans.Talisman; import io.github.thebusybiscuit.slimefun4.implementation.settings.TalismanEnchantment; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedEnchantment; import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag; /** @@ -301,7 +302,7 @@ public void onEnchant(EnchantItemEvent e) { } // Wizard Talisman - if (!enchantments.containsKey(Enchantment.SILK_TOUCH) && Enchantment.LOOT_BONUS_BLOCKS.canEnchantItem(e.getItem()) && Talisman.trigger(e, SlimefunItems.TALISMAN_WIZARD)) { + if (!enchantments.containsKey(Enchantment.SILK_TOUCH) && VersionedEnchantment.FORTUNE.canEnchantItem(e.getItem()) && Talisman.trigger(e, SlimefunItems.TALISMAN_WIZARD)) { // Randomly lower some enchantments for (Map.Entry entry : enchantments.entrySet()) { if (entry.getValue() > 1 && random.nextInt(100) < 40) { @@ -310,7 +311,7 @@ public void onEnchant(EnchantItemEvent e) { } // Give an extra Fortune boost (Lvl 3 - 5) - enchantments.put(Enchantment.LOOT_BONUS_BLOCKS, random.nextInt(3) + 3); + enchantments.put(VersionedEnchantment.FORTUNE, random.nextInt(3) + 3); } } @@ -351,7 +352,7 @@ private void doubleTalismanDrops(BlockDropItemEvent e, SlimefunItemStack talisma Collection drops = e.getItems(); if (Talisman.trigger(e, talismanItemStack, false)) { - int dropAmount = getAmountWithFortune(type, meta.getEnchantLevel(Enchantment.LOOT_BONUS_BLOCKS)); + int dropAmount = getAmountWithFortune(type, meta.getEnchantLevel(VersionedEnchantment.FORTUNE)); // Keep track of whether we actually doubled the drops or not boolean doubledDrops = false; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java index 9ade30e843..16bfdc85a0 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java @@ -217,6 +217,7 @@ import io.github.thebusybiscuit.slimefun4.utils.ColoredMaterial; import io.github.thebusybiscuit.slimefun4.utils.HeadTexture; import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedPotionEffectType; /** * This class holds the recipes of all items. @@ -241,7 +242,7 @@ public static void setup(@Nonnull Slimefun plugin) { new SlimefunItem(itemGroups.weapons, SlimefunItems.GRANDMAS_WALKING_STICK, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {null, new ItemStack(Material.OAK_LOG), null, null, new ItemStack(Material.OAK_LOG), null, null, new ItemStack(Material.OAK_LOG), null}) .register(plugin); - + new SlimefunItem(itemGroups.weapons, SlimefunItems.GRANDPAS_WALKING_STICK, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {new ItemStack(Material.LEATHER), new ItemStack(Material.OAK_LOG), new ItemStack(Material.LEATHER), null, new ItemStack(Material.OAK_LOG), null, null, new ItemStack(Material.OAK_LOG), null}) .register(plugin); @@ -261,7 +262,7 @@ public static void setup(@Nonnull Slimefun plugin) { new OutputChest(itemGroups.basicMachines, SlimefunItems.OUTPUT_CHEST, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {SlimefunItems.LEAD_INGOT, new ItemStack(Material.HOPPER), SlimefunItems.LEAD_INGOT, SlimefunItems.LEAD_INGOT, new ItemStack(Material.CHEST), SlimefunItems.LEAD_INGOT, null, SlimefunItems.LEAD_INGOT, null}) .register(plugin); - + new EnhancedCraftingTable(itemGroups.basicMachines, SlimefunItems.ENHANCED_CRAFTING_TABLE).register(plugin); new PortableDustbin(itemGroups.usefulItems, SlimefunItems.PORTABLE_DUSTBIN, RecipeType.ENHANCED_CRAFTING_TABLE, @@ -299,14 +300,14 @@ public static void setup(@Nonnull Slimefun plugin) { new GrindStone(itemGroups.basicMachines, SlimefunItems.GRIND_STONE).register(plugin); new ArmorForge(itemGroups.basicMachines, SlimefunItems.ARMOR_FORGE).register(plugin); - + OreCrusher oreCrusher = new OreCrusher(itemGroups.basicMachines, SlimefunItems.ORE_CRUSHER); oreCrusher.register(plugin); - + new Compressor(itemGroups.basicMachines, SlimefunItems.COMPRESSOR).register(plugin); new SlimefunItem(itemGroups.magicalResources, SlimefunItems.MAGIC_LUMP_1, RecipeType.GRIND_STONE, - new ItemStack[] {new ItemStack(Material.NETHER_WART), null, null, null, null, null, null, null, null}, + new ItemStack[] {new ItemStack(Material.NETHER_WART), null, null, null, null, null, null, null, null}, new SlimefunItemStack(SlimefunItems.MAGIC_LUMP_1, 2)) .register(plugin); @@ -378,7 +379,7 @@ public static void setup(@Nonnull Slimefun plugin) { new LongFallBoots(itemGroups.magicalArmor, SlimefunItems.SLIME_BOOTS, RecipeType.ARMOR_FORGE, new ItemStack[] {null, null, null, new ItemStack(Material.SLIME_BALL), null, new ItemStack(Material.SLIME_BALL), new ItemStack(Material.IRON_INGOT), null, new ItemStack(Material.IRON_INGOT)}, - new PotionEffect[] {new PotionEffect(PotionEffectType.JUMP, 300, 5)}, + new PotionEffect[] {new PotionEffect(VersionedPotionEffectType.JUMP_BOOST, 300, 5)}, SoundEffect.SLIME_BOOTS_FALL_SOUND) .register(plugin); @@ -416,11 +417,11 @@ public static void setup(@Nonnull Slimefun plugin) { new MakeshiftSmeltery(itemGroups.basicMachines, SlimefunItems.MAKESHIFT_SMELTERY).register(plugin); new Smeltery(itemGroups.basicMachines, SlimefunItems.SMELTERY).register(plugin); - + new IgnitionChamber(itemGroups.basicMachines, SlimefunItems.IGNITION_CHAMBER, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {new ItemStack(Material.IRON_INGOT), new ItemStack(Material.FLINT_AND_STEEL), new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT), SlimefunItems.BASIC_CIRCUIT_BOARD, new ItemStack(Material.IRON_INGOT), null, new ItemStack(Material.OBSERVER), null}) .register(plugin); - + new PressureChamber(itemGroups.basicMachines, SlimefunItems.PRESSURE_CHAMBER).register(plugin); new UnplaceableBlock(itemGroups.technicalComponents, SlimefunItems.BATTERY, RecipeType.ENHANCED_CRAFTING_TABLE, @@ -429,9 +430,9 @@ public static void setup(@Nonnull Slimefun plugin) { registerArmorSet(itemGroups.magicalArmor, new ItemStack(Material.GLOWSTONE), new ItemStack[] {SlimefunItems.GLOWSTONE_HELMET, SlimefunItems.GLOWSTONE_CHESTPLATE, SlimefunItems.GLOWSTONE_LEGGINGS, SlimefunItems.GLOWSTONE_BOOTS}, "GLOWSTONE", false, new PotionEffect[][] { - new PotionEffect[] {new PotionEffect(PotionEffectType.NIGHT_VISION, 600, 0)}, - new PotionEffect[] {new PotionEffect(PotionEffectType.NIGHT_VISION, 600, 0)}, - new PotionEffect[] {new PotionEffect(PotionEffectType.NIGHT_VISION, 600, 0)}, + new PotionEffect[] {new PotionEffect(PotionEffectType.NIGHT_VISION, 600, 0)}, + new PotionEffect[] {new PotionEffect(PotionEffectType.NIGHT_VISION, 600, 0)}, + new PotionEffect[] {new PotionEffect(PotionEffectType.NIGHT_VISION, 600, 0)}, new PotionEffect[] {new PotionEffect(PotionEffectType.NIGHT_VISION, 600, 0)} }, plugin); @@ -551,12 +552,12 @@ public static void setup(@Nonnull Slimefun plugin) { .register(plugin); new SlimefunItem(itemGroups.resources, SlimefunItems.IRON_DUST, RecipeType.ORE_CRUSHER, - new ItemStack[] {new ItemStack(Material.IRON_ORE), null, null, null, null, null, null, null, null}, + new ItemStack[] {new ItemStack(Material.IRON_ORE), null, null, null, null, null, null, null, null}, new SlimefunItemStack(SlimefunItems.IRON_DUST, oreCrusher.isOreDoublingEnabled() ? 2 : 1)) .register(plugin); new SlimefunItem(itemGroups.resources, SlimefunItems.GOLD_DUST, RecipeType.ORE_CRUSHER, - new ItemStack[] {new ItemStack(Material.GOLD_ORE), null, null, null, null, null, null, null, null}, + new ItemStack[] {new ItemStack(Material.GOLD_ORE), null, null, null, null, null, null, null, null}, new SlimefunItemStack(SlimefunItems.GOLD_DUST, oreCrusher.isOreDoublingEnabled() ? 2 : 1)) .register(plugin); @@ -571,7 +572,7 @@ public static void setup(@Nonnull Slimefun plugin) { new SlimefunItem(itemGroups.resources, SlimefunItems.SILVER_DUST, RecipeType.ORE_WASHER, new ItemStack[] {SlimefunItems.SIFTED_ORE, null, null, null, null, null, null, null, null}) .register(plugin); - + new SlimefunItem(itemGroups.resources, SlimefunItems.LEAD_DUST, RecipeType.ORE_WASHER, new ItemStack[] {SlimefunItems.SIFTED_ORE, null, null, null, null, null, null, null, null}) .register(plugin); @@ -693,12 +694,12 @@ public static void setup(@Nonnull Slimefun plugin) { .register(plugin); new HologramProjector(itemGroups.technicalGadgets, SlimefunItems.HOLOGRAM_PROJECTOR, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {null, SlimefunItems.POWER_CRYSTAL, null, SlimefunItems.ALUMINUM_BRASS_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ALUMINUM_BRASS_INGOT, null, SlimefunItems.ALUMINUM_BRASS_INGOT, null}, + new ItemStack[] {null, SlimefunItems.POWER_CRYSTAL, null, SlimefunItems.ALUMINUM_BRASS_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ALUMINUM_BRASS_INGOT, null, SlimefunItems.ALUMINUM_BRASS_INGOT, null}, new SlimefunItemStack(SlimefunItems.HOLOGRAM_PROJECTOR, 3)) .register(plugin); new UnplaceableBlock(itemGroups.misc, SlimefunItems.CHAIN, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {null, null, SlimefunItems.STEEL_INGOT, null, SlimefunItems.STEEL_INGOT, null, SlimefunItems.STEEL_INGOT, null, null}, + new ItemStack[] {null, null, SlimefunItems.STEEL_INGOT, null, SlimefunItems.STEEL_INGOT, null, SlimefunItems.STEEL_INGOT, null, null}, new SlimefunItemStack(SlimefunItems.CHAIN, 8)) .register(plugin); @@ -723,11 +724,11 @@ public static void setup(@Nonnull Slimefun plugin) { new WaterStaff(itemGroups.magicalGadgets, SlimefunItems.STAFF_WATER, RecipeType.MAGIC_WORKBENCH, new ItemStack[] {null, new ItemStack(Material.LILY_PAD), SlimefunItems.MAGIC_LUMP_2, null, SlimefunItems.STAFF_ELEMENTAL, new ItemStack(Material.LILY_PAD), SlimefunItems.STAFF_ELEMENTAL, null, null}) .register(plugin); - + new EnchantedItem(itemGroups.magicalGadgets, SlimefunItems.STAFF_FIRE, RecipeType.MAGIC_WORKBENCH, new ItemStack[] {null, null, SlimefunItems.LAVA_CRYSTAL, null, SlimefunItems.STAFF_ELEMENTAL, null, SlimefunItems.STAFF_ELEMENTAL, null, null}) - .register(plugin); - + .register(plugin); + String[] multiToolItems = new String[] {"PORTABLE_CRAFTER", "MAGIC_EYE_OF_ENDER", "STAFF_ELEMENTAL_WIND", "GRAPPLING_HOOK"}; new MultiTool(itemGroups.technicalGadgets, SlimefunItems.DURALUMIN_MULTI_TOOL, RecipeType.ENHANCED_CRAFTING_TABLE, @@ -832,14 +833,18 @@ public static void setup(@Nonnull Slimefun plugin) { new UnplaceableBlock(itemGroups.magicalResources, SlimefunItems.LAVA_CRYSTAL, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {SlimefunItems.MAGIC_LUMP_1, new ItemStack(Material.BLAZE_POWDER), SlimefunItems.MAGIC_LUMP_1, new ItemStack(Material.BLAZE_POWDER), SlimefunItems.FIRE_RUNE, new ItemStack(Material.BLAZE_POWDER), SlimefunItems.MAGIC_LUMP_1, new ItemStack(Material.BLAZE_POWDER), SlimefunItems.MAGIC_LUMP_1}) .register(plugin); - + new StormStaff(itemGroups.magicalGadgets, SlimefunItems.STAFF_STORM, RecipeType.ANCIENT_ALTAR, new ItemStack[] {SlimefunItems.LIGHTNING_RUNE, SlimefunItems.ENDER_LUMP_3, SlimefunItems.LIGHTNING_RUNE, SlimefunItems.STAFF_WATER, SlimefunItems.MAGIC_SUGAR, SlimefunItems.STAFF_WIND, SlimefunItems.LIGHTNING_RUNE, SlimefunItems.ENDER_LUMP_3, SlimefunItems.LIGHTNING_RUNE}) .register(plugin); ItemStack weaknessPotion = new ItemStack(Material.POTION); PotionMeta meta = (PotionMeta) weaknessPotion.getItemMeta(); - meta.setBasePotionData(new PotionData(PotionType.WEAKNESS, false, false)); + if (Slimefun.getMinecraftVersion().isBefore(20, 2)) { + meta.setBasePotionData(new PotionData(PotionType.WEAKNESS, false, false)); + } else { + meta.setBasePotionType(PotionType.WEAKNESS); + } weaknessPotion.setItemMeta(meta); new MagicalZombiePills(itemGroups.magicalGadgets, SlimefunItems.MAGICAL_ZOMBIE_PILLS, RecipeType.MAGIC_WORKBENCH, @@ -907,7 +912,7 @@ public static void setup(@Nonnull Slimefun plugin) { new Talisman(SlimefunItems.TALISMAN_WARRIOR, new ItemStack[] {SlimefunItems.MAGIC_LUMP_3, null, SlimefunItems.MAGIC_LUMP_3, SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.COMMON_TALISMAN, SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.MAGIC_LUMP_3, null, SlimefunItems.MAGIC_LUMP_3}, - true, true, "warrior", new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 3600, 2)) + true, true, "warrior", new PotionEffect(VersionedPotionEffectType.STRENGTH, 3600, 2)) .register(plugin); new Talisman(SlimefunItems.TALISMAN_KNIGHT, @@ -917,7 +922,7 @@ public static void setup(@Nonnull Slimefun plugin) { new Talisman(SlimefunItems.TALISMAN_CAVEMAN, new ItemStack[] { SlimefunItems.MAGIC_LUMP_3, null, SlimefunItems.MAGIC_LUMP_3, new ItemStack(Material.GOLDEN_PICKAXE), SlimefunItems.TALISMAN_MINER, SlimefunItems.EARTH_RUNE, SlimefunItems.MAGIC_LUMP_3, null, SlimefunItems.MAGIC_LUMP_3}, - false, false, "caveman", 50, new PotionEffect(PotionEffectType.FAST_DIGGING, 800, 2)) + false, false, "caveman", 50, new PotionEffect(VersionedPotionEffectType.HASTE, 800, 2)) .register(plugin); new Talisman(SlimefunItems.TALISMAN_WISE, @@ -946,7 +951,7 @@ public static void setup(@Nonnull Slimefun plugin) { new ItemStack[] {SlimefunItems.ENDER_LUMP_3, null, SlimefunItems.ENDER_LUMP_3, SlimefunItems.MAGIC_EYE_OF_ENDER, SlimefunItems.TALISMAN_MAGICIAN, SlimefunItems.MAGIC_EYE_OF_ENDER, SlimefunItems.ENDER_LUMP_3, null, SlimefunItems.ENDER_LUMP_3}, false, false, "wizard", 60) .register(plugin); - + new LumberAxe(itemGroups.tools, SlimefunItems.LUMBER_AXE, RecipeType.MAGIC_WORKBENCH, new ItemStack[] {SlimefunItems.SYNTHETIC_DIAMOND, SlimefunItems.SYNTHETIC_DIAMOND, null, SlimefunItems.SYNTHETIC_EMERALD, SlimefunItems.GILDED_IRON, null, null, SlimefunItems.GILDED_IRON, null}) .register(plugin); @@ -956,7 +961,7 @@ public static void setup(@Nonnull Slimefun plugin) { .register(plugin); new HeavyCream(itemGroups.misc, SlimefunItems.HEAVY_CREAM, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {new ItemStack(Material.MILK_BUCKET), null, null, null, null, null, null, null, null}, + new ItemStack[] {new ItemStack(Material.MILK_BUCKET), null, null, null, null, null, null, null, null}, new SlimefunItemStack(SlimefunItems.HEAVY_CREAM, 2)) .register(plugin); @@ -971,7 +976,7 @@ public static void setup(@Nonnull Slimefun plugin) { registerArmorSet(itemGroups.armor, SlimefunItems.GILDED_IRON, new ItemStack[] { SlimefunItems.GILDED_IRON_HELMET, SlimefunItems.GILDED_IRON_CHESTPLATE, SlimefunItems.GILDED_IRON_LEGGINGS, SlimefunItems.GILDED_IRON_BOOTS }, "GILDED_IRON", false, new PotionEffect[0][0], plugin); - + new SlimefunItem(itemGroups.technicalComponents, SlimefunItems.REINFORCED_CLOTH, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {null, SlimefunItems.CLOTH, null, SlimefunItems.CLOTH, SlimefunItems.LEAD_INGOT, SlimefunItems.CLOTH, null, SlimefunItems.CLOTH, null}, new SlimefunItemStack(SlimefunItems.REINFORCED_CLOTH, 2)) .register(plugin); @@ -1027,7 +1032,7 @@ public static void setup(@Nonnull Slimefun plugin) { }, "GOLD_12K", false, new PotionEffect[0][0], plugin); new SlimefunItem(itemGroups.misc, SlimefunItems.CLOTH, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {new ItemStack(Material.WHITE_WOOL), null, null, null, null, null, null, null, null}, + new ItemStack[] {new ItemStack(Material.WHITE_WOOL), null, null, null, null, null, null, null, null}, new SlimefunItemStack(SlimefunItems.CLOTH, 8)) .register(plugin); @@ -1037,17 +1042,17 @@ public static void setup(@Nonnull Slimefun plugin) { .register(plugin); new Bandage(itemGroups.usefulItems, SlimefunItems.BANDAGE, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {SlimefunItems.RAG, new ItemStack(Material.STRING), SlimefunItems.RAG, null, null, null, null, null, null}, + new ItemStack[] {SlimefunItems.RAG, new ItemStack(Material.STRING), SlimefunItems.RAG, null, null, null, null, null, null}, new SlimefunItemStack(SlimefunItems.BANDAGE, 4), 1) .register(plugin); new Splint(itemGroups.usefulItems, SlimefunItems.SPLINT, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {null, new ItemStack(Material.IRON_INGOT), null, new ItemStack(Material.STICK), new ItemStack(Material.STICK), new ItemStack(Material.STICK), null, new ItemStack(Material.IRON_INGOT), null}, + new ItemStack[] {null, new ItemStack(Material.IRON_INGOT), null, new ItemStack(Material.STICK), new ItemStack(Material.STICK), new ItemStack(Material.STICK), null, new ItemStack(Material.IRON_INGOT), null}, new SlimefunItemStack(SlimefunItems.SPLINT, 4)) .register(plugin); new UnplaceableBlock(itemGroups.misc, SlimefunItems.TIN_CAN, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT, null, SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT}, + new ItemStack[] {SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT, null, SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT}, new SlimefunItemStack(SlimefunItems.TIN_CAN, 8)) .register(plugin); @@ -1067,7 +1072,7 @@ public static void setup(@Nonnull Slimefun plugin) { new PickaxeOfContainment(itemGroups.tools, SlimefunItems.PICKAXE_OF_CONTAINMENT, RecipeType.MAGIC_WORKBENCH, new ItemStack[] {SlimefunItems.FERROSILICON, SlimefunItems.FERROSILICON, SlimefunItems.FERROSILICON, null, SlimefunItems.GILDED_IRON, null, null, SlimefunItems.GILDED_IRON, null}) .register(plugin); - + new TableSaw(itemGroups.basicMachines, SlimefunItems.TABLE_SAW).register(plugin); new SlimefunArmorPiece(itemGroups.magicalArmor, SlimefunItems.SLIME_HELMET_STEEL, RecipeType.ARMOR_FORGE, @@ -1085,7 +1090,7 @@ public static void setup(@Nonnull Slimefun plugin) { new LongFallBoots(itemGroups.magicalArmor, SlimefunItems.SLIME_BOOTS_STEEL, RecipeType.ARMOR_FORGE, new ItemStack[] {null, null, null, new ItemStack(Material.SLIME_BALL), null, new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), SlimefunItems.STEEL_PLATE, new ItemStack(Material.SLIME_BALL)}, - new PotionEffect[] {new PotionEffect(PotionEffectType.JUMP, 300, 5)}, + new PotionEffect[] {new PotionEffect(VersionedPotionEffectType.JUMP_BOOST, 300, 5)}, SoundEffect.SLIME_BOOTS_FALL_SOUND) .register(plugin); @@ -1104,7 +1109,7 @@ public static void setup(@Nonnull Slimefun plugin) { new FarmerShoes(itemGroups.magicalArmor, SlimefunItems.FARMER_SHOES, RecipeType.ARMOR_FORGE, new ItemStack[] {null, null, null, new ItemStack(Material.HAY_BLOCK), null, new ItemStack(Material.HAY_BLOCK), new ItemStack(Material.HAY_BLOCK), null, new ItemStack(Material.HAY_BLOCK)}) .register(plugin); - + new ExplosivePickaxe(itemGroups.tools, SlimefunItems.EXPLOSIVE_PICKAXE, RecipeType.MAGIC_WORKBENCH, new ItemStack[] {new ItemStack(Material.TNT), SlimefunItems.SYNTHETIC_DIAMOND, new ItemStack(Material.TNT), null, SlimefunItems.FERROSILICON, null, null, SlimefunItems.FERROSILICON, null}) .register(plugin); @@ -1114,7 +1119,7 @@ public static void setup(@Nonnull Slimefun plugin) { .register(plugin); new AutomatedPanningMachine(itemGroups.basicMachines, SlimefunItems.AUTOMATED_PANNING_MACHINE).register(plugin); - + new IndustrialMiner(itemGroups.basicMachines, SlimefunItems.INDUSTRIAL_MINER, Material.IRON_BLOCK, false, 3).register(plugin); new AdvancedIndustrialMiner(itemGroups.basicMachines, SlimefunItems.ADVANCED_INDUSTRIAL_MINER).register(plugin); @@ -1232,7 +1237,7 @@ public static void setup(@Nonnull Slimefun plugin) { new PickaxeOfVeinMining(itemGroups.tools, SlimefunItems.PICKAXE_OF_VEIN_MINING, RecipeType.MAGIC_WORKBENCH, new ItemStack[] {new ItemStack(Material.EMERALD_ORE), SlimefunItems.SYNTHETIC_DIAMOND, new ItemStack(Material.EMERALD_ORE), null, SlimefunItems.GILDED_IRON, null, null, SlimefunItems.GILDED_IRON, null}) .register(plugin); - + new ClimbingPick(itemGroups.tools, SlimefunItems.CLIMBING_PICK, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {SlimefunItems.STEEL_INGOT, SlimefunItems.HARDENED_METAL_INGOT, SlimefunItems.STEEL_INGOT, null, new ItemStack(Material.STICK), null, null, new ItemStack(Material.STICK), null}) .register(plugin); @@ -1240,7 +1245,7 @@ public static void setup(@Nonnull Slimefun plugin) { new SoulboundItem(itemGroups.weapons, SlimefunItems.SOULBOUND_SWORD, RecipeType.MAGIC_WORKBENCH, new ItemStack[] {null, SlimefunItems.ESSENCE_OF_AFTERLIFE, null, null, new ItemStack(Material.DIAMOND_SWORD), null, null, SlimefunItems.ESSENCE_OF_AFTERLIFE, null}) .register(plugin); - + new SoulboundItem(itemGroups.weapons, SlimefunItems.SOULBOUND_TRIDENT, RecipeType.MAGIC_WORKBENCH, new ItemStack[] {null, SlimefunItems.ESSENCE_OF_AFTERLIFE, null, null, new ItemStack(Material.TRIDENT), null, null, SlimefunItems.ESSENCE_OF_AFTERLIFE, null}) .register(plugin); @@ -1384,10 +1389,10 @@ public static void setup(@Nonnull Slimefun plugin) { .register(plugin); new UnplaceableBlock(itemGroups.technicalComponents, SlimefunItems.COPPER_WIRE, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {null, null, null, SlimefunItems.COPPER_INGOT, SlimefunItems.COPPER_INGOT, SlimefunItems.COPPER_INGOT, null, null, null}, + new ItemStack[] {null, null, null, SlimefunItems.COPPER_INGOT, SlimefunItems.COPPER_INGOT, SlimefunItems.COPPER_INGOT, null, null, null}, new SlimefunItemStack(SlimefunItems.COPPER_WIRE, 8)) .register(plugin); - + new BlockPlacer(itemGroups.basicMachines, SlimefunItems.BLOCK_PLACER, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {SlimefunItems.GOLD_4K, new ItemStack(Material.PISTON), SlimefunItems.GOLD_4K, new ItemStack(Material.IRON_INGOT), SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.IRON_INGOT), SlimefunItems.GOLD_4K, new ItemStack(Material.PISTON), SlimefunItems.GOLD_4K}) .register(plugin); @@ -1409,7 +1414,7 @@ public static void setup(@Nonnull Slimefun plugin) { .register(plugin); new KnowledgeFlask(itemGroups.magicalGadgets, SlimefunItems.FLASK_OF_KNOWLEDGE, RecipeType.MAGIC_WORKBENCH, - new ItemStack[] {null, null, null, SlimefunItems.MAGIC_LUMP_2, new ItemStack(Material.GLASS_PANE), SlimefunItems.MAGIC_LUMP_2, null, SlimefunItems.MAGIC_LUMP_2, null}, + new ItemStack[] {null, null, null, SlimefunItems.MAGIC_LUMP_2, new ItemStack(Material.GLASS_PANE), SlimefunItems.MAGIC_LUMP_2, null, SlimefunItems.MAGIC_LUMP_2, null}, new SlimefunItemStack(SlimefunItems.FLASK_OF_KNOWLEDGE, 8)) .register(plugin); @@ -1422,37 +1427,37 @@ public static void setup(@Nonnull Slimefun plugin) { .register(plugin); new Juice(itemGroups.christmas, SlimefunItems.CHRISTMAS_MILK, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {new ItemStack(Material.MILK_BUCKET), new ItemStack(Material.GLASS_BOTTLE), null, null, null, null, null, null, null}, + new ItemStack[] {new ItemStack(Material.MILK_BUCKET), new ItemStack(Material.GLASS_BOTTLE), null, null, null, null, null, null, null}, new SlimefunItemStack(SlimefunItems.CHRISTMAS_MILK, 4)) .register(plugin); new Juice(itemGroups.christmas, SlimefunItems.CHRISTMAS_CHOCOLATE_MILK, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {SlimefunItems.CHRISTMAS_MILK, new ItemStack(Material.COCOA_BEANS), null, null, null, null, null, null, null}, + new ItemStack[] {SlimefunItems.CHRISTMAS_MILK, new ItemStack(Material.COCOA_BEANS), null, null, null, null, null, null, null}, new SlimefunItemStack(SlimefunItems.CHRISTMAS_CHOCOLATE_MILK, 2)) .register(plugin); new Juice(itemGroups.christmas, SlimefunItems.CHRISTMAS_EGG_NOG, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {SlimefunItems.CHRISTMAS_MILK, new ItemStack(Material.EGG), null, null, null, null, null, null, null}, + new ItemStack[] {SlimefunItems.CHRISTMAS_MILK, new ItemStack(Material.EGG), null, null, null, null, null, null, null}, new SlimefunItemStack(SlimefunItems.CHRISTMAS_EGG_NOG, 2)) .register(plugin); new Juice(itemGroups.christmas, SlimefunItems.CHRISTMAS_APPLE_CIDER, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {SlimefunItems.APPLE_JUICE, new ItemStack(Material.SUGAR), null, null, null, null, null, null, null}, + new ItemStack[] {SlimefunItems.APPLE_JUICE, new ItemStack(Material.SUGAR), null, null, null, null, null, null, null}, new SlimefunItemStack(SlimefunItems.CHRISTMAS_APPLE_CIDER, 2)) .register(plugin); new SlimefunItem(itemGroups.christmas, SlimefunItems.CHRISTMAS_COOKIE, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {new ItemStack(Material.COOKIE), new ItemStack(Material.SUGAR), new ItemStack(Material.LIME_DYE), null, null, null, null, null, null}, + new ItemStack[] {new ItemStack(Material.COOKIE), new ItemStack(Material.SUGAR), new ItemStack(Material.LIME_DYE), null, null, null, null, null, null}, new SlimefunItemStack(SlimefunItems.CHRISTMAS_COOKIE, 16)) .register(plugin); new SlimefunItem(itemGroups.christmas, SlimefunItems.CHRISTMAS_FRUIT_CAKE, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {new ItemStack(Material.EGG), new ItemStack(Material.APPLE), new ItemStack(Material.MELON), new ItemStack(Material.SUGAR), null, null, null, null, null}, + new ItemStack[] {new ItemStack(Material.EGG), new ItemStack(Material.APPLE), new ItemStack(Material.MELON), new ItemStack(Material.SUGAR), null, null, null, null, null}, new SlimefunItemStack(SlimefunItems.CHRISTMAS_FRUIT_CAKE, 4)) .register(plugin); new SlimefunItem(itemGroups.christmas, SlimefunItems.CHRISTMAS_APPLE_PIE, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {new ItemStack(Material.SUGAR), new ItemStack(Material.APPLE), new ItemStack(Material.EGG), null, null, null, null, null, null}, + new ItemStack[] {new ItemStack(Material.SUGAR), new ItemStack(Material.APPLE), new ItemStack(Material.EGG), null, null, null, null, null, null}, new SlimefunItemStack(SlimefunItems.CHRISTMAS_APPLE_PIE, 2)) .register(plugin); @@ -1461,22 +1466,22 @@ public static void setup(@Nonnull Slimefun plugin) { .register(plugin); new SlimefunItem(itemGroups.christmas, SlimefunItems.CHRISTMAS_CAKE, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {new ItemStack(Material.EGG), new ItemStack(Material.SUGAR), SlimefunItems.WHEAT_FLOUR, new ItemStack(Material.MILK_BUCKET), null, null, null, null, null}, + new ItemStack[] {new ItemStack(Material.EGG), new ItemStack(Material.SUGAR), SlimefunItems.WHEAT_FLOUR, new ItemStack(Material.MILK_BUCKET), null, null, null, null, null}, new SlimefunItemStack(SlimefunItems.CHRISTMAS_CAKE, 4)) .register(plugin); new SlimefunItem(itemGroups.christmas, SlimefunItems.CHRISTMAS_CARAMEL, RecipeType.SMELTERY, - new ItemStack[] {new ItemStack(Material.SUGAR), new ItemStack(Material.SUGAR), null, null, null, null, null, null, null}, + new ItemStack[] {new ItemStack(Material.SUGAR), new ItemStack(Material.SUGAR), null, null, null, null, null, null, null}, new SlimefunItemStack(SlimefunItems.CHRISTMAS_CARAMEL, 4)) .register(plugin); new SlimefunItem(itemGroups.christmas, SlimefunItems.CHRISTMAS_CARAMEL_APPLE, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {null, SlimefunItems.CHRISTMAS_CARAMEL, null, null, new ItemStack(Material.APPLE), null, null, new ItemStack(Material.STICK), null}, + new ItemStack[] {null, SlimefunItems.CHRISTMAS_CARAMEL, null, null, new ItemStack(Material.APPLE), null, null, new ItemStack(Material.STICK), null}, new SlimefunItemStack(SlimefunItems.CHRISTMAS_CARAMEL_APPLE, 2)) .register(plugin); new SlimefunItem(itemGroups.christmas, SlimefunItems.CHRISTMAS_CHOCOLATE_APPLE, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {null, new ItemStack(Material.COCOA_BEANS), null, null, new ItemStack(Material.APPLE), null, null, new ItemStack(Material.STICK), null}, + new ItemStack[] {null, new ItemStack(Material.COCOA_BEANS), null, null, new ItemStack(Material.APPLE), null, null, new ItemStack(Material.STICK), null}, new SlimefunItemStack(SlimefunItems.CHRISTMAS_CHOCOLATE_APPLE, 2)) .register(plugin); @@ -1497,17 +1502,17 @@ public static void setup(@Nonnull Slimefun plugin) { ).register(plugin); new SlimefunItem(itemGroups.easter, SlimefunItems.EASTER_CARROT_PIE, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {new ItemStack(Material.SUGAR), new ItemStack(Material.CARROT), new ItemStack(Material.EGG), null, null, null, null, null, null}, + new ItemStack[] {new ItemStack(Material.SUGAR), new ItemStack(Material.CARROT), new ItemStack(Material.EGG), null, null, null, null, null, null}, new SlimefunItemStack(SlimefunItems.EASTER_CARROT_PIE, 2)) .register(plugin); new SlimefunItem(itemGroups.easter, SlimefunItems.EASTER_APPLE_PIE, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {new ItemStack(Material.SUGAR), new ItemStack(Material.APPLE), new ItemStack(Material.EGG), null, null, null, null, null, null}, + new ItemStack[] {new ItemStack(Material.SUGAR), new ItemStack(Material.APPLE), new ItemStack(Material.EGG), null, null, null, null, null, null}, new SlimefunItemStack(SlimefunItems.EASTER_APPLE_PIE, 2)) .register(plugin); new EasterEgg(itemGroups.easter, SlimefunItems.EASTER_EGG, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {null, null, null, new ItemStack(Material.LIME_DYE), new ItemStack(Material.EGG), new ItemStack(Material.PURPLE_DYE), null, null, null}, + new ItemStack[] {null, null, null, new ItemStack(Material.LIME_DYE), new ItemStack(Material.EGG), new ItemStack(Material.PURPLE_DYE), null, null, null}, new SlimefunItemStack(SlimefunItems.EASTER_EGG, 2), // Gifts: new SlimefunItemStack(SlimefunItems.EASTER_CARROT_PIE, 4), @@ -1543,7 +1548,7 @@ public static void setup(@Nonnull Slimefun plugin) { .register(plugin); new AncientPedestal(itemGroups.magicalGadgets, SlimefunItems.ANCIENT_PEDESTAL, RecipeType.MAGIC_WORKBENCH, - new ItemStack[] {new ItemStack(Material.OBSIDIAN), SlimefunItems.GOLD_8K, new ItemStack(Material.OBSIDIAN), null, new ItemStack(Material.STONE), null, new ItemStack(Material.OBSIDIAN), SlimefunItems.GOLD_8K, new ItemStack(Material.OBSIDIAN)}, + new ItemStack[] {new ItemStack(Material.OBSIDIAN), SlimefunItems.GOLD_8K, new ItemStack(Material.OBSIDIAN), null, new ItemStack(Material.STONE), null, new ItemStack(Material.OBSIDIAN), SlimefunItems.GOLD_8K, new ItemStack(Material.OBSIDIAN)}, new SlimefunItemStack(SlimefunItems.ANCIENT_PEDESTAL, 4)) .register(plugin); @@ -1561,7 +1566,7 @@ public static void setup(@Nonnull Slimefun plugin) { .register(plugin); new SlimefunItem(itemGroups.misc, SlimefunItems.DUCT_TAPE, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {SlimefunItems.ALUMINUM_DUST, SlimefunItems.ALUMINUM_DUST, SlimefunItems.ALUMINUM_DUST, new ItemStack(Material.SLIME_BALL), new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.PAPER), new ItemStack(Material.PAPER), new ItemStack(Material.PAPER)}, + new ItemStack[] {SlimefunItems.ALUMINUM_DUST, SlimefunItems.ALUMINUM_DUST, SlimefunItems.ALUMINUM_DUST, new ItemStack(Material.SLIME_BALL), new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.PAPER), new ItemStack(Material.PAPER), new ItemStack(Material.PAPER)}, new SlimefunItemStack(SlimefunItems.DUCT_TAPE, 2)) .register(plugin); @@ -1604,7 +1609,7 @@ public static void setup(@Nonnull Slimefun plugin) { new SolarGenerator(itemGroups.electricity, 128, 64, SlimefunItems.SOLAR_GENERATOR_4, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {SlimefunItems.SOLAR_GENERATOR_3, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.SOLAR_GENERATOR_3, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.SOLAR_GENERATOR_3, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.SOLAR_GENERATOR_3}) .register(plugin); - + new ChargingBench(itemGroups.electricity, SlimefunItems.CHARGING_BENCH, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {null, SlimefunItems.ELECTRO_MAGNET, null, SlimefunItems.BATTERY, new ItemStack(Material.CRAFTING_TABLE), SlimefunItems.BATTERY, null, SlimefunItems.SMALL_CAPACITOR, null}) .setCapacity(128) @@ -1804,11 +1809,11 @@ public static void setup(@Nonnull Slimefun plugin) { .setEnergyConsumption(20) .setProcessingSpeed(3) .register(plugin); - + new SlimefunItem(itemGroups.resources, SlimefunItems.MAGNESIUM_SALT, RecipeType.HEATED_PRESSURE_CHAMBER, new ItemStack[] {SlimefunItems.MAGNESIUM_DUST, SlimefunItems.SALT, null, null, null, null, null, null, null}) .register(plugin); - + new MagnesiumGenerator(itemGroups.electricity, SlimefunItems.MAGNESIUM_GENERATOR, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {null, SlimefunItems.ELECTRIC_MOTOR, null, SlimefunItems.COMPRESSED_CARBON, new ItemStack(Material.WATER_BUCKET), SlimefunItems.COMPRESSED_CARBON, SlimefunItems.DURALUMIN_INGOT, SlimefunItems.DURALUMIN_INGOT, SlimefunItems.DURALUMIN_INGOT}) .setCapacity(128) @@ -1879,7 +1884,7 @@ public static void setup(@Nonnull Slimefun plugin) { new GPSTransmitter(itemGroups.gps, 1, SlimefunItems.GPS_TRANSMITTER, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {null, null, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.STEEL_INGOT, SlimefunItems.ADVANCED_CIRCUIT_BOARD, SlimefunItems.STEEL_INGOT, SlimefunItems.STEEL_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.STEEL_INGOT}) { - + @Override public int getMultiplier(int y) { return y; @@ -1894,7 +1899,7 @@ public int getEnergyConsumption() { new GPSTransmitter(itemGroups.gps, 2, SlimefunItems.GPS_TRANSMITTER_2, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {SlimefunItems.GPS_TRANSMITTER, SlimefunItems.BRONZE_INGOT, SlimefunItems.GPS_TRANSMITTER, SlimefunItems.BRONZE_INGOT, SlimefunItems.CARBON, SlimefunItems.BRONZE_INGOT, SlimefunItems.GPS_TRANSMITTER, SlimefunItems.BRONZE_INGOT, SlimefunItems.GPS_TRANSMITTER}) { - + @Override public int getMultiplier(int y) { return y * 4 + 100; @@ -1909,7 +1914,7 @@ public int getEnergyConsumption() { new GPSTransmitter(itemGroups.gps, 3, SlimefunItems.GPS_TRANSMITTER_3, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {SlimefunItems.GPS_TRANSMITTER_2, SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.GPS_TRANSMITTER_2, SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.CARBONADO, SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.GPS_TRANSMITTER_2, SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.GPS_TRANSMITTER_2}) { - + @Override public int getMultiplier(int y) { return y * 16 + 500; @@ -1924,7 +1929,7 @@ public int getEnergyConsumption() { new GPSTransmitter(itemGroups.gps, 4, SlimefunItems.GPS_TRANSMITTER_4, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {SlimefunItems.GPS_TRANSMITTER_3, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.GPS_TRANSMITTER_3, SlimefunItems.NICKEL_INGOT, SlimefunItems.CARBONADO, SlimefunItems.NICKEL_INGOT, SlimefunItems.GPS_TRANSMITTER_3, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.GPS_TRANSMITTER_3}) { - + @Override public int getMultiplier(int y) { return y * 64 + 2100; @@ -1934,7 +1939,7 @@ public int getMultiplier(int y) { public int getEnergyConsumption() { return 43; } - + }.register(plugin); new GPSControlPanel(itemGroups.gps, SlimefunItems.GPS_CONTROL_PANEL, RecipeType.ENHANCED_CRAFTING_TABLE, @@ -2014,32 +2019,32 @@ public int getEnergyConsumption() { .register(plugin); new ElementalRune(itemGroups.magicalResources, SlimefunItems.AIR_RUNE, - new ItemStack[] {new ItemStack(Material.FEATHER), SlimefunItems.MAGIC_LUMP_1, new ItemStack(Material.FEATHER), new ItemStack(Material.GHAST_TEAR), SlimefunItems.BLANK_RUNE, new ItemStack(Material.GHAST_TEAR), new ItemStack(Material.FEATHER), SlimefunItems.MAGIC_LUMP_1, new ItemStack(Material.FEATHER)}, + new ItemStack[] {new ItemStack(Material.FEATHER), SlimefunItems.MAGIC_LUMP_1, new ItemStack(Material.FEATHER), new ItemStack(Material.GHAST_TEAR), SlimefunItems.BLANK_RUNE, new ItemStack(Material.GHAST_TEAR), new ItemStack(Material.FEATHER), SlimefunItems.MAGIC_LUMP_1, new ItemStack(Material.FEATHER)}, new SlimefunItemStack(SlimefunItems.AIR_RUNE, 4)) .register(plugin); new ElementalRune(itemGroups.magicalResources, SlimefunItems.EARTH_RUNE, - new ItemStack[] {new ItemStack(Material.DIRT), SlimefunItems.MAGIC_LUMP_1, new ItemStack(Material.STONE), new ItemStack(Material.OBSIDIAN), SlimefunItems.BLANK_RUNE, new ItemStack(Material.OBSIDIAN), new ItemStack(Material.STONE), SlimefunItems.MAGIC_LUMP_1, new ItemStack(Material.DIRT)}, + new ItemStack[] {new ItemStack(Material.DIRT), SlimefunItems.MAGIC_LUMP_1, new ItemStack(Material.STONE), new ItemStack(Material.OBSIDIAN), SlimefunItems.BLANK_RUNE, new ItemStack(Material.OBSIDIAN), new ItemStack(Material.STONE), SlimefunItems.MAGIC_LUMP_1, new ItemStack(Material.DIRT)}, new SlimefunItemStack(SlimefunItems.EARTH_RUNE, 4)) .register(plugin); new ElementalRune(itemGroups.magicalResources, SlimefunItems.FIRE_RUNE, - new ItemStack[] {new ItemStack(Material.FIRE_CHARGE), SlimefunItems.MAGIC_LUMP_2, new ItemStack(Material.FIRE_CHARGE), new ItemStack(Material.BLAZE_POWDER), SlimefunItems.EARTH_RUNE, new ItemStack(Material.FLINT_AND_STEEL), new ItemStack(Material.FIRE_CHARGE), SlimefunItems.MAGIC_LUMP_2, new ItemStack(Material.FIRE_CHARGE)}, + new ItemStack[] {new ItemStack(Material.FIRE_CHARGE), SlimefunItems.MAGIC_LUMP_2, new ItemStack(Material.FIRE_CHARGE), new ItemStack(Material.BLAZE_POWDER), SlimefunItems.EARTH_RUNE, new ItemStack(Material.FLINT_AND_STEEL), new ItemStack(Material.FIRE_CHARGE), SlimefunItems.MAGIC_LUMP_2, new ItemStack(Material.FIRE_CHARGE)}, new SlimefunItemStack(SlimefunItems.FIRE_RUNE, 4)) .register(plugin); new ElementalRune(itemGroups.magicalResources, SlimefunItems.WATER_RUNE, - new ItemStack[] {new ItemStack(Material.SALMON), SlimefunItems.MAGIC_LUMP_2, new ItemStack(Material.WATER_BUCKET), new ItemStack(Material.SAND), SlimefunItems.BLANK_RUNE, new ItemStack(Material.SAND), new ItemStack(Material.WATER_BUCKET), SlimefunItems.MAGIC_LUMP_2, new ItemStack(Material.COD)}, + new ItemStack[] {new ItemStack(Material.SALMON), SlimefunItems.MAGIC_LUMP_2, new ItemStack(Material.WATER_BUCKET), new ItemStack(Material.SAND), SlimefunItems.BLANK_RUNE, new ItemStack(Material.SAND), new ItemStack(Material.WATER_BUCKET), SlimefunItems.MAGIC_LUMP_2, new ItemStack(Material.COD)}, new SlimefunItemStack(SlimefunItems.WATER_RUNE, 4)) .register(plugin); new ElementalRune(itemGroups.magicalResources, SlimefunItems.ENDER_RUNE, - new ItemStack[] {new ItemStack(Material.ENDER_PEARL), SlimefunItems.ENDER_LUMP_3, new ItemStack(Material.ENDER_PEARL), new ItemStack(Material.ENDER_EYE), SlimefunItems.BLANK_RUNE, new ItemStack(Material.ENDER_EYE), new ItemStack(Material.ENDER_PEARL), SlimefunItems.ENDER_LUMP_3, new ItemStack(Material.ENDER_PEARL)}, + new ItemStack[] {new ItemStack(Material.ENDER_PEARL), SlimefunItems.ENDER_LUMP_3, new ItemStack(Material.ENDER_PEARL), new ItemStack(Material.ENDER_EYE), SlimefunItems.BLANK_RUNE, new ItemStack(Material.ENDER_EYE), new ItemStack(Material.ENDER_PEARL), SlimefunItems.ENDER_LUMP_3, new ItemStack(Material.ENDER_PEARL)}, new SlimefunItemStack(SlimefunItems.ENDER_RUNE, 6)) .register(plugin); new ElementalRune(itemGroups.magicalResources, SlimefunItems.LIGHTNING_RUNE, - new ItemStack[] {new ItemStack(Material.IRON_INGOT), SlimefunItems.MAGIC_LUMP_3, new ItemStack(Material.IRON_INGOT), SlimefunItems.AIR_RUNE, new ItemStack(Material.PHANTOM_MEMBRANE), SlimefunItems.WATER_RUNE, new ItemStack(Material.IRON_INGOT), SlimefunItems.MAGIC_LUMP_3, new ItemStack(Material.IRON_INGOT)}, + new ItemStack[] {new ItemStack(Material.IRON_INGOT), SlimefunItems.MAGIC_LUMP_3, new ItemStack(Material.IRON_INGOT), SlimefunItems.AIR_RUNE, new ItemStack(Material.PHANTOM_MEMBRANE), SlimefunItems.WATER_RUNE, new ItemStack(Material.IRON_INGOT), SlimefunItems.MAGIC_LUMP_3, new ItemStack(Material.IRON_INGOT)}, new SlimefunItemStack(SlimefunItems.LIGHTNING_RUNE, 4)) .register(plugin); @@ -2056,7 +2061,7 @@ public int getEnergyConsumption() { .register(plugin); new InfernalBonemeal(itemGroups.magicalGadgets, SlimefunItems.INFERNAL_BONEMEAL, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.NETHER_WART), SlimefunItems.EARTH_RUNE, new ItemStack(Material.NETHER_WART), SlimefunItems.MAGIC_LUMP_2, new ItemStack(Material.BONE_MEAL), SlimefunItems.MAGIC_LUMP_2, new ItemStack(Material.NETHER_WART), new ItemStack(Material.BLAZE_POWDER), new ItemStack(Material.NETHER_WART)}, + new ItemStack[] {new ItemStack(Material.NETHER_WART), SlimefunItems.EARTH_RUNE, new ItemStack(Material.NETHER_WART), SlimefunItems.MAGIC_LUMP_2, new ItemStack(Material.BONE_MEAL), SlimefunItems.MAGIC_LUMP_2, new ItemStack(Material.NETHER_WART), new ItemStack(Material.BLAZE_POWDER), new ItemStack(Material.NETHER_WART)}, new SlimefunItemStack(SlimefunItems.INFERNAL_BONEMEAL, 8)) .register(plugin); @@ -2085,133 +2090,133 @@ public int getEnergyConsumption() { .register(plugin); new RainbowBlock(itemGroups.magicalGadgets, SlimefunItems.RAINBOW_WOOL, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.WHITE_WOOL)}, + new ItemStack[] {new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.WHITE_WOOL)}, new SlimefunItemStack(SlimefunItems.RAINBOW_WOOL, 8), new RainbowTickHandler(ColoredMaterial.WOOL)) .register(plugin); new RainbowBlock(itemGroups.magicalGadgets, SlimefunItems.RAINBOW_GLASS, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.WHITE_STAINED_GLASS), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.WHITE_STAINED_GLASS)}, + new ItemStack[] {new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.WHITE_STAINED_GLASS), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.WHITE_STAINED_GLASS)}, new SlimefunItemStack(SlimefunItems.RAINBOW_GLASS, 8), new RainbowTickHandler(ColoredMaterial.STAINED_GLASS)) .register(plugin); new RainbowBlock(itemGroups.magicalGadgets, SlimefunItems.RAINBOW_GLASS_PANE, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE)}, + new ItemStack[] {new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE)}, new SlimefunItemStack(SlimefunItems.RAINBOW_GLASS_PANE, 8), new RainbowTickHandler(ColoredMaterial.STAINED_GLASS_PANE)) .register(plugin); new RainbowBlock(itemGroups.magicalGadgets, SlimefunItems.RAINBOW_CLAY, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.WHITE_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.WHITE_TERRACOTTA)}, + new ItemStack[] {new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.WHITE_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.WHITE_TERRACOTTA)}, new SlimefunItemStack(SlimefunItems.RAINBOW_CLAY, 8), new RainbowTickHandler(ColoredMaterial.TERRACOTTA)) .register(plugin); new RainbowBlock(itemGroups.magicalGadgets, SlimefunItems.RAINBOW_CONCRETE, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.WHITE_CONCRETE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.WHITE_CONCRETE)}, + new ItemStack[] {new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.WHITE_CONCRETE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.WHITE_CONCRETE)}, new SlimefunItemStack(SlimefunItems.RAINBOW_CONCRETE, 8), new RainbowTickHandler(ColoredMaterial.CONCRETE)) .register(plugin); - + new RainbowBlock(itemGroups.magicalGadgets, SlimefunItems.RAINBOW_GLAZED_TERRACOTTA, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA)}, + new ItemStack[] {new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA)}, new SlimefunItemStack(SlimefunItems.RAINBOW_GLAZED_TERRACOTTA, 8), new RainbowTickHandler(ColoredMaterial.GLAZED_TERRACOTTA)) .register(plugin); // Christmas new RainbowBlock(itemGroups.christmas, SlimefunItems.RAINBOW_WOOL_XMAS, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.GREEN_DYE), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.RED_DYE)}, + new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.GREEN_DYE), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.RED_DYE)}, new SlimefunItemStack(SlimefunItems.RAINBOW_WOOL_XMAS, 2), new RainbowTickHandler(Material.RED_WOOL, Material.GREEN_WOOL)) .register(plugin); new RainbowBlock(itemGroups.christmas, SlimefunItems.RAINBOW_GLASS_XMAS, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.GREEN_DYE), new ItemStack(Material.WHITE_STAINED_GLASS), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.RED_DYE)}, + new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.GREEN_DYE), new ItemStack(Material.WHITE_STAINED_GLASS), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.RED_DYE)}, new SlimefunItemStack(SlimefunItems.RAINBOW_GLASS_XMAS, 2), new RainbowTickHandler(Material.RED_STAINED_GLASS, Material.GREEN_STAINED_GLASS)) .register(plugin); new RainbowBlock(itemGroups.christmas, SlimefunItems.RAINBOW_GLASS_PANE_XMAS, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.GREEN_DYE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.RED_DYE)}, + new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.GREEN_DYE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.RED_DYE)}, new SlimefunItemStack(SlimefunItems.RAINBOW_GLASS_PANE_XMAS, 2), new RainbowTickHandler(Material.RED_STAINED_GLASS_PANE, Material.GREEN_STAINED_GLASS_PANE)) .register(plugin); new RainbowBlock(itemGroups.christmas, SlimefunItems.RAINBOW_CLAY_XMAS, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.GREEN_DYE), new ItemStack(Material.WHITE_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.RED_DYE)}, + new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.GREEN_DYE), new ItemStack(Material.WHITE_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.RED_DYE)}, new SlimefunItemStack(SlimefunItems.RAINBOW_CLAY_XMAS, 2), new RainbowTickHandler(Material.RED_TERRACOTTA, Material.GREEN_TERRACOTTA)) .register(plugin); new RainbowBlock(itemGroups.christmas, SlimefunItems.RAINBOW_CONCRETE_XMAS, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.GREEN_DYE), new ItemStack(Material.WHITE_CONCRETE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.RED_DYE)}, + new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.GREEN_DYE), new ItemStack(Material.WHITE_CONCRETE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.RED_DYE)}, new SlimefunItemStack(SlimefunItems.RAINBOW_CONCRETE_XMAS, 2), new RainbowTickHandler(Material.RED_CONCRETE, Material.GREEN_CONCRETE)) .register(plugin); - + new RainbowBlock(itemGroups.christmas, SlimefunItems.RAINBOW_GLAZED_TERRACOTTA_XMAS, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.GREEN_DYE), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.RED_DYE)}, + new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.GREEN_DYE), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.RED_DYE)}, new SlimefunItemStack(SlimefunItems.RAINBOW_GLAZED_TERRACOTTA_XMAS, 2), new RainbowTickHandler(Material.RED_GLAZED_TERRACOTTA, Material.GREEN_GLAZED_TERRACOTTA)) .register(plugin); - + // Valentines Day new RainbowBlock(itemGroups.valentinesDay, SlimefunItems.RAINBOW_WOOL_VALENTINE, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.RED_DYE)}, + new ItemStack[] {new ItemStack(Material.RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.RED_DYE)}, new SlimefunItemStack(SlimefunItems.RAINBOW_WOOL_VALENTINE, 2), new RainbowTickHandler(Material.MAGENTA_WOOL, Material.PINK_WOOL)) .register(plugin); new RainbowBlock(itemGroups.valentinesDay, SlimefunItems.RAINBOW_GLASS_VALENTINE, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_STAINED_GLASS), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.RED_DYE)}, + new ItemStack[] {new ItemStack(Material.RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_STAINED_GLASS), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.RED_DYE)}, new SlimefunItemStack(SlimefunItems.RAINBOW_GLASS_VALENTINE, 2), new RainbowTickHandler(Material.MAGENTA_STAINED_GLASS, Material.PINK_STAINED_GLASS)) .register(plugin); new RainbowBlock(itemGroups.valentinesDay, SlimefunItems.RAINBOW_GLASS_PANE_VALENTINE, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.RED_DYE)}, + new ItemStack[] {new ItemStack(Material.RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.RED_DYE)}, new SlimefunItemStack(SlimefunItems.RAINBOW_GLASS_PANE_VALENTINE, 2), new RainbowTickHandler(Material.MAGENTA_STAINED_GLASS_PANE, Material.PINK_STAINED_GLASS_PANE)) .register(plugin); new RainbowBlock(itemGroups.valentinesDay, SlimefunItems.RAINBOW_CLAY_VALENTINE, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.RED_DYE)}, + new ItemStack[] {new ItemStack(Material.RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.RED_DYE)}, new SlimefunItemStack(SlimefunItems.RAINBOW_CLAY_VALENTINE, 2), new RainbowTickHandler(Material.MAGENTA_TERRACOTTA, Material.PINK_TERRACOTTA)) .register(plugin); - + new RainbowBlock(itemGroups.valentinesDay, SlimefunItems.RAINBOW_CONCRETE_VALENTINE, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_CONCRETE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.RED_DYE)}, + new ItemStack[] {new ItemStack(Material.RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_CONCRETE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.RED_DYE)}, new SlimefunItemStack(SlimefunItems.RAINBOW_CONCRETE_VALENTINE, 2), new RainbowTickHandler(Material.MAGENTA_CONCRETE, Material.PINK_CONCRETE)) .register(plugin); - + new RainbowBlock(itemGroups.valentinesDay, SlimefunItems.RAINBOW_GLAZED_TERRACOTTA_VALENTINE, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.RED_DYE)}, + new ItemStack[] {new ItemStack(Material.RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.RED_DYE)}, new SlimefunItemStack(SlimefunItems.RAINBOW_GLAZED_TERRACOTTA_VALENTINE, 2), new RainbowTickHandler(Material.MAGENTA_GLAZED_TERRACOTTA, Material.PINK_GLAZED_TERRACOTTA)) .register(plugin); // Halloween - + new RainbowBlock(itemGroups.halloween, SlimefunItems.RAINBOW_WOOL_HALLOWEEN, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)}, + new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)}, new SlimefunItemStack(SlimefunItems.RAINBOW_WOOL_HALLOWEEN, 2), new RainbowTickHandler(Material.ORANGE_WOOL, Material.BLACK_WOOL)) .register(plugin); new RainbowBlock(itemGroups.halloween, SlimefunItems.RAINBOW_GLASS_HALLOWEEN, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.WHITE_STAINED_GLASS), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)}, + new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.WHITE_STAINED_GLASS), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)}, new SlimefunItemStack(SlimefunItems.RAINBOW_GLASS_HALLOWEEN, 2), new RainbowTickHandler(Material.ORANGE_STAINED_GLASS, Material.BLACK_STAINED_GLASS)) .register(plugin); new RainbowBlock(itemGroups.halloween, SlimefunItems.RAINBOW_GLASS_PANE_HALLOWEEN, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)}, + new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)}, new SlimefunItemStack(SlimefunItems.RAINBOW_GLASS_PANE_HALLOWEEN, 2), new RainbowTickHandler(Material.ORANGE_STAINED_GLASS_PANE, Material.BLACK_STAINED_GLASS_PANE)) .register(plugin); new RainbowBlock(itemGroups.halloween, SlimefunItems.RAINBOW_CLAY_HALLOWEEN, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.WHITE_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)}, + new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.WHITE_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)}, new SlimefunItemStack(SlimefunItems.RAINBOW_CLAY_HALLOWEEN, 2), new RainbowTickHandler(Material.ORANGE_TERRACOTTA, Material.BLACK_TERRACOTTA)) .register(plugin); - + new RainbowBlock(itemGroups.halloween, SlimefunItems.RAINBOW_CONCRETE_HALLOWEEN, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.WHITE_CONCRETE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)}, + new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.WHITE_CONCRETE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)}, new SlimefunItemStack(SlimefunItems.RAINBOW_CONCRETE_HALLOWEEN, 2), new RainbowTickHandler(Material.ORANGE_CONCRETE, Material.BLACK_CONCRETE)) .register(plugin); - + new RainbowBlock(itemGroups.halloween, SlimefunItems.RAINBOW_GLAZED_TERRACOTTA_HALLOWEEN, RecipeType.ANCIENT_ALTAR, - new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)}, + new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)}, new SlimefunItemStack(SlimefunItems.RAINBOW_GLAZED_TERRACOTTA_HALLOWEEN, 2), new RainbowTickHandler(Material.ORANGE_GLAZED_TERRACOTTA, Material.BLACK_GLAZED_TERRACOTTA)) .register(plugin); new WitherProofBlock(itemGroups.technicalComponents, SlimefunItems.WITHER_PROOF_GLASS, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {SlimefunItems.LEAD_INGOT, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.LEAD_INGOT, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.HARDENED_GLASS, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.LEAD_INGOT, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.LEAD_INGOT}, + new ItemStack[] {SlimefunItems.LEAD_INGOT, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.LEAD_INGOT, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.HARDENED_GLASS, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.LEAD_INGOT, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.LEAD_INGOT}, new SlimefunItemStack(SlimefunItems.WITHER_PROOF_GLASS, 4)) .register(plugin); @@ -2275,7 +2280,7 @@ public int getEnergyConsumption() { .register(plugin); new TeleporterPylon(itemGroups.gps, SlimefunItems.GPS_TELEPORTER_PYLON, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {SlimefunItems.ZINC_INGOT, new ItemStack(Material.GLASS), SlimefunItems.ZINC_INGOT, new ItemStack(Material.GLASS), SlimefunItems.HEATING_COIL, new ItemStack(Material.GLASS), SlimefunItems.ZINC_INGOT, new ItemStack(Material.GLASS), SlimefunItems.ZINC_INGOT}, + new ItemStack[] {SlimefunItems.ZINC_INGOT, new ItemStack(Material.GLASS), SlimefunItems.ZINC_INGOT, new ItemStack(Material.GLASS), SlimefunItems.HEATING_COIL, new ItemStack(Material.GLASS), SlimefunItems.ZINC_INGOT, new ItemStack(Material.GLASS), SlimefunItems.ZINC_INGOT}, new SlimefunItemStack(SlimefunItems.GPS_TELEPORTER_PYLON, 8)) .register(plugin); @@ -2379,7 +2384,7 @@ public int getEnergyConsumption() { new TreeGrowthAccelerator(itemGroups.electricity, SlimefunItems.TREE_GROWTH_ACCELERATOR, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {null, SlimefunItems.CARBONADO, null, SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.DIAMOND_AXE), SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.MAGNESIUM_SALT, SlimefunItems.BIG_CAPACITOR, SlimefunItems.MAGNESIUM_SALT}) .register(plugin); - + new ExpCollector(itemGroups.electricity, SlimefunItems.EXP_COLLECTOR, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {null, SlimefunItems.BLISTERING_INGOT_3, null, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.AUTO_ENCHANTER, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.ALUMINUM_BRONZE_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ALUMINUM_BRONZE_INGOT}) .register(plugin); @@ -2515,7 +2520,7 @@ public int getSpeed() { new NuclearReactor(itemGroups.electricity, SlimefunItems.NUCLEAR_REACTOR, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.CARBONADO_EDGED_CAPACITOR, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.REINFORCED_PLATE, SlimefunItems.COOLING_UNIT, SlimefunItems.REINFORCED_PLATE, SlimefunItems.LEAD_INGOT, SlimefunItems.REINFORCED_PLATE, SlimefunItems.LEAD_INGOT}){ - + @Override public int getEnergyProduction() { return 250; @@ -2525,7 +2530,7 @@ public int getEnergyProduction() { public int getCapacity() { return 16384; } - + }.register(plugin); new NetherStarReactor(itemGroups.electricity, SlimefunItems.NETHER_STAR_REACTOR, RecipeType.ENHANCED_CRAFTING_TABLE, @@ -2544,7 +2549,7 @@ public int getCapacity() { }.register(plugin); new UnplaceableBlock(itemGroups.cargo, SlimefunItems.CARGO_MOTOR, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {SlimefunItems.HARDENED_GLASS, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.HARDENED_GLASS, SlimefunItems.SILVER_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.SILVER_INGOT, SlimefunItems.HARDENED_GLASS, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.HARDENED_GLASS}, + new ItemStack[] {SlimefunItems.HARDENED_GLASS, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.HARDENED_GLASS, SlimefunItems.SILVER_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.SILVER_INGOT, SlimefunItems.HARDENED_GLASS, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.HARDENED_GLASS}, new SlimefunItemStack(SlimefunItems.CARGO_MOTOR, 4)) .register(plugin); @@ -2553,17 +2558,17 @@ public int getCapacity() { .register(plugin); new CargoConnectorNode(itemGroups.cargo, SlimefunItems.CARGO_CONNECTOR_NODE, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {SlimefunItems.BRONZE_INGOT, SlimefunItems.SILVER_INGOT, SlimefunItems.BRONZE_INGOT, SlimefunItems.SILVER_INGOT, SlimefunItems.CARGO_MOTOR, SlimefunItems.SILVER_INGOT, SlimefunItems.BRONZE_INGOT, SlimefunItems.SILVER_INGOT, SlimefunItems.BRONZE_INGOT}, + new ItemStack[] {SlimefunItems.BRONZE_INGOT, SlimefunItems.SILVER_INGOT, SlimefunItems.BRONZE_INGOT, SlimefunItems.SILVER_INGOT, SlimefunItems.CARGO_MOTOR, SlimefunItems.SILVER_INGOT, SlimefunItems.BRONZE_INGOT, SlimefunItems.SILVER_INGOT, SlimefunItems.BRONZE_INGOT}, new SlimefunItemStack(SlimefunItems.CARGO_CONNECTOR_NODE, 4)) .register(plugin); new CargoInputNode(itemGroups.cargo, SlimefunItems.CARGO_INPUT_NODE, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {null, new ItemStack(Material.HOPPER), null, SlimefunItems.BILLON_INGOT, SlimefunItems.CARGO_CONNECTOR_NODE, SlimefunItems.BILLON_INGOT, null, new ItemStack(Material.HOPPER), null}, + new ItemStack[] {null, new ItemStack(Material.HOPPER), null, SlimefunItems.BILLON_INGOT, SlimefunItems.CARGO_CONNECTOR_NODE, SlimefunItems.BILLON_INGOT, null, new ItemStack(Material.HOPPER), null}, new SlimefunItemStack(SlimefunItems.CARGO_INPUT_NODE, 2)) .register(plugin); new CargoOutputNode(itemGroups.cargo, SlimefunItems.CARGO_OUTPUT_NODE, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {null, new ItemStack(Material.HOPPER), null, SlimefunItems.BRASS_INGOT, SlimefunItems.CARGO_CONNECTOR_NODE, SlimefunItems.BRASS_INGOT, null, new ItemStack(Material.HOPPER), null}, + new ItemStack[] {null, new ItemStack(Material.HOPPER), null, SlimefunItems.BRASS_INGOT, SlimefunItems.CARGO_CONNECTOR_NODE, SlimefunItems.BRASS_INGOT, null, new ItemStack(Material.HOPPER), null}, new SlimefunItemStack(SlimefunItems.CARGO_OUTPUT_NODE, 2)) .register(plugin); @@ -2625,11 +2630,11 @@ public int getCapacity() { new WitherAssembler(itemGroups.electricity, SlimefunItems.WITHER_ASSEMBLER, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {SlimefunItems.BLISTERING_INGOT_3, new ItemStack(Material.NETHER_STAR), SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.ANDROID_MEMORY_CORE, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.CARBONADO_EDGED_CAPACITOR}) .register(plugin); - + new TapeMeasure(itemGroups.usefulItems, SlimefunItems.TAPE_MEASURE, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {SlimefunItems.SILICON, new ItemStack(Material.YELLOW_DYE), SlimefunItems.SILICON, new ItemStack(Material.YELLOW_DYE), new ItemStack(Material.STRING), new ItemStack(Material.YELLOW_DYE), SlimefunItems.GILDED_IRON, new ItemStack(Material.YELLOW_DYE), SlimefunItems.SILICON}) .register(plugin); - + MinecraftVersion minecraftVersion = Slimefun.getMinecraftVersion(); new SlimefunItem(itemGroups.magicalArmor, SlimefunItems.BEE_HELMET, RecipeType.ARMOR_FORGE, @@ -2646,7 +2651,7 @@ public int getCapacity() { new LongFallBoots(itemGroups.magicalArmor, SlimefunItems.BEE_BOOTS, RecipeType.ARMOR_FORGE, new ItemStack[] {null, null, null, SlimefunItems.GOLD_8K, null, SlimefunItems.GOLD_8K, new ItemStack(Material.HONEY_BLOCK), null, new ItemStack(Material.HONEY_BLOCK)}, - new PotionEffect[] {new PotionEffect(PotionEffectType.JUMP, 300, 2)}, + new PotionEffect[] {new PotionEffect(VersionedPotionEffectType.JUMP_BOOST, 300, 2)}, SoundEffect.BEE_BOOTS_FALL_SOUND) .register(plugin); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/AncientAltarTask.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/AncientAltarTask.java index b32e719efc..be256b0031 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/AncientAltarTask.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/AncientAltarTask.java @@ -14,7 +14,6 @@ import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.Particle; import org.bukkit.SoundCategory; import org.bukkit.block.Block; import org.bukkit.entity.Item; @@ -28,6 +27,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.altar.AncientAltar; import io.github.thebusybiscuit.slimefun4.implementation.items.altar.AncientPedestal; import io.github.thebusybiscuit.slimefun4.implementation.listeners.AncientAltarListener; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedParticle; /** * The {@link AncientAltarTask} is responsible for the animation that happens when a ritual @@ -117,12 +117,12 @@ private boolean checkLockedItems() { } private void idle() { - dropLocation.getWorld().spawnParticle(Particle.SPELL_WITCH, dropLocation, 16, 1.2F, 0F, 1.2F); - dropLocation.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, dropLocation, 8, 0.2F, 0F, 0.2F); + dropLocation.getWorld().spawnParticle(VersionedParticle.WITCH, dropLocation, 16, 1.2F, 0F, 1.2F); + dropLocation.getWorld().spawnParticle(VersionedParticle.FIREWORK, dropLocation, 8, 0.2F, 0F, 0.2F); for (Location loc : particleLocations) { - dropLocation.getWorld().spawnParticle(Particle.ENCHANTMENT_TABLE, loc, 16, 0.3F, 0.2F, 0.3F); - dropLocation.getWorld().spawnParticle(Particle.CRIT_MAGIC, loc, 8, 0.3F, 0.2F, 0.3F); + dropLocation.getWorld().spawnParticle(VersionedParticle.ENCHANT, loc, 16, 0.3F, 0.2F, 0.3F); + dropLocation.getWorld().spawnParticle(VersionedParticle.ENCHANTED_HIT, loc, 8, 0.3F, 0.2F, 0.3F); } } @@ -137,8 +137,8 @@ private void checkPedestal(@Nonnull Block pedestal) { items.add(pedestalItem.getOriginalItemStack(entity)); SoundEffect.ANCIENT_ALTAR_ITEM_CHECK_SOUND.playAt(pedestal); - dropLocation.getWorld().spawnParticle(Particle.ENCHANTMENT_TABLE, pedestal.getLocation().add(0.5, 1.5, 0.5), 16, 0.3F, 0.2F, 0.3F); - dropLocation.getWorld().spawnParticle(Particle.CRIT_MAGIC, pedestal.getLocation().add(0.5, 1.5, 0.5), 8, 0.3F, 0.2F, 0.3F); + dropLocation.getWorld().spawnParticle(VersionedParticle.ENCHANT, pedestal.getLocation().add(0.5, 1.5, 0.5), 16, 0.3F, 0.2F, 0.3F); + dropLocation.getWorld().spawnParticle(VersionedParticle.ENCHANTED_HIT, pedestal.getLocation().add(0.5, 1.5, 0.5), 8, 0.3F, 0.2F, 0.3F); positionLock.remove(entity); entity.remove(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/ArmorTask.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/ArmorTask.java index 32141cb010..051f931460 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/ArmorTask.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/ArmorTask.java @@ -24,10 +24,9 @@ import io.github.thebusybiscuit.slimefun4.core.attributes.ProtectionType; import io.github.thebusybiscuit.slimefun4.core.attributes.Radioactive; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; -import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems; import io.github.thebusybiscuit.slimefun4.implementation.items.armor.SlimefunArmorPiece; import io.github.thebusybiscuit.slimefun4.implementation.items.electric.gadgets.SolarHelmet; -import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedPotionEffectType; import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper; /** @@ -55,10 +54,10 @@ public ArmorTask(boolean radioactiveFire) { Set effects = new HashSet<>(); effects.add(new PotionEffect(PotionEffectType.WITHER, 400, 2)); effects.add(new PotionEffect(PotionEffectType.BLINDNESS, 400, 3)); - effects.add(new PotionEffect(PotionEffectType.CONFUSION, 400, 3)); + effects.add(new PotionEffect(VersionedPotionEffectType.NAUSEA, 400, 3)); effects.add(new PotionEffect(PotionEffectType.WEAKNESS, 400, 2)); - effects.add(new PotionEffect(PotionEffectType.SLOW, 400, 1)); - effects.add(new PotionEffect(PotionEffectType.SLOW_DIGGING, 400, 1)); + effects.add(new PotionEffect(VersionedPotionEffectType.SLOWNESS, 400, 1)); + effects.add(new PotionEffect(VersionedPotionEffectType.MINING_FATIGUE, 400, 1)); radiationEffects = Collections.unmodifiableSet(effects); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/armor/RadiationTask.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/armor/RadiationTask.java index 29ac850805..85e4c4bfe8 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/armor/RadiationTask.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/armor/RadiationTask.java @@ -1,31 +1,30 @@ package io.github.thebusybiscuit.slimefun4.implementation.tasks.armor; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import javax.annotation.Nonnull; -import javax.annotation.ParametersAreNonnullByDefault; - -import org.bukkit.GameMode; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import io.github.bakedlibs.dough.common.ChatColors; +import io.github.thebusybiscuit.slimefun4.api.events.RadiationDamageEvent; import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem; import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile; import io.github.thebusybiscuit.slimefun4.core.attributes.ProtectionType; import io.github.thebusybiscuit.slimefun4.core.attributes.RadiationSymptom; import io.github.thebusybiscuit.slimefun4.core.attributes.Radioactive; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.RadioactivityListener; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; -import io.github.thebusybiscuit.slimefun4.implementation.items.RadioactiveItem; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.RadioactivityListener; import io.github.thebusybiscuit.slimefun4.utils.RadiationUtils; - import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.ComponentBuilder; +import org.bukkit.Bukkit; +import org.bukkit.GameMode; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import javax.annotation.Nonnull; +import javax.annotation.ParametersAreNonnullByDefault; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + /** * The {@link RadiationTask} handles radioactivity for * {@link Radioactive} items. @@ -48,13 +47,15 @@ protected void onPlayerTick(Player p, PlayerProfile profile) { } int exposureTotal = 0; - if (!profile.hasFullProtectionAgainst(ProtectionType.RADIATION) && p.getGameMode() != GameMode.CREATIVE && p.getGameMode() != GameMode.SPECTATOR) { + if (!profile.hasFullProtectionAgainst(ProtectionType.RADIATION) + && p.getGameMode() != GameMode.CREATIVE + && p.getGameMode() != GameMode.SPECTATOR) { for (ItemStack item : p.getInventory()) { if (item == null || item.getType().isAir()) { continue; } SlimefunItem sfItem = SlimefunItem.getByItem(item); - if (sfItem instanceof RadioactiveItem radioactiveItem) { + if (sfItem instanceof Radioactive radioactiveItem) { exposureTotal += item.getAmount() * radioactiveItem.getRadioactivity().getExposureModifier(); } } @@ -72,7 +73,14 @@ protected void onPlayerTick(Player p, PlayerProfile profile) { int exposureLevelAfter = RadiationUtils.getExposure(p); - Slimefun.runSync(() -> { + Slimefun.runSync(() -> { + RadiationDamageEvent event = new RadiationDamageEvent(p, exposureLevelAfter); + Bukkit.getPluginManager().callEvent(event); + + if (event.isCancelled()) { + return; + } + for (RadiationSymptom symptom : symptoms) { if (symptom.shouldApply(exposureLevelAfter)) { symptom.apply(p); @@ -81,8 +89,11 @@ protected void onPlayerTick(Player p, PlayerProfile profile) { }); if (exposureLevelAfter > 0 || exposureLevelBefore > 0) { - String msg = Slimefun.getLocalization().getMessage(p, "actionbar.radiation").replace("%level%", "" + exposureLevelAfter); - BaseComponent[] components = new ComponentBuilder().append(ChatColors.color(msg)).create(); + String msg = Slimefun.getLocalization() + .getMessage(p, "actionbar.radiation") + .replace("%level%", "" + exposureLevelAfter); + BaseComponent[] components = + new ComponentBuilder().append(ChatColors.color(msg)).create(); p.spigot().sendMessage(ChatMessageType.ACTION_BAR, components); } } else { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ChestMenuUtils.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ChestMenuUtils.java index 3df992835b..928233eb5d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ChestMenuUtils.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ChestMenuUtils.java @@ -5,9 +5,11 @@ import javax.annotation.Nonnull; +import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; +import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; @@ -43,6 +45,19 @@ private ChestMenuUtils() {} private static final ItemStack PREV_BUTTON_INACTIVE = new SlimefunItemStack("_UI_PREVIOUS_INACTIVE", Material.BLACK_STAINED_GLASS_PANE, "&8\u21E6 Previous Page"); private static final ItemStack NEXT_BUTTON_INACTIVE = new SlimefunItemStack("_UI_NEXT_INACTIVE", Material.BLACK_STAINED_GLASS_PANE, "&8Next Page \u21E8"); + private static final ChestMenu.AdvancedMenuClickHandler OUTPUT_HANDLER = new ChestMenu.AdvancedMenuClickHandler() { + + @Override + public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) { + return false; + } + + @Override + public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor, ClickAction action) { + return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR; + } + }; + private static final MenuClickHandler CLICK_HANDLER = (p, s, i, a) -> false; public static @Nonnull ItemStack getBackground() { @@ -69,6 +84,10 @@ private ChestMenuUtils() {} return CLICK_HANDLER; } + public static @Nonnull ChestMenu.AdvancedMenuClickHandler getDefaultOutputHandler() { + return OUTPUT_HANDLER; + } + public static @Nonnull ItemStack getBackButton(@Nonnull Player p, String... lore) { return new CustomItemStack(BACK_BUTTON, "&7\u21E6 " + Slimefun.getLocalization().getMessage(p, "guide.back.title"), lore); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/FireworkUtils.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/FireworkUtils.java index 808c5364ce..e09851349d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/FireworkUtils.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/FireworkUtils.java @@ -15,6 +15,8 @@ import org.bukkit.entity.Firework; import org.bukkit.inventory.meta.FireworkMeta; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedEntityType; + /** * This is a simple utility class for spawning random and colorful {@link Firework} rockets. * @@ -31,6 +33,8 @@ public final class FireworkUtils { Color.RED, Color.SILVER, Color.TEAL, Color.WHITE, Color.YELLOW }; // @formatter:on + + private static final EntityType firework = VersionedEntityType.FIREWORK; private FireworkUtils() {} @@ -39,7 +43,7 @@ public static void launchFirework(@Nonnull Location l, @Nonnull Color color) { } public static @Nonnull Firework createFirework(@Nonnull Location l, @Nonnull Color color) { - Firework fw = (Firework) l.getWorld().spawnEntity(l, EntityType.FIREWORK); + Firework fw = (Firework) l.getWorld().spawnEntity(l, firework); FireworkMeta meta = fw.getFireworkMeta(); meta.setDisplayName(ChatColor.GREEN + "Slimefun Research"); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/SlimefunUtils.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/SlimefunUtils.java index 5fc3bda47f..a509b207f3 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/SlimefunUtils.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/SlimefunUtils.java @@ -485,11 +485,24 @@ private static boolean equalsItemMeta(@Nonnull ItemMeta itemMeta, @Nonnull ItemM return false; } - if (itemMeta instanceof PotionMeta && sfitemMeta instanceof PotionMeta) { - return ((PotionMeta) itemMeta).getBasePotionData().equals(((PotionMeta) sfitemMeta).getBasePotionData()); + if (!(itemMeta instanceof PotionMeta potionMeta) || !(sfitemMeta instanceof PotionMeta sfPotionMeta)) { + return true; } - - return true; + MinecraftVersion current = Slimefun.getMinecraftVersion(); + + if (current.isBefore(20, 2)) { + // getBasePotionData pre 1.20.2 + return potionMeta.getBasePotionData().equals(sfPotionMeta.getBasePotionData()); + } else if (current.isBefore(20, 5)) { + // getBasePotionType without null check for 1.20.3 and 1.20.4 + return potionMeta.getBasePotionType() == sfPotionMeta.getBasePotionType(); + } + // check if potionMetha has a basePotionType (acting a null check for getBasePotionType + // on 1.20.5+ + if (potionMeta.hasBasePotionType() != sfPotionMeta.hasBasePotionType()) { + return false; + } + return potionMeta.getBasePotionType() == sfPotionMeta.getBasePotionType(); } /** diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedEnchantment.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedEnchantment.java new file mode 100644 index 0000000000..d5063ce413 --- /dev/null +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedEnchantment.java @@ -0,0 +1,48 @@ +package io.github.thebusybiscuit.slimefun4.utils.compatibility; + +import org.bukkit.NamespacedKey; +import org.bukkit.Registry; +import org.bukkit.enchantments.Enchantment; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +// https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java?until=2a6207fe150b6165722fce94c83cc1f206620ab5&untilPath=src%2Fmain%2Fjava%2Forg%2Fbukkit%2Fcraftbukkit%2Flegacy%2FFieldRename.java#86-110 +public class VersionedEnchantment { + + public static final Enchantment EFFICIENCY; + public static final Enchantment UNBREAKING; + public static final Enchantment PROTECTION; + public static final Enchantment SHARPNESS; + public static final Enchantment LUCK_OF_THE_SEA; + public static final Enchantment AQUA_AFFINITY; + public static final Enchantment FORTUNE; + + static { + // DIG_SPEED is renamed to EFFICIENCY in 1.20.5 + EFFICIENCY = getKey("efficiency"); + + // DURABILITY is renamed to UNBREAKING in 1.20.5 + UNBREAKING = getKey("unbreaking"); + + // PROTECTION_ENVIRONMENTAL is renamed to PROTECTION in 1.20.5 + PROTECTION = getKey("protection"); + + // DAMAGE_ALL is renamed to SHARPNESS in 1.20.5 + SHARPNESS = getKey("sharpness"); + + // LUCK is renamed to LUCK_OF_THE_SEA in 1.20.5 + LUCK_OF_THE_SEA = getKey("luck_of_the_sea"); + + // WATER_WORKER is renamed to AQUA_AFFINITY in 1.20.5 + AQUA_AFFINITY = getKey("aqua_affinity"); + + // LOOT_BONUS_BLOCKS is renamed to FORTUNE in 1.20.5 + FORTUNE = getKey("fortune"); + } + + @Nullable + private static Enchantment getKey(@Nonnull String key) { + return Registry.ENCHANTMENT.get(NamespacedKey.minecraft(key)); + } +} diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedEntityType.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedEntityType.java new file mode 100644 index 0000000000..10ae11e803 --- /dev/null +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedEntityType.java @@ -0,0 +1,31 @@ +package io.github.thebusybiscuit.slimefun4.utils.compatibility; + +import org.bukkit.NamespacedKey; +import org.bukkit.Registry; +import org.bukkit.entity.EntityType; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +// https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java?until=2a6207fe150b6165722fce94c83cc1f206620ab5&untilPath=src%2Fmain%2Fjava%2Forg%2Fbukkit%2Fcraftbukkit%2Flegacy%2FFieldRename.java#158-193 +public class VersionedEntityType { + + public static final EntityType MOOSHROOM; + public static final EntityType SNOW_GOLEM; + public static final EntityType FIREWORK; + + static { + // MUSHROOM_COW is renamed to MOOSHROOM in 1.20.5 + MOOSHROOM = getKey("mooshroom"); + + // SNOWMAN is renamed to SNOW_GOLEM in 1.20.5 + SNOW_GOLEM = getKey("snow_golem"); + + FIREWORK = getKey("firework_rocket"); + } + + @Nullable + private static EntityType getKey(@Nonnull String key) { + return Registry.ENTITY_TYPE.get(NamespacedKey.minecraft(key)); + } +} diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedItemFlag.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedItemFlag.java new file mode 100644 index 0000000000..507a903a23 --- /dev/null +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedItemFlag.java @@ -0,0 +1,34 @@ +package io.github.thebusybiscuit.slimefun4.utils.compatibility; + +import java.lang.reflect.Field; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import org.bukkit.inventory.ItemFlag; + +import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion; +import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; + +public class VersionedItemFlag { + + public static final ItemFlag HIDE_ADDITIONAL_TOOLTIP; + + static { + MinecraftVersion version = Slimefun.getMinecraftVersion(); + + HIDE_ADDITIONAL_TOOLTIP = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) + ? ItemFlag.HIDE_ADDITIONAL_TOOLTIP + : getKey("HIDE_POTION_EFFECTS"); + } + + @Nullable + private static ItemFlag getKey(@Nonnull String key) { + try { + Field field = ItemFlag.class.getDeclaredField(key); + return (ItemFlag) field.get(null); + } catch(Exception e) { + return null; + } + } +} diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedParticle.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedParticle.java new file mode 100644 index 0000000000..fafd340cc0 --- /dev/null +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedParticle.java @@ -0,0 +1,78 @@ +package io.github.thebusybiscuit.slimefun4.utils.compatibility; + +import java.lang.reflect.Field; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import org.bukkit.Particle; + +import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion; +import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; + +// https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java?until=2a6207fe150b6165722fce94c83cc1f206620ab5&untilPath=src%2Fmain%2Fjava%2Forg%2Fbukkit%2Fcraftbukkit%2Flegacy%2FFieldRename.java#281-318 +public class VersionedParticle { + + public static final Particle DUST; + public static final Particle SMOKE; + public static final Particle HAPPY_VILLAGER; + public static final Particle ENCHANTED_HIT; + public static final Particle EXPLOSION; + public static final Particle WITCH; + public static final Particle FIREWORK; + public static final Particle ENCHANT; + + static { + MinecraftVersion version = Slimefun.getMinecraftVersion(); + + // REDSTONE is renamed to DUST in 1.20.5 + DUST = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) + ? Particle.DUST + : getKey("REDSTONE"); + + // SMOKE_NORMAL is renamed to SMOKE in 1.20.5 + SMOKE = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) + ? Particle.SMOKE + : getKey("SMOKE_NORMAL"); + + // VILLAGER_HAPPY is renamed to HAPPY_VILLAGER in 1.20.5 + HAPPY_VILLAGER = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) + ? Particle.HAPPY_VILLAGER + : getKey("VILLAGER_HAPPY"); + + // CRIT_MAGIC is renamed to ENCHANTED_HIT in 1.20.5 + ENCHANTED_HIT = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) + ? Particle.ENCHANTED_HIT + : getKey("CRIT_MAGIC"); + + // EXPLOSION_LARGE is renamed to EXPLOSION in 1.20.5 + EXPLOSION = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) + ? Particle.EXPLOSION + : getKey("EXPLOSION_LARGE"); + + // SPELL_WITCH is renamed to WITCH in 1.20.5 + WITCH = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) + ? Particle.WITCH + : getKey("SPELL_WITCH"); + + // FIREWORKS_SPARK is renamed to FIREWORK in 1.20.5 + FIREWORK = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) + ? Particle.FIREWORK + : getKey("FIREWORKS_SPARK"); + + // ENCHANTMENT_TABLE is renamed to ENCHANT in 1.20.5 + ENCHANT = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) + ? Particle.ENCHANT + : getKey("ENCHANTMENT_TABLE"); + } + + @Nullable + private static Particle getKey(@Nonnull String key) { + try { + Field field = Particle.class.getDeclaredField(key); + return (Particle) field.get(null); + } catch(Exception e) { + return null; + } + } +} diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedPotionEffectType.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedPotionEffectType.java new file mode 100644 index 0000000000..f3dbe6b6d1 --- /dev/null +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedPotionEffectType.java @@ -0,0 +1,75 @@ +package io.github.thebusybiscuit.slimefun4.utils.compatibility; + +import java.lang.reflect.Field; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import org.bukkit.potion.PotionEffectType; + +import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion; +import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; + +// https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java?until=2a6207fe150b6165722fce94c83cc1f206620ab5&untilPath=src%2Fmain%2Fjava%2Forg%2Fbukkit%2Fcraftbukkit%2Flegacy%2FFieldRename.java#216-228 +public class VersionedPotionEffectType { + + public static final PotionEffectType SLOWNESS; + public static final PotionEffectType HASTE; + public static final PotionEffectType MINING_FATIGUE; + public static final PotionEffectType STRENGTH; + public static final PotionEffectType INSTANT_HEALTH; + public static final PotionEffectType INSTANT_DAMAGE; + public static final PotionEffectType JUMP_BOOST; + public static final PotionEffectType NAUSEA; + public static final PotionEffectType RESISTANCE; + + static { + MinecraftVersion version = Slimefun.getMinecraftVersion(); + + SLOWNESS = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) + ? PotionEffectType.SLOWNESS + : getKey("SLOW"); + + HASTE = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) + ? PotionEffectType.HASTE + : getKey("FAST_DIGGING"); + + MINING_FATIGUE = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) + ? PotionEffectType.MINING_FATIGUE + : getKey("SLOW_DIGGING"); + + STRENGTH = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) + ? PotionEffectType.STRENGTH + : getKey("INCREASE_DAMAGE"); + + INSTANT_HEALTH = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) + ? PotionEffectType.INSTANT_HEALTH + : getKey("HEAL"); + + INSTANT_DAMAGE = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) + ? PotionEffectType.INSTANT_DAMAGE + : getKey("HARM"); + + JUMP_BOOST = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) + ? PotionEffectType.JUMP_BOOST + : getKey("JUMP"); + + NAUSEA = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) + ? PotionEffectType.NAUSEA + : getKey("CONFUSION"); + + RESISTANCE = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) + ? PotionEffectType.RESISTANCE + : getKey("DAMAGE_RESISTANCE"); + } + + @Nullable + private static PotionEffectType getKey(@Nonnull String key) { + try { + Field field = PotionEffectType.class.getDeclaredField(key); + return (PotionEffectType) field.get(null); + } catch(Exception e) { + return null; + } + } +} diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedPotionType.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedPotionType.java new file mode 100644 index 0000000000..1713d77baf --- /dev/null +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedPotionType.java @@ -0,0 +1,55 @@ +package io.github.thebusybiscuit.slimefun4.utils.compatibility; + +import java.lang.reflect.Field; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import org.bukkit.potion.PotionType; + +import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion; +import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; + +// https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java?until=2a6207fe150b6165722fce94c83cc1f206620ab5&untilPath=src%2Fmain%2Fjava%2Forg%2Fbukkit%2Fcraftbukkit%2Flegacy%2FFieldRename.java#242-250 +public class VersionedPotionType { + + public static final PotionType LEAPING; + public static final PotionType SWIFTNESS; + public static final PotionType HEALING; + public static final PotionType HARMING; + public static final PotionType REGENERATION; + + static { + MinecraftVersion version = Slimefun.getMinecraftVersion(); + + LEAPING = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) + ? PotionType.LEAPING + : getKey("JUMP"); + + SWIFTNESS = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) + ? PotionType.SWIFTNESS + : getKey("SPEED"); + + HEALING = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) + ? PotionType.HEALING + : getKey("INSTANT_HEAL"); + + HARMING = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) + ? PotionType.HARMING + : getKey("INSTANT_DAMAGE"); + + REGENERATION = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) + ? PotionType.REGENERATION + : getKey("REGEN"); + } + + @Nullable + private static PotionType getKey(@Nonnull String key) { + try { + Field field = PotionType.class.getDeclaredField(key); + return (PotionType) field.get(null); + } catch(Exception e) { + return null; + } + } +} diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/itemstack/ColoredFireworkStar.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/itemstack/ColoredFireworkStar.java index 17a62c352f..063d91f8d1 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/itemstack/ColoredFireworkStar.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/itemstack/ColoredFireworkStar.java @@ -9,12 +9,12 @@ import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect.Type; import org.bukkit.Material; -import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.FireworkEffectMeta; import io.github.bakedlibs.dough.common.ChatColors; import io.github.bakedlibs.dough.items.CustomItemStack; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedItemFlag; /** * This simple {@link ItemStack} implementation allows us to obtain @@ -44,7 +44,7 @@ public ColoredFireworkStar(Color color, String name, String... lore) { im.setLore(lines); } - im.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS); + im.addItemFlags(VersionedItemFlag.HIDE_ADDITIONAL_TOOLTIP); }); } diff --git a/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/Configuration/Config.java b/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/Configuration/Config.java index 7784370617..7cceeb6a08 100644 --- a/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/Configuration/Config.java +++ b/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/Configuration/Config.java @@ -13,10 +13,8 @@ * An old remnant of CS-CoreLib. * This will be removed once we updated everything. * Don't look at the code, it will be gone soon, don't worry. - * - * @deprecated Only used by the legacy {@link BlockStorage} system. + * Only used by the legacy {@link BlockStorage} system. */ -@Deprecated public class Config { private final File file; diff --git a/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/general/Inventory/ChestMenu.java b/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/general/Inventory/ChestMenu.java index 1d047d0615..d13234063c 100644 --- a/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/general/Inventory/ChestMenu.java +++ b/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/general/Inventory/ChestMenu.java @@ -16,9 +16,7 @@ * An old remnant of CS-CoreLib. * This will be removed once we updated everything. * Don't look at the code, it will be gone soon, don't worry. - * */ -@Deprecated public class ChestMenu { private boolean clickable; @@ -207,7 +205,6 @@ public ChestMenu addMenuCloseHandler(MenuCloseHandler handler) { * * @return The ChestMenu Instance */ - @Deprecated public ChestMenu build() { return this; } diff --git a/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/general/Inventory/ClickAction.java b/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/general/Inventory/ClickAction.java index 2592862ff2..4ad692a6e1 100644 --- a/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/general/Inventory/ClickAction.java +++ b/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/general/Inventory/ClickAction.java @@ -4,9 +4,7 @@ * An old remnant of CS-CoreLib. * This will be removed once we updated everything. * Don't look at the code, it will be gone soon, don't worry. - * */ -@Deprecated public class ClickAction { private boolean right; diff --git a/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/general/Inventory/MenuListener.java b/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/general/Inventory/MenuListener.java index 3483e5a6e8..1647e5aeee 100644 --- a/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/general/Inventory/MenuListener.java +++ b/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/general/Inventory/MenuListener.java @@ -17,12 +17,9 @@ /** * An old {@link Listener} for CS-CoreLib - * - * @deprecated This is an old remnant of CS-CoreLib, the last bits of the past. They will be removed once everything is + * This is an old remnant of CS-CoreLib, the last bits of the past. They will be removed once everything is * updated. - * */ -@Deprecated public class MenuListener implements Listener { static final Map menus = new HashMap<>(); diff --git a/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/package-info.java b/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/package-info.java index ca990142b2..4a7b23e254 100644 --- a/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/package-info.java +++ b/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/package-info.java @@ -1,5 +1,4 @@ /** * Old CS-CoreLib 1.X code. */ -@java.lang.Deprecated package me.mrCookieSlime.CSCoreLibPlugin; \ No newline at end of file diff --git a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AContainer.java b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AContainer.java index be71fbe598..04747b4f84 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AContainer.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AContainer.java @@ -12,8 +12,6 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; @@ -37,8 +35,6 @@ import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper; import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config; -import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler; -import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.InventoryBlock; import me.mrCookieSlime.Slimefun.Objects.handlers.BlockTicker; import me.mrCookieSlime.Slimefun.api.BlockStorage; @@ -115,18 +111,7 @@ protected void constructMenu(BlockMenuPreset preset) { preset.addItem(22, new CustomItemStack(Material.BLACK_STAINED_GLASS_PANE, " "), ChestMenuUtils.getEmptyClickHandler()); for (int i : getOutputSlots()) { - preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() { - - @Override - public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) { - return false; - } - - @Override - public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor, ClickAction action) { - return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR; - } - }); + preset.addMenuClickHandler(i, ChestMenuUtils.getDefaultOutputHandler()); } } diff --git a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AGenerator.java b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AGenerator.java index 0bc27e5d17..db5555f6c9 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AGenerator.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AGenerator.java @@ -12,7 +12,6 @@ import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; -import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.inventory.ItemStack; import io.github.bakedlibs.dough.items.CustomItemStack; @@ -35,8 +34,6 @@ import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper; import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config; -import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler; -import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction; import me.mrCookieSlime.Slimefun.api.BlockStorage; import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu; import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset; @@ -122,18 +119,7 @@ private void constructMenu(BlockMenuPreset preset) { } for (int i : getOutputSlots()) { - preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() { - - @Override - public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) { - return false; - } - - @Override - public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor, ClickAction action) { - return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR; - } - }); + preset.addMenuClickHandler(i, ChestMenuUtils.getDefaultOutputHandler()); } preset.addItem(22, new CustomItemStack(Material.BLACK_STAINED_GLASS_PANE, " "), ChestMenuUtils.getEmptyClickHandler()); @@ -282,7 +268,7 @@ public void register(@Nonnull SlimefunAddon addon) { if (getCapacity() < 0) { warn("The capacity has not been configured correctly. The Item was disabled."); - warn("Make sure to call '" + getClass().getSimpleName() + "#setEnergyCapacity(...)' before registering!"); + warn("Make sure to call '" + getClass().getSimpleName() + "#setCapacity(...)' before registering!"); } if (getEnergyProduction() <= 0) { diff --git a/src/main/java/me/mrCookieSlime/Slimefun/api/BlockInfoConfig.java b/src/main/java/me/mrCookieSlime/Slimefun/api/BlockInfoConfig.java index c2f5a821eb..448f0fbcfe 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/api/BlockInfoConfig.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/api/BlockInfoConfig.java @@ -118,4 +118,4 @@ public String toJSON() { return new GsonBuilder().create().toJson(data); } -} \ No newline at end of file +} diff --git a/src/main/java/me/mrCookieSlime/package-info.java b/src/main/java/me/mrCookieSlime/package-info.java index 2fc365aed1..d346250b2c 100644 --- a/src/main/java/me/mrCookieSlime/package-info.java +++ b/src/main/java/me/mrCookieSlime/package-info.java @@ -3,5 +3,4 @@ * Don't look too close at the code that lays here. It's horrible, believe me. * Once we updated everything, all of these classes will be removed. */ -@java.lang.Deprecated package me.mrCookieSlime; \ No newline at end of file diff --git a/src/main/resources/languages/en/messages.yml b/src/main/resources/languages/en/messages.yml index 9eaa8b9d93..f796fbcc9a 100644 --- a/src/main/resources/languages/en/messages.yml +++ b/src/main/resources/languages/en/messages.yml @@ -102,7 +102,28 @@ guide: name: '&aIs something missing?' lore: 'Click to add your own translation' + modes: + selected: 'Slimefun Guide Type: ' + change: 'Click to change the type' + SURVIVAL_MODE: 'Survival Mode' + CHEAT_MODE: 'Cheat Sheet' + options: + fireworks: + enabled: + text: + - '&bFireworks: &aYes' + - '' + - '&7You can now toggle whether you' + - '&7will see fireworks upon researching an item.' + click: '&eClick to disable your fireworks' + disabled: + text: + - '&bFireworks: &4No' + - '' + - '&7You can now toggle whether you' + - '&7will see fireworks upon researching an item.' + click: '&eClick to enable your fireworks' learning-animation: enabled: text: diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestTalismanActivateEvent.java b/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestTalismanActivateEvent.java index 94b1947cf1..40cfc61fe5 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestTalismanActivateEvent.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestTalismanActivateEvent.java @@ -78,23 +78,20 @@ void testEventIsFired() { activateAnvilTalisman(true, true); server.getPluginManager().assertEventFired(TalismanActivateEvent.class, ignored -> true); server.getPluginManager().clearEvents(); + // Assert the normal talisman does not activate in the ender chest activateAnvilTalisman(false, true); - try { - server.getPluginManager().assertEventFired(TalismanActivateEvent.class, ignored -> true); - } catch (AssertionError ignored) { - return; // This is expected; the event should not have fired - } - server.getPluginManager().clearEvents(); + Assertions.assertThrows( + AssertionError.class, + () -> server.getPluginManager().assertEventFired(TalismanActivateEvent.class, ignored -> true) + ); // Assert the ender talisman does not activate in the inventory - try { - activateAnvilTalisman(true, false); - server.getPluginManager().assertEventFired(TalismanActivateEvent.class, ignored -> true); - } catch (AssertionError ignored) { - return; // This is expected; the event should not have fired - } - server.getPluginManager().clearEvents(); + activateAnvilTalisman(true, false); + Assertions.assertThrows( + AssertionError.class, + () -> server.getPluginManager().assertEventFired(TalismanActivateEvent.class, ignored -> true) + ); } @Test diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/commands/TestGuideCommand.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/commands/TestGuideCommand.java index 0612ade074..57560503a7 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/commands/TestGuideCommand.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/commands/TestGuideCommand.java @@ -38,9 +38,9 @@ public static void unload() { void testCommand(boolean op) { Player player = server.addPlayer(); player.setOp(op); + boolean hasPermission = player.hasPermission("slimefun.command.guide"); server.execute("slimefun", player, "guide").assertSucceeded(); - ItemStack guide = SlimefunGuide.getItem(SlimefunGuideMode.SURVIVAL_MODE); - Assertions.assertEquals(op, SlimefunUtils.containsSimilarItem(player.getInventory(), guide, true)); + Assertions.assertEquals(hasPermission, SlimefunUtils.containsSimilarItem(player.getInventory(), guide, true)); } } diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/localization/AbstractLocaleRegexChecker.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/localization/AbstractLocaleRegexChecker.java index 63eef282b4..df8668f285 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/localization/AbstractLocaleRegexChecker.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/localization/AbstractLocaleRegexChecker.java @@ -1,8 +1,8 @@ package io.github.thebusybiscuit.slimefun4.core.services.localization; import java.io.BufferedReader; +import java.io.IOException; import java.io.InputStream; -import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.List; @@ -16,7 +16,9 @@ import javax.annotation.ParametersAreNonnullByDefault; import org.apache.commons.lang.Validate; +import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; @@ -50,16 +52,23 @@ public static void unload() { @ParametersAreNonnullByDefault @Nullable - BufferedReader readLanguageFile(LanguagePreset lang, LanguageFile file) { + FileConfiguration readLanguageFile(LanguagePreset lang, LanguageFile file) throws IOException, InvalidConfigurationException { String path = file.getFilePath(lang.getLanguageCode()); - InputStream inputStream = getClass().getResourceAsStream(path); - - if (inputStream == null) { - // This file does not exist, we consider it "passed". + byte[] bytes; + try (InputStream inputStream = getClass().getResourceAsStream(path)) { + if (inputStream == null) { + // This file does not exist, we consider it "passed". + return null; + } + bytes = inputStream.readAllBytes(); + } + String contents = new String(bytes, StandardCharsets.UTF_8); + if (contents.trim().equals("---")) { return null; } - - return new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); + YamlConfiguration configuration = new YamlConfiguration(); + configuration.loadFromString(contents); + return configuration; } @ParametersAreNonnullByDefault diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/localization/TestColorCodes.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/localization/TestColorCodes.java index 9be3d2710b..88371ac0ee 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/localization/TestColorCodes.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/localization/TestColorCodes.java @@ -1,17 +1,15 @@ package io.github.thebusybiscuit.slimefun4.core.services.localization; -import java.io.BufferedReader; -import java.io.IOException; -import java.util.regex.Pattern; - -import javax.annotation.ParametersAreNonnullByDefault; - +import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; +import javax.annotation.ParametersAreNonnullByDefault; +import java.io.IOException; +import java.util.regex.Pattern; + /** * We need to make sure that color codes are still working properly. *

@@ -24,7 +22,7 @@ *

* The test will catch occurences like "a& ", "b&Hello" or "7&", "5& a". * The test will however ignore valid color codes such as "a&a". - * + * * @author TheBusyBiscuit * */ @@ -38,15 +36,12 @@ class TestColorCodes extends AbstractLocaleRegexChecker { @ParametersAreNonnullByDefault @MethodSource("getAllLanguageFiles") @DisplayName("Test for mistakes in color codes for Slimefun locale files") - void testSpelling(LanguagePreset lang, LanguageFile file) throws IOException { - try (BufferedReader reader = readLanguageFile(lang, file)) { - if (reader == null) { - return; - } - - FileConfiguration config = YamlConfiguration.loadConfiguration(reader); - assertNoRegexMatchesForAllEntries(lang, file, config); + void testSpelling(LanguagePreset lang, LanguageFile file) throws IOException, InvalidConfigurationException { + FileConfiguration config = readLanguageFile(lang, file); + if (config == null) { + return; } + assertNoRegexMatchesForAllEntries(lang, file, config); } } diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/localization/TestSlimefunSpelling.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/localization/TestSlimefunSpelling.java index c33bb4c11d..dd8b62be3a 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/localization/TestSlimefunSpelling.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/localization/TestSlimefunSpelling.java @@ -1,13 +1,12 @@ package io.github.thebusybiscuit.slimefun4.core.services.localization; -import java.io.BufferedReader; import java.io.IOException; import java.util.regex.Pattern; import javax.annotation.ParametersAreNonnullByDefault; +import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; @@ -16,7 +15,7 @@ * Your friendly neighbourhood spellcheck. * Brought to you by our Discord bot "@WalshBot". * No more incorrect spelling of "Slimefun". - * + * * @author TheBusyBiscuit * */ @@ -30,15 +29,12 @@ class TestSlimefunSpelling extends AbstractLocaleRegexChecker { @ParametersAreNonnullByDefault @MethodSource("getAllLanguageFiles") @DisplayName("Test correct spelling of Slimefun in language files") - void testSpelling(LanguagePreset lang, LanguageFile file) throws IOException { - try (BufferedReader reader = readLanguageFile(lang, file)) { - if (reader == null) { - return; - } - - FileConfiguration config = YamlConfiguration.loadConfiguration(reader); - assertNoRegexMatchesForAllEntries(lang, file, config); + void testSpelling(LanguagePreset lang, LanguageFile file) throws IOException, InvalidConfigurationException { + FileConfiguration config = readLanguageFile(lang, file); + if (config == null) { + return; } + assertNoRegexMatchesForAllEntries(lang, file, config); } } diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/TestDamageableItem.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/TestDamageableItem.java index d7aec62eec..7a97e33cf3 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/TestDamageableItem.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/TestDamageableItem.java @@ -20,7 +20,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; import io.github.thebusybiscuit.slimefun4.test.mocks.MockDamageable; - +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedEnchantment; import be.seeseemelk.mockbukkit.MockBukkit; import be.seeseemelk.mockbukkit.ServerMock; @@ -82,8 +82,8 @@ void testDamageableItemDamagesItem() { @DisplayName("Test if DamageableItem cares about unbreaking levels") void testDamageableItemCaresUnbreaking() { MockDamageable noUnbreakingItem = getDummyItem("NU", true, null, null); - MockDamageable iiiUnbreakingItem = getDummyItem("IIIU", true, Enchantment.DURABILITY, 3); - MockDamageable xUnbreakingItem = getDummyItem("XU", true, Enchantment.DURABILITY, 10); + MockDamageable iiiUnbreakingItem = getDummyItem("IIIU", true, VersionedEnchantment.UNBREAKING, 3); + MockDamageable xUnbreakingItem = getDummyItem("XU", true, VersionedEnchantment.UNBREAKING, 10); ItemStack noUnbreakingItemIS = noUnbreakingItem.getItem().clone(); ItemStack iiiUnbreakingItemIS = iiiUnbreakingItem.getItem().clone(); ItemStack xUnbreakingItemIS = xUnbreakingItem.getItem().clone(); diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/TestClimbingPick.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/TestClimbingPick.java index 53181b2c1b..9a43bc12f5 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/TestClimbingPick.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/TestClimbingPick.java @@ -7,7 +7,6 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.BlockFace; -import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; @@ -26,6 +25,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; import io.github.thebusybiscuit.slimefun4.test.presets.SlimefunItemTest; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedEnchantment; import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag; import be.seeseemelk.mockbukkit.MockBukkit; @@ -164,7 +164,7 @@ void testEfficiency() { private ItemStack getPickWithEfficiency(@Nonnull ClimbingPick pick, int level) { ItemStack item = pick.getItem().clone(); - item.addUnsafeEnchantment(Enchantment.DIG_SPEED, level); + item.addUnsafeEnchantment(VersionedEnchantment.EFFICIENCY, level); return item; } } diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCoolerListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCoolerListener.java index 5bd37ce19d..e606840cbc 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCoolerListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCoolerListener.java @@ -25,7 +25,6 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.backpacks.Cooler; import io.github.thebusybiscuit.slimefun4.implementation.items.food.Juice; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; - import be.seeseemelk.mockbukkit.MockBukkit; import be.seeseemelk.mockbukkit.ServerMock; diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestMinecraftVersion.java b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestMinecraftVersion.java index 72beee0091..74a2622cce 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestMinecraftVersion.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestMinecraftVersion.java @@ -11,11 +11,27 @@ class TestMinecraftVersion { @Test @DisplayName("Test if Minecraft versions match themselves") void testMatches() { - Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_16.isMinecraftVersion(16)); - Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_17.isMinecraftVersion(17)); + Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_16.isMinecraftVersion(16, -1)); + Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_17.isMinecraftVersion(17, -1)); + Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_20_5.isMinecraftVersion(20, 5)); - Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_17.isMinecraftVersion(16)); - Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_16.isMinecraftVersion(0)); + Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_17.isMinecraftVersion(16, -1)); + Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_16.isMinecraftVersion(0, -1)); + Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_20_5.isMinecraftVersion(20, 4)); + } + + @Test + @DisplayName("Test if Minecraft versions match minor versions") + void testMatchesMinor() { + Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_16.isMinecraftVersion(16, 1)); + Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_16.isMinecraftVersion(16, 2)); + + Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_20.isMinecraftVersion(20, 4)); + Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_20_5.isMinecraftVersion(20, 6)); + + Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_20.isMinecraftVersion(20, 5)); + Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_16.isMinecraftVersion(17, 1)); + Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_20_5.isMinecraftVersion(20, 4)); } @Test @@ -24,6 +40,8 @@ void testAtLeast() { Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_18.isAtLeast(MinecraftVersion.MINECRAFT_1_16)); Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_17.isAtLeast(MinecraftVersion.MINECRAFT_1_16)); Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_17.isAtLeast(MinecraftVersion.MINECRAFT_1_17)); + Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_20.isAtLeast(MinecraftVersion.MINECRAFT_1_20)); + Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_20_5.isAtLeast(MinecraftVersion.MINECRAFT_1_20)); Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_17.isAtLeast(MinecraftVersion.MINECRAFT_1_18)); } @@ -48,6 +66,24 @@ void testIsBefore() { Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_17.isBefore(MinecraftVersion.MINECRAFT_1_16)); } + @Test + @DisplayName("Test if Minecraft versions #isBefore behaves correctly for minor versions") + void testIsBeforeMinor() { + Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_18.isBefore(16, 5)); + Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_18.isBefore(17, 1)); + Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_18.isBefore(18, 0)); + Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_18.isBefore(18, 1)); + + Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_20.isBefore(20, 0)); + Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_20.isBefore(20, 2)); + Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_20.isBefore(20, 4)); + Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_20.isBefore(20, 5)); + + Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_20_5.isBefore(20, 4)); + Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_20_5.isBefore(20, 5)); + Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_20_5.isBefore(20, 6)); + } + @Test @DisplayName("Test correct behaviour for MinecraftVersion.UNKNOWN.isBefore(...)") void testIsBeforeUnknown() { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/biomes/TestBiomeMapCompatibility.java b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/biomes/TestBiomeMapCompatibility.java index cdb132d91c..99f7c6100f 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/biomes/TestBiomeMapCompatibility.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/biomes/TestBiomeMapCompatibility.java @@ -34,7 +34,7 @@ /** * This test checks if biome maps work across multiple versions of Minecraft. * A similar test can be written for Material Tags :? - * + * * @author TheBusyBiscuit * */ @@ -45,6 +45,9 @@ class TestBiomeMapCompatibility { @BeforeAll public static void load() { MockBukkit.mock(); + // Needed for JsonUtils.parseString which relies on a valid Slimefun plugin instance to determine the current + // MinecraftVersion + MockBukkit.load(Slimefun.class); for (MinecraftVersion version : MinecraftVersion.values()) { if (!version.isVirtual()) { @@ -91,7 +94,7 @@ void testCompatibilities(String name, MinecraftVersion version) { /** * We manually specify here which biome map works on which minecraft versions. - * + * * @return A {@link Stream} of {@link Arguments} for our unit test. */ private static @Nonnull Stream biomeMaps() { @@ -105,37 +108,37 @@ void testCompatibilities(String name, MinecraftVersion version) { MinecraftVersion.MINECRAFT_1_19, MinecraftVersion.MINECRAFT_1_20 }); - + testCases.put("oil_v1.16", new MinecraftVersion[] { MinecraftVersion.MINECRAFT_1_16, MinecraftVersion.MINECRAFT_1_17 }); - + testCases.put("oil_v1.18", new MinecraftVersion[] { MinecraftVersion.MINECRAFT_1_18, MinecraftVersion.MINECRAFT_1_19, MinecraftVersion.MINECRAFT_1_20 }); - + testCases.put("salt_v1.16", new MinecraftVersion[] { MinecraftVersion.MINECRAFT_1_16, MinecraftVersion.MINECRAFT_1_17 }); - + testCases.put("salt_v1.18", new MinecraftVersion[] { MinecraftVersion.MINECRAFT_1_18, MinecraftVersion.MINECRAFT_1_19, MinecraftVersion.MINECRAFT_1_20 }); - + testCases.put("uranium_v1.16", new MinecraftVersion[] { MinecraftVersion.MINECRAFT_1_16 }); - + testCases.put("uranium_v1.17", new MinecraftVersion[] { MinecraftVersion.MINECRAFT_1_17 }); - + testCases.put("uranium_v1.18", new MinecraftVersion[] { MinecraftVersion.MINECRAFT_1_18, MinecraftVersion.MINECRAFT_1_19, diff --git a/src/test/resources/biomes/1.20.5+.json b/src/test/resources/biomes/1.20.5+.json new file mode 100644 index 0000000000..dfe92f1834 --- /dev/null +++ b/src/test/resources/biomes/1.20.5+.json @@ -0,0 +1,67 @@ +[ + "minecraft:ocean", + "minecraft:plains", + "minecraft:desert", + "minecraft:windswept_hills", + "minecraft:forest", + "minecraft:taiga", + "minecraft:swamp", + "minecraft:mangrove_swamp", + "minecraft:river", + "minecraft:nether_wastes", + "minecraft:the_end", + "minecraft:frozen_ocean", + "minecraft:frozen_river", + "minecraft:snowy_plains", + "minecraft:mushroom_fields", + "minecraft:beach", + "minecraft:jungle", + "minecraft:sparse_jungle", + "minecraft:deep_ocean", + "minecraft:stony_shore", + "minecraft:snowy_beach", + "minecraft:birch_forest", + "minecraft:dark_forest", + "minecraft:snowy_taiga", + "minecraft:old_growth_pine_taiga", + "minecraft:windswept_forest", + "minecraft:savanna", + "minecraft:savanna_plateau", + "minecraft:badlands", + "minecraft:wooded_badlands", + "minecraft:small_end_islands", + "minecraft:end_midlands", + "minecraft:end_highlands", + "minecraft:end_barrens", + "minecraft:warm_ocean", + "minecraft:lukewarm_ocean", + "minecraft:cold_ocean", + "minecraft:deep_lukewarm_ocean", + "minecraft:deep_cold_ocean", + "minecraft:deep_frozen_ocean", + "minecraft:the_void", + "minecraft:sunflower_plains", + "minecraft:windswept_gravelly_hills", + "minecraft:flower_forest", + "minecraft:ice_spikes", + "minecraft:old_growth_birch_forest", + "minecraft:old_growth_spruce_taiga", + "minecraft:windswept_savanna", + "minecraft:eroded_badlands", + "minecraft:bamboo_jungle", + "minecraft:soul_sand_valley", + "minecraft:crimson_forest", + "minecraft:warped_forest", + "minecraft:basalt_deltas", + "minecraft:dripstone_caves", + "minecraft:lush_caves", + "minecraft:deep_dark", + "minecraft:meadow", + "minecraft:grove", + "minecraft:snowy_slopes", + "minecraft:frozen_peaks", + "minecraft:jagged_peaks", + "minecraft:stony_peaks", + "minecraft:cherry_grove", + "minecraft:custom", +] \ No newline at end of file