Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-08 17:20:24 +01:00
Add new is feature to PacketWrapper :)
Dieser Commit ist enthalten in:
Ursprung
45952d3759
Commit
a3db32758c
@ -56,6 +56,26 @@ public class PacketWrapper {
|
|||||||
throw new InformativeException(e).set("Type", type.getTypeName()).set("Index", index).set("Packet ID", getId()).set("Data", packetValues);
|
throw new InformativeException(e).set("Type", type.getTypeName()).set("Index", index).set("Packet ID", getId()).set("Data", packetValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a type is at an index
|
||||||
|
*
|
||||||
|
* @param type The type of the part you wish to get.
|
||||||
|
* @param index The index of the part (relative to the type)
|
||||||
|
* @return True if the type is at the index
|
||||||
|
*/
|
||||||
|
public boolean is(Type type, int index) {
|
||||||
|
int currentIndex = 0;
|
||||||
|
for (Pair<Type, Object> packetValue : packetValues) {
|
||||||
|
if (packetValue.getKey() == type) { // Ref check
|
||||||
|
if (currentIndex == index) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
currentIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a currently existing part in the output
|
* Set a currently existing part in the output
|
||||||
*
|
*
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren