Skip to content

Commit 3544459

Browse files
WalshyDevmd5sha256
andauthored
Update to 1.21 (#4248)
**Note: This is experimental and will break all addons not yet supporting 1.21! Use at your own risk** * Update to 1.21 * Add a temporary InventoryViewWrapper in tests. Refactor TestBackpackListener to use the wrapper on Player#getOpenInventory * Wrap the inventory view after the backpack has been opened * Updates usages of CustomItemStack (#4253) Co-authored-by: Daniel Walsh <walshydev@gmail.com> * Remove EnumMap and EnumSet usages (#4258) --------- Co-authored-by: Andrew Wong <42793301+md5sha256@users.noreply.github.com>
1 parent 01137f9 commit 3544459

File tree

121 files changed

+876
-729
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+876
-729
lines changed

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
default: help
2+
3+
.PHONY: help
4+
help:
5+
@echo " * gen-biomes version=<version> - Generate biomes for the given version"
6+
7+
.PHONY: gen-biomes
8+
gen-biomes:
9+
@echo "Generating biomes for $(version)"
10+
@curl "https://raw.githubusercontent.com/MockBukkit/MockBukkit/refs/heads/v$(version)/src/main/resources/keyed/worldgen/biome.json" -s \
11+
| jq '[ .values[].key]' \
12+
> "src/test/resources/biomes/$(version).x.json"

pom.xml

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<packaging>jar</packaging>
1515

1616
<!-- Project Info -->
17-
<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>
17+
<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>
1818
<url>https://github.com/Slimefun/Slimefun4</url>
1919

2020
<properties>
@@ -29,8 +29,8 @@
2929
<maven.compiler.testTarget>21</maven.compiler.testTarget>
3030

3131
<!-- Spigot properties -->
32-
<spigot.version>1.20.6</spigot.version>
33-
<spigot.javadocs>https://hub.spigotmc.org/javadocs/spigot/</spigot.javadocs>
32+
<paper.version>1.21.1</paper.version>
33+
<paper.javadocs>https://hub.spigotmc.org/javadocs/spigot/</paper.javadocs>
3434

3535
<!-- Default settings for sonarcloud.io -->
3636
<sonar.projectKey>Slimefun_Slimefun4</sonar.projectKey>
@@ -251,7 +251,7 @@
251251

252252
<links>
253253
<!-- We can reference the Spigot API in our Javadocs -->
254-
<link>${spigot.javadocs}</link>
254+
<link>${paper.javadocs}</link>
255255
</links>
256256

257257
<!-- We can group packages together in our Javadocs -->
@@ -355,9 +355,9 @@
355355

356356
<!-- Shaded packages -->
357357
<dependency>
358-
<groupId>com.github.baked-libs.dough</groupId>
358+
<groupId>com.github.Slimefun.dough</groupId>
359359
<artifactId>dough-api</artifactId>
360-
<version>f8ff25187d</version>
360+
<version>cb22e71335</version>
361361
<scope>compile</scope>
362362
</dependency>
363363
<dependency>
@@ -367,6 +367,14 @@
367367
<scope>compile</scope>
368368
</dependency>
369369

370+
<!-- Paper -->
371+
<dependency>
372+
<groupId>io.papermc.paper</groupId>
373+
<artifactId>paper-api</artifactId>
374+
<version>${paper.version}-R0.1-SNAPSHOT</version>
375+
<scope>provided</scope>
376+
</dependency>
377+
370378
<!-- Testing dependencies -->
371379
<dependency>
372380
<groupId>org.junit.jupiter</groupId>
@@ -387,9 +395,9 @@
387395
</dependency>
388396
<!-- This needs to be before Spigot because MockBukkit will fail otherwise. -->
389397
<dependency>
390-
<groupId>com.github.MockBukkit</groupId>
391-
<artifactId>MockBukkit</artifactId>
392-
<version>c7cc678834</version>
398+
<groupId>com.github.seeseemelk</groupId>
399+
<artifactId>MockBukkit-v1.21</artifactId>
400+
<version>3.133.2</version>
393401
<scope>test</scope>
394402

395403
<exclusions>
@@ -401,13 +409,6 @@
401409
</exclusion>
402410
</exclusions>
403411
</dependency>
404-
<!-- Override Spigot with Paper tests as a CommandMap ctor which MockBukkit uses only exists on Paper but not in Spigot -->
405-
<dependency>
406-
<groupId>io.papermc.paper</groupId>
407-
<artifactId>paper-api</artifactId>
408-
<version>1.20.6-R0.1-SNAPSHOT</version>
409-
<scope>test</scope>
410-
</dependency>
411412

412413
<!-- Third party plugin integrations / soft dependencies -->
413414
<dependency>
@@ -515,12 +516,6 @@
515516
<version>2.6</version>
516517
<scope>compile</scope>
517518
</dependency>
518-
<dependency>
519-
<groupId>org.spigotmc</groupId>
520-
<artifactId>spigot-api</artifactId>
521-
<version>${spigot.version}-R0.1-SNAPSHOT</version>
522-
<scope>provided</scope>
523-
</dependency>
524519
<dependency>
525520
<groupId>com.mojang</groupId>
526521
<artifactId>authlib</artifactId>

src/main/java/io/github/thebusybiscuit/slimefun4/api/MinecraftVersion.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ public enum MinecraftVersion {
5555
*/
5656
MINECRAFT_1_20_5(20, 5, "1.20.5+"),
5757

58+
/**
59+
* This constant represents Minecraft (Java Edition) Version 1.21
60+
* ("Tricky Trials")
61+
*/
62+
MINECRAFT_1_21(21, 0, "1.21.x"),
63+
5864
/**
5965
* This constant represents an exceptional state in which we were unable
6066
* to identify the Minecraft Version we are using

src/main/java/io/github/thebusybiscuit/slimefun4/api/geo/ResourceManager.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
/**
3939
* The {@link ResourceManager} is responsible for registering and managing a {@link GEOResource}.
4040
* You have to use the {@link ResourceManager} if you want to generate or consume a {@link GEOResource} too.
41-
*
41+
*
4242
* @author TheBusyBiscuit
43-
*
43+
*
4444
* @see GEOResource
4545
* @see GEOMiner
4646
* @see GEOScanner
@@ -53,7 +53,7 @@ public class ResourceManager {
5353

5454
/**
5555
* This will create a new {@link ResourceManager}.
56-
*
56+
*
5757
* @param plugin
5858
* Our {@link Slimefun} instance
5959
*/
@@ -64,7 +64,7 @@ public ResourceManager(@Nonnull Slimefun plugin) {
6464
/**
6565
* This method registers the given {@link GEOResource}.
6666
* It may never be called directly, use {@link GEOResource#register()} instead.
67-
*
67+
*
6868
* @param resource
6969
* The {@link GEOResource} to register
7070
*/
@@ -93,7 +93,7 @@ void register(@Nonnull GEOResource resource) {
9393
* This method returns the amount of a certain {@link GEOResource} found in a given {@link Chunk}.
9494
* The result is an {@link OptionalInt} which will be empty if this {@link GEOResource}
9595
* has not been generated at that {@link Location} yet.
96-
*
96+
*
9797
* @param resource
9898
* The {@link GEOResource} to query
9999
* @param world
@@ -102,7 +102,7 @@ void register(@Nonnull GEOResource resource) {
102102
* The {@link Chunk} x coordinate
103103
* @param z
104104
* The {@link Chunk} z coordinate
105-
*
105+
*
106106
* @return An {@link OptionalInt}, either empty or containing the amount of the given {@link GEOResource}
107107
*/
108108
public @Nonnull OptionalInt getSupplies(@Nonnull GEOResource resource, @Nonnull World world, int x, int z) {
@@ -121,7 +121,7 @@ void register(@Nonnull GEOResource resource) {
121121

122122
/**
123123
* This method will set the supplies in a given {@link Chunk} to the specified value.
124-
*
124+
*
125125
* @param resource
126126
* The {@link GEOResource}
127127
* @param world
@@ -147,7 +147,7 @@ public void setSupplies(@Nonnull GEOResource resource, @Nonnull World world, int
147147
* <p>
148148
* This method will invoke {@link #setSupplies(GEOResource, World, int, int, int)} and also calls a
149149
* {@link GEOResourceGenerationEvent}.
150-
*
150+
*
151151
* @param resource
152152
* The {@link GEOResource} to generate
153153
* @param world
@@ -156,7 +156,7 @@ public void setSupplies(@Nonnull GEOResource resource, @Nonnull World world, int
156156
* The x coordinate of that {@link Chunk}
157157
* @param z
158158
* The z coordinate of that {@link Chunk}
159-
*
159+
*
160160
* @return The new supply value
161161
*/
162162
private int generate(@Nonnull GEOResource resource, @Nonnull World world, int x, int y, int z) {
@@ -199,11 +199,11 @@ private int generate(@Nonnull GEOResource resource, @Nonnull World world, int x,
199199
/**
200200
* This method will start a geo-scan at the given {@link Block} and display the result
201201
* of that scan to the given {@link Player}.
202-
*
202+
*
203203
* Note that scans are always per {@link Chunk}, not per {@link Block}, the {@link Block}
204204
* parameter only determines the {@link Location} that was clicked but it will still scan
205205
* the entire {@link Chunk}.
206-
*
206+
*
207207
* @param p
208208
* The {@link Player} who requested these results
209209
* @param block
@@ -227,7 +227,7 @@ public void scan(@Nonnull Player p, @Nonnull Block block, int page) {
227227
menu.addItem(slot, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
228228
}
229229

230-
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());
230+
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());
231231
List<GEOResource> resources = new ArrayList<>(Slimefun.getRegistry().getGEOResources().values());
232232
resources.sort(Comparator.comparing(a -> a.getName(p).toLowerCase(Locale.ROOT)));
233233

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

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

245245
if (supplies > 1) {
246246
item.setAmount(Math.min(supplies, item.getMaxStackSize()));

0 commit comments

Comments
 (0)