PlaySoundEvent3D class
Пакет: com.hypixel.hytale.protocol.packets.world
Файл: com/hypixel/hytale/protocol/packets/world/PlaySoundEvent3D.java
implements: Packet, ToClientPacket
Поля (7)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
int |
PACKET_ID |
|
PlaySoundEvent3D |
var1 |
|
long |
var2 |
|
byte |
var2 |
|
PlaySoundEvent3D |
var3 |
|
byte |
var3 |
|
|
var3 |
Методы (27)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
PlaySoundEvent3D |
clonePlaySoundEvent3D clone() |
static |
SoundCategory |
getCategorySoundCategory getCategory(MemorySegment var0) |
static |
SoundCategory |
getCategorySoundCategory getCategory(MemorySegment var0, int var1) |
abstract |
return |
getCategoryreturn getCategory(var0, 0) |
static |
float |
getPitchModifierfloat getPitchModifier(MemorySegment var0) |
static |
float |
getPitchModifierfloat getPitchModifier(MemorySegment var0, int var1) |
abstract |
return |
getPitchModifierreturn getPitchModifier(var0, 0) |
abstract |
return |
getPositionreturn getPosition(var0, 0) |
static |
int |
getSoundEventIndexint getSoundEventIndex(MemorySegment var0) |
static |
int |
getSoundEventIndexint getSoundEventIndex(MemorySegment var0, int var1) |
abstract |
return |
getSoundEventIndexreturn getSoundEventIndex(var0, 0) |
static |
float |
getVolumeModifierfloat getVolumeModifier(MemorySegment var0) |
static |
float |
getVolumeModifierfloat getVolumeModifier(MemorySegment var0, int var1) |
abstract |
return |
getVolumeModifierreturn getVolumeModifier(var0, 0) |
static |
boolean |
hasPositionboolean hasPosition(MemorySegment var0, int var1) |
|
|
if if(var1 < 0) |
|
|
if if(var2 != null) |
|
|
if if(this.position != null) |
|
|
if if(this.position != null) |
|
|
if if(this == var1) |
static |
void |
requireBoundsvoid requireBounds(MemorySegment var0, int var1) |
abstract |
|
requireBounds requireBounds(var0, var1) |
static |
PlaySoundEvent3D |
toObjectPlaySoundEvent3D toObject(MemorySegment var0) |
static |
PlaySoundEvent3D |
toObjectPlaySoundEvent3D toObject(MemorySegment var0, int var1) |
static |
PlaySoundEvent3D |
toObjectPlaySoundEvent3D 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.world;
class="kw">import com.hypixel.hytale.protocol.NetworkChannel;
class="kw">import com.hypixel.hytale.protocol.Packet;
class="kw">import com.hypixel.hytale.protocol.Position;
class="kw">import com.hypixel.hytale.protocol.SoundCategory;
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 PlaySoundEvent3D class="kw">implements Packet, ToClientPacket {
class="kw">public class="kw">static class="kw">final int PACKET_ID = 155;
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 = 1;
class="kw">public class="kw">static class="kw">final int FIXED_BLOCK_SIZE = 38;
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 = 38;
class="kw">public class="kw">static class="kw">final int MAX_SIZE = 38;
class="kw">public int soundEventIndex;
@Nonnull
class="kw">public SoundCategory category = SoundCategory.Music;
@Nullable
class="kw">public Position position;
class="kw">public float volumeModifier;
class="kw">public float pitchModifier;
@Override
class="kw">public int getId() {
class="kw">return 155;
}
@Override
class="kw">public NetworkChannel getChannel() {
class="kw">return NetworkChannel.Default;
}
class="kw">public PlaySoundEvent3D() {
}
class="kw">public PlaySoundEvent3D(int var1, @Nonnull SoundCategory var2, @Nullable Position var3, float var4, float var5) {
this.soundEventIndex = var1;
this.category = var2;
this.position = var3;
this.volumeModifier = var4;
this.pitchModifier = var5;
}
class="kw">public PlaySoundEvent3D(@Nonnull PlaySoundEvent3D var1) {
this.soundEventIndex = var1.soundEventIndex;
this.category = var1.category;
this.position = var1.position;
this.volumeModifier = var1.volumeModifier;
this.pitchModifier = var1.pitchModifier;
}
class="kw">public class="kw">static void requireBounds(MemorySegment var0, int var1) {
if (var1 < 0) {
throw ProtocolException.invalidOffset("PlaySoundEvent3D", var1, (int)var0.byteSize());
}
long var2 = var1 + 38L;
if (var2 > var0.byteSize()) {
throw ProtocolException.bufferTooSmall("PlaySoundEvent3D", (int)Math.min(var2, 2147483647L), (int)var0.byteSize());
}
}
class="kw">public class="kw">static int getSoundEventIndex(MemorySegment var0) {
class="kw">return getSoundEventIndex(var0, 0);
}
class="kw">public class="kw">static int getSoundEventIndex(MemorySegment var0, int var1) {
class="kw">return var0.get(PacketIO.PROTO_INT, var1 + 1);
}
class="kw">public class="kw">static SoundCategory getCategory(MemorySegment var0) {
class="kw">return getCategory(var0, 0);
}
class="kw">public class="kw">static SoundCategory getCategory(MemorySegment var0, int var1) {
class="kw">return SoundCategory.fromValue(var0.get(PacketIO.PROTO_BYTE, var1 + 5));
}
@Nullable
class="kw">public class="kw">static Position getPosition(MemorySegment var0) {
class="kw">return getPosition(var0, 0);
}
@Nullable
class="kw">public class="kw">static Position getPosition(MemorySegment var0, int var1) {
class="kw">return hasPosition(var0, var1) ? Position.toObject(var0, var1 + 6) : null;
}
class="kw">public class="kw">static float getVolumeModifier(MemorySegment var0) {
class="kw">return getVolumeModifier(var0, 0);
}
class="kw">public class="kw">static float getVolumeModifier(MemorySegment var0, int var1) {
class="kw">return PacketIO.requireFinite(var0.get(PacketIO.PROTO_FLOAT, var1 + 30), "VolumeModifier");
}
class="kw">public class="kw">static float getPitchModifier(MemorySegment var0) {
class="kw">return getPitchModifier(var0, 0);
}
class="kw">public class="kw">static float getPitchModifier(MemorySegment var0, int var1) {
class="kw">return PacketIO.requireFinite(var0.get(PacketIO.PROTO_FLOAT, var1 + 34), "PitchModifier");
}
class="kw">public class="kw">static boolean hasPosition(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 PlaySoundEvent3D toObject(MemorySegment var0) {
class="kw">return toObject(var0, 0, null);
}
class="kw">public class="kw">static PlaySoundEvent3D toObject(MemorySegment var0, int var1) {
class="kw">return toObject(var0, var1, null);
}
class="kw">public class="kw">static PlaySoundEvent3D toObject(MemorySegment var0, int var1, @Nullable ReadCursor var2) {
requireBounds(var0, var1);
PlaySoundEvent3D var3 = new PlaySoundEvent3D(
var0.get(PacketIO.PROTO_INT, var1 + 1),
SoundCategory.fromValue(var0.get(PacketIO.PROTO_BYTE, var1 + 5)),
hasPosition(var0, var1) ? Position.toObject(var0, var1 + 6) : null,
PacketIO.requireFinite(var0.get(PacketIO.PROTO_FLOAT, var1 + 30), "VolumeModifier"),
PacketIO.requireFinite(var0.get(PacketIO.PROTO_FLOAT, var1 + 34), "PitchModifier")
);
if (var2 != null) {
var2.position = var1 + 38;
}
class="kw">return var3;
}
@Override
class="kw">public int serialize(@Nonnull MemorySegment var1, int var2) {
byte var3 = 0;
if (this.position != null) {
var3 = (byte)(var3 | 1);
}
var1.set(PacketIO.PROTO_BYTE, var2 + 0, var3);
var1.set(PacketIO.PROTO_INT, var2 + 1, this.soundEventIndex);
var1.set(PacketIO.PROTO_BYTE, var2 + 5, (byte)this.category.getValue());
if (this.position != null) {
this.position.serialize(var1, var2 + 6);
} else {
var1.asSlice(var2 + 6, 24L).fill((byte)0);
}
PacketIO.requireFinite(this.volumeModifier, "VolumeModifier");
var1.set(PacketIO.PROTO_FLOAT, var2 + 30, this.volumeModifier);
PacketIO.requireFinite(this.pitchModifier, "PitchModifier");
var1.set(PacketIO.PROTO_FLOAT, var2 + 34, this.pitchModifier);
class="kw">return 38;
}
@Override
class="kw">public int computeSize() {
class="kw">return 38;
}
class="kw">public PlaySoundEvent3D clone() {
PlaySoundEvent3D var1 = new PlaySoundEvent3D();
var1.soundEventIndex = this.soundEventIndex;
var1.category = this.category;
var1.position = this.position != null ? this.position.clone() : null;
var1.volumeModifier = this.volumeModifier;
var1.pitchModifier = this.pitchModifier;
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 PlaySoundEvent3D var2)
? false
: this.soundEventIndex == var2.soundEventIndex
&& Objects.equals(this.category, var2.category)
&& Objects.equals(this.position, var2.position)
&& this.volumeModifier == var2.volumeModifier
&& this.pitchModifier == var2.pitchModifier;
}
}
@Override
class="kw">public int hashCode() {
class="kw">return Objects.hash(this.soundEventIndex, this.category, this.position, this.volumeModifier, this.pitchModifier);
}
}