mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-27 21:26:17 +01:00
parent
b871eb3d54
commit
13f5c14599
@ -926,7 +926,7 @@ public class PacketContainer implements Serializable {
|
|||||||
*/
|
*/
|
||||||
public StructureModifier<Integer> getDimensions() {
|
public StructureModifier<Integer> getDimensions() {
|
||||||
if (NEW_DIMENSIONS) {
|
if (NEW_DIMENSIONS) {
|
||||||
return structureModifier.withType(
|
return structureModifier.withParamType(
|
||||||
MinecraftReflection.getMinecraftClass("ResourceKey"),
|
MinecraftReflection.getMinecraftClass("ResourceKey"),
|
||||||
BukkitConverters.getDimensionIDConverter(),
|
BukkitConverters.getDimensionIDConverter(),
|
||||||
MinecraftReflection.getMinecraftClass("DimensionManager")
|
MinecraftReflection.getMinecraftClass("DimensionManager")
|
||||||
@ -977,7 +977,7 @@ public class PacketContainer implements Serializable {
|
|||||||
* @return The Structure Modifier
|
* @return The Structure Modifier
|
||||||
*/
|
*/
|
||||||
public StructureModifier<World> getWorldKeys() {
|
public StructureModifier<World> getWorldKeys() {
|
||||||
return structureModifier.withType(
|
return structureModifier.withParamType(
|
||||||
MinecraftReflection.getMinecraftClass("ResourceKey"),
|
MinecraftReflection.getMinecraftClass("ResourceKey"),
|
||||||
BukkitConverters.getWorldKeyConverter(),
|
BukkitConverters.getWorldKeyConverter(),
|
||||||
MinecraftReflection.getNmsWorldClass()
|
MinecraftReflection.getNmsWorldClass()
|
||||||
|
@ -477,8 +477,20 @@ public class StructureModifier<TField> {
|
|||||||
* @param converter - converts objects into the given type.
|
* @param converter - converts objects into the given type.
|
||||||
* @return A structure modifier for fields of this type.
|
* @return A structure modifier for fields of this type.
|
||||||
*/
|
*/
|
||||||
|
public <T> StructureModifier<T> withType(Class fieldType, EquivalentConverter<T> converter) {
|
||||||
|
return withParamType(fieldType, converter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a structure modifier that only reads and writes fields of a given type.
|
||||||
|
* @param <T> Type
|
||||||
|
* @param fieldType - the type, or supertype, of every field to modify.
|
||||||
|
* @param converter - converts objects into the given type.
|
||||||
|
* @param paramTypes - field type parameters
|
||||||
|
* @return A structure modifier for fields of this type.
|
||||||
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T> StructureModifier<T> withType(Class fieldType, EquivalentConverter<T> converter, Class... paramTypes) {
|
public <T> StructureModifier<T> withParamType(Class fieldType, EquivalentConverter<T> converter, Class... paramTypes) {
|
||||||
if (fieldType == null) {
|
if (fieldType == null) {
|
||||||
// It's not supported in this version, so return an empty modifier
|
// It's not supported in this version, so return an empty modifier
|
||||||
return new StructureModifier<T>() {
|
return new StructureModifier<T>() {
|
||||||
|
Loading…
Reference in New Issue
Block a user