13
0
geforkt von Mirrors/Paper

Merge remote-tracking branch 'upstream/master' into update
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Chaoscaot 2024-11-28 22:28:56 +01:00
Commit f27acfdb62
70 geänderte Dateien mit 3679 neuen und 599 gelöschten Zeilen

Datei anzeigen

@ -18,7 +18,7 @@ jobs:
actions: read
steps:
- name: Download and Extract Artifacts
uses: dawidd6/action-download-artifact@v3
uses: dawidd6/action-download-artifact@v6
with:
run_id: ${{ github.event.workflow_run.id }}
path: artifacts

Datei anzeigen

@ -0,0 +1,120 @@
package io.papermc.paper.registry.keys.tags;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.tag.TagKey;
import net.kyori.adventure.key.Key;
import org.bukkit.block.banner.PatternType;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla keys for {@link RegistryKey#BANNER_PATTERN}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.21.3")
@NullMarked
@ApiStatus.Experimental
public final class BannerPatternTagKeys {
/**
* {@code #minecraft:no_item_required}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<PatternType> NO_ITEM_REQUIRED = create(key("no_item_required"));
/**
* {@code #minecraft:pattern_item/bordure_indented}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<PatternType> PATTERN_ITEM_BORDURE_INDENTED = create(key("pattern_item/bordure_indented"));
/**
* {@code #minecraft:pattern_item/creeper}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<PatternType> PATTERN_ITEM_CREEPER = create(key("pattern_item/creeper"));
/**
* {@code #minecraft:pattern_item/field_masoned}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<PatternType> PATTERN_ITEM_FIELD_MASONED = create(key("pattern_item/field_masoned"));
/**
* {@code #minecraft:pattern_item/flow}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<PatternType> PATTERN_ITEM_FLOW = create(key("pattern_item/flow"));
/**
* {@code #minecraft:pattern_item/flower}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<PatternType> PATTERN_ITEM_FLOWER = create(key("pattern_item/flower"));
/**
* {@code #minecraft:pattern_item/globe}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<PatternType> PATTERN_ITEM_GLOBE = create(key("pattern_item/globe"));
/**
* {@code #minecraft:pattern_item/guster}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<PatternType> PATTERN_ITEM_GUSTER = create(key("pattern_item/guster"));
/**
* {@code #minecraft:pattern_item/mojang}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<PatternType> PATTERN_ITEM_MOJANG = create(key("pattern_item/mojang"));
/**
* {@code #minecraft:pattern_item/piglin}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<PatternType> PATTERN_ITEM_PIGLIN = create(key("pattern_item/piglin"));
/**
* {@code #minecraft:pattern_item/skull}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<PatternType> PATTERN_ITEM_SKULL = create(key("pattern_item/skull"));
private BannerPatternTagKeys() {
}
/**
* Creates a tag key for {@link PatternType} in the registry {@code minecraft:banner_pattern}.
*
* @param key the tag key's key
* @return a new tag key
*/
@ApiStatus.Experimental
public static TagKey<PatternType> create(final Key key) {
return TagKey.create(RegistryKey.BANNER_PATTERN, key);
}
}

Datei anzeigen

@ -0,0 +1,533 @@
package io.papermc.paper.registry.keys.tags;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.tag.TagKey;
import net.kyori.adventure.key.Key;
import org.bukkit.block.Biome;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla keys for {@link RegistryKey#BIOME}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.21.3")
@NullMarked
@ApiStatus.Experimental
public final class BiomeTagKeys {
/**
* {@code #minecraft:allows_surface_slime_spawns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> ALLOWS_SURFACE_SLIME_SPAWNS = create(key("allows_surface_slime_spawns"));
/**
* {@code #minecraft:allows_tropical_fish_spawns_at_any_height}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> ALLOWS_TROPICAL_FISH_SPAWNS_AT_ANY_HEIGHT = create(key("allows_tropical_fish_spawns_at_any_height"));
/**
* {@code #minecraft:has_closer_water_fog}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_CLOSER_WATER_FOG = create(key("has_closer_water_fog"));
/**
* {@code #minecraft:has_structure/ancient_city}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_ANCIENT_CITY = create(key("has_structure/ancient_city"));
/**
* {@code #minecraft:has_structure/bastion_remnant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_BASTION_REMNANT = create(key("has_structure/bastion_remnant"));
/**
* {@code #minecraft:has_structure/buried_treasure}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_BURIED_TREASURE = create(key("has_structure/buried_treasure"));
/**
* {@code #minecraft:has_structure/desert_pyramid}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_DESERT_PYRAMID = create(key("has_structure/desert_pyramid"));
/**
* {@code #minecraft:has_structure/end_city}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_END_CITY = create(key("has_structure/end_city"));
/**
* {@code #minecraft:has_structure/igloo}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_IGLOO = create(key("has_structure/igloo"));
/**
* {@code #minecraft:has_structure/jungle_temple}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_JUNGLE_TEMPLE = create(key("has_structure/jungle_temple"));
/**
* {@code #minecraft:has_structure/mineshaft}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_MINESHAFT = create(key("has_structure/mineshaft"));
/**
* {@code #minecraft:has_structure/mineshaft_mesa}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_MINESHAFT_MESA = create(key("has_structure/mineshaft_mesa"));
/**
* {@code #minecraft:has_structure/nether_fortress}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_NETHER_FORTRESS = create(key("has_structure/nether_fortress"));
/**
* {@code #minecraft:has_structure/nether_fossil}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_NETHER_FOSSIL = create(key("has_structure/nether_fossil"));
/**
* {@code #minecraft:has_structure/ocean_monument}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_OCEAN_MONUMENT = create(key("has_structure/ocean_monument"));
/**
* {@code #minecraft:has_structure/ocean_ruin_cold}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_OCEAN_RUIN_COLD = create(key("has_structure/ocean_ruin_cold"));
/**
* {@code #minecraft:has_structure/ocean_ruin_warm}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_OCEAN_RUIN_WARM = create(key("has_structure/ocean_ruin_warm"));
/**
* {@code #minecraft:has_structure/pillager_outpost}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_PILLAGER_OUTPOST = create(key("has_structure/pillager_outpost"));
/**
* {@code #minecraft:has_structure/ruined_portal_desert}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_RUINED_PORTAL_DESERT = create(key("has_structure/ruined_portal_desert"));
/**
* {@code #minecraft:has_structure/ruined_portal_jungle}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_RUINED_PORTAL_JUNGLE = create(key("has_structure/ruined_portal_jungle"));
/**
* {@code #minecraft:has_structure/ruined_portal_mountain}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_RUINED_PORTAL_MOUNTAIN = create(key("has_structure/ruined_portal_mountain"));
/**
* {@code #minecraft:has_structure/ruined_portal_nether}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_RUINED_PORTAL_NETHER = create(key("has_structure/ruined_portal_nether"));
/**
* {@code #minecraft:has_structure/ruined_portal_ocean}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_RUINED_PORTAL_OCEAN = create(key("has_structure/ruined_portal_ocean"));
/**
* {@code #minecraft:has_structure/ruined_portal_standard}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_RUINED_PORTAL_STANDARD = create(key("has_structure/ruined_portal_standard"));
/**
* {@code #minecraft:has_structure/ruined_portal_swamp}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_RUINED_PORTAL_SWAMP = create(key("has_structure/ruined_portal_swamp"));
/**
* {@code #minecraft:has_structure/shipwreck}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_SHIPWRECK = create(key("has_structure/shipwreck"));
/**
* {@code #minecraft:has_structure/shipwreck_beached}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_SHIPWRECK_BEACHED = create(key("has_structure/shipwreck_beached"));
/**
* {@code #minecraft:has_structure/stronghold}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_STRONGHOLD = create(key("has_structure/stronghold"));
/**
* {@code #minecraft:has_structure/swamp_hut}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_SWAMP_HUT = create(key("has_structure/swamp_hut"));
/**
* {@code #minecraft:has_structure/trail_ruins}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_TRAIL_RUINS = create(key("has_structure/trail_ruins"));
/**
* {@code #minecraft:has_structure/trial_chambers}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_TRIAL_CHAMBERS = create(key("has_structure/trial_chambers"));
/**
* {@code #minecraft:has_structure/village_desert}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_VILLAGE_DESERT = create(key("has_structure/village_desert"));
/**
* {@code #minecraft:has_structure/village_plains}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_VILLAGE_PLAINS = create(key("has_structure/village_plains"));
/**
* {@code #minecraft:has_structure/village_savanna}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_VILLAGE_SAVANNA = create(key("has_structure/village_savanna"));
/**
* {@code #minecraft:has_structure/village_snowy}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_VILLAGE_SNOWY = create(key("has_structure/village_snowy"));
/**
* {@code #minecraft:has_structure/village_taiga}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_VILLAGE_TAIGA = create(key("has_structure/village_taiga"));
/**
* {@code #minecraft:has_structure/woodland_mansion}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> HAS_STRUCTURE_WOODLAND_MANSION = create(key("has_structure/woodland_mansion"));
/**
* {@code #minecraft:increased_fire_burnout}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> INCREASED_FIRE_BURNOUT = create(key("increased_fire_burnout"));
/**
* {@code #minecraft:is_badlands}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> IS_BADLANDS = create(key("is_badlands"));
/**
* {@code #minecraft:is_beach}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> IS_BEACH = create(key("is_beach"));
/**
* {@code #minecraft:is_deep_ocean}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> IS_DEEP_OCEAN = create(key("is_deep_ocean"));
/**
* {@code #minecraft:is_end}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> IS_END = create(key("is_end"));
/**
* {@code #minecraft:is_forest}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> IS_FOREST = create(key("is_forest"));
/**
* {@code #minecraft:is_hill}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> IS_HILL = create(key("is_hill"));
/**
* {@code #minecraft:is_jungle}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> IS_JUNGLE = create(key("is_jungle"));
/**
* {@code #minecraft:is_mountain}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> IS_MOUNTAIN = create(key("is_mountain"));
/**
* {@code #minecraft:is_nether}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> IS_NETHER = create(key("is_nether"));
/**
* {@code #minecraft:is_ocean}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> IS_OCEAN = create(key("is_ocean"));
/**
* {@code #minecraft:is_overworld}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> IS_OVERWORLD = create(key("is_overworld"));
/**
* {@code #minecraft:is_river}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> IS_RIVER = create(key("is_river"));
/**
* {@code #minecraft:is_savanna}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> IS_SAVANNA = create(key("is_savanna"));
/**
* {@code #minecraft:is_taiga}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> IS_TAIGA = create(key("is_taiga"));
/**
* {@code #minecraft:mineshaft_blocking}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> MINESHAFT_BLOCKING = create(key("mineshaft_blocking"));
/**
* {@code #minecraft:more_frequent_drowned_spawns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> MORE_FREQUENT_DROWNED_SPAWNS = create(key("more_frequent_drowned_spawns"));
/**
* {@code #minecraft:plays_underwater_music}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> PLAYS_UNDERWATER_MUSIC = create(key("plays_underwater_music"));
/**
* {@code #minecraft:polar_bears_spawn_on_alternate_blocks}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> POLAR_BEARS_SPAWN_ON_ALTERNATE_BLOCKS = create(key("polar_bears_spawn_on_alternate_blocks"));
/**
* {@code #minecraft:produces_corals_from_bonemeal}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> PRODUCES_CORALS_FROM_BONEMEAL = create(key("produces_corals_from_bonemeal"));
/**
* {@code #minecraft:reduce_water_ambient_spawns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> REDUCE_WATER_AMBIENT_SPAWNS = create(key("reduce_water_ambient_spawns"));
/**
* {@code #minecraft:required_ocean_monument_surrounding}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> REQUIRED_OCEAN_MONUMENT_SURROUNDING = create(key("required_ocean_monument_surrounding"));
/**
* {@code #minecraft:snow_golem_melts}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> SNOW_GOLEM_MELTS = create(key("snow_golem_melts"));
/**
* {@code #minecraft:spawns_cold_variant_frogs}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> SPAWNS_COLD_VARIANT_FROGS = create(key("spawns_cold_variant_frogs"));
/**
* {@code #minecraft:spawns_gold_rabbits}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> SPAWNS_GOLD_RABBITS = create(key("spawns_gold_rabbits"));
/**
* {@code #minecraft:spawns_snow_foxes}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> SPAWNS_SNOW_FOXES = create(key("spawns_snow_foxes"));
/**
* {@code #minecraft:spawns_warm_variant_frogs}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> SPAWNS_WARM_VARIANT_FROGS = create(key("spawns_warm_variant_frogs"));
/**
* {@code #minecraft:spawns_white_rabbits}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> SPAWNS_WHITE_RABBITS = create(key("spawns_white_rabbits"));
/**
* {@code #minecraft:stronghold_biased_to}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> STRONGHOLD_BIASED_TO = create(key("stronghold_biased_to"));
/**
* {@code #minecraft:water_on_map_outlines}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> WATER_ON_MAP_OUTLINES = create(key("water_on_map_outlines"));
/**
* {@code #minecraft:without_patrol_spawns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> WITHOUT_PATROL_SPAWNS = create(key("without_patrol_spawns"));
/**
* {@code #minecraft:without_wandering_trader_spawns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> WITHOUT_WANDERING_TRADER_SPAWNS = create(key("without_wandering_trader_spawns"));
/**
* {@code #minecraft:without_zombie_sieges}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> WITHOUT_ZOMBIE_SIEGES = create(key("without_zombie_sieges"));
private BiomeTagKeys() {
}
/**
* Creates a tag key for {@link Biome} in the registry {@code minecraft:worldgen/biome}.
*
* @param key the tag key's key
* @return a new tag key
*/
@ApiStatus.Experimental
public static TagKey<Biome> create(final Key key) {
return TagKey.create(RegistryKey.BIOME, key);
}
}

Datei anzeigen

@ -0,0 +1,57 @@
package io.papermc.paper.registry.keys.tags;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.tag.TagKey;
import net.kyori.adventure.key.Key;
import org.bukkit.entity.Cat;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla keys for {@link RegistryKey#CAT_VARIANT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.21.3")
@NullMarked
@ApiStatus.Experimental
public final class CatVariantTagKeys {
/**
* {@code #minecraft:default_spawns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Cat.Type> DEFAULT_SPAWNS = create(key("default_spawns"));
/**
* {@code #minecraft:full_moon_spawns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Cat.Type> FULL_MOON_SPAWNS = create(key("full_moon_spawns"));
private CatVariantTagKeys() {
}
/**
* Creates a tag key for {@link Cat.Type} in the registry {@code minecraft:cat_variant}.
*
* @param key the tag key's key
* @return a new tag key
*/
@ApiStatus.Experimental
public static TagKey<Cat.Type> create(final Key key) {
return TagKey.create(RegistryKey.CAT_VARIANT, key);
}
}

Datei anzeigen

@ -0,0 +1,274 @@
package io.papermc.paper.registry.keys.tags;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.tag.TagKey;
import net.kyori.adventure.key.Key;
import org.bukkit.damage.DamageType;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla keys for {@link RegistryKey#DAMAGE_TYPE}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.21.3")
@NullMarked
@ApiStatus.Experimental
public final class DamageTypeTagKeys {
/**
* {@code #minecraft:always_hurts_ender_dragons}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> ALWAYS_HURTS_ENDER_DRAGONS = create(key("always_hurts_ender_dragons"));
/**
* {@code #minecraft:always_kills_armor_stands}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> ALWAYS_KILLS_ARMOR_STANDS = create(key("always_kills_armor_stands"));
/**
* {@code #minecraft:always_most_significant_fall}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> ALWAYS_MOST_SIGNIFICANT_FALL = create(key("always_most_significant_fall"));
/**
* {@code #minecraft:always_triggers_silverfish}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> ALWAYS_TRIGGERS_SILVERFISH = create(key("always_triggers_silverfish"));
/**
* {@code #minecraft:avoids_guardian_thorns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> AVOIDS_GUARDIAN_THORNS = create(key("avoids_guardian_thorns"));
/**
* {@code #minecraft:burn_from_stepping}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> BURN_FROM_STEPPING = create(key("burn_from_stepping"));
/**
* {@code #minecraft:burns_armor_stands}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> BURNS_ARMOR_STANDS = create(key("burns_armor_stands"));
/**
* {@code #minecraft:bypasses_armor}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> BYPASSES_ARMOR = create(key("bypasses_armor"));
/**
* {@code #minecraft:bypasses_effects}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> BYPASSES_EFFECTS = create(key("bypasses_effects"));
/**
* {@code #minecraft:bypasses_enchantments}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> BYPASSES_ENCHANTMENTS = create(key("bypasses_enchantments"));
/**
* {@code #minecraft:bypasses_invulnerability}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> BYPASSES_INVULNERABILITY = create(key("bypasses_invulnerability"));
/**
* {@code #minecraft:bypasses_resistance}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> BYPASSES_RESISTANCE = create(key("bypasses_resistance"));
/**
* {@code #minecraft:bypasses_shield}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> BYPASSES_SHIELD = create(key("bypasses_shield"));
/**
* {@code #minecraft:bypasses_wolf_armor}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> BYPASSES_WOLF_ARMOR = create(key("bypasses_wolf_armor"));
/**
* {@code #minecraft:can_break_armor_stand}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> CAN_BREAK_ARMOR_STAND = create(key("can_break_armor_stand"));
/**
* {@code #minecraft:damages_helmet}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> DAMAGES_HELMET = create(key("damages_helmet"));
/**
* {@code #minecraft:ignites_armor_stands}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> IGNITES_ARMOR_STANDS = create(key("ignites_armor_stands"));
/**
* {@code #minecraft:is_drowning}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> IS_DROWNING = create(key("is_drowning"));
/**
* {@code #minecraft:is_explosion}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> IS_EXPLOSION = create(key("is_explosion"));
/**
* {@code #minecraft:is_fall}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> IS_FALL = create(key("is_fall"));
/**
* {@code #minecraft:is_fire}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> IS_FIRE = create(key("is_fire"));
/**
* {@code #minecraft:is_freezing}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> IS_FREEZING = create(key("is_freezing"));
/**
* {@code #minecraft:is_lightning}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> IS_LIGHTNING = create(key("is_lightning"));
/**
* {@code #minecraft:is_player_attack}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> IS_PLAYER_ATTACK = create(key("is_player_attack"));
/**
* {@code #minecraft:is_projectile}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> IS_PROJECTILE = create(key("is_projectile"));
/**
* {@code #minecraft:mace_smash}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> MACE_SMASH = create(key("mace_smash"));
/**
* {@code #minecraft:no_anger}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> NO_ANGER = create(key("no_anger"));
/**
* {@code #minecraft:no_impact}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> NO_IMPACT = create(key("no_impact"));
/**
* {@code #minecraft:no_knockback}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> NO_KNOCKBACK = create(key("no_knockback"));
/**
* {@code #minecraft:panic_causes}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> PANIC_CAUSES = create(key("panic_causes"));
/**
* {@code #minecraft:panic_environmental_causes}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> PANIC_ENVIRONMENTAL_CAUSES = create(key("panic_environmental_causes"));
/**
* {@code #minecraft:witch_resistant_to}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> WITCH_RESISTANT_TO = create(key("witch_resistant_to"));
/**
* {@code #minecraft:wither_immune_to}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> WITHER_IMMUNE_TO = create(key("wither_immune_to"));
private DamageTypeTagKeys() {
}
/**
* Creates a tag key for {@link DamageType} in the registry {@code minecraft:damage_type}.
*
* @param key the tag key's key
* @return a new tag key
*/
@ApiStatus.Experimental
public static TagKey<DamageType> create(final Key key) {
return TagKey.create(RegistryKey.DAMAGE_TYPE, key);
}
}

Datei anzeigen

@ -0,0 +1,57 @@
package io.papermc.paper.registry.keys.tags;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.tag.TagKey;
import net.kyori.adventure.key.Key;
import org.bukkit.Fluid;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla keys for {@link RegistryKey#FLUID}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.21.3")
@NullMarked
@ApiStatus.Experimental
public final class FluidTagKeys {
/**
* {@code #minecraft:lava}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Fluid> LAVA = create(key("lava"));
/**
* {@code #minecraft:water}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Fluid> WATER = create(key("water"));
private FluidTagKeys() {
}
/**
* Creates a tag key for {@link Fluid} in the registry {@code minecraft:fluid}.
*
* @param key the tag key's key
* @return a new tag key
*/
@ApiStatus.Experimental
public static TagKey<Fluid> create(final Key key) {
return TagKey.create(RegistryKey.FLUID, key);
}
}

Datei anzeigen

@ -0,0 +1,78 @@
package io.papermc.paper.registry.keys.tags;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.tag.TagKey;
import net.kyori.adventure.key.Key;
import org.bukkit.GameEvent;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla keys for {@link RegistryKey#GAME_EVENT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.21.3")
@NullMarked
@ApiStatus.Experimental
public final class GameEventTagKeys {
/**
* {@code #minecraft:allay_can_listen}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<GameEvent> ALLAY_CAN_LISTEN = create(key("allay_can_listen"));
/**
* {@code #minecraft:ignore_vibrations_sneaking}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<GameEvent> IGNORE_VIBRATIONS_SNEAKING = create(key("ignore_vibrations_sneaking"));
/**
* {@code #minecraft:shrieker_can_listen}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<GameEvent> SHRIEKER_CAN_LISTEN = create(key("shrieker_can_listen"));
/**
* {@code #minecraft:vibrations}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<GameEvent> VIBRATIONS = create(key("vibrations"));
/**
* {@code #minecraft:warden_can_listen}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<GameEvent> WARDEN_CAN_LISTEN = create(key("warden_can_listen"));
private GameEventTagKeys() {
}
/**
* Creates a tag key for {@link GameEvent} in the registry {@code minecraft:game_event}.
*
* @param key the tag key's key
* @return a new tag key
*/
@ApiStatus.Experimental
public static TagKey<GameEvent> create(final Key key) {
return TagKey.create(RegistryKey.GAME_EVENT, key);
}
}

Datei anzeigen

@ -0,0 +1,64 @@
package io.papermc.paper.registry.keys.tags;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.tag.TagKey;
import net.kyori.adventure.key.Key;
import org.bukkit.MusicInstrument;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla keys for {@link RegistryKey#INSTRUMENT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.21.3")
@NullMarked
@ApiStatus.Experimental
public final class InstrumentTagKeys {
/**
* {@code #minecraft:goat_horns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<MusicInstrument> GOAT_HORNS = create(key("goat_horns"));
/**
* {@code #minecraft:regular_goat_horns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<MusicInstrument> REGULAR_GOAT_HORNS = create(key("regular_goat_horns"));
/**
* {@code #minecraft:screaming_goat_horns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<MusicInstrument> SCREAMING_GOAT_HORNS = create(key("screaming_goat_horns"));
private InstrumentTagKeys() {
}
/**
* Creates a tag key for {@link MusicInstrument} in the registry {@code minecraft:instrument}.
*
* @param key the tag key's key
* @return a new tag key
*/
@ApiStatus.Experimental
public static TagKey<MusicInstrument> create(final Key key) {
return TagKey.create(RegistryKey.INSTRUMENT, key);
}
}

Datei anzeigen

@ -0,0 +1,50 @@
package io.papermc.paper.registry.keys.tags;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.tag.TagKey;
import net.kyori.adventure.key.Key;
import org.bukkit.Art;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla keys for {@link RegistryKey#PAINTING_VARIANT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.21.3")
@NullMarked
@ApiStatus.Experimental
public final class PaintingVariantTagKeys {
/**
* {@code #minecraft:placeable}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Art> PLACEABLE = create(key("placeable"));
private PaintingVariantTagKeys() {
}
/**
* Creates a tag key for {@link Art} in the registry {@code minecraft:painting_variant}.
*
* @param key the tag key's key
* @return a new tag key
*/
@ApiStatus.Experimental
public static TagKey<Art> create(final Key key) {
return TagKey.create(RegistryKey.PAINTING_VARIANT, key);
}
}

Datei anzeigen

@ -0,0 +1,198 @@
package io.papermc.paper.registry.keys.tags;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.tag.TagKey;
import net.kyori.adventure.key.Key;
import org.bukkit.MinecraftExperimental;
import org.bukkit.generator.structure.Structure;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla keys for {@link RegistryKey#STRUCTURE}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.21.3")
@NullMarked
@ApiStatus.Experimental
public final class StructureTagKeys {
/**
* {@code #minecraft:cats_spawn_as_black}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> CATS_SPAWN_AS_BLACK = create(key("cats_spawn_as_black"));
/**
* {@code #minecraft:cats_spawn_in}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> CATS_SPAWN_IN = create(key("cats_spawn_in"));
/**
* {@code #minecraft:dolphin_located}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> DOLPHIN_LOCATED = create(key("dolphin_located"));
/**
* {@code #minecraft:eye_of_ender_located}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> EYE_OF_ENDER_LOCATED = create(key("eye_of_ender_located"));
/**
* {@code #minecraft:mineshaft}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> MINESHAFT = create(key("mineshaft"));
/**
* {@code #minecraft:ocean_ruin}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> OCEAN_RUIN = create(key("ocean_ruin"));
/**
* {@code #minecraft:on_desert_village_maps}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Structure> ON_DESERT_VILLAGE_MAPS = create(key("on_desert_village_maps"));
/**
* {@code #minecraft:on_jungle_explorer_maps}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Structure> ON_JUNGLE_EXPLORER_MAPS = create(key("on_jungle_explorer_maps"));
/**
* {@code #minecraft:on_ocean_explorer_maps}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> ON_OCEAN_EXPLORER_MAPS = create(key("on_ocean_explorer_maps"));
/**
* {@code #minecraft:on_plains_village_maps}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Structure> ON_PLAINS_VILLAGE_MAPS = create(key("on_plains_village_maps"));
/**
* {@code #minecraft:on_savanna_village_maps}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Structure> ON_SAVANNA_VILLAGE_MAPS = create(key("on_savanna_village_maps"));
/**
* {@code #minecraft:on_snowy_village_maps}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Structure> ON_SNOWY_VILLAGE_MAPS = create(key("on_snowy_village_maps"));
/**
* {@code #minecraft:on_swamp_explorer_maps}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Structure> ON_SWAMP_EXPLORER_MAPS = create(key("on_swamp_explorer_maps"));
/**
* {@code #minecraft:on_taiga_village_maps}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Structure> ON_TAIGA_VILLAGE_MAPS = create(key("on_taiga_village_maps"));
/**
* {@code #minecraft:on_treasure_maps}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> ON_TREASURE_MAPS = create(key("on_treasure_maps"));
/**
* {@code #minecraft:on_trial_chambers_maps}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> ON_TRIAL_CHAMBERS_MAPS = create(key("on_trial_chambers_maps"));
/**
* {@code #minecraft:on_woodland_explorer_maps}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> ON_WOODLAND_EXPLORER_MAPS = create(key("on_woodland_explorer_maps"));
/**
* {@code #minecraft:ruined_portal}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> RUINED_PORTAL = create(key("ruined_portal"));
/**
* {@code #minecraft:shipwreck}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> SHIPWRECK = create(key("shipwreck"));
/**
* {@code #minecraft:village}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> VILLAGE = create(key("village"));
private StructureTagKeys() {
}
/**
* Creates a tag key for {@link Structure} in the registry {@code minecraft:worldgen/structure}.
*
* @param key the tag key's key
* @return a new tag key
*/
@ApiStatus.Experimental
public static TagKey<Structure> create(final Key key) {
return TagKey.create(RegistryKey.STRUCTURE, key);
}
}

Datei anzeigen

@ -66,8 +66,19 @@ public interface Generators {
simpleKey("InstrumentKeys", MusicInstrument.class, Registries.INSTRUMENT, RegistryKey.INSTRUMENT, true),
// tags
simpleTagKey("EnchantmentTagKeys", Enchantment.class, Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT),
simpleTagKey("GameEventTagKeys", GameEvent.class, Registries.GAME_EVENT, RegistryKey.GAME_EVENT),
simpleTagKey("BlockTypeTagKeys", BlockType.class, Registries.BLOCK, RegistryKey.BLOCK),
simpleTagKey("ItemTypeTagKeys", ItemType.class, Registries.ITEM, RegistryKey.ITEM),
simpleTagKey("CatVariantTagKeys", Cat.Type.class, Registries.CAT_VARIANT, RegistryKey.CAT_VARIANT),
simpleTagKey("FluidTagKeys", Fluid.class, Registries.FLUID, RegistryKey.FLUID),
simpleTagKey("BiomeTagKeys", Biome.class, Registries.BIOME, RegistryKey.BIOME),
simpleTagKey("StructureTagKeys", Structure.class, Registries.STRUCTURE, RegistryKey.STRUCTURE),
simpleTagKey("DamageTypeTagKeys", DamageType.class, Registries.DAMAGE_TYPE, RegistryKey.DAMAGE_TYPE),
simpleTagKey("EnchantmentTagKeys", Enchantment.class, Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT),
simpleTagKey("BannerPatternTagKeys", PatternType.class, Registries.BANNER_PATTERN, RegistryKey.BANNER_PATTERN),
simpleTagKey("PaintingVariantTagKeys", Art.class, Registries.PAINTING_VARIANT, RegistryKey.PAINTING_VARIANT),
simpleTagKey("InstrumentTagKeys", MusicInstrument.class, Registries.INSTRUMENT, RegistryKey.INSTRUMENT),
new MobGoalGenerator("VanillaGoal", "com.destroystokyo.paper.entity.ai")
};

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Add Player Client Options API
diff --git a/src/main/java/com/destroystokyo/paper/ClientOption.java b/src/main/java/com/destroystokyo/paper/ClientOption.java
new file mode 100644
index 0000000000000000000000000000000000000000..ed08f823e0620289392f7fc2ff0ac721cff60478
index 0000000000000000000000000000000000000000..7af28d6ba27c97a87ffbb9db03a5c340277853cc
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/ClientOption.java
@@ -0,0 +1,51 @@
@@ -0,0 +1,70 @@
+package com.destroystokyo.paper;
+
+import net.kyori.adventure.translation.Translatable;
@ -26,8 +26,9 @@ index 0000000000000000000000000000000000000000..ed08f823e0620289392f7fc2ff0ac721
+ public static final ClientOption<String> LOCALE = new ClientOption<>(String.class);
+ public static final ClientOption<MainHand> MAIN_HAND = new ClientOption<>(MainHand.class);
+ public static final ClientOption<Integer> VIEW_DISTANCE = new ClientOption<>(Integer.class);
+ public static final ClientOption<Boolean> ALLOW_SERVER_LISTINGS = new ClientOption<>(Boolean.class);
+ public static final ClientOption<Boolean> TEXT_FILTERING_ENABLED = new ClientOption<>(Boolean.class);
+ public static final ClientOption<Boolean> ALLOW_SERVER_LISTINGS = new ClientOption<>(Boolean.class);
+ public static final ClientOption<ParticleVisibility> PARTICLE_VISIBILITY = new ClientOption<>(ParticleVisibility.class);
+
+ private final Class<T> type;
+
@ -60,6 +61,24 @@ index 0000000000000000000000000000000000000000..ed08f823e0620289392f7fc2ff0ac721
+ return "options.chat.visibility." + this.name;
+ }
+ }
+
+ public enum ParticleVisibility implements Translatable {
+ ALL("all"),
+ DECREASED("decreased"),
+ MINIMAL("minimal");
+
+ public static final Index<String, ParticleVisibility> NAMES = Index.create(ParticleVisibility.class, particleVisibility -> particleVisibility.name);
+ private final String name;
+
+ ParticleVisibility(final String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String translationKey() {
+ return "options.particles." + this.name;
+ }
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/SkinParts.java b/src/main/java/com/destroystokyo/paper/SkinParts.java
new file mode 100644
@ -89,14 +108,15 @@ index 0000000000000000000000000000000000000000..4a0c39405d4fbed457787e3c6ded4cc6
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerClientOptionsChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerClientOptionsChangeEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..6cf6aa876278d0d3e75148608951fc5865ad5aee
index 0000000000000000000000000000000000000000..5245955fb3466d2b89eaad4027d145ebf7bb122c
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerClientOptionsChangeEvent.java
@@ -0,0 +1,130 @@
@@ -0,0 +1,142 @@
+package com.destroystokyo.paper.event.player;
+
+import com.destroystokyo.paper.ClientOption;
+import com.destroystokyo.paper.ClientOption.ChatVisibility;
+import com.destroystokyo.paper.ClientOption.ParticleVisibility;
+import com.destroystokyo.paper.SkinParts;
+import java.util.Map;
+import org.bukkit.entity.Player;
@ -122,6 +142,7 @@ index 0000000000000000000000000000000000000000..6cf6aa876278d0d3e75148608951fc58
+ private final MainHand mainHand;
+ private final boolean allowsServerListings;
+ private final boolean textFilteringEnabled;
+ private final ParticleVisibility particleVisibility;
+
+ @Deprecated
+ public PlayerClientOptionsChangeEvent(final Player player, final String locale, final int viewDistance, final ChatVisibility chatVisibility, final boolean chatColors, final SkinParts skinParts, final MainHand mainHand) {
@ -134,6 +155,7 @@ index 0000000000000000000000000000000000000000..6cf6aa876278d0d3e75148608951fc58
+ this.mainHand = mainHand;
+ this.allowsServerListings = false;
+ this.textFilteringEnabled = false;
+ this.particleVisibility = ParticleVisibility.ALL;
+ }
+
+ @ApiStatus.Internal
@ -148,6 +170,7 @@ index 0000000000000000000000000000000000000000..6cf6aa876278d0d3e75148608951fc58
+ this.mainHand = (MainHand) options.get(ClientOption.MAIN_HAND);
+ this.allowsServerListings = (boolean) options.get(ClientOption.ALLOW_SERVER_LISTINGS);
+ this.textFilteringEnabled = (boolean) options.get(ClientOption.TEXT_FILTERING_ENABLED);
+ this.particleVisibility = (ParticleVisibility) options.get(ClientOption.PARTICLE_VISIBILITY);
+ }
+
+ public String getLocale() {
@ -198,6 +221,14 @@ index 0000000000000000000000000000000000000000..6cf6aa876278d0d3e75148608951fc58
+ return this.mainHand != this.player.getClientOption(ClientOption.MAIN_HAND);
+ }
+
+ public boolean hasTextFilteringEnabled() {
+ return this.textFilteringEnabled;
+ }
+
+ public boolean hasTextFilteringChanged() {
+ return this.textFilteringEnabled != this.player.getClientOption(ClientOption.TEXT_FILTERING_ENABLED);
+ }
+
+ public boolean allowsServerListings() {
+ return this.allowsServerListings;
+ }
@ -206,12 +237,12 @@ index 0000000000000000000000000000000000000000..6cf6aa876278d0d3e75148608951fc58
+ return this.allowsServerListings != this.player.getClientOption(ClientOption.ALLOW_SERVER_LISTINGS);
+ }
+
+ public boolean hasTextFilteringEnabled() {
+ return this.textFilteringEnabled;
+ public ParticleVisibility getParticleVisibility() {
+ return this.particleVisibility;
+ }
+
+ public boolean hasTextFilteringChanged() {
+ return this.textFilteringEnabled != this.player.getClientOption(ClientOption.TEXT_FILTERING_ENABLED);
+ public boolean hasParticleVisibilityChanged() {
+ return this.particleVisibility != this.player.getClientOption(ClientOption.PARTICLE_VISIBILITY);
+ }
+
+ @Override

Datei anzeigen

@ -18,7 +18,7 @@ the schedulers depending on the result of the ownership check.
diff --git a/src/main/java/io/papermc/paper/threadedregions/scheduler/AsyncScheduler.java b/src/main/java/io/papermc/paper/threadedregions/scheduler/AsyncScheduler.java
new file mode 100644
index 0000000000000000000000000000000000000000..d9cdd04660c5e60e494a8fed91ae437e6cb733ed
index 0000000000000000000000000000000000000000..9852e14e68d12ca56b0d57cd6e83e252f47bde72
--- /dev/null
+++ b/src/main/java/io/papermc/paper/threadedregions/scheduler/AsyncScheduler.java
@@ -0,0 +1,51 @@
@ -52,7 +52,7 @@ index 0000000000000000000000000000000000000000..d9cdd04660c5e60e494a8fed91ae437e
+ * @return The {@link ScheduledTask} that represents the scheduled task.
+ */
+ @NotNull ScheduledTask runDelayed(@NotNull Plugin plugin, @NotNull Consumer<ScheduledTask> task, long delay,
+ @NotNull TimeUnit unit);
+ @NotNull TimeUnit unit);
+
+ /**
+ * Schedules the specified task to be executed asynchronously after the initial delay has passed,
@ -65,7 +65,7 @@ index 0000000000000000000000000000000000000000..d9cdd04660c5e60e494a8fed91ae437e
+ * @return The {@link ScheduledTask} that represents the scheduled task.
+ */
+ @NotNull ScheduledTask runAtFixedRate(@NotNull Plugin plugin, @NotNull Consumer<ScheduledTask> task,
+ long initialDelay, long period, @NotNull TimeUnit unit);
+ long initialDelay, long period, @NotNull TimeUnit unit);
+
+ /**
+ * Attempts to cancel all tasks scheduled by the specified plugin.
@ -75,7 +75,7 @@ index 0000000000000000000000000000000000000000..d9cdd04660c5e60e494a8fed91ae437e
+}
diff --git a/src/main/java/io/papermc/paper/threadedregions/scheduler/EntityScheduler.java b/src/main/java/io/papermc/paper/threadedregions/scheduler/EntityScheduler.java
new file mode 100644
index 0000000000000000000000000000000000000000..9f69e189be8202a0ab1450540f5d12187ba6c987
index 0000000000000000000000000000000000000000..99e9e20ae01f9b4b8cde585d29c57e27c53c996e
--- /dev/null
+++ b/src/main/java/io/papermc/paper/threadedregions/scheduler/EntityScheduler.java
@@ -0,0 +1,104 @@
@ -142,7 +142,7 @@ index 0000000000000000000000000000000000000000..9f69e189be8202a0ab1450540f5d1218
+ * @return The {@link ScheduledTask} that represents the scheduled task, or {@code null} if the entity has been removed.
+ */
+ @Nullable ScheduledTask run(@NotNull Plugin plugin, @NotNull Consumer<ScheduledTask> task,
+ @Nullable Runnable retired);
+ @Nullable Runnable retired);
+
+ /**
+ * Schedules a task with the given delay. If the task failed to schedule because the scheduler is retired (entity
@ -161,7 +161,7 @@ index 0000000000000000000000000000000000000000..9f69e189be8202a0ab1450540f5d1218
+ * @return The {@link ScheduledTask} that represents the scheduled task, or {@code null} if the entity has been removed.
+ */
+ @Nullable ScheduledTask runDelayed(@NotNull Plugin plugin, @NotNull Consumer<ScheduledTask> task,
+ @Nullable Runnable retired, long delayTicks);
+ @Nullable Runnable retired, long delayTicks);
+
+ /**
+ * Schedules a repeating task with the given delay and period. If the task failed to schedule because the scheduler
@ -181,11 +181,11 @@ index 0000000000000000000000000000000000000000..9f69e189be8202a0ab1450540f5d1218
+ * @return The {@link ScheduledTask} that represents the scheduled task, or {@code null} if the entity has been removed.
+ */
+ @Nullable ScheduledTask runAtFixedRate(@NotNull Plugin plugin, @NotNull Consumer<ScheduledTask> task,
+ @Nullable Runnable retired, long initialDelayTicks, long periodTicks);
+ @Nullable Runnable retired, long initialDelayTicks, long periodTicks);
+}
diff --git a/src/main/java/io/papermc/paper/threadedregions/scheduler/GlobalRegionScheduler.java b/src/main/java/io/papermc/paper/threadedregions/scheduler/GlobalRegionScheduler.java
new file mode 100644
index 0000000000000000000000000000000000000000..365b53fea8dee09cdc11f4399dea5f00c6ee70e2
index 0000000000000000000000000000000000000000..57455aca80ecc458b96b44c086cea94ddcecae47
--- /dev/null
+++ b/src/main/java/io/papermc/paper/threadedregions/scheduler/GlobalRegionScheduler.java
@@ -0,0 +1,58 @@
@ -239,7 +239,7 @@ index 0000000000000000000000000000000000000000..365b53fea8dee09cdc11f4399dea5f00
+ * @return The {@link ScheduledTask} that represents the scheduled task.
+ */
+ @NotNull ScheduledTask runAtFixedRate(@NotNull Plugin plugin, @NotNull Consumer<ScheduledTask> task,
+ long initialDelayTicks, long periodTicks);
+ long initialDelayTicks, long periodTicks);
+
+ /**
+ * Attempts to cancel all tasks scheduled by the specified plugin.
@ -499,10 +499,10 @@ index 0000000000000000000000000000000000000000..a6b50c9d8af589cc4747e14d343d2045
+ }
+}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 7919a001e5b5886a3d0fb64913064bc9607a2102..0f0b5b69a6cf7aac62a9802f2778cce4f08cfb88 100644
index 7919a001e5b5886a3d0fb64913064bc9607a2102..42beeecad288a7600d4906877932ccd701ed7cc2 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2696,6 +2696,141 @@ public final class Bukkit {
@@ -2696,6 +2696,164 @@ public final class Bukkit {
}
// Paper end
@ -631,6 +631,21 @@ index 7919a001e5b5886a3d0fb64913064bc9607a2102..0f0b5b69a6cf7aac62a9802f2778cce4
+
+ /**
+ * Returns whether the current thread is ticking a region and that the region being ticked
+ * owns the chunks in the rectangle specified by the min and max parameters.
+ * Specifically, this function checks that every chunk with position x in [minChunkX, maxChunkX] and
+ * position z in [minChunkZ, maxChunkZ] is owned by the current ticking region.
+ * @param world Specified world.
+ * @param minChunkX Specified x-coordinate of the minimum chunk position.
+ * @param minChunkZ Specified z-coordinate of the minimum chunk position.
+ * @param maxChunkX Specified x-coordinate of the maximum chunk position.
+ * @param maxChunkZ Specified z-coordinate of the maximum chunk position.
+ */
+ public static boolean isOwnedByCurrentRegion(@NotNull World world, int minChunkX, int minChunkZ, int maxChunkX, int maxChunkZ) {
+ return server.isOwnedByCurrentRegion(world, minChunkX, minChunkZ, maxChunkX, maxChunkZ);
+ }
+
+ /**
+ * Returns whether the current thread is ticking a region and that the region being ticked
+ * owns the specified entity. Note that this function is the only appropriate method of checking
+ * for ownership of an entity, as retrieving the entity's location is undefined unless the entity is owned
+ * by the current region.
@ -639,16 +654,24 @@ index 7919a001e5b5886a3d0fb64913064bc9607a2102..0f0b5b69a6cf7aac62a9802f2778cce4
+ public static boolean isOwnedByCurrentRegion(@NotNull Entity entity) {
+ return server.isOwnedByCurrentRegion(entity);
+ }
+
+ /**
+ * Returns whether the current thread is ticking the global region.
+ * @see io.papermc.paper.threadedregions.scheduler.GlobalRegionScheduler
+ */
+ public static boolean isGlobalTickThread() {
+ return server.isGlobalTickThread();
+ }
+ // Paper end - Folia region threading API
+
@NotNull
public static Server.Spigot spigot() {
return server.spigot();
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 2801f4b27bb77e2d5698f82dd14c4a92d2f4392c..01b1aa2af1aac83ac8b341e7ba2803317373056b 100644
index 2801f4b27bb77e2d5698f82dd14c4a92d2f4392c..ecfe4f0079038e0a4541ac71ab590ac18108d1d3 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2351,4 +2351,119 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2351,4 +2351,138 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
@NotNull org.bukkit.potion.PotionBrewer getPotionBrewer();
// Paper end
@ -760,12 +783,31 @@ index 2801f4b27bb77e2d5698f82dd14c4a92d2f4392c..01b1aa2af1aac83ac8b341e7ba280331
+
+ /**
+ * Returns whether the current thread is ticking a region and that the region being ticked
+ * owns the chunks in the rectangle specified by the min and max parameters.
+ * Specifically, this function checks that every chunk with position x in [minChunkX, maxChunkX] and
+ * position z in [minChunkZ, maxChunkZ] is owned by the current ticking region.
+ * @param world Specified world.
+ * @param minChunkX Specified x-coordinate of the minimum chunk position.
+ * @param minChunkZ Specified z-coordinate of the minimum chunk position.
+ * @param maxChunkX Specified x-coordinate of the maximum chunk position.
+ * @param maxChunkZ Specified z-coordinate of the maximum chunk position.
+ */
+ boolean isOwnedByCurrentRegion(@NotNull World world, int minChunkX, int minChunkZ, int maxChunkX, int maxChunkZ);
+
+ /**
+ * Returns whether the current thread is ticking a region and that the region being ticked
+ * owns the specified entity. Note that this function is the only appropriate method of checking
+ * for ownership of an entity, as retrieving the entity's location is undefined unless the entity is owned
+ * by the current region.
+ * @param entity Specified entity.
+ */
+ boolean isOwnedByCurrentRegion(@NotNull Entity entity);
+
+ /**
+ * Returns whether the current thread is ticking the global region.
+ * @see io.papermc.paper.threadedregions.scheduler.GlobalRegionScheduler
+ */
+ public boolean isGlobalTickThread();
+ // Paper end - Folia region threading API
}
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java

Datei anzeigen

@ -24,10 +24,10 @@ index 647f6a1ec1f9d3c203b41f90a99bfd415bf67366..9b39e33514b15a9d07104e2ad826d0da
* Built-in registry for cat variants.
diff --git a/src/main/java/io/papermc/paper/registry/data/EnchantmentRegistryEntry.java b/src/main/java/io/papermc/paper/registry/data/EnchantmentRegistryEntry.java
new file mode 100644
index 0000000000000000000000000000000000000000..d0d19a4bb2ba0e92710861b106777a428bdc5ad9
index 0000000000000000000000000000000000000000..f092077453cb13dd8d849550896c2ef1cfa81b7a
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/data/EnchantmentRegistryEntry.java
@@ -0,0 +1,332 @@
@@ -0,0 +1,331 @@
+package io.papermc.paper.registry.data;
+
+import io.papermc.paper.registry.RegistryBuilder;
@ -177,7 +177,7 @@ index 0000000000000000000000000000000000000000..d0d19a4bb2ba0e92710861b106777a42
+ * sharpness enchantment.
+ *
+ * @param description the description component.
+ * @return this builder.
+ * @return this builder instance.
+ */
+ @Contract(value = "_ -> this", mutates = "this")
+ Builder description(Component description);
@ -191,7 +191,7 @@ index 0000000000000000000000000000000000000000..d0d19a4bb2ba0e92710861b106777a42
+ * {@link io.papermc.paper.registry.keys.tags.ItemTypeTagKeys#ENCHANTABLE_SWORD}.
+ *
+ * @param supportedItems the registry key set representing the supported items.
+ * @return this builder.
+ * @return this builder instance.
+ * @see RegistrySet#keySet(RegistryKey, TypedKey[])
+ * @see io.papermc.paper.registry.event.RegistryFreezeEvent#getOrCreateTag(TagKey)
+ */
@ -212,7 +212,7 @@ index 0000000000000000000000000000000000000000..d0d19a4bb2ba0e92710861b106777a42
+ * which enchantments can even show up in an enchantment table.
+ *
+ * @param primaryItems the registry key set representing the primary items.
+ * @return this builder.
+ * @return this builder instance.
+ * @see RegistrySet#keySet(RegistryKey, TypedKey[])
+ * @see io.papermc.paper.registry.event.RegistryFreezeEvent#getOrCreateTag(TagKey)
+ */
@ -223,7 +223,7 @@ index 0000000000000000000000000000000000000000..d0d19a4bb2ba0e92710861b106777a42
+ * Configures the weight of this enchantment used by the weighted random when selecting enchantments.
+ *
+ * @param weight the weight value.
+ * @return this builder.
+ * @return this builder instance.
+ * @see <a href="https://minecraft.wiki/w/Enchanting">https://minecraft.wiki/w/Enchanting</a> for examplary weights.
+ */
+ @Contract(value = "_ -> this", mutates = "this")
@ -233,7 +233,7 @@ index 0000000000000000000000000000000000000000..d0d19a4bb2ba0e92710861b106777a42
+ * Configures the maximum level this enchantment can have when applied.
+ *
+ * @param maxLevel the maximum level.
+ * @return this builder.
+ * @return this builder instance.
+ */
+ @Contract(value = "_ -> this", mutates = "this")
+ Builder maxLevel(@Range(from = 1, to = 255) int maxLevel);
@ -244,7 +244,7 @@ index 0000000000000000000000000000000000000000..d0d19a4bb2ba0e92710861b106777a42
+ * Note that a cost is not directly related to the consumed xp.
+ *
+ * @param minimumCost the enchantment cost.
+ * @return this builder.
+ * @return this builder instance.
+ * @see <a href="https://minecraft.wiki/w/Enchanting/Levels">https://minecraft.wiki/w/Enchanting/Levels</a> for
+ * examplary costs.
+ */
@ -257,7 +257,7 @@ index 0000000000000000000000000000000000000000..d0d19a4bb2ba0e92710861b106777a42
+ * Note that a cost is not directly related to the consumed xp.
+ *
+ * @param maximumCost the enchantment cost.
+ * @return this builder.
+ * @return this builder instance.
+ * @see <a href="https://minecraft.wiki/w/Enchanting/Levels">https://minecraft.wiki/w/Enchanting/Levels</a> for
+ * examplary costs.
+ */
@ -272,7 +272,7 @@ index 0000000000000000000000000000000000000000..d0d19a4bb2ba0e92710861b106777a42
+ * </p>
+ *
+ * @param anvilCost the anvil cost of this enchantment
+ * @return this builder.
+ * @return this builder instance.
+ * @see Enchantment#getAnvilCost()
+ */
+ @Contract(value = "_ -> this", mutates = "this")
@ -285,7 +285,7 @@ index 0000000000000000000000000000000000000000..d0d19a4bb2ba0e92710861b106777a42
+ * groups, the enchantment's effects, like attribute modifiers, will not activate.
+ *
+ * @param activeSlots a list of equipment slot groups.
+ * @return this builder.
+ * @return this builder instance.
+ * @see Enchantment#getActiveSlotGroups()
+ */
+ @Contract(value = "_ -> this", mutates = "this")
@ -300,7 +300,7 @@ index 0000000000000000000000000000000000000000..d0d19a4bb2ba0e92710861b106777a42
+ * groups, the enchantment's effects, like attribute modifiers, will not activate.
+ *
+ * @param activeSlots a list of equipment slot groups.
+ * @return this builder.
+ * @return this builder instance.
+ * @see Enchantment#getActiveSlotGroups()
+ */
+ @Contract(value = "_ -> this", mutates = "this")
@ -315,7 +315,7 @@ index 0000000000000000000000000000000000000000..d0d19a4bb2ba0e92710861b106777a42
+ * Defaults to an empty set allowing this enchantment to be applied regardless of other enchantments.
+ *
+ * @param exclusiveWith a registry set of enchantments exclusive to this one.
+ * @return this builder.
+ * @return this builder instance.
+ * @see RegistrySet#keySet(RegistryKey, TypedKey[])
+ * @see io.papermc.paper.registry.event.RegistryFreezeEvent#getOrCreateTag(TagKey)
+ */
@ -358,7 +358,6 @@ index 0000000000000000000000000000000000000000..d0d19a4bb2ba0e92710861b106777a42
+ return new Impl(baseCost, additionalPerLevelCost);
+ }
+ }
+
+}
diff --git a/src/main/java/io/papermc/paper/registry/data/GameEventRegistryEntry.java b/src/main/java/io/papermc/paper/registry/data/GameEventRegistryEntry.java
new file mode 100644
@ -417,10 +416,10 @@ index 0000000000000000000000000000000000000000..980fe12b75258b51cc2498590cadb9de
+}
diff --git a/src/main/java/io/papermc/paper/registry/data/PaintingVariantRegistryEntry.java b/src/main/java/io/papermc/paper/registry/data/PaintingVariantRegistryEntry.java
new file mode 100644
index 0000000000000000000000000000000000000000..b8d133afa82da1b5b9e7a18e1c332ae3aefea50d
index 0000000000000000000000000000000000000000..4e2c99acd7dc307981ba8e33a62835f0f29fd73e
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/data/PaintingVariantRegistryEntry.java
@@ -0,0 +1,135 @@
@@ -0,0 +1,131 @@
+package io.papermc.paper.registry.data;
+
+import io.papermc.paper.registry.RegistryBuilder;
@ -443,27 +442,25 @@ index 0000000000000000000000000000000000000000..b8d133afa82da1b5b9e7a18e1c332ae3
+public interface PaintingVariantRegistryEntry {
+
+ /**
+ * Provides the width of this variant in blocks.
+ * Provides the width of this painting in blocks.
+ *
+ * @return the width
+ * @return the width.
+ * @see Art#getBlockWidth()
+ */
+ @Range(from = 1, to = 16)
+ int width();
+ @Range(from = 1, to = 16) int width();
+
+ /**
+ * Provides the height of this variant in blocks.
+ * Provides the height of this painting in blocks.
+ *
+ * @return the height
+ * @return the height.
+ * @see Art#getBlockHeight()
+ */
+ @Range(from = 1, to = 16)
+ int height();
+ @Range(from = 1, to = 16) int height();
+
+ /**
+ * Provides the title of the painting visible in the creative inventory.
+ *
+ * @return the title
+ * @return the title.
+ * @see Art#title()
+ */
+ @Nullable Component title();
@ -471,15 +468,15 @@ index 0000000000000000000000000000000000000000..b8d133afa82da1b5b9e7a18e1c332ae3
+ /**
+ * Provides the author of the painting visible in the creative inventory.
+ *
+ * @return the author
+ * @return the author.
+ * @see Art#author()
+ */
+ @Nullable Component author();
+
+ /**
+ * Provides the assetId of the variant, which is the location of the sprite to use.
+ * Provides the asset id of the painting, which is the location of the sprite to use.
+ *
+ * @return the asset id
+ * @return the asset id.
+ * @see Art#assetId()
+ */
+ Key assetId();
@ -501,30 +498,30 @@ index 0000000000000000000000000000000000000000..b8d133afa82da1b5b9e7a18e1c332ae3
+ /**
+ * Sets the width of the painting in blocks.
+ *
+ * @param width the width in blocks
+ * @return this builder instance
+ * @param width the width in blocks.
+ * @return this builder instance.
+ * @see PaintingVariantRegistryEntry#width()
+ * @see Art#getBlockWidth()
+ */
+ @Contract(value = "_ -> this", mutates = "this")
+ Builder width(@Range(from = 0, to = 16) int width);
+ Builder width(@Range(from = 1, to = 16) int width);
+
+ /**
+ * Sets the height of the painting in blocks.
+ *
+ * @param height the height in blocks
+ * @return this builder instance
+ * @param height the height in blocks.
+ * @return this builder instance.
+ * @see PaintingVariantRegistryEntry#height()
+ * @see Art#getBlockHeight()
+ */
+ @Contract(value = "_ -> this", mutates = "this")
+ Builder height(@Range(from = 0, to = 16) int height);
+ Builder height(@Range(from = 1, to = 16) int height);
+
+ /**
+ * Sets the title of the painting.
+ *
+ * @param title the title
+ * @return this builder instance
+ * @param title the title.
+ * @return this builder instance.
+ * @see PaintingVariantRegistryEntry#title()
+ * @see Art#title()
+ */
@ -534,8 +531,8 @@ index 0000000000000000000000000000000000000000..b8d133afa82da1b5b9e7a18e1c332ae3
+ /**
+ * Sets the author of the painting.
+ *
+ * @param author the author
+ * @return this builder instance
+ * @param author the author.
+ * @return this builder instance.
+ * @see PaintingVariantRegistryEntry#author()
+ * @see Art#author()
+ */
@ -543,18 +540,16 @@ index 0000000000000000000000000000000000000000..b8d133afa82da1b5b9e7a18e1c332ae3
+ Builder author(@Nullable Component author);
+
+ /**
+ * Sets the assetId of the variant, which is the location of the sprite to use.
+ * Sets the asset id of the painting, which is the location of the sprite to use.
+ *
+ * @param assetId the asset id
+ * @return this builder instance
+ * @param assetId the asset id.
+ * @return this builder instance.
+ * @see PaintingVariantRegistryEntry#assetId()
+ * @see Art#assetId()
+ */
+ @Contract(value = "_ -> this", mutates = "this")
+ Builder assetId(Key assetId);
+
+ }
+
+}
diff --git a/src/main/java/io/papermc/paper/registry/data/package-info.java b/src/main/java/io/papermc/paper/registry/data/package-info.java
new file mode 100644

Datei anzeigen

@ -3561,7 +3561,7 @@ index 0000000000000000000000000000000000000000..979bc05009b84b6fcdb59938cceace35
+}
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridge.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridge.java
new file mode 100644
index 0000000000000000000000000000000000000000..a845ccfc21f101f0632249745bbd8b334f85e72c
index 0000000000000000000000000000000000000000..e632221f36d0f355b4750071c7d8ccdd84b040a9
--- /dev/null
+++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridge.java
@@ -0,0 +1,32 @@
@ -3589,7 +3589,7 @@ index 0000000000000000000000000000000000000000..a845ccfc21f101f0632249745bbd8b33
+
+ ConsumeEffect.ApplyStatusEffects applyStatusEffects(List<PotionEffect> effectList, float probability);
+
+ ConsumeEffect.RemoveStatusEffects removeStatusEffects(RegistryKeySet<PotionEffectType> potionEffectTypeTagKey);
+ ConsumeEffect.RemoveStatusEffects removeStatusEffects(RegistryKeySet<PotionEffectType> effectTypes);
+
+ ConsumeEffect.ClearAllStatusEffects clearAllStatusEffects();
+

Datei anzeigen

@ -5,12 +5,12 @@ Subject: [PATCH] API to check if the server is sleeping
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 0b78564256ebc647ebac402e549d86ab6e307c8d..ba366576a571214e67bcc529dc1bca19e1d59ef8 100644
index dcd2699654c8848b985309f3739b4967515e41c7..7266d29ab6bb246e6daaa643951417123d42abcb 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2572,4 +2572,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2591,4 +2591,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
boolean isOwnedByCurrentRegion(@NotNull Entity entity);
public boolean isGlobalTickThread();
// Paper end - Folia region threading API
+
+ // Paper start - API to check if the server is sleeping

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] API to allow/disallow tick sleeping
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index ba366576a571214e67bcc529dc1bca19e1d59ef8..f55638eb8b315864052f9fe17ab4846e5e9d8dbb 100644
index 7266d29ab6bb246e6daaa643951417123d42abcb..a92bd4da6788f1331a4838ab5760baec2dc6e8ec 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2578,5 +2578,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2597,5 +2597,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* Returns whether the server is sleeping/paused.
*/
boolean isPaused();

Datei anzeigen

@ -485,10 +485,10 @@ index 0000000000000000000000000000000000000000..007e01d329a31acf7f4ed4c6dc4de7ad
+}
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
new file mode 100644
index 0000000000000000000000000000000000000000..0ea9eba1367858dfa5284524a8dd2f79daf6fc69
index 0000000000000000000000000000000000000000..87da4ff63294735bfcbfa8442fb8ae7196b0f197
--- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -0,0 +1,330 @@
@@ -0,0 +1,328 @@
+package io.papermc.paper.configuration;
+
+import com.mojang.logging.LogUtils;
@ -653,8 +653,6 @@ index 0000000000000000000000000000000000000000..0ea9eba1367858dfa5284524a8dd2f79
+ public UnsupportedSettings unsupportedSettings;
+
+ public class UnsupportedSettings extends ConfigurationPart {
+ @Comment("This setting controls if the broken behavior of disarmed tripwires not breaking should be allowed. This also allows for dupes")
+ public boolean allowTripwireDisarmingExploits = false;
+ @Comment("This setting allows for exploits related to end portals, for example sand duping")
+ public boolean allowUnsafeEndPortalTeleportation = false;
+ @Comment("This setting controls if players should be able to break bedrock, end portals and other intended to be permanent blocks.")
@ -1334,10 +1332,10 @@ index 0000000000000000000000000000000000000000..c5644d8d64f12073e39bc6ed79c8714f
+}
diff --git a/src/main/java/io/papermc/paper/configuration/RemovedConfigurations.java b/src/main/java/io/papermc/paper/configuration/RemovedConfigurations.java
new file mode 100644
index 0000000000000000000000000000000000000000..279b24c689b9979884b65df7eb1f059024f0feac
index 0000000000000000000000000000000000000000..f9a4bb664409a6c691c4dc901afe0bde75813636
--- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/RemovedConfigurations.java
@@ -0,0 +1,83 @@
@@ -0,0 +1,84 @@
+package io.papermc.paper.configuration;
+
+import org.spongepowered.configurate.NodePath;
@ -1417,7 +1415,8 @@ index 0000000000000000000000000000000000000000..279b24c689b9979884b65df7eb1f0590
+ path("limit-player-interactions"),
+ path("warnWhenSettingExcessiveVelocity"),
+ path("logging", "use-rgb-for-named-text-colors"),
+ path("unsupported-settings", "allow-grindstone-overstacking")
+ path("unsupported-settings", "allow-grindstone-overstacking"),
+ path("unsupported-settings", "allow-tripwire-disarming-exploits")
+ };
+
+}

Datei anzeigen

@ -4037,36 +4037,41 @@ index 0000000000000000000000000000000000000000..559c959aff3c9deef867b9e425fba3e2
+ private MoonriseConstants() {}
+
+}
diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/SimpleRandom.java b/src/main/java/ca/spottedleaf/moonrise/common/util/SimpleRandom.java
diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/SimpleThreadUnsafeRandom.java b/src/main/java/ca/spottedleaf/moonrise/common/util/SimpleThreadUnsafeRandom.java
new file mode 100644
index 0000000000000000000000000000000000000000..a9ff1c1a70faf4b7a64b265932f07a8b8f00c1ff
index 0000000000000000000000000000000000000000..8d57b9c141fbe049aea248faa547dc97ba24cba5
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/moonrise/common/util/SimpleRandom.java
@@ -0,0 +1,52 @@
+++ b/src/main/java/ca/spottedleaf/moonrise/common/util/SimpleThreadUnsafeRandom.java
@@ -0,0 +1,105 @@
+package ca.spottedleaf.moonrise.common.util;
+
+import net.minecraft.world.level.levelgen.LegacyRandomSource;
+import net.minecraft.util.Mth;
+import net.minecraft.util.RandomSource;
+import net.minecraft.world.level.levelgen.BitRandomSource;
+import net.minecraft.world.level.levelgen.MarsagliaPolarGaussian;
+import net.minecraft.world.level.levelgen.PositionalRandomFactory;
+
+/**
+ * Avoid costly CAS of superclass
+ * Avoid costly CAS of superclass + division in nextInt
+ */
+public final class SimpleRandom extends LegacyRandomSource {
+public final class SimpleThreadUnsafeRandom implements BitRandomSource {
+
+ private static final long MULTIPLIER = 25214903917L;
+ private static final long ADDEND = 11L;
+ private static final int BITS = 48;
+ private static final long MASK = (1L << BITS) - 1;
+ private static final long MASK = (1L << BITS) - 1L;
+
+ private long value;
+ private final MarsagliaPolarGaussian gaussianSource = new MarsagliaPolarGaussian(this);
+
+ public SimpleRandom(final long seed) {
+ super(0L);
+ this.value = seed;
+ public SimpleThreadUnsafeRandom(final long seed) {
+ this.setSeed(seed);
+ }
+
+ @Override
+ public void setSeed(final long seed) {
+ this.value = (seed ^ MULTIPLIER) & MASK;
+ this.gaussianSource.reset();
+ }
+
+ private long advanceSeed() {
@ -4094,6 +4099,154 @@ index 0000000000000000000000000000000000000000..a9ff1c1a70faf4b7a64b265932f07a8b
+ final long value = this.advanceSeed() >>> (BITS - Integer.SIZE);
+ return (int)((value * (long)bound) >>> Integer.SIZE);
+ }
+
+ @Override
+ public double nextGaussian() {
+ return this.gaussianSource.nextGaussian();
+ }
+
+ @Override
+ public RandomSource fork() {
+ return new SimpleThreadUnsafeRandom(this.nextLong());
+ }
+
+ @Override
+ public PositionalRandomFactory forkPositional() {
+ return new SimpleRandomPositionalFactory(this.nextLong());
+ }
+
+ public static final class SimpleRandomPositionalFactory implements PositionalRandomFactory {
+
+ private final long seed;
+
+ public SimpleRandomPositionalFactory(final long seed) {
+ this.seed = seed;
+ }
+
+ public long getSeed() {
+ return this.seed;
+ }
+
+ @Override
+ public RandomSource fromHashOf(final String string) {
+ return new SimpleThreadUnsafeRandom((long)string.hashCode() ^ this.seed);
+ }
+
+ @Override
+ public RandomSource fromSeed(final long seed) {
+ return new SimpleThreadUnsafeRandom(seed);
+ }
+
+ @Override
+ public RandomSource at(final int x, final int y, final int z) {
+ return new SimpleThreadUnsafeRandom(Mth.getSeed(x, y, z) ^ this.seed);
+ }
+
+ @Override
+ public void parityConfigString(final StringBuilder stringBuilder) {
+ stringBuilder.append("SimpleRandomPositionalFactory{").append(this.seed).append('}');
+ }
+ }
+}
diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/ThreadUnsafeRandom.java b/src/main/java/ca/spottedleaf/moonrise/common/util/ThreadUnsafeRandom.java
new file mode 100644
index 0000000000000000000000000000000000000000..12eb3add0931a4d77acdf6e875c42dda9c313dc3
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/moonrise/common/util/ThreadUnsafeRandom.java
@@ -0,0 +1,94 @@
+package ca.spottedleaf.moonrise.common.util;
+
+import net.minecraft.util.Mth;
+import net.minecraft.util.RandomSource;
+import net.minecraft.world.level.levelgen.BitRandomSource;
+import net.minecraft.world.level.levelgen.MarsagliaPolarGaussian;
+import net.minecraft.world.level.levelgen.PositionalRandomFactory;
+
+/**
+ * Avoid costly CAS of superclass
+ */
+public final class ThreadUnsafeRandom implements BitRandomSource {
+
+ private static final long MULTIPLIER = 25214903917L;
+ private static final long ADDEND = 11L;
+ private static final int BITS = 48;
+ private static final long MASK = (1L << BITS) - 1L;
+
+ private long value;
+ private final MarsagliaPolarGaussian gaussianSource = new MarsagliaPolarGaussian(this);
+
+ public ThreadUnsafeRandom(final long seed) {
+ this.setSeed(seed);
+ }
+
+ @Override
+ public void setSeed(final long seed) {
+ this.value = (seed ^ MULTIPLIER) & MASK;
+ this.gaussianSource.reset();
+ }
+
+ private long advanceSeed() {
+ return this.value = ((this.value * MULTIPLIER) + ADDEND) & MASK;
+ }
+
+ @Override
+ public int next(final int bits) {
+ return (int)(this.advanceSeed() >>> (BITS - bits));
+ }
+
+ @Override
+ public int nextInt() {
+ final long seed = this.advanceSeed();
+ return (int)(seed >>> (BITS - Integer.SIZE));
+ }
+
+ @Override
+ public double nextGaussian() {
+ return this.gaussianSource.nextGaussian();
+ }
+
+ @Override
+ public RandomSource fork() {
+ return new ThreadUnsafeRandom(this.nextLong());
+ }
+
+ @Override
+ public PositionalRandomFactory forkPositional() {
+ return new ThreadUnsafeRandomPositionalFactory(this.nextLong());
+ }
+
+ public static final class ThreadUnsafeRandomPositionalFactory implements PositionalRandomFactory {
+
+ private final long seed;
+
+ public ThreadUnsafeRandomPositionalFactory(final long seed) {
+ this.seed = seed;
+ }
+
+ public long getSeed() {
+ return this.seed;
+ }
+
+ @Override
+ public RandomSource fromHashOf(final String string) {
+ return new ThreadUnsafeRandom((long)string.hashCode() ^ this.seed);
+ }
+
+ @Override
+ public RandomSource fromSeed(final long seed) {
+ return new ThreadUnsafeRandom(seed);
+ }
+
+ @Override
+ public RandomSource at(final int x, final int y, final int z) {
+ return new ThreadUnsafeRandom(Mth.getSeed(x, y, z) ^ this.seed);
+ }
+
+ @Override
+ public void parityConfigString(final StringBuilder stringBuilder) {
+ stringBuilder.append("ThreadUnsafeRandomPositionalFactory{").append(this.seed).append('}');
+ }
+ }
+}
diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
new file mode 100644
@ -4542,10 +4695,10 @@ index 46cab7a8c7b87ab01b26074b04f5a02b3907cfc4..49019b4a9bc4e634d54a9b0acaf9229a
+ // Paper end
}
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index f0d470d7770e119f734b9e72021c806d0ea8ecbd..c3fe4481dd35f80815716e48beeeb07b1f51e30b 100644
index 0ea9eba1367858dfa5284524a8dd2f79daf6fc69..18b64c00fa73e233bf41f519db54a1d43c2a8b1f 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -217,7 +217,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -215,7 +215,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@PostProcess
private void postProcess() {
@ -5553,7 +5706,7 @@ index f6a3606b972064c4ec78487374e6197c0c447e27..8978fa74ceae06bef6aad3b74d654498
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess(), iworlddataserver.getGameRules()))); // Paper - create paper world configs
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index fd97a0e54ad8487b0c6f242fcb626f0b76f88274..785c7e11f92610be58b624d252d1858658496af7 100644
index 2819ee5726c759e524ba558155bcc516f1b70606..c60e7f27ea4060e455a18feb6f6a7919e80a8fc8 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -309,6 +309,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {

Datei anzeigen

@ -5,6 +5,7 @@ Subject: [PATCH] Implement Player Client Options API
== AT ==
public net.minecraft.world.entity.player.Player DATA_PLAYER_MODE_CUSTOMISATION
public net.minecraft.server.level.ServerPlayer particleStatus
diff --git a/src/main/java/com/destroystokyo/paper/PaperSkinParts.java b/src/main/java/com/destroystokyo/paper/PaperSkinParts.java
new file mode 100644
@ -87,7 +88,7 @@ index 0000000000000000000000000000000000000000..b6f4400df3d8ec7e06a996de54f8cabb
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 363175d3325c012f31ba84060bb0bfac694f6ab8..9911e231ad021286f2da90057b06874f7b4e3b4d 100644
index 0c68c0a9ec9b353b353eff0c36af2993df5f59b3..eebf44c7124c4f48b6d48562a00633b1e8ff9b00 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -420,7 +420,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@ -99,31 +100,27 @@ index 363175d3325c012f31ba84060bb0bfac694f6ab8..9911e231ad021286f2da90057b06874f
this.object = null;
// CraftBukkit start
@@ -2404,7 +2404,23 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
}
@@ -2405,6 +2405,19 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
}
+ // Paper start - Client option API
+ private java.util.Map<com.destroystokyo.paper.ClientOption<?>, ?> getClientOptionMap(String locale, int viewDistance, com.destroystokyo.paper.ClientOption.ChatVisibility chatVisibility, boolean chatColors, com.destroystokyo.paper.PaperSkinParts skinParts, org.bukkit.inventory.MainHand mainHand, boolean allowsServerListing, boolean textFilteringEnabled) {
+ java.util.Map<com.destroystokyo.paper.ClientOption<?>, Object> map = new java.util.HashMap<>();
+ map.put(com.destroystokyo.paper.ClientOption.LOCALE, locale);
+ map.put(com.destroystokyo.paper.ClientOption.VIEW_DISTANCE, viewDistance);
+ map.put(com.destroystokyo.paper.ClientOption.CHAT_VISIBILITY, chatVisibility);
+ map.put(com.destroystokyo.paper.ClientOption.CHAT_COLORS_ENABLED, chatColors);
+ map.put(com.destroystokyo.paper.ClientOption.SKIN_PARTS, skinParts);
+ map.put(com.destroystokyo.paper.ClientOption.MAIN_HAND, mainHand);
+ map.put(com.destroystokyo.paper.ClientOption.ALLOW_SERVER_LISTINGS, allowsServerListing);
+ map.put(com.destroystokyo.paper.ClientOption.TEXT_FILTERING_ENABLED, textFilteringEnabled);
+ return map;
+ }
+ // Paper end
+
public void updateOptions(ClientInformation clientOptions) {
+ new com.destroystokyo.paper.event.player.PlayerClientOptionsChangeEvent(getBukkitEntity(), getClientOptionMap(clientOptions.language(), clientOptions.viewDistance(), com.destroystokyo.paper.ClientOption.ChatVisibility.valueOf(clientOptions.chatVisibility().name()), clientOptions.chatColors(), new com.destroystokyo.paper.PaperSkinParts(clientOptions.modelCustomisation()), clientOptions.mainHand() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT, clientOptions.allowsListing(), clientOptions.textFilteringEnabled())).callEvent(); // Paper - settings event
+ // Paper start - settings event
+ new com.destroystokyo.paper.event.player.PlayerClientOptionsChangeEvent(this.getBukkitEntity(), Util.make(new java.util.IdentityHashMap<>(), map -> {
+ map.put(com.destroystokyo.paper.ClientOption.LOCALE, clientOptions.language());
+ map.put(com.destroystokyo.paper.ClientOption.VIEW_DISTANCE, clientOptions.viewDistance());
+ map.put(com.destroystokyo.paper.ClientOption.CHAT_VISIBILITY, com.destroystokyo.paper.ClientOption.ChatVisibility.valueOf(clientOptions.chatVisibility().name()));
+ map.put(com.destroystokyo.paper.ClientOption.CHAT_COLORS_ENABLED, clientOptions.chatColors());
+ map.put(com.destroystokyo.paper.ClientOption.SKIN_PARTS, new com.destroystokyo.paper.PaperSkinParts(clientOptions.modelCustomisation()));
+ map.put(com.destroystokyo.paper.ClientOption.MAIN_HAND, clientOptions.mainHand() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT);
+ map.put(com.destroystokyo.paper.ClientOption.TEXT_FILTERING_ENABLED, clientOptions.textFilteringEnabled());
+ map.put(com.destroystokyo.paper.ClientOption.ALLOW_SERVER_LISTINGS, clientOptions.allowsListing());
+ map.put(com.destroystokyo.paper.ClientOption.PARTICLE_VISIBILITY, com.destroystokyo.paper.ClientOption.ParticleVisibility.valueOf(clientOptions.particleStatus().name()));
+ })).callEvent();
+ // Paper end - settings event
// CraftBukkit start
if (this.getMainArm() != clientOptions.mainHand()) {
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), this.getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT);
@@ -2415,6 +2431,11 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@@ -2415,6 +2428,11 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
this.server.server.getPluginManager().callEvent(event);
}
// CraftBukkit end
@ -136,10 +133,10 @@ index 363175d3325c012f31ba84060bb0bfac694f6ab8..9911e231ad021286f2da90057b06874f
this.adventure$locale = java.util.Objects.requireNonNullElse(net.kyori.adventure.translation.Translator.parseLocale(this.language), java.util.Locale.US); // Paper
this.requestedViewDistance = clientOptions.viewDistance();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 341dbff92d15886afe8fe628e06d1c07817241ed..66e5e949c8711103ae9bf73161422f350c217874 100644
index b3b13f1baea0b170fd4f1546689aad40f53d3c27..8cfcd8797d056be07b09ec9627bc35bf75eb0d2d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -658,6 +658,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -658,6 +658,30 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message);
}
}
@ -147,21 +144,23 @@ index 341dbff92d15886afe8fe628e06d1c07817241ed..66e5e949c8711103ae9bf73161422f35
+ @Override
+ public <T> T getClientOption(com.destroystokyo.paper.ClientOption<T> type) {
+ if (com.destroystokyo.paper.ClientOption.SKIN_PARTS == type) {
+ return type.getType().cast(new com.destroystokyo.paper.PaperSkinParts(getHandle().getEntityData().get(net.minecraft.world.entity.player.Player.DATA_PLAYER_MODE_CUSTOMISATION)));
+ return type.getType().cast(new com.destroystokyo.paper.PaperSkinParts(this.getHandle().getEntityData().get(net.minecraft.world.entity.player.Player.DATA_PLAYER_MODE_CUSTOMISATION)));
+ } else if (com.destroystokyo.paper.ClientOption.CHAT_COLORS_ENABLED == type) {
+ return type.getType().cast(getHandle().canChatInColor());
+ return type.getType().cast(this.getHandle().canChatInColor());
+ } else if (com.destroystokyo.paper.ClientOption.CHAT_VISIBILITY == type) {
+ return type.getType().cast(getHandle().getChatVisibility() == null ? com.destroystokyo.paper.ClientOption.ChatVisibility.UNKNOWN : com.destroystokyo.paper.ClientOption.ChatVisibility.valueOf(getHandle().getChatVisibility().name()));
+ return type.getType().cast(this.getHandle().getChatVisibility() == null ? com.destroystokyo.paper.ClientOption.ChatVisibility.UNKNOWN : com.destroystokyo.paper.ClientOption.ChatVisibility.valueOf(this.getHandle().getChatVisibility().name()));
+ } else if (com.destroystokyo.paper.ClientOption.LOCALE == type) {
+ return type.getType().cast(getLocale());
+ return type.getType().cast(this.getLocale());
+ } else if (com.destroystokyo.paper.ClientOption.MAIN_HAND == type) {
+ return type.getType().cast(getMainHand());
+ return type.getType().cast(this.getMainHand());
+ } else if (com.destroystokyo.paper.ClientOption.VIEW_DISTANCE == type) {
+ return type.getType().cast(getClientViewDistance());
+ } else if (com.destroystokyo.paper.ClientOption.ALLOW_SERVER_LISTINGS == type) {
+ return type.getType().cast(getHandle().allowsListing());
+ return type.getType().cast(this.getClientViewDistance());
+ } else if (com.destroystokyo.paper.ClientOption.TEXT_FILTERING_ENABLED == type) {
+ return type.getType().cast(getHandle().isTextFilteringEnabled());
+ return type.getType().cast(this.getHandle().isTextFilteringEnabled());
+ } else if (com.destroystokyo.paper.ClientOption.ALLOW_SERVER_LISTINGS == type) {
+ return type.getType().cast(this.getHandle().allowsListing());
+ } else if (com.destroystokyo.paper.ClientOption.PARTICLE_VISIBILITY == type) {
+ return type.getType().cast(com.destroystokyo.paper.ClientOption.ParticleVisibility.valueOf(this.getHandle().particleStatus.name()));
+ }
+ throw new RuntimeException("Unknown settings type");
+ }
@ -170,15 +169,15 @@ index 341dbff92d15886afe8fe628e06d1c07817241ed..66e5e949c8711103ae9bf73161422f35
@Override
diff --git a/src/test/java/io/papermc/paper/world/TranslationKeyTest.java b/src/test/java/io/papermc/paper/world/TranslationKeyTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..7f8b6462d2a1bbd39a870d2543bebc135f7eb45b
index 0000000000000000000000000000000000000000..01e0936ea8ce5bcacafd9e89a1c0dfd2c172024d
--- /dev/null
+++ b/src/test/java/io/papermc/paper/world/TranslationKeyTest.java
@@ -0,0 +1,18 @@
@@ -0,0 +1,25 @@
+package io.papermc.paper.world;
+
+import com.destroystokyo.paper.ClientOption;
+import net.minecraft.server.level.ParticleStatus;
+import net.minecraft.world.entity.player.ChatVisiblity;
+import org.bukkit.Difficulty;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
@ -191,4 +190,11 @@ index 0000000000000000000000000000000000000000..7f8b6462d2a1bbd39a870d2543bebc13
+ Assertions.assertEquals(ChatVisiblity.valueOf(chatVisibility.name()).getKey(), chatVisibility.translationKey(), chatVisibility + "'s translation key doesn't match");
+ }
+ }
+
+ @Test
+ public void testParticleVisibilityKeys() {
+ for (ClientOption.ParticleVisibility particleVisibility : ClientOption.ParticleVisibility.values()) {
+ Assertions.assertEquals(ParticleStatus.valueOf(particleVisibility.name()).getKey(), particleVisibility.translationKey(), particleVisibility + "'s translation key doesn't match");
+ }
+ }
+}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Brand support
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index eacc0675d751caf996c9741a5ef5df28d1b9999b..80198c2f6419a3358f41df15dd7bbeb642d37585 100644
index fd0fd75ed3e75cbdcc1abd56905ace176b871c25..b614be746f1b3c6470eddeb86bb1d4a976b84fcc 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -322,6 +322,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@ -57,10 +57,10 @@ index b9fbaddcc8239bf737fdea51790f678306e511eb..9a8b08d4b70b8890961e4af7ce6e870a
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index e4c39eba10124ebf675ac721866e0c73bf15e533..ad109929cb8d9be8e147adaf744f6fa588414404 100644
index 5ca3025700b3e8995ae003b73dd53e580c95b889..93caaea4832f2cf7102b43c24afaea55e11ae4c1 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -3154,6 +3154,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3156,6 +3156,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Paper end
};

Datei anzeigen

@ -130,32 +130,29 @@ index 4921fc085c9d60c74028ef390325e26c598e8df1..4941e0afff8df5f10f06c715b54bf58e
case BALL:
return FireworkExplosion.Shape.SMALL_BALL;
diff --git a/src/test/java/io/papermc/paper/world/TranslationKeyTest.java b/src/test/java/io/papermc/paper/world/TranslationKeyTest.java
index 7f8b6462d2a1bbd39a870d2543bebc135f7eb45b..c843de24f06dcdee474e9a21d0a3dc54b7b3557a 100644
index 01e0936ea8ce5bcacafd9e89a1c0dfd2c172024d..95b7506c1317f2664f52c88295aee1006db4da63 100644
--- a/src/test/java/io/papermc/paper/world/TranslationKeyTest.java
+++ b/src/test/java/io/papermc/paper/world/TranslationKeyTest.java
@@ -1,11 +1,32 @@
@@ -1,11 +1,29 @@
package io.papermc.paper.world;
import com.destroystokyo.paper.ClientOption;
+import java.util.Locale;
+import java.util.Map;
+import net.minecraft.core.registries.Registries;
+import net.minecraft.network.chat.contents.TranslatableContents;
+import net.minecraft.resources.ResourceKey;
+import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ParticleStatus;
import net.minecraft.world.entity.player.ChatVisiblity;
+import net.minecraft.world.flag.FeatureFlags;
+import net.minecraft.world.level.GameRules;
+import net.minecraft.world.level.GameType;
+import net.minecraft.world.level.biome.Biome;
import org.bukkit.Difficulty;
+import org.bukkit.Difficulty;
+import org.bukkit.FireworkEffect;
+import org.bukkit.GameMode;
+import org.bukkit.GameRule;
+import org.bukkit.MusicInstrument;
+import org.bukkit.attribute.Attribute;
+import org.bukkit.craftbukkit.CraftWorld;
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
+import org.bukkit.support.RegistryHelper;
+import org.bukkit.support.environment.AllFeatures;
import org.junit.jupiter.api.Assertions;
@ -166,8 +163,8 @@ index 7f8b6462d2a1bbd39a870d2543bebc135f7eb45b..c843de24f06dcdee474e9a21d0a3dc54
public class TranslationKeyTest {
@Test
@@ -15,4 +36,61 @@ public class TranslationKeyTest {
Assertions.assertEquals(ChatVisiblity.valueOf(chatVisibility.name()).getKey(), chatVisibility.translationKey(), chatVisibility + "'s translation key doesn't match");
@@ -22,4 +40,61 @@ public class TranslationKeyTest {
Assertions.assertEquals(ParticleStatus.valueOf(particleVisibility.name()).getKey(), particleVisibility.translationKey(), particleVisibility + "'s translation key doesn't match");
}
}
+

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Fix Player spawnParticle x/y/z precision loss
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index ad109929cb8d9be8e147adaf744f6fa588414404..c11c83376bd5e006bab86db6d8aa99b7ec371636 100644
index 93caaea4832f2cf7102b43c24afaea55e11ae4c1..a88d94d51520521144799b9abc4bbde0596082e0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2722,7 +2722,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2724,7 +2724,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) {

Datei anzeigen

@ -32,10 +32,10 @@ index fbe10666c4ec6caa95aa38a6f99ccca700e9a4d2..061bba184c8bc2569ce1d413435ec136
public boolean isWhiteListed(GameProfile profile) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index c11c83376bd5e006bab86db6d8aa99b7ec371636..1cc89895a1e03d4b1734a81d89c8bc396bf2b343 100644
index a88d94d51520521144799b9abc4bbde0596082e0..dbb25f5cc8cf03654faf2386826965f049737897 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -682,6 +682,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -684,6 +684,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
// Paper end

Datei anzeigen

@ -12,10 +12,10 @@ public net.minecraft.server.RegistryLayer STATIC_ACCESS
diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
new file mode 100644
index 0000000000000000000000000000000000000000..2f22f46f80b80be43a2cc1cd8afb51f4d1fd0e91
index 0000000000000000000000000000000000000000..cd8a6a4c2a63029f8f859765088c227bbd456813
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
@@ -0,0 +1,157 @@
@@ -0,0 +1,154 @@
+package io.papermc.paper.registry;
+
+import com.google.common.base.Preconditions;
@ -81,14 +81,11 @@ index 0000000000000000000000000000000000000000..2f22f46f80b80be43a2cc1cd8afb51f4
+import org.bukkit.inventory.meta.trim.TrimPattern;
+import org.bukkit.map.MapCursor;
+import org.bukkit.potion.PotionEffectType;
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.checker.nullness.qual.Nullable;
+import org.checkerframework.framework.qual.DefaultQualifier;
+import org.jspecify.annotations.Nullable;
+
+import static io.papermc.paper.registry.entry.RegistryEntry.apiOnly;
+import static io.papermc.paper.registry.entry.RegistryEntry.entry;
+
+@DefaultQualifier(NonNull.class)
+public final class PaperRegistries {
+
+ static final List<RegistryEntry<?, ?>> REGISTRY_ENTRIES;
@ -175,10 +172,10 @@ index 0000000000000000000000000000000000000000..2f22f46f80b80be43a2cc1cd8afb51f4
+}
diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistryAccess.java b/src/main/java/io/papermc/paper/registry/PaperRegistryAccess.java
new file mode 100644
index 0000000000000000000000000000000000000000..35b6a7c5bac9640332a833bd3627f2bcb1bbf2f3
index 0000000000000000000000000000000000000000..4bf7915867dbe762ef0b070d67d5f7b7d1ee4f03
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/PaperRegistryAccess.java
@@ -0,0 +1,127 @@
@@ -0,0 +1,122 @@
+package io.papermc.paper.registry;
+
+import io.papermc.paper.registry.entry.ApiRegistryEntry;
@ -194,14 +191,9 @@ index 0000000000000000000000000000000000000000..35b6a7c5bac9640332a833bd3627f2bc
+import net.minecraft.resources.ResourceKey;
+import org.bukkit.Keyed;
+import org.bukkit.Registry;
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.checker.nullness.qual.Nullable;
+import org.checkerframework.framework.qual.DefaultQualifier;
+import org.jetbrains.annotations.VisibleForTesting;
+import org.jspecify.annotations.Nullable;
+
+import static java.util.Objects.requireNonNull;
+
+@DefaultQualifier(NonNull.class)
+public class PaperRegistryAccess implements RegistryAccess {
+
+ // We store the API registries in a memoized supplier, so they can be created on-demand.
@ -224,14 +216,14 @@ index 0000000000000000000000000000000000000000..35b6a7c5bac9640332a833bd3627f2bc
+ @Deprecated(forRemoval = true)
+ @Override
+ public <T extends Keyed> @Nullable Registry<T> getRegistry(final Class<T> type) {
+ final @Nullable RegistryKey<T> registryKey = byType(type);
+ final RegistryKey<T> registryKey = byType(type);
+ // If our mapping from Class -> RegistryKey did not contain the passed type it was either a completely invalid type or a registry
+ // that merely exists as a SimpleRegistry in the org.bukkit.Registry type. We cannot return a registry for these, return null
+ // as per method contract in Bukkit#getRegistry.
+ if (registryKey == null) return null;
+
+ final @Nullable RegistryEntry<?, T> entry = PaperRegistries.getEntry(registryKey);
+ final @Nullable RegistryHolder<T> registry = (RegistryHolder<T>) this.registries.get(registryKey);
+ final RegistryEntry<?, T> entry = PaperRegistries.getEntry(registryKey);
+ final RegistryHolder<T> registry = (RegistryHolder<T>) this.registries.get(registryKey);
+ if (registry != null) {
+ // if the registry exists, return right away. Since this is the "legacy" method, we return DelayedRegistry
+ // for the non-builtin Registry instances stored as fields in Registry.
@ -352,10 +344,10 @@ index 0000000000000000000000000000000000000000..6d134ace042758da722960cbcb48e525
+}
diff --git a/src/main/java/io/papermc/paper/registry/RegistryHolder.java b/src/main/java/io/papermc/paper/registry/RegistryHolder.java
new file mode 100644
index 0000000000000000000000000000000000000000..a31bdd9f02fe75a87fceb2ebe8c36b3232a561cc
index 0000000000000000000000000000000000000000..1b52d4bc868e1e5f84c8416301e193bb9cd315b2
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/RegistryHolder.java
@@ -0,0 +1,47 @@
@@ -0,0 +1,44 @@
+package io.papermc.paper.registry;
+
+import com.google.common.base.Suppliers;
@ -364,10 +356,7 @@ index 0000000000000000000000000000000000000000..a31bdd9f02fe75a87fceb2ebe8c36b32
+import java.util.function.Supplier;
+import org.bukkit.Keyed;
+import org.bukkit.Registry;
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.framework.qual.DefaultQualifier;
+
+@DefaultQualifier(NonNull.class)
+public interface RegistryHolder<B extends Keyed> {
+
+ Registry<B> get();
@ -471,10 +460,10 @@ index 0000000000000000000000000000000000000000..ceb217dbbb84e8bd51365dd47bf91971
+}
diff --git a/src/main/java/io/papermc/paper/registry/entry/CraftRegistryEntry.java b/src/main/java/io/papermc/paper/registry/entry/CraftRegistryEntry.java
new file mode 100644
index 0000000000000000000000000000000000000000..9bb4aa926978f117901c9f99c45a6862a1d5ce30
index 0000000000000000000000000000000000000000..45cbc425da64f0bd3290600869ad425d9e6e912b
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/entry/CraftRegistryEntry.java
@@ -0,0 +1,51 @@
@@ -0,0 +1,48 @@
+package io.papermc.paper.registry.entry;
+
+import com.google.common.base.Preconditions;
@ -487,10 +476,7 @@ index 0000000000000000000000000000000000000000..9bb4aa926978f117901c9f99c45a6862
+import org.bukkit.NamespacedKey;
+import org.bukkit.craftbukkit.CraftRegistry;
+import org.bukkit.craftbukkit.util.ApiVersion;
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.framework.qual.DefaultQualifier;
+
+@DefaultQualifier(NonNull.class)
+public class CraftRegistryEntry<M, B extends Keyed> extends BaseRegistryEntry<M, B> { // TODO remove Keyed
+
+ private static final BiFunction<NamespacedKey, ApiVersion, NamespacedKey> EMPTY = (namespacedKey, apiVersion) -> namespacedKey;
@ -528,10 +514,10 @@ index 0000000000000000000000000000000000000000..9bb4aa926978f117901c9f99c45a6862
+}
diff --git a/src/main/java/io/papermc/paper/registry/entry/RegistryEntry.java b/src/main/java/io/papermc/paper/registry/entry/RegistryEntry.java
new file mode 100644
index 0000000000000000000000000000000000000000..15991bf13894d850f360a520d1815711d25973ec
index 0000000000000000000000000000000000000000..2889d87f0989ae5744cd4c1e57240830aa574155
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/entry/RegistryEntry.java
@@ -0,0 +1,51 @@
@@ -0,0 +1,48 @@
+package io.papermc.paper.registry.entry;
+
+import io.papermc.paper.registry.RegistryHolder;
@ -544,10 +530,7 @@ index 0000000000000000000000000000000000000000..15991bf13894d850f360a520d1815711
+import org.bukkit.Keyed;
+import org.bukkit.NamespacedKey;
+import org.bukkit.craftbukkit.util.ApiVersion;
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.framework.qual.DefaultQualifier;
+
+@DefaultQualifier(NonNull.class)
+public interface RegistryEntry<M, B extends Keyed> extends RegistryEntryInfo<M, B> { // TODO remove Keyed
+
+ RegistryHolder<B> createRegistryHolder(Registry<M> nmsRegistry);
@ -603,34 +586,29 @@ index 0000000000000000000000000000000000000000..0ae855e80fc9fddfc1feb33c7a974820
+}
diff --git a/src/main/java/io/papermc/paper/registry/entry/package-info.java b/src/main/java/io/papermc/paper/registry/entry/package-info.java
new file mode 100644
index 0000000000000000000000000000000000000000..e4c94d6860e0f5b643cde1ded20b5503c02a4866
index 0000000000000000000000000000000000000000..f04e93aa5ca41ce1cf3b152f827911fdf0dd10cb
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/entry/package-info.java
@@ -0,0 +1,5 @@
+@DefaultQualifier(NonNull.class)
@@ -0,0 +1,4 @@
+@NullMarked
+package io.papermc.paper.registry.entry;
+
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.framework.qual.DefaultQualifier;
+import org.jspecify.annotations.NullMarked;
diff --git a/src/main/java/io/papermc/paper/registry/legacy/DelayedRegistry.java b/src/main/java/io/papermc/paper/registry/legacy/DelayedRegistry.java
new file mode 100644
index 0000000000000000000000000000000000000000..9400fed345344a0a8e4fb301cca6a1867adf625b
index 0000000000000000000000000000000000000000..ca829b162d4369f845e59b62bb8779fd83fe2ef3
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/legacy/DelayedRegistry.java
@@ -0,0 +1,61 @@
@@ -0,0 +1,57 @@
+package io.papermc.paper.registry.legacy;
+
+import java.util.Iterator;
+import java.util.function.Supplier;
+import java.util.stream.Stream;
+import net.kyori.adventure.key.Key;
+import org.bukkit.Keyed;
+import org.bukkit.NamespacedKey;
+import org.bukkit.Registry;
+import org.bukkit.craftbukkit.CraftRegistry;
+import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
+import org.checkerframework.checker.nullness.qual.Nullable;
+import org.jetbrains.annotations.NotNull;
+import org.jspecify.annotations.Nullable;
+
+/**
+ * This is to support the now-deprecated fields in {@link Registry} for
@ -638,7 +616,7 @@ index 0000000000000000000000000000000000000000..9400fed345344a0a8e4fb301cca6a186
+ */
+public final class DelayedRegistry<T extends Keyed, R extends Registry<T>> implements Registry<T> {
+
+ private @MonotonicNonNull Supplier<? extends R> delegate;
+ private @Nullable Supplier<? extends R> delegate;
+
+ public void load(final Supplier<? extends R> registry) {
+ if (this.delegate != null) {
@ -660,7 +638,7 @@ index 0000000000000000000000000000000000000000..9400fed345344a0a8e4fb301cca6a186
+ }
+
+ @Override
+ public @NotNull T getOrThrow(@NotNull final NamespacedKey key) {
+ public T getOrThrow(final NamespacedKey key) {
+ return this.delegate().getOrThrow(key);
+ }
+
@ -675,7 +653,7 @@ index 0000000000000000000000000000000000000000..9400fed345344a0a8e4fb301cca6a186
+ }
+
+ @Override
+ public NamespacedKey getKey(final T value) {
+ public @Nullable NamespacedKey getKey(final T value) {
+ return this.delegate().getKey(value);
+ }
+}
@ -752,15 +730,24 @@ index 0000000000000000000000000000000000000000..83870816cd4c54f94a3c603ffe41c11e
+}
diff --git a/src/main/java/io/papermc/paper/registry/legacy/package-info.java b/src/main/java/io/papermc/paper/registry/legacy/package-info.java
new file mode 100644
index 0000000000000000000000000000000000000000..4396982af55872fafbfeaf8161ad6f392726c773
index 0000000000000000000000000000000000000000..063a8d7a7313d5d685d51df54d9502d72266da49
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/legacy/package-info.java
@@ -0,0 +1,5 @@
+@DefaultQualifier(NonNull.class)
@@ -0,0 +1,4 @@
+@NullMarked
+package io.papermc.paper.registry.legacy;
+
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.framework.qual.DefaultQualifier;
+import org.jspecify.annotations.NullMarked;
diff --git a/src/main/java/io/papermc/paper/registry/package-info.java b/src/main/java/io/papermc/paper/registry/package-info.java
new file mode 100644
index 0000000000000000000000000000000000000000..ca07ef31161e938d48214992b34cafb712a51513
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/package-info.java
@@ -0,0 +1,4 @@
+@NullMarked
+package io.papermc.paper.registry;
+
+import org.jspecify.annotations.NullMarked;
diff --git a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
index 3f72e30b57fb2a4231e22a2234729408c1240af4..4638ba98dbbdb0f880337347be85a6e0fbed2191 100644
--- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java

Datei anzeigen

@ -45,7 +45,7 @@ index 7f09119bc7d661e08a960dd2bd46006efe752d3e..d1da3600dc07107309b20ebe6e7c0c4d
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 57253e59b6330be6176d3aa42f8f575ad1995bca..254d9eede5a9a57280643284175df2e061aa78ea 100644
index 7c4f7a17f34802962c74bb8c5a732861d1a759c6..d26c2b8fd241216d4411254c16012f8141f2856c 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2335,10 +2335,18 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@ -78,7 +78,7 @@ index 57253e59b6330be6176d3aa42f8f575ad1995bca..254d9eede5a9a57280643284175df2e0
}
}
@@ -2806,6 +2814,16 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@@ -2803,6 +2811,16 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
}
public void loadGameTypes(@Nullable CompoundTag nbt) {
@ -147,10 +147,10 @@ index 2bd2f1cdf3467cacee55094d43bd3eccf61b9aa7..c3b4b800c5a34afa03ed7c31e14f26ca
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 1cc89895a1e03d4b1734a81d89c8bc396bf2b343..2ebfc8744434dd4819f52201ae621268b0e04998 100644
index dbb25f5cc8cf03654faf2386826965f049737897..a6a2ed03ae781809b50fd793265977db0918a259 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1669,7 +1669,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1671,7 +1671,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
Preconditions.checkArgument(mode != null, "GameMode cannot be null");
if (this.getHandle().connection == null) return;

Datei anzeigen

@ -495,7 +495,7 @@ index 9e2ad78b12cadbf0e2bda1e12fe844120529c347..6a7d7fad990fc44fdda6849d43dad141
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 2ebfc8744434dd4819f52201ae621268b0e04998..97046a2ae1ab30f4eefb64558afe312d2b9f55f8 100644
index a6a2ed03ae781809b50fd793265977db0918a259..43d46239295ea16808383fbdb4d94da0b85e4fad 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -280,7 +280,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -533,7 +533,7 @@ index 2ebfc8744434dd4819f52201ae621268b0e04998..97046a2ae1ab30f4eefb64558afe312d
}
}
@@ -714,7 +719,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -716,7 +721,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Paper start - Improve chat handling
if (ServerGamePacketListenerImpl.isChatMessageIllegal(msg)) {

Datei anzeigen

@ -34,7 +34,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma
index 254d9eede5a9a57280643284175df2e061aa78ea..09798fc2d2d847f3ec705a2640f25ac08ca69f92 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2747,7 +2747,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@@ -2744,7 +2744,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
if (flag1) {
if (!itemstack1.isEmpty()) {
@ -43,7 +43,7 @@ index 254d9eede5a9a57280643284175df2e061aa78ea..09798fc2d2d847f3ec705a2640f25ac0
}
this.awardStat(Stats.DROP);
@@ -2763,6 +2763,11 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@@ -2760,6 +2760,11 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
return null;
} else {
double d0 = this.getEyeY() - 0.30000001192092896D;

Datei anzeigen

@ -49,7 +49,7 @@ index a2d0699e8427b2262a2396495111125eccafbb66..15db9368227dbc29d07d74e85bd126b3
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index f0655e6c9c0f60b57912a76448706d49ce774dce..fe39d0ab5e99818356d4e1a600af4bdd3eb03b70 100644
index b8804881f983cc91ab8e92ba2447151f1e5af9fc..b0391056c5308292131de1d8d2a86a552a9d94e2 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1690,7 +1690,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@ -61,7 +61,7 @@ index f0655e6c9c0f60b57912a76448706d49ce774dce..fe39d0ab5e99818356d4e1a600af4bdd
if (this.level().isDay()) {
return Either.left(net.minecraft.world.entity.player.Player.BedSleepingProblem.NOT_POSSIBLE_NOW);
} else {
@@ -2640,44 +2640,50 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@@ -2637,44 +2637,50 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
this.setRespawnPosition(player.getRespawnDimension(), player.getRespawnPosition(), player.getRespawnAngle(), player.isRespawnForced(), false);
}
@ -145,7 +145,7 @@ index f0655e6c9c0f60b57912a76448706d49ce774dce..fe39d0ab5e99818356d4e1a600af4bdd
} else {
this.respawnPosition = null;
this.respawnDimension = Level.OVERWORLD;
@@ -2685,6 +2691,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@@ -2682,6 +2688,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
this.respawnForced = false;
}
@ -187,10 +187,10 @@ index db26b5a0464bd6087eeacaf6dd61eba37365df92..9117c035d5a6ff114b028fad3380ceb1
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 97046a2ae1ab30f4eefb64558afe312d2b9f55f8..fe05fe8f9c24ad15c083cb63bc6b7e004a974832 100644
index 43d46239295ea16808383fbdb4d94da0b85e4fad..3f89cbc48828f36cf6ff02b9de6cd378b2fde4f2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1418,9 +1418,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1420,9 +1420,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void setRespawnLocation(Location location, boolean override) {
if (location == null) {

Datei anzeigen

@ -24,10 +24,10 @@ index 926ff9be3d9e3f5d620e4c7ccb22b9f64865ff8c..1a37654aff9a9c86c9f7af10a1cf7213
buf.writeLong(this.sectionPos.asLong());
buf.writeVarInt(this.positions.length);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index fe05fe8f9c24ad15c083cb63bc6b7e004a974832..728a65ad7a826596530b12594db15c93f1af68fb 100644
index 3f89cbc48828f36cf6ff02b9de6cd378b2fde4f2..e9e895b885e6e45df45246f3988d6e62a1b3d960 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -935,6 +935,32 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -937,6 +937,32 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.getHandle().connection.send(packet);
}

Datei anzeigen

@ -113,10 +113,10 @@ index 10fb64df10820974d11f142c102a11a5bd0f317c..8d2f6bb43fb69a4a1e2085960eb24f43
private final org.bukkit.entity.Entity.Spigot spigot = new org.bukkit.entity.Entity.Spigot()
{
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 728a65ad7a826596530b12594db15c93f1af68fb..87aa5f0d594ff697b87bc06019351d22b6c8c8e5 100644
index e9e895b885e6e45df45246f3988d6e62a1b3d960..6c6128922491efe4f47eb27039eb078f2f411315 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1291,13 +1291,94 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1293,13 +1293,94 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void setRotation(float yaw, float pitch) {
@ -212,7 +212,7 @@ index 728a65ad7a826596530b12594db15c93f1af68fb..87aa5f0d594ff697b87bc06019351d22
location.checkFinite();
ServerPlayer entity = this.getHandle();
@@ -1310,7 +1391,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1312,7 +1393,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return false;
}
@ -221,7 +221,7 @@ index 728a65ad7a826596530b12594db15c93f1af68fb..87aa5f0d594ff697b87bc06019351d22
return false;
}
@@ -1319,7 +1400,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1321,7 +1402,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// To = Players new Location if Teleport is Successful
Location to = location;
// Create & Call the Teleport Event.
@ -230,7 +230,7 @@ index 728a65ad7a826596530b12594db15c93f1af68fb..87aa5f0d594ff697b87bc06019351d22
this.server.getPluginManager().callEvent(event);
// Return False to inform the Plugin that the Teleport was unsuccessful/cancelled.
@@ -1328,7 +1409,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1330,7 +1411,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
// If this player is riding another entity, we must dismount before teleporting.
@ -239,7 +239,7 @@ index 728a65ad7a826596530b12594db15c93f1af68fb..87aa5f0d594ff697b87bc06019351d22
// SPIGOT-5509: Wakeup, similar to riding
if (this.isSleeping()) {
@@ -1344,13 +1425,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1346,13 +1427,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
ServerLevel toWorld = ((CraftWorld) to.getWorld()).getHandle();
// Close any foreign inventory

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Custom Chat Completion Suggestions API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 87aa5f0d594ff697b87bc06019351d22b6c8c8e5..51b6b8d54b139bc89e0343c7c1ec5acedcf6f8a2 100644
index 6c6128922491efe4f47eb27039eb078f2f411315..b8a0be15e8987719b8cfb4ab842544197cfa2d67 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -696,6 +696,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -698,6 +698,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
// Paper end - Add sendOpLevel API

Datei anzeigen

@ -0,0 +1,42 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
Date: Sun, 7 Aug 2022 22:16:36 +0200
Subject: [PATCH] Add source block to BlockPhysicsEvent
diff --git a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
index 5821c802ec880501df025fcd3fbbd98242ed952c..3a95e3236eafd14baed035e53503b58c2e21b68a 100644
--- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
+++ b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
@@ -135,7 +135,7 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
orientation = this.orientation.withFront(direction);
}
- NeighborUpdater.executeUpdate(world, blockState, blockPos, this.sourceBlock, orientation, false);
+ NeighborUpdater.executeUpdate(world, blockState, blockPos, this.sourceBlock, orientation, false, this.sourcePos); // Paper - Add source block to BlockPhysicsEvent
if (this.idx < NeighborUpdater.UPDATE_ORDER.length && NeighborUpdater.UPDATE_ORDER[this.idx] == this.skipDirection) {
this.idx++;
}
diff --git a/src/main/java/net/minecraft/world/level/redstone/NeighborUpdater.java b/src/main/java/net/minecraft/world/level/redstone/NeighborUpdater.java
index be8f34dd222e43b2db7f05e5e5839df8446e1b02..e414da8a51bb9b49c28a74eca166046cbee44835 100644
--- a/src/main/java/net/minecraft/world/level/redstone/NeighborUpdater.java
+++ b/src/main/java/net/minecraft/world/level/redstone/NeighborUpdater.java
@@ -55,11 +55,17 @@ public interface NeighborUpdater {
}
static void executeUpdate(Level world, BlockState state, BlockPos pos, Block sourceBlock, @Nullable Orientation orientation, boolean notify) {
+ // Paper start - Add source block to BlockPhysicsEvent
+ executeUpdate(world, state, pos, sourceBlock, orientation, notify, pos);
+ }
+
+ static void executeUpdate(Level world, BlockState state, BlockPos pos, Block sourceBlock, @Nullable Orientation orientation, boolean notify, BlockPos sourcePos) {
+ // Paper end - Add source block to BlockPhysicsEvent
try {
// CraftBukkit start
CraftWorld cworld = ((ServerLevel) world).getWorld();
if (cworld != null) {
- BlockPhysicsEvent event = new BlockPhysicsEvent(CraftBlock.at(world, pos), CraftBlockData.fromData(state));
+ BlockPhysicsEvent event = new BlockPhysicsEvent(CraftBlock.at(world, pos), CraftBlockData.fromData(state), CraftBlock.at(world, sourcePos)); // Paper - Add source block to BlockPhysicsEvent
((ServerLevel) world).getCraftServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {

Datei anzeigen

@ -1,32 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
Date: Sun, 7 Aug 2022 22:16:36 +0200
Subject: [PATCH] Call BlockPhysicsEvent more often
diff --git a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
index 5821c802ec880501df025fcd3fbbd98242ed952c..0587f4e5083a6c890a11642284a9c16fb2eb2fe1 100644
--- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
+++ b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
@@ -135,7 +135,20 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
orientation = this.orientation.withFront(direction);
}
- NeighborUpdater.executeUpdate(world, blockState, blockPos, this.sourceBlock, orientation, false);
+ // Paper start - Call BlockPhysicsEvent
+ try {
+ org.bukkit.event.block.BlockPhysicsEvent event = new org.bukkit.event.block.BlockPhysicsEvent(
+ org.bukkit.craftbukkit.block.CraftBlock.at(world, blockPos),
+ org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(blockState),
+ org.bukkit.craftbukkit.block.CraftBlock.at(world, this.sourcePos));
+
+ if (event.callEvent()) { // continue to check for adjacent block (increase idx)
+ NeighborUpdater.executeUpdate(world, blockState, blockPos, this.sourceBlock, orientation, false);
+ }
+ } catch (StackOverflowError ex) {
+ world.lastPhysicsProblem = blockPos;
+ }
+ // Paper end - Call BlockPhysicsEvent
if (this.idx < NeighborUpdater.UPDATE_ORDER.length && NeighborUpdater.UPDATE_ORDER[this.idx] == this.skipDirection) {
this.idx++;
}

Datei anzeigen

@ -22,10 +22,10 @@ is actually processed, this is honestly really just exposed for the misnomers or
who just wanna ensure that this won't grow over a specific size if chat gets stupidly active
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index c3fe4481dd35f80815716e48beeeb07b1f51e30b..56798215644d8bca1695856b3a941e8089f49e48 100644
index 2eb155d3df2e34c050fd28c5a64015e6e1232851..d8db428f06606c16466d39cceb2a5e02eb3d3b24 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -302,7 +302,18 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -300,7 +300,18 @@ public class GlobalConfiguration extends ConfigurationPart {
@PostProcess
private void postProcess() {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Elder Guardian appearance API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 51b6b8d54b139bc89e0343c7c1ec5acedcf6f8a2..1fb27bf5da9bb281d1ff6e863912dfac2588611f 100644
index b8a0be15e8987719b8cfb4ab842544197cfa2d67..762dfbf88773b85893b3d4fa3a71ce577f3ecbd6 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -3308,6 +3308,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3310,6 +3310,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
// Paper end

Datei anzeigen

@ -10,10 +10,10 @@ public net.minecraft.world.entity.monster.warden.WardenSpawnTracker cooldownTick
public net.minecraft.world.entity.monster.warden.WardenSpawnTracker increaseWarningLevel()V
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 1fb27bf5da9bb281d1ff6e863912dfac2588611f..95f0e7e1248ded53ec5de684ec0cfb6343598f51 100644
index 762dfbf88773b85893b3d4fa3a71ce577f3ecbd6..82767306f63025fa537163cbbac24bd4d66e3416 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -3313,6 +3313,41 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3315,6 +3315,41 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void showElderGuardian(boolean silent) {
if (getHandle().connection != null) getHandle().connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.GUARDIAN_ELDER_EFFECT, silent ? 0F : 1F));
}

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] fix Instruments
properly handle Player#playNote
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 95f0e7e1248ded53ec5de684ec0cfb6343598f51..02850d3ef48aecda5d9b543e23d43c9b19ff3a89 100644
index 82767306f63025fa537163cbbac24bd4d66e3416..02e3c1aef805dd83a54a9fab2843dc2d7d47cdb5 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -773,7 +773,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -775,7 +775,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
Sound instrumentSound = instrument.getSound();
if (instrumentSound == null) return;

Datei anzeigen

@ -26,10 +26,10 @@ index 30e0a5fe3f9bd85d2b702c2c877c5682ed35d461..aca888c2f02b09ac6739bdc81b194c45
} else {
if (fallDistance >= 2.0F) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 02850d3ef48aecda5d9b543e23d43c9b19ff3a89..68296e776cda9983d2b3f1fdabe7fcaa2e631e86 100644
index 02e3c1aef805dd83a54a9fab2843dc2d7d47cdb5..9e46b2c9b3390c70ab10f279a4b41160b2f17b6d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2591,6 +2591,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2593,6 +2593,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.getHandle().onUpdateAbilities();
}

Datei anzeigen

@ -7,10 +7,10 @@ Subject: [PATCH] Win Screen API
public net.minecraft.server.level.ServerPlayer seenCredits
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 68296e776cda9983d2b3f1fdabe7fcaa2e631e86..0eaae1dddf90a23210075b795116f74fad2e2d94 100644
index 9e46b2c9b3390c70ab10f279a4b41160b2f17b6d..37f8b1adfeba6eebcbb21cd9a143ac8f6dacdcfb 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1310,6 +1310,25 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1312,6 +1312,25 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.getHandle().connection.send(packet);
}

Datei anzeigen

@ -30,10 +30,10 @@ index 3a7af27bb1ce0cbe56bd3760cd400083daf98d4c..bf0838f574fa3fb9654e087d602b8d38
if (l > 0) {
// this.value = l; // CraftBukkit - update exp value of orb for PlayerItemMendEvent calls // Paper - the value field should not be mutated here because it doesn't take "count" into account
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 0eaae1dddf90a23210075b795116f74fad2e2d94..9cddd440e50d8314b4e853fccee22fc4540ccae0 100644
index 37f8b1adfeba6eebcbb21cd9a143ac8f6dacdcfb..981b5074e832038537f8281e25bbd868c580c091 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1863,11 +1863,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1865,11 +1865,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
handle.serverLevel(), itemstack, amount
);
int i = Math.min(possibleDurabilityFromXp, itemstack.getDamageValue());

Datei anzeigen

@ -208,10 +208,10 @@ index 172202accf4448a933fcf1ff820316c7910dd7f7..50ee7656580d386db473c054f5c5ec57
return null;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 9cddd440e50d8314b4e853fccee22fc4540ccae0..b0b417d916c6c3099157f8279c346bc6670c0012 100644
index 981b5074e832038537f8281e25bbd868c580c091..cf9f7143924239c8add0e7231d922e41d9ff84d7 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1757,23 +1757,23 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1759,23 +1759,23 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
@Override
@ -240,7 +240,7 @@ index 9cddd440e50d8314b4e853fccee22fc4540ccae0..b0b417d916c6c3099157f8279c346bc6
if (kickPlayer) {
this.kickPlayer(reason);
}
@@ -1781,12 +1781,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1783,12 +1783,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
@Override

Datei anzeigen

@ -1249,10 +1249,10 @@ index 4cced854e750ea9057b4a8d686245925e5dc2868..5a2d33b7da60469f27f9782841b0cf87
public void setLevelCallback(EntityInLevelCallback changeListener) {
this.levelCallback = changeListener;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 5c907eca23d936ba3095f2d81256775edaa737da..1bf51d4a1ffb6ab56c4023c49725e412f4350197 100644
index 5c907eca23d936ba3095f2d81256775edaa737da..4c4fa7bbafb075beb0d9c1ef21e3ba2d62b1ae65 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -313,6 +313,76 @@ public final class CraftServer implements Server {
@@ -313,6 +313,88 @@ public final class CraftServer implements Server {
private final io.papermc.paper.logging.SysoutCatcher sysoutCatcher = new io.papermc.paper.logging.SysoutCatcher(); // Paper
private final io.papermc.paper.potion.PaperPotionBrewer potionBrewer; // Paper - Custom Potion Mixes
@ -1321,9 +1321,21 @@ index 5c907eca23d936ba3095f2d81256775edaa737da..1bf51d4a1ffb6ab56c4023c49725e412
+ }
+
+ @Override
+ public final boolean isOwnedByCurrentRegion(World world, int minChunkX, int minChunkZ, int maxChunkX, int maxChunkZ) {
+ return ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(
+ ((CraftWorld) world).getHandle(), minChunkX, minChunkZ, maxChunkX, maxChunkZ
+ );
+ }
+
+ @Override
+ public final boolean isOwnedByCurrentRegion(Entity entity) {
+ return ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(((org.bukkit.craftbukkit.entity.CraftEntity) entity).getHandleRaw());
+ }
+
+ @Override
+ public final boolean isGlobalTickThread() {
+ return ca.spottedleaf.moonrise.common.util.TickThread.isTickThread();
+ }
+ // Paper end - Folia reagion threading API
+
static {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Use correct seed on api world load
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 1bf51d4a1ffb6ab56c4023c49725e412f4350197..d5e8cb8a907385e807c786815cf33f1cd9355f0c 100644
index 4c4fa7bbafb075beb0d9c1ef21e3ba2d62b1ae65..54b5dee7cfd19ad58e376eee80d3827f1a80cfcd 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1388,7 +1388,7 @@ public final class CraftServer implements Server {
@@ -1400,7 +1400,7 @@ public final class CraftServer implements Server {
net.minecraft.server.Main.forceUpgrade(worldSession, DataFixers.getDataFixer(), this.console.options.has("eraseCache"), () -> true, iregistrycustom_dimension, this.console.options.has("recreateRegionFiles"));
}

Datei anzeigen

@ -38,10 +38,10 @@ index 3a6e918e9db6397b6f1cff531041655298ce087d..efc12d629b71ba1da664d9ecfd4575be
public void reloadRecipes() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index d5e8cb8a907385e807c786815cf33f1cd9355f0c..8e0d8fafa68d909d1d10c6d6a03cca371c0e6fb3 100644
index 54b5dee7cfd19ad58e376eee80d3827f1a80cfcd..a755137d8d4b266a648cb2a4f41a5ed00262f121 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1178,6 +1178,18 @@ public final class CraftServer implements Server {
@@ -1190,6 +1190,18 @@ public final class CraftServer implements Server {
ReloadCommand.reload(this.console);
}
@ -60,7 +60,7 @@ index d5e8cb8a907385e807c786815cf33f1cd9355f0c..8e0d8fafa68d909d1d10c6d6a03cca37
private void loadIcon() {
this.icon = new CraftIconCache(null);
try {
@@ -1557,6 +1569,13 @@ public final class CraftServer implements Server {
@@ -1569,6 +1581,13 @@ public final class CraftServer implements Server {
@Override
public boolean addRecipe(Recipe recipe) {
@ -74,7 +74,7 @@ index d5e8cb8a907385e807c786815cf33f1cd9355f0c..8e0d8fafa68d909d1d10c6d6a03cca37
CraftRecipe toAdd;
if (recipe instanceof CraftRecipe) {
toAdd = (CraftRecipe) recipe;
@@ -1588,6 +1607,11 @@ public final class CraftServer implements Server {
@@ -1600,6 +1619,11 @@ public final class CraftServer implements Server {
}
}
toAdd.addToCraftingManager();
@ -86,7 +86,7 @@ index d5e8cb8a907385e807c786815cf33f1cd9355f0c..8e0d8fafa68d909d1d10c6d6a03cca37
return true;
}
@@ -1768,9 +1792,23 @@ public final class CraftServer implements Server {
@@ -1780,9 +1804,23 @@ public final class CraftServer implements Server {
@Override
public boolean removeRecipe(NamespacedKey recipeKey) {

Datei anzeigen

@ -81,10 +81,10 @@ index 431bd698e28b7731bf781e29de6c6a3fd936c71c..bca9e4908c7949a6f0b24fed2aa7332d
// Special case: the axis is optional for ELECTRIC_SPARK
Preconditions.checkArgument(effect.getData() == null || effect == Effect.ELECTRIC_SPARK, "Wrong kind of data for the %s effect", effect);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index b0b417d916c6c3099157f8279c346bc6670c0012..b397f784510d832d300a777b4c4a4de03c904b72 100644
index cf9f7143924239c8add0e7231d922e41d9ff84d7..df986f2359b5bce137d7c37ed34e49ac912229e2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -922,7 +922,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -924,7 +924,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
Preconditions.checkArgument(effect != null, "Effect cannot be null");
if (data != null) {
Preconditions.checkArgument(effect.getData() != null, "Effect.%s does not have a valid Data", effect);

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Deprecate and replace methods with old StructureType
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 8e0d8fafa68d909d1d10c6d6a03cca371c0e6fb3..ee79e3374b50ba21620a9685975a0341c15f313b 100644
index a755137d8d4b266a648cb2a4f41a5ed00262f121..eaea08530ca864158a2fa15dca38ca0c25a49bde 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2007,6 +2007,11 @@ public final class CraftServer implements Server {
@@ -2019,6 +2019,11 @@ public final class CraftServer implements Server {
ServerLevel worldServer = ((CraftWorld) world).getHandle();
Location structureLocation = world.locateNearestStructure(location, structureType, radius, findUnexplored);
@ -20,7 +20,7 @@ index 8e0d8fafa68d909d1d10c6d6a03cca371c0e6fb3..ee79e3374b50ba21620a9685975a0341
BlockPos structurePosition = CraftLocation.toBlockPosition(structureLocation);
// Create map with trackPlayer = true, unlimitedTracking = true
@@ -2017,6 +2022,31 @@ public final class CraftServer implements Server {
@@ -2029,6 +2034,31 @@ public final class CraftServer implements Server {
return CraftItemStack.asBukkitCopy(stack);
}

Datei anzeigen

@ -122,7 +122,7 @@ index efc12d629b71ba1da664d9ecfd4575bee9b45dc3..9067100a82a8c405cec0a19e53b3b245
// Paper end - Use single player info update packet on join
player.sentListPacket = true;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index b397f784510d832d300a777b4c4a4de03c904b72..76ee6dcf028720f22ca6d0ba5975a8f1555cca37 100644
index df986f2359b5bce137d7c37ed34e49ac912229e2..21a700a44972336ee619389eab1d83545883f092 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -206,6 +206,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -133,7 +133,7 @@ index b397f784510d832d300a777b4c4a4de03c904b72..76ee6dcf028720f22ca6d0ba5975a8f1
private static final WeakHashMap<Plugin, WeakReference<Plugin>> pluginWeakReferences = new WeakHashMap<>();
private int hash = 0;
private double health = 20;
@@ -2102,7 +2103,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2104,7 +2105,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
otherPlayer.setUUID(uuidOverride);
}
// Paper end
@ -142,7 +142,7 @@ index b397f784510d832d300a777b4c4a4de03c904b72..76ee6dcf028720f22ca6d0ba5975a8f1
if (original != null) otherPlayer.setUUID(original); // Paper - uuid override
}
@@ -2206,6 +2207,41 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2208,6 +2209,41 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return (entity != null) ? this.canSee(entity) : false; // If we can't find it, we can't see it
}

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Add player idle duration API
Implements API for getting and resetting a player's idle duration.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index d8f0f8f0afd0a3705cf20b2670a6dd137cd70c15..81455040c878b202cdb96a282fddfe4a65c7d0b7 100644
index 24abbc26ef9bc8ddc468b7d241cf825405fcfae3..6f1533523424de0d362d1251f05490829460eb8b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -3429,6 +3429,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3431,6 +3431,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
// Paper end

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Allow null itemstack for Player#sendEquipmentChange
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 81455040c878b202cdb96a282fddfe4a65c7d0b7..273a94f727c6c736b2bdf98c1806431ebce4d90f 100644
index 6f1533523424de0d362d1251f05490829460eb8b..cc4911163e0e22a7313ea4a591efc7dd40fb1b72 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1132,7 +1132,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1134,7 +1134,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void sendEquipmentChange(LivingEntity entity, EquipmentSlot slot, ItemStack item) {

Datei anzeigen

@ -18,10 +18,10 @@ index aca888c2f02b09ac6739bdc81b194c4527dd69f5..a19a795deaa7f46c92b97912e2ade006
// Paper start - send while respecting visibility
private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 273a94f727c6c736b2bdf98c1806431ebce4d90f..a1c7e7b95718562d86ee8e6da1bb6e6b5d82ce7a 100644
index cc4911163e0e22a7313ea4a591efc7dd40fb1b72..f881a73c6213582ef6d2632759a5d3a46dbf19ef 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1931,6 +1931,49 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1933,6 +1933,49 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
Preconditions.checkArgument(exp >= 0, "Total experience points must not be negative (%s)", exp);
this.getHandle().totalExperience = exp;
}

Datei anzeigen

@ -727,10 +727,10 @@ index 2e96308696e131f3f013469a395e5ddda2c5d529..65a66e484c1c39c5f41d97db52f31c67
} catch (Throwable e) {
LOGGER.error("Failed to run bootstrapper for %s. This plugin will not be loaded.".formatted(provider.getSource()), e);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index ee79e3374b50ba21620a9685975a0341c15f313b..7cc96d03472a4cb94e679251f0969995284f7eaa 100644
index eaea08530ca864158a2fa15dca38ca0c25a49bde..b4a823a62d7088262b7f799c977aec71f8778ff5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1050,6 +1050,11 @@ public final class CraftServer implements Server {
@@ -1062,6 +1062,11 @@ public final class CraftServer implements Server {
@Override
public void reload() {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] improve BanList types
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 7cc96d03472a4cb94e679251f0969995284f7eaa..54ef70eff81194c85d6433d00382a5909b6d797f 100644
index b4a823a62d7088262b7f799c977aec71f8778ff5..0d62694e2f9086702eaca7a11799eb90a06ce853 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2260,6 +2260,21 @@ public final class CraftServer implements Server {
@@ -2272,6 +2272,21 @@ public final class CraftServer implements Server {
};
}

Datei anzeigen

@ -2376,7 +2376,7 @@ index c4ffa8519b520e0793af90e149518951d7ffb65b..688916c8fef40d4c81379ad38609a979
// CraftBukkit end
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 54ef70eff81194c85d6433d00382a5909b6d797f..c65a4bb7f1818378a5e571d39a5aabe8ad87d16c 100644
index 0d62694e2f9086702eaca7a11799eb90a06ce853..338b60f0254d55ac4a0645ca351d0ce736ce0681 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -275,11 +275,11 @@ public final class CraftServer implements Server {
@ -2394,7 +2394,7 @@ index 54ef70eff81194c85d6433d00382a5909b6d797f..c65a4bb7f1818378a5e571d39a5aabe8
private final StructureManager structureManager;
protected final DedicatedServer console;
protected final DedicatedPlayerList playerList;
@@ -407,6 +407,12 @@ public final class CraftServer implements Server {
@@ -419,6 +419,12 @@ public final class CraftServer implements Server {
this.serverLinks = new CraftServerLinks(console);
Bukkit.setServer(this);
@ -2407,7 +2407,7 @@ index 54ef70eff81194c85d6433d00382a5909b6d797f..c65a4bb7f1818378a5e571d39a5aabe8
CraftRegistry.setMinecraftRegistry(console.registryAccess());
@@ -605,48 +611,11 @@ public final class CraftServer implements Server {
@@ -617,48 +623,11 @@ public final class CraftServer implements Server {
}
private void setVanillaCommands(boolean first) { // Spigot
@ -2458,7 +2458,7 @@ index 54ef70eff81194c85d6433d00382a5909b6d797f..c65a4bb7f1818378a5e571d39a5aabe8
// Refresh commands
for (ServerPlayer player : this.getHandle().players) {
@@ -1033,17 +1002,31 @@ public final class CraftServer implements Server {
@@ -1045,17 +1014,31 @@ public final class CraftServer implements Server {
return true;
}
@ -2500,7 +2500,7 @@ index 54ef70eff81194c85d6433d00382a5909b6d797f..c65a4bb7f1818378a5e571d39a5aabe8
return false;
}
@@ -1052,7 +1035,7 @@ public final class CraftServer implements Server {
@@ -1064,7 +1047,7 @@ public final class CraftServer implements Server {
public void reload() {
// Paper start - lifecycle events
if (io.papermc.paper.plugin.lifecycle.event.LifecycleEventRunner.INSTANCE.blocksPluginReloading()) {
@ -2509,7 +2509,7 @@ index 54ef70eff81194c85d6433d00382a5909b6d797f..c65a4bb7f1818378a5e571d39a5aabe8
}
// Paper end - lifecycle events
org.spigotmc.WatchdogThread.hasStarted = false; // Paper - Disable watchdog early timeout on reload
@@ -1107,8 +1090,9 @@ public final class CraftServer implements Server {
@@ -1119,8 +1102,9 @@ public final class CraftServer implements Server {
}
Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
@ -2520,7 +2520,7 @@ index 54ef70eff81194c85d6433d00382a5909b6d797f..c65a4bb7f1818378a5e571d39a5aabe8
// Paper start
for (Plugin plugin : pluginClone) {
entityMetadata.removeAll(plugin);
@@ -1148,6 +1132,12 @@ public final class CraftServer implements Server {
@@ -1160,6 +1144,12 @@ public final class CraftServer implements Server {
this.enablePlugins(PluginLoadOrder.STARTUP);
this.enablePlugins(PluginLoadOrder.POSTWORLD);
if (io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper != null) io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper.pluginsEnabled(); // Paper - Remap plugins

Datei anzeigen

@ -30,7 +30,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma
index 55a4424c47591d1bcaba306f6af877a4fb7144bf..a13f88ed2ce39848b1fe1673265cf6c62adbfb66 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2811,6 +2811,14 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@@ -2808,6 +2808,14 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
this.awardStat(Stats.DROP);
}

Datei anzeigen

@ -1599,10 +1599,10 @@ index 5fc9e8e969debb3e15ed474b36a1c48b086d0449..f65cc95ab28e8a3b21eac2b16bd9ebe9
private static final byte[] EMPTY_LIGHT = new byte[2048];
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index c65a4bb7f1818378a5e571d39a5aabe8ad87d16c..758d86865136e5ef58f401f00c5e62fbb8cf25a3 100644
index 338b60f0254d55ac4a0645ca351d0ce736ce0681..87477ad186b5f692a39f323a618d016b669d8051 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2702,7 +2702,7 @@ public final class CraftServer implements Server {
@@ -2714,7 +2714,7 @@ public final class CraftServer implements Server {
public ChunkGenerator.ChunkData createChunkData(World world) {
Preconditions.checkArgument(world != null, "World cannot be null");
ServerLevel handle = ((CraftWorld) world).getHandle();

Datei anzeigen

@ -11,7 +11,7 @@ public net.minecraft.resources.RegistryOps lookupProvider
public net.minecraft.resources.RegistryOps$HolderLookupAdapter
diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
index 2f22f46f80b80be43a2cc1cd8afb51f4d1fd0e91..3ec2aa5da045b62809afd2c13fc9ae74189dbdad 100644
index cd8a6a4c2a63029f8f859765088c227bbd456813..86c9f87cdb41c0d1ccc2a61b501f969cfaae47bc 100644
--- a/src/main/java/io/papermc/paper/registry/PaperRegistries.java
+++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
@@ -3,6 +3,7 @@ package io.papermc.paper.registry;
@ -22,15 +22,15 @@ index 2f22f46f80b80be43a2cc1cd8afb51f4d1fd0e91..3ec2aa5da045b62809afd2c13fc9ae74
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.List;
@@ -69,6 +70,7 @@ import org.checkerframework.framework.qual.DefaultQualifier;
@@ -67,6 +68,7 @@ import org.jspecify.annotations.Nullable;
import static io.papermc.paper.registry.entry.RegistryEntry.apiOnly;
import static io.papermc.paper.registry.entry.RegistryEntry.entry;
+import static io.papermc.paper.registry.entry.RegistryEntry.writable;
@DefaultQualifier(NonNull.class)
public final class PaperRegistries {
@@ -152,6 +154,15 @@ public final class PaperRegistries {
@@ -149,6 +151,15 @@ public final class PaperRegistries {
return ResourceKey.create((ResourceKey<? extends Registry<M>>) PaperRegistries.registryToNms(typedKey.registryKey()), PaperAdventure.asVanilla(typedKey.key()));
}
@ -47,10 +47,10 @@ index 2f22f46f80b80be43a2cc1cd8afb51f4d1fd0e91..3ec2aa5da045b62809afd2c13fc9ae74
}
}
diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistryAccess.java b/src/main/java/io/papermc/paper/registry/PaperRegistryAccess.java
index 35b6a7c5bac9640332a833bd3627f2bcb1bbf2f3..1026b9c04f94ed73049b980822a2eafdbacea7fd 100644
index 4bf7915867dbe762ef0b070d67d5f7b7d1ee4f03..ed071ed34e16812f133102b0d66a5201a94639f2 100644
--- a/src/main/java/io/papermc/paper/registry/PaperRegistryAccess.java
+++ b/src/main/java/io/papermc/paper/registry/PaperRegistryAccess.java
@@ -83,6 +83,14 @@ public class PaperRegistryAccess implements RegistryAccess {
@@ -78,6 +78,14 @@ public class PaperRegistryAccess implements RegistryAccess {
return possiblyUnwrap(registryHolder.get());
}
@ -67,15 +67,14 @@ index 35b6a7c5bac9640332a833bd3627f2bcb1bbf2f3..1026b9c04f94ed73049b980822a2eafd
return delayedRegistry.delegate();
diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistryBuilder.java b/src/main/java/io/papermc/paper/registry/PaperRegistryBuilder.java
new file mode 100644
index 0000000000000000000000000000000000000000..528c6ee1739d92f766f3904acd7fc5734c93388a
index 0000000000000000000000000000000000000000..69e63689083207de2f409557d4a9a17f8ad7ae3e
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/PaperRegistryBuilder.java
@@ -0,0 +1,26 @@
@@ -0,0 +1,25 @@
+package io.papermc.paper.registry;
+
+import io.papermc.paper.registry.data.util.Conversions;
+import net.minecraft.resources.RegistryOps;
+import org.checkerframework.checker.nullness.qual.Nullable;
+import org.jspecify.annotations.Nullable;
+
+public interface PaperRegistryBuilder<M, T> extends RegistryBuilder<T> {
+
@ -99,7 +98,7 @@ index 0000000000000000000000000000000000000000..528c6ee1739d92f766f3904acd7fc573
+}
diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistryListenerManager.java b/src/main/java/io/papermc/paper/registry/PaperRegistryListenerManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..69e946173407eb05b18a2b19b0d45cbb3213570b
index 0000000000000000000000000000000000000000..60d9b806a09bb103e36ce1f932a5a34ef408770a
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/PaperRegistryListenerManager.java
@@ -0,0 +1,183 @@
@ -133,8 +132,8 @@ index 0000000000000000000000000000000000000000..69e946173407eb05b18a2b19b0d45cbb
+import net.minecraft.core.registries.BuiltInRegistries;
+import net.minecraft.resources.ResourceKey;
+import net.minecraft.resources.ResourceLocation;
+import org.checkerframework.checker.nullness.qual.Nullable;
+import org.intellij.lang.annotations.Subst;
+import org.jspecify.annotations.Nullable;
+
+public class PaperRegistryListenerManager {
+
@ -201,7 +200,7 @@ index 0000000000000000000000000000000000000000..69e946173407eb05b18a2b19b0d45cbb
+ final Conversions conversions
+ ) {
+ Preconditions.checkState(LaunchEntryPointHandler.INSTANCE.hasEntered(Entrypoint.BOOTSTRAPPER), registry.key() + " tried to run modification listeners before bootstrappers have been called"); // verify that bootstrappers have been called
+ final @Nullable RegistryEntryInfo<M, T> entry = PaperRegistries.getEntry(registry.key());
+ final RegistryEntryInfo<M, T> entry = PaperRegistries.getEntry(registry.key());
+ if (!RegistryEntry.Modifiable.isModifiable(entry) || !this.valueAddEventTypes.hasHandlers(entry.apiKey())) {
+ return registerMethod.register((WritableRegistry<M>) registry, key, nms, registrationInfo);
+ }
@ -262,7 +261,7 @@ index 0000000000000000000000000000000000000000..69e946173407eb05b18a2b19b0d45cbb
+ }
+
+ public <M, T extends org.bukkit.Keyed, B extends PaperRegistryBuilder<M, T>> void runFreezeListeners(final ResourceKey<? extends Registry<M>> resourceKey, final Conversions conversions) {
+ final @Nullable RegistryEntryInfo<M, T> entry = PaperRegistries.getEntry(resourceKey);
+ final RegistryEntryInfo<M, T> entry = PaperRegistries.getEntry(resourceKey);
+ if (!RegistryEntry.Addable.isAddable(entry) || !this.freezeEventTypes.hasHandlers(entry.apiKey())) {
+ return;
+ }
@ -320,7 +319,7 @@ index 6d134ace042758da722960cbcb48e52508dafd61..cc39bc68d29055ef6429f08f975412bd
}
diff --git a/src/main/java/io/papermc/paper/registry/WritableCraftRegistry.java b/src/main/java/io/papermc/paper/registry/WritableCraftRegistry.java
new file mode 100644
index 0000000000000000000000000000000000000000..78317c7ab42a666f19634593a8f3b696700764c8
index 0000000000000000000000000000000000000000..ef91352d442d9ddd666af6bde9a186ce15e5aa04
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/WritableCraftRegistry.java
@@ -0,0 +1,92 @@
@ -341,7 +340,7 @@ index 0000000000000000000000000000000000000000..78317c7ab42a666f19634593a8f3b696
+import org.bukkit.NamespacedKey;
+import org.bukkit.craftbukkit.CraftRegistry;
+import org.bukkit.craftbukkit.util.ApiVersion;
+import org.checkerframework.checker.nullness.qual.Nullable;
+import org.jspecify.annotations.Nullable;
+
+public class WritableCraftRegistry<M, T extends Keyed, B extends PaperRegistryBuilder<M, T>> extends CraftRegistry<T, M> {
+
@ -418,22 +417,19 @@ index 0000000000000000000000000000000000000000..78317c7ab42a666f19634593a8f3b696
+}
diff --git a/src/main/java/io/papermc/paper/registry/data/util/Conversions.java b/src/main/java/io/papermc/paper/registry/data/util/Conversions.java
new file mode 100644
index 0000000000000000000000000000000000000000..eda5cc7d45ef59ccc1c9c7e027c1f044f1dcc86b
index 0000000000000000000000000000000000000000..1e9a0143bc3b70dfc5e129a0fe849ff3e01447ab
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/data/util/Conversions.java
@@ -0,0 +1,36 @@
@@ -0,0 +1,33 @@
+package io.papermc.paper.registry.data.util;
+
+import com.mojang.serialization.JavaOps;
+import io.papermc.paper.adventure.WrapperAwareSerializer;
+import net.kyori.adventure.text.Component;
+import net.minecraft.resources.RegistryOps;
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.checker.nullness.qual.Nullable;
+import org.checkerframework.framework.qual.DefaultQualifier;
+import org.jetbrains.annotations.Contract;
+import org.jspecify.annotations.Nullable;
+
+@DefaultQualifier(NonNull.class)
+public class Conversions {
+
+ private final RegistryOps.RegistryInfoLookup lookup;
@ -458,6 +454,16 @@ index 0000000000000000000000000000000000000000..eda5cc7d45ef59ccc1c9c7e027c1f044
+ return vanilla == null ? Component.empty() : this.serializer.deserialize(vanilla);
+ }
+}
diff --git a/src/main/java/io/papermc/paper/registry/data/util/package-info.java b/src/main/java/io/papermc/paper/registry/data/util/package-info.java
new file mode 100644
index 0000000000000000000000000000000000000000..5b88be976c7773459ce1b6daf58d7ea7c806f21b
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/data/util/package-info.java
@@ -0,0 +1,4 @@
+@NullMarked
+package io.papermc.paper.registry.data.util;
+
+import org.jspecify.annotations.NullMarked;
diff --git a/src/main/java/io/papermc/paper/registry/entry/AddableRegistryEntry.java b/src/main/java/io/papermc/paper/registry/entry/AddableRegistryEntry.java
new file mode 100644
index 0000000000000000000000000000000000000000..aeec9b3ae2911f041d000b3db72f37974020ba60
@ -547,7 +553,7 @@ index 0000000000000000000000000000000000000000..515a995e3862f8e7cb93d149315ea32e
+ }
+}
diff --git a/src/main/java/io/papermc/paper/registry/entry/RegistryEntry.java b/src/main/java/io/papermc/paper/registry/entry/RegistryEntry.java
index 15991bf13894d850f360a520d1815711d25973ec..f2e919705301cb23ed1938ca3c1976378249172c 100644
index 2889d87f0989ae5744cd4c1e57240830aa574155..9494bcf82101340e04559d850570698947b7a9ff 100644
--- a/src/main/java/io/papermc/paper/registry/entry/RegistryEntry.java
+++ b/src/main/java/io/papermc/paper/registry/entry/RegistryEntry.java
@@ -1,7 +1,13 @@
@ -564,15 +570,15 @@ index 15991bf13894d850f360a520d1815711d25973ec..f2e919705301cb23ed1938ca3c197637
import io.papermc.paper.registry.legacy.DelayedRegistryEntry;
import java.util.function.BiFunction;
import java.util.function.Supplier;
@@ -11,6 +17,7 @@ import org.bukkit.Keyed;
@@ -10,6 +16,7 @@ import net.minecraft.resources.ResourceKey;
import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
import org.bukkit.craftbukkit.util.ApiVersion;
import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.framework.qual.DefaultQualifier;
+import org.jspecify.annotations.Nullable;
@DefaultQualifier(NonNull.class)
@@ -32,6 +39,65 @@ public interface RegistryEntry<M, B extends Keyed> extends RegistryEntryInfo<M,
public interface RegistryEntry<M, B extends Keyed> extends RegistryEntryInfo<M, B> { // TODO remove Keyed
@@ -29,6 +36,65 @@ public interface RegistryEntry<M, B extends Keyed> extends RegistryEntryInfo<M,
return new DelayedRegistryEntry<>(this);
}
@ -638,7 +644,7 @@ index 15991bf13894d850f360a520d1815711d25973ec..f2e919705301cb23ed1938ca3c197637
static <M, B extends Keyed> RegistryEntry<M, B> entry(
final ResourceKey<? extends Registry<M>> mcKey,
final RegistryKey<B> apiKey,
@@ -48,4 +114,24 @@ public interface RegistryEntry<M, B extends Keyed> extends RegistryEntryInfo<M,
@@ -45,4 +111,24 @@ public interface RegistryEntry<M, B extends Keyed> extends RegistryEntryInfo<M,
) {
return new ApiRegistryEntry<>(mcKey, apiKey, apiRegistrySupplier);
}
@ -693,10 +699,10 @@ index 0000000000000000000000000000000000000000..562accce731630327d116afd1c9d559d
+}
diff --git a/src/main/java/io/papermc/paper/registry/event/RegistryEntryAddEventImpl.java b/src/main/java/io/papermc/paper/registry/event/RegistryEntryAddEventImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..cc9c8fd313f530777af80ad79e03903f3f8f9829
index 0000000000000000000000000000000000000000..332829c65ef45966dffcf5f1c59422a801179759
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/event/RegistryEntryAddEventImpl.java
@@ -0,0 +1,30 @@
@@ -0,0 +1,29 @@
+package io.papermc.paper.registry.event;
+
+import io.papermc.paper.plugin.lifecycle.event.PaperLifecycleEvent;
@ -711,7 +717,6 @@ index 0000000000000000000000000000000000000000..cc9c8fd313f530777af80ad79e03903f
+import net.minecraft.core.HolderSet;
+import net.minecraft.resources.RegistryOps;
+import org.bukkit.Keyed;
+import org.checkerframework.checker.nullness.qual.NonNull;
+
+public record RegistryEntryAddEventImpl<T, B extends RegistryBuilder<T>>(
+ TypedKey<T> key,
@ -721,7 +726,7 @@ index 0000000000000000000000000000000000000000..cc9c8fd313f530777af80ad79e03903f
+) implements RegistryEntryAddEvent<T, B>, PaperLifecycleEvent {
+
+ @Override
+ public @NonNull <V extends Keyed> Tag<V> getOrCreateTag(final TagKey<V> tagKey) {
+ public <V extends Keyed> Tag<V> getOrCreateTag(final TagKey<V> tagKey) {
+ final RegistryOps.RegistryInfo<Object> registryInfo = this.conversions.lookup().lookup(PaperRegistries.registryToNms(tagKey.registryKey())).orElseThrow();
+ final HolderSet.Named<?> tagSet = registryInfo.getter().getOrThrow(PaperRegistries.toNms(tagKey));
+ return new NamedRegistryKeySetImpl<>(tagKey, tagSet);
@ -810,10 +815,10 @@ index 0000000000000000000000000000000000000000..34c842ffa355e3c8001dd7b8551bcb49
+}
diff --git a/src/main/java/io/papermc/paper/registry/event/RegistryFreezeEventImpl.java b/src/main/java/io/papermc/paper/registry/event/RegistryFreezeEventImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..63957d2509e68ccc6eb2fd9ecaa35bfad7b71b81
index 0000000000000000000000000000000000000000..1b45802f9afc97fd59c6dc77964dedea1016cd6c
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/event/RegistryFreezeEventImpl.java
@@ -0,0 +1,28 @@
@@ -0,0 +1,27 @@
+package io.papermc.paper.registry.event;
+
+import io.papermc.paper.plugin.lifecycle.event.PaperLifecycleEvent;
@ -827,7 +832,6 @@ index 0000000000000000000000000000000000000000..63957d2509e68ccc6eb2fd9ecaa35bfa
+import net.minecraft.core.HolderSet;
+import net.minecraft.resources.RegistryOps;
+import org.bukkit.Keyed;
+import org.checkerframework.checker.nullness.qual.NonNull;
+
+public record RegistryFreezeEventImpl<T, B extends RegistryBuilder<T>>(
+ RegistryKey<T> registryKey,
@ -836,7 +840,7 @@ index 0000000000000000000000000000000000000000..63957d2509e68ccc6eb2fd9ecaa35bfa
+) implements RegistryFreezeEvent<T, B>, PaperLifecycleEvent {
+
+ @Override
+ public @NonNull <V extends Keyed> Tag<V> getOrCreateTag(final TagKey<V> tagKey) {
+ public <V extends Keyed> Tag<V> getOrCreateTag(final TagKey<V> tagKey) {
+ final RegistryOps.RegistryInfo<Object> registryInfo = this.conversions.lookup().lookup(PaperRegistries.registryToNms(tagKey.registryKey())).orElseThrow();
+ final HolderSet.Named<?> tagSet = registryInfo.getter().getOrThrow(PaperRegistries.toNms(tagKey));
+ return new NamedRegistryKeySetImpl<>(tagKey, tagSet);
@ -844,15 +848,14 @@ index 0000000000000000000000000000000000000000..63957d2509e68ccc6eb2fd9ecaa35bfa
+}
diff --git a/src/main/java/io/papermc/paper/registry/event/package-info.java b/src/main/java/io/papermc/paper/registry/event/package-info.java
new file mode 100644
index 0000000000000000000000000000000000000000..14d2d9766b8dee763f220c397aba3ad432d02aaa
index 0000000000000000000000000000000000000000..1d20e0d940ae498b96fe33f6176c140f816921f1
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/event/package-info.java
@@ -0,0 +1,5 @@
+@DefaultQualifier(NonNull.class)
@@ -0,0 +1,4 @@
+@NullMarked
+package io.papermc.paper.registry.event;
+
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.framework.qual.DefaultQualifier;
+import org.jspecify.annotations.NullMarked;
diff --git a/src/main/java/io/papermc/paper/registry/event/type/RegistryEntryAddEventTypeImpl.java b/src/main/java/io/papermc/paper/registry/event/type/RegistryEntryAddEventTypeImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..fbf853bf1cbb3c7bbef531afe185818b9454299b
@ -898,7 +901,7 @@ index 0000000000000000000000000000000000000000..fbf853bf1cbb3c7bbef531afe185818b
+}
diff --git a/src/main/java/io/papermc/paper/registry/event/type/RegistryEntryAddHandlerConfiguration.java b/src/main/java/io/papermc/paper/registry/event/type/RegistryEntryAddHandlerConfiguration.java
new file mode 100644
index 0000000000000000000000000000000000000000..548f5bf979e88708e98d04dfe22ccaa300c91ddd
index 0000000000000000000000000000000000000000..3cc0f7688f61c5fdbd98d0134741c98a8b9748b9
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/event/type/RegistryEntryAddHandlerConfiguration.java
@@ -0,0 +1,42 @@
@ -912,8 +915,8 @@ index 0000000000000000000000000000000000000000..548f5bf979e88708e98d04dfe22ccaa3
+import io.papermc.paper.registry.TypedKey;
+import io.papermc.paper.registry.event.RegistryEntryAddEvent;
+import java.util.function.Predicate;
+import org.checkerframework.checker.nullness.qual.Nullable;
+import org.jetbrains.annotations.Contract;
+import org.jspecify.annotations.Nullable;
+
+public class RegistryEntryAddHandlerConfiguration<T, B extends RegistryBuilder<T>> extends PrioritizedLifecycleEventHandlerConfigurationImpl<BootstrapContext, RegistryEntryAddEvent<T, B>> implements RegistryEntryAddConfiguration<T> {
+
@ -968,11 +971,21 @@ index 0000000000000000000000000000000000000000..7ee77022198bf5f9f88c6a1917a1da30
+ return false; // only runs once
+ }
+}
diff --git a/src/main/java/io/papermc/paper/registry/event/type/package-info.java b/src/main/java/io/papermc/paper/registry/event/type/package-info.java
new file mode 100644
index 0000000000000000000000000000000000000000..f9f63926a5aaf84e0d23bac3422c5800683e37f9
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/event/type/package-info.java
@@ -0,0 +1,4 @@
+@NullMarked
+package io.papermc.paper.registry.event.type;
+
+import org.jspecify.annotations.NullMarked;
diff --git a/src/main/java/io/papermc/paper/registry/legacy/DelayedRegistry.java b/src/main/java/io/papermc/paper/registry/legacy/DelayedRegistry.java
index 9400fed345344a0a8e4fb301cca6a1867adf625b..0cdc92acd3ebb6efb10e1b66419cc05618301581 100644
index ca829b162d4369f845e59b62bb8779fd83fe2ef3..fdc475f2b112ba88ff1d89cb0c4eaa465b2d034c 100644
--- a/src/main/java/io/papermc/paper/registry/legacy/DelayedRegistry.java
+++ b/src/main/java/io/papermc/paper/registry/legacy/DelayedRegistry.java
@@ -1,5 +1,7 @@
@@ -1,11 +1,14 @@
package io.papermc.paper.registry.legacy;
+import io.papermc.paper.registry.tag.Tag;
@ -980,16 +993,15 @@ index 9400fed345344a0a8e4fb301cca6a1867adf625b..0cdc92acd3ebb6efb10e1b66419cc056
import java.util.Iterator;
import java.util.function.Supplier;
import java.util.stream.Stream;
@@ -7,7 +9,6 @@ import net.kyori.adventure.key.Key;
import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
-import org.bukkit.craftbukkit.CraftRegistry;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.NotNull;
@@ -58,4 +59,14 @@ public final class DelayedRegistry<T extends Keyed, R extends Registry<T>> imple
public NamespacedKey getKey(final T value) {
+import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;
/**
@@ -54,4 +57,14 @@ public final class DelayedRegistry<T extends Keyed, R extends Registry<T>> imple
public @Nullable NamespacedKey getKey(final T value) {
return this.delegate().getKey(value);
}
+
@ -999,27 +1011,16 @@ index 9400fed345344a0a8e4fb301cca6a1867adf625b..0cdc92acd3ebb6efb10e1b66419cc056
+ }
+
+ @Override
+ public @NotNull Tag<T> getTag(final TagKey<T> key) {
+ public @NonNull Tag<T> getTag(final TagKey<T> key) {
+ return this.delegate().getTag(key);
+ }
}
diff --git a/src/main/java/io/papermc/paper/registry/package-info.java b/src/main/java/io/papermc/paper/registry/package-info.java
new file mode 100644
index 0000000000000000000000000000000000000000..0b80179ff90e085568d7ceafd9b17511789dc99b
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/package-info.java
@@ -0,0 +1,5 @@
+@DefaultQualifier(NonNull.class)
+package io.papermc.paper.registry;
+
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.framework.qual.DefaultQualifier;
diff --git a/src/main/java/io/papermc/paper/registry/set/NamedRegistryKeySetImpl.java b/src/main/java/io/papermc/paper/registry/set/NamedRegistryKeySetImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..e8c2c18a1ed5cd587266bd415170610781531a12
index 0000000000000000000000000000000000000000..7b15640c2f10c72f2612ab2270adc5689dfd9e5a
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/set/NamedRegistryKeySetImpl.java
@@ -0,0 +1,76 @@
@@ -0,0 +1,74 @@
+package io.papermc.paper.registry.set;
+
+import com.google.common.collect.ImmutableList;
@ -1039,12 +1040,10 @@ index 0000000000000000000000000000000000000000..e8c2c18a1ed5cd587266bd4151706107
+import org.bukkit.NamespacedKey;
+import org.bukkit.Registry;
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.framework.qual.DefaultQualifier;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Unmodifiable;
+import org.jspecify.annotations.NullMarked;
+
+@DefaultQualifier(NonNull.class)
+@NullMarked
+public record NamedRegistryKeySetImpl<T extends Keyed, M>( // TODO remove Keyed
+ TagKey<T> tagKey,
+ HolderSet.Named<M> namedSet
@ -1091,17 +1090,17 @@ index 0000000000000000000000000000000000000000..e8c2c18a1ed5cd587266bd4151706107
+ }
+
+ @Override
+ public @NotNull NamespacedKey getKey() {
+ public NamespacedKey getKey() {
+ final Key key = this.tagKey().key();
+ return new NamespacedKey(key.namespace(), key.value());
+ }
+}
diff --git a/src/main/java/io/papermc/paper/registry/set/PaperRegistrySets.java b/src/main/java/io/papermc/paper/registry/set/PaperRegistrySets.java
new file mode 100644
index 0000000000000000000000000000000000000000..f09ce9c8547ef05153847245746473dd9a8acbe6
index 0000000000000000000000000000000000000000..cb92f53cf9d139828acd016499470212a198b722
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/set/PaperRegistrySets.java
@@ -0,0 +1,48 @@
@@ -0,0 +1,45 @@
+package io.papermc.paper.registry.set;
+
+import io.papermc.paper.registry.PaperRegistries;
@ -1115,10 +1114,7 @@ index 0000000000000000000000000000000000000000..f09ce9c8547ef05153847245746473dd
+import net.minecraft.resources.RegistryOps;
+import net.minecraft.resources.ResourceKey;
+import org.bukkit.Keyed;
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.framework.qual.DefaultQualifier;
+
+@DefaultQualifier(NonNull.class)
+public final class PaperRegistrySets {
+
+ public static <A extends Keyed, M> HolderSet<M> convertToNms(final ResourceKey<? extends Registry<M>> resourceKey, final RegistryOps.RegistryInfoLookup lookup, final RegistryKeySet<A> registryKeySet) { // TODO remove Keyed
@ -1150,6 +1146,16 @@ index 0000000000000000000000000000000000000000..f09ce9c8547ef05153847245746473dd
+ private PaperRegistrySets() {
+ }
+}
diff --git a/src/main/java/io/papermc/paper/registry/set/package-info.java b/src/main/java/io/papermc/paper/registry/set/package-info.java
new file mode 100644
index 0000000000000000000000000000000000000000..516b072428dcc8a28d13bcc990493cf4c22ad948
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/set/package-info.java
@@ -0,0 +1,4 @@
+@NullMarked
+package io.papermc.paper.registry.set;
+
+import org.jspecify.annotations.NullMarked;
diff --git a/src/main/java/net/minecraft/core/MappedRegistry.java b/src/main/java/net/minecraft/core/MappedRegistry.java
index 71e04e5c1bc0722abf8ca2e0738bd60b6d7ae21c..063630c1ffcce099139c59d598fc5a210e21f640 100644
--- a/src/main/java/net/minecraft/core/MappedRegistry.java
@ -1406,21 +1412,24 @@ index 0000000000000000000000000000000000000000..8bee1a5ed877a04e4d027593df1f42ce
+io.papermc.paper.registry.event.RegistryEventTypeProviderImpl
diff --git a/src/test/java/io/papermc/paper/registry/RegistryBuilderTest.java b/src/test/java/io/papermc/paper/registry/RegistryBuilderTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..ceef7b5864deb1d7c6aa5630febe86ba9427bdc4
index 0000000000000000000000000000000000000000..f2f1dfe4277ce1e84a9494bee285badc958c8d3f
--- /dev/null
+++ b/src/test/java/io/papermc/paper/registry/RegistryBuilderTest.java
@@ -0,0 +1,36 @@
@@ -0,0 +1,44 @@
+package io.papermc.paper.registry;
+
+import io.papermc.paper.registry.data.util.Conversions;
+import java.util.List;
+import io.papermc.paper.registry.entry.RegistryEntry;
+import io.papermc.paper.registry.entry.RegistryEntryInfo;
+import io.papermc.paper.registry.legacy.DelayedRegistryEntry;
+import java.util.Map;
+import java.util.stream.Stream;
+import net.minecraft.core.Registry;
+import net.minecraft.resources.RegistryOps;
+import net.minecraft.resources.ResourceKey;
+import org.bukkit.Keyed;
+import org.bukkit.support.RegistryHelper;
+import org.bukkit.support.environment.AllFeatures;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
@ -1430,18 +1439,23 @@ index 0000000000000000000000000000000000000000..ceef7b5864deb1d7c6aa5630febe86ba
+@AllFeatures
+class RegistryBuilderTest {
+
+ static List<Arguments> registries() {
+ return List.of(
+ );
+ static Stream<Arguments> registries() {
+ return PaperRegistries.REGISTRY_ENTRIES.stream()
+ .map(RegistryBuilderTest::possiblyUnwrap)
+ .filter(RegistryEntry.BuilderHolder.class::isInstance)
+ .map(Arguments::arguments);
+ }
+
+ private static <M, B extends Keyed> RegistryEntryInfo<M, B> possiblyUnwrap(final RegistryEntryInfo<M, B> entry) {
+ return entry instanceof final DelayedRegistryEntry<M, B> delayed ? delayed.delegate() : entry;
+ }
+
+ @Disabled
+ @ParameterizedTest
+ @MethodSource("registries")
+ <M, T> void testEquality(final ResourceKey<? extends Registry<M>> resourceKey, final PaperRegistryBuilder.Filler<M, T, ?> filler) {
+ final Registry<M> registry = RegistryHelper.getRegistry().lookupOrThrow(resourceKey);
+ <M, T> void testEquality(final RegistryEntry.BuilderHolder<M, T, ?> registryEntry) {
+ final Registry<M> registry = RegistryHelper.getRegistry().lookupOrThrow(registryEntry.mcKey());
+ for (final Map.Entry<ResourceKey<M>, M> entry : registry.entrySet()) {
+ final M built = filler.fill(new Conversions(new RegistryOps.HolderLookupAdapter(RegistryHelper.getRegistry())), PaperRegistries.fromNms(entry.getKey()), entry.getValue()).build();
+ final M built = registryEntry.fillBuilder(new Conversions(new RegistryOps.HolderLookupAdapter(RegistryHelper.getRegistry())), PaperRegistries.fromNms(entry.getKey()), entry.getValue()).build();
+ assertEquals(entry.getValue(), built);
+ }
+ }

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Add registry entry and builders
Feature patch
diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
index 3ec2aa5da045b62809afd2c13fc9ae74189dbdad..31d660bbbe62cd2c26715e8d90fef58b8e024e34 100644
index 86c9f87cdb41c0d1ccc2a61b501f969cfaae47bc..fd024576e70e0c121c1477a0b7777af18159b7c4 100644
--- a/src/main/java/io/papermc/paper/registry/PaperRegistries.java
+++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
@@ -2,6 +2,9 @@ package io.papermc.paper.registry;
@ -19,7 +19,7 @@ index 3ec2aa5da045b62809afd2c13fc9ae74189dbdad..31d660bbbe62cd2c26715e8d90fef58b
import io.papermc.paper.registry.entry.RegistryEntry;
import io.papermc.paper.registry.tag.TagKey;
import java.util.Collections;
@@ -81,7 +84,7 @@ public final class PaperRegistries {
@@ -78,7 +81,7 @@ public final class PaperRegistries {
static {
REGISTRY_ENTRIES = List.of(
// built-ins
@ -28,7 +28,7 @@ index 3ec2aa5da045b62809afd2c13fc9ae74189dbdad..31d660bbbe62cd2c26715e8d90fef58b
entry(Registries.STRUCTURE_TYPE, RegistryKey.STRUCTURE_TYPE, StructureType.class, CraftStructureType::new),
entry(Registries.MOB_EFFECT, RegistryKey.MOB_EFFECT, PotionEffectType.class, CraftPotionEffectType::new),
entry(Registries.BLOCK, RegistryKey.BLOCK, BlockType.class, CraftBlockType::new),
@@ -103,10 +106,10 @@ public final class PaperRegistries {
@@ -100,10 +103,10 @@ public final class PaperRegistries {
entry(Registries.TRIM_PATTERN, RegistryKey.TRIM_PATTERN, TrimPattern.class, CraftTrimPattern::new).delayed(),
entry(Registries.DAMAGE_TYPE, RegistryKey.DAMAGE_TYPE, DamageType.class, CraftDamageType::new).delayed(),
entry(Registries.WOLF_VARIANT, RegistryKey.WOLF_VARIANT, Wolf.Variant.class, CraftWolf.CraftVariant::new).delayed(),
@ -43,10 +43,10 @@ index 3ec2aa5da045b62809afd2c13fc9ae74189dbdad..31d660bbbe62cd2c26715e8d90fef58b
// api-only
diff --git a/src/main/java/io/papermc/paper/registry/data/PaperEnchantmentRegistryEntry.java b/src/main/java/io/papermc/paper/registry/data/PaperEnchantmentRegistryEntry.java
new file mode 100644
index 0000000000000000000000000000000000000000..481f5f0cfae1fada3bc3f873fb7e04c3086ea9bf
index 0000000000000000000000000000000000000000..1b1c6838452d3001070a5d43cc49e3a09de7153d
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/data/PaperEnchantmentRegistryEntry.java
@@ -0,0 +1,234 @@
@@ -0,0 +1,230 @@
+package io.papermc.paper.registry.data;
+
+import com.google.common.base.Preconditions;
@ -72,31 +72,27 @@ index 0000000000000000000000000000000000000000..481f5f0cfae1fada3bc3f873fb7e04c3
+import net.minecraft.world.item.enchantment.Enchantment;
+import org.bukkit.craftbukkit.CraftEquipmentSlot;
+import org.bukkit.inventory.ItemType;
+import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.checker.nullness.qual.Nullable;
+import org.checkerframework.framework.qual.DefaultQualifier;
+import org.jetbrains.annotations.Range;
+import org.jspecify.annotations.Nullable;
+
+import static io.papermc.paper.registry.data.util.Checks.asArgument;
+import static io.papermc.paper.registry.data.util.Checks.asArgumentMin;
+import static io.papermc.paper.registry.data.util.Checks.asConfigured;
+
+@DefaultQualifier(NonNull.class)
+public class PaperEnchantmentRegistryEntry implements EnchantmentRegistryEntry {
+
+ // Top level
+ protected @MonotonicNonNull Component description;
+ protected @Nullable Component description;
+
+ // Definition
+ protected @MonotonicNonNull HolderSet<Item> supportedItems;
+ protected @Nullable HolderSet<Item> supportedItems;
+ protected @Nullable HolderSet<Item> primaryItems;
+ protected OptionalInt weight = OptionalInt.empty();
+ protected OptionalInt maxLevel = OptionalInt.empty();
+ protected Enchantment.@MonotonicNonNull Cost minimumCost;
+ protected Enchantment.@MonotonicNonNull Cost maximumCost;
+ protected Enchantment.@Nullable Cost minimumCost;
+ protected Enchantment.@Nullable Cost maximumCost;
+ protected OptionalInt anvilCost = OptionalInt.empty();
+ protected @MonotonicNonNull List<EquipmentSlotGroup> activeSlots;
+ protected @Nullable List<EquipmentSlotGroup> activeSlots;
+
+ // Exclusive
+ protected HolderSet<Enchantment> exclusiveWith = HolderSet.empty(); // Paper added default to empty.
@ -165,13 +161,13 @@ index 0000000000000000000000000000000000000000..481f5f0cfae1fada3bc3f873fb7e04c3
+
+ @Override
+ public EnchantmentCost minimumCost() {
+ final Enchantment.@MonotonicNonNull Cost cost = asConfigured(this.minimumCost, "minimumCost");
+ final Enchantment.Cost cost = asConfigured(this.minimumCost, "minimumCost");
+ return EnchantmentRegistryEntry.EnchantmentCost.of(cost.base(), cost.perLevelAboveFirst());
+ }
+
+ @Override
+ public EnchantmentCost maximumCost() {
+ final Enchantment.@MonotonicNonNull Cost cost = asConfigured(this.maximumCost, "maximumCost");
+ final Enchantment.Cost cost = asConfigured(this.maximumCost, "maximumCost");
+ return EnchantmentRegistryEntry.EnchantmentCost.of(cost.base(), cost.perLevelAboveFirst());
+ }
+
@ -283,25 +279,22 @@ index 0000000000000000000000000000000000000000..481f5f0cfae1fada3bc3f873fb7e04c3
+}
diff --git a/src/main/java/io/papermc/paper/registry/data/PaperGameEventRegistryEntry.java b/src/main/java/io/papermc/paper/registry/data/PaperGameEventRegistryEntry.java
new file mode 100644
index 0000000000000000000000000000000000000000..18f9463ae23ba2d9c65ffb7531a87c925a5a8d6f
index 0000000000000000000000000000000000000000..2100e8aca6f7ae7b90545bd3f4d4b800dba65daa
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/data/PaperGameEventRegistryEntry.java
@@ -0,0 +1,57 @@
@@ -0,0 +1,54 @@
+package io.papermc.paper.registry.data;
+
+import io.papermc.paper.registry.PaperRegistryBuilder;
+import io.papermc.paper.registry.data.util.Conversions;
+import java.util.OptionalInt;
+import net.minecraft.world.level.gameevent.GameEvent;
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.checker.nullness.qual.Nullable;
+import org.checkerframework.framework.qual.DefaultQualifier;
+import org.jetbrains.annotations.Range;
+import org.jspecify.annotations.Nullable;
+
+import static io.papermc.paper.registry.data.util.Checks.asArgumentMin;
+import static io.papermc.paper.registry.data.util.Checks.asConfigured;
+
+@DefaultQualifier(NonNull.class)
+public class PaperGameEventRegistryEntry implements GameEventRegistryEntry {
+
+ protected OptionalInt range = OptionalInt.empty();
@ -309,11 +302,11 @@ index 0000000000000000000000000000000000000000..18f9463ae23ba2d9c65ffb7531a87c92
+ public PaperGameEventRegistryEntry(
+ final Conversions ignoredConversions,
+ final io.papermc.paper.registry.TypedKey<org.bukkit.GameEvent> ignoredKey,
+ final @Nullable GameEvent nms
+ final @Nullable GameEvent internal
+ ) {
+ if (nms == null) return;
+ if (internal == null) return;
+
+ this.range = OptionalInt.of(nms.notificationRadius());
+ this.range = OptionalInt.of(internal.notificationRadius());
+ }
+
+ @Override
@ -327,9 +320,9 @@ index 0000000000000000000000000000000000000000..18f9463ae23ba2d9c65ffb7531a87c92
+ public PaperBuilder(
+ final Conversions conversions,
+ final io.papermc.paper.registry.TypedKey<org.bukkit.GameEvent> key,
+ final @Nullable GameEvent nms
+ final @Nullable GameEvent internal
+ ) {
+ super(conversions, key, nms);
+ super(conversions, key, internal);
+ }
+
+ @Override
@ -346,7 +339,7 @@ index 0000000000000000000000000000000000000000..18f9463ae23ba2d9c65ffb7531a87c92
+}
diff --git a/src/main/java/io/papermc/paper/registry/data/PaperPaintingVariantRegistryEntry.java b/src/main/java/io/papermc/paper/registry/data/PaperPaintingVariantRegistryEntry.java
new file mode 100644
index 0000000000000000000000000000000000000000..21cb8c28c0027b4b2446279f6cf9dbedfc8945d5
index 0000000000000000000000000000000000000000..68b3d747f759f615a3c942de3f4d7a0fe856cd84
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/data/PaperPaintingVariantRegistryEntry.java
@@ -0,0 +1,120 @@
@ -385,16 +378,16 @@ index 0000000000000000000000000000000000000000..21cb8c28c0027b4b2446279f6cf9dbed
+ public PaperPaintingVariantRegistryEntry(
+ final Conversions conversions,
+ final TypedKey<Art> ignoredKey,
+ final @Nullable PaintingVariant nms
+ final @Nullable PaintingVariant internal
+ ) {
+ this.conversions = conversions;
+ if(nms == null) return;
+ if (internal == null) return;
+
+ this.width = OptionalInt.of(nms.width());
+ this.height = OptionalInt.of(nms.height());
+ this.title = nms.title().orElse(null);
+ this.author = nms.title().orElse(null);
+ this.assetId = nms.assetId();
+ this.width = OptionalInt.of(internal.width());
+ this.height = OptionalInt.of(internal.height());
+ this.title = internal.title().orElse(null);
+ this.author = internal.author().orElse(null);
+ this.assetId = internal.assetId();
+ }
+
+ @Override
@ -424,18 +417,18 @@ index 0000000000000000000000000000000000000000..21cb8c28c0027b4b2446279f6cf9dbed
+
+ public static final class PaperBuilder extends PaperPaintingVariantRegistryEntry implements PaintingVariantRegistryEntry.Builder, PaperRegistryBuilder<PaintingVariant, Art> {
+
+ public PaperBuilder(final Conversions conversions, final TypedKey<Art> key, final @Nullable PaintingVariant nms) {
+ super(conversions, key, nms);
+ public PaperBuilder(final Conversions conversions, final TypedKey<Art> key, final @Nullable PaintingVariant internal) {
+ super(conversions, key, internal);
+ }
+
+ @Override
+ public Builder width(@Range(from = 0, to = 16) final int width) {
+ public Builder width(final @Range(from = 1, to = 16) int width) {
+ this.width = OptionalInt.of(asArgumentRange(width, "width", 1, 16));
+ return this;
+ }
+
+ @Override
+ public Builder height(@Range(from = 0, to = 16) final int height) {
+ public Builder height(final @Range(from = 1, to = 16) int height) {
+ this.height = OptionalInt.of(asArgumentRange(height, "height", 1, 16));
+ return this;
+ }
@ -470,20 +463,27 @@ index 0000000000000000000000000000000000000000..21cb8c28c0027b4b2446279f6cf9dbed
+ }
+ }
+}
diff --git a/src/main/java/io/papermc/paper/registry/data/package-info.java b/src/main/java/io/papermc/paper/registry/data/package-info.java
new file mode 100644
index 0000000000000000000000000000000000000000..cfcf814eb527e6b82a2319f28df43b085ca5c168
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/data/package-info.java
@@ -0,0 +1,4 @@
+@NullMarked
+package io.papermc.paper.registry.data;
+
+import org.jspecify.annotations.NullMarked;
diff --git a/src/main/java/io/papermc/paper/registry/data/util/Checks.java b/src/main/java/io/papermc/paper/registry/data/util/Checks.java
new file mode 100644
index 0000000000000000000000000000000000000000..3241a94731fe8163876614efdcf30f8b551535af
index 0000000000000000000000000000000000000000..9d61fad3989540b77734e57935104696e3c2b5b8
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/data/util/Checks.java
@@ -0,0 +1,48 @@
@@ -0,0 +1,45 @@
+package io.papermc.paper.registry.data.util;
+
+import java.util.OptionalInt;
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.checker.nullness.qual.Nullable;
+import org.checkerframework.framework.qual.DefaultQualifier;
+import org.jspecify.annotations.Nullable;
+
+@DefaultQualifier(NonNull.class)
+public final class Checks {
+
+ public static <T> T asConfigured(final @Nullable T value, final String field) {
@ -573,44 +573,3 @@ index ac9b4328cd55a68664a3f71186bc9a7be7cd9658..ea9fe1f8b1a1685ea975eba0ca418a83
@NotNull
@Override
public NamespacedKey getKey() {
diff --git a/src/test/java/io/papermc/paper/registry/RegistryBuilderTest.java b/src/test/java/io/papermc/paper/registry/RegistryBuilderTest.java
index ceef7b5864deb1d7c6aa5630febe86ba9427bdc4..4d4632da6bf1bde85115dde2e2f7e353bd392176 100644
--- a/src/test/java/io/papermc/paper/registry/RegistryBuilderTest.java
+++ b/src/test/java/io/papermc/paper/registry/RegistryBuilderTest.java
@@ -1,11 +1,16 @@
package io.papermc.paper.registry;
+import io.papermc.paper.registry.data.PaperEnchantmentRegistryEntry;
+import io.papermc.paper.registry.data.PaperGameEventRegistryEntry;
import io.papermc.paper.registry.data.util.Conversions;
import java.util.List;
import java.util.Map;
import net.minecraft.core.Registry;
+import net.minecraft.core.registries.Registries;
import net.minecraft.resources.RegistryOps;
import net.minecraft.resources.ResourceKey;
+import net.minecraft.world.item.enchantment.Enchantment;
+import net.minecraft.world.level.gameevent.GameEvent;
import org.bukkit.support.RegistryHelper;
import org.bukkit.support.environment.AllFeatures;
import org.junit.jupiter.api.Disabled;
@@ -14,16 +19,18 @@ import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.params.provider.Arguments.arguments;
@AllFeatures
class RegistryBuilderTest {
static List<Arguments> registries() {
return List.of(
+ arguments(Registries.ENCHANTMENT, (PaperRegistryBuilder.Filler<Enchantment, org.bukkit.enchantments.Enchantment, PaperEnchantmentRegistryEntry.PaperBuilder>) PaperEnchantmentRegistryEntry.PaperBuilder::new),
+ arguments(Registries.GAME_EVENT, (PaperRegistryBuilder.Filler<GameEvent, org.bukkit.GameEvent, PaperGameEventRegistryEntry.PaperBuilder>) PaperGameEventRegistryEntry.PaperBuilder::new)
);
}
- @Disabled
@ParameterizedTest
@MethodSource("registries")
<M, T> void testEquality(final ResourceKey<? extends Registry<M>> resourceKey, final PaperRegistryBuilder.Filler<M, T, ?> filler) {

Datei anzeigen

@ -25,10 +25,10 @@ index d1d9916db7bd4886d30355e6a0ecb69cd21c2364..ddabaed899c755925ad8618b78c33dac
+ // Paper end - broadcast hurt animation
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 700751a1469dd99339e6502e96cd98e72feee803..0d3d565db8fdc30e44966492f2c30171b4dac7ec 100644
index 4b65a7967cdcc94e04fa375a6bad2c012b3b4d4b..4459d9f205222764affae053930c15f5107d4e69 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1282,6 +1282,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1284,6 +1284,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void sendHurtAnimation(float yaw) {
@ -40,7 +40,7 @@ index 700751a1469dd99339e6502e96cd98e72feee803..0d3d565db8fdc30e44966492f2c30171
if (this.getHandle().connection == null) {
return;
}
@@ -1291,7 +1296,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1293,7 +1298,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
* This makes no sense. We'll add 90 to it so that 0 = front, clockwise from there.
*/
float actualYaw = yaw + 90;
@ -49,7 +49,7 @@ index 700751a1469dd99339e6502e96cd98e72feee803..0d3d565db8fdc30e44966492f2c30171
}
@Override
@@ -3528,4 +3533,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3530,4 +3535,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void setSendViewDistance(final int viewDistance) {
throw new UnsupportedOperationException("Not implemented yet");
}

Datei anzeigen

@ -1484,7 +1484,7 @@ index 0000000000000000000000000000000000000000..2a043bb9001048f66d3a6aa8cb896b35
+}
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperItemAdventurePredicate.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperItemAdventurePredicate.java
new file mode 100644
index 0000000000000000000000000000000000000000..c7e40bd15b7063f155b2065927e8201f80fb6d0e
index 0000000000000000000000000000000000000000..e6315cd0ebd46f874284c32da9cc03eb77f0677f
--- /dev/null
+++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperItemAdventurePredicate.java
@@ -0,0 +1,75 @@
@ -1533,7 +1533,7 @@ index 0000000000000000000000000000000000000000..c7e40bd15b7063f155b2065927e8201f
+ static final class BuilderImpl implements ItemAdventurePredicate.Builder {
+
+ private final List<net.minecraft.advancements.critereon.BlockPredicate> predicates = new ObjectArrayList<>();
+ private boolean showInTooltip = net.minecraft.world.item.component.ItemAttributeModifiers.EMPTY.showInTooltip();
+ private boolean showInTooltip = true;
+
+ @Override
+ public ItemAdventurePredicate.Builder addPredicate(final BlockPredicate predicate) {
@ -3311,7 +3311,7 @@ index 0000000000000000000000000000000000000000..037a6695bdb8ee6e3c119fa79000c4ea
+}
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridgeImpl.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridgeImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..e11e7b36c0b0b499a6149c44ca2ad9f331d1b863
index 0000000000000000000000000000000000000000..eab1883d691e0d0034b7959c8130a6240c3f529c
--- /dev/null
+++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridgeImpl.java
@@ -0,0 +1,64 @@
@ -3349,10 +3349,10 @@ index 0000000000000000000000000000000000000000..e11e7b36c0b0b499a6149c44ca2ad9f3
+ }
+
+ @Override
+ public ConsumeEffect.RemoveStatusEffects removeStatusEffects(final RegistryKeySet<PotionEffectType> potionEffectTypeTagKey) {
+ public ConsumeEffect.RemoveStatusEffects removeStatusEffects(final RegistryKeySet<PotionEffectType> effectTypes) {
+ return new PaperRemoveStatusEffects(
+ new net.minecraft.world.item.consume_effects.RemoveStatusEffectsConsumeEffect(
+ PaperRegistrySets.convertToNms(Registries.MOB_EFFECT, BuiltInRegistries.BUILT_IN_CONVERSIONS.lookup(), potionEffectTypeTagKey)
+ PaperRegistrySets.convertToNms(Registries.MOB_EFFECT, BuiltInRegistries.BUILT_IN_CONVERSIONS.lookup(), effectTypes)
+ )
+ );
+ }
@ -3589,7 +3589,7 @@ index 0000000000000000000000000000000000000000..62aa1061c35d5358e6dec16a52574b42
+
+import org.jspecify.annotations.NullMarked;
diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
index 31d660bbbe62cd2c26715e8d90fef58b8e024e34..7e5d1d4f563dfd4beef9cd73b3670714c96bacaf 100644
index fd024576e70e0c121c1477a0b7777af18159b7c4..b81d0d906789ef2ff3759395821316462aacf323 100644
--- a/src/main/java/io/papermc/paper/registry/PaperRegistries.java
+++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
@@ -2,6 +2,8 @@ package io.papermc.paper.registry;
@ -3601,7 +3601,7 @@ index 31d660bbbe62cd2c26715e8d90fef58b8e024e34..7e5d1d4f563dfd4beef9cd73b3670714
import io.papermc.paper.registry.data.PaperEnchantmentRegistryEntry;
import io.papermc.paper.registry.data.PaperGameEventRegistryEntry;
import io.papermc.paper.registry.data.PaperPaintingVariantRegistryEntry;
@@ -98,6 +100,7 @@ public final class PaperRegistries {
@@ -95,6 +97,7 @@ public final class PaperRegistries {
entry(Registries.ATTRIBUTE, RegistryKey.ATTRIBUTE, Attribute.class, CraftAttribute::new),
entry(Registries.FLUID, RegistryKey.FLUID, Fluid.class, CraftFluid::new),
entry(Registries.SOUND_EVENT, RegistryKey.SOUND_EVENT, Sound.class, CraftSound::new),

Datei anzeigen

@ -13,6 +13,7 @@ Currently includes:
- Block/Biome Palette read optimisations
- StateHolder (BlockState/FluidState) property access optimisations
- Basic Fluid property read optimisations
- Entity/Level random replacement
See https://github.com/Tuinity/Moonrise
@ -364,6 +365,19 @@ index 49fe9eed5d5d08abd6e9778fe0d0545f35552435..fc029c8fb22a7c8eeb23bfc171812f6d
}
private ChunkSystem() {}
diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/ThreadUnsafeRandom.java b/src/main/java/ca/spottedleaf/moonrise/common/util/ThreadUnsafeRandom.java
index 12eb3add0931a4d77acdf6e875c42dda9c313dc3..5239993a681d6113eec99fa627b85508656ed7ac 100644
--- a/src/main/java/ca/spottedleaf/moonrise/common/util/ThreadUnsafeRandom.java
+++ b/src/main/java/ca/spottedleaf/moonrise/common/util/ThreadUnsafeRandom.java
@@ -9,7 +9,7 @@ import net.minecraft.world.level.levelgen.PositionalRandomFactory;
/**
* Avoid costly CAS of superclass
*/
-public final class ThreadUnsafeRandom implements BitRandomSource {
+public class ThreadUnsafeRandom implements BitRandomSource { // Paper - replace random
private static final long MULTIPLIER = 25214903917L;
private static final long ADDEND = 11L;
diff --git a/src/main/java/ca/spottedleaf/moonrise/paper/PaperHooks.java b/src/main/java/ca/spottedleaf/moonrise/paper/PaperHooks.java
index c8f2457ab3b28f2c3a6b500bcea40261669c24a4..ca8b6a926dfff3fdd6b04228809a4480366120b2 100644
--- a/src/main/java/ca/spottedleaf/moonrise/paper/PaperHooks.java
@ -23206,10 +23220,10 @@ index 0000000000000000000000000000000000000000..85950a1aa732ab8c01ad28bec9e0de14
+ }
+}
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index 46c37c8db8ecf3cc808fcf59f6bee5fe6ca49b75..cbd0f2c6636b8ae332f20a3cb763b06855dfe795 100644
index 2d2ff826354670fef356e241d939080c9ed3fd4a..17e23ca4dd2bbfba49ea00aa2b719a95feb931be 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -219,6 +219,23 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -217,6 +217,23 @@ public class GlobalConfiguration extends ConfigurationPart {
@PostProcess
private void postProcess() {
ca.spottedleaf.moonrise.common.util.MoonriseCommon.adjustWorkerThreads(this.workerThreads, this.ioThreads);
@ -24158,7 +24172,7 @@ index d9ad32acdf46a43a649334a3b736aeb7b3af21d1..fae17a075d7efaf24d916877dd5968eb
public static final int RADIUS_AROUND_FULL_CHUNK = FULL_CHUNK_STEP.accumulatedDependencies().getRadius();
public static final int MAX_LEVEL = 33 + RADIUS_AROUND_FULL_CHUNK;
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 7317c353edab8b11d9d94e257f968ac49284f47a..cb3850939955ae068d4776c835522e0b8f228984 100644
index 7317c353edab8b11d9d94e257f968ac49284f47a..c185f634b962c40047696ec0df50eb88af3ac389 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -108,7 +108,7 @@ import org.slf4j.Logger;
@ -25441,7 +25455,7 @@ index 7317c353edab8b11d9d94e257f968ac49284f47a..cb3850939955ae068d4776c835522e0b
- Iterator iterator = this.entity.getIndirectPassengers().iterator();
+ // Paper start - optimise entity tracker
+ final Entity entity = this.entity;
+ int range = ca.spottedleaf.moonrise.common.PlatformHooks.get().modifyEntityTrackingRange(entity, this.range);
+ int range = this.range;
- while (iterator.hasNext()) {
- Entity entity = (Entity) iterator.next();
@ -26285,7 +26299,7 @@ index 65206fdfa5b94eaca139e433b4865c16b16641f3..bf4463bcb5dc439ac5a3fa08dd60845a
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 0a895055ec7f61d3cb52d303bbe3f89486a322e7..10a9406e96ab0ab2404c0e0a9bef08e86a6a12a2 100644
index 0a895055ec7f61d3cb52d303bbe3f89486a322e7..56a109dc832c231bf8470f46e1ff37565e9fdd7a 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -52,7 +52,7 @@ import net.minecraft.world.level.storage.DimensionDataStorage;
@ -26366,7 +26380,7 @@ index 0a895055ec7f61d3cb52d303bbe3f89486a322e7..10a9406e96ab0ab2404c0e0a9bef08e8
+ }
+ // Paper end - rewrite chunk system
+ // Paper start - chunk tick iteration optimisations
+ private final ca.spottedleaf.moonrise.common.util.SimpleRandom shuffleRandom = new ca.spottedleaf.moonrise.common.util.SimpleRandom(0L);
+ private final ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom shuffleRandom = new ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom(0L);
+ private boolean isChunkNearPlayer(final ChunkMap chunkMap, final ChunkPos chunkPos, final LevelChunk levelChunk) {
+ final ca.spottedleaf.moonrise.patches.chunk_system.level.chunk.ChunkData chunkData = ((ca.spottedleaf.moonrise.patches.chunk_system.level.chunk.ChunkSystemChunkHolder)((ca.spottedleaf.moonrise.patches.chunk_system.level.chunk.ChunkSystemLevelChunk)levelChunk).moonrise$getChunkAndHolder().holder())
+ .moonrise$getRealChunkHolder().holderData;
@ -26801,7 +26815,7 @@ index b2fd3e936559c8fcb8b02ae3ef63c4f3bd0edb08..5bbc7ceaafc163f12344e5d5d355ad2f
if (!list.equals(this.lastPassengers)) {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index c5f3e4dff83a85a3a5f29534afd84d4a332b1d3e..85c58214c13208ed30f0ae4a2722f172184123ab 100644
index c5f3e4dff83a85a3a5f29534afd84d4a332b1d3e..9928e14a5a42a2f0deba86e9dcb1f6f9f59412ef 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -185,7 +185,7 @@ import org.bukkit.event.weather.LightningStrikeEvent;
@ -27232,12 +27246,12 @@ index c5f3e4dff83a85a3a5f29534afd84d4a332b1d3e..85c58214c13208ed30f0ae4a2722f172
}
+ // Paper start - optimise random ticking
+ private final ca.spottedleaf.moonrise.common.util.SimpleRandom simpleRandom = new ca.spottedleaf.moonrise.common.util.SimpleRandom(0L);
+ private final ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom simpleRandom = new ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom(net.minecraft.world.level.levelgen.RandomSupport.generateUniqueSeed());
+
+ private void optimiseRandomTick(final LevelChunk chunk, final int tickSpeed) {
+ final LevelChunkSection[] sections = chunk.getSections();
+ final int minSection = ca.spottedleaf.moonrise.common.util.WorldUtil.getMinSection((ServerLevel)(Object)this);
+ final ca.spottedleaf.moonrise.common.util.SimpleRandom simpleRandom = this.simpleRandom;
+ final ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom simpleRandom = this.simpleRandom;
+ final boolean doubleTickFluids = !ca.spottedleaf.moonrise.common.PlatformHooks.get().configFixMC224294();
+
+ final ChunkPos cpos = chunk.getPos();
@ -27284,7 +27298,7 @@ index c5f3e4dff83a85a3a5f29534afd84d4a332b1d3e..85c58214c13208ed30f0ae4a2722f172
+ // Paper end - optimise random ticking
+
public void tickChunk(LevelChunk chunk, int randomTickSpeed) {
+ final ca.spottedleaf.moonrise.common.util.SimpleRandom simpleRandom = this.simpleRandom; // Paper - optimise random ticking
+ final ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom simpleRandom = this.simpleRandom; // Paper - optimise random ticking
ChunkPos chunkcoordintpair = chunk.getPos();
boolean flag = this.isRaining();
int j = chunkcoordintpair.getMinBlockX();
@ -27566,7 +27580,7 @@ index c5f3e4dff83a85a3a5f29534afd84d4a332b1d3e..85c58214c13208ed30f0ae4a2722f172
return crashreportsystemdetails;
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 08a82b7a3456f58b3d0fdbb8e8dbce6972ad1672..dda53c52fab7c02f39451335fe0bfe36852ac994 100644
index f6e130aba66935f808dcfd7ef987131092ddfe4e..2b6c5b2387b67f25d8877849ccbfaaa77eab51d3 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -218,7 +218,7 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
@ -28437,7 +28451,7 @@ index 50040c497a819cd1229042ab3cb057d34a32cacc..1f9c436a632e4f110be61cf76fcfc3b7
+ // Paper end - block counting
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 5949cbccb569ab1d518508d200e69ad9d7d0ba9a..a9e1ae7ad0b81e7488cb07876b32d7ba0a170365 100644
index 5949cbccb569ab1d518508d200e69ad9d7d0ba9a..b810f887e536af938f978ca2af068e6ae89b5e60 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -176,7 +176,7 @@ import org.bukkit.event.player.PlayerTeleportEvent;
@ -28449,7 +28463,89 @@ index 5949cbccb569ab1d518508d200e69ad9d7d0ba9a..a9e1ae7ad0b81e7488cb07876b32d7ba
// CraftBukkit start
private static final int CURRENT_LEVEL = 2;
@@ -461,6 +461,156 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -187,7 +187,17 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
// Paper start - Share random for entities to make them more random
public static RandomSource SHARED_RANDOM = new RandomRandomSource();
- private static final class RandomRandomSource extends java.util.Random implements net.minecraft.world.level.levelgen.BitRandomSource {
+ // Paper start - replace random
+ private static final class RandomRandomSource extends ca.spottedleaf.moonrise.common.util.ThreadUnsafeRandom {
+ public RandomRandomSource() {
+ this(net.minecraft.world.level.levelgen.RandomSupport.generateUniqueSeed());
+ }
+
+ public RandomRandomSource(long seed) {
+ super(seed);
+ }
+
+ // Paper end - replace random
private boolean locked = false;
@Override
@@ -200,61 +210,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
}
- @Override
- public RandomSource fork() {
- return new net.minecraft.world.level.levelgen.LegacyRandomSource(this.nextLong());
- }
-
- @Override
- public net.minecraft.world.level.levelgen.PositionalRandomFactory forkPositional() {
- return new net.minecraft.world.level.levelgen.LegacyRandomSource.LegacyPositionalRandomFactory(this.nextLong());
- }
-
- // these below are added to fix reobf issues that I don't wanna deal with right now
- @Override
- public int next(int bits) {
- return super.next(bits);
- }
-
- @Override
- public int nextInt(int origin, int bound) {
- return net.minecraft.world.level.levelgen.BitRandomSource.super.nextInt(origin, bound);
- }
-
- @Override
- public long nextLong() {
- return net.minecraft.world.level.levelgen.BitRandomSource.super.nextLong();
- }
-
- @Override
- public int nextInt() {
- return net.minecraft.world.level.levelgen.BitRandomSource.super.nextInt();
- }
-
- @Override
- public int nextInt(int bound) {
- return net.minecraft.world.level.levelgen.BitRandomSource.super.nextInt(bound);
- }
-
- @Override
- public boolean nextBoolean() {
- return net.minecraft.world.level.levelgen.BitRandomSource.super.nextBoolean();
- }
-
- @Override
- public float nextFloat() {
- return net.minecraft.world.level.levelgen.BitRandomSource.super.nextFloat();
- }
-
- @Override
- public double nextDouble() {
- return net.minecraft.world.level.levelgen.BitRandomSource.super.nextDouble();
- }
-
- @Override
- public double nextGaussian() {
- return super.nextGaussian();
- }
+ // Paper - replace random
}
// Paper end - Share random for entities to make them more random
public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; // Paper - Entity#getEntitySpawnReason
@@ -461,6 +417,156 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return this.dimensions.makeBoundingBox(x, y, z);
}
// Paper end
@ -28606,7 +28702,7 @@ index 5949cbccb569ab1d518508d200e69ad9d7d0ba9a..a9e1ae7ad0b81e7488cb07876b32d7ba
public Entity(EntityType<?> type, Level world) {
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
@@ -1366,41 +1516,76 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -1366,41 +1472,76 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
private Vec3 collide(Vec3 movement) {
@ -28632,22 +28728,17 @@ index 5949cbccb569ab1d518508d200e69ad9d7d0ba9a..a9e1ae7ad0b81e7488cb07876b32d7ba
+ if (xZero & yZero & zZero) {
+ return movement;
+ }
+
+ final AABB currentBox = this.getBoundingBox();
+
+ final List<VoxelShape> potentialCollisionsVoxel = new ArrayList<>();
+ final List<AABB> potentialCollisionsBB = new ArrayList<>();
- List<VoxelShape> list1 = Entity.collectColliders(this, this.level, list, axisalignedbb2);
- float f = (float) vec3d1.y;
- float[] afloat = Entity.collectCandidateStepUpHeights(axisalignedbb1, list1, this.maxUpStep(), f);
- float[] afloat1 = afloat;
- int i = afloat.length;
+ final AABB currentBox = this.getBoundingBox();
- for (int j = 0; j < i; ++j) {
- float f1 = afloat1[j];
- Vec3 vec3d2 = Entity.collideWithShapes(new Vec3(movement.x, (double) f1, movement.z), axisalignedbb1, list1);
+ final List<VoxelShape> potentialCollisionsVoxel = new ArrayList<>();
+ final List<AABB> potentialCollisionsBB = new ArrayList<>();
- if (vec3d2.horizontalDistanceSqr() > vec3d1.horizontalDistanceSqr()) {
- double d0 = axisalignedbb.minY - axisalignedbb1.minY;
+ final AABB initialCollisionBox;
+ if (xZero & zZero) {
+ // note: xZero & zZero -> collision on x/z == 0 -> no step height calculation
@ -28658,20 +28749,25 @@ index 5949cbccb569ab1d518508d200e69ad9d7d0ba9a..a9e1ae7ad0b81e7488cb07876b32d7ba
+ initialCollisionBox = currentBox.expandTowards(movement);
+ }
- return vec3d2.add(0.0D, -d0, 0.0D);
- }
- for (int j = 0; j < i; ++j) {
- float f1 = afloat1[j];
- Vec3 vec3d2 = Entity.collideWithShapes(new Vec3(movement.x, (double) f1, movement.z), axisalignedbb1, list1);
+ final List<AABB> entityAABBs = new ArrayList<>();
+ ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.getEntityHardCollisions(
+ this.level, (Entity)(Object)this, initialCollisionBox, entityAABBs, 0, null
+ );
+
- if (vec3d2.horizontalDistanceSqr() > vec3d1.horizontalDistanceSqr()) {
- double d0 = axisalignedbb.minY - axisalignedbb1.minY;
+ ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.getCollisionsForBlocksOrWorldBorder(
+ this.level, (Entity)(Object)this, initialCollisionBox, potentialCollisionsVoxel, potentialCollisionsBB,
+ ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_FLAG_CHECK_BORDER, null
+ );
+ potentialCollisionsBB.addAll(entityAABBs);
+ final Vec3 collided = ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.performCollisions(movement, currentBox, potentialCollisionsVoxel, potentialCollisionsBB);
+
- return vec3d2.add(0.0D, -d0, 0.0D);
- }
+ final boolean collidedX = collided.x != movement.x;
+ final boolean collidedY = collided.y != movement.y;
+ final boolean collidedZ = collided.z != movement.z;
@ -28711,7 +28807,7 @@ index 5949cbccb569ab1d518508d200e69ad9d7d0ba9a..a9e1ae7ad0b81e7488cb07876b32d7ba
}
private static float[] collectCandidateStepUpHeights(AABB collisionBox, List<VoxelShape> collisions, float f, float stepHeight) {
@@ -2788,18 +2973,110 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2788,18 +2929,110 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public boolean isInWall() {
@ -28829,7 +28925,7 @@ index 5949cbccb569ab1d518508d200e69ad9d7d0ba9a..a9e1ae7ad0b81e7488cb07876b32d7ba
}
public InteractionResult interact(Player player, InteractionHand hand) {
@@ -4272,14 +4549,17 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4272,14 +4505,17 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public Iterable<Entity> getIndirectPassengers() {
@ -28854,7 +28950,7 @@ index 5949cbccb569ab1d518508d200e69ad9d7d0ba9a..a9e1ae7ad0b81e7488cb07876b32d7ba
}
private Iterable<Entity> getIndirectPassengers_old() {
// Paper end - Optimize indirect passenger iteration
@@ -4437,82 +4717,136 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4437,82 +4673,136 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return Mth.lerp(delta, this.yRotO, this.yRot);
}
@ -28955,7 +29051,9 @@ index 5949cbccb569ab1d518508d200e69ad9d7d0ba9a..a9e1ae7ad0b81e7488cb07876b32d7ba
+ final int maxZIterate = currChunkZ == maxChunkZ ? (maxBlockZ & 15) : 15;
+ final int minYIterate = currChunkY == minChunkY ? (minBlockY & 15) : 0;
+ final int maxYIterate = currChunkY == maxChunkY ? (maxBlockY & 15) : 15;
+
- vec3d = vec3d.add(vec3d1);
- ++k1;
+ for (int currY = minYIterate; currY <= maxYIterate; ++currY) {
+ for (int currZ = minZIterate; currZ <= maxZIterate; ++currZ) {
+ for (int currX = minXIterate; currX <= maxXIterate; ++currX) {
@ -28963,21 +29061,19 @@ index 5949cbccb569ab1d518508d200e69ad9d7d0ba9a..a9e1ae7ad0b81e7488cb07876b32d7ba
+
+ if (fluidState.isEmpty() || !fluidState.is(fluid)) {
+ continue;
+ }
}
- // CraftBukkit start - store last lava contact location
- if (tag == FluidTags.LAVA) {
- this.lastLavaContact = blockposition_mutableblockposition.immutable();
+
+ mutablePos.set(currX | (currChunkX << 4), currY | (currChunkY << 4), currZ | (currChunkZ << 4));
- vec3d = vec3d.add(vec3d1);
- ++k1;
+
+ final double height = (double)((float)mutablePos.getY() + fluidState.getHeight(world, mutablePos));
+ final double diff = height - boundingBox.minY;
+
+ if (diff < 0.0) {
+ continue;
}
- // CraftBukkit start - store last lava contact location
- if (tag == FluidTags.LAVA) {
- this.lastLavaContact = blockposition_mutableblockposition.immutable();
+ }
+
+ inFluid = true;
+ maxHeightDiff = Math.max(maxHeightDiff, diff);
@ -29049,7 +29145,7 @@ index 5949cbccb569ab1d518508d200e69ad9d7d0ba9a..a9e1ae7ad0b81e7488cb07876b32d7ba
public boolean touchingUnloadedChunk() {
AABB axisalignedbb = this.getBoundingBox().inflate(1.0D);
@@ -4664,6 +4998,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4664,6 +4954,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.setPosRaw(x, y, z, false);
}
public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) {
@ -29065,7 +29161,7 @@ index 5949cbccb569ab1d518508d200e69ad9d7d0ba9a..a9e1ae7ad0b81e7488cb07876b32d7ba
if (!checkPosition(this, x, y, z)) {
return;
}
@@ -4793,6 +5136,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4793,6 +5092,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@Override
public final void setRemoved(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) {
@ -29078,7 +29174,7 @@ index 5949cbccb569ab1d518508d200e69ad9d7d0ba9a..a9e1ae7ad0b81e7488cb07876b32d7ba
CraftEventFactory.callEntityRemoveEvent(this, cause);
// CraftBukkit end
final boolean alreadyRemoved = this.removalReason != null; // Paper - Folia schedulers
@@ -4804,7 +5153,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4804,7 +5109,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.stopRiding();
}
@ -29087,7 +29183,7 @@ index 5949cbccb569ab1d518508d200e69ad9d7d0ba9a..a9e1ae7ad0b81e7488cb07876b32d7ba
this.levelCallback.onRemove(entity_removalreason);
this.onRemoval(entity_removalreason);
// Paper start - Folia schedulers
@@ -4836,7 +5185,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4836,7 +5141,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@Override
public boolean shouldBeSaved() {
@ -29486,7 +29582,7 @@ index e185a33b5b1f8e8e0a0e666b24ba3e9186a8a7ff..5d7a6e4b73f032db356e7ec369b15001
// Paper start - Affects Spawning API
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 078088a854d466e66411d25d6dd6bcc536db78f3..86cd6e1b8f68dd0564ee2a7c60f02d7af287af67 100644
index 078088a854d466e66411d25d6dd6bcc536db78f3..061d3e77fe8d9322eb660ac1995e025aba51ae1a 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -83,6 +83,7 @@ import net.minecraft.world.level.storage.LevelData;
@ -29506,6 +29602,15 @@ index 078088a854d466e66411d25d6dd6bcc536db78f3..86cd6e1b8f68dd0564ee2a7c60f02d7a
public static final Codec<ResourceKey<Level>> RESOURCE_KEY_CODEC = ResourceKey.codec(Registries.DIMENSION);
public static final ResourceKey<Level> OVERWORLD = ResourceKey.create(Registries.DIMENSION, ResourceLocation.withDefaultNamespace("overworld"));
@@ -130,7 +131,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public float rainLevel;
protected float oThunderLevel;
public float thunderLevel;
- public final RandomSource random = RandomSource.create();
+ public final RandomSource random = new ca.spottedleaf.moonrise.common.util.ThreadUnsafeRandom(net.minecraft.world.level.levelgen.RandomSupport.generateUniqueSeed()); // Paper - replace random
/** @deprecated */
@Deprecated
private final RandomSource threadSafeRandom = RandomSource.createThreadSafe();
@@ -206,7 +207,639 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public abstract ResourceKey<LevelStem> getTypeKey();
@ -36027,10 +36132,10 @@ index f65cc95ab28e8a3b21eac2b16bd9ebe97e56e571..0074bc0e7147dc3a8c538e796f14ac9b
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 758d86865136e5ef58f401f00c5e62fbb8cf25a3..6323738fe96c8e815a0835e6d8b03125c36ecf90 100644
index 87477ad186b5f692a39f323a618d016b669d8051..1df118625aeb57f3353c40f9552f00d2f34fc655 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1432,7 +1432,7 @@ public final class CraftServer implements Server {
@@ -1444,7 +1444,7 @@ public final class CraftServer implements Server {
// Paper - Put world into worldlist before initing the world; move up
this.getServer().prepareLevels(internal.getChunkSource().chunkMap.progressListener, internal);
@ -36039,7 +36144,7 @@ index 758d86865136e5ef58f401f00c5e62fbb8cf25a3..6323738fe96c8e815a0835e6d8b03125
this.pluginManager.callEvent(new WorldLoadEvent(internal.getWorld()));
return internal.getWorld();
@@ -1477,7 +1477,7 @@ public final class CraftServer implements Server {
@@ -1489,7 +1489,7 @@ public final class CraftServer implements Server {
}
handle.getChunkSource().close(save);
@ -36048,7 +36153,7 @@ index 758d86865136e5ef58f401f00c5e62fbb8cf25a3..6323738fe96c8e815a0835e6d8b03125
handle.convertable.close();
} catch (Exception ex) {
this.getLogger().log(Level.SEVERE, null, ex);
@@ -2515,7 +2515,7 @@ public final class CraftServer implements Server {
@@ -2527,7 +2527,7 @@ public final class CraftServer implements Server {
@Override
public boolean isPrimaryThread() {
@ -36160,10 +36265,10 @@ index 4a5a0e33af16369f665bf39e70238e4e5a5486da..696152286a4d16fa51a23ff6e15fb297
// Paper start - implement pointers
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 0d3d565db8fdc30e44966492f2c30171b4dac7ec..4f1b3b38d1eec331ab67307eb0e9e62621ce3cd5 100644
index 5989a9af8840e1bdb5c7a25a44473e2ab597e1e5..e1f20b5b9ebc5d9870136aa2c77d887094bd4b6e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -3511,7 +3511,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3513,7 +3513,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void setViewDistance(final int viewDistance) {
@ -36174,7 +36279,7 @@ index 0d3d565db8fdc30e44966492f2c30171b4dac7ec..4f1b3b38d1eec331ab67307eb0e9e626
}
@Override
@@ -3521,7 +3523,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3523,7 +3525,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void setSimulationDistance(final int simulationDistance) {
@ -36185,7 +36290,7 @@ index 0d3d565db8fdc30e44966492f2c30171b4dac7ec..4f1b3b38d1eec331ab67307eb0e9e626
}
@Override
@@ -3531,7 +3535,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3533,7 +3537,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void setSendViewDistance(final int viewDistance) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] API for checking sent chunks
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 4f1b3b38d1eec331ab67307eb0e9e62621ce3cd5..d0010dfd22463986bf3be9b3ee015ce92735753e 100644
index 73de1c68e92bf6b17cbb5cd49447bc98ae0fb650..a6dd30f0267a4c8bdc58d8745782a8862aabeba6 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -3498,6 +3498,35 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3500,6 +3500,35 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
// Paper end

Datei anzeigen

@ -78,7 +78,7 @@ index f7197f1347251a37dd0f6d9ffa2f09bc3a4e1233..1f7f68aad97ee73763c042837f239bdc
});
throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 85c58214c13208ed30f0ae4a2722f172184123ab..ff79925649ac1ceb6121c4b74fdb65f5f138f689 100644
index 9928e14a5a42a2f0deba86e9dcb1f6f9f59412ef..d81be1069ef6ce51789df38ce21f125b6d524945 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1253,7 +1253,26 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@ -123,10 +123,10 @@ index 85c58214c13208ed30f0ae4a2722f172184123ab..ff79925649ac1ceb6121c4b74fdb65f5
private void tickPassenger(Entity vehicle, Entity passenger, boolean isActive) { // Paper - EAR 2
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index a9e1ae7ad0b81e7488cb07876b32d7ba0a170365..8be1b051543cda2b2e9e3d337834757e53f442de 100644
index b810f887e536af938f978ca2af068e6ae89b5e60..8c62d1aa5c8a062685474dca7e91bf9f8b004ca5 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1172,8 +1172,43 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -1128,8 +1128,43 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return this.onGround;
}
@ -170,7 +170,7 @@ index a9e1ae7ad0b81e7488cb07876b32d7ba0a170365..8be1b051543cda2b2e9e3d337834757e
if (this.noPhysics) {
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
} else {
@@ -1294,6 +1329,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -1250,6 +1285,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
gameprofilerfiller.pop();
}
}
@ -184,7 +184,7 @@ index a9e1ae7ad0b81e7488cb07876b32d7ba0a170365..8be1b051543cda2b2e9e3d337834757e
}
private void applyMovementEmissionAndPlaySound(Entity.MovementEmission moveEffect, Vec3 movement, BlockPos landingPos, BlockState landingState) {
@@ -4916,7 +4958,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4872,7 +4914,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void setDeltaMovement(Vec3 velocity) {
@ -194,7 +194,7 @@ index a9e1ae7ad0b81e7488cb07876b32d7ba0a170365..8be1b051543cda2b2e9e3d337834757e
}
public void addDeltaMovement(Vec3 velocity) {
@@ -5022,7 +5066,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4978,7 +5022,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
// Paper end - Fix MC-4
if (this.position.x != x || this.position.y != y || this.position.z != z) {

Datei anzeigen

@ -364,7 +364,7 @@ index c06863578c5d654706d93e73059d89c12ae502a5..17a158ff6ce6520b69a5a0032ba4c054
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 6323738fe96c8e815a0835e6d8b03125c36ecf90..806e56cb60235a99f468d36a059fdbd54c2d46e3 100644
index 1df118625aeb57f3353c40f9552f00d2f34fc655..11ff5f3b5cd25f0ad6ca944d59bca8434f8510d8 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -312,6 +312,7 @@ public final class CraftServer implements Server {
@ -375,7 +375,7 @@ index 6323738fe96c8e815a0835e6d8b03125c36ecf90..806e56cb60235a99f468d36a059fdbd5
// Paper start - Folia region threading API
private final io.papermc.paper.threadedregions.scheduler.FallbackRegionScheduler regionizedScheduler = new io.papermc.paper.threadedregions.scheduler.FallbackRegionScheduler();
@@ -477,6 +478,7 @@ public final class CraftServer implements Server {
@@ -489,6 +490,7 @@ public final class CraftServer implements Server {
}
this.potionBrewer = new io.papermc.paper.potion.PaperPotionBrewer(console); // Paper - custom potion mixes
datapackManager = new io.papermc.paper.datapack.PaperDatapackManager(console.getPackRepository()); // Paper
@ -383,7 +383,7 @@ index 6323738fe96c8e815a0835e6d8b03125c36ecf90..806e56cb60235a99f468d36a059fdbd5
}
public boolean getCommandBlockOverride(String command) {
@@ -1103,6 +1105,7 @@ public final class CraftServer implements Server {
@@ -1115,6 +1117,7 @@ public final class CraftServer implements Server {
this.reloadData();
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
@ -391,7 +391,7 @@ index 6323738fe96c8e815a0835e6d8b03125c36ecf90..806e56cb60235a99f468d36a059fdbd5
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
@@ -1131,6 +1134,7 @@ public final class CraftServer implements Server {
@@ -1143,6 +1146,7 @@ public final class CraftServer implements Server {
this.loadPlugins();
this.enablePlugins(PluginLoadOrder.STARTUP);
this.enablePlugins(PluginLoadOrder.POSTWORLD);

Datei anzeigen

@ -20,7 +20,7 @@ index b525369fb6f3bb80c1553ae41b1e3bddeda29936..2e8ecf3bbb9f9ceba6f896738fa1ab8e
if (entityenderpearl.isRemoved()) {
ServerPlayer.LOGGER.warn("Trying to save removed ender pearl, skipping");
@@ -3146,7 +3147,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
@@ -3143,7 +3144,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
}
public static long placeEnderPearlTicket(ServerLevel world, ChunkPos chunkPos) {

Datei anzeigen

@ -20,10 +20,10 @@ index 64b56abf8900d0424100da460fc68ac964394793..5d070f036dae6d93f863c55192b55741
+ // Paper end - API to check if the server is sleeping
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 806e56cb60235a99f468d36a059fdbd54c2d46e3..605662917a7720a6c5134fd1d93aa2d26116b76d 100644
index 11ff5f3b5cd25f0ad6ca944d59bca8434f8510d8..7afc3d4244c096f78d48338da2eb65c4e834b6f1 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -3246,4 +3246,11 @@ public final class CraftServer implements Server {
@@ -3258,4 +3258,11 @@ public final class CraftServer implements Server {
return this.potionBrewer;
}
// Paper end

Datei anzeigen

@ -5,14 +5,14 @@ Subject: [PATCH] API to allow/disallow tick sleeping
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 5d070f036dae6d93f863c55192b557419634456d..663b4ecd520e82aa108d44f2d5c2a20cfc7bc01f 100644
index 5d070f036dae6d93f863c55192b557419634456d..c26e3a239441376f2694782d4f07943538677c71 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -332,6 +332,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public volatile Thread shutdownThread; // Paper
public volatile boolean abnormalExit = false; // Paper
public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation
+ private List<String> pluginsBlockingSleep = new ArrayList<>(); // Paper - API to allow/disallow tick sleeping
+ private final Set<String> pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
AtomicReference<S> atomicreference = new AtomicReference();
@ -51,10 +51,10 @@ index 5d070f036dae6d93f863c55192b557419634456d..663b4ecd520e82aa108d44f2d5c2a20c
// Paper end - API to check if the server is sleeping
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 605662917a7720a6c5134fd1d93aa2d26116b76d..cac8592e3a2f438fe9ca167a4fdcd65152bbb2de 100644
index 7afc3d4244c096f78d48338da2eb65c4e834b6f1..ac8af406180bc680d46e8edc3da0fc2e5211345a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -3252,5 +3252,10 @@ public final class CraftServer implements Server {
@@ -3264,5 +3264,10 @@ public final class CraftServer implements Server {
public boolean isPaused() {
return this.console.isTickPaused();
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable Entity Despawn Time
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 8be1b051543cda2b2e9e3d337834757e53f442de..ed5b00620527c1776722d25b1b45f1544802a341 100644
index 8c62d1aa5c8a062685474dca7e91bf9f8b004ca5..a15546e433ebba6c0de01bdaaef201a3d99a87b5 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -432,6 +432,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -388,6 +388,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
private UUID originWorld;
public boolean freezeLocked = false; // Paper - Freeze Tick Lock API
public boolean fixedPose = false; // Paper - Expand Pose API
@ -16,7 +16,7 @@ index 8be1b051543cda2b2e9e3d337834757e53f442de..ed5b00620527c1776722d25b1b45f154
public void setOrigin(@javax.annotation.Nonnull Location location) {
this.origin = location.toVector();
@@ -614,6 +615,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -570,6 +571,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public Entity(EntityType<?> type, Level world) {
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
@ -24,7 +24,7 @@ index 8be1b051543cda2b2e9e3d337834757e53f442de..ed5b00620527c1776722d25b1b45f154
this.passengers = ImmutableList.of();
this.deltaMovement = Vec3.ZERO;
this.bb = Entity.INITIAL_AABB;
@@ -912,6 +914,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -868,6 +870,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void tick() {

Datei anzeigen

@ -5,48 +5,28 @@ Subject: [PATCH] Expanded Art API
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftArt.java b/src/main/java/org/bukkit/craftbukkit/CraftArt.java
index 40af940193d0df66bbcdcf5f46132e304016a4d7..932118f5e5bfc765c852acaf21f9721d8fa5fb6a 100644
index 40af940193d0df66bbcdcf5f46132e304016a4d7..9d73954282104a6e315c1840feb7d6034d27cfbe 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftArt.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftArt.java
@@ -42,6 +42,9 @@ public class CraftArt implements Art, Handleable<PaintingVariant> {
private final NamespacedKey key;
private final PaintingVariant paintingVariant;
+ private final net.kyori.adventure.text.@org.jspecify.annotations.Nullable Component adventureTitle; // Paper - name and author components, assetId key
+ private final net.kyori.adventure.text.@org.jspecify.annotations.Nullable Component adventureAuthor; // Paper - name and author components, assetId key
+ private final net.kyori.adventure.key.@org.jspecify.annotations.NonNull Key adventureAssetId; // Paper - name and author components, assetId key
private final String name;
private final int ordinal;
@@ -58,6 +61,9 @@ public class CraftArt implements Art, Handleable<PaintingVariant> {
this.name = key.toString();
}
this.ordinal = CraftArt.count++;
+ this.adventureTitle = paintingVariant.title().map(io.papermc.paper.adventure.PaperAdventure::asAdventure).orElse(null); // Paper - name and author components, assetId key
+ this.adventureAuthor = paintingVariant.author().map(io.papermc.paper.adventure.PaperAdventure::asAdventure).orElse(null); // Paper - name and author components, assetId key
+ this.adventureAssetId = io.papermc.paper.adventure.PaperAdventure.asAdventure(paintingVariant.assetId()); // Paper - name and author components, assetId key
}
@Override
@@ -75,6 +81,22 @@ public class CraftArt implements Art, Handleable<PaintingVariant> {
@@ -75,6 +75,22 @@ public class CraftArt implements Art, Handleable<PaintingVariant> {
return this.paintingVariant.height();
}
+ // Paper start - name and author components, assetId key
+ // Paper start - Expand Art API
+ @Override
+ public net.kyori.adventure.text.@org.jetbrains.annotations.Nullable Component title() {
+ return this.adventureTitle;
+ public net.kyori.adventure.text.Component title() {
+ return this.paintingVariant.title().map(io.papermc.paper.adventure.PaperAdventure::asAdventure).orElse(null);
+ }
+
+ @Override
+ public net.kyori.adventure.text.@org.jetbrains.annotations.Nullable Component author() {
+ return this.adventureAuthor;
+ public net.kyori.adventure.text.Component author() {
+ return this.paintingVariant.author().map(io.papermc.paper.adventure.PaperAdventure::asAdventure).orElse(null);
+ }
+
+ public net.kyori.adventure.key.@org.jspecify.annotations.NonNull Key assetId() {
+ return this.adventureAssetId;
+ public net.kyori.adventure.key.Key assetId() {
+ return io.papermc.paper.adventure.PaperAdventure.asAdventure(this.paintingVariant.assetId());
+ }
+ // Paper end - name and author components, assetId key
+ // Paper end - Expand Art API
+
@Override
public int getId() {