Update to Minecraft 1.21.5 (#6109)

This commit is contained in:
Josh Roy 2025-03-29 18:49:13 -04:00 committed by GitHub
parent 0cb387fb05
commit f09541cfa6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 154 additions and 8 deletions

View File

@ -9,6 +9,8 @@ import org.bukkit.TreeSpecies;
import org.bukkit.entity.Axolotl;
import org.bukkit.entity.Boat;
import org.bukkit.entity.Camel;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Cow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Fox;
@ -18,6 +20,7 @@ import org.bukkit.entity.MushroomCow;
import org.bukkit.entity.Ocelot;
import org.bukkit.entity.Panda;
import org.bukkit.entity.Parrot;
import org.bukkit.entity.Pig;
import org.bukkit.entity.Player;
import org.bukkit.entity.Salmon;
import org.bukkit.entity.TropicalFish;
@ -25,6 +28,9 @@ import org.bukkit.entity.Villager;
import org.bukkit.entity.Wolf;
import org.bukkit.inventory.ItemStack;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.lang.reflect.Method;
import static com.earth2me.essentials.utils.EnumUtil.getEntityType;
@ -32,8 +38,21 @@ import static com.earth2me.essentials.utils.EnumUtil.getEntityType;
public final class MobCompat {
// Constants for mob interfaces added in later versions
@SuppressWarnings("rawtypes")
public static final Class RAIDER = ReflUtil.getClassCached("org.bukkit.entity.Raider");
public static final Class<?> RAIDER = ReflUtil.getClassCached("org.bukkit.entity.Raider");
// Stupid hacks to avoid Commodore rewrites.
private static final Class<?> COW = ReflUtil.getClassCached("org.bukkit.entity.Cow");
private static final Class<?> COW_VARIANT = ReflUtil.getClassCached("org.bukkit.entity.Cow$Variant");
private static final MethodHandle COW_VARIANT_HANDLE;
static {
MethodHandle handle = null;
try {
handle = MethodHandles.lookup().findVirtual(COW, "setVariant", MethodType.methodType(void.class, COW_VARIANT));
} catch (NoSuchMethodException | IllegalAccessException ignored) {
}
COW_VARIANT_HANDLE = handle;
}
// Constants for mobs added in later versions
public static final EntityType LLAMA = getEntityType("LLAMA");
@ -250,6 +269,41 @@ public final class MobCompat {
}
}
public static void setCowVariant(final Entity spawned, final String variant) {
if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_21_5_R01) || COW_VARIANT_HANDLE == null) {
return;
}
if (spawned instanceof Cow) {
try {
COW_VARIANT_HANDLE.invoke(spawned, RegistryUtil.valueOf(COW_VARIANT, variant));
} catch (Throwable ignored) {
}
}
}
public static void setChickenVariant(final Entity spawned, final String variant) {
if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_21_5_R01)) {
return;
}
if (spawned instanceof Chicken) {
//noinspection DataFlowIssue
((Chicken) spawned).setVariant(RegistryUtil.valueOf(Chicken.Variant.class, variant));
}
}
public static void setPigVariant(final Entity spawned, final String variant) {
if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_21_5_R01)) {
return;
}
if (spawned instanceof Pig) {
//noinspection DataFlowIssue
((Pig) spawned).setVariant(RegistryUtil.valueOf(Pig.Variant.class, variant));
}
}
public enum CatType {
// These are (loosely) Mojang names for the cats
SIAMESE("SIAMESE", "SIAMESE_CAT"),

View File

@ -10,6 +10,7 @@ import org.bukkit.Material;
import org.bukkit.entity.Ageable;
import org.bukkit.entity.Boat;
import org.bukkit.entity.ChestedHorse;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
@ -221,6 +222,15 @@ public enum MobData {
SMALL_SALMON("small", MobCompat.SALMON, "salmon:SMALL", true),
MEDIUM_SALMON("medium", MobCompat.SALMON, "salmon:MEDIUM", true),
LARGE_SALMON("large", MobCompat.SALMON, "salmon:LARGE", true),
TEMPERATE_COW("temperate", EntityType.COW.getEntityClass(), "cow:TEMPERATE", true),
WARM_COW("warm", EntityType.COW.getEntityClass(), "cow:WARM", true),
COLD_COW("cold", EntityType.COW.getEntityClass(), "cow:COLD", true),
TEMPERATE_CHICKEN("temperate", Chicken.class, "chicken:TEMPERATE", true),
WARM_CHICKEN("warm", Chicken.class, "chicken:WARM", true),
COLD_CHICKEN("cold", Chicken.class, "chicken:COLD", true),
TEMPERATE_PIG("temperate", Pig.class, "pig:TEMPERATE", true),
WARM_PIG("warm", Pig.class, "pig:WARM", true),
COLD_PIG("cold", Pig.class, "pig:COLD", true),
;
final private String nickname;
@ -442,6 +452,15 @@ public enum MobData {
case "salmon":
MobCompat.setSalmonSize(spawned, split[1]);
break;
case "cow":
MobCompat.setCowVariant(spawned, split[1]);
break;
case "chicken":
MobCompat.setChickenVariant(spawned, split[1]);
break;
case "pig":
MobCompat.setPigVariant(spawned, split[1]);
break;
}
} else {
Essentials.getWrappedLogger().warning("Unknown mob data type: " + this.toString());

View File

@ -38,13 +38,12 @@ public final class VersionUtil {
public static final BukkitVersion v1_19_R01 = BukkitVersion.fromString("1.19-R0.1-SNAPSHOT");
public static final BukkitVersion v1_19_4_R01 = BukkitVersion.fromString("1.19.4-R0.1-SNAPSHOT");
public static final BukkitVersion v1_20_1_R01 = BukkitVersion.fromString("1.20.1-R0.1-SNAPSHOT");
public static final BukkitVersion v1_20_4_R01 = BukkitVersion.fromString("1.20.4-R0.1-SNAPSHOT");
public static final BukkitVersion v1_20_6_R01 = BukkitVersion.fromString("1.20.6-R0.1-SNAPSHOT");
public static final BukkitVersion v1_21_R01 = BukkitVersion.fromString("1.21-R0.1-SNAPSHOT");
public static final BukkitVersion v1_21_3_R01 = BukkitVersion.fromString("1.21.3-R0.1-SNAPSHOT");
public static final BukkitVersion v1_21_4_R01 = BukkitVersion.fromString("1.21.4-R0.1-SNAPSHOT");
public static final BukkitVersion v1_21_5_R01 = BukkitVersion.fromString("1.21.5-R0.1-SNAPSHOT");
private static final Set<BukkitVersion> supportedVersions = ImmutableSet.of(v1_8_8_R01, v1_9_4_R01, v1_10_2_R01, v1_11_2_R01, v1_12_2_R01, v1_13_2_R01, v1_14_4_R01, v1_15_2_R01, v1_16_5_R01, v1_17_1_R01, v1_18_2_R01, v1_19_4_R01, v1_20_6_R01, v1_21_4_R01);
private static final Set<BukkitVersion> supportedVersions = ImmutableSet.of(v1_8_8_R01, v1_9_4_R01, v1_10_2_R01, v1_11_2_R01, v1_12_2_R01, v1_13_2_R01, v1_14_4_R01, v1_15_2_R01, v1_16_5_R01, v1_17_1_R01, v1_18_2_R01, v1_19_4_R01, v1_20_6_R01, v1_21_5_R01);
public static final boolean PRE_FLATTENING = VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_13_0_R01);

View File

@ -2003,6 +2003,11 @@
"bludye": "blue_dye",
"bluedye": "blue_dye",
"minecraft:blue_dye": "blue_dye",
"blue_egg": {
"material": "BLUE_EGG"
},
"blueegg": "blue_egg",
"minecraft:blue_egg": "blue_egg",
"blue_glazed_terracotta": {
"material": "BLUE_GLAZED_TERRACOTTA"
},
@ -2322,6 +2327,11 @@
"brodye": "brown_dye",
"browndye": "brown_dye",
"minecraft:brown_dye": "brown_dye",
"brown_egg": {
"material": "BROWN_EGG"
},
"brownegg": "brown_egg",
"minecraft:brown_egg": "brown_egg",
"brown_glazed_terracotta": {
"material": "BROWN_GLAZED_TERRACOTTA"
},
@ -2469,12 +2479,28 @@
"burnpotterysherd": "burn_pottery_sherd",
"burnsherd": "burn_pottery_sherd",
"minecraft:burn_pottery_sherd": "burn_pottery_sherd",
"bush": {
"material": "BUSH"
},
"gbush": "bush",
"grassbush": "bush",
"minecraft:bush": "bush",
"cactus": {
"material": "CACTUS"
},
"cacti": "cactus",
"cactuses": "cactus",
"minecraft:cactus": "cactus",
"cactus_flower": {
"material": "CACTUS_FLOWER"
},
"cactiflower": "cactus_flower",
"cactusflower": "cactus_flower",
"cflower": "cactus_flower",
"flowerc": "cactus_flower",
"flowercacti": "cactus_flower",
"flowercactus": "cactus_flower",
"minecraft:cactus_flower": "cactus_flower",
"cake": {
"material": "CAKE"
},
@ -5712,7 +5738,6 @@
"dead_bush": {
"material": "DEAD_BUSH"
},
"bush": "dead_bush",
"dbush": "dead_bush",
"deadbush": "dead_bush",
"deadsapling": "dead_bush",
@ -7425,6 +7450,13 @@
"firerestarr": "fire_resistance_tipped_arrow",
"firerestarrow": "fire_resistance_tipped_arrow",
"firerestippedarrow": "fire_resistance_tipped_arrow",
"firefly_bush": {
"material": "FIREFLY_BUSH"
},
"ffbush": "firefly_bush",
"firebush": "firefly_bush",
"fireflybush": "firefly_bush",
"minecraft:firefly_bush": "firefly_bush",
"firework_rocket": {
"material": "FIREWORK_ROCKET"
},
@ -11428,6 +11460,15 @@
"material": "LEAD"
},
"minecraft:lead": "lead",
"leaf_litter": {
"material": "LEAF_LITTER"
},
"leaflit": "leaf_litter",
"leaflitter": "leaf_litter",
"litter": "leaf_litter",
"llitter": "leaf_litter",
"minecraft:leaf_litter": "leaf_litter",
"spottedleaf": "leaf_litter",
"leaping_lingering_potion": {
"potionData": {
"type": "LEAPING",
@ -27238,6 +27279,14 @@
"minecraft:shield": "shield",
"woodenshield": "shield",
"woodshield": "shield",
"short_dry_grass": {
"material": "SHORT_DRY_GRASS"
},
"minecraft:short_dry_grass": "short_dry_grass",
"sdgrass": "short_dry_grass",
"sdrygrass": "short_dry_grass",
"shortdgrass": "short_dry_grass",
"shortdrygrass": "short_dry_grass",
"short_grass": {
"material": "SHORT_GRASS",
"fallbacks": [
@ -33146,6 +33195,14 @@
"tadpolemonsterspawner": "tadpole_spawner",
"tadpolemspawner": "tadpole_spawner",
"tadpolespawner": "tadpole_spawner",
"tall_dry_grass": {
"material": "TALL_DRY_GRASS"
},
"minecraft:tall_dry_grass": "tall_dry_grass",
"talldgrass": "tall_dry_grass",
"talldrygrass": "tall_dry_grass",
"tdgrass": "tall_dry_grass",
"tdrygrass": "tall_dry_grass",
"tall_grass": {
"material": "TALL_GRASS"
},
@ -33167,6 +33224,16 @@
"material": "TERRACOTTA"
},
"minecraft:terracotta": "terracotta",
"test_block": {
"material": "TEST_BLOCK"
},
"minecraft:test_block": "test_block",
"testblock": "test_block",
"test_instance_block": {
"material": "TEST_INSTANCE_BLOCK"
},
"minecraft:test_instance_block": "test_instance_block",
"testinstanceblock": "test_instance_block",
"thick_lingering_potion": {
"potionData": {
"type": "THICK",
@ -46809,6 +46876,13 @@
"minecraft:wild_armor_trim_smithing_template": "wild_armor_trim_smithing_template",
"wildarmortrimsmithingtemplate": "wild_armor_trim_smithing_template",
"wildtrim": "wild_armor_trim_smithing_template",
"wildflowers": {
"material": "WILDFLOWERS"
},
"minecraft:wildflowers": "wildflowers",
"wflower": "wildflowers",
"wflowers": "wildflowers",
"wildflower": "wildflowers",
"wind_charge": {
"material": "WIND_CHARGE"
},

View File

@ -26,7 +26,7 @@ however, have some new requirements:
* **EssentialsX requires CraftBukkit, Spigot or Paper to run.** Other server software may work, but these are not tested
by the team and we may not be able to help with any issues that occur.
* **EssentialsX currently supports Minecraft versions 1.8.8, 1.9.4, 1.10.2, 1.11.2, 1.12.2, 1.13.2, 1.14.4, 1.15.2,
1.16.5, 1.17.1, 1.18.2, 1.19.4, 1.20.6, and 1.21.4.**
1.16.5, 1.17.1, 1.18.2, 1.19.4, 1.20.6, and 1.21.5.**
* **EssentialsX currently requires Java 8 or higher.** We recommend using the latest Java version supported by your
server software.
* **EssentialsX requires [Vault](http://dev.bukkit.org/bukkit-plugins/vault/) to enable using chat prefix/suffixes and

View File

@ -10,7 +10,7 @@ plugins {
val baseExtension = extensions.create<EssentialsBaseExtension>("essentials", project)
val checkstyleVersion = "8.36.2"
val spigotVersion = "1.21.4-R0.1-SNAPSHOT"
val spigotVersion = "1.21.5-R0.1-SNAPSHOT"
val junit5Version = "5.10.2"
val mockitoVersion = "3.12.4"