Fixed a error when setting up a itemstack watcher before it spawns in
This commit is contained in:
parent
dd035980e7
commit
cd24514ec6
@ -419,14 +419,23 @@ public abstract class Disguise {
|
|||||||
// Start from 2 as they ALL share 0 and 1
|
// Start from 2 as they ALL share 0 and 1
|
||||||
for (int dataNo = 2; dataNo <= 31; dataNo++) {
|
for (int dataNo = 2; dataNo <= 31; dataNo++) {
|
||||||
// If the watcher already set a metadata on this
|
// If the watcher already set a metadata on this
|
||||||
if (getWatcher().getValue(dataNo, null) != null) {
|
if (getWatcher().hasValue(dataNo)) {
|
||||||
// Better check that the value is stable.
|
// Better check that the value is stable.
|
||||||
if (disguiseValues.containsKey(dataNo)
|
// To check this, I'm going to check if there exists a default value
|
||||||
&& getWatcher().getValue(dataNo, null).getClass() == disguiseValues.get(dataNo).getClass()) {
|
// Then I'm going to check if the watcher value is the same as the default value.
|
||||||
|
if (disguiseValues.containsKey(dataNo)) {
|
||||||
|
// Now check if they are the same class, or both null.
|
||||||
|
if (disguiseValues.get(dataNo) == null || getWatcher().getValue(dataNo, null) == null) {
|
||||||
|
if (disguiseValues.get(dataNo) == null && getWatcher().getValue(dataNo, null) == null) {
|
||||||
|
// They are both null. Idk what this means really.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else if (getWatcher().getValue(dataNo, null).getClass() == disguiseValues.get(dataNo).getClass()) {
|
||||||
// The classes are the same. The client "shouldn't" crash.
|
// The classes are the same. The client "shouldn't" crash.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// If neither of them touch it
|
// If neither of them touch it
|
||||||
if (!entityValues.containsKey(dataNo) && !disguiseValues.containsKey(dataNo))
|
if (!entityValues.containsKey(dataNo) && !disguiseValues.containsKey(dataNo))
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user