Skip to content

Commit 13f5c14

Browse files
committed
Fix bytecode breakage with StructureModifier
Fixes #935
1 parent b871eb3 commit 13f5c14

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/main/java/com/comphenix/protocol/events/PacketContainer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ public StructureModifier<MinecraftKey> getMinecraftKeys() {
926926
*/
927927
public StructureModifier<Integer> getDimensions() {
928928
if (NEW_DIMENSIONS) {
929-
return structureModifier.withType(
929+
return structureModifier.withParamType(
930930
MinecraftReflection.getMinecraftClass("ResourceKey"),
931931
BukkitConverters.getDimensionIDConverter(),
932932
MinecraftReflection.getMinecraftClass("DimensionManager")
@@ -977,7 +977,7 @@ public StructureModifier<MovingObjectPositionBlock> getMovingBlockPositions() {
977977
* @return The Structure Modifier
978978
*/
979979
public StructureModifier<World> getWorldKeys() {
980-
return structureModifier.withType(
980+
return structureModifier.withParamType(
981981
MinecraftReflection.getMinecraftClass("ResourceKey"),
982982
BukkitConverters.getWorldKeyConverter(),
983983
MinecraftReflection.getNmsWorldClass()

src/main/java/com/comphenix/protocol/reflect/StructureModifier.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,20 @@ private static Type[] getParamTypes(Field field) {
477477
* @param converter - converts objects into the given type.
478478
* @return A structure modifier for fields of this type.
479479
*/
480+
public <T> StructureModifier<T> withType(Class fieldType, EquivalentConverter<T> converter) {
481+
return withParamType(fieldType, converter);
482+
}
483+
484+
/**
485+
* Retrieves a structure modifier that only reads and writes fields of a given type.
486+
* @param <T> Type
487+
* @param fieldType - the type, or supertype, of every field to modify.
488+
* @param converter - converts objects into the given type.
489+
* @param paramTypes - field type parameters
490+
* @return A structure modifier for fields of this type.
491+
*/
480492
@SuppressWarnings("unchecked")
481-
public <T> StructureModifier<T> withType(Class fieldType, EquivalentConverter<T> converter, Class... paramTypes) {
493+
public <T> StructureModifier<T> withParamType(Class fieldType, EquivalentConverter<T> converter, Class... paramTypes) {
482494
if (fieldType == null) {
483495
// It's not supported in this version, so return an empty modifier
484496
return new StructureModifier<T>() {

0 commit comments

Comments
 (0)