mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-10 04:41:12 +01:00
FIXED: DataWatcher can now clone ItemStacks and ChunkPositions.
Due to a oversight, we retrieved the "wrapped" value in the get cloned helper method. This caused it to not clone the chunk position and item stack.
This commit is contained in:
parent
637d6cda18
commit
651581d677
@ -218,6 +218,14 @@ public class WrappedWatchableObject {
|
|||||||
modifier.withType(Object.class).write(0, getUnwrapped(newValue));
|
modifier.withType(Object.class).write(0, getUnwrapped(newValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the underlying value field.
|
||||||
|
* @return The underlying value.
|
||||||
|
*/
|
||||||
|
private Object getNMSValue() {
|
||||||
|
return modifier.withType(Object.class).read(0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the value field.
|
* Read the value field.
|
||||||
* @return The watched value.
|
* @return The watched value.
|
||||||
@ -324,7 +332,7 @@ public class WrappedWatchableObject {
|
|||||||
|
|
||||||
// Helper
|
// Helper
|
||||||
Object getClonedValue() throws FieldAccessException {
|
Object getClonedValue() throws FieldAccessException {
|
||||||
Object value = getValue();
|
Object value = getNMSValue();
|
||||||
|
|
||||||
// Only a limited set of references types are supported
|
// Only a limited set of references types are supported
|
||||||
if (MinecraftReflection.isChunkPosition(value)) {
|
if (MinecraftReflection.isChunkPosition(value)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user