mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-23 19:16:14 +01:00
parent
b871eb3d54
commit
13f5c14599
@ -926,7 +926,7 @@ public class PacketContainer implements Serializable {
|
||||
*/
|
||||
public StructureModifier<Integer> getDimensions() {
|
||||
if (NEW_DIMENSIONS) {
|
||||
return structureModifier.withType(
|
||||
return structureModifier.withParamType(
|
||||
MinecraftReflection.getMinecraftClass("ResourceKey"),
|
||||
BukkitConverters.getDimensionIDConverter(),
|
||||
MinecraftReflection.getMinecraftClass("DimensionManager")
|
||||
@ -977,7 +977,7 @@ public class PacketContainer implements Serializable {
|
||||
* @return The Structure Modifier
|
||||
*/
|
||||
public StructureModifier<World> getWorldKeys() {
|
||||
return structureModifier.withType(
|
||||
return structureModifier.withParamType(
|
||||
MinecraftReflection.getMinecraftClass("ResourceKey"),
|
||||
BukkitConverters.getWorldKeyConverter(),
|
||||
MinecraftReflection.getNmsWorldClass()
|
||||
|
@ -477,8 +477,20 @@ public class StructureModifier<TField> {
|
||||
* @param converter - converts objects into the given 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")
|
||||
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) {
|
||||
// It's not supported in this version, so return an empty modifier
|
||||
return new StructureModifier<T>() {
|
||||
|
Loading…
Reference in New Issue
Block a user