UpdatePlayerInventory class
Пакет: com.hypixel.hytale.protocol.packets.inventory
Файл: com/hypixel/hytale/protocol/packets/inventory/UpdatePlayerInventory.java
implements: Packet, ToClientPacket
Поля (42)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
int |
PACKET_ID |
|
int |
var1 |
|
UpdatePlayerInventory |
var1 |
|
InventorySection |
var10 |
|
|
var10 |
|
InventorySection |
var11 |
|
|
var11 |
|
UpdatePlayerInventory |
var12 |
|
long |
var2 |
|
byte |
var2 |
|
byte |
var2 |
|
byte |
var2 |
|
byte |
var2 |
|
byte |
var2 |
|
byte |
var2 |
|
int |
var3 |
|
byte |
var3 |
|
|
var3 |
|
|
var3 |
|
|
var3 |
|
|
var3 |
|
|
var3 |
|
|
var3 |
|
int |
var4 |
|
int |
var4 |
|
|
var4 |
|
|
var4 |
|
|
var4 |
|
|
var4 |
|
|
var4 |
|
|
var4 |
|
int |
var4 |
|
int |
var5 |
|
ReadCursor |
var5 |
|
InventorySection |
var6 |
|
|
var6 |
|
InventorySection |
var7 |
|
|
var7 |
|
InventorySection |
var8 |
|
|
var8 |
|
InventorySection |
var9 |
|
|
var9 |
Методы (56)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
UpdatePlayerInventory |
cloneUpdatePlayerInventory clone() |
abstract |
return |
getArmorreturn getArmor(var0, 0) |
abstract |
return |
getBackpackreturn getBackpack(var0, 0) |
abstract |
return |
getHotbarreturn getHotbar(var0, 0) |
abstract |
return |
getStoragereturn getStorage(var0, 0) |
abstract |
return |
getToolsreturn getTools(var0, 0) |
abstract |
return |
getUtilityreturn getUtility(var0, 0) |
static |
int |
getValidatedOffsetint getValidatedOffset(MemorySegment var0, int var1, int var2, int var3, String var4) |
static |
boolean |
hasArmorboolean hasArmor(MemorySegment var0, int var1) |
static |
boolean |
hasBackpackboolean hasBackpack(MemorySegment var0, int var1) |
static |
boolean |
hasHotbarboolean hasHotbar(MemorySegment var0, int var1) |
static |
boolean |
hasStorageboolean hasStorage(MemorySegment var0, int var1) |
static |
boolean |
hasToolsboolean hasTools(MemorySegment var0, int var1) |
static |
boolean |
hasUtilityboolean hasUtility(MemorySegment var0, int var1) |
|
|
if if(var1 < 0) |
|
|
if if(var4 != var2) |
|
|
if if(var2 != null) |
|
|
if if(this.storage != null) |
|
|
if if(this.armor != null) |
|
|
if if(this.hotbar != null) |
|
|
if if(this.utility != null) |
|
|
if if(this.tools != null) |
|
|
if if(this.backpack != null) |
|
|
if if(this.storage != null) |
|
|
if if(this.armor != null) |
|
|
if if(this.hotbar != null) |
|
|
if if(this.utility != null) |
|
|
if if(this.tools != null) |
|
|
if if(this.backpack != null) |
|
|
if if(this.storage != null) |
|
|
if if(this.armor != null) |
|
|
if if(this.hotbar != null) |
|
|
if if(this.utility != null) |
|
|
if if(this.tools != null) |
|
|
if if(this.backpack != null) |
|
|
if if(this == var1) |
static |
void |
requireBoundsvoid requireBounds(MemorySegment var0, int var1) |
abstract |
|
requireBounds requireBounds(var0, var1) |
static |
void |
requireSlotvoid requireSlot(MemorySegment var0, int var1, int var2, String var3) |
abstract |
|
requireSlot requireSlot(var0, var1 + 1, var4, "Storage") |
abstract |
|
requireSlot requireSlot(var0, var1 + 1, -1, "Storage") |
abstract |
|
requireSlot requireSlot(var0, var1 + 5, var4, "Armor") |
abstract |
|
requireSlot requireSlot(var0, var1 + 5, -1, "Armor") |
abstract |
|
requireSlot requireSlot(var0, var1 + 9, var4, "Hotbar") |
abstract |
|
requireSlot requireSlot(var0, var1 + 9, -1, "Hotbar") |
abstract |
|
requireSlot requireSlot(var0, var1 + 13, var4, "Utility") |
abstract |
|
requireSlot requireSlot(var0, var1 + 13, -1, "Utility") |
abstract |
|
requireSlot requireSlot(var0, var1 + 17, var4, "Tools") |
abstract |
|
requireSlot requireSlot(var0, var1 + 17, -1, "Tools") |
abstract |
|
requireSlot requireSlot(var0, var1 + 21, var4, "Backpack") |
abstract |
|
requireSlot requireSlot(var0, var1 + 21, -1, "Backpack") |
static |
UpdatePlayerInventory |
toObjectUpdatePlayerInventory toObject(MemorySegment var0) |
static |
UpdatePlayerInventory |
toObjectUpdatePlayerInventory toObject(MemorySegment var0, int var1) |
static |
UpdatePlayerInventory |
toObjectUpdatePlayerInventory 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.InventorySection;
class="kw">import com.hypixel.hytale.protocol.NetworkChannel;
class="kw">import com.hypixel.hytale.protocol.Packet;
class="kw">import com.hypixel.hytale.protocol.ToClientPacket;
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 UpdatePlayerInventory class="kw">implements Packet, ToClientPacket {
class="kw">public class="kw">static class="kw">final int PACKET_ID = 170;
class="kw">public class="kw">static class="kw">final boolean IS_COMPRESSED = true;
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 = 1;
class="kw">public class="kw">static class="kw">final int VARIABLE_FIELD_COUNT = 6;
class="kw">public class="kw">static class="kw">final int VARIABLE_BLOCK_START = 25;
class="kw">public class="kw">static class="kw">final int MAX_SIZE = 1677721600;
@Nullable
class="kw">public InventorySection storage;
@Nullable
class="kw">public InventorySection armor;
@Nullable
class="kw">public InventorySection hotbar;
@Nullable
class="kw">public InventorySection utility;
@Nullable
class="kw">public InventorySection tools;
@Nullable
class="kw">public InventorySection backpack;
@Override
class="kw">public int getId() {
class="kw">return 170;
}
@Override
class="kw">public NetworkChannel getChannel() {
class="kw">return NetworkChannel.Default;
}
class="kw">public UpdatePlayerInventory() {
}
class="kw">public UpdatePlayerInventory(
@Nullable InventorySection var1,
@Nullable InventorySection var2,
@Nullable InventorySection var3,
@Nullable InventorySection var4,
@Nullable InventorySection var5,
@Nullable InventorySection var6
) {
this.storage = var1;
this.armor = var2;
this.hotbar = var3;
this.utility = var4;
this.tools = var5;
this.backpack = var6;
}
class="kw">public UpdatePlayerInventory(@Nonnull UpdatePlayerInventory var1) {
this.storage = var1.storage;
this.armor = var1.armor;
this.hotbar = var1.hotbar;
this.utility = var1.utility;
this.tools = var1.tools;
this.backpack = var1.backpack;
}
class="kw">public class="kw">static void requireBounds(MemorySegment var0, int var1) {
if (var1 < 0) {
throw ProtocolException.invalidOffset("UpdatePlayerInventory", var1, (int)var0.byteSize());
}
long var2 = var1 + 25L;
if (var2 > var0.byteSize()) {
throw ProtocolException.bufferTooSmall("UpdatePlayerInventory", (int)Math.min(var2, 2147483647L), (int)var0.byteSize());
}
}
@Nullable
class="kw">public class="kw">static InventorySection getStorage(MemorySegment var0) {
class="kw">return getStorage(var0, 0);
}
@Nullable
class="kw">public class="kw">static InventorySection getStorage(MemorySegment var0, int var1) {
class="kw">return hasStorage(var0, var1) ? InventorySection.toObject(var0, var1 + getValidatedOffset(var0, var1, 1, 25, "Storage")) : null;
}
@Nullable
class="kw">public class="kw">static InventorySection getArmor(MemorySegment var0) {
class="kw">return getArmor(var0, 0);
}
@Nullable
class="kw">public class="kw">static InventorySection getArmor(MemorySegment var0, int var1) {
class="kw">return hasArmor(var0, var1) ? InventorySection.toObject(var0, var1 + getValidatedOffset(var0, var1, 5, 25, "Armor")) : null;
}
@Nullable
class="kw">public class="kw">static InventorySection getHotbar(MemorySegment var0) {
class="kw">return getHotbar(var0, 0);
}
@Nullable
class="kw">public class="kw">static InventorySection getHotbar(MemorySegment var0, int var1) {
class="kw">return hasHotbar(var0, var1) ? InventorySection.toObject(var0, var1 + getValidatedOffset(var0, var1, 9, 25, "Hotbar")) : null;
}
@Nullable
class="kw">public class="kw">static InventorySection getUtility(MemorySegment var0) {
class="kw">return getUtility(var0, 0);
}
@Nullable
class="kw">public class="kw">static InventorySection getUtility(MemorySegment var0, int var1) {
class="kw">return hasUtility(var0, var1) ? InventorySection.toObject(var0, var1 + getValidatedOffset(var0, var1, 13, 25, "Utility")) : null;
}
@Nullable
class="kw">public class="kw">static InventorySection getTools(MemorySegment var0) {
class="kw">return getTools(var0, 0);
}
@Nullable
class="kw">public class="kw">static InventorySection getTools(MemorySegment var0, int var1) {
class="kw">return hasTools(var0, var1) ? InventorySection.toObject(var0, var1 + getValidatedOffset(var0, var1, 17, 25, "Tools")) : null;
}
@Nullable
class="kw">public class="kw">static InventorySection getBackpack(MemorySegment var0) {
class="kw">return getBackpack(var0, 0);
}
@Nullable
class="kw">public class="kw">static InventorySection getBackpack(MemorySegment var0, int var1) {
class="kw">return hasBackpack(var0, var1) ? InventorySection.toObject(var0, var1 + getValidatedOffset(var0, var1, 21, 25, "Backpack")) : null;
}
class="kw">public class="kw">static boolean hasStorage(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 hasArmor(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 boolean hasHotbar(MemorySegment var0, int var1) {
byte var2 = var0.get(PacketIO.PROTO_BYTE, var1 + 0);
class="kw">return (var2 & 4) != 0;
}
class="kw">public class="kw">static boolean hasUtility(MemorySegment var0, int var1) {
byte var2 = var0.get(PacketIO.PROTO_BYTE, var1 + 0);
class="kw">return (var2 & 8) != 0;
}
class="kw">public class="kw">static boolean hasTools(MemorySegment var0, int var1) {
byte var2 = var0.get(PacketIO.PROTO_BYTE, var1 + 0);
class="kw">return (var2 & 16) != 0;
}
class="kw">public class="kw">static boolean hasBackpack(MemorySegment var0, int var1) {
byte var2 = var0.get(PacketIO.PROTO_BYTE, var1 + 0);
class="kw">return (var2 & 32) != 0;
}
class="kw">private class="kw">static int getValidatedOffset(MemorySegment var0, int var1, int var2, int var3, String var4) {
int var5 = var0.get(PacketIO.PROTO_INT, var1 + var2);
if (var5 >= 0 && var5 <= var0.byteSize() - var1 - var3) {
class="kw">return var3 + var5;
} else {
throw ProtocolException.invalidOffset(var4, var5, (int)var0.byteSize());
}
}
class="kw">private class="kw">static void requireSlot(MemorySegment var0, int var1, int var2, String var3) {
int var4 = var0.get(PacketIO.PROTO_INT, var1);
if (var4 != var2) {
throw ProtocolException.nonCanonicalLayout(var3, var4, var2);
}
}
class="kw">public class="kw">static UpdatePlayerInventory toObject(MemorySegment var0) {
class="kw">return toObject(var0, 0, null);
}
class="kw">public class="kw">static UpdatePlayerInventory toObject(MemorySegment var0, int var1) {
class="kw">return toObject(var0, var1, null);
}
class="kw">public class="kw">static UpdatePlayerInventory toObject(MemorySegment var0, int var1, @Nullable ReadCursor var2) {
requireBounds(var0, var1);
int var3 = var1 + 25;
int var4 = 0;
ReadCursor var5 = var2 != null ? var2 : new ReadCursor();
InventorySection var6 = null;
if (hasStorage(var0, var1)) {
requireSlot(var0, var1 + 1, var4, "Storage");
var6 = InventorySection.toObject(var0, var3 + var4, var5);
var4 = var5.position - var3;
} else {
requireSlot(var0, var1 + 1, -1, "Storage");
}
InventorySection var7 = null;
if (hasArmor(var0, var1)) {
requireSlot(var0, var1 + 5, var4, "Armor");
var7 = InventorySection.toObject(var0, var3 + var4, var5);
var4 = var5.position - var3;
} else {
requireSlot(var0, var1 + 5, -1, "Armor");
}
InventorySection var8 = null;
if (hasHotbar(var0, var1)) {
requireSlot(var0, var1 + 9, var4, "Hotbar");
var8 = InventorySection.toObject(var0, var3 + var4, var5);
var4 = var5.position - var3;
} else {
requireSlot(var0, var1 + 9, -1, "Hotbar");
}
InventorySection var9 = null;
if (hasUtility(var0, var1)) {
requireSlot(var0, var1 + 13, var4, "Utility");
var9 = InventorySection.toObject(var0, var3 + var4, var5);
var4 = var5.position - var3;
} else {
requireSlot(var0, var1 + 13, -1, "Utility");
}
InventorySection var10 = null;
if (hasTools(var0, var1)) {
requireSlot(var0, var1 + 17, var4, "Tools");
var10 = InventorySection.toObject(var0, var3 + var4, var5);
var4 = var5.position - var3;
} else {
requireSlot(var0, var1 + 17, -1, "Tools");
}
InventorySection var11 = null;
if (hasBackpack(var0, var1)) {
requireSlot(var0, var1 + 21, var4, "Backpack");
var11 = InventorySection.toObject(var0, var3 + var4, var5);
var4 = var5.position - var3;
} else {
requireSlot(var0, var1 + 21, -1, "Backpack");
}
UpdatePlayerInventory var12 = new UpdatePlayerInventory(var6, var7, var8, var9, var10, var11);
if (var2 != null) {
var2.position = var3 + var4;
}
class="kw">return var12;
}
@Override
class="kw">public int serialize(@Nonnull MemorySegment var1, int var2) {
byte var3 = 0;
if (this.storage != null) {
var3 = (byte)(var3 | 1);
}
if (this.armor != null) {
var3 = (byte)(var3 | 2);
}
if (this.hotbar != null) {
var3 = (byte)(var3 | 4);
}
if (this.utility != null) {
var3 = (byte)(var3 | 8);
}
if (this.tools != null) {
var3 = (byte)(var3 | 16);
}
if (this.backpack != null) {
var3 = (byte)(var3 | 32);
}
var1.set(PacketIO.PROTO_BYTE, var2 + 0, var3);
int var4 = var2 + 25;
if (this.storage != null) {
var1.set(PacketIO.PROTO_INT, var2 + 1, var4 - var2 - 25);
var4 += this.storage.serialize(var1, var4);
} else {
var1.set(PacketIO.PROTO_INT, var2 + 1, -1);
}
if (this.armor != null) {
var1.set(PacketIO.PROTO_INT, var2 + 5, var4 - var2 - 25);
var4 += this.armor.serialize(var1, var4);
} else {
var1.set(PacketIO.PROTO_INT, var2 + 5, -1);
}
if (this.hotbar != null) {
var1.set(PacketIO.PROTO_INT, var2 + 9, var4 - var2 - 25);
var4 += this.hotbar.serialize(var1, var4);
} else {
var1.set(PacketIO.PROTO_INT, var2 + 9, -1);
}
if (this.utility != null) {
var1.set(PacketIO.PROTO_INT, var2 + 13, var4 - var2 - 25);
var4 += this.utility.serialize(var1, var4);
} else {
var1.set(PacketIO.PROTO_INT, var2 + 13, -1);
}
if (this.tools != null) {
var1.set(PacketIO.PROTO_INT, var2 + 17, var4 - var2 - 25);
var4 += this.tools.serialize(var1, var4);
} else {
var1.set(PacketIO.PROTO_INT, var2 + 17, -1);
}
if (this.backpack != null) {
var1.set(PacketIO.PROTO_INT, var2 + 21, var4 - var2 - 25);
var4 += this.backpack.serialize(var1, var4);
} else {
var1.set(PacketIO.PROTO_INT, var2 + 21, -1);
}
class="kw">return var4 - var2;
}
@Override
class="kw">public int computeSize() {
int var1 = 25;
if (this.storage != null) {
var1 += this.storage.computeSize();
}
if (this.armor != null) {
var1 += this.armor.computeSize();
}
if (this.hotbar != null) {
var1 += this.hotbar.computeSize();
}
if (this.utility != null) {
var1 += this.utility.computeSize();
}
if (this.tools != null) {
var1 += this.tools.computeSize();
}
if (this.backpack != null) {
var1 += this.backpack.computeSize();
}
class="kw">return var1;
}
class="kw">public UpdatePlayerInventory clone() {
UpdatePlayerInventory var1 = new UpdatePlayerInventory();
var1.storage = this.storage != null ? this.storage.clone() : null;
var1.armor = this.armor != null ? this.armor.clone() : null;
var1.hotbar = this.hotbar != null ? this.hotbar.clone() : null;
var1.utility = this.utility != null ? this.utility.clone() : null;
var1.tools = this.tools != null ? this.tools.clone() : null;
var1.backpack = this.backpack != null ? this.backpack.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 UpdatePlayerInventory var2)
? false
: Objects.equals(this.storage, var2.storage)
&& Objects.equals(this.armor, var2.armor)
&& Objects.equals(this.hotbar, var2.hotbar)
&& Objects.equals(this.utility, var2.utility)
&& Objects.equals(this.tools, var2.tools)
&& Objects.equals(this.backpack, var2.backpack);
}
}
@Override
class="kw">public int hashCode() {
class="kw">return Objects.hash(this.storage, this.armor, this.hotbar, this.utility, this.tools, this.backpack);
}
}