MoveItemStack class
Пакет: com.hypixel.hytale.protocol.packets.inventory
Файл: com/hypixel/hytale/protocol/packets/inventory/MoveItemStack.java
implements: Packet, ToServerPacket
Поля (6)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
int |
PACKET_ID |
|
MoveItemStack |
var1 |
|
long |
var2 |
|
int |
var2 |
|
int |
var3 |
|
MoveItemStack |
var4 |
Методы (29)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
MoveItemStack |
cloneMoveItemStack clone() |
static |
int |
getFromSectionIdint getFromSectionId(MemorySegment var0) |
static |
int |
getFromSectionIdint getFromSectionId(MemorySegment var0, int var1) |
abstract |
return |
getFromSectionIdreturn getFromSectionId(var0, 0) |
static |
int |
getFromSlotIdint getFromSlotId(MemorySegment var0) |
static |
int |
getFromSlotIdint getFromSlotId(MemorySegment var0, int var1) |
abstract |
return |
getFromSlotIdreturn getFromSlotId(var0, 0) |
static |
int |
getQuantityint getQuantity(MemorySegment var0) |
static |
int |
getQuantityint getQuantity(MemorySegment var0, int var1) |
abstract |
return |
getQuantityreturn getQuantity(var0, 0) |
static |
int |
getToSectionIdint getToSectionId(MemorySegment var0) |
static |
int |
getToSectionIdint getToSectionId(MemorySegment var0, int var1) |
abstract |
return |
getToSectionIdreturn getToSectionId(var0, 0) |
static |
int |
getToSlotIdint getToSlotId(MemorySegment var0) |
static |
int |
getToSlotIdint getToSlotId(MemorySegment var0, int var1) |
abstract |
return |
getToSlotIdreturn getToSlotId(var0, 0) |
|
|
if if(var1 < 0) |
|
|
if if(var2 < 1) |
|
|
if if(var3 < 1) |
|
|
if if(var2 != null) |
|
|
if if(this.quantity < 1) |
|
|
if if(this == var1) |
static |
void |
requireBoundsvoid requireBounds(MemorySegment var0, int var1) |
abstract |
|
requireBounds requireBounds(var0, var1) |
static |
MoveItemStack |
toObjectMoveItemStack toObject(MemorySegment var0) |
static |
MoveItemStack |
toObjectMoveItemStack toObject(MemorySegment var0, int var1) |
static |
MoveItemStack |
toObjectMoveItemStack 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.packets.inventory;
class="kw">import com.hypixel.hytale.protocol.NetworkChannel;
class="kw">import com.hypixel.hytale.protocol.Packet;
class="kw">import com.hypixel.hytale.protocol.ToServerPacket;
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 java.lang.foreign.MemorySegment;
class="kw">import java.util.Objects;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class MoveItemStack class="kw">implements Packet, ToServerPacket {
class="kw">public class="kw">static class="kw">final int PACKET_ID = 175;
class="kw">public class="kw">static class="kw">final boolean IS_COMPRESSED = false;
class="kw">public class="kw">static class="kw">final int NULLABLE_BIT_FIELD_SIZE = 0;
class="kw">public class="kw">static class="kw">final int FIXED_BLOCK_SIZE = 20;
class="kw">public class="kw">static class="kw">final int VARIABLE_FIELD_COUNT = 0;
class="kw">public class="kw">static class="kw">final int VARIABLE_BLOCK_START = 20;
class="kw">public class="kw">static class="kw">final int MAX_SIZE = 20;
class="kw">public int fromSectionId;
class="kw">public int fromSlotId;
class="kw">public int quantity;
class="kw">public int toSectionId;
class="kw">public int toSlotId;
@Override
class="kw">public int getId() {
class="kw">return 175;
}
@Override
class="kw">public NetworkChannel getChannel() {
class="kw">return NetworkChannel.Default;
}
class="kw">public MoveItemStack() {
}
class="kw">public MoveItemStack(int var1, int var2, int var3, int var4, int var5) {
this.fromSectionId = var1;
this.fromSlotId = var2;
this.quantity = var3;
this.toSectionId = var4;
this.toSlotId = var5;
}
class="kw">public MoveItemStack(@Nonnull MoveItemStack var1) {
this.fromSectionId = var1.fromSectionId;
this.fromSlotId = var1.fromSlotId;
this.quantity = var1.quantity;
this.toSectionId = var1.toSectionId;
this.toSlotId = var1.toSlotId;
}
class="kw">public class="kw">static void requireBounds(MemorySegment var0, int var1) {
if (var1 < 0) {
throw ProtocolException.invalidOffset("MoveItemStack", var1, (int)var0.byteSize());
}
long var2 = var1 + 20L;
if (var2 > var0.byteSize()) {
throw ProtocolException.bufferTooSmall("MoveItemStack", (int)Math.min(var2, 2147483647L), (int)var0.byteSize());
}
}
class="kw">public class="kw">static int getFromSectionId(MemorySegment var0) {
class="kw">return getFromSectionId(var0, 0);
}
class="kw">public class="kw">static int getFromSectionId(MemorySegment var0, int var1) {
class="kw">return var0.get(PacketIO.PROTO_INT, var1 + 0);
}
class="kw">public class="kw">static int getFromSlotId(MemorySegment var0) {
class="kw">return getFromSlotId(var0, 0);
}
class="kw">public class="kw">static int getFromSlotId(MemorySegment var0, int var1) {
class="kw">return var0.get(PacketIO.PROTO_INT, var1 + 4);
}
class="kw">public class="kw">static int getQuantity(MemorySegment var0) {
class="kw">return getQuantity(var0, 0);
}
class="kw">public class="kw">static int getQuantity(MemorySegment var0, int var1) {
int var2 = var0.get(PacketIO.PROTO_INT, var1 + 8);
if (var2 < 1) {
throw ProtocolException.valueBelowMinimum("Quantity", var2, 1.0);
} else {
class="kw">return var2;
}
}
class="kw">public class="kw">static int getToSectionId(MemorySegment var0) {
class="kw">return getToSectionId(var0, 0);
}
class="kw">public class="kw">static int getToSectionId(MemorySegment var0, int var1) {
class="kw">return var0.get(PacketIO.PROTO_INT, var1 + 12);
}
class="kw">public class="kw">static int getToSlotId(MemorySegment var0) {
class="kw">return getToSlotId(var0, 0);
}
class="kw">public class="kw">static int getToSlotId(MemorySegment var0, int var1) {
class="kw">return var0.get(PacketIO.PROTO_INT, var1 + 16);
}
class="kw">public class="kw">static MoveItemStack toObject(MemorySegment var0) {
class="kw">return toObject(var0, 0, null);
}
class="kw">public class="kw">static MoveItemStack toObject(MemorySegment var0, int var1) {
class="kw">return toObject(var0, var1, null);
}
class="kw">public class="kw">static MoveItemStack toObject(MemorySegment var0, int var1, @Nullable ReadCursor var2) {
requireBounds(var0, var1);
int var3 = var0.get(PacketIO.PROTO_INT, var1 + 8);
if (var3 < 1) {
throw ProtocolException.valueBelowMinimum("Quantity", var3, 1.0);
}
MoveItemStack var4 = new MoveItemStack(
var0.get(PacketIO.PROTO_INT, var1 + 0),
var0.get(PacketIO.PROTO_INT, var1 + 4),
var3,
var0.get(PacketIO.PROTO_INT, var1 + 12),
var0.get(PacketIO.PROTO_INT, var1 + 16)
);
if (var2 != null) {
var2.position = var1 + 20;
}
class="kw">return var4;
}
@Override
class="kw">public int serialize(@Nonnull MemorySegment var1, int var2) {
var1.set(PacketIO.PROTO_INT, var2 + 0, this.fromSectionId);
var1.set(PacketIO.PROTO_INT, var2 + 4, this.fromSlotId);
if (this.quantity < 1) {
throw ProtocolException.valueBelowMinimum("Quantity", this.quantity, 1.0);
}
var1.set(PacketIO.PROTO_INT, var2 + 8, this.quantity);
var1.set(PacketIO.PROTO_INT, var2 + 12, this.toSectionId);
var1.set(PacketIO.PROTO_INT, var2 + 16, this.toSlotId);
class="kw">return 20;
}
@Override
class="kw">public int computeSize() {
class="kw">return 20;
}
class="kw">public MoveItemStack clone() {
MoveItemStack var1 = new MoveItemStack();
var1.fromSectionId = this.fromSectionId;
var1.fromSlotId = this.fromSlotId;
var1.quantity = this.quantity;
var1.toSectionId = this.toSectionId;
var1.toSlotId = this.toSlotId;
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 MoveItemStack var2)
? false
: this.fromSectionId == var2.fromSectionId
&& this.fromSlotId == var2.fromSlotId
&& this.quantity == var2.quantity
&& this.toSectionId == var2.toSectionId
&& this.toSlotId == var2.toSlotId;
}
}
@Override
class="kw">public int hashCode() {
class="kw">return Objects.hash(this.fromSectionId, this.fromSlotId, this.quantity, this.toSectionId, this.toSlotId);
}
}