Skip to content

Commit

Permalink
Update meta offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
xDec0de committed Jul 4, 2024
1 parent f4b2a05 commit a776de8
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 83 deletions.
100 changes: 58 additions & 42 deletions api/src/main/java/me/tofaa/entitylib/meta/MetaOffsetConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,94 +9,101 @@
@ApiStatus.Internal
@SuppressWarnings("unused")
public final class MetaOffsetConverter {
private MetaOffsetConverter() {}
private MetaOffsetConverter() {
}

public static final class EntityMetaOffsets {
private EntityMetaOffsets() {
}

public static byte airTicksOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 47 && protocolVersion <= 766) {
if (protocolVersion >= 47 && protocolVersion <= 767) {
return 1;
}
throw new RuntimeException("Unknown protocol version for this method");
}

public static byte customNameOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 47 && protocolVersion <= 766) {
if (protocolVersion >= 47 && protocolVersion <= 767) {
return 2;
}
throw new RuntimeException("Unknown protocol version for this method");
}

public static byte customNameVisibleOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 47 && protocolVersion <= 766) {
if (protocolVersion >= 47 && protocolVersion <= 767) {
return 3;
}
throw new RuntimeException("Unknown protocol version for this method");
}

public static byte silentOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 47 && protocolVersion <= 766) {
if (protocolVersion >= 47 && protocolVersion <= 767) {
return 4;
}
throw new RuntimeException("Unknown protocol version for this method");
}

public static byte hasNoGravityOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 47 && protocolVersion <= 766) {
if (protocolVersion >= 47 && protocolVersion <= 767) {
return 5;
}
throw new RuntimeException("Unknown protocol version for this method");
}

public static byte poseOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 47 && protocolVersion <= 766) {
if (protocolVersion >= 47 && protocolVersion <= 767) {
return 6;
}
throw new RuntimeException("Unknown protocol version for this method");
}

public static byte ticksFrozenInPowderedSnowOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 47 && protocolVersion <= 766) {
if (protocolVersion >= 47 && protocolVersion <= 767) {
return 7;
}
throw new RuntimeException("Unknown protocol version for this method");
}
}

public static final class AbstractDisplayMetaOffsets {
private AbstractDisplayMetaOffsets() {
}

public static byte interpolationDelayOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 762 && protocolVersion <= 766) {
if (protocolVersion >= 762 && protocolVersion <= 767) {
return 8;
}
throw new RuntimeException("Unknown protocol version for this method");
}

public static byte transformationDurationOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 762 && protocolVersion <= 766) {
if (protocolVersion >= 762 && protocolVersion <= 767) {
return 9;
}
throw new RuntimeException("Unknown protocol version for this method");
}

public static byte positionRotationInterpolationDurationOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 10;
}
throw new RuntimeException("Unknown protocol version for this method");
}

public static byte translationOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 11;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -107,7 +114,7 @@ public static byte translationOffset() {

public static byte scaleOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 12;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -118,7 +125,7 @@ public static byte scaleOffset() {

public static byte leftRotationOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 13;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -129,7 +136,7 @@ public static byte leftRotationOffset() {

public static byte rightRotationOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 14;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -140,7 +147,7 @@ public static byte rightRotationOffset() {

public static byte billboardConstraintsOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 15;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -151,7 +158,7 @@ public static byte billboardConstraintsOffset() {

public static byte brightnessOverrideOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 16;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -162,7 +169,7 @@ public static byte brightnessOverrideOffset() {

public static byte viewRangeOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 17;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -173,7 +180,7 @@ public static byte viewRangeOffset() {

public static byte shadowRadiusOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 18;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -184,7 +191,7 @@ public static byte shadowRadiusOffset() {

public static byte shadowStrengthOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 19;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -195,7 +202,7 @@ public static byte shadowStrengthOffset() {

public static byte widthOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 20;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -206,7 +213,7 @@ public static byte widthOffset() {

public static byte heightOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 21;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -217,7 +224,7 @@ public static byte heightOffset() {

public static byte glowColorOverrideOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 22;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -228,9 +235,12 @@ public static byte glowColorOverrideOffset() {
}

public static final class BlockDisplayMetaOffsets {
private BlockDisplayMetaOffsets() {
}

public static byte blockIdOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 23;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -241,9 +251,12 @@ public static byte blockIdOffset() {
}

public static final class ItemDisplayMetaOffsets {
private ItemDisplayMetaOffsets() {
}

public static byte itemOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 24;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -254,7 +267,7 @@ public static byte itemOffset() {

public static byte displayTypeOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 25;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -265,9 +278,12 @@ public static byte displayTypeOffset() {
}

public static final class TextDisplayMetaOffsets {
private TextDisplayMetaOffsets() {
}

public static byte textOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 26;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -278,7 +294,7 @@ public static byte textOffset() {

public static byte textColorOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 27;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -289,7 +305,7 @@ public static byte textColorOffset() {

public static byte textBackgroundColorOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 28;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -300,7 +316,7 @@ public static byte textBackgroundColorOffset() {

public static byte textBackgroundOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 29;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -311,7 +327,7 @@ public static byte textBackgroundOffset() {

public static byte textScaleOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 30;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -322,18 +338,18 @@ public static byte textScaleOffset() {

public static byte textAlignmentOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 31;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
if (protocolVersion >= 762 && protocolVersion <= 767) {
return 30;
}
throw new RuntimeException("Unknown protocol version for this method");
}

public static byte lineWidthOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 32;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -344,7 +360,7 @@ public static byte lineWidthOffset() {

public static byte backgroundColorOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 33;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -355,7 +371,7 @@ public static byte backgroundColorOffset() {

public static byte textOpacityOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 34;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -366,7 +382,7 @@ public static byte textOpacityOffset() {

public static byte shadowOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 35;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -377,7 +393,7 @@ public static byte shadowOffset() {

public static byte seeThroughOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 36;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -388,7 +404,7 @@ public static byte seeThroughOffset() {

public static byte useDefaultBackgroundOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 37;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -399,7 +415,7 @@ public static byte useDefaultBackgroundOffset() {

public static byte allighnLeftOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 38;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -410,7 +426,7 @@ public static byte allighnLeftOffset() {

public static byte allighnRightOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 39;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand All @@ -421,7 +437,7 @@ public static byte allighnRightOffset() {

public static byte allighnCenterOffset() {
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
if (protocolVersion >= 764 && protocolVersion <= 766) {
if (protocolVersion >= 764 && protocolVersion <= 767) {
return 40;
}
if (protocolVersion >= 762 && protocolVersion <= 763) {
Expand Down
Loading

0 comments on commit a776de8

Please sign in to comment.