File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
modules/API/src/main/java/com/comphenix/protocol/reflect/cloning Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 32
32
import com .comphenix .protocol .wrappers .WrappedBlockData ;
33
33
import com .comphenix .protocol .wrappers .WrappedDataWatcher ;
34
34
import com .comphenix .protocol .wrappers .WrappedServerPing ;
35
+ import com .comphenix .protocol .wrappers .nbt .NbtFactory ;
36
+ import com .comphenix .protocol .wrappers .nbt .NbtWrapper ;
35
37
import com .google .common .collect .Maps ;
36
38
37
39
/**
@@ -76,6 +78,10 @@ public BukkitCloner() {
76
78
addClass (8 , MinecraftReflection .getNonNullListClass ());
77
79
} catch (Throwable ex ) {
78
80
}
81
+
82
+ try {
83
+ addClass (9 , MinecraftReflection .getNBTBaseClass ());
84
+ } catch (Throwable ex ) { }
79
85
}
80
86
81
87
private void addClass (int id , Class <?> clazz ) {
@@ -133,6 +139,9 @@ public Object clone(Object source) {
133
139
return blockDataConverter .getGeneric (blockDataConverter .getSpecific (source ).deepClone ());
134
140
case 8 :
135
141
return nonNullListCloner ().clone (source );
142
+ case 9 :
143
+ NbtWrapper <?> clone = (NbtWrapper <?>) NbtFactory .fromNMS (source ).deepClone ();
144
+ return clone .getHandle ();
136
145
default :
137
146
throw new IllegalArgumentException ("Cannot clone objects of type " + source .getClass ());
138
147
}
You can’t perform that action at this time.
0 commit comments