mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-16 10:55:01 -04:00
fix item reading for items with damage (parameter ignoreMetaData (damage))
This commit is contained in:
parent
9e44d10566
commit
71260dbb3c
@ -987,6 +987,7 @@ public enum Items {
|
|||||||
|
|
||||||
final Identifier identifier;
|
final Identifier identifier;
|
||||||
final int legacyId;
|
final int legacyId;
|
||||||
|
final boolean ignoreMetaData;
|
||||||
int legacyData;
|
int legacyData;
|
||||||
|
|
||||||
// legacy id -2 means: 1.13+
|
// legacy id -2 means: 1.13+
|
||||||
@ -994,24 +995,13 @@ public enum Items {
|
|||||||
this.identifier = identifier;
|
this.identifier = identifier;
|
||||||
this.legacyId = legacyId;
|
this.legacyId = legacyId;
|
||||||
this.legacyData = legacyData;
|
this.legacyData = legacyData;
|
||||||
|
ignoreMetaData = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Items(Identifier identifier, int legacyId) {
|
Items(Identifier identifier, int legacyId) {
|
||||||
this.identifier = identifier;
|
this.identifier = identifier;
|
||||||
this.legacyId = legacyId;
|
this.legacyId = legacyId;
|
||||||
}
|
ignoreMetaData = true;
|
||||||
|
|
||||||
public Identifier getIdentifier() {
|
|
||||||
return identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public int getLegacyId() {
|
|
||||||
return legacyId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getLegacyData() {
|
|
||||||
return legacyData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Items byIdentifier(Identifier identifier) {
|
public static Items byIdentifier(Identifier identifier) {
|
||||||
@ -1024,9 +1014,13 @@ public enum Items {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Items byLegacy(int id, int data) {
|
public static Items byLegacy(int id, int data) {
|
||||||
for (Items b : values()) {
|
for (Items item : values()) {
|
||||||
if (b.getLegacyId() == id && b.getLegacyData() == data) {
|
if (item.getLegacyId() == id) {
|
||||||
return b;
|
if (item.ignoreMetaData) {
|
||||||
|
return item;
|
||||||
|
} else if (item.getLegacyData() == data) {
|
||||||
|
return item;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return UNKNOWN;
|
return UNKNOWN;
|
||||||
@ -1036,5 +1030,17 @@ public enum Items {
|
|||||||
return byLegacy(id, 0);
|
return byLegacy(id, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Identifier getIdentifier() {
|
||||||
|
return identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLegacyId() {
|
||||||
|
return legacyId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLegacyData() {
|
||||||
|
return legacyData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user