Skip to content

Commit

Permalink
Add support for Minecraft 1.20.4
Browse files Browse the repository at this point in the history
  • Loading branch information
PseudoKnight committed Dec 8, 2023
1 parent 62a04f0 commit f2b77ca
Show file tree
Hide file tree
Showing 16 changed files with 205 additions and 120 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
<!-- GPL -->
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.20.2-R0.1-SNAPSHOT</version>
<version>1.20.4-R0.1-SNAPSHOT</version>
</dependency>

<!-- Used for storing and retreiving Constructs in a storage transparent medium: JSONs -->
Expand Down
79 changes: 74 additions & 5 deletions src/main/java/com/laytonsmith/abstraction/blocks/MCMaterial.java
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ public enum MCVanillaMaterial {
CHISELED_SANDSTONE,
CUT_SANDSTONE,
COBWEB,
GRASS,
GRASS(MCVersion.MC1_0, MCVersion.MC1_20_2),
SHORT_GRASS(MCVersion.MC1_20_X), // changed from GRASS
FERN,
DEAD_BUSH,
SEAGRASS,
Expand Down Expand Up @@ -1390,6 +1391,7 @@ public enum MCVanillaMaterial {
SPYGLASS(MCVersion.MC1_17),
TINTED_GLASS(MCVersion.MC1_17),
TUFF(MCVersion.MC1_17),
GRASS_PATH(MCVersion.MC1_9, MCVersion.MC1_16_X),
DIRT_PATH(MCVersion.MC1_17), // changed from GRASS_PATH
WATER_CAULDRON(MCVersion.MC1_17),
LAVA_CAULDRON(MCVersion.MC1_17),
Expand Down Expand Up @@ -1579,20 +1581,87 @@ public enum MCVanillaMaterial {
SHEAF_POTTERY_SHERD(MCVersion.MC1_20),
SHELTER_POTTERY_SHERD(MCVersion.MC1_20),
SKULL_POTTERY_SHERD(MCVersion.MC1_20),
SNORT_POTTERY_SHERD(MCVersion.MC1_20);
SNORT_POTTERY_SHERD(MCVersion.MC1_20),

// 1.20.3 experimental additions for 1.21
CRAFTER(MCVersion.MC1_20_X),
CHISELED_COPPER(MCVersion.MC1_20_X),
EXPOSED_CHISELED_COPPER(MCVersion.MC1_20_X),
WEATHERED_CHISELED_COPPER(MCVersion.MC1_20_X),
OXIDIZED_CHISELED_COPPER(MCVersion.MC1_20_X),
WAXED_CHISELED_COPPER(MCVersion.MC1_20_X),
WAXED_EXPOSED_CHISELED_COPPER(MCVersion.MC1_20_X),
WAXED_WEATHERED_CHISELED_COPPER(MCVersion.MC1_20_X),
WAXED_OXIDIZED_CHISELED_COPPER(MCVersion.MC1_20_X),
COPPER_BULB(MCVersion.MC1_20_X),
EXPOSED_COPPER_BULB(MCVersion.MC1_20_X),
WEATHERED_COPPER_BULB(MCVersion.MC1_20_X),
OXIDIZED_COPPER_BULB(MCVersion.MC1_20_X),
WAXED_COPPER_BULB(MCVersion.MC1_20_X),
WAXED_EXPOSED_COPPER_BULB(MCVersion.MC1_20_X),
WAXED_WEATHERED_COPPER_BULB(MCVersion.MC1_20_X),
WAXED_OXIDIZED_COPPER_BULB(MCVersion.MC1_20_X),
COPPER_DOOR(MCVersion.MC1_20_X),
EXPOSED_COPPER_DOOR(MCVersion.MC1_20_X),
WEATHERED_COPPER_DOOR(MCVersion.MC1_20_X),
OXIDIZED_COPPER_DOOR(MCVersion.MC1_20_X),
WAXED_COPPER_DOOR(MCVersion.MC1_20_X),
WAXED_EXPOSED_COPPER_DOOR(MCVersion.MC1_20_X),
WAXED_WEATHERED_COPPER_DOOR(MCVersion.MC1_20_X),
WAXED_OXIDIZED_COPPER_DOOR(MCVersion.MC1_20_X),
COPPER_GRATE(MCVersion.MC1_20_X),
EXPOSED_COPPER_GRATE(MCVersion.MC1_20_X),
WEATHERED_COPPER_GRATE(MCVersion.MC1_20_X),
OXIDIZED_COPPER_GRATE(MCVersion.MC1_20_X),
WAXED_COPPER_GRATE(MCVersion.MC1_20_X),
WAXED_EXPOSED_COPPER_GRATE(MCVersion.MC1_20_X),
WAXED_WEATHERED_COPPER_GRATE(MCVersion.MC1_20_X),
WAXED_OXIDIZED_COPPER_GRATE(MCVersion.MC1_20_X),
COPPER_TRAPDOOR(MCVersion.MC1_20_X),
EXPOSED_COPPER_TRAPDOOR(MCVersion.MC1_20_X),
WEATHERED_COPPER_TRAPDOOR(MCVersion.MC1_20_X),
OXIDIZED_COPPER_TRAPDOOR(MCVersion.MC1_20_X),
WAXED_COPPER_TRAPDOOR(MCVersion.MC1_20_X),
WAXED_EXPOSED_COPPER_TRAPDOOR(MCVersion.MC1_20_X),
WAXED_WEATHERED_COPPER_TRAPDOOR(MCVersion.MC1_20_X),
WAXED_OXIDIZED_COPPER_TRAPDOOR(MCVersion.MC1_20_X),
BREEZE_SPAWN_EGG(MCVersion.MC1_20_X),
TRIAL_SPAWNER(MCVersion.MC1_20_X),
TRIAL_KEY(MCVersion.MC1_20_X),
TUFF_BRICKS(MCVersion.MC1_20_X),
TUFF_BRICK_SLAB(MCVersion.MC1_20_X),
TUFF_BRICK_STAIRS(MCVersion.MC1_20_X),
TUFF_BRICK_WALL(MCVersion.MC1_20_X),
TUFF_SLAB(MCVersion.MC1_20_X),
TUFF_STAIRS(MCVersion.MC1_20_X),
TUFF_WALL(MCVersion.MC1_20_X),
CHISELED_TUFF(MCVersion.MC1_20_X),
POLISHED_TUFF(MCVersion.MC1_20_X),
CHISELED_TUFF_BRICKS(MCVersion.MC1_20_X),
POLISHED_TUFF_SLAB(MCVersion.MC1_20_X),
POLISHED_TUFF_STAIRS(MCVersion.MC1_20_X),
POLISHED_TUFF_WALL(MCVersion.MC1_20_X);

private final MCVersion since;
private final MCVersion until;

MCVanillaMaterial() {
this.since = MCVersion.MC1_0;
this.until = MCVersion.FUTURE;
}

MCVanillaMaterial(MCVersion since) {
this.since = since;
this.until = MCVersion.FUTURE;
}

MCVanillaMaterial(MCVersion ver) {
this.since = ver;
MCVanillaMaterial(MCVersion since, MCVersion until) {
this.since = since;
this.until = until;
}

public boolean existsIn(MCVersion version) {
return version.gte(since);
return version.gte(since) && version.lte(until);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -406,25 +406,28 @@ public MCEntity getSpectatorTarget() {

@Override
public void setTempOp(Boolean value) throws ClassNotFoundException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
// Get some version specific strings
// Get some version specific mappings
String nms = "net.minecraft.server";
String playersPackage = nms + ".players";
String ops = "p";
String getPlayerList = "ac";
String getPlayerList = "ae";
MCVersion mcversion = Static.getServer().getMinecraftVersion();
if(mcversion.lt(MCVersion.MC1_20_2)) {
ops = "o";
if(mcversion.equals(MCVersion.MC1_19_3)) {
getPlayerList = "ab";
} else if(mcversion.lt(MCVersion.MC1_19_1)) {
ops = "n";
if(mcversion.lt(MCVersion.MC1_18)) {
getPlayerList = "getPlayerList";
if(mcversion.lt(MCVersion.MC1_17)) {
String version = ((BukkitMCServer) Static.getServer()).getCraftBukkitPackage().split("\\.")[3];
nms = "net.minecraft.server." + version;
playersPackage = nms;
ops = "operators";
if(mcversion.lt(MCVersion.MC1_20_X)) {
getPlayerList = "ac";
if(mcversion.lt(MCVersion.MC1_20_2)) {
ops = "o";
if(mcversion.equals(MCVersion.MC1_19_3)) {
getPlayerList = "ab";
} else if(mcversion.lt(MCVersion.MC1_19_1)) {
ops = "n";
if(mcversion.lt(MCVersion.MC1_18)) {
getPlayerList = "getPlayerList";
if(mcversion.lt(MCVersion.MC1_17)) {
String version = ((BukkitMCServer) Static.getServer()).getCraftBukkitPackage().split("\\.")[3];
nms = "net.minecraft.server." + version;
playersPackage = nms;
ops = "operators";
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
public enum MCEntityEffect {
ARROW_PARTICLES,
RABBIT_JUMP,
DEATH,
DEATH, // deprecated for EGG_BREAK, SNOWBALL_BREAK, ENTITY_DEATH
EGG_BREAK,
SNOWBALL_BREAK,
ENTITY_DEATH,
HURT,
SHEEP_EAT,
SHEEP_EAT, // deprecated for SHEEP_EAT_GRASS, TNT_MINECART_IGNITE
SHEEP_EAT_GRASS,
TNT_MINECART_IGNITE,
WOLF_HEARTS,
WOLF_SHAKE,
WOLF_SMOKE,
Expand Down Expand Up @@ -45,5 +50,21 @@ public enum MCEntityEffect {
BREAK_EQUIPMENT_HELMET,
BREAK_EQUIPMENT_CHESTPLATE,
BREAK_EQUIPMENT_LEGGINGS,
BREAK_EQUIPMENT_BOOTS
BREAK_EQUIPMENT_BOOTS,
RESET_SPAWNER_MINECART_DELAY,
FANG_ATTACK,
HOGLIN_ATTACK,
RAVAGER_ATTACK,
WARDEN_ATTACK,
ZOGLIN_ATTACK,
HONEY_BLOCK_SLIDE_PARTICLES,
HONEY_BLOCK_FALL_PARTICLES,
SWAP_HAND_ITEMS,
WOLF_SHAKE_STOP,
GOAT_LOWER_HEAD,
GOAT_RAISE_HEAD,
SPAWN_DEATH_SMOKE,
WARDEN_TENDRIL_SHAKE,
WARDEN_SONIC_ATTACK,
SNIFFER_DIG,
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public enum MCVanillaEntityType {
BLAZE,
BLOCK_DISPLAY(true, false, MCVersion.MC1_19_X),
BOAT,
BREEZE(true, false, MCVersion.MC1_20_X),
CAMEL(true, false, MCVersion.MC1_19_3),
CAT(true, false, MCVersion.MC1_14),
CAVE_SPIDER,
Expand Down Expand Up @@ -235,6 +236,7 @@ public enum MCVanillaEntityType {
VINDICATOR,
WANDERING_TRADER(true, false, MCVersion.MC1_14),
WARDEN(true, false, MCVersion.MC1_19),
WIND_CHARGE(true, true, MCVersion.MC1_20_X),
WITCH,
WITHER,
WITHER_SKELETON,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,15 @@ public enum MCGameRule {
LAVASOURCECONVERSION("lavaSourceConversion"),
LOGADMINCOMMANDS("logAdminCommands"),
MAXCOMMANDCHAINLENGTH("maxCommandChainLength", CInt.class),
MAXCOMMANDFORKCOUNT("maxCommandForkCount", CInt.class),
MAXENTITYCRAMMING("maxEntityCramming", CInt.class),
MOBEXPLOSIONDROPDECAY("mobExplosionDropDecay"),
MOBGRIEFING("mobGriefing"),
NATURALREGENERATION("naturalRegeneration"),
PLAYERSNETHERPORTALCREATIVEDELAY("playersNetherPortalCreativeDelay", CInt.class),
PLAYERSNETHERPORTALDEFAULTDELAY("playersNetherPortalDefaultDelay", CInt.class),
PLAYERSSLEEPINGPERCENTAGE("playersSleepingPercentage", CInt.class),
PROJECTILESCANBREAKBLOCKS("projectilesCanBreakBlocks"),
RANDOMTICKSPEED("randomTickSpeed", CInt.class),
REDUCEDDEBUGINFO("reducedDebugInfo"),
SENDCOMMANDFEEDBACK("sendCommandFeedback"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public enum MCInventoryType {
CARTOGRAPHY(false),
GRINDSTONE(false),
STONECUTTER(false),
CHISELED_BOOKSHELF(false);
CHISELED_BOOKSHELF(false),
CRAFTER(false);

// Whether or not this inventory type can be created and used virtually
private final boolean canVirtualize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ public enum MCVanillaParticle {
LANDING_CHERRY_LEAVES(MCVersion.MC1_19_X, MCVersion.MC1_19_X),
CHERRY_LEAVES(MCVersion.MC1_20),
EGG_CRACK(MCVersion.MC1_20),
DUST_PLUME(MCVersion.MC1_20_X),
WHITE_SMOKE(MCVersion.MC1_20_X),
GUST(MCVersion.MC1_20_X),
GUST_EMITTER(MCVersion.MC1_20_X),
GUST_DUST(MCVersion.MC1_20_X),
TRIAL_SPAWNER_DETECTION(MCVersion.MC1_20_X),
UNKNOWN(MCVersion.NEVER);

private final MCVersion since;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
public enum MCResourcePackStatus {
ACCEPTED,
DECLINED,
DISCARDED,
DOWNLOADED,
FAILED_DOWNLOAD,
FAILED_RELOAD,
INVALID_URL,
SUCCESSFULLY_LOADED
}
56 changes: 56 additions & 0 deletions src/main/java/com/laytonsmith/abstraction/enums/MCSound.java
Original file line number Diff line number Diff line change
Expand Up @@ -1581,6 +1581,62 @@ public enum MCVanillaSound {
BLOCK_WET_SPONGE_PLACE(MCVersion.MC1_20_2),
BLOCK_WET_SPONGE_STEP(MCVersion.MC1_20_2),

// 1.20.3 additions
BLOCK_COPPER_BULB_BREAK(MCVersion.MC1_20_X),
BLOCK_COPPER_BULB_FALL(MCVersion.MC1_20_X),
BLOCK_COPPER_BULB_HIT(MCVersion.MC1_20_X),
BLOCK_COPPER_BULB_PLACE(MCVersion.MC1_20_X),
BLOCK_COPPER_BULB_STEP(MCVersion.MC1_20_X),
BLOCK_COPPER_BULB_TURN_OFF(MCVersion.MC1_20_X),
BLOCK_COPPER_BULB_TURN_ON(MCVersion.MC1_20_X),
BLOCK_COPPER_DOOR_CLOSE(MCVersion.MC1_20_X),
BLOCK_COPPER_DOOR_OPEN(MCVersion.MC1_20_X),
BLOCK_COPPER_GRATE_BREAK(MCVersion.MC1_20_X),
BLOCK_COPPER_GRATE_FALL(MCVersion.MC1_20_X),
BLOCK_COPPER_GRATE_HIT(MCVersion.MC1_20_X),
BLOCK_COPPER_GRATE_PLACE(MCVersion.MC1_20_X),
BLOCK_COPPER_GRATE_STEP(MCVersion.MC1_20_X),
BLOCK_COPPER_TRAPDOOR_CLOSE(MCVersion.MC1_20_X),
BLOCK_COPPER_TRAPDOOR_OPEN(MCVersion.MC1_20_X),
BLOCK_CRAFTER_CRAFT(MCVersion.MC1_20_X),
BLOCK_CRAFTER_FAIL(MCVersion.MC1_20_X),
BLOCK_DECORATED_POT_INSERT(MCVersion.MC1_20_X),
BLOCK_DECORATED_POT_INSERT_FAIL(MCVersion.MC1_20_X),
BLOCK_HANGING_SIGN_WAXED_INTERACT_FAIL(MCVersion.MC1_20_X),
BLOCK_POLISHED_TUFF_BREAK(MCVersion.MC1_20_X),
BLOCK_POLISHED_TUFF_FALL(MCVersion.MC1_20_X),
BLOCK_POLISHED_TUFF_HIT(MCVersion.MC1_20_X),
BLOCK_POLISHED_TUFF_PLACE(MCVersion.MC1_20_X),
BLOCK_POLISHED_TUFF_STEP(MCVersion.MC1_20_X),
BLOCK_TRIAL_SPAWNER_AMBIENT(MCVersion.MC1_20_X),
BLOCK_TRIAL_SPAWNER_BREAK(MCVersion.MC1_20_X),
BLOCK_TRIAL_SPAWNER_CLOSE_SHUTTER(MCVersion.MC1_20_X),
BLOCK_TRIAL_SPAWNER_DETECT_PLAYER(MCVersion.MC1_20_X),
BLOCK_TRIAL_SPAWNER_EJECT_ITEM(MCVersion.MC1_20_X),
BLOCK_TRIAL_SPAWNER_FALL(MCVersion.MC1_20_X),
BLOCK_TRIAL_SPAWNER_HIT(MCVersion.MC1_20_X),
BLOCK_TRIAL_SPAWNER_OPEN_SHUTTER(MCVersion.MC1_20_X),
BLOCK_TRIAL_SPAWNER_PLACE(MCVersion.MC1_20_X),
BLOCK_TRIAL_SPAWNER_SPAWN_MOB(MCVersion.MC1_20_X),
BLOCK_TRIAL_SPAWNER_STEP(MCVersion.MC1_20_X),
BLOCK_TUFF_BRICKS_BREAK(MCVersion.MC1_20_X),
BLOCK_TUFF_BRICKS_FALL(MCVersion.MC1_20_X),
BLOCK_TUFF_BRICKS_HIT(MCVersion.MC1_20_X),
BLOCK_TUFF_BRICKS_PLACE(MCVersion.MC1_20_X),
BLOCK_TUFF_BRICKS_STEP(MCVersion.MC1_20_X),
ENTITY_BREEZE_DEATH(MCVersion.MC1_20_X),
ENTITY_BREEZE_HURT(MCVersion.MC1_20_X),
ENTITY_BREEZE_IDLE_AIR(MCVersion.MC1_20_X),
ENTITY_BREEZE_IDLE_GROUND(MCVersion.MC1_20_X),
ENTITY_BREEZE_INHALE(MCVersion.MC1_20_X),
ENTITY_BREEZE_JUMP(MCVersion.MC1_20_X),
ENTITY_BREEZE_LAND(MCVersion.MC1_20_X),
ENTITY_BREEZE_SHOOT(MCVersion.MC1_20_X),
ENTITY_BREEZE_SLIDE(MCVersion.MC1_20_X),
ENTITY_GENERIC_WIND_BURST(MCVersion.MC1_20_X),
ENTITY_PARROT_IMITATE_BREEZE(MCVersion.MC1_20_X),
ENTITY_PLAYER_TELEPORT(MCVersion.MC1_20_X),

UNKNOWN(MCVersion.NEVER);

private final MCVersion since;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,8 @@ public enum LegacyMaterialName {
POTTERY_SHARD_ARCHER("ARCHER_POTTERY_SHERD", MCVersion.MC1_20),
POTTERY_SHARD_ARMS_UP("ARMS_UP_POTTERY_SHERD", MCVersion.MC1_20),
POTTERY_SHARD_PRIZE("PRIZE_POTTERY_SHERD", MCVersion.MC1_20),
POTTERY_SHARD_SKULL("SKULL_POTTERY_SHERD", MCVersion.MC1_20);
POTTERY_SHARD_SKULL("SKULL_POTTERY_SHERD", MCVersion.MC1_20),
GRASS("SHORT_GRASS", MCVersion.MC1_20_X);

private final String mat;
private final MCVersion version;
Expand Down Expand Up @@ -543,10 +544,13 @@ public static Material getMaterial(int id) {
}

public static Material getMaterial(String name) {
Material mat = Material.getMaterial(name, true);
// we should never get air here since we're checking for legacy materials only
if(mat == null || mat == Material.AIR) {
mat = BY_NAME.get(name);
Material mat = BY_NAME.get(name);
if(mat == null) {
mat = Material.getMaterial(name, true);
// we should never get air here since we're checking for legacy materials only
if(mat == Material.AIR) {
return null;
}
}
return mat;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.laytonsmith.PureUtilities.Version;
import com.laytonsmith.abstraction.blocks.MCMaterial;
import com.laytonsmith.abstraction.blocks.MCMaterial.MCVanillaMaterial;
import com.laytonsmith.abstraction.enums.MCVersion;
import com.laytonsmith.annotations.api;
import com.laytonsmith.core.MSVersion;
import com.laytonsmith.core.ParseTree;
Expand Down Expand Up @@ -66,12 +65,7 @@ public void validate(ParseTree node, CClassType nodeType, Environment env)
throws ConfigCompileException, ConfigCompileGroupException, ConfigRuntimeException {
if(node.isConst() && !node.getData().equals(CNull.NULL)) {
try {
MCVanillaMaterial mat = MCVanillaMaterial.valueOf(node.getData().val());
if(!mat.existsIn(MCVersion.CURRENT)) {
env.getEnv(CompilerEnvironment.class).addCompilerWarning(node.getFileOptions(),
new CompilerWarning("\"" + node.getData() + "\" is no longer a valid material type",
node.getTarget(), null));
}
MCVanillaMaterial.valueOf(node.getData().val());
} catch (IllegalArgumentException ex) {
env.getEnv(CompilerEnvironment.class).addCompilerWarning(node.getFileOptions(),
new CompilerWarning("\"" + node.getData() + "\" is not a valid material type, this will never match."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4993,7 +4993,7 @@ public Integer[] numArgs() {
public String docs() {
return "array {entityUUID} Returns an associative array of display entity data."
+ " Array keys are: 'billboard', 'brightness', 'glowcolor', 'height', 'width',"
+ " 'viewrange', 'shadowradius', and 'shadowstrength'. ---- "
+ " 'viewrange', 'shadowradius', 'shadowstrength', and 'teleportduration'. ---- "
+ " The following values are common to all display entity types. Data about specific display entity"
+ " types (block, text, and item display entities) can be found in {{function|entity_spec}}."
+ " * '''billboard''' (string) : Controls which axes the rendered entity rotates around the entity"
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/docs/Compatibility
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ with build 1498, so earlier builds may not be accurate. In general, the compatib
the same as the previous milestone build. The minimum requirements for the current builds are:

* Java 16
* Spigot/Paper 1.16.5 - 1.20.2 (when CH is used as a plugin)
* Spigot/Paper 1.16.5 - 1.20.4 (when CH is used as a plugin)

Also note that CommandHelper may still be backwards and forward compatible to a large degree, many of the advanced
features that normally have hard dependencies on certain versions of external dependencies have been configured to
Expand Down
Loading

0 comments on commit f2b77ca

Please sign in to comment.