fixup tests and add missing API detected by those tests

This commit is contained in:
Jake Potrebic 2023-12-08 12:07:56 -08:00
parent 4fc499dde8
commit b21ac86cac
8 changed files with 73 additions and 17 deletions

View file

@ -224,7 +224,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+ public static final MaterialSetTag DOORS = new MaterialSetTag(keyFor("doors"))
+ .endsWith("_DOOR")
+ .ensureSize("DOORS", 12).lock();
+ .ensureSize("DOORS", 20).lock();
+
+ /**
+ * Covers all dyes.
@ -438,7 +438,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+ public static final MaterialSetTag SPAWN_EGGS = new MaterialSetTag(keyFor("spawn_eggs"))
+ .endsWith("_SPAWN_EGG")
+ .ensureSize("SPAWN_EGGS", 77).lock();
+ .ensureSize("SPAWN_EGGS", 78).lock();
+
+ /**
+ * Covers all colors of stained glass.
@ -459,7 +459,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+ public static final MaterialSetTag TRAPDOORS = new MaterialSetTag(keyFor("trapdoors"))
+ .endsWith("_TRAPDOOR")
+ .ensureSize("TRAPDOORS", 12).lock();
+ .ensureSize("TRAPDOORS", 20).lock();
+
+ /**
+ * Covers all wood variants of doors.
@ -467,6 +467,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public static final MaterialSetTag WOODEN_DOORS = new MaterialSetTag(keyFor("wooden_doors"))
+ .endsWith("_DOOR")
+ .not(Material.IRON_DOOR)
+ .notContains("COPPER")
+ .ensureSize("WOODEN_DOORS", 11).lock();
+
+ /**
@ -483,6 +484,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public static final MaterialSetTag WOODEN_TRAPDOORS = new MaterialSetTag(keyFor("wooden_trapdoors"))
+ .endsWith("_TRAPDOOR")
+ .not(Material.IRON_TRAPDOOR)
+ .notContains("COPPER")
+ .ensureSize("WOODEN_TRAPDOORS", 11).lock();
+
+ /**
@ -713,25 +715,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Covers all oxidized copper blocks.
+ */
+ public static final MaterialSetTag OXIDIZED_COPPER_BLOCKS = new MaterialSetTag(keyFor("oxidized_copper_blocks"))
+ .startsWith("OXIDIZED_").startsWith("WAXED_OXIDIZED_").ensureSize("OXIDIZED_COPPER_BLOCKS", 8).lock();
+ .startsWith("OXIDIZED_").startsWith("WAXED_OXIDIZED_").ensureSize("OXIDIZED_COPPER_BLOCKS", 18).lock();
+
+ /**
+ * Covers all weathered copper blocks.
+ */
+ public static final MaterialSetTag WEATHERED_COPPER_BLOCKS = new MaterialSetTag(keyFor("weathered_copper_blocks"))
+ .startsWith("WEATHERED_").startsWith("WAXED_WEATHERED_").ensureSize("WEATHERED_COPPER_BLOCKS", 8).lock();
+ .startsWith("WEATHERED_").startsWith("WAXED_WEATHERED_").ensureSize("WEATHERED_COPPER_BLOCKS", 18).lock();
+
+ /**
+ * Covers all exposed copper blocks.
+ */
+ public static final MaterialSetTag EXPOSED_COPPER_BLOCKS = new MaterialSetTag(keyFor("exposed_copper_blocks"))
+ .startsWith("EXPOSED_").startsWith("WAXED_EXPOSED_").ensureSize("EXPOSED_COPPER_BLOCKS", 8).lock();
+ .startsWith("EXPOSED_").startsWith("WAXED_EXPOSED_").ensureSize("EXPOSED_COPPER_BLOCKS", 18).lock();
+
+ /**
+ * Covers all un-weathered copper blocks.
+ */
+ public static final MaterialSetTag UNAFFECTED_COPPER_BLOCKS = new MaterialSetTag(keyFor("unaffected_copper_blocks"))
+ .startsWith("CUT_COPPER").startsWith("WAXED_CUT_COPPER").add(Material.COPPER_BLOCK).add(Material.WAXED_COPPER_BLOCK).ensureSize("UNAFFECTED_COPPER_BLOCKS", 8).lock();
+ .startsWith("CUT_COPPER").startsWith("WAXED_CUT_COPPER")
+ .startsWith("WAXED_COPPER_").startsWith("COPPER_")
+ .add(Material.CHISELED_COPPER, Material.WAXED_CHISELED_COPPER)
+ .not(Material.COPPER_INGOT, Material.COPPER_ORE)
+ .ensureSize("UNAFFECTED_COPPER_BLOCKS", 18).lock();
+
+ /**
+ * Covers all waxed copper blocks.
@ -739,7 +745,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Combine with other copper-related tags to filter is-waxed or not.
+ */
+ public static final MaterialSetTag WAXED_COPPER_BLOCKS = new MaterialSetTag(keyFor("waxed_copper_blocks"))
+ .add(m -> m.name().startsWith("WAXED_") && m.name().contains("COPPER")).ensureSize("WAXED_COPPER_BLOCKS", 16).lock();
+ .add(m -> m.name().startsWith("WAXED_") && m.name().contains("COPPER")).ensureSize("WAXED_COPPER_BLOCKS", 36).lock();
+
+ /**
+ * Covers all un-waxed copper blocks.
@ -747,22 +753,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Combine with other copper-related tags to filter is-un-waxed or not.
+ */
+ public static final MaterialSetTag UNWAXED_COPPER_BLOCKS = new MaterialSetTag(keyFor("unwaxed_copper_blocks"))
+ .contains("CUT_COPPER").endsWith("_COPPER").notContains("WAXED").add(Material.COPPER_BLOCK).not(Material.RAW_COPPER).ensureSize("UNWAXED_COPPER_BLOCKS", 16).lock();
+ .startsWith("EXPOSED_").startsWith("WEATHERED_").startsWith("OXIDIZED_")
+ .startsWith("CUT_COPPER")
+ .add(Material.COPPER_BLOCK, Material.CHISELED_COPPER, Material.COPPER_DOOR, Material.COPPER_TRAPDOOR, Material.COPPER_GRATE, Material.COPPER_BULB)
+ .ensureSize("UNWAXED_COPPER_BLOCKS", 36).lock();
+
+ /**
+ * Covers all copper block variants.
+ */
+ public static final MaterialSetTag COPPER_BLOCKS = new MaterialSetTag(keyFor("copper_blocks"))
+ .add(WAXED_COPPER_BLOCKS).add(UNWAXED_COPPER_BLOCKS).ensureSize("COPPER_BLOCKS", 32).lock();
+ .add(WAXED_COPPER_BLOCKS).add(UNWAXED_COPPER_BLOCKS).ensureSize("COPPER_BLOCKS", 72).lock();
+
+ /**
+ * Covers all weathering/waxed states of the plain copper block.
+ */
+ public static final MaterialSetTag FULL_COPPER_BLOCKS = new MaterialSetTag(keyFor("full_copper_blocks"))
+ .contains("OXIDIZED_COPPER")
+ .contains("WEATHERED_COPPER")
+ .contains("EXPOSED_COPPER")
+ .contains("COPPER_BLOCK")
+ .endsWith("OXIDIZED_COPPER")
+ .endsWith("WEATHERED_COPPER")
+ .endsWith("EXPOSED_COPPER")
+ .endsWith("COPPER_BLOCK")
+ .not(Material.RAW_COPPER_BLOCK)
+ .ensureSize("FULL_COPPER_BLOCKS", 8).lock();
+

View file

@ -3,6 +3,7 @@ From: Ivan Pekov <ivan@mrivanplays.com>
Date: Tue, 5 Jan 2021 10:19:11 +0200
Subject: [PATCH] Add missing effects
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/org/bukkit/Effect.java b/src/main/java/org/bukkit/Effect.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -122,13 +123,35 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ SOUND_STOP_JUKEBOX_SONG(1011, Type.SOUND),
+
+ CRAFTER_CRAFT(1049, Type.SOUND),
+
+ CRAFTER_FAIL(1050, Type.SOUND),
+
+ /**
+ * {@link BlockFace} param is the direction to shoot
+ */
+ SHOOT_WHITE_SMOKE(2010, Type.VISUAL, BlockFace.class),
+
+ PARTICLES_SCULK_CHARGE(3006, Type.VISUAL, Integer.class),
+
+ PARTICLES_SCULK_SHRIEK(3007, Type.SOUND),
+
+ PARTICLES_AND_SOUND_BRUSH_BLOCK_COMPLETE(3008, Type.VISUAL, org.bukkit.block.data.BlockData.class),
+
+ PARTICLES_EGG_CRACK(3009, Type.VISUAL)
+ PARTICLES_EGG_CRACK(3009, Type.VISUAL),
+
+ GUST_DUST(3010, Type.VISUAL),
+
+ TRIAL_SPAWNER_SPAWN(3011, Type.VISUAL),
+
+ TRIAL_SPAWNER_SPAWN_MOB_AT(3012, Type.VISUAL),
+
+ /**
+ * {@link Integer} param is the number of players
+ */
+ TRIAL_SPAWNER_DETECT_PLAYER(3013, Type.VISUAL, Integer.class),
+
+ TRIAL_SPAWNER_EJECT_ITEM(3014, Type.VISUAL),
;
+ private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger();
+ // Paper end

View file

@ -159,7 +159,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ for (Structure feature : structureRegistry) {
+ final ResourceLocation key = structureRegistry.getKey(feature);
+ assertNotNull(key, "Missing built-in registry key");
+ if (key.equals(BuiltinStructures.ANCIENT_CITY.location()) || key.equals(BuiltinStructures.TRAIL_RUINS.location())) {
+ if (key.equals(BuiltinStructures.ANCIENT_CITY.location()) || key.equals(BuiltinStructures.TRAIL_RUINS.location()) || key.equals(BuiltinStructures.TRIAL_CHAMBERS.location())) {
+ continue; // TODO remove when upstream adds "jigsaw" StructureType
+ }
+ if (DEFAULT_CONFIGURED_STRUCTURES.get(CraftNamespacedKey.fromMinecraft(key)) == null) {

View file

@ -90,6 +90,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ case "trail_ruins":
+ seed = conf.trailRuinsSeed;
+ break;
+ case "trial_chambers":
+ seed = conf.trialChambersSeed;
+ break;
+ // Paper end
}
@ -242,6 +245,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - add missing structure set configs
+ public int ancientCitySeed;
+ public int trailRuinsSeed;
+ public int trialChambersSeed;
+ public int buriedTreasureSeed;
+ public Integer mineshaftSeed;
+ public Long strongholdSeed;
@ -260,6 +264,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - add missing structure set configs
+ this.ancientCitySeed = this.getInt("seed-ancientcity", 20083232);
+ this.trailRuinsSeed = this.getInt("seed-trailruins", 83469867);
+ this.trialChambersSeed = this.getInt("seed-trialchambers", 94251327);
+ this.buriedTreasureSeed = this.getInt("seed-buriedtreasure", 10387320); // StructurePlacement#HIGHLY_ARBITRARY_RANDOM_SALT
+ this.mineshaftSeed = this.getSeed("seed-mineshaft", Integer::parseInt);
+ this.strongholdSeed = this.getSeed("seed-stronghold", Long::parseLong);
@ -334,6 +339,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ case "end_cities" -> config.endCitySeed;
+ case "ancient_cities" -> config.ancientCitySeed;
+ case "trail_ruins" -> config.trailRuinsSeed;
+ case "trial_chambers" -> config.trialChambersSeed;
+ default -> throw new AssertionError("Missing structure set seed in SpigotWorldConfig for " + setKey);
+ };
+ if (setKey == BuiltinStructureSets.BURIED_TREASURES) {

View file

@ -213,7 +213,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ final var frame = PaperAdvancementDisplay.asPaperFrame(advancementType);
+ assertEquals(expectedTranslationKey, frame.translationKey(), "The translation keys should be the same");
+ assertEquals(expectedColor, frame.color(), "The frame colors should be the same");
+ assertEquals(advancementType.name(), AdvancementDisplay.Frame.NAMES.key(frame));
+ assertEquals(advancementType.getSerializedName(), AdvancementDisplay.Frame.NAMES.key(frame));
+ }
+ }
+}

View file

@ -73,6 +73,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "teammsg", "Allows the user to specify the message to send to team", PermissionDefault.TRUE, commands); // defaults to all players
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "tellraw", "Allows the user to display a JSON message to players", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "time", "Allows the user to change or query the world's game time", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "tick", "Allows the user to control the tick rate of the server", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "title", "Allows the user to manage screen titles", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "weather", "Allows the user to set the weather", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "whitelist", "Allows the user to manage the server whitelist", PermissionDefault.OP, commands);

View file

@ -17,6 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
int datavalue;
switch (effect) {
+ case PARTICLES_SCULK_CHARGE: // Paper - add missing effects
+ case TRIAL_SPAWNER_DETECT_PLAYER: // Paper - add missing effects
case VILLAGER_PLANT_GROW:
datavalue = (Integer) data;
break;
@ -28,6 +29,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
case INSTANT_POTION_BREAK:
datavalue = ((Color) data).asRGB();
break;
@@ -0,0 +0,0 @@ public class CraftEffect {
Preconditions.checkArgument(data == Material.AIR || ((Material) data).isRecord(), "Invalid record type for Material %s!", data);
datavalue = Item.getId(CraftMagicNumbers.getItem((Material) data));
break;
+ // Paper start - handle shoot white smoke event
+ case SHOOT_WHITE_SMOKE:
+ final BlockFace face = (BlockFace) data;
+ Preconditions.checkArgument(face.isCartesian(), face + " isn't cartesian");
+ datavalue = org.bukkit.craftbukkit.block.CraftBlock.blockFaceToNotch(face).get3DDataValue();
+ break;
+ // Paper end - handle shoot white smoke event
case SMOKE:
switch ((BlockFace) data) {
case DOWN:
@@ -0,0 +0,0 @@ public class CraftEffect {
}
break;

View file

@ -57,6 +57,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import net.minecraft.world.entity.monster.RangedAttackMob;
+import net.minecraft.world.entity.monster.SpellcasterIllager;
+import net.minecraft.world.entity.monster.ZombifiedPiglin;
+import net.minecraft.world.entity.monster.breeze.Breeze;
+import net.minecraft.world.entity.monster.piglin.AbstractPiglin;
+import org.bukkit.NamespacedKey;
+import org.bukkit.entity.AbstractHorse;
@ -268,6 +269,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ bukkitMap.put(net.minecraft.world.entity.monster.warden.Warden.class, org.bukkit.entity.Warden.class);
+ bukkitMap.put(net.minecraft.world.entity.animal.allay.Allay.class, org.bukkit.entity.Allay.class);
+ bukkitMap.put(net.minecraft.world.entity.animal.sniffer.Sniffer.class, org.bukkit.entity.Sniffer.class);
+ bukkitMap.put(Breeze.class, org.bukkit.entity.Breeze.class);
+ }
+
+ public static String getUsableName(Class<?> clazz) {