MouseMotionEvent class
Пакет: com.hypixel.hytale.protocol
Файл: com/hypixel/hytale/protocol/MouseMotionEvent.java
Поля (27)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
int |
NULLABLE_BIT_FIELD_SIZE |
|
int |
var1 |
|
MouseMotionEvent |
var1 |
|
int |
var1 |
|
|
var1 |
|
int |
var10 |
|
MouseMotionEvent |
var13 |
|
long |
var2 |
|
int |
var2 |
|
byte |
var2 |
|
byte |
var2 |
|
long |
var3 |
|
int |
var3 |
|
byte |
var3 |
|
|
var3 |
|
|
var3 |
|
int |
var4 |
|
|
var4 |
|
int |
var4 |
|
int |
var5 |
|
MouseButtonType[] |
var5 |
|
|
var5 |
|
int |
var6 |
|
int |
var6 |
|
MouseButtonType[] |
var7 |
|
long |
var7 |
|
int |
var9 |
Методы (30)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
MouseMotionEvent |
cloneMouseMotionEvent clone() |
public |
int |
computeSizeint computeSize() |
|
|
for for(int var8 = 0; var8 < var5; var8++) |
|
|
for for(int var11 = 0; var11 < var9; var11++) |
|
|
for for(int var5 = 0; var5 < this.mouseButtonType.length; var5++) |
abstract |
return |
getMouseButtonTypereturn getMouseButtonType(var0, 0) |
abstract |
return |
getRelativeMotionreturn getRelativeMotion(var0, 0) |
static |
boolean |
hasMouseButtonTypeboolean hasMouseButtonType(MemorySegment var0, int var1) |
static |
boolean |
hasRelativeMotionboolean hasRelativeMotion(MemorySegment var0, int var1) |
|
|
if if(var1 < 0) |
|
|
if if(var3 == -1L) |
|
|
if if(var5 > 4096000) |
|
|
if if(var7 == -1L) |
|
|
if if(var9 > 4096000) |
|
|
if if(var2 != null) |
|
|
if if(this.relativeMotion != null) |
|
|
if if(this.mouseButtonType != null) |
|
|
if if(this.relativeMotion != null) |
|
|
if if(this.mouseButtonType != null) |
|
|
if if(this.mouseButtonType.length > 4096000) |
|
|
if if(this.mouseButtonType != null) |
|
|
if if(this == var1) |
static |
void |
requireBoundsvoid requireBounds(MemorySegment var0, int var1) |
abstract |
|
requireBounds requireBounds(var0, var1) |
public |
int |
serializeint serialize(@Nonnull MemorySegment var1, int var2) |
static |
MouseMotionEvent |
toObjectMouseMotionEvent toObject(MemorySegment var0) |
static |
MouseMotionEvent |
toObjectMouseMotionEvent toObject(MemorySegment var0, int var1) |
static |
MouseMotionEvent |
toObjectMouseMotionEvent toObject(MemorySegment var0, int var1, @Nullable ReadCursor var2) |
abstract |
return |
toObjectreturn toObject(var0, 0, null) |
abstract |
return |
toObjectreturn toObject(var0, var1, null) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.protocol;
class="kw">import com.hypixel.hytale.protocol.io.PacketIO;
class="kw">import com.hypixel.hytale.protocol.io.ProtocolException;
class="kw">import com.hypixel.hytale.protocol.io.ReadCursor;
class="kw">import com.hypixel.hytale.protocol.io.VarInt;
class="kw">import java.lang.foreign.MemorySegment;
class="kw">import java.util.Arrays;
class="kw">import java.util.Objects;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class MouseMotionEvent {
class="kw">public class="kw">static class="kw">final int NULLABLE_BIT_FIELD_SIZE = 1;
class="kw">public class="kw">static class="kw">final int FIXED_BLOCK_SIZE = 9;
class="kw">public class="kw">static class="kw">final int VARIABLE_FIELD_COUNT = 1;
class="kw">public class="kw">static class="kw">final int VARIABLE_BLOCK_START = 9;
class="kw">public class="kw">static class="kw">final int MAX_SIZE = 4096014;
@Nullable
class="kw">public MouseButtonType[] mouseButtonType;
@Nullable
class="kw">public Vector2i relativeMotion;
class="kw">public MouseMotionEvent() {
}
class="kw">public MouseMotionEvent(@Nullable MouseButtonType[] var1, @Nullable Vector2i var2) {
this.mouseButtonType = var1;
this.relativeMotion = var2;
}
class="kw">public MouseMotionEvent(@Nonnull MouseMotionEvent var1) {
this.mouseButtonType = var1.mouseButtonType;
this.relativeMotion = var1.relativeMotion;
}
class="kw">public class="kw">static void requireBounds(MemorySegment var0, int var1) {
if (var1 < 0) {
throw ProtocolException.invalidOffset("MouseMotionEvent", var1, (int)var0.byteSize());
}
long var2 = var1 + 9L;
if (var2 > var0.byteSize()) {
throw ProtocolException.bufferTooSmall("MouseMotionEvent", (int)Math.min(var2, 2147483647L), (int)var0.byteSize());
}
}
@Nullable
class="kw">public class="kw">static MouseButtonType[] getMouseButtonType(MemorySegment var0) {
class="kw">return getMouseButtonType(var0, 0);
}
@Nullable
class="kw">public class="kw">static MouseButtonType[] getMouseButtonType(MemorySegment var0, int var1) {
if (!hasMouseButtonType(var0, var1)) {
class="kw">return null;
}
int var2 = var1 + 9;
long var3 = VarInt.getWithLength(var0, var2);
if (var3 == -1L) {
throw ProtocolException.invalidVarInt("MouseButtonType");
}
int var5 = (int)var3;
if (var5 > 4096000) {
throw ProtocolException.arrayTooLong("MouseButtonType", var5, 4096000);
}
int var6 = (int)(var3 >>> 32);
if (var2 + var6 + var5 > var0.byteSize()) {
throw ProtocolException.bufferTooSmall("MouseButtonType", Math.min(var2 + var6 + var5, Integer.MAX_VALUE), (int)var0.byteSize());
}
var2 += var6;
MouseButtonType[] var7 = new MouseButtonType[var5];
for (int var8 = 0; var8 < var5; var8++) {
var7[var8] = MouseButtonType.fromValue(var0.get(PacketIO.PROTO_BYTE, var2 + var8 * 1));
}
class="kw">return var7;
}
@Nullable
class="kw">public class="kw">static Vector2i getRelativeMotion(MemorySegment var0) {
class="kw">return getRelativeMotion(var0, 0);
}
@Nullable
class="kw">public class="kw">static Vector2i getRelativeMotion(MemorySegment var0, int var1) {
class="kw">return hasRelativeMotion(var0, var1) ? Vector2i.toObject(var0, var1 + 1) : null;
}
class="kw">public class="kw">static boolean hasRelativeMotion(MemorySegment var0, int var1) {
byte var2 = var0.get(PacketIO.PROTO_BYTE, var1 + 0);
class="kw">return (var2 & 1) != 0;
}
class="kw">public class="kw">static boolean hasMouseButtonType(MemorySegment var0, int var1) {
byte var2 = var0.get(PacketIO.PROTO_BYTE, var1 + 0);
class="kw">return (var2 & 2) != 0;
}
class="kw">public class="kw">static MouseMotionEvent toObject(MemorySegment var0) {
class="kw">return toObject(var0, 0, null);
}
class="kw">public class="kw">static MouseMotionEvent toObject(MemorySegment var0, int var1) {
class="kw">return toObject(var0, var1, null);
}
class="kw">public class="kw">static MouseMotionEvent toObject(MemorySegment var0, int var1, @Nullable ReadCursor var2) {
requireBounds(var0, var1);
int var3 = var1 + 9;
int var4 = 0;
MouseButtonType[] var5 = null;
if (hasMouseButtonType(var0, var1)) {
int var6 = var3 + var4;
long var7 = VarInt.getWithLength(var0, var6);
if (var7 == -1L) {
throw ProtocolException.invalidVarInt("MouseButtonType");
}
int var9 = (int)var7;
if (var9 > 4096000) {
throw ProtocolException.arrayTooLong("MouseButtonType", var9, 4096000);
}
int var10 = (int)(var7 >>> 32);
if (var6 + var10 + var9 > var0.byteSize()) {
throw ProtocolException.bufferTooSmall("MouseButtonType", Math.min(var6 + var10 + var9, Integer.MAX_VALUE), (int)var0.byteSize());
}
var6 += var10;
var5 = new MouseButtonType[var9];
for (int var11 = 0; var11 < var9; var11++) {
var5[var11] = MouseButtonType.fromValue(var0.get(PacketIO.PROTO_BYTE, var6 + var11 * 1));
}
var4 = var6 + var9 - var3;
}
MouseMotionEvent var13 = new MouseMotionEvent(var5, hasRelativeMotion(var0, var1) ? Vector2i.toObject(var0, var1 + 1) : null);
if (var2 != null) {
var2.position = var3 + var4;
}
class="kw">return var13;
}
class="kw">public int serialize(@Nonnull MemorySegment var1, int var2) {
byte var3 = 0;
if (this.relativeMotion != null) {
var3 = (byte)(var3 | 1);
}
if (this.mouseButtonType != null) {
var3 = (byte)(var3 | 2);
}
var1.set(PacketIO.PROTO_BYTE, var2 + 0, var3);
if (this.relativeMotion != null) {
this.relativeMotion.serialize(var1, var2 + 1);
} else {
var1.asSlice(var2 + 1, 8L).fill((byte)0);
}
int var4 = var2 + 9;
if (this.mouseButtonType != null) {
if (this.mouseButtonType.length > 4096000) {
throw ProtocolException.arrayTooLong("MouseButtonType", this.mouseButtonType.length, 4096000);
}
var4 += VarInt.set(var1, var4, this.mouseButtonType.length);
for (int var5 = 0; var5 < this.mouseButtonType.length; var5++) {
var1.set(PacketIO.PROTO_BYTE, var4 + var5 * 1, (byte)this.mouseButtonType[var5].getValue());
}
var4 += this.mouseButtonType.length * 1;
}
class="kw">return var4 - var2;
}
class="kw">public int computeSize() {
int var1 = 9;
if (this.mouseButtonType != null) {
var1 += VarInt.size(this.mouseButtonType.length) + this.mouseButtonType.length * 1;
}
class="kw">return var1;
}
class="kw">public MouseMotionEvent clone() {
MouseMotionEvent var1 = new MouseMotionEvent();
var1.mouseButtonType = this.mouseButtonType != null ? Arrays.copyOf(this.mouseButtonType, this.mouseButtonType.length) : null;
var1.relativeMotion = this.relativeMotion != null ? this.relativeMotion.clone() : null;
class="kw">return var1;
}
@Override
class="kw">public boolean equals(Object var1) {
if (this == var1) {
class="kw">return true;
} else {
class="kw">return !(var1 class="kw">instanceof MouseMotionEvent var2)
? false
: Arrays.equals(this.mouseButtonType, var2.mouseButtonType) && Objects.equals(this.relativeMotion, var2.relativeMotion);
}
}
@Override
class="kw">public int hashCode() {
int var1 = 1;
var1 = 31 * var1 + Arrays.hashCode(this.mouseButtonType);
class="kw">return 31 * var1 + Objects.hashCode(this.relativeMotion);
}
}