Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 1.21 #4248

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
default: help

.PHONY: help
help:
@echo " * gen-biomes version=<version> - Generate biomes for the given version"

.PHONY: gen-biomes
gen-biomes:
@echo "Generating biomes for $(version)"
@curl "https://raw.githubusercontent.com/MockBukkit/MockBukkit/refs/heads/v$(version)/src/main/resources/keyed/worldgen/biome.json" -s \
| jq '[ .values[].key]' \
> "src/test/resources/biomes/$(version).x.json"
41 changes: 18 additions & 23 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<packaging>jar</packaging>

<!-- Project Info -->
<description>Slimefun is a Spigot/Paper plugin that simulates a modpack-like atmosphere by adding over 500 new items and recipes to your Minecraft Server.</description>
<description>Slimefun is a Paper plugin that simulates a modpack-like atmosphere by adding over 500 new items and recipes to your Minecraft Server.</description>
<url>https://github.com/Slimefun/Slimefun4</url>

<properties>
Expand All @@ -29,8 +29,8 @@
<maven.compiler.testTarget>21</maven.compiler.testTarget>

<!-- Spigot properties -->
<spigot.version>1.20.6</spigot.version>
<spigot.javadocs>https://hub.spigotmc.org/javadocs/spigot/</spigot.javadocs>
<paper.version>1.21.1</paper.version>
<paper.javadocs>https://hub.spigotmc.org/javadocs/spigot/</paper.javadocs>

<!-- Default settings for sonarcloud.io -->
<sonar.projectKey>Slimefun_Slimefun4</sonar.projectKey>
Expand Down Expand Up @@ -238,7 +238,7 @@
<!-- Javadocs -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.7.0</version>
<version>3.10.0</version>

<configuration>
<reportOutputDirectory>${project.basedir}</reportOutputDirectory>
Expand All @@ -251,7 +251,7 @@

<links>
<!-- We can reference the Spigot API in our Javadocs -->
<link>${spigot.javadocs}</link>
<link>${paper.javadocs}</link>
</links>

<!-- We can group packages together in our Javadocs -->
Expand Down Expand Up @@ -355,9 +355,9 @@

<!-- Shaded packages -->
<dependency>
<groupId>com.github.baked-libs.dough</groupId>
<groupId>com.github.Slimefun.dough</groupId>
<artifactId>dough-api</artifactId>
<version>f8ff25187d</version>
<version>cb22e71335</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand All @@ -367,6 +367,14 @@
<scope>compile</scope>
</dependency>

<!-- Paper -->
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>${paper.version}-R0.1-SNAPSHOT</version>
WalshyDev marked this conversation as resolved.
Show resolved Hide resolved
<scope>provided</scope>
</dependency>

<!-- Testing dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand All @@ -387,9 +395,9 @@
</dependency>
<!-- This needs to be before Spigot because MockBukkit will fail otherwise. -->
<dependency>
<groupId>com.github.MockBukkit</groupId>
<artifactId>MockBukkit</artifactId>
<version>c7cc678834</version>
<groupId>com.github.seeseemelk</groupId>
<artifactId>MockBukkit-v1.21</artifactId>
<version>3.133.2</version>
<scope>test</scope>

<exclusions>
Expand All @@ -401,13 +409,6 @@
</exclusion>
</exclusions>
</dependency>
<!-- Override Spigot with Paper tests as a CommandMap ctor which MockBukkit uses only exists on Paper but not in Spigot -->
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.20.6-R0.1-SNAPSHOT</version>
<scope>test</scope>
</dependency>

<!-- Third party plugin integrations / soft dependencies -->
<dependency>
Expand Down Expand Up @@ -515,12 +516,6 @@
<version>2.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${spigot.version}-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ public enum MinecraftVersion {
*/
MINECRAFT_1_20_5(20, 5, "1.20.5+"),

/**
* This constant represents Minecraft (Java Edition) Version 1.21
* ("Tricky Trials")
*/
MINECRAFT_1_21(21, 0, "1.21.x"),

/**
* This constant represents an exceptional state in which we were unable
* to identify the Minecraft Version we are using
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
/**
* The {@link ResourceManager} is responsible for registering and managing a {@link GEOResource}.
* You have to use the {@link ResourceManager} if you want to generate or consume a {@link GEOResource} too.
*
*
* @author TheBusyBiscuit
*
*
* @see GEOResource
* @see GEOMiner
* @see GEOScanner
Expand All @@ -53,7 +53,7 @@ public class ResourceManager {

/**
* This will create a new {@link ResourceManager}.
*
*
* @param plugin
* Our {@link Slimefun} instance
*/
Expand All @@ -64,7 +64,7 @@ public ResourceManager(@Nonnull Slimefun plugin) {
/**
* This method registers the given {@link GEOResource}.
* It may never be called directly, use {@link GEOResource#register()} instead.
*
*
* @param resource
* The {@link GEOResource} to register
*/
Expand Down Expand Up @@ -93,7 +93,7 @@ void register(@Nonnull GEOResource resource) {
* This method returns the amount of a certain {@link GEOResource} found in a given {@link Chunk}.
* The result is an {@link OptionalInt} which will be empty if this {@link GEOResource}
* has not been generated at that {@link Location} yet.
*
*
* @param resource
* The {@link GEOResource} to query
* @param world
Expand All @@ -102,7 +102,7 @@ void register(@Nonnull GEOResource resource) {
* The {@link Chunk} x coordinate
* @param z
* The {@link Chunk} z coordinate
*
*
* @return An {@link OptionalInt}, either empty or containing the amount of the given {@link GEOResource}
*/
public @Nonnull OptionalInt getSupplies(@Nonnull GEOResource resource, @Nonnull World world, int x, int z) {
Expand All @@ -121,7 +121,7 @@ void register(@Nonnull GEOResource resource) {

/**
* This method will set the supplies in a given {@link Chunk} to the specified value.
*
*
* @param resource
* The {@link GEOResource}
* @param world
Expand All @@ -147,7 +147,7 @@ public void setSupplies(@Nonnull GEOResource resource, @Nonnull World world, int
* <p>
* This method will invoke {@link #setSupplies(GEOResource, World, int, int, int)} and also calls a
* {@link GEOResourceGenerationEvent}.
*
*
* @param resource
* The {@link GEOResource} to generate
* @param world
Expand All @@ -156,7 +156,7 @@ public void setSupplies(@Nonnull GEOResource resource, @Nonnull World world, int
* The x coordinate of that {@link Chunk}
* @param z
* The z coordinate of that {@link Chunk}
*
*
* @return The new supply value
*/
private int generate(@Nonnull GEOResource resource, @Nonnull World world, int x, int y, int z) {
Expand Down Expand Up @@ -199,11 +199,11 @@ private int generate(@Nonnull GEOResource resource, @Nonnull World world, int x,
/**
* This method will start a geo-scan at the given {@link Block} and display the result
* of that scan to the given {@link Player}.
*
*
* Note that scans are always per {@link Chunk}, not per {@link Block}, the {@link Block}
* parameter only determines the {@link Location} that was clicked but it will still scan
* the entire {@link Chunk}.
*
*
* @param p
* The {@link Player} who requested these results
* @param block
Expand All @@ -227,7 +227,7 @@ public void scan(@Nonnull Player p, @Nonnull Block block, int page) {
menu.addItem(slot, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
}

menu.addItem(4, new CustomItemStack(HeadTexture.MINECRAFT_CHUNK.getAsItemStack(), ChatColor.YELLOW + Slimefun.getLocalization().getResourceString(p, "tooltips.chunk"), "", "&8\u21E8 &7" + Slimefun.getLocalization().getResourceString(p, "tooltips.world") + ": " + block.getWorld().getName(), "&8\u21E8 &7X: " + x + " Z: " + z), ChestMenuUtils.getEmptyClickHandler());
menu.addItem(4, CustomItemStack.create(HeadTexture.MINECRAFT_CHUNK.getAsItemStack(), ChatColor.YELLOW + Slimefun.getLocalization().getResourceString(p, "tooltips.chunk"), "", "&8\u21E8 &7" + Slimefun.getLocalization().getResourceString(p, "tooltips.world") + ": " + block.getWorld().getName(), "&8\u21E8 &7X: " + x + " Z: " + z), ChestMenuUtils.getEmptyClickHandler());
List<GEOResource> resources = new ArrayList<>(Slimefun.getRegistry().getGEOResources().values());
resources.sort(Comparator.comparing(a -> a.getName(p).toLowerCase(Locale.ROOT)));

Expand All @@ -240,7 +240,7 @@ public void scan(@Nonnull Player p, @Nonnull Block block, int page) {
int supplies = optional.orElseGet(() -> generate(resource, block.getWorld(), x, block.getY(), z));
String suffix = Slimefun.getLocalization().getResourceString(p, ChatUtils.checkPlurality("tooltips.unit", supplies));

ItemStack item = new CustomItemStack(resource.getItem(), "&f" + resource.getName(p), "&8\u21E8 &e" + supplies + ' ' + suffix);
ItemStack item = CustomItemStack.create(resource.getItem(), "&f" + resource.getName(p), "&8\u21E8 &e" + supplies + ' ' + suffix);

if (supplies > 1) {
item.setAmount(Math.min(supplies, item.getMaxStackSize()));
Expand Down
Loading
Loading