-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix/disabling-vanilla-registry-values
- Loading branch information
Showing
46 changed files
with
994 additions
and
388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
paper-api/src/main/java/io/papermc/paper/entity/EntitySerializationFlag.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package io.papermc.paper.entity; | ||
|
||
import org.bukkit.UnsafeValues; | ||
import org.bukkit.entity.Entity; | ||
import org.bukkit.entity.Player; | ||
|
||
/** | ||
* Represents flags for entity serialization. | ||
* | ||
* @see UnsafeValues#serializeEntity(Entity, EntitySerializationFlag... serializationFlags) | ||
* @since 1.21.4 | ||
*/ | ||
public enum EntitySerializationFlag { | ||
|
||
/** | ||
* Serialize entities that wouldn't be serialized normally | ||
* (e.g. dead, despawned, non-persistent, etc.). | ||
* | ||
* @see Entity#isValid() | ||
* @see Entity#isPersistent() | ||
*/ | ||
FORCE, | ||
/** | ||
* Serialize misc non-saveable entities like lighting bolts, fishing bobbers, etc. | ||
* <br>Note: players require a separate flag: {@link #PLAYER}. | ||
*/ | ||
MISC, | ||
/** | ||
* Include passengers in the serialized data. | ||
*/ | ||
PASSENGERS, | ||
/** | ||
* Allow serializing {@link Player}s. | ||
* <p>Note: deserializing player data will always fail. | ||
*/ | ||
PLAYER | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
paper-api/src/main/java/io/papermc/paper/registry/RegistryBuilderFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package io.papermc.paper.registry; | ||
|
||
import org.jetbrains.annotations.ApiStatus; | ||
import org.jetbrains.annotations.Contract; | ||
import org.jspecify.annotations.NullMarked; | ||
|
||
/** | ||
* A factory to create a {@link RegistryBuilder} for a given {@link TypedKey}. For | ||
* each instance of this class, once either {@link #empty()} or {@link #copyFrom(TypedKey)} | ||
* is called once, any future calls to either method will throw an {@link IllegalStateException}. | ||
* | ||
* @param <T> The type of the registry | ||
* @param <B> The type of the registry builder | ||
*/ | ||
@NullMarked | ||
@ApiStatus.Experimental | ||
@ApiStatus.NonExtendable | ||
public interface RegistryBuilderFactory<T, B extends RegistryBuilder<T>> { | ||
|
||
/** | ||
* Creates a new empty {@link RegistryBuilder}. | ||
* | ||
* @return A new empty {@link RegistryBuilder} | ||
* @throws IllegalStateException if this method or {@link #copyFrom(TypedKey)}) has already been called once | ||
*/ | ||
@Contract("-> new") | ||
B empty(); | ||
|
||
/** | ||
* Creates a new {@link RegistryBuilder} with the same properties as the given {@link TypedKey}. | ||
* | ||
* @param key The key to copy properties from | ||
* @return A new {@link RegistryBuilder} with the same properties as the given key | ||
* @throws IllegalStateException if this method or {@link #empty()} has already been called once | ||
* @throws IllegalArgumentException if key doesn't exist | ||
*/ | ||
@Contract("_ -> new") | ||
B copyFrom(TypedKey<T> key); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
paper-api/src/main/java/io/papermc/paper/registry/data/BannerPatternRegistryEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package io.papermc.paper.registry.data; | ||
|
||
import io.papermc.paper.registry.RegistryBuilder; | ||
import net.kyori.adventure.key.Key; | ||
import org.bukkit.block.banner.PatternType; | ||
import org.jetbrains.annotations.ApiStatus; | ||
import org.jetbrains.annotations.Contract; | ||
|
||
/** | ||
* A data-centric version-specific registry entry for the {@link PatternType} type. | ||
*/ | ||
@ApiStatus.Experimental | ||
@ApiStatus.NonExtendable | ||
public interface BannerPatternRegistryEntry { | ||
|
||
/** | ||
* Provides the asset id of the pattern type, which is the location of the sprite to use. | ||
* | ||
* @return the asset id. | ||
*/ | ||
Key assetId(); | ||
|
||
/** | ||
* Provides the translation key for displaying the pattern inside the banner's tooltip. | ||
* | ||
* @return the translation key. | ||
*/ | ||
String translationKey(); | ||
|
||
/** | ||
* A mutable builder for the {@link BannerPatternRegistryEntry} plugins may change in applicable registry events. | ||
* <p> | ||
* The following values are required for each builder: | ||
* <ul> | ||
* <li>{@link #assetId(Key)}</li> | ||
* <li>{@link #translationKey(String)}</li> | ||
* </ul> | ||
*/ | ||
@ApiStatus.Experimental | ||
@ApiStatus.NonExtendable | ||
interface Builder extends BannerPatternRegistryEntry, RegistryBuilder<PatternType> { | ||
|
||
/** | ||
* Sets the asset id of the pattern type, which is the location of the sprite to use. | ||
* | ||
* @param assetId the asset id. | ||
* @return this builder instance. | ||
* @see BannerPatternRegistryEntry#assetId() | ||
*/ | ||
@Contract(value = "_ -> this", mutates = "this") | ||
Builder assetId(Key assetId); | ||
|
||
/** | ||
* Sets the translation key for displaying the pattern inside the banner's tooltip. | ||
* | ||
* @param translationKey the translation key. | ||
* @return this builder instance. | ||
* @see BannerPatternRegistryEntry#translationKey() | ||
*/ | ||
@Contract(value = "_ -> this", mutates = "this") | ||
Builder translationKey(String translationKey); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.