mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-12-13 09:11:03 -05:00
commit
1590c1a4a3
7 changed files with 27 additions and 37 deletions
|
@ -2,8 +2,8 @@ package org.spacehq.mc.protocol;
|
||||||
|
|
||||||
public class MinecraftConstants {
|
public class MinecraftConstants {
|
||||||
// General Constants
|
// General Constants
|
||||||
public static final String GAME_VERSION = "1.9.4";
|
public static final String GAME_VERSION = "1.10";
|
||||||
public static final int PROTOCOL_VERSION = 110;
|
public static final int PROTOCOL_VERSION = 210;
|
||||||
|
|
||||||
// General Key Constants
|
// General Key Constants
|
||||||
public static final String PROFILE_KEY = "profile";
|
public static final String PROFILE_KEY = "profile";
|
||||||
|
|
|
@ -306,7 +306,6 @@ public class MagicValues {
|
||||||
|
|
||||||
register(GlobalEntityType.LIGHTNING_BOLT, 1);
|
register(GlobalEntityType.LIGHTNING_BOLT, 1);
|
||||||
|
|
||||||
register(MobType.ARMOR_STAND, 30);
|
|
||||||
register(MobType.MOB, 48);
|
register(MobType.MOB, 48);
|
||||||
register(MobType.MONSTER, 49);
|
register(MobType.MONSTER, 49);
|
||||||
register(MobType.CREEPER, 50);
|
register(MobType.CREEPER, 50);
|
||||||
|
@ -341,6 +340,7 @@ public class MagicValues {
|
||||||
register(MobType.IRON_GOLEM, 99);
|
register(MobType.IRON_GOLEM, 99);
|
||||||
register(MobType.HORSE, 100);
|
register(MobType.HORSE, 100);
|
||||||
register(MobType.RABBIT, 101);
|
register(MobType.RABBIT, 101);
|
||||||
|
register(MobType.POLAR_BEAR, 102);
|
||||||
register(MobType.VILLAGER, 120);
|
register(MobType.VILLAGER, 120);
|
||||||
|
|
||||||
register(ObjectType.BOAT, 1);
|
register(ObjectType.BOAT, 1);
|
||||||
|
@ -807,7 +807,8 @@ public class MagicValues {
|
||||||
|
|
||||||
for(BuiltinSound sound : BuiltinSound.values()) {
|
for(BuiltinSound sound : BuiltinSound.values()) {
|
||||||
register(sound, sound.ordinal());
|
register(sound, sound.ordinal());
|
||||||
register(sound, sound.name().toLowerCase().replace('_', '.'));
|
// TODO: Change this
|
||||||
|
register(sound, sound.name().toLowerCase().replace('_', '.').replace("enchantment.table", "enchantment_table").replace("polar.bear", "polar_bear").replace("wither.skeleton", "wither_skeleton"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package org.spacehq.mc.protocol.data.game.entity.type;
|
package org.spacehq.mc.protocol.data.game.entity.type;
|
||||||
|
|
||||||
public enum MobType {
|
public enum MobType {
|
||||||
ARMOR_STAND,
|
|
||||||
MOB,
|
MOB,
|
||||||
MONSTER,
|
MONSTER,
|
||||||
CREEPER,
|
CREEPER,
|
||||||
|
@ -36,5 +35,6 @@ public enum MobType {
|
||||||
IRON_GOLEM,
|
IRON_GOLEM,
|
||||||
HORSE,
|
HORSE,
|
||||||
RABBIT,
|
RABBIT,
|
||||||
|
POLAR_BEAR,
|
||||||
VILLAGER;
|
VILLAGER;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ public enum BuiltinSound implements Sound {
|
||||||
BLOCK_DISPENSER_DISPENSE,
|
BLOCK_DISPENSER_DISPENSE,
|
||||||
BLOCK_DISPENSER_FAIL,
|
BLOCK_DISPENSER_FAIL,
|
||||||
BLOCK_DISPENSER_LAUNCH,
|
BLOCK_DISPENSER_LAUNCH,
|
||||||
|
BLOCK_ENCHANTMENT_TABLE_USE,
|
||||||
BLOCK_END_GATEWAY_SPAWN,
|
BLOCK_END_GATEWAY_SPAWN,
|
||||||
BLOCK_ENDERCHEST_CLOSE,
|
BLOCK_ENDERCHEST_CLOSE,
|
||||||
BLOCK_ENDERCHEST_OPEN,
|
BLOCK_ENDERCHEST_OPEN,
|
||||||
|
@ -249,6 +250,10 @@ public enum BuiltinSound implements Sound {
|
||||||
ENTITY_HOSTILE_SMALL_FALL,
|
ENTITY_HOSTILE_SMALL_FALL,
|
||||||
ENTITY_HOSTILE_SPLASH,
|
ENTITY_HOSTILE_SPLASH,
|
||||||
ENTITY_HOSTILE_SWIM,
|
ENTITY_HOSTILE_SWIM,
|
||||||
|
ENTITY_HUSK_AMBIENT,
|
||||||
|
ENTITY_HUSK_DEATH,
|
||||||
|
ENTITY_HUSK_HURT,
|
||||||
|
ENTITY_HUSK_STEP,
|
||||||
ENTITY_IRONGOLEM_ATTACK,
|
ENTITY_IRONGOLEM_ATTACK,
|
||||||
ENTITY_IRONGOLEM_DEATH,
|
ENTITY_IRONGOLEM_DEATH,
|
||||||
ENTITY_IRONGOLEM_HURT,
|
ENTITY_IRONGOLEM_HURT,
|
||||||
|
@ -297,6 +302,12 @@ public enum BuiltinSound implements Sound {
|
||||||
ENTITY_PLAYER_SMALL_FALL,
|
ENTITY_PLAYER_SMALL_FALL,
|
||||||
ENTITY_PLAYER_SPLASH,
|
ENTITY_PLAYER_SPLASH,
|
||||||
ENTITY_PLAYER_SWIM,
|
ENTITY_PLAYER_SWIM,
|
||||||
|
ENTITY_POLAR_BEAR_AMBIENT,
|
||||||
|
ENTITY_POLAR_BEAR_BABY_AMBIENT,
|
||||||
|
ENTITY_POLAR_BEAR_DEATH,
|
||||||
|
ENTITY_POLAR_BEAR_HURT,
|
||||||
|
ENTITY_POLAR_BEAR_STEP,
|
||||||
|
ENTITY_POLAR_BEAR_WARNING,
|
||||||
ENTITY_RABBIT_AMBIENT,
|
ENTITY_RABBIT_AMBIENT,
|
||||||
ENTITY_RABBIT_ATTACK,
|
ENTITY_RABBIT_ATTACK,
|
||||||
ENTITY_RABBIT_DEATH,
|
ENTITY_RABBIT_DEATH,
|
||||||
|
@ -372,6 +383,10 @@ public enum BuiltinSound implements Sound {
|
||||||
ENTITY_WITHER_DEATH,
|
ENTITY_WITHER_DEATH,
|
||||||
ENTITY_WITHER_HURT,
|
ENTITY_WITHER_HURT,
|
||||||
ENTITY_WITHER_SHOOT,
|
ENTITY_WITHER_SHOOT,
|
||||||
|
ENTITY_WITHER_SKELETON_AMBIENT,
|
||||||
|
ENTITY_WITHER_SKELETON_DEATH,
|
||||||
|
ENTITY_WITHER_SKELETON_HURT,
|
||||||
|
ENTITY_WITHER_SKELETON_STEP,
|
||||||
ENTITY_WITHER_SPAWN,
|
ENTITY_WITHER_SPAWN,
|
||||||
ENTITY_WOLF_AMBIENT,
|
ENTITY_WOLF_AMBIENT,
|
||||||
ENTITY_WOLF_DEATH,
|
ENTITY_WOLF_DEATH,
|
||||||
|
|
|
@ -10,35 +10,27 @@ import org.spacehq.packetlib.packet.Packet;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class ClientResourcePackStatusPacket implements Packet {
|
public class ClientResourcePackStatusPacket implements Packet {
|
||||||
private String hash;
|
|
||||||
private ResourcePackStatus status;
|
private ResourcePackStatus status;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private ClientResourcePackStatusPacket() {
|
private ClientResourcePackStatusPacket() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClientResourcePackStatusPacket(String hash, ResourcePackStatus status) {
|
public ClientResourcePackStatusPacket(ResourcePackStatus status) {
|
||||||
this.hash = hash;
|
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHash() {
|
|
||||||
return this.hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResourcePackStatus getStatus() {
|
public ResourcePackStatus getStatus() {
|
||||||
return this.status;
|
return this.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(NetInput in) throws IOException {
|
public void read(NetInput in) throws IOException {
|
||||||
this.hash = in.readString();
|
|
||||||
this.status = MagicValues.key(ResourcePackStatus.class, in.readVarInt());
|
this.status = MagicValues.key(ResourcePackStatus.class, in.readVarInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(NetOutput out) throws IOException {
|
public void write(NetOutput out) throws IOException {
|
||||||
out.writeString(this.hash);
|
|
||||||
out.writeVarInt(MagicValues.value(Integer.class, this.status));
|
out.writeVarInt(MagicValues.value(Integer.class, this.status));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class ServerPlayBuiltinSoundPacket implements Packet {
|
||||||
this.y = in.readInt() / 8D;
|
this.y = in.readInt() / 8D;
|
||||||
this.z = in.readInt() / 8D;
|
this.z = in.readInt() / 8D;
|
||||||
this.volume = in.readFloat();
|
this.volume = in.readFloat();
|
||||||
this.pitch = in.readUnsignedByte() / 63.5f;
|
this.pitch = in.readFloat();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -81,16 +81,7 @@ public class ServerPlayBuiltinSoundPacket implements Packet {
|
||||||
out.writeInt((int) (this.y * 8));
|
out.writeInt((int) (this.y * 8));
|
||||||
out.writeInt((int) (this.z * 8));
|
out.writeInt((int) (this.z * 8));
|
||||||
out.writeFloat(this.volume);
|
out.writeFloat(this.volume);
|
||||||
int pitch = (int) (this.pitch * 63.5f);
|
out.writeFloat(this.pitch);
|
||||||
if(pitch > 255) {
|
|
||||||
pitch = 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(pitch < 0) {
|
|
||||||
pitch = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
out.writeByte(pitch);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class ServerPlaySoundPacket implements Packet {
|
||||||
this.y = in.readInt() / 8D;
|
this.y = in.readInt() / 8D;
|
||||||
this.z = in.readInt() / 8D;
|
this.z = in.readInt() / 8D;
|
||||||
this.volume = in.readFloat();
|
this.volume = in.readFloat();
|
||||||
this.pitch = in.readUnsignedByte() / 63f;
|
this.pitch = in.readFloat();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -87,7 +87,7 @@ public class ServerPlaySoundPacket implements Packet {
|
||||||
if(this.sound instanceof CustomSound) {
|
if(this.sound instanceof CustomSound) {
|
||||||
value = ((CustomSound) this.sound).getName();
|
value = ((CustomSound) this.sound).getName();
|
||||||
} else if(this.sound instanceof BuiltinSound) {
|
} else if(this.sound instanceof BuiltinSound) {
|
||||||
value = MagicValues.value(String.class, (BuiltinSound) this.sound);
|
value = MagicValues.value(String.class, this.sound);
|
||||||
}
|
}
|
||||||
|
|
||||||
out.writeString(value);
|
out.writeString(value);
|
||||||
|
@ -96,16 +96,7 @@ public class ServerPlaySoundPacket implements Packet {
|
||||||
out.writeInt((int) (this.y * 8));
|
out.writeInt((int) (this.y * 8));
|
||||||
out.writeInt((int) (this.z * 8));
|
out.writeInt((int) (this.z * 8));
|
||||||
out.writeFloat(this.volume);
|
out.writeFloat(this.volume);
|
||||||
int pitch = (int) (this.pitch * 63);
|
out.writeFloat(this.pitch);
|
||||||
if(pitch > 255) {
|
|
||||||
pitch = 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(pitch < 0) {
|
|
||||||
pitch = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
out.writeByte(pitch);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue