mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-11-14 19:34:58 -05:00
General cleanup, fixes, and re-versioning.
This commit is contained in:
parent
2b39ead979
commit
b22cd66d4f
240 changed files with 9618 additions and 9445 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -1,12 +1,13 @@
|
||||||
bin
|
bin
|
||||||
lib
|
lib
|
||||||
|
target
|
||||||
|
testing
|
||||||
|
|
||||||
.settings
|
.settings
|
||||||
.classpath
|
.classpath
|
||||||
.project
|
.project
|
||||||
|
.directory
|
||||||
|
|
||||||
*.iml
|
*.iml
|
||||||
.idea
|
.idea
|
||||||
|
|
||||||
target
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Copyright (C) 2013-2014 Steveice10
|
Copyright (C) 2013-2015 Steveice10
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
|
30
README.md
30
README.md
|
@ -1,30 +1,14 @@
|
||||||
<b><center><h1>MCProtocolLib</h></center></b>
|
# MCProtocolLib
|
||||||
==========
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<b>About MCProtocolLib</b>
|
|
||||||
--------
|
|
||||||
|
|
||||||
MCProtocolLib is a simple library for communicating with a Minecraft client/server. It aims to allow people to make custom bots, clients, or servers for Minecraft easily.
|
MCProtocolLib is a simple library for communicating with a Minecraft client/server. It aims to allow people to make custom bots, clients, or servers for Minecraft easily.
|
||||||
|
|
||||||
|
## Example Code
|
||||||
|
See example/org/spacehq/mc/protocol/test
|
||||||
|
|
||||||
<b>Example Code</b>
|
## Building the Source
|
||||||
--------
|
|
||||||
|
|
||||||
See example/org/spacehq/mc/protocol/test/Test.java
|
|
||||||
|
|
||||||
|
|
||||||
<b>Building the Source</b>
|
|
||||||
--------
|
|
||||||
|
|
||||||
MCProtocolLib uses Maven to manage dependencies. Simply run 'mvn clean install' in the source's directory.
|
MCProtocolLib uses Maven to manage dependencies. Simply run 'mvn clean install' in the source's directory.
|
||||||
Snapshots (if any exist) can be downloaded <b>[here](http://repo.spacehq.org/content/repositories/snapshots/org/spacehq/mcprotocollib)</b>.
|
|
||||||
Releases (if any exist) can be downloaded <b>[here](http://repo.spacehq.org/content/repositories/release/org/spacehq/mcprotocollib)</b>.
|
|
||||||
|
|
||||||
|
Builds can be downloaded **[here](http://build.spacehq.org/job/MCProtocolLib)**.
|
||||||
|
|
||||||
<b>License</b>
|
## License
|
||||||
---------
|
MCProtocolLib is licensed under the **[MIT license](http://www.opensource.org/licenses/mit-license.html)**.
|
||||||
|
|
||||||
MCProtocolLib is licensed under the <b>[MIT license](http://www.opensource.org/licenses/mit-license.html)</b>.
|
|
||||||
|
|
||||||
|
|
183
example/org/spacehq/mc/protocol/test/MinecraftProtocolTest.java
Normal file
183
example/org/spacehq/mc/protocol/test/MinecraftProtocolTest.java
Normal file
|
@ -0,0 +1,183 @@
|
||||||
|
package org.spacehq.mc.protocol.test;
|
||||||
|
|
||||||
|
import org.spacehq.mc.auth.GameProfile;
|
||||||
|
import org.spacehq.mc.auth.exception.AuthenticationException;
|
||||||
|
import org.spacehq.mc.protocol.MinecraftProtocol;
|
||||||
|
import org.spacehq.mc.protocol.ProtocolConstants;
|
||||||
|
import org.spacehq.mc.protocol.ProtocolMode;
|
||||||
|
import org.spacehq.mc.protocol.ServerLoginHandler;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.player.GameMode;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.setting.Difficulty;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.WorldType;
|
||||||
|
import org.spacehq.mc.protocol.data.message.ChatColor;
|
||||||
|
import org.spacehq.mc.protocol.data.message.ChatFormat;
|
||||||
|
import org.spacehq.mc.protocol.data.message.Message;
|
||||||
|
import org.spacehq.mc.protocol.data.message.MessageStyle;
|
||||||
|
import org.spacehq.mc.protocol.data.message.TextMessage;
|
||||||
|
import org.spacehq.mc.protocol.data.message.TranslationMessage;
|
||||||
|
import org.spacehq.mc.protocol.data.status.PlayerInfo;
|
||||||
|
import org.spacehq.mc.protocol.data.status.ServerStatusInfo;
|
||||||
|
import org.spacehq.mc.protocol.data.status.VersionInfo;
|
||||||
|
import org.spacehq.mc.protocol.data.status.handler.ServerInfoBuilder;
|
||||||
|
import org.spacehq.mc.protocol.data.status.handler.ServerInfoHandler;
|
||||||
|
import org.spacehq.mc.protocol.data.status.handler.ServerPingTimeHandler;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.ClientChatPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerChatPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
|
||||||
|
import org.spacehq.packetlib.Client;
|
||||||
|
import org.spacehq.packetlib.Server;
|
||||||
|
import org.spacehq.packetlib.Session;
|
||||||
|
import org.spacehq.packetlib.event.server.ServerAdapter;
|
||||||
|
import org.spacehq.packetlib.event.server.SessionAddedEvent;
|
||||||
|
import org.spacehq.packetlib.event.server.SessionRemovedEvent;
|
||||||
|
import org.spacehq.packetlib.event.session.DisconnectedEvent;
|
||||||
|
import org.spacehq.packetlib.event.session.PacketReceivedEvent;
|
||||||
|
import org.spacehq.packetlib.event.session.SessionAdapter;
|
||||||
|
import org.spacehq.packetlib.tcp.TcpSessionFactory;
|
||||||
|
|
||||||
|
import java.net.Proxy;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public class MinecraftProtocolTest {
|
||||||
|
private static final boolean SPAWN_SERVER = true;
|
||||||
|
private static final boolean VERIFY_USERS = false;
|
||||||
|
private static final String HOST = "127.0.0.1";
|
||||||
|
private static final int PORT = 25565;
|
||||||
|
private static final Proxy PROXY = Proxy.NO_PROXY;
|
||||||
|
private static final Proxy AUTH_PROXY = Proxy.NO_PROXY;
|
||||||
|
private static final String USERNAME = "Username";
|
||||||
|
private static final String PASSWORD = "Password";
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
if(SPAWN_SERVER) {
|
||||||
|
Server server = new Server(HOST, PORT, MinecraftProtocol.class, new TcpSessionFactory(PROXY));
|
||||||
|
server.setGlobalFlag(ProtocolConstants.AUTH_PROXY_KEY, AUTH_PROXY);
|
||||||
|
server.setGlobalFlag(ProtocolConstants.VERIFY_USERS_KEY, VERIFY_USERS);
|
||||||
|
server.setGlobalFlag(ProtocolConstants.SERVER_INFO_BUILDER_KEY, new ServerInfoBuilder() {
|
||||||
|
@Override
|
||||||
|
public ServerStatusInfo buildInfo(Session session) {
|
||||||
|
return new ServerStatusInfo(new VersionInfo(ProtocolConstants.GAME_VERSION, ProtocolConstants.PROTOCOL_VERSION), new PlayerInfo(100, 0, new GameProfile[0]), new TextMessage("Hello world!"), null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
server.setGlobalFlag(ProtocolConstants.SERVER_LOGIN_HANDLER_KEY, new ServerLoginHandler() {
|
||||||
|
@Override
|
||||||
|
public void loggedIn(Session session) {
|
||||||
|
session.send(new ServerJoinGamePacket(0, false, GameMode.SURVIVAL, 0, Difficulty.PEACEFUL, 10, WorldType.DEFAULT, false));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
server.setGlobalFlag(ProtocolConstants.SERVER_COMPRESSION_THRESHOLD, 100);
|
||||||
|
server.addListener(new ServerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void sessionAdded(SessionAddedEvent event) {
|
||||||
|
event.getSession().addListener(new SessionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void packetReceived(PacketReceivedEvent event) {
|
||||||
|
if(event.getPacket() instanceof ClientChatPacket) {
|
||||||
|
ClientChatPacket packet = event.getPacket();
|
||||||
|
GameProfile profile = event.getSession().getFlag(ProtocolConstants.PROFILE_KEY);
|
||||||
|
System.out.println(profile.getName() + ": " + packet.getMessage());
|
||||||
|
Message msg = new TextMessage("Hello, ").setStyle(new MessageStyle().setColor(ChatColor.GREEN));
|
||||||
|
Message name = new TextMessage(profile.getName()).setStyle(new MessageStyle().setColor(ChatColor.AQUA).addFormat(ChatFormat.UNDERLINED));
|
||||||
|
Message end = new TextMessage("!");
|
||||||
|
msg.addExtra(name);
|
||||||
|
msg.addExtra(end);
|
||||||
|
event.getSession().send(new ServerChatPacket(msg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sessionRemoved(SessionRemovedEvent event) {
|
||||||
|
MinecraftProtocol protocol = (MinecraftProtocol) event.getSession().getPacketProtocol();
|
||||||
|
if(protocol.getMode() == ProtocolMode.GAME) {
|
||||||
|
System.out.println("Closing server.");
|
||||||
|
event.getServer().close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
server.bind();
|
||||||
|
}
|
||||||
|
|
||||||
|
status();
|
||||||
|
login();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void status() {
|
||||||
|
MinecraftProtocol protocol = new MinecraftProtocol(ProtocolMode.STATUS);
|
||||||
|
Client client = new Client(HOST, PORT, protocol, new TcpSessionFactory(PROXY));
|
||||||
|
client.getSession().setFlag(ProtocolConstants.AUTH_PROXY_KEY, AUTH_PROXY);
|
||||||
|
client.getSession().setFlag(ProtocolConstants.SERVER_INFO_HANDLER_KEY, new ServerInfoHandler() {
|
||||||
|
@Override
|
||||||
|
public void handle(Session session, ServerStatusInfo info) {
|
||||||
|
System.out.println("Version: " + info.getVersionInfo().getVersionName() + ", " + info.getVersionInfo().getProtocolVersion());
|
||||||
|
System.out.println("Player Count: " + info.getPlayerInfo().getOnlinePlayers() + " / " + info.getPlayerInfo().getMaxPlayers());
|
||||||
|
System.out.println("Players: " + Arrays.toString(info.getPlayerInfo().getPlayers()));
|
||||||
|
System.out.println("Description: " + info.getDescription().getFullText());
|
||||||
|
System.out.println("Icon: " + info.getIcon());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
client.getSession().setFlag(ProtocolConstants.SERVER_PING_TIME_HANDLER_KEY, new ServerPingTimeHandler() {
|
||||||
|
@Override
|
||||||
|
public void handle(Session session, long pingTime) {
|
||||||
|
System.out.println("Server ping took " + pingTime + "ms");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
client.getSession().connect();
|
||||||
|
while(client.getSession().isConnected()) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(5);
|
||||||
|
} catch(InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void login() {
|
||||||
|
MinecraftProtocol protocol = null;
|
||||||
|
if(VERIFY_USERS) {
|
||||||
|
try {
|
||||||
|
protocol = new MinecraftProtocol(USERNAME, PASSWORD, false);
|
||||||
|
System.out.println("Successfully authenticated user.");
|
||||||
|
} catch(AuthenticationException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
protocol = new MinecraftProtocol(USERNAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
Client client = new Client(HOST, PORT, protocol, new TcpSessionFactory(PROXY));
|
||||||
|
client.getSession().addListener(new SessionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void packetReceived(PacketReceivedEvent event) {
|
||||||
|
if(event.getPacket() instanceof ServerJoinGamePacket) {
|
||||||
|
event.getSession().send(new ClientChatPacket("Hello, this is a test of MCProtocolLib."));
|
||||||
|
} else if(event.getPacket() instanceof ServerChatPacket) {
|
||||||
|
Message message = event.<ServerChatPacket>getPacket().getMessage();
|
||||||
|
System.out.println("Received Message: " + message.getFullText());
|
||||||
|
if(message instanceof TranslationMessage) {
|
||||||
|
System.out.println("Received Translation Components: " + Arrays.toString(((TranslationMessage) message).getTranslationParams()));
|
||||||
|
}
|
||||||
|
|
||||||
|
event.getSession().disconnect("Finished");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disconnected(DisconnectedEvent event) {
|
||||||
|
System.out.println("Disconnected: " + Message.fromString(event.getReason()).getFullText());
|
||||||
|
if(event.getCause() != null) {
|
||||||
|
event.getCause().printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
client.getSession().connect();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,177 +0,0 @@
|
||||||
package org.spacehq.mc.protocol.test;
|
|
||||||
|
|
||||||
import org.spacehq.mc.auth.GameProfile;
|
|
||||||
import org.spacehq.mc.auth.exception.AuthenticationException;
|
|
||||||
import org.spacehq.mc.protocol.MinecraftProtocol;
|
|
||||||
import org.spacehq.mc.protocol.ProtocolConstants;
|
|
||||||
import org.spacehq.mc.protocol.ProtocolMode;
|
|
||||||
import org.spacehq.mc.protocol.ServerLoginHandler;
|
|
||||||
import org.spacehq.mc.protocol.data.game.values.entity.player.GameMode;
|
|
||||||
import org.spacehq.mc.protocol.data.game.values.setting.Difficulty;
|
|
||||||
import org.spacehq.mc.protocol.data.game.values.world.WorldType;
|
|
||||||
import org.spacehq.mc.protocol.data.message.*;
|
|
||||||
import org.spacehq.mc.protocol.data.status.PlayerInfo;
|
|
||||||
import org.spacehq.mc.protocol.data.status.ServerStatusInfo;
|
|
||||||
import org.spacehq.mc.protocol.data.status.VersionInfo;
|
|
||||||
import org.spacehq.mc.protocol.data.status.handler.ServerInfoBuilder;
|
|
||||||
import org.spacehq.mc.protocol.data.status.handler.ServerInfoHandler;
|
|
||||||
import org.spacehq.mc.protocol.data.status.handler.ServerPingTimeHandler;
|
|
||||||
import org.spacehq.mc.protocol.packet.ingame.client.ClientChatPacket;
|
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.ServerChatPacket;
|
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
|
|
||||||
import org.spacehq.packetlib.Client;
|
|
||||||
import org.spacehq.packetlib.Server;
|
|
||||||
import org.spacehq.packetlib.Session;
|
|
||||||
import org.spacehq.packetlib.event.server.ServerAdapter;
|
|
||||||
import org.spacehq.packetlib.event.server.SessionAddedEvent;
|
|
||||||
import org.spacehq.packetlib.event.server.SessionRemovedEvent;
|
|
||||||
import org.spacehq.packetlib.event.session.DisconnectedEvent;
|
|
||||||
import org.spacehq.packetlib.event.session.PacketReceivedEvent;
|
|
||||||
import org.spacehq.packetlib.event.session.SessionAdapter;
|
|
||||||
import org.spacehq.packetlib.tcp.TcpSessionFactory;
|
|
||||||
|
|
||||||
import java.net.Proxy;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
public class Test {
|
|
||||||
|
|
||||||
private static final boolean SPAWN_SERVER = true;
|
|
||||||
private static final boolean VERIFY_USERS = false;
|
|
||||||
private static final String HOST = "127.0.0.1";
|
|
||||||
private static final int PORT = 25565;
|
|
||||||
private static final Proxy PROXY = Proxy.NO_PROXY;
|
|
||||||
private static final Proxy AUTH_PROXY = Proxy.NO_PROXY;
|
|
||||||
private static final String USERNAME = "Username";
|
|
||||||
private static final String PASSWORD = "Password";
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
if(SPAWN_SERVER) {
|
|
||||||
Server server = new Server(HOST, PORT, MinecraftProtocol.class, new TcpSessionFactory(PROXY));
|
|
||||||
server.setGlobalFlag(ProtocolConstants.AUTH_PROXY_KEY, AUTH_PROXY);
|
|
||||||
server.setGlobalFlag(ProtocolConstants.VERIFY_USERS_KEY, VERIFY_USERS);
|
|
||||||
server.setGlobalFlag(ProtocolConstants.SERVER_INFO_BUILDER_KEY, new ServerInfoBuilder() {
|
|
||||||
@Override
|
|
||||||
public ServerStatusInfo buildInfo(Session session) {
|
|
||||||
return new ServerStatusInfo(new VersionInfo(ProtocolConstants.GAME_VERSION, ProtocolConstants.PROTOCOL_VERSION), new PlayerInfo(100, 0, new GameProfile[0]), new TextMessage("Hello world!"), null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
server.setGlobalFlag(ProtocolConstants.SERVER_LOGIN_HANDLER_KEY, new ServerLoginHandler() {
|
|
||||||
@Override
|
|
||||||
public void loggedIn(Session session) {
|
|
||||||
session.send(new ServerJoinGamePacket(0, false, GameMode.SURVIVAL, 0, Difficulty.PEACEFUL, 10, WorldType.DEFAULT, false));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
server.setGlobalFlag(ProtocolConstants.SERVER_COMPRESSION_THRESHOLD, 100);
|
|
||||||
server.addListener(new ServerAdapter() {
|
|
||||||
@Override
|
|
||||||
public void sessionAdded(SessionAddedEvent event) {
|
|
||||||
event.getSession().addListener(new SessionAdapter() {
|
|
||||||
@Override
|
|
||||||
public void packetReceived(PacketReceivedEvent event) {
|
|
||||||
if(event.getPacket() instanceof ClientChatPacket) {
|
|
||||||
ClientChatPacket packet = event.getPacket();
|
|
||||||
GameProfile profile = event.getSession().getFlag(ProtocolConstants.PROFILE_KEY);
|
|
||||||
System.out.println(profile.getName() + ": " + packet.getMessage());
|
|
||||||
Message msg = new TextMessage("Hello, ").setStyle(new MessageStyle().setColor(ChatColor.GREEN));
|
|
||||||
Message name = new TextMessage(profile.getName()).setStyle(new MessageStyle().setColor(ChatColor.AQUA).addFormat(ChatFormat.UNDERLINED));
|
|
||||||
Message end = new TextMessage("!");
|
|
||||||
msg.addExtra(name);
|
|
||||||
msg.addExtra(end);
|
|
||||||
event.getSession().send(new ServerChatPacket(msg));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sessionRemoved(SessionRemovedEvent event) {
|
|
||||||
MinecraftProtocol protocol = (MinecraftProtocol) event.getSession().getPacketProtocol();
|
|
||||||
if(protocol.getMode() == ProtocolMode.GAME) {
|
|
||||||
System.out.println("Closing server.");
|
|
||||||
event.getServer().close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
server.bind();
|
|
||||||
}
|
|
||||||
|
|
||||||
status();
|
|
||||||
login();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void status() {
|
|
||||||
MinecraftProtocol protocol = new MinecraftProtocol(ProtocolMode.STATUS);
|
|
||||||
Client client = new Client(HOST, PORT, protocol, new TcpSessionFactory(PROXY));
|
|
||||||
client.getSession().setFlag(ProtocolConstants.AUTH_PROXY_KEY, AUTH_PROXY);
|
|
||||||
client.getSession().setFlag(ProtocolConstants.SERVER_INFO_HANDLER_KEY, new ServerInfoHandler() {
|
|
||||||
@Override
|
|
||||||
public void handle(Session session, ServerStatusInfo info) {
|
|
||||||
System.out.println("Version: " + info.getVersionInfo().getVersionName() + ", " + info.getVersionInfo().getProtocolVersion());
|
|
||||||
System.out.println("Player Count: " + info.getPlayerInfo().getOnlinePlayers() + " / " + info.getPlayerInfo().getMaxPlayers());
|
|
||||||
System.out.println("Players: " + Arrays.toString(info.getPlayerInfo().getPlayers()));
|
|
||||||
System.out.println("Description: " + info.getDescription().getFullText());
|
|
||||||
System.out.println("Icon: " + info.getIcon());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
client.getSession().setFlag(ProtocolConstants.SERVER_PING_TIME_HANDLER_KEY, new ServerPingTimeHandler() {
|
|
||||||
@Override
|
|
||||||
public void handle(Session session, long pingTime) {
|
|
||||||
System.out.println("Server ping took " + pingTime + "ms");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
client.getSession().connect();
|
|
||||||
while(client.getSession().isConnected()) {
|
|
||||||
try {
|
|
||||||
Thread.sleep(5);
|
|
||||||
} catch(InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void login() {
|
|
||||||
MinecraftProtocol protocol = null;
|
|
||||||
if(VERIFY_USERS) {
|
|
||||||
try {
|
|
||||||
protocol = new MinecraftProtocol(USERNAME, PASSWORD, false);
|
|
||||||
System.out.println("Successfully authenticated user.");
|
|
||||||
} catch(AuthenticationException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
protocol = new MinecraftProtocol(USERNAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
Client client = new Client(HOST, PORT, protocol, new TcpSessionFactory(PROXY));
|
|
||||||
client.getSession().addListener(new SessionAdapter() {
|
|
||||||
@Override
|
|
||||||
public void packetReceived(PacketReceivedEvent event) {
|
|
||||||
if(event.getPacket() instanceof ServerJoinGamePacket) {
|
|
||||||
event.getSession().send(new ClientChatPacket("Hello, this is a test of MCProtocolLib."));
|
|
||||||
} else if(event.getPacket() instanceof ServerChatPacket) {
|
|
||||||
Message message = event.<ServerChatPacket>getPacket().getMessage();
|
|
||||||
System.out.println("Received Message: " + message.getFullText());
|
|
||||||
if(message instanceof TranslationMessage) {
|
|
||||||
System.out.println("Received Translation Components: " + Arrays.toString(((TranslationMessage) message).getTranslationParams()));
|
|
||||||
}
|
|
||||||
|
|
||||||
event.getSession().disconnect("Finished");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void disconnected(DisconnectedEvent event) {
|
|
||||||
System.out.println("Disconnected: " + Message.fromString(event.getReason()).getFullText());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
client.getSession().connect();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
62
pom.xml
62
pom.xml
|
@ -11,6 +11,16 @@
|
||||||
<description>A library for communicating with a Minecraft client or server.</description>
|
<description>A library for communicating with a Minecraft client or server.</description>
|
||||||
<url>http://github.com/Steveice10/MCProtocolLib/</url>
|
<url>http://github.com/Steveice10/MCProtocolLib/</url>
|
||||||
|
|
||||||
|
<scm>
|
||||||
|
<connection>scm:git:git@github.com:Steveice10/MCProtocolLib.git</connection>
|
||||||
|
<developerConnection>scm:git:git@github.com:Steveice10/MCProtocolLib.git</developerConnection>
|
||||||
|
<url>git@github.com:Steveice10/MCProtocolLib/</url>
|
||||||
|
</scm>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
<licenses>
|
<licenses>
|
||||||
<license>
|
<license>
|
||||||
<name>MIT</name>
|
<name>MIT</name>
|
||||||
|
@ -19,25 +29,6 @@
|
||||||
</license>
|
</license>
|
||||||
</licenses>
|
</licenses>
|
||||||
|
|
||||||
<scm>
|
|
||||||
<connection>scm:git:git@github.com:Steveice10/MCProtocolLib.git</connection>
|
|
||||||
<developerConnection>scm:git:git@github.com:Steveice10/MCProtocolLib.git</developerConnection>
|
|
||||||
<url>git@github.com:Steveice10/MCProtocolLib/</url>
|
|
||||||
</scm>
|
|
||||||
|
|
||||||
<distributionManagement>
|
|
||||||
<repository>
|
|
||||||
<id>spacehq</id>
|
|
||||||
<name>spacehq-releases</name>
|
|
||||||
<url>http://repo.spacehq.org/content/repositories/release/</url>
|
|
||||||
</repository>
|
|
||||||
<snapshotRepository>
|
|
||||||
<id>spacehq</id>
|
|
||||||
<name>spacehq-snapshots</name>
|
|
||||||
<url>http://repo.spacehq.org/content/repositories/snapshots/</url>
|
|
||||||
</snapshotRepository>
|
|
||||||
</distributionManagement>
|
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
<developer>
|
<developer>
|
||||||
<id>steveice10</id>
|
<id>steveice10</id>
|
||||||
|
@ -46,10 +37,23 @@
|
||||||
</developer>
|
</developer>
|
||||||
</developers>
|
</developers>
|
||||||
|
|
||||||
|
<distributionManagement>
|
||||||
|
<repository>
|
||||||
|
<id>spacehq</id>
|
||||||
|
<name>spacehq-releases</name>
|
||||||
|
<url>http://repo.spacehq.org/content/repositories/releases/</url>
|
||||||
|
</repository>
|
||||||
|
<snapshotRepository>
|
||||||
|
<id>spacehq</id>
|
||||||
|
<name>spacehq-snapshots</name>
|
||||||
|
<url>http://repo.spacehq.org/content/repositories/snapshots/</url>
|
||||||
|
</snapshotRepository>
|
||||||
|
</distributionManagement>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>spacehq-releases</id>
|
<id>spacehq-releases</id>
|
||||||
<url>http://repo.spacehq.org/content/repositories/release/</url>
|
<url>http://repo.spacehq.org/content/repositories/releases/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>spacehq-snapshots</id>
|
<id>spacehq-snapshots</id>
|
||||||
|
@ -57,22 +61,17 @@
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<!-- Dependencies -->
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spacehq</groupId>
|
<groupId>org.spacehq</groupId>
|
||||||
<artifactId>opennbt</artifactId>
|
<artifactId>opennbt</artifactId>
|
||||||
<version>1.4</version>
|
<version>1.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spacehq</groupId>
|
<groupId>org.spacehq</groupId>
|
||||||
<artifactId>packetlib</artifactId>
|
<artifactId>packetlib</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -89,23 +88,21 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>2.3.2</version>
|
<version>2.5.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.6</source>
|
<source>1.6</source>
|
||||||
<target>1.6</target>
|
<target>1.6</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- JAR creation plugin -->
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
<version>2.3.2</version>
|
<version>2.6</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- JAR dependency addition plugin -->
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>1.5</version>
|
<version>2.4.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
|
@ -115,6 +112,7 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
|
||||||
<filters>
|
<filters>
|
||||||
<filter>
|
<filter>
|
||||||
<artifact>*:*</artifact>
|
<artifact>*:*</artifact>
|
||||||
|
|
|
@ -36,100 +36,100 @@ import java.net.Proxy;
|
||||||
|
|
||||||
public class ClientListener extends SessionAdapter {
|
public class ClientListener extends SessionAdapter {
|
||||||
|
|
||||||
private SecretKey key;
|
private SecretKey key;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void packetReceived(PacketReceivedEvent event) {
|
public void packetReceived(PacketReceivedEvent event) {
|
||||||
MinecraftProtocol protocol = (MinecraftProtocol) event.getSession().getPacketProtocol();
|
MinecraftProtocol protocol = (MinecraftProtocol) event.getSession().getPacketProtocol();
|
||||||
if(protocol.getMode() == ProtocolMode.LOGIN) {
|
if(protocol.getMode() == ProtocolMode.LOGIN) {
|
||||||
if(event.getPacket() instanceof EncryptionRequestPacket) {
|
if(event.getPacket() instanceof EncryptionRequestPacket) {
|
||||||
EncryptionRequestPacket packet = event.getPacket();
|
EncryptionRequestPacket packet = event.getPacket();
|
||||||
this.key = CryptUtil.generateSharedKey();
|
this.key = CryptUtil.generateSharedKey();
|
||||||
|
|
||||||
Proxy proxy = event.getSession().<Proxy>getFlag(ProtocolConstants.AUTH_PROXY_KEY);
|
Proxy proxy = event.getSession().<Proxy>getFlag(ProtocolConstants.AUTH_PROXY_KEY);
|
||||||
if(proxy == null) {
|
if(proxy == null) {
|
||||||
proxy = Proxy.NO_PROXY;
|
proxy = Proxy.NO_PROXY;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameProfile profile = event.getSession().getFlag(ProtocolConstants.PROFILE_KEY);
|
GameProfile profile = event.getSession().getFlag(ProtocolConstants.PROFILE_KEY);
|
||||||
String serverHash = new BigInteger(CryptUtil.getServerIdHash(packet.getServerId(), packet.getPublicKey(), this.key)).toString(16);
|
String serverHash = new BigInteger(CryptUtil.getServerIdHash(packet.getServerId(), packet.getPublicKey(), this.key)).toString(16);
|
||||||
String accessToken = event.getSession().getFlag(ProtocolConstants.ACCESS_TOKEN_KEY);
|
String accessToken = event.getSession().getFlag(ProtocolConstants.ACCESS_TOKEN_KEY);
|
||||||
try {
|
try {
|
||||||
new SessionService(proxy).joinServer(profile, accessToken, serverHash);
|
new SessionService(proxy).joinServer(profile, accessToken, serverHash);
|
||||||
} catch(AuthenticationUnavailableException e) {
|
} catch(AuthenticationUnavailableException e) {
|
||||||
event.getSession().disconnect("Login failed: Authentication service unavailable.");
|
event.getSession().disconnect("Login failed: Authentication service unavailable.");
|
||||||
return;
|
return;
|
||||||
} catch(InvalidCredentialsException e) {
|
} catch(InvalidCredentialsException e) {
|
||||||
event.getSession().disconnect("Login failed: Invalid login session.");
|
event.getSession().disconnect("Login failed: Invalid login session.");
|
||||||
return;
|
return;
|
||||||
} catch(AuthenticationException e) {
|
} catch(AuthenticationException e) {
|
||||||
event.getSession().disconnect("Login failed: Authentication error: " + e.getMessage());
|
event.getSession().disconnect("Login failed: Authentication error: " + e.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.getSession().send(new EncryptionResponsePacket(this.key, packet.getPublicKey(), packet.getVerifyToken()));
|
event.getSession().send(new EncryptionResponsePacket(this.key, packet.getPublicKey(), packet.getVerifyToken()));
|
||||||
} else if(event.getPacket() instanceof LoginSuccessPacket) {
|
} else if(event.getPacket() instanceof LoginSuccessPacket) {
|
||||||
LoginSuccessPacket packet = event.getPacket();
|
LoginSuccessPacket packet = event.getPacket();
|
||||||
event.getSession().setFlag(ProtocolConstants.PROFILE_KEY, packet.getProfile());
|
event.getSession().setFlag(ProtocolConstants.PROFILE_KEY, packet.getProfile());
|
||||||
protocol.setMode(ProtocolMode.GAME, true, event.getSession());
|
protocol.setMode(ProtocolMode.GAME, true, event.getSession());
|
||||||
} else if(event.getPacket() instanceof LoginDisconnectPacket) {
|
} else if(event.getPacket() instanceof LoginDisconnectPacket) {
|
||||||
LoginDisconnectPacket packet = event.getPacket();
|
LoginDisconnectPacket packet = event.getPacket();
|
||||||
event.getSession().disconnect(packet.getReason().getFullText());
|
event.getSession().disconnect(packet.getReason().getFullText());
|
||||||
} else if(event.getPacket() instanceof LoginSetCompressionPacket) {
|
} else if(event.getPacket() instanceof LoginSetCompressionPacket) {
|
||||||
event.getSession().setCompressionThreshold(event.<LoginSetCompressionPacket>getPacket().getThreshold());
|
event.getSession().setCompressionThreshold(event.<LoginSetCompressionPacket>getPacket().getThreshold());
|
||||||
}
|
}
|
||||||
} else if(protocol.getMode() == ProtocolMode.STATUS) {
|
} else if(protocol.getMode() == ProtocolMode.STATUS) {
|
||||||
if(event.getPacket() instanceof StatusResponsePacket) {
|
if(event.getPacket() instanceof StatusResponsePacket) {
|
||||||
ServerStatusInfo info = event.<StatusResponsePacket>getPacket().getInfo();
|
ServerStatusInfo info = event.<StatusResponsePacket>getPacket().getInfo();
|
||||||
ServerInfoHandler handler = event.getSession().getFlag(ProtocolConstants.SERVER_INFO_HANDLER_KEY);
|
ServerInfoHandler handler = event.getSession().getFlag(ProtocolConstants.SERVER_INFO_HANDLER_KEY);
|
||||||
if(handler != null) {
|
if(handler != null) {
|
||||||
handler.handle(event.getSession(), info);
|
handler.handle(event.getSession(), info);
|
||||||
}
|
}
|
||||||
|
|
||||||
event.getSession().send(new StatusPingPacket(System.currentTimeMillis()));
|
event.getSession().send(new StatusPingPacket(System.currentTimeMillis()));
|
||||||
} else if(event.getPacket() instanceof StatusPongPacket) {
|
} else if(event.getPacket() instanceof StatusPongPacket) {
|
||||||
long time = System.currentTimeMillis() - event.<StatusPongPacket>getPacket().getPingTime();
|
long time = System.currentTimeMillis() - event.<StatusPongPacket>getPacket().getPingTime();
|
||||||
ServerPingTimeHandler handler = event.getSession().getFlag(ProtocolConstants.SERVER_PING_TIME_HANDLER_KEY);
|
ServerPingTimeHandler handler = event.getSession().getFlag(ProtocolConstants.SERVER_PING_TIME_HANDLER_KEY);
|
||||||
if(handler != null) {
|
if(handler != null) {
|
||||||
handler.handle(event.getSession(), time);
|
handler.handle(event.getSession(), time);
|
||||||
}
|
}
|
||||||
|
|
||||||
event.getSession().disconnect("Finished");
|
event.getSession().disconnect("Finished");
|
||||||
}
|
}
|
||||||
} else if(protocol.getMode() == ProtocolMode.GAME) {
|
} else if(protocol.getMode() == ProtocolMode.GAME) {
|
||||||
if(event.getPacket() instanceof ServerKeepAlivePacket) {
|
if(event.getPacket() instanceof ServerKeepAlivePacket) {
|
||||||
event.getSession().send(new ClientKeepAlivePacket(event.<ServerKeepAlivePacket>getPacket().getPingId()));
|
event.getSession().send(new ClientKeepAlivePacket(event.<ServerKeepAlivePacket>getPacket().getPingId()));
|
||||||
} else if(event.getPacket() instanceof ServerDisconnectPacket) {
|
} else if(event.getPacket() instanceof ServerDisconnectPacket) {
|
||||||
event.getSession().disconnect(event.<ServerDisconnectPacket>getPacket().getReason().getFullText());
|
event.getSession().disconnect(event.<ServerDisconnectPacket>getPacket().getReason().getFullText());
|
||||||
} else if(event.getPacket() instanceof ServerSetCompressionPacket) {
|
} else if(event.getPacket() instanceof ServerSetCompressionPacket) {
|
||||||
event.getSession().setCompressionThreshold(event.<ServerSetCompressionPacket>getPacket().getThreshold());
|
event.getSession().setCompressionThreshold(event.<ServerSetCompressionPacket>getPacket().getThreshold());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void packetSent(PacketSentEvent event) {
|
public void packetSent(PacketSentEvent event) {
|
||||||
MinecraftProtocol protocol = (MinecraftProtocol) event.getSession().getPacketProtocol();
|
MinecraftProtocol protocol = (MinecraftProtocol) event.getSession().getPacketProtocol();
|
||||||
if(protocol.getMode() == ProtocolMode.LOGIN && event.getPacket() instanceof EncryptionResponsePacket) {
|
if(protocol.getMode() == ProtocolMode.LOGIN && event.getPacket() instanceof EncryptionResponsePacket) {
|
||||||
protocol.enableEncryption(this.key);
|
protocol.enableEncryption(this.key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void connected(ConnectedEvent event) {
|
public void connected(ConnectedEvent event) {
|
||||||
MinecraftProtocol protocol = (MinecraftProtocol) event.getSession().getPacketProtocol();
|
MinecraftProtocol protocol = (MinecraftProtocol) event.getSession().getPacketProtocol();
|
||||||
if(protocol.getMode() == ProtocolMode.LOGIN) {
|
if(protocol.getMode() == ProtocolMode.LOGIN) {
|
||||||
GameProfile profile = event.getSession().getFlag(ProtocolConstants.PROFILE_KEY);
|
GameProfile profile = event.getSession().getFlag(ProtocolConstants.PROFILE_KEY);
|
||||||
protocol.setMode(ProtocolMode.HANDSHAKE, true, event.getSession());
|
protocol.setMode(ProtocolMode.HANDSHAKE, true, event.getSession());
|
||||||
event.getSession().send(new HandshakePacket(ProtocolConstants.PROTOCOL_VERSION, event.getSession().getHost(), event.getSession().getPort(), HandshakeIntent.LOGIN));
|
event.getSession().send(new HandshakePacket(ProtocolConstants.PROTOCOL_VERSION, event.getSession().getHost(), event.getSession().getPort(), HandshakeIntent.LOGIN));
|
||||||
protocol.setMode(ProtocolMode.LOGIN, true, event.getSession());
|
protocol.setMode(ProtocolMode.LOGIN, true, event.getSession());
|
||||||
event.getSession().send(new LoginStartPacket(profile != null ? profile.getName() : ""));
|
event.getSession().send(new LoginStartPacket(profile != null ? profile.getName() : ""));
|
||||||
} else if(protocol.getMode() == ProtocolMode.STATUS) {
|
} else if(protocol.getMode() == ProtocolMode.STATUS) {
|
||||||
protocol.setMode(ProtocolMode.HANDSHAKE, true, event.getSession());
|
protocol.setMode(ProtocolMode.HANDSHAKE, true, event.getSession());
|
||||||
event.getSession().send(new HandshakePacket(ProtocolConstants.PROTOCOL_VERSION, event.getSession().getHost(), event.getSession().getPort(), HandshakeIntent.STATUS));
|
event.getSession().send(new HandshakePacket(ProtocolConstants.PROTOCOL_VERSION, event.getSession().getHost(), event.getSession().getPort(), HandshakeIntent.STATUS));
|
||||||
protocol.setMode(ProtocolMode.STATUS, true, event.getSession());
|
protocol.setMode(ProtocolMode.STATUS, true, event.getSession());
|
||||||
event.getSession().send(new StatusQueryPacket());
|
event.getSession().send(new StatusQueryPacket());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,22 +4,106 @@ import org.spacehq.mc.auth.GameProfile;
|
||||||
import org.spacehq.mc.auth.UserAuthentication;
|
import org.spacehq.mc.auth.UserAuthentication;
|
||||||
import org.spacehq.mc.auth.exception.AuthenticationException;
|
import org.spacehq.mc.auth.exception.AuthenticationException;
|
||||||
import org.spacehq.mc.protocol.packet.handshake.client.HandshakePacket;
|
import org.spacehq.mc.protocol.packet.handshake.client.HandshakePacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.client.*;
|
import org.spacehq.mc.protocol.packet.ingame.client.ClientChatPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.ClientKeepAlivePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.ClientPluginMessagePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.ClientRequestPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.ClientResourcePackStatusPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.ClientSettingsPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.ClientTabCompletePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientChangeHeldItemPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerAbilitiesPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerActionPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerInteractEntityPacket;
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerInteractEntityPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerMovementPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerPlaceBlockPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerPositionPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerPositionRotationPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerRotationPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerStatePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientSpectatePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientSteerVehiclePacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientSwingArmPacket;
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientSwingArmPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.client.player.*;
|
import org.spacehq.mc.protocol.packet.ingame.client.window.ClientCloseWindowPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.client.window.*;
|
import org.spacehq.mc.protocol.packet.ingame.client.window.ClientConfirmTransactionPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.window.ClientCreativeInventoryActionPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.window.ClientEnchantItemPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.window.ClientWindowActionPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.client.world.ClientUpdateSignPacket;
|
import org.spacehq.mc.protocol.packet.ingame.client.world.ClientUpdateSignPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.*;
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerChatPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.entity.*;
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerCombatPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.*;
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerDifficultyPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.entity.spawn.*;
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerDisconnectPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerKeepAlivePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerPlayerListDataPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerPlayerListEntryPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerPluginMessagePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerResourcePackSendPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerRespawnPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerSetCompressionPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerStatisticsPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerSwitchCameraPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerTabCompletePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerTitlePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerAnimationPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerCollectItemPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerDestroyEntitiesPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityAttachPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityEffectPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityEquipmentPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityHeadLookPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityMetadataPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityMovementPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityNBTUpdatePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityPositionPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityPositionRotationPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityPropertiesPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityRemoveEffectPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityRotationPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityStatusPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityTeleportPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityVelocityPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerChangeHeldItemPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerAbilitiesPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerUseBedPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerSetExperiencePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerUpdateHealthPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnExpOrbPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnGlobalEntityPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnMobPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnObjectPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnPaintingPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnPlayerPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.scoreboard.ServerDisplayScoreboardPacket;
|
import org.spacehq.mc.protocol.packet.ingame.server.scoreboard.ServerDisplayScoreboardPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.scoreboard.ServerScoreboardObjectivePacket;
|
import org.spacehq.mc.protocol.packet.ingame.server.scoreboard.ServerScoreboardObjectivePacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.scoreboard.ServerTeamPacket;
|
import org.spacehq.mc.protocol.packet.ingame.server.scoreboard.ServerTeamPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.scoreboard.ServerUpdateScorePacket;
|
import org.spacehq.mc.protocol.packet.ingame.server.scoreboard.ServerUpdateScorePacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.window.*;
|
import org.spacehq.mc.protocol.packet.ingame.server.window.ServerCloseWindowPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.world.*;
|
import org.spacehq.mc.protocol.packet.ingame.server.window.ServerConfirmTransactionPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.window.ServerOpenWindowPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.window.ServerSetSlotPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.window.ServerWindowItemsPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.window.ServerWindowPropertyPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerBlockBreakAnimPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerBlockChangePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerBlockValuePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerChunkDataPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerExplosionPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerMapDataPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerMultiBlockChangePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerMultiChunkDataPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerNotifyClientPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerOpenTileEntityEditorPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerPlayEffectPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerPlaySoundPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerSpawnParticlePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerSpawnPositionPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerUpdateSignPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerUpdateTileEntityPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerUpdateTimePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerWorldBorderPacket;
|
||||||
import org.spacehq.mc.protocol.packet.login.client.EncryptionResponsePacket;
|
import org.spacehq.mc.protocol.packet.login.client.EncryptionResponsePacket;
|
||||||
import org.spacehq.mc.protocol.packet.login.client.LoginStartPacket;
|
import org.spacehq.mc.protocol.packet.login.client.LoginStartPacket;
|
||||||
import org.spacehq.mc.protocol.packet.login.server.EncryptionRequestPacket;
|
import org.spacehq.mc.protocol.packet.login.server.EncryptionRequestPacket;
|
||||||
|
@ -46,414 +130,409 @@ import java.util.UUID;
|
||||||
|
|
||||||
public class MinecraftProtocol extends PacketProtocol {
|
public class MinecraftProtocol extends PacketProtocol {
|
||||||
|
|
||||||
private ProtocolMode mode = ProtocolMode.HANDSHAKE;
|
private ProtocolMode mode = ProtocolMode.HANDSHAKE;
|
||||||
private PacketHeader header = new DefaultPacketHeader();
|
private PacketHeader header = new DefaultPacketHeader();
|
||||||
private AESEncryption encrypt;
|
private AESEncryption encrypt;
|
||||||
|
|
||||||
private GameProfile profile;
|
private GameProfile profile;
|
||||||
private String accessToken = "";
|
private String accessToken = "";
|
||||||
private ClientListener clientListener;
|
private ClientListener clientListener;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private MinecraftProtocol() {
|
private MinecraftProtocol() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public MinecraftProtocol(ProtocolMode mode) {
|
public MinecraftProtocol(ProtocolMode mode) {
|
||||||
if(mode != ProtocolMode.LOGIN && mode != ProtocolMode.STATUS) {
|
if(mode != ProtocolMode.LOGIN && mode != ProtocolMode.STATUS) {
|
||||||
throw new IllegalArgumentException("Only login and status modes are permitted.");
|
throw new IllegalArgumentException("Only login and status modes are permitted.");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
if(mode == ProtocolMode.LOGIN) {
|
if(mode == ProtocolMode.LOGIN) {
|
||||||
this.profile = new GameProfile((UUID) null, "Player");
|
this.profile = new GameProfile((UUID) null, "Player");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.clientListener = new ClientListener();
|
this.clientListener = new ClientListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MinecraftProtocol(String username) {
|
public MinecraftProtocol(String username) {
|
||||||
this(ProtocolMode.LOGIN);
|
this(ProtocolMode.LOGIN);
|
||||||
this.profile = new GameProfile((UUID) null, username);
|
this.profile = new GameProfile((UUID) null, username);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MinecraftProtocol(String username, String password) throws AuthenticationException {
|
public MinecraftProtocol(String username, String password) throws AuthenticationException {
|
||||||
this(username, password, false);
|
this(username, password, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MinecraftProtocol(String username, String using, boolean token) throws AuthenticationException {
|
public MinecraftProtocol(String username, String using, boolean token) throws AuthenticationException {
|
||||||
this(username, using, token, Proxy.NO_PROXY);
|
this(username, using, token, Proxy.NO_PROXY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MinecraftProtocol(String username, String using, boolean token, Proxy authProxy) throws AuthenticationException {
|
public MinecraftProtocol(String username, String using, boolean token, Proxy authProxy) throws AuthenticationException {
|
||||||
this(ProtocolMode.LOGIN);
|
this(ProtocolMode.LOGIN);
|
||||||
String clientToken = UUID.randomUUID().toString();
|
String clientToken = UUID.randomUUID().toString();
|
||||||
UserAuthentication auth = new UserAuthentication(clientToken, authProxy);
|
UserAuthentication auth = new UserAuthentication(clientToken, authProxy);
|
||||||
auth.setUsername(username);
|
auth.setUsername(username);
|
||||||
if(token) {
|
if(token) {
|
||||||
auth.setAccessToken(using);
|
auth.setAccessToken(using);
|
||||||
} else {
|
} else {
|
||||||
auth.setPassword(using);
|
auth.setPassword(using);
|
||||||
}
|
}
|
||||||
|
|
||||||
auth.login();
|
auth.login();
|
||||||
this.profile = auth.getSelectedProfile();
|
this.profile = auth.getSelectedProfile();
|
||||||
this.accessToken = auth.getAccessToken();
|
this.accessToken = auth.getAccessToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MinecraftProtocol(GameProfile profile, String accessToken) {
|
public MinecraftProtocol(GameProfile profile, String accessToken) {
|
||||||
this(ProtocolMode.LOGIN);
|
this(ProtocolMode.LOGIN);
|
||||||
this.profile = profile;
|
this.profile = profile;
|
||||||
this.accessToken = accessToken;
|
this.accessToken = accessToken;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameProfile getProfile() {
|
public GameProfile getProfile() {
|
||||||
return this.profile;
|
return this.profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAccessToken() {
|
public String getAccessToken() {
|
||||||
return this.accessToken;
|
return this.accessToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean needsPacketSizer() {
|
public String getSRVRecordPrefix() {
|
||||||
return true;
|
return "_minecraft";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean needsPacketEncryptor() {
|
public PacketHeader getPacketHeader() {
|
||||||
return true;
|
return this.header;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PacketHeader getPacketHeader() {
|
public PacketEncryption getEncryption() {
|
||||||
return this.header;
|
return this.encrypt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PacketEncryption getEncryption() {
|
public void newClientSession(Client client, Session session) {
|
||||||
return this.encrypt;
|
if(this.profile != null) {
|
||||||
}
|
session.setFlag(ProtocolConstants.PROFILE_KEY, this.profile);
|
||||||
|
session.setFlag(ProtocolConstants.ACCESS_TOKEN_KEY, this.accessToken);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
this.setMode(this.mode, true, session);
|
||||||
public void newClientSession(Client client, Session session) {
|
session.addListener(this.clientListener);
|
||||||
if(this.profile != null) {
|
}
|
||||||
session.setFlag(ProtocolConstants.PROFILE_KEY, this.profile);
|
|
||||||
session.setFlag(ProtocolConstants.ACCESS_TOKEN_KEY, this.accessToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setMode(this.mode, true, session);
|
@Override
|
||||||
session.addListener(this.clientListener);
|
public void newServerSession(Server server, Session session) {
|
||||||
}
|
this.setMode(ProtocolMode.HANDSHAKE, false, session);
|
||||||
|
session.addListener(new ServerListener());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
protected void enableEncryption(Key key) {
|
||||||
public void newServerSession(Server server, Session session) {
|
try {
|
||||||
this.setMode(ProtocolMode.HANDSHAKE, false, session);
|
this.encrypt = new AESEncryption(key);
|
||||||
session.addListener(new ServerListener());
|
} catch(GeneralSecurityException e) {
|
||||||
}
|
throw new Error("Failed to enable protocol encryption.", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void enableEncryption(Key key) {
|
public ProtocolMode getMode() {
|
||||||
try {
|
return this.mode;
|
||||||
this.encrypt = new AESEncryption(key);
|
}
|
||||||
} catch(GeneralSecurityException e) {
|
|
||||||
throw new Error("Failed to enable protocol encryption.", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProtocolMode getMode() {
|
protected void setMode(ProtocolMode mode, boolean client, Session session) {
|
||||||
return this.mode;
|
this.clearPackets();
|
||||||
}
|
switch(mode) {
|
||||||
|
case HANDSHAKE:
|
||||||
|
if(client) {
|
||||||
|
this.initClientHandshake(session);
|
||||||
|
} else {
|
||||||
|
this.initServerHandshake(session);
|
||||||
|
}
|
||||||
|
|
||||||
protected void setMode(ProtocolMode mode, boolean client, Session session) {
|
break;
|
||||||
this.clearPackets();
|
case LOGIN:
|
||||||
switch(mode) {
|
if(client) {
|
||||||
case HANDSHAKE:
|
this.initClientLogin(session);
|
||||||
if(client) {
|
} else {
|
||||||
this.initClientHandshake(session);
|
this.initServerLogin(session);
|
||||||
} else {
|
}
|
||||||
this.initServerHandshake(session);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case LOGIN:
|
case GAME:
|
||||||
if(client) {
|
if(client) {
|
||||||
this.initClientLogin(session);
|
this.initClientGame(session);
|
||||||
} else {
|
} else {
|
||||||
this.initServerLogin(session);
|
this.initServerGame(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case GAME:
|
case STATUS:
|
||||||
if(client) {
|
if(client) {
|
||||||
this.initClientGame(session);
|
this.initClientStatus(session);
|
||||||
} else {
|
} else {
|
||||||
this.initServerGame(session);
|
this.initServerStatus(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case STATUS:
|
}
|
||||||
if(client) {
|
|
||||||
this.initClientStatus(session);
|
|
||||||
} else {
|
|
||||||
this.initServerStatus(session);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
this.mode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mode = mode;
|
private void initClientHandshake(Session session) {
|
||||||
}
|
this.registerOutgoing(0, HandshakePacket.class);
|
||||||
|
}
|
||||||
|
|
||||||
private void initClientHandshake(Session session) {
|
private void initServerHandshake(Session session) {
|
||||||
this.registerOutgoing(0, HandshakePacket.class);
|
this.registerIncoming(0, HandshakePacket.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initServerHandshake(Session session) {
|
private void initClientLogin(Session session) {
|
||||||
this.registerIncoming(0, HandshakePacket.class);
|
this.registerIncoming(0, LoginDisconnectPacket.class);
|
||||||
}
|
this.registerIncoming(1, EncryptionRequestPacket.class);
|
||||||
|
this.registerIncoming(2, LoginSuccessPacket.class);
|
||||||
|
this.registerIncoming(3, LoginSetCompressionPacket.class);
|
||||||
|
|
||||||
private void initClientLogin(Session session) {
|
this.registerOutgoing(0, LoginStartPacket.class);
|
||||||
this.registerIncoming(0, LoginDisconnectPacket.class);
|
this.registerOutgoing(1, EncryptionResponsePacket.class);
|
||||||
this.registerIncoming(1, EncryptionRequestPacket.class);
|
}
|
||||||
this.registerIncoming(2, LoginSuccessPacket.class);
|
|
||||||
this.registerIncoming(3, LoginSetCompressionPacket.class);
|
|
||||||
|
|
||||||
this.registerOutgoing(0, LoginStartPacket.class);
|
private void initServerLogin(Session session) {
|
||||||
this.registerOutgoing(1, EncryptionResponsePacket.class);
|
this.registerIncoming(0, LoginStartPacket.class);
|
||||||
}
|
this.registerIncoming(1, EncryptionResponsePacket.class);
|
||||||
|
|
||||||
private void initServerLogin(Session session) {
|
this.registerOutgoing(0, LoginDisconnectPacket.class);
|
||||||
this.registerIncoming(0, LoginStartPacket.class);
|
this.registerOutgoing(1, EncryptionRequestPacket.class);
|
||||||
this.registerIncoming(1, EncryptionResponsePacket.class);
|
this.registerOutgoing(2, LoginSuccessPacket.class);
|
||||||
|
this.registerOutgoing(3, LoginSetCompressionPacket.class);
|
||||||
|
}
|
||||||
|
|
||||||
this.registerOutgoing(0, LoginDisconnectPacket.class);
|
private void initClientGame(Session session) {
|
||||||
this.registerOutgoing(1, EncryptionRequestPacket.class);
|
this.registerIncoming(0, ServerKeepAlivePacket.class);
|
||||||
this.registerOutgoing(2, LoginSuccessPacket.class);
|
this.registerIncoming(1, ServerJoinGamePacket.class);
|
||||||
this.registerOutgoing(3, LoginSetCompressionPacket.class);
|
this.registerIncoming(2, ServerChatPacket.class);
|
||||||
}
|
this.registerIncoming(3, ServerUpdateTimePacket.class);
|
||||||
|
this.registerIncoming(4, ServerEntityEquipmentPacket.class);
|
||||||
|
this.registerIncoming(5, ServerSpawnPositionPacket.class);
|
||||||
|
this.registerIncoming(6, ServerUpdateHealthPacket.class);
|
||||||
|
this.registerIncoming(7, ServerRespawnPacket.class);
|
||||||
|
this.registerIncoming(8, ServerPlayerPositionRotationPacket.class);
|
||||||
|
this.registerIncoming(9, ServerChangeHeldItemPacket.class);
|
||||||
|
this.registerIncoming(10, ServerPlayerUseBedPacket.class);
|
||||||
|
this.registerIncoming(11, ServerAnimationPacket.class);
|
||||||
|
this.registerIncoming(12, ServerSpawnPlayerPacket.class);
|
||||||
|
this.registerIncoming(13, ServerCollectItemPacket.class);
|
||||||
|
this.registerIncoming(14, ServerSpawnObjectPacket.class);
|
||||||
|
this.registerIncoming(15, ServerSpawnMobPacket.class);
|
||||||
|
this.registerIncoming(16, ServerSpawnPaintingPacket.class);
|
||||||
|
this.registerIncoming(17, ServerSpawnExpOrbPacket.class);
|
||||||
|
this.registerIncoming(18, ServerEntityVelocityPacket.class);
|
||||||
|
this.registerIncoming(19, ServerDestroyEntitiesPacket.class);
|
||||||
|
this.registerIncoming(20, ServerEntityMovementPacket.class);
|
||||||
|
this.registerIncoming(21, ServerEntityPositionPacket.class);
|
||||||
|
this.registerIncoming(22, ServerEntityRotationPacket.class);
|
||||||
|
this.registerIncoming(23, ServerEntityPositionRotationPacket.class);
|
||||||
|
this.registerIncoming(24, ServerEntityTeleportPacket.class);
|
||||||
|
this.registerIncoming(25, ServerEntityHeadLookPacket.class);
|
||||||
|
this.registerIncoming(26, ServerEntityStatusPacket.class);
|
||||||
|
this.registerIncoming(27, ServerEntityAttachPacket.class);
|
||||||
|
this.registerIncoming(28, ServerEntityMetadataPacket.class);
|
||||||
|
this.registerIncoming(29, ServerEntityEffectPacket.class);
|
||||||
|
this.registerIncoming(30, ServerEntityRemoveEffectPacket.class);
|
||||||
|
this.registerIncoming(31, ServerSetExperiencePacket.class);
|
||||||
|
this.registerIncoming(32, ServerEntityPropertiesPacket.class);
|
||||||
|
this.registerIncoming(33, ServerChunkDataPacket.class);
|
||||||
|
this.registerIncoming(34, ServerMultiBlockChangePacket.class);
|
||||||
|
this.registerIncoming(35, ServerBlockChangePacket.class);
|
||||||
|
this.registerIncoming(36, ServerBlockValuePacket.class);
|
||||||
|
this.registerIncoming(37, ServerBlockBreakAnimPacket.class);
|
||||||
|
this.registerIncoming(38, ServerMultiChunkDataPacket.class);
|
||||||
|
this.registerIncoming(39, ServerExplosionPacket.class);
|
||||||
|
this.registerIncoming(40, ServerPlayEffectPacket.class);
|
||||||
|
this.registerIncoming(41, ServerPlaySoundPacket.class);
|
||||||
|
this.registerIncoming(42, ServerSpawnParticlePacket.class);
|
||||||
|
this.registerIncoming(43, ServerNotifyClientPacket.class);
|
||||||
|
this.registerIncoming(44, ServerSpawnGlobalEntityPacket.class);
|
||||||
|
this.registerIncoming(45, ServerOpenWindowPacket.class);
|
||||||
|
this.registerIncoming(46, ServerCloseWindowPacket.class);
|
||||||
|
this.registerIncoming(47, ServerSetSlotPacket.class);
|
||||||
|
this.registerIncoming(48, ServerWindowItemsPacket.class);
|
||||||
|
this.registerIncoming(49, ServerWindowPropertyPacket.class);
|
||||||
|
this.registerIncoming(50, ServerConfirmTransactionPacket.class);
|
||||||
|
this.registerIncoming(51, ServerUpdateSignPacket.class);
|
||||||
|
this.registerIncoming(52, ServerMapDataPacket.class);
|
||||||
|
this.registerIncoming(53, ServerUpdateTileEntityPacket.class);
|
||||||
|
this.registerIncoming(54, ServerOpenTileEntityEditorPacket.class);
|
||||||
|
this.registerIncoming(55, ServerStatisticsPacket.class);
|
||||||
|
this.registerIncoming(56, ServerPlayerListEntryPacket.class);
|
||||||
|
this.registerIncoming(57, ServerPlayerAbilitiesPacket.class);
|
||||||
|
this.registerIncoming(58, ServerTabCompletePacket.class);
|
||||||
|
this.registerIncoming(59, ServerScoreboardObjectivePacket.class);
|
||||||
|
this.registerIncoming(60, ServerUpdateScorePacket.class);
|
||||||
|
this.registerIncoming(61, ServerDisplayScoreboardPacket.class);
|
||||||
|
this.registerIncoming(62, ServerTeamPacket.class);
|
||||||
|
this.registerIncoming(63, ServerPluginMessagePacket.class);
|
||||||
|
this.registerIncoming(64, ServerDisconnectPacket.class);
|
||||||
|
this.registerIncoming(65, ServerDifficultyPacket.class);
|
||||||
|
this.registerIncoming(66, ServerCombatPacket.class);
|
||||||
|
this.registerIncoming(67, ServerSwitchCameraPacket.class);
|
||||||
|
this.registerIncoming(68, ServerWorldBorderPacket.class);
|
||||||
|
this.registerIncoming(69, ServerTitlePacket.class);
|
||||||
|
this.registerIncoming(70, ServerSetCompressionPacket.class);
|
||||||
|
this.registerIncoming(71, ServerPlayerListDataPacket.class);
|
||||||
|
this.registerIncoming(72, ServerResourcePackSendPacket.class);
|
||||||
|
this.registerIncoming(73, ServerEntityNBTUpdatePacket.class);
|
||||||
|
|
||||||
private void initClientGame(Session session) {
|
this.registerOutgoing(0, ClientKeepAlivePacket.class);
|
||||||
this.registerIncoming(0, ServerKeepAlivePacket.class);
|
this.registerOutgoing(1, ClientChatPacket.class);
|
||||||
this.registerIncoming(1, ServerJoinGamePacket.class);
|
this.registerOutgoing(2, ClientPlayerInteractEntityPacket.class);
|
||||||
this.registerIncoming(2, ServerChatPacket.class);
|
this.registerOutgoing(3, ClientPlayerMovementPacket.class);
|
||||||
this.registerIncoming(3, ServerUpdateTimePacket.class);
|
this.registerOutgoing(4, ClientPlayerPositionPacket.class);
|
||||||
this.registerIncoming(4, ServerEntityEquipmentPacket.class);
|
this.registerOutgoing(5, ClientPlayerRotationPacket.class);
|
||||||
this.registerIncoming(5, ServerSpawnPositionPacket.class);
|
this.registerOutgoing(6, ClientPlayerPositionRotationPacket.class);
|
||||||
this.registerIncoming(6, ServerUpdateHealthPacket.class);
|
this.registerOutgoing(7, ClientPlayerActionPacket.class);
|
||||||
this.registerIncoming(7, ServerRespawnPacket.class);
|
this.registerOutgoing(8, ClientPlayerPlaceBlockPacket.class);
|
||||||
this.registerIncoming(8, ServerPlayerPositionRotationPacket.class);
|
this.registerOutgoing(9, ClientChangeHeldItemPacket.class);
|
||||||
this.registerIncoming(9, ServerChangeHeldItemPacket.class);
|
this.registerOutgoing(10, ClientSwingArmPacket.class);
|
||||||
this.registerIncoming(10, ServerPlayerUseBedPacket.class);
|
this.registerOutgoing(11, ClientPlayerStatePacket.class);
|
||||||
this.registerIncoming(11, ServerAnimationPacket.class);
|
this.registerOutgoing(12, ClientSteerVehiclePacket.class);
|
||||||
this.registerIncoming(12, ServerSpawnPlayerPacket.class);
|
this.registerOutgoing(13, ClientCloseWindowPacket.class);
|
||||||
this.registerIncoming(13, ServerCollectItemPacket.class);
|
this.registerOutgoing(14, ClientWindowActionPacket.class);
|
||||||
this.registerIncoming(14, ServerSpawnObjectPacket.class);
|
this.registerOutgoing(15, ClientConfirmTransactionPacket.class);
|
||||||
this.registerIncoming(15, ServerSpawnMobPacket.class);
|
this.registerOutgoing(16, ClientCreativeInventoryActionPacket.class);
|
||||||
this.registerIncoming(16, ServerSpawnPaintingPacket.class);
|
this.registerOutgoing(17, ClientEnchantItemPacket.class);
|
||||||
this.registerIncoming(17, ServerSpawnExpOrbPacket.class);
|
this.registerOutgoing(18, ClientUpdateSignPacket.class);
|
||||||
this.registerIncoming(18, ServerEntityVelocityPacket.class);
|
this.registerOutgoing(19, ClientPlayerAbilitiesPacket.class);
|
||||||
this.registerIncoming(19, ServerDestroyEntitiesPacket.class);
|
this.registerOutgoing(20, ClientTabCompletePacket.class);
|
||||||
this.registerIncoming(20, ServerEntityMovementPacket.class);
|
this.registerOutgoing(21, ClientSettingsPacket.class);
|
||||||
this.registerIncoming(21, ServerEntityPositionPacket.class);
|
this.registerOutgoing(22, ClientRequestPacket.class);
|
||||||
this.registerIncoming(22, ServerEntityRotationPacket.class);
|
this.registerOutgoing(23, ClientPluginMessagePacket.class);
|
||||||
this.registerIncoming(23, ServerEntityPositionRotationPacket.class);
|
this.registerOutgoing(24, ClientSpectatePacket.class);
|
||||||
this.registerIncoming(24, ServerEntityTeleportPacket.class);
|
this.registerOutgoing(25, ClientResourcePackStatusPacket.class);
|
||||||
this.registerIncoming(25, ServerEntityHeadLookPacket.class);
|
}
|
||||||
this.registerIncoming(26, ServerEntityStatusPacket.class);
|
|
||||||
this.registerIncoming(27, ServerEntityAttachPacket.class);
|
|
||||||
this.registerIncoming(28, ServerEntityMetadataPacket.class);
|
|
||||||
this.registerIncoming(29, ServerEntityEffectPacket.class);
|
|
||||||
this.registerIncoming(30, ServerEntityRemoveEffectPacket.class);
|
|
||||||
this.registerIncoming(31, ServerSetExperiencePacket.class);
|
|
||||||
this.registerIncoming(32, ServerEntityPropertiesPacket.class);
|
|
||||||
this.registerIncoming(33, ServerChunkDataPacket.class);
|
|
||||||
this.registerIncoming(34, ServerMultiBlockChangePacket.class);
|
|
||||||
this.registerIncoming(35, ServerBlockChangePacket.class);
|
|
||||||
this.registerIncoming(36, ServerBlockValuePacket.class);
|
|
||||||
this.registerIncoming(37, ServerBlockBreakAnimPacket.class);
|
|
||||||
this.registerIncoming(38, ServerMultiChunkDataPacket.class);
|
|
||||||
this.registerIncoming(39, ServerExplosionPacket.class);
|
|
||||||
this.registerIncoming(40, ServerPlayEffectPacket.class);
|
|
||||||
this.registerIncoming(41, ServerPlaySoundPacket.class);
|
|
||||||
this.registerIncoming(42, ServerSpawnParticlePacket.class);
|
|
||||||
this.registerIncoming(43, ServerNotifyClientPacket.class);
|
|
||||||
this.registerIncoming(44, ServerSpawnGlobalEntityPacket.class);
|
|
||||||
this.registerIncoming(45, ServerOpenWindowPacket.class);
|
|
||||||
this.registerIncoming(46, ServerCloseWindowPacket.class);
|
|
||||||
this.registerIncoming(47, ServerSetSlotPacket.class);
|
|
||||||
this.registerIncoming(48, ServerWindowItemsPacket.class);
|
|
||||||
this.registerIncoming(49, ServerWindowPropertyPacket.class);
|
|
||||||
this.registerIncoming(50, ServerConfirmTransactionPacket.class);
|
|
||||||
this.registerIncoming(51, ServerUpdateSignPacket.class);
|
|
||||||
this.registerIncoming(52, ServerMapDataPacket.class);
|
|
||||||
this.registerIncoming(53, ServerUpdateTileEntityPacket.class);
|
|
||||||
this.registerIncoming(54, ServerOpenTileEntityEditorPacket.class);
|
|
||||||
this.registerIncoming(55, ServerStatisticsPacket.class);
|
|
||||||
this.registerIncoming(56, ServerPlayerListEntryPacket.class);
|
|
||||||
this.registerIncoming(57, ServerPlayerAbilitiesPacket.class);
|
|
||||||
this.registerIncoming(58, ServerTabCompletePacket.class);
|
|
||||||
this.registerIncoming(59, ServerScoreboardObjectivePacket.class);
|
|
||||||
this.registerIncoming(60, ServerUpdateScorePacket.class);
|
|
||||||
this.registerIncoming(61, ServerDisplayScoreboardPacket.class);
|
|
||||||
this.registerIncoming(62, ServerTeamPacket.class);
|
|
||||||
this.registerIncoming(63, ServerPluginMessagePacket.class);
|
|
||||||
this.registerIncoming(64, ServerDisconnectPacket.class);
|
|
||||||
this.registerIncoming(65, ServerDifficultyPacket.class);
|
|
||||||
this.registerIncoming(66, ServerCombatPacket.class);
|
|
||||||
this.registerIncoming(67, ServerSwitchCameraPacket.class);
|
|
||||||
this.registerIncoming(68, ServerWorldBorderPacket.class);
|
|
||||||
this.registerIncoming(69, ServerTitlePacket.class);
|
|
||||||
this.registerIncoming(70, ServerSetCompressionPacket.class);
|
|
||||||
this.registerIncoming(71, ServerPlayerListDataPacket.class);
|
|
||||||
this.registerIncoming(72, ServerResourcePackSendPacket.class);
|
|
||||||
this.registerIncoming(73, ServerEntityNBTUpdatePacket.class);
|
|
||||||
|
|
||||||
this.registerOutgoing(0, ClientKeepAlivePacket.class);
|
private void initServerGame(Session session) {
|
||||||
this.registerOutgoing(1, ClientChatPacket.class);
|
this.registerIncoming(0, ClientKeepAlivePacket.class);
|
||||||
this.registerOutgoing(2, ClientPlayerInteractEntityPacket.class);
|
this.registerIncoming(1, ClientChatPacket.class);
|
||||||
this.registerOutgoing(3, ClientPlayerMovementPacket.class);
|
this.registerIncoming(2, ClientPlayerInteractEntityPacket.class);
|
||||||
this.registerOutgoing(4, ClientPlayerPositionPacket.class);
|
this.registerIncoming(3, ClientPlayerMovementPacket.class);
|
||||||
this.registerOutgoing(5, ClientPlayerRotationPacket.class);
|
this.registerIncoming(4, ClientPlayerPositionPacket.class);
|
||||||
this.registerOutgoing(6, ClientPlayerPositionRotationPacket.class);
|
this.registerIncoming(5, ClientPlayerRotationPacket.class);
|
||||||
this.registerOutgoing(7, ClientPlayerActionPacket.class);
|
this.registerIncoming(6, ClientPlayerPositionRotationPacket.class);
|
||||||
this.registerOutgoing(8, ClientPlayerPlaceBlockPacket.class);
|
this.registerIncoming(7, ClientPlayerActionPacket.class);
|
||||||
this.registerOutgoing(9, ClientChangeHeldItemPacket.class);
|
this.registerIncoming(8, ClientPlayerPlaceBlockPacket.class);
|
||||||
this.registerOutgoing(10, ClientSwingArmPacket.class);
|
this.registerIncoming(9, ClientChangeHeldItemPacket.class);
|
||||||
this.registerOutgoing(11, ClientPlayerStatePacket.class);
|
this.registerIncoming(10, ClientSwingArmPacket.class);
|
||||||
this.registerOutgoing(12, ClientSteerVehiclePacket.class);
|
this.registerIncoming(11, ClientPlayerStatePacket.class);
|
||||||
this.registerOutgoing(13, ClientCloseWindowPacket.class);
|
this.registerIncoming(12, ClientSteerVehiclePacket.class);
|
||||||
this.registerOutgoing(14, ClientWindowActionPacket.class);
|
this.registerIncoming(13, ClientCloseWindowPacket.class);
|
||||||
this.registerOutgoing(15, ClientConfirmTransactionPacket.class);
|
this.registerIncoming(14, ClientWindowActionPacket.class);
|
||||||
this.registerOutgoing(16, ClientCreativeInventoryActionPacket.class);
|
this.registerIncoming(15, ClientConfirmTransactionPacket.class);
|
||||||
this.registerOutgoing(17, ClientEnchantItemPacket.class);
|
this.registerIncoming(16, ClientCreativeInventoryActionPacket.class);
|
||||||
this.registerOutgoing(18, ClientUpdateSignPacket.class);
|
this.registerIncoming(17, ClientEnchantItemPacket.class);
|
||||||
this.registerOutgoing(19, ClientPlayerAbilitiesPacket.class);
|
this.registerIncoming(18, ClientUpdateSignPacket.class);
|
||||||
this.registerOutgoing(20, ClientTabCompletePacket.class);
|
this.registerIncoming(19, ClientPlayerAbilitiesPacket.class);
|
||||||
this.registerOutgoing(21, ClientSettingsPacket.class);
|
this.registerIncoming(20, ClientTabCompletePacket.class);
|
||||||
this.registerOutgoing(22, ClientRequestPacket.class);
|
this.registerIncoming(21, ClientSettingsPacket.class);
|
||||||
this.registerOutgoing(23, ClientPluginMessagePacket.class);
|
this.registerIncoming(22, ClientRequestPacket.class);
|
||||||
this.registerOutgoing(24, ClientSpectatePacket.class);
|
this.registerIncoming(23, ClientPluginMessagePacket.class);
|
||||||
this.registerOutgoing(25, ClientResourcePackStatusPacket.class);
|
this.registerIncoming(24, ClientSpectatePacket.class);
|
||||||
}
|
this.registerIncoming(25, ClientResourcePackStatusPacket.class);
|
||||||
|
|
||||||
private void initServerGame(Session session) {
|
this.registerOutgoing(0, ServerKeepAlivePacket.class);
|
||||||
this.registerIncoming(0, ClientKeepAlivePacket.class);
|
this.registerOutgoing(1, ServerJoinGamePacket.class);
|
||||||
this.registerIncoming(1, ClientChatPacket.class);
|
this.registerOutgoing(2, ServerChatPacket.class);
|
||||||
this.registerIncoming(2, ClientPlayerInteractEntityPacket.class);
|
this.registerOutgoing(3, ServerUpdateTimePacket.class);
|
||||||
this.registerIncoming(3, ClientPlayerMovementPacket.class);
|
this.registerOutgoing(4, ServerEntityEquipmentPacket.class);
|
||||||
this.registerIncoming(4, ClientPlayerPositionPacket.class);
|
this.registerOutgoing(5, ServerSpawnPositionPacket.class);
|
||||||
this.registerIncoming(5, ClientPlayerRotationPacket.class);
|
this.registerOutgoing(6, ServerUpdateHealthPacket.class);
|
||||||
this.registerIncoming(6, ClientPlayerPositionRotationPacket.class);
|
this.registerOutgoing(7, ServerRespawnPacket.class);
|
||||||
this.registerIncoming(7, ClientPlayerActionPacket.class);
|
this.registerOutgoing(8, ServerPlayerPositionRotationPacket.class);
|
||||||
this.registerIncoming(8, ClientPlayerPlaceBlockPacket.class);
|
this.registerOutgoing(9, ServerChangeHeldItemPacket.class);
|
||||||
this.registerIncoming(9, ClientChangeHeldItemPacket.class);
|
this.registerOutgoing(10, ServerPlayerUseBedPacket.class);
|
||||||
this.registerIncoming(10, ClientSwingArmPacket.class);
|
this.registerOutgoing(11, ServerAnimationPacket.class);
|
||||||
this.registerIncoming(11, ClientPlayerStatePacket.class);
|
this.registerOutgoing(12, ServerSpawnPlayerPacket.class);
|
||||||
this.registerIncoming(12, ClientSteerVehiclePacket.class);
|
this.registerOutgoing(13, ServerCollectItemPacket.class);
|
||||||
this.registerIncoming(13, ClientCloseWindowPacket.class);
|
this.registerOutgoing(14, ServerSpawnObjectPacket.class);
|
||||||
this.registerIncoming(14, ClientWindowActionPacket.class);
|
this.registerOutgoing(15, ServerSpawnMobPacket.class);
|
||||||
this.registerIncoming(15, ClientConfirmTransactionPacket.class);
|
this.registerOutgoing(16, ServerSpawnPaintingPacket.class);
|
||||||
this.registerIncoming(16, ClientCreativeInventoryActionPacket.class);
|
this.registerOutgoing(17, ServerSpawnExpOrbPacket.class);
|
||||||
this.registerIncoming(17, ClientEnchantItemPacket.class);
|
this.registerOutgoing(18, ServerEntityVelocityPacket.class);
|
||||||
this.registerIncoming(18, ClientUpdateSignPacket.class);
|
this.registerOutgoing(19, ServerDestroyEntitiesPacket.class);
|
||||||
this.registerIncoming(19, ClientPlayerAbilitiesPacket.class);
|
this.registerOutgoing(20, ServerEntityMovementPacket.class);
|
||||||
this.registerIncoming(20, ClientTabCompletePacket.class);
|
this.registerOutgoing(21, ServerEntityPositionPacket.class);
|
||||||
this.registerIncoming(21, ClientSettingsPacket.class);
|
this.registerOutgoing(22, ServerEntityRotationPacket.class);
|
||||||
this.registerIncoming(22, ClientRequestPacket.class);
|
this.registerOutgoing(23, ServerEntityPositionRotationPacket.class);
|
||||||
this.registerIncoming(23, ClientPluginMessagePacket.class);
|
this.registerOutgoing(24, ServerEntityTeleportPacket.class);
|
||||||
this.registerIncoming(24, ClientSpectatePacket.class);
|
this.registerOutgoing(25, ServerEntityHeadLookPacket.class);
|
||||||
this.registerIncoming(25, ClientResourcePackStatusPacket.class);
|
this.registerOutgoing(26, ServerEntityStatusPacket.class);
|
||||||
|
this.registerOutgoing(27, ServerEntityAttachPacket.class);
|
||||||
|
this.registerOutgoing(28, ServerEntityMetadataPacket.class);
|
||||||
|
this.registerOutgoing(29, ServerEntityEffectPacket.class);
|
||||||
|
this.registerOutgoing(30, ServerEntityRemoveEffectPacket.class);
|
||||||
|
this.registerOutgoing(31, ServerSetExperiencePacket.class);
|
||||||
|
this.registerOutgoing(32, ServerEntityPropertiesPacket.class);
|
||||||
|
this.registerOutgoing(33, ServerChunkDataPacket.class);
|
||||||
|
this.registerOutgoing(34, ServerMultiBlockChangePacket.class);
|
||||||
|
this.registerOutgoing(35, ServerBlockChangePacket.class);
|
||||||
|
this.registerOutgoing(36, ServerBlockValuePacket.class);
|
||||||
|
this.registerOutgoing(37, ServerBlockBreakAnimPacket.class);
|
||||||
|
this.registerOutgoing(38, ServerMultiChunkDataPacket.class);
|
||||||
|
this.registerOutgoing(39, ServerExplosionPacket.class);
|
||||||
|
this.registerOutgoing(40, ServerPlayEffectPacket.class);
|
||||||
|
this.registerOutgoing(41, ServerPlaySoundPacket.class);
|
||||||
|
this.registerOutgoing(42, ServerSpawnParticlePacket.class);
|
||||||
|
this.registerOutgoing(43, ServerNotifyClientPacket.class);
|
||||||
|
this.registerOutgoing(44, ServerSpawnGlobalEntityPacket.class);
|
||||||
|
this.registerOutgoing(45, ServerOpenWindowPacket.class);
|
||||||
|
this.registerOutgoing(46, ServerCloseWindowPacket.class);
|
||||||
|
this.registerOutgoing(47, ServerSetSlotPacket.class);
|
||||||
|
this.registerOutgoing(48, ServerWindowItemsPacket.class);
|
||||||
|
this.registerOutgoing(49, ServerWindowPropertyPacket.class);
|
||||||
|
this.registerOutgoing(50, ServerConfirmTransactionPacket.class);
|
||||||
|
this.registerOutgoing(51, ServerUpdateSignPacket.class);
|
||||||
|
this.registerOutgoing(52, ServerMapDataPacket.class);
|
||||||
|
this.registerOutgoing(53, ServerUpdateTileEntityPacket.class);
|
||||||
|
this.registerOutgoing(54, ServerOpenTileEntityEditorPacket.class);
|
||||||
|
this.registerOutgoing(55, ServerStatisticsPacket.class);
|
||||||
|
this.registerOutgoing(56, ServerPlayerListEntryPacket.class);
|
||||||
|
this.registerOutgoing(57, ServerPlayerAbilitiesPacket.class);
|
||||||
|
this.registerOutgoing(58, ServerTabCompletePacket.class);
|
||||||
|
this.registerOutgoing(59, ServerScoreboardObjectivePacket.class);
|
||||||
|
this.registerOutgoing(60, ServerUpdateScorePacket.class);
|
||||||
|
this.registerOutgoing(61, ServerDisplayScoreboardPacket.class);
|
||||||
|
this.registerOutgoing(62, ServerTeamPacket.class);
|
||||||
|
this.registerOutgoing(63, ServerPluginMessagePacket.class);
|
||||||
|
this.registerOutgoing(64, ServerDisconnectPacket.class);
|
||||||
|
this.registerOutgoing(65, ServerDifficultyPacket.class);
|
||||||
|
this.registerOutgoing(66, ServerCombatPacket.class);
|
||||||
|
this.registerOutgoing(67, ServerSwitchCameraPacket.class);
|
||||||
|
this.registerOutgoing(68, ServerWorldBorderPacket.class);
|
||||||
|
this.registerOutgoing(69, ServerTitlePacket.class);
|
||||||
|
this.registerOutgoing(70, ServerSetCompressionPacket.class);
|
||||||
|
this.registerOutgoing(71, ServerPlayerListDataPacket.class);
|
||||||
|
this.registerOutgoing(72, ServerResourcePackSendPacket.class);
|
||||||
|
this.registerOutgoing(73, ServerEntityNBTUpdatePacket.class);
|
||||||
|
}
|
||||||
|
|
||||||
this.registerOutgoing(0, ServerKeepAlivePacket.class);
|
private void initClientStatus(Session session) {
|
||||||
this.registerOutgoing(1, ServerJoinGamePacket.class);
|
this.registerIncoming(0, StatusResponsePacket.class);
|
||||||
this.registerOutgoing(2, ServerChatPacket.class);
|
this.registerIncoming(1, StatusPongPacket.class);
|
||||||
this.registerOutgoing(3, ServerUpdateTimePacket.class);
|
|
||||||
this.registerOutgoing(4, ServerEntityEquipmentPacket.class);
|
|
||||||
this.registerOutgoing(5, ServerSpawnPositionPacket.class);
|
|
||||||
this.registerOutgoing(6, ServerUpdateHealthPacket.class);
|
|
||||||
this.registerOutgoing(7, ServerRespawnPacket.class);
|
|
||||||
this.registerOutgoing(8, ServerPlayerPositionRotationPacket.class);
|
|
||||||
this.registerOutgoing(9, ServerChangeHeldItemPacket.class);
|
|
||||||
this.registerOutgoing(10, ServerPlayerUseBedPacket.class);
|
|
||||||
this.registerOutgoing(11, ServerAnimationPacket.class);
|
|
||||||
this.registerOutgoing(12, ServerSpawnPlayerPacket.class);
|
|
||||||
this.registerOutgoing(13, ServerCollectItemPacket.class);
|
|
||||||
this.registerOutgoing(14, ServerSpawnObjectPacket.class);
|
|
||||||
this.registerOutgoing(15, ServerSpawnMobPacket.class);
|
|
||||||
this.registerOutgoing(16, ServerSpawnPaintingPacket.class);
|
|
||||||
this.registerOutgoing(17, ServerSpawnExpOrbPacket.class);
|
|
||||||
this.registerOutgoing(18, ServerEntityVelocityPacket.class);
|
|
||||||
this.registerOutgoing(19, ServerDestroyEntitiesPacket.class);
|
|
||||||
this.registerOutgoing(20, ServerEntityMovementPacket.class);
|
|
||||||
this.registerOutgoing(21, ServerEntityPositionPacket.class);
|
|
||||||
this.registerOutgoing(22, ServerEntityRotationPacket.class);
|
|
||||||
this.registerOutgoing(23, ServerEntityPositionRotationPacket.class);
|
|
||||||
this.registerOutgoing(24, ServerEntityTeleportPacket.class);
|
|
||||||
this.registerOutgoing(25, ServerEntityHeadLookPacket.class);
|
|
||||||
this.registerOutgoing(26, ServerEntityStatusPacket.class);
|
|
||||||
this.registerOutgoing(27, ServerEntityAttachPacket.class);
|
|
||||||
this.registerOutgoing(28, ServerEntityMetadataPacket.class);
|
|
||||||
this.registerOutgoing(29, ServerEntityEffectPacket.class);
|
|
||||||
this.registerOutgoing(30, ServerEntityRemoveEffectPacket.class);
|
|
||||||
this.registerOutgoing(31, ServerSetExperiencePacket.class);
|
|
||||||
this.registerOutgoing(32, ServerEntityPropertiesPacket.class);
|
|
||||||
this.registerOutgoing(33, ServerChunkDataPacket.class);
|
|
||||||
this.registerOutgoing(34, ServerMultiBlockChangePacket.class);
|
|
||||||
this.registerOutgoing(35, ServerBlockChangePacket.class);
|
|
||||||
this.registerOutgoing(36, ServerBlockValuePacket.class);
|
|
||||||
this.registerOutgoing(37, ServerBlockBreakAnimPacket.class);
|
|
||||||
this.registerOutgoing(38, ServerMultiChunkDataPacket.class);
|
|
||||||
this.registerOutgoing(39, ServerExplosionPacket.class);
|
|
||||||
this.registerOutgoing(40, ServerPlayEffectPacket.class);
|
|
||||||
this.registerOutgoing(41, ServerPlaySoundPacket.class);
|
|
||||||
this.registerOutgoing(42, ServerSpawnParticlePacket.class);
|
|
||||||
this.registerOutgoing(43, ServerNotifyClientPacket.class);
|
|
||||||
this.registerOutgoing(44, ServerSpawnGlobalEntityPacket.class);
|
|
||||||
this.registerOutgoing(45, ServerOpenWindowPacket.class);
|
|
||||||
this.registerOutgoing(46, ServerCloseWindowPacket.class);
|
|
||||||
this.registerOutgoing(47, ServerSetSlotPacket.class);
|
|
||||||
this.registerOutgoing(48, ServerWindowItemsPacket.class);
|
|
||||||
this.registerOutgoing(49, ServerWindowPropertyPacket.class);
|
|
||||||
this.registerOutgoing(50, ServerConfirmTransactionPacket.class);
|
|
||||||
this.registerOutgoing(51, ServerUpdateSignPacket.class);
|
|
||||||
this.registerOutgoing(52, ServerMapDataPacket.class);
|
|
||||||
this.registerOutgoing(53, ServerUpdateTileEntityPacket.class);
|
|
||||||
this.registerOutgoing(54, ServerOpenTileEntityEditorPacket.class);
|
|
||||||
this.registerOutgoing(55, ServerStatisticsPacket.class);
|
|
||||||
this.registerOutgoing(56, ServerPlayerListEntryPacket.class);
|
|
||||||
this.registerOutgoing(57, ServerPlayerAbilitiesPacket.class);
|
|
||||||
this.registerOutgoing(58, ServerTabCompletePacket.class);
|
|
||||||
this.registerOutgoing(59, ServerScoreboardObjectivePacket.class);
|
|
||||||
this.registerOutgoing(60, ServerUpdateScorePacket.class);
|
|
||||||
this.registerOutgoing(61, ServerDisplayScoreboardPacket.class);
|
|
||||||
this.registerOutgoing(62, ServerTeamPacket.class);
|
|
||||||
this.registerOutgoing(63, ServerPluginMessagePacket.class);
|
|
||||||
this.registerOutgoing(64, ServerDisconnectPacket.class);
|
|
||||||
this.registerOutgoing(65, ServerDifficultyPacket.class);
|
|
||||||
this.registerOutgoing(66, ServerCombatPacket.class);
|
|
||||||
this.registerOutgoing(67, ServerSwitchCameraPacket.class);
|
|
||||||
this.registerOutgoing(68, ServerWorldBorderPacket.class);
|
|
||||||
this.registerOutgoing(69, ServerTitlePacket.class);
|
|
||||||
this.registerOutgoing(70, ServerSetCompressionPacket.class);
|
|
||||||
this.registerOutgoing(71, ServerPlayerListDataPacket.class);
|
|
||||||
this.registerOutgoing(72, ServerResourcePackSendPacket.class);
|
|
||||||
this.registerOutgoing(73, ServerEntityNBTUpdatePacket.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initClientStatus(Session session) {
|
this.registerOutgoing(0, StatusQueryPacket.class);
|
||||||
this.registerIncoming(0, StatusResponsePacket.class);
|
this.registerOutgoing(1, StatusPingPacket.class);
|
||||||
this.registerIncoming(1, StatusPongPacket.class);
|
}
|
||||||
|
|
||||||
this.registerOutgoing(0, StatusQueryPacket.class);
|
private void initServerStatus(Session session) {
|
||||||
this.registerOutgoing(1, StatusPingPacket.class);
|
this.registerIncoming(0, StatusQueryPacket.class);
|
||||||
}
|
this.registerIncoming(1, StatusPingPacket.class);
|
||||||
|
|
||||||
private void initServerStatus(Session session) {
|
this.registerOutgoing(0, StatusResponsePacket.class);
|
||||||
this.registerIncoming(0, StatusQueryPacket.class);
|
this.registerOutgoing(1, StatusPongPacket.class);
|
||||||
this.registerIncoming(1, StatusPingPacket.class);
|
}
|
||||||
|
|
||||||
this.registerOutgoing(0, StatusResponsePacket.class);
|
|
||||||
this.registerOutgoing(1, StatusPongPacket.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,24 +2,24 @@ package org.spacehq.mc.protocol;
|
||||||
|
|
||||||
public class ProtocolConstants {
|
public class ProtocolConstants {
|
||||||
|
|
||||||
// General Constants
|
// General Constants
|
||||||
public static final String GAME_VERSION = "1.8";
|
public static final String GAME_VERSION = "1.8";
|
||||||
public static final int PROTOCOL_VERSION = 47;
|
public static final int PROTOCOL_VERSION = 47;
|
||||||
|
|
||||||
// General Key Constants
|
// General Key Constants
|
||||||
public static final String PROFILE_KEY = "profile";
|
public static final String PROFILE_KEY = "profile";
|
||||||
public static final String AUTH_PROXY_KEY = "auth-proxy";
|
public static final String AUTH_PROXY_KEY = "auth-proxy";
|
||||||
|
|
||||||
// Client Key Constants
|
// Client Key Constants
|
||||||
public static final String ACCESS_TOKEN_KEY = "access-token";
|
public static final String ACCESS_TOKEN_KEY = "access-token";
|
||||||
public static final String SERVER_INFO_HANDLER_KEY = "server-info-handler";
|
public static final String SERVER_INFO_HANDLER_KEY = "server-info-handler";
|
||||||
public static final String SERVER_PING_TIME_HANDLER_KEY = "server-ping-time-handler";
|
public static final String SERVER_PING_TIME_HANDLER_KEY = "server-ping-time-handler";
|
||||||
|
|
||||||
// Server Key Constants
|
// Server Key Constants
|
||||||
public static final String VERIFY_USERS_KEY = "verify-users";
|
public static final String VERIFY_USERS_KEY = "verify-users";
|
||||||
public static final String SERVER_INFO_BUILDER_KEY = "info-builder";
|
public static final String SERVER_INFO_BUILDER_KEY = "info-builder";
|
||||||
public static final String SERVER_LOGIN_HANDLER_KEY = "login-handler";
|
public static final String SERVER_LOGIN_HANDLER_KEY = "login-handler";
|
||||||
public static final String PING_KEY = "ping";
|
public static final String PING_KEY = "ping";
|
||||||
public static final String SERVER_COMPRESSION_THRESHOLD = "compression-threshold";
|
public static final String SERVER_COMPRESSION_THRESHOLD = "compression-threshold";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,9 @@ package org.spacehq.mc.protocol;
|
||||||
|
|
||||||
public enum ProtocolMode {
|
public enum ProtocolMode {
|
||||||
|
|
||||||
HANDSHAKE,
|
HANDSHAKE,
|
||||||
LOGIN,
|
LOGIN,
|
||||||
GAME,
|
GAME,
|
||||||
STATUS;
|
STATUS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,182 +37,182 @@ import java.util.UUID;
|
||||||
|
|
||||||
public class ServerListener extends SessionAdapter {
|
public class ServerListener extends SessionAdapter {
|
||||||
|
|
||||||
private static KeyPair pair = CryptUtil.generateKeyPair();
|
private static KeyPair pair = CryptUtil.generateKeyPair();
|
||||||
|
|
||||||
private byte verifyToken[] = new byte[4];
|
private byte verifyToken[] = new byte[4];
|
||||||
private String serverId = "";
|
private String serverId = "";
|
||||||
private String username = "";
|
private String username = "";
|
||||||
|
|
||||||
private long lastPingTime = 0;
|
private long lastPingTime = 0;
|
||||||
private int lastPingId = 0;
|
private int lastPingId = 0;
|
||||||
|
|
||||||
public ServerListener() {
|
public ServerListener() {
|
||||||
new Random().nextBytes(this.verifyToken);
|
new Random().nextBytes(this.verifyToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void connected(ConnectedEvent event) {
|
public void connected(ConnectedEvent event) {
|
||||||
event.getSession().setFlag(ProtocolConstants.PING_KEY, 0);
|
event.getSession().setFlag(ProtocolConstants.PING_KEY, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void packetReceived(PacketReceivedEvent event) {
|
public void packetReceived(PacketReceivedEvent event) {
|
||||||
MinecraftProtocol protocol = (MinecraftProtocol) event.getSession().getPacketProtocol();
|
MinecraftProtocol protocol = (MinecraftProtocol) event.getSession().getPacketProtocol();
|
||||||
if(protocol.getMode() == ProtocolMode.HANDSHAKE) {
|
if(protocol.getMode() == ProtocolMode.HANDSHAKE) {
|
||||||
if(event.getPacket() instanceof HandshakePacket) {
|
if(event.getPacket() instanceof HandshakePacket) {
|
||||||
HandshakePacket packet = event.getPacket();
|
HandshakePacket packet = event.getPacket();
|
||||||
switch(packet.getIntent()) {
|
switch(packet.getIntent()) {
|
||||||
case STATUS:
|
case STATUS:
|
||||||
protocol.setMode(ProtocolMode.STATUS, false, event.getSession());
|
protocol.setMode(ProtocolMode.STATUS, false, event.getSession());
|
||||||
break;
|
break;
|
||||||
case LOGIN:
|
case LOGIN:
|
||||||
protocol.setMode(ProtocolMode.LOGIN, false, event.getSession());
|
protocol.setMode(ProtocolMode.LOGIN, false, event.getSession());
|
||||||
if(packet.getProtocolVersion() > ProtocolConstants.PROTOCOL_VERSION) {
|
if(packet.getProtocolVersion() > ProtocolConstants.PROTOCOL_VERSION) {
|
||||||
event.getSession().disconnect("Outdated server! I'm still on " + ProtocolConstants.GAME_VERSION + ".");
|
event.getSession().disconnect("Outdated server! I'm still on " + ProtocolConstants.GAME_VERSION + ".");
|
||||||
} else if(packet.getProtocolVersion() < ProtocolConstants.PROTOCOL_VERSION) {
|
} else if(packet.getProtocolVersion() < ProtocolConstants.PROTOCOL_VERSION) {
|
||||||
event.getSession().disconnect("Outdated client! Please use " + ProtocolConstants.GAME_VERSION + ".");
|
event.getSession().disconnect("Outdated client! Please use " + ProtocolConstants.GAME_VERSION + ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new UnsupportedOperationException("Invalid client intent: " + packet.getIntent());
|
throw new UnsupportedOperationException("Invalid client intent: " + packet.getIntent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(protocol.getMode() == ProtocolMode.LOGIN) {
|
if(protocol.getMode() == ProtocolMode.LOGIN) {
|
||||||
if(event.getPacket() instanceof LoginStartPacket) {
|
if(event.getPacket() instanceof LoginStartPacket) {
|
||||||
this.username = event.<LoginStartPacket>getPacket().getUsername();
|
this.username = event.<LoginStartPacket>getPacket().getUsername();
|
||||||
boolean verify = event.getSession().hasFlag(ProtocolConstants.VERIFY_USERS_KEY) ? event.getSession().<Boolean>getFlag(ProtocolConstants.VERIFY_USERS_KEY) : true;
|
boolean verify = event.getSession().hasFlag(ProtocolConstants.VERIFY_USERS_KEY) ? event.getSession().<Boolean>getFlag(ProtocolConstants.VERIFY_USERS_KEY) : true;
|
||||||
if(verify) {
|
if(verify) {
|
||||||
event.getSession().send(new EncryptionRequestPacket(this.serverId, pair.getPublic(), this.verifyToken));
|
event.getSession().send(new EncryptionRequestPacket(this.serverId, pair.getPublic(), this.verifyToken));
|
||||||
} else {
|
} else {
|
||||||
GameProfile profile = new GameProfile(UUID.nameUUIDFromBytes(("OfflinePlayer:" + this.username).getBytes()), this.username);
|
GameProfile profile = new GameProfile(UUID.nameUUIDFromBytes(("OfflinePlayer:" + this.username).getBytes()), this.username);
|
||||||
int threshold = event.getSession().getFlag(ProtocolConstants.SERVER_COMPRESSION_THRESHOLD);
|
int threshold = event.getSession().getFlag(ProtocolConstants.SERVER_COMPRESSION_THRESHOLD);
|
||||||
event.getSession().send(new LoginSetCompressionPacket(threshold));
|
event.getSession().send(new LoginSetCompressionPacket(threshold));
|
||||||
event.getSession().setCompressionThreshold(threshold);
|
event.getSession().setCompressionThreshold(threshold);
|
||||||
event.getSession().send(new LoginSuccessPacket(profile));
|
event.getSession().send(new LoginSuccessPacket(profile));
|
||||||
event.getSession().setFlag(ProtocolConstants.PROFILE_KEY, profile);
|
event.getSession().setFlag(ProtocolConstants.PROFILE_KEY, profile);
|
||||||
protocol.setMode(ProtocolMode.GAME, false, event.getSession());
|
protocol.setMode(ProtocolMode.GAME, false, event.getSession());
|
||||||
ServerLoginHandler handler = event.getSession().getFlag(ProtocolConstants.SERVER_LOGIN_HANDLER_KEY);
|
ServerLoginHandler handler = event.getSession().getFlag(ProtocolConstants.SERVER_LOGIN_HANDLER_KEY);
|
||||||
if(handler != null) {
|
if(handler != null) {
|
||||||
handler.loggedIn(event.getSession());
|
handler.loggedIn(event.getSession());
|
||||||
}
|
}
|
||||||
|
|
||||||
new Thread(new KeepAlive(event.getSession())).start();
|
new Thread(new KeepAlive(event.getSession())).start();
|
||||||
}
|
}
|
||||||
} else if(event.getPacket() instanceof EncryptionResponsePacket) {
|
} else if(event.getPacket() instanceof EncryptionResponsePacket) {
|
||||||
EncryptionResponsePacket packet = event.getPacket();
|
EncryptionResponsePacket packet = event.getPacket();
|
||||||
PrivateKey privateKey = pair.getPrivate();
|
PrivateKey privateKey = pair.getPrivate();
|
||||||
if(!Arrays.equals(this.verifyToken, packet.getVerifyToken(privateKey))) {
|
if(!Arrays.equals(this.verifyToken, packet.getVerifyToken(privateKey))) {
|
||||||
throw new IllegalStateException("Invalid nonce!");
|
throw new IllegalStateException("Invalid nonce!");
|
||||||
} else {
|
} else {
|
||||||
SecretKey key = packet.getSecretKey(privateKey);
|
SecretKey key = packet.getSecretKey(privateKey);
|
||||||
protocol.enableEncryption(key);
|
protocol.enableEncryption(key);
|
||||||
new UserAuthThread(event.getSession(), key).start();
|
new UserAuthThread(event.getSession(), key).start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(protocol.getMode() == ProtocolMode.STATUS) {
|
if(protocol.getMode() == ProtocolMode.STATUS) {
|
||||||
if(event.getPacket() instanceof StatusQueryPacket) {
|
if(event.getPacket() instanceof StatusQueryPacket) {
|
||||||
ServerInfoBuilder builder = event.getSession().getFlag(ProtocolConstants.SERVER_INFO_BUILDER_KEY);
|
ServerInfoBuilder builder = event.getSession().getFlag(ProtocolConstants.SERVER_INFO_BUILDER_KEY);
|
||||||
if(builder == null) {
|
if(builder == null) {
|
||||||
event.getSession().disconnect("No server info builder set.");
|
event.getSession().disconnect("No server info builder set.");
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerStatusInfo info = builder.buildInfo(event.getSession());
|
ServerStatusInfo info = builder.buildInfo(event.getSession());
|
||||||
event.getSession().send(new StatusResponsePacket(info));
|
event.getSession().send(new StatusResponsePacket(info));
|
||||||
} else if(event.getPacket() instanceof StatusPingPacket) {
|
} else if(event.getPacket() instanceof StatusPingPacket) {
|
||||||
event.getSession().send(new StatusPongPacket(event.<StatusPingPacket>getPacket().getPingTime()));
|
event.getSession().send(new StatusPongPacket(event.<StatusPingPacket>getPacket().getPingTime()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(protocol.getMode() == ProtocolMode.GAME) {
|
if(protocol.getMode() == ProtocolMode.GAME) {
|
||||||
if(event.getPacket() instanceof ClientKeepAlivePacket) {
|
if(event.getPacket() instanceof ClientKeepAlivePacket) {
|
||||||
ClientKeepAlivePacket packet = event.getPacket();
|
ClientKeepAlivePacket packet = event.getPacket();
|
||||||
if(packet.getPingId() == this.lastPingId) {
|
if(packet.getPingId() == this.lastPingId) {
|
||||||
long time = System.currentTimeMillis() - this.lastPingTime;
|
long time = System.currentTimeMillis() - this.lastPingTime;
|
||||||
event.getSession().setFlag(ProtocolConstants.PING_KEY, time);
|
event.getSession().setFlag(ProtocolConstants.PING_KEY, time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disconnecting(DisconnectingEvent event) {
|
public void disconnecting(DisconnectingEvent event) {
|
||||||
MinecraftProtocol protocol = (MinecraftProtocol) event.getSession().getPacketProtocol();
|
MinecraftProtocol protocol = (MinecraftProtocol) event.getSession().getPacketProtocol();
|
||||||
if(protocol.getMode() == ProtocolMode.LOGIN) {
|
if(protocol.getMode() == ProtocolMode.LOGIN) {
|
||||||
event.getSession().send(new LoginDisconnectPacket(event.getReason()));
|
event.getSession().send(new LoginDisconnectPacket(event.getReason()));
|
||||||
} else if(protocol.getMode() == ProtocolMode.GAME) {
|
} else if(protocol.getMode() == ProtocolMode.GAME) {
|
||||||
event.getSession().send(new ServerDisconnectPacket(event.getReason()));
|
event.getSession().send(new ServerDisconnectPacket(event.getReason()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class UserAuthThread extends Thread {
|
private class UserAuthThread extends Thread {
|
||||||
private Session session;
|
private Session session;
|
||||||
private SecretKey key;
|
private SecretKey key;
|
||||||
|
|
||||||
public UserAuthThread(Session session, SecretKey key) {
|
public UserAuthThread(Session session, SecretKey key) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.session = session;
|
this.session = session;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MinecraftProtocol protocol = (MinecraftProtocol) this.session.getPacketProtocol();
|
MinecraftProtocol protocol = (MinecraftProtocol) this.session.getPacketProtocol();
|
||||||
try {
|
try {
|
||||||
Proxy proxy = this.session.<Proxy>getFlag(ProtocolConstants.AUTH_PROXY_KEY);
|
Proxy proxy = this.session.<Proxy>getFlag(ProtocolConstants.AUTH_PROXY_KEY);
|
||||||
if(proxy == null) {
|
if(proxy == null) {
|
||||||
proxy = Proxy.NO_PROXY;
|
proxy = Proxy.NO_PROXY;
|
||||||
}
|
}
|
||||||
|
|
||||||
String serverHash = new BigInteger(CryptUtil.getServerIdHash(serverId, pair.getPublic(), this.key)).toString(16);
|
String serverHash = new BigInteger(CryptUtil.getServerIdHash(serverId, pair.getPublic(), this.key)).toString(16);
|
||||||
SessionService service = new SessionService(proxy);
|
SessionService service = new SessionService(proxy);
|
||||||
GameProfile profile = service.hasJoinedServer(new GameProfile((UUID) null, username), serverHash);
|
GameProfile profile = service.hasJoinedServer(new GameProfile((UUID) null, username), serverHash);
|
||||||
if(profile != null) {
|
if(profile != null) {
|
||||||
int threshold = this.session.getFlag(ProtocolConstants.SERVER_COMPRESSION_THRESHOLD);
|
int threshold = this.session.getFlag(ProtocolConstants.SERVER_COMPRESSION_THRESHOLD);
|
||||||
this.session.send(new LoginSetCompressionPacket(threshold));
|
this.session.send(new LoginSetCompressionPacket(threshold));
|
||||||
this.session.setCompressionThreshold(threshold);
|
this.session.setCompressionThreshold(threshold);
|
||||||
this.session.send(new LoginSuccessPacket(profile));
|
this.session.send(new LoginSuccessPacket(profile));
|
||||||
this.session.setFlag(ProtocolConstants.PROFILE_KEY, profile);
|
this.session.setFlag(ProtocolConstants.PROFILE_KEY, profile);
|
||||||
protocol.setMode(ProtocolMode.GAME, false, this.session);
|
protocol.setMode(ProtocolMode.GAME, false, this.session);
|
||||||
ServerLoginHandler handler = this.session.getFlag(ProtocolConstants.SERVER_LOGIN_HANDLER_KEY);
|
ServerLoginHandler handler = this.session.getFlag(ProtocolConstants.SERVER_LOGIN_HANDLER_KEY);
|
||||||
if(handler != null) {
|
if(handler != null) {
|
||||||
handler.loggedIn(this.session);
|
handler.loggedIn(this.session);
|
||||||
}
|
}
|
||||||
|
|
||||||
new Thread(new KeepAlive(this.session)).start();
|
new Thread(new KeepAlive(this.session)).start();
|
||||||
} else {
|
} else {
|
||||||
this.session.disconnect("Failed to verify username!");
|
this.session.disconnect("Failed to verify username!");
|
||||||
}
|
}
|
||||||
} catch(AuthenticationUnavailableException e) {
|
} catch(AuthenticationUnavailableException e) {
|
||||||
this.session.disconnect("Authentication servers are down. Please try again later, sorry!");
|
this.session.disconnect("Authentication servers are down. Please try again later, sorry!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class KeepAlive implements Runnable {
|
private class KeepAlive implements Runnable {
|
||||||
private Session session;
|
private Session session;
|
||||||
|
|
||||||
public KeepAlive(Session session) {
|
public KeepAlive(Session session) {
|
||||||
this.session = session;
|
this.session = session;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
while(this.session.isConnected()) {
|
while(this.session.isConnected()) {
|
||||||
lastPingTime = System.currentTimeMillis();
|
lastPingTime = System.currentTimeMillis();
|
||||||
lastPingId = (int) lastPingTime;
|
lastPingId = (int) lastPingTime;
|
||||||
this.session.send(new ServerKeepAlivePacket(lastPingId));
|
this.session.send(new ServerKeepAlivePacket(lastPingId));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
} catch(InterruptedException e) {
|
} catch(InterruptedException e) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,6 @@ import org.spacehq.packetlib.Session;
|
||||||
|
|
||||||
public interface ServerLoginHandler {
|
public interface ServerLoginHandler {
|
||||||
|
|
||||||
public void loggedIn(Session session);
|
public void loggedIn(Session session);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,62 +2,62 @@ package org.spacehq.mc.protocol.data.game;
|
||||||
|
|
||||||
public class Chunk {
|
public class Chunk {
|
||||||
|
|
||||||
private ShortArray3d blocks;
|
private ShortArray3d blocks;
|
||||||
private NibbleArray3d blocklight;
|
private NibbleArray3d blocklight;
|
||||||
private NibbleArray3d skylight;
|
private NibbleArray3d skylight;
|
||||||
|
|
||||||
public Chunk(boolean skylight) {
|
public Chunk(boolean skylight) {
|
||||||
this(new ShortArray3d(4096), new NibbleArray3d(4096), skylight ? new NibbleArray3d(4096) : null);
|
this(new ShortArray3d(4096), new NibbleArray3d(4096), skylight ? new NibbleArray3d(4096) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Chunk(ShortArray3d blocks, NibbleArray3d blocklight, NibbleArray3d skylight) {
|
public Chunk(ShortArray3d blocks, NibbleArray3d blocklight, NibbleArray3d skylight) {
|
||||||
this.blocks = blocks;
|
this.blocks = blocks;
|
||||||
this.blocklight = blocklight;
|
this.blocklight = blocklight;
|
||||||
this.skylight = skylight;
|
this.skylight = skylight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShortArray3d getBlocks() {
|
public ShortArray3d getBlocks() {
|
||||||
return this.blocks;
|
return this.blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NibbleArray3d getBlockLight() {
|
public NibbleArray3d getBlockLight() {
|
||||||
return this.blocklight;
|
return this.blocklight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NibbleArray3d getSkyLight() {
|
public NibbleArray3d getSkyLight() {
|
||||||
return this.skylight;
|
return this.skylight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEmpty() {
|
public boolean isEmpty() {
|
||||||
for(short block : this.blocks.getData()) {
|
for(short block : this.blocks.getData()) {
|
||||||
if(block != 0) {
|
if(block != 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
Chunk chunk = (Chunk) o;
|
Chunk chunk = (Chunk) o;
|
||||||
|
|
||||||
if (!blocklight.equals(chunk.blocklight)) return false;
|
if(!blocklight.equals(chunk.blocklight)) return false;
|
||||||
if (!blocks.equals(chunk.blocks)) return false;
|
if(!blocks.equals(chunk.blocks)) return false;
|
||||||
if (skylight != null ? !skylight.equals(chunk.skylight) : chunk.skylight != null) return false;
|
if(skylight != null ? !skylight.equals(chunk.skylight) : chunk.skylight != null) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = blocks.hashCode();
|
int result = blocks.hashCode();
|
||||||
result = 31 * result + blocklight.hashCode();
|
result = 31 * result + blocklight.hashCode();
|
||||||
result = 31 * result + (skylight != null ? skylight.hashCode() : 0);
|
result = 31 * result + (skylight != null ? skylight.hashCode() : 0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,48 +4,48 @@ import org.spacehq.mc.protocol.data.game.values.entity.MetadataType;
|
||||||
|
|
||||||
public class EntityMetadata {
|
public class EntityMetadata {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
private MetadataType type;
|
private MetadataType type;
|
||||||
private Object value;
|
private Object value;
|
||||||
|
|
||||||
public EntityMetadata(int id, MetadataType type, Object value) {
|
public EntityMetadata(int id, MetadataType type, Object value) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MetadataType getType() {
|
public MetadataType getType() {
|
||||||
return this.type;
|
return this.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getValue() {
|
public Object getValue() {
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
EntityMetadata metadata = (EntityMetadata) o;
|
EntityMetadata metadata = (EntityMetadata) o;
|
||||||
|
|
||||||
if (id != metadata.id) return false;
|
if(id != metadata.id) return false;
|
||||||
if (type != metadata.type) return false;
|
if(type != metadata.type) return false;
|
||||||
if (!value.equals(metadata.value)) return false;
|
if(!value.equals(metadata.value)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = id;
|
int result = id;
|
||||||
result = 31 * result + type.hashCode();
|
result = 31 * result + type.hashCode();
|
||||||
result = 31 * result + value.hashCode();
|
result = 31 * result + value.hashCode();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,68 +4,68 @@ import org.spacehq.opennbt.tag.builtin.CompoundTag;
|
||||||
|
|
||||||
public class ItemStack {
|
public class ItemStack {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
private int amount;
|
private int amount;
|
||||||
private int data;
|
private int data;
|
||||||
private CompoundTag nbt;
|
private CompoundTag nbt;
|
||||||
|
|
||||||
public ItemStack(int id) {
|
public ItemStack(int id) {
|
||||||
this(id, 1);
|
this(id, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack(int id, int amount) {
|
public ItemStack(int id, int amount) {
|
||||||
this(id, amount, 0);
|
this(id, amount, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack(int id, int amount, int data) {
|
public ItemStack(int id, int amount, int data) {
|
||||||
this(id, amount, data, null);
|
this(id, amount, data, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack(int id, int amount, int data, CompoundTag nbt) {
|
public ItemStack(int id, int amount, int data, CompoundTag nbt) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
this.data = data;
|
this.data = data;
|
||||||
this.nbt = nbt;
|
this.nbt = nbt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAmount() {
|
public int getAmount() {
|
||||||
return this.amount;
|
return this.amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getData() {
|
public int getData() {
|
||||||
return this.data;
|
return this.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompoundTag getNBT() {
|
public CompoundTag getNBT() {
|
||||||
return this.nbt;
|
return this.nbt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
ItemStack itemStack = (ItemStack) o;
|
ItemStack itemStack = (ItemStack) o;
|
||||||
|
|
||||||
if (amount != itemStack.amount) return false;
|
if(amount != itemStack.amount) return false;
|
||||||
if (data != itemStack.data) return false;
|
if(data != itemStack.data) return false;
|
||||||
if (id != itemStack.id) return false;
|
if(id != itemStack.id) return false;
|
||||||
if (nbt != null ? !nbt.equals(itemStack.nbt) : itemStack.nbt != null) return false;
|
if(nbt != null ? !nbt.equals(itemStack.nbt) : itemStack.nbt != null) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = id;
|
int result = id;
|
||||||
result = 31 * result + amount;
|
result = 31 * result + amount;
|
||||||
result = 31 * result + data;
|
result = 31 * result + data;
|
||||||
result = 31 * result + (nbt != null ? nbt.hashCode() : 0);
|
result = 31 * result + (nbt != null ? nbt.hashCode() : 0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,65 +4,65 @@ import java.util.Arrays;
|
||||||
|
|
||||||
public class NibbleArray3d {
|
public class NibbleArray3d {
|
||||||
|
|
||||||
private byte[] data;
|
private byte[] data;
|
||||||
|
|
||||||
public NibbleArray3d(int size) {
|
public NibbleArray3d(int size) {
|
||||||
this.data = new byte[size >> 1];
|
this.data = new byte[size >> 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
public NibbleArray3d(byte[] array) {
|
public NibbleArray3d(byte[] array) {
|
||||||
this.data = array;
|
this.data = array;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getData() {
|
public byte[] getData() {
|
||||||
return this.data;
|
return this.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int get(int x, int y, int z) {
|
public int get(int x, int y, int z) {
|
||||||
int key = y << 8 | z << 4 | x;
|
int key = y << 8 | z << 4 | x;
|
||||||
int index = key >> 1;
|
int index = key >> 1;
|
||||||
int part = key & 1;
|
int part = key & 1;
|
||||||
return part == 0 ? this.data[index] & 15 : this.data[index] >> 4 & 15;
|
return part == 0 ? this.data[index] & 15 : this.data[index] >> 4 & 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set(int x, int y, int z, int val) {
|
public void set(int x, int y, int z, int val) {
|
||||||
int key = y << 8 | z << 4 | x;
|
int key = y << 8 | z << 4 | x;
|
||||||
int index = key >> 1;
|
int index = key >> 1;
|
||||||
int part = key & 1;
|
int part = key & 1;
|
||||||
if(part == 0) {
|
if(part == 0) {
|
||||||
this.data[index] = (byte) (this.data[index] & 240 | val & 15);
|
this.data[index] = (byte) (this.data[index] & 240 | val & 15);
|
||||||
} else {
|
} else {
|
||||||
this.data[index] = (byte) (this.data[index] & 15 | (val & 15) << 4);
|
this.data[index] = (byte) (this.data[index] & 15 | (val & 15) << 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fill(int val) {
|
public void fill(int val) {
|
||||||
for(int index = 0; index < this.data.length << 1; index++) {
|
for(int index = 0; index < this.data.length << 1; index++) {
|
||||||
int ind = index >> 1;
|
int ind = index >> 1;
|
||||||
int part = index & 1;
|
int part = index & 1;
|
||||||
if(part == 0) {
|
if(part == 0) {
|
||||||
this.data[ind] = (byte) (this.data[ind] & 240 | val & 15);
|
this.data[ind] = (byte) (this.data[ind] & 240 | val & 15);
|
||||||
} else {
|
} else {
|
||||||
this.data[ind] = (byte) (this.data[ind] & 15 | (val & 15) << 4);
|
this.data[ind] = (byte) (this.data[ind] & 15 | (val & 15) << 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
NibbleArray3d that = (NibbleArray3d) o;
|
NibbleArray3d that = (NibbleArray3d) o;
|
||||||
|
|
||||||
if (!Arrays.equals(data, that.data)) return false;
|
if(!Arrays.equals(data, that.data)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Arrays.hashCode(data);
|
return Arrays.hashCode(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,48 +2,48 @@ package org.spacehq.mc.protocol.data.game;
|
||||||
|
|
||||||
public class Position {
|
public class Position {
|
||||||
|
|
||||||
private int x;
|
private int x;
|
||||||
private int y;
|
private int y;
|
||||||
private int z;
|
private int z;
|
||||||
|
|
||||||
public Position(int x, int y, int z) {
|
public Position(int x, int y, int z) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.z = z;
|
this.z = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getX() {
|
public int getX() {
|
||||||
return this.x;
|
return this.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getY() {
|
public int getY() {
|
||||||
return this.y;
|
return this.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getZ() {
|
public int getZ() {
|
||||||
return this.z;
|
return this.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
Position position = (Position) o;
|
Position position = (Position) o;
|
||||||
|
|
||||||
if (x != position.x) return false;
|
if(x != position.x) return false;
|
||||||
if (y != position.y) return false;
|
if(y != position.y) return false;
|
||||||
if (z != position.z) return false;
|
if(z != position.z) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = x;
|
int result = x;
|
||||||
result = 31 * result + y;
|
result = 31 * result + y;
|
||||||
result = 31 * result + z;
|
result = 31 * result + z;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,52 +1,52 @@
|
||||||
package org.spacehq.mc.protocol.data.game;
|
package org.spacehq.mc.protocol.data.game;
|
||||||
|
|
||||||
public class Rotation {
|
public class Rotation {
|
||||||
private float pitch;
|
private float pitch;
|
||||||
private float yaw;
|
private float yaw;
|
||||||
private float roll;
|
private float roll;
|
||||||
|
|
||||||
public Rotation() {
|
public Rotation() {
|
||||||
this(0, 0, 0);
|
this(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Rotation(float pitch, float yaw, float roll) {
|
public Rotation(float pitch, float yaw, float roll) {
|
||||||
this.pitch = pitch;
|
this.pitch = pitch;
|
||||||
this.yaw = yaw;
|
this.yaw = yaw;
|
||||||
this.roll = roll;
|
this.roll = roll;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getPitch() {
|
public float getPitch() {
|
||||||
return this.pitch;
|
return this.pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getYaw() {
|
public float getYaw() {
|
||||||
return this.yaw;
|
return this.yaw;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getRoll() {
|
public float getRoll() {
|
||||||
return this.roll;
|
return this.roll;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
Rotation rotation = (Rotation) o;
|
Rotation rotation = (Rotation) o;
|
||||||
|
|
||||||
if (Float.compare(rotation.pitch, pitch) != 0) return false;
|
if(Float.compare(rotation.pitch, pitch) != 0) return false;
|
||||||
if (Float.compare(rotation.roll, roll) != 0) return false;
|
if(Float.compare(rotation.roll, roll) != 0) return false;
|
||||||
if (Float.compare(rotation.yaw, yaw) != 0) return false;
|
if(Float.compare(rotation.yaw, yaw) != 0) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = (pitch != +0.0f ? Float.floatToIntBits(pitch) : 0);
|
int result = (pitch != +0.0f ? Float.floatToIntBits(pitch) : 0);
|
||||||
result = 31 * result + (yaw != +0.0f ? Float.floatToIntBits(yaw) : 0);
|
result = 31 * result + (yaw != +0.0f ? Float.floatToIntBits(yaw) : 0);
|
||||||
result = 31 * result + (roll != +0.0f ? Float.floatToIntBits(roll) : 0);
|
result = 31 * result + (roll != +0.0f ? Float.floatToIntBits(roll) : 0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,67 +4,67 @@ import java.util.Arrays;
|
||||||
|
|
||||||
public class ShortArray3d {
|
public class ShortArray3d {
|
||||||
|
|
||||||
private short[] data;
|
private short[] data;
|
||||||
|
|
||||||
public ShortArray3d(int size) {
|
public ShortArray3d(int size) {
|
||||||
this.data = new short[size];
|
this.data = new short[size];
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShortArray3d(short[] array) {
|
public ShortArray3d(short[] array) {
|
||||||
this.data = array;
|
this.data = array;
|
||||||
}
|
}
|
||||||
|
|
||||||
public short[] getData() {
|
public short[] getData() {
|
||||||
return this.data;
|
return this.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int get(int x, int y, int z) {
|
public int get(int x, int y, int z) {
|
||||||
return this.data[y << 8 | z << 4 | x] & 0xFFFF;
|
return this.data[y << 8 | z << 4 | x] & 0xFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set(int x, int y, int z, int val) {
|
public void set(int x, int y, int z, int val) {
|
||||||
this.data[y << 8 | z << 4 | x] = (short) val;
|
this.data[y << 8 | z << 4 | x] = (short) val;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBlock(int x, int y, int z) {
|
public int getBlock(int x, int y, int z) {
|
||||||
return this.get(x, y, z) >> 4;
|
return this.get(x, y, z) >> 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlock(int x, int y, int z, int block) {
|
public void setBlock(int x, int y, int z, int block) {
|
||||||
this.set(x, y, z, block << 4 | this.getData(x, y, z));
|
this.set(x, y, z, block << 4 | this.getData(x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getData(int x, int y, int z) {
|
public int getData(int x, int y, int z) {
|
||||||
return this.get(x, y, z) & 0xF;
|
return this.get(x, y, z) & 0xF;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setData(int x, int y, int z, int data) {
|
public void setData(int x, int y, int z, int data) {
|
||||||
this.set(x, y, z, this.getBlock(x, y, z) << 4 | data);
|
this.set(x, y, z, this.getBlock(x, y, z) << 4 | data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlockAndData(int x, int y, int z, int block, int data) {
|
public void setBlockAndData(int x, int y, int z, int block, int data) {
|
||||||
this.set(x, y, z, block << 4 | data);
|
this.set(x, y, z, block << 4 | data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fill(int val) {
|
public void fill(int val) {
|
||||||
Arrays.fill(this.data, (short) val);
|
Arrays.fill(this.data, (short) val);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
ShortArray3d that = (ShortArray3d) o;
|
ShortArray3d that = (ShortArray3d) o;
|
||||||
|
|
||||||
if (!Arrays.equals(data, that.data)) return false;
|
if(!Arrays.equals(data, that.data)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Arrays.hashCode(data);
|
return Arrays.hashCode(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,57 +7,57 @@ import java.util.List;
|
||||||
|
|
||||||
public class Attribute {
|
public class Attribute {
|
||||||
|
|
||||||
private AttributeType type;
|
private AttributeType type;
|
||||||
private double value;
|
private double value;
|
||||||
private List<AttributeModifier> modifiers;
|
private List<AttributeModifier> modifiers;
|
||||||
|
|
||||||
public Attribute(AttributeType type) {
|
public Attribute(AttributeType type) {
|
||||||
this(type, type.getDefault());
|
this(type, type.getDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Attribute(AttributeType type, double value) {
|
public Attribute(AttributeType type, double value) {
|
||||||
this(type, value, new ArrayList<AttributeModifier>());
|
this(type, value, new ArrayList<AttributeModifier>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Attribute(AttributeType type, double value, List<AttributeModifier> modifiers) {
|
public Attribute(AttributeType type, double value, List<AttributeModifier> modifiers) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.modifiers = modifiers;
|
this.modifiers = modifiers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AttributeType getType() {
|
public AttributeType getType() {
|
||||||
return this.type;
|
return this.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getValue() {
|
public double getValue() {
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AttributeModifier> getModifiers() {
|
public List<AttributeModifier> getModifiers() {
|
||||||
return new ArrayList<AttributeModifier>(this.modifiers);
|
return new ArrayList<AttributeModifier>(this.modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
Attribute attribute = (Attribute) o;
|
Attribute attribute = (Attribute) o;
|
||||||
|
|
||||||
if (Double.compare(attribute.value, value) != 0) return false;
|
if(Double.compare(attribute.value, value) != 0) return false;
|
||||||
if (!modifiers.equals(attribute.modifiers)) return false;
|
if(!modifiers.equals(attribute.modifiers)) return false;
|
||||||
if (type != attribute.type) return false;
|
if(type != attribute.type) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = type.hashCode();
|
int result = type.hashCode();
|
||||||
long temp = Double.doubleToLongBits(value);
|
long temp = Double.doubleToLongBits(value);
|
||||||
result = 31 * result + (int) (temp ^ (temp >>> 32));
|
result = 31 * result + (int) (temp ^ (temp >>> 32));
|
||||||
result = 31 * result + modifiers.hashCode();
|
result = 31 * result + modifiers.hashCode();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,62 +8,62 @@ import java.util.UUID;
|
||||||
|
|
||||||
public class AttributeModifier {
|
public class AttributeModifier {
|
||||||
|
|
||||||
private ModifierType type;
|
private ModifierType type;
|
||||||
private UUID uuid;
|
private UUID uuid;
|
||||||
private double amount;
|
private double amount;
|
||||||
private ModifierOperation operation;
|
private ModifierOperation operation;
|
||||||
|
|
||||||
public AttributeModifier(ModifierType type, double amount, ModifierOperation operation) {
|
public AttributeModifier(ModifierType type, double amount, ModifierOperation operation) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.uuid = MagicValues.value(UUID.class, type);
|
this.uuid = MagicValues.value(UUID.class, type);
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
this.operation = operation;
|
this.operation = operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AttributeModifier(UUID uuid, double amount, ModifierOperation operation) {
|
public AttributeModifier(UUID uuid, double amount, ModifierOperation operation) {
|
||||||
this.type = MagicValues.key(ModifierType.class, uuid);
|
this.type = MagicValues.key(ModifierType.class, uuid);
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
this.operation = operation;
|
this.operation = operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModifierType getType() {
|
public ModifierType getType() {
|
||||||
return this.type;
|
return this.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getUUID() {
|
public UUID getUUID() {
|
||||||
return this.uuid;
|
return this.uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getAmount() {
|
public double getAmount() {
|
||||||
return this.amount;
|
return this.amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModifierOperation getOperation() {
|
public ModifierOperation getOperation() {
|
||||||
return this.operation;
|
return this.operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
AttributeModifier that = (AttributeModifier) o;
|
AttributeModifier that = (AttributeModifier) o;
|
||||||
|
|
||||||
if (Double.compare(that.amount, amount) != 0) return false;
|
if(Double.compare(that.amount, amount) != 0) return false;
|
||||||
if (operation != that.operation) return false;
|
if(operation != that.operation) return false;
|
||||||
if (type != that.type) return false;
|
if(type != that.type) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = type.hashCode();
|
int result = type.hashCode();
|
||||||
long temp = Double.doubleToLongBits(amount);
|
long temp = Double.doubleToLongBits(amount);
|
||||||
result = 31 * result + (int) (temp ^ (temp >>> 32));
|
result = 31 * result + (int) (temp ^ (temp >>> 32));
|
||||||
result = 31 * result + operation.hashCode();
|
result = 31 * result + operation.hashCode();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ package org.spacehq.mc.protocol.data.game.values;
|
||||||
|
|
||||||
public enum ClientRequest {
|
public enum ClientRequest {
|
||||||
|
|
||||||
RESPAWN,
|
RESPAWN,
|
||||||
STATS,
|
STATS,
|
||||||
OPEN_INVENTORY_ACHIEVEMENT;
|
OPEN_INVENTORY_ACHIEVEMENT;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,12 @@ package org.spacehq.mc.protocol.data.game.values;
|
||||||
|
|
||||||
public enum Face {
|
public enum Face {
|
||||||
|
|
||||||
BOTTOM,
|
BOTTOM,
|
||||||
TOP,
|
TOP,
|
||||||
EAST,
|
EAST,
|
||||||
WEST,
|
WEST,
|
||||||
NORTH,
|
NORTH,
|
||||||
SOUTH,
|
SOUTH,
|
||||||
INVALID;
|
INVALID;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package org.spacehq.mc.protocol.data.game.values;
|
||||||
|
|
||||||
public enum HandshakeIntent {
|
public enum HandshakeIntent {
|
||||||
|
|
||||||
STATUS,
|
STATUS,
|
||||||
LOGIN;
|
LOGIN;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2,8 +2,8 @@ package org.spacehq.mc.protocol.data.game.values;
|
||||||
|
|
||||||
public enum MessageType {
|
public enum MessageType {
|
||||||
|
|
||||||
CHAT,
|
CHAT,
|
||||||
SYSTEM,
|
SYSTEM,
|
||||||
NOTIFICATION;
|
NOTIFICATION;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,76 +5,76 @@ import org.spacehq.mc.protocol.data.game.values.entity.player.GameMode;
|
||||||
import org.spacehq.mc.protocol.data.message.Message;
|
import org.spacehq.mc.protocol.data.message.Message;
|
||||||
|
|
||||||
public class PlayerListEntry {
|
public class PlayerListEntry {
|
||||||
private GameProfile profile;
|
private GameProfile profile;
|
||||||
|
|
||||||
private GameMode gameMode;
|
private GameMode gameMode;
|
||||||
private int ping;
|
private int ping;
|
||||||
private Message displayName;
|
private Message displayName;
|
||||||
|
|
||||||
public PlayerListEntry(GameProfile profile, GameMode gameMode, int ping, Message displayName) {
|
public PlayerListEntry(GameProfile profile, GameMode gameMode, int ping, Message displayName) {
|
||||||
this.profile = profile;
|
this.profile = profile;
|
||||||
this.gameMode = gameMode;
|
this.gameMode = gameMode;
|
||||||
this.ping = ping;
|
this.ping = ping;
|
||||||
this.displayName = displayName;
|
this.displayName = displayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerListEntry(GameProfile profile, GameMode gameMode) {
|
public PlayerListEntry(GameProfile profile, GameMode gameMode) {
|
||||||
this.profile = profile;
|
this.profile = profile;
|
||||||
this.gameMode = gameMode;
|
this.gameMode = gameMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerListEntry(GameProfile profile, int ping) {
|
public PlayerListEntry(GameProfile profile, int ping) {
|
||||||
this.profile = profile;
|
this.profile = profile;
|
||||||
this.ping = ping;
|
this.ping = ping;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerListEntry(GameProfile profile, Message displayName) {
|
public PlayerListEntry(GameProfile profile, Message displayName) {
|
||||||
this.profile = profile;
|
this.profile = profile;
|
||||||
this.displayName = displayName;
|
this.displayName = displayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerListEntry(GameProfile profile) {
|
public PlayerListEntry(GameProfile profile) {
|
||||||
this.profile = profile;
|
this.profile = profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameProfile getProfile() {
|
public GameProfile getProfile() {
|
||||||
return this.profile;
|
return this.profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameMode getGameMode() {
|
public GameMode getGameMode() {
|
||||||
return this.gameMode;
|
return this.gameMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPing() {
|
public int getPing() {
|
||||||
return this.ping;
|
return this.ping;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Message getDisplayName() {
|
public Message getDisplayName() {
|
||||||
return this.displayName;
|
return this.displayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
PlayerListEntry entry = (PlayerListEntry) o;
|
PlayerListEntry entry = (PlayerListEntry) o;
|
||||||
|
|
||||||
if (ping != entry.ping) return false;
|
if(ping != entry.ping) return false;
|
||||||
if (displayName != null ? !displayName.equals(entry.displayName) : entry.displayName != null) return false;
|
if(displayName != null ? !displayName.equals(entry.displayName) : entry.displayName != null) return false;
|
||||||
if (gameMode != entry.gameMode) return false;
|
if(gameMode != entry.gameMode) return false;
|
||||||
if (!profile.equals(entry.profile)) return false;
|
if(!profile.equals(entry.profile)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = profile.hashCode();
|
int result = profile.hashCode();
|
||||||
result = 31 * result + (gameMode != null ? gameMode.hashCode() : 0);
|
result = 31 * result + (gameMode != null ? gameMode.hashCode() : 0);
|
||||||
result = 31 * result + ping;
|
result = 31 * result + ping;
|
||||||
result = 31 * result + (displayName != null ? displayName.hashCode() : 0);
|
result = 31 * result + (displayName != null ? displayName.hashCode() : 0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package org.spacehq.mc.protocol.data.game.values;
|
package org.spacehq.mc.protocol.data.game.values;
|
||||||
|
|
||||||
public enum PlayerListEntryAction {
|
public enum PlayerListEntryAction {
|
||||||
ADD_PLAYER,
|
ADD_PLAYER,
|
||||||
UPDATE_GAMEMODE,
|
UPDATE_GAMEMODE,
|
||||||
UPDATE_LATENCY,
|
UPDATE_LATENCY,
|
||||||
UPDATE_DISPLAY_NAME,
|
UPDATE_DISPLAY_NAME,
|
||||||
REMOVE_PLAYER;
|
REMOVE_PLAYER;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package org.spacehq.mc.protocol.data.game.values;
|
package org.spacehq.mc.protocol.data.game.values;
|
||||||
|
|
||||||
public enum ResourcePackStatus {
|
public enum ResourcePackStatus {
|
||||||
SUCCESSFULLY_LOADED,
|
SUCCESSFULLY_LOADED,
|
||||||
DECLINED,
|
DECLINED,
|
||||||
FAILED_DOWNLOAD,
|
FAILED_DOWNLOAD,
|
||||||
ACCEPTED;
|
ACCEPTED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package org.spacehq.mc.protocol.data.game.values;
|
package org.spacehq.mc.protocol.data.game.values;
|
||||||
|
|
||||||
public enum TitleAction {
|
public enum TitleAction {
|
||||||
TITLE,
|
TITLE,
|
||||||
SUBTITLE,
|
SUBTITLE,
|
||||||
TIMES,
|
TIMES,
|
||||||
CLEAR,
|
CLEAR,
|
||||||
RESET;
|
RESET;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,31 +2,31 @@ package org.spacehq.mc.protocol.data.game.values.entity;
|
||||||
|
|
||||||
public enum Art {
|
public enum Art {
|
||||||
|
|
||||||
KEBAB,
|
KEBAB,
|
||||||
AZTEC,
|
AZTEC,
|
||||||
ALBAN,
|
ALBAN,
|
||||||
AZTEC2,
|
AZTEC2,
|
||||||
BOMB,
|
BOMB,
|
||||||
PLANT,
|
PLANT,
|
||||||
WASTELAND,
|
WASTELAND,
|
||||||
POOL,
|
POOL,
|
||||||
COURBET,
|
COURBET,
|
||||||
SEA,
|
SEA,
|
||||||
SUNSET,
|
SUNSET,
|
||||||
CREEBET,
|
CREEBET,
|
||||||
WANDERER,
|
WANDERER,
|
||||||
GRAHAM,
|
GRAHAM,
|
||||||
MATCH,
|
MATCH,
|
||||||
BUST,
|
BUST,
|
||||||
STAGE,
|
STAGE,
|
||||||
VOID,
|
VOID,
|
||||||
SKULL_AND_ROSES,
|
SKULL_AND_ROSES,
|
||||||
WITHER,
|
WITHER,
|
||||||
FIGHTERS,
|
FIGHTERS,
|
||||||
POINTER,
|
POINTER,
|
||||||
PIG_SCENE,
|
PIG_SCENE,
|
||||||
BURNING_SKULL,
|
BURNING_SKULL,
|
||||||
SKELETON,
|
SKELETON,
|
||||||
DONKEY_KONG;
|
DONKEY_KONG;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,34 +2,34 @@ package org.spacehq.mc.protocol.data.game.values.entity;
|
||||||
|
|
||||||
public enum AttributeType {
|
public enum AttributeType {
|
||||||
|
|
||||||
MAX_HEALTH(20, 0, Double.MAX_VALUE),
|
MAX_HEALTH(20, 0, Double.MAX_VALUE),
|
||||||
FOLLOW_RANGE(32, 0, 2048),
|
FOLLOW_RANGE(32, 0, 2048),
|
||||||
KNOCKBACK_RESISTANCE(0, 0, 1),
|
KNOCKBACK_RESISTANCE(0, 0, 1),
|
||||||
MOVEMENT_SPEED(0.699999988079071, 0, Double.MAX_VALUE),
|
MOVEMENT_SPEED(0.699999988079071, 0, Double.MAX_VALUE),
|
||||||
ATTACK_DAMAGE(2, 0, Double.MAX_VALUE),
|
ATTACK_DAMAGE(2, 0, Double.MAX_VALUE),
|
||||||
HORSE_JUMP_STRENGTH(0.7, 0, 2),
|
HORSE_JUMP_STRENGTH(0.7, 0, 2),
|
||||||
ZOMBIE_SPAWN_REINFORCEMENTS_CHANCE(0, 0, 1);
|
ZOMBIE_SPAWN_REINFORCEMENTS_CHANCE(0, 0, 1);
|
||||||
|
|
||||||
private double def;
|
private double def;
|
||||||
private double min;
|
private double min;
|
||||||
private double max;
|
private double max;
|
||||||
|
|
||||||
private AttributeType(double def, double min, double max) {
|
private AttributeType(double def, double min, double max) {
|
||||||
this.def = def;
|
this.def = def;
|
||||||
this.min = min;
|
this.min = min;
|
||||||
this.max = max;
|
this.max = max;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getDefault() {
|
public double getDefault() {
|
||||||
return this.def;
|
return this.def;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getMin() {
|
public double getMin() {
|
||||||
return this.min;
|
return this.min;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getMax() {
|
public double getMax() {
|
||||||
return this.max;
|
return this.max;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,28 +2,28 @@ package org.spacehq.mc.protocol.data.game.values.entity;
|
||||||
|
|
||||||
public enum Effect {
|
public enum Effect {
|
||||||
|
|
||||||
SPEED,
|
SPEED,
|
||||||
SLOWNESS,
|
SLOWNESS,
|
||||||
DIG_SPEED,
|
DIG_SPEED,
|
||||||
DIG_SLOWNESS,
|
DIG_SLOWNESS,
|
||||||
DAMAGE_BOOST,
|
DAMAGE_BOOST,
|
||||||
HEAL,
|
HEAL,
|
||||||
DAMAGE,
|
DAMAGE,
|
||||||
JUMP_BOOST,
|
JUMP_BOOST,
|
||||||
CONFUSION,
|
CONFUSION,
|
||||||
REGENERATION,
|
REGENERATION,
|
||||||
RESISTANCE,
|
RESISTANCE,
|
||||||
FIRE_RESISTANCE,
|
FIRE_RESISTANCE,
|
||||||
WATER_BREATHING,
|
WATER_BREATHING,
|
||||||
INVISIBILITY,
|
INVISIBILITY,
|
||||||
BLINDNESS,
|
BLINDNESS,
|
||||||
NIGHT_VISION,
|
NIGHT_VISION,
|
||||||
HUNGER,
|
HUNGER,
|
||||||
WEAKNESS,
|
WEAKNESS,
|
||||||
POISON,
|
POISON,
|
||||||
WITHER_EFFECT,
|
WITHER_EFFECT,
|
||||||
HEALTH_BOOST,
|
HEALTH_BOOST,
|
||||||
ABSORPTION,
|
ABSORPTION,
|
||||||
SATURATION;
|
SATURATION;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,27 +2,27 @@ package org.spacehq.mc.protocol.data.game.values.entity;
|
||||||
|
|
||||||
public enum EntityStatus {
|
public enum EntityStatus {
|
||||||
|
|
||||||
HURT_OR_MINECART_SPAWNER_DELAY_RESET,
|
HURT_OR_MINECART_SPAWNER_DELAY_RESET,
|
||||||
LIVING_HURT,
|
LIVING_HURT,
|
||||||
DEAD,
|
DEAD,
|
||||||
IRON_GOLEM_THROW,
|
IRON_GOLEM_THROW,
|
||||||
TAMING,
|
TAMING,
|
||||||
TAMED,
|
TAMED,
|
||||||
WOLF_SHAKING,
|
WOLF_SHAKING,
|
||||||
FINISHED_EATING,
|
FINISHED_EATING,
|
||||||
SHEEP_GRAZING_OR_TNT_CART_EXPLODING,
|
SHEEP_GRAZING_OR_TNT_CART_EXPLODING,
|
||||||
IRON_GOLEM_ROSE,
|
IRON_GOLEM_ROSE,
|
||||||
VILLAGER_HEARTS,
|
VILLAGER_HEARTS,
|
||||||
VILLAGER_ANGRY,
|
VILLAGER_ANGRY,
|
||||||
VILLAGER_HAPPY,
|
VILLAGER_HAPPY,
|
||||||
WITCH_MAGIC_PARTICLES,
|
WITCH_MAGIC_PARTICLES,
|
||||||
ZOMBIE_VILLAGER_SHAKING,
|
ZOMBIE_VILLAGER_SHAKING,
|
||||||
FIREWORK_EXPLODING,
|
FIREWORK_EXPLODING,
|
||||||
ANIMAL_HEARTS,
|
ANIMAL_HEARTS,
|
||||||
RESET_SQUID_ROTATION,
|
RESET_SQUID_ROTATION,
|
||||||
EXPLOSION_PARTICLE,
|
EXPLOSION_PARTICLE,
|
||||||
GUARDIAN_SOUND,
|
GUARDIAN_SOUND,
|
||||||
ENABLE_REDUCED_DEBUG,
|
ENABLE_REDUCED_DEBUG,
|
||||||
DISABLE_REDUCED_DEBUG;
|
DISABLE_REDUCED_DEBUG;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,40 +2,40 @@ package org.spacehq.mc.protocol.data.game.values.entity;
|
||||||
|
|
||||||
public class FallingBlockData implements ObjectData {
|
public class FallingBlockData implements ObjectData {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
private int metadata;
|
private int metadata;
|
||||||
|
|
||||||
public FallingBlockData(int id, int metadata) {
|
public FallingBlockData(int id, int metadata) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.metadata = metadata;
|
this.metadata = metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMetadata() {
|
public int getMetadata() {
|
||||||
return this.metadata;
|
return this.metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
FallingBlockData that = (FallingBlockData) o;
|
FallingBlockData that = (FallingBlockData) o;
|
||||||
|
|
||||||
if (id != that.id) return false;
|
if(id != that.id) return false;
|
||||||
if (metadata != that.metadata) return false;
|
if(metadata != that.metadata) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = id;
|
int result = id;
|
||||||
result = 31 * result + metadata;
|
result = 31 * result + metadata;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,6 @@ package org.spacehq.mc.protocol.data.game.values.entity;
|
||||||
|
|
||||||
public enum GlobalEntityType {
|
public enum GlobalEntityType {
|
||||||
|
|
||||||
LIGHTNING_BOLT;
|
LIGHTNING_BOLT;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,9 @@ package org.spacehq.mc.protocol.data.game.values.entity;
|
||||||
|
|
||||||
public enum HangingDirection implements ObjectData {
|
public enum HangingDirection implements ObjectData {
|
||||||
|
|
||||||
SOUTH,
|
SOUTH,
|
||||||
WEST,
|
WEST,
|
||||||
NORTH,
|
NORTH,
|
||||||
EAST;
|
EAST;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,13 @@ package org.spacehq.mc.protocol.data.game.values.entity;
|
||||||
|
|
||||||
public enum MetadataType {
|
public enum MetadataType {
|
||||||
|
|
||||||
BYTE,
|
BYTE,
|
||||||
SHORT,
|
SHORT,
|
||||||
INT,
|
INT,
|
||||||
FLOAT,
|
FLOAT,
|
||||||
STRING,
|
STRING,
|
||||||
ITEM,
|
ITEM,
|
||||||
POSITION,
|
POSITION,
|
||||||
ROTATION;
|
ROTATION;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,12 @@ package org.spacehq.mc.protocol.data.game.values.entity;
|
||||||
|
|
||||||
public enum MinecartType implements ObjectData {
|
public enum MinecartType implements ObjectData {
|
||||||
|
|
||||||
NORMAL,
|
NORMAL,
|
||||||
CHEST,
|
CHEST,
|
||||||
POWERED,
|
POWERED,
|
||||||
TNT,
|
TNT,
|
||||||
MOB_SPAWNER,
|
MOB_SPAWNER,
|
||||||
HOPPER,
|
HOPPER,
|
||||||
COMMAND_BLOCK;
|
COMMAND_BLOCK;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,38 +2,38 @@ package org.spacehq.mc.protocol.data.game.values.entity;
|
||||||
|
|
||||||
public enum MobType {
|
public enum MobType {
|
||||||
|
|
||||||
ARMOR_STAND,
|
ARMOR_STAND,
|
||||||
CREEPER,
|
CREEPER,
|
||||||
SKELETON,
|
SKELETON,
|
||||||
SPIDER,
|
SPIDER,
|
||||||
GIANT_ZOMBIE,
|
GIANT_ZOMBIE,
|
||||||
ZOMBIE,
|
ZOMBIE,
|
||||||
SLIME,
|
SLIME,
|
||||||
GHAST,
|
GHAST,
|
||||||
ZOMBIE_PIGMAN,
|
ZOMBIE_PIGMAN,
|
||||||
ENDERMAN,
|
ENDERMAN,
|
||||||
CAVE_SPIDER,
|
CAVE_SPIDER,
|
||||||
SILVERFISH,
|
SILVERFISH,
|
||||||
BLAZE,
|
BLAZE,
|
||||||
MAGMA_CUBE,
|
MAGMA_CUBE,
|
||||||
ENDER_DRAGON,
|
ENDER_DRAGON,
|
||||||
WITHER,
|
WITHER,
|
||||||
BAT,
|
BAT,
|
||||||
WITCH,
|
WITCH,
|
||||||
ENDERMITE,
|
ENDERMITE,
|
||||||
GUARDIAN,
|
GUARDIAN,
|
||||||
PIG,
|
PIG,
|
||||||
SHEEP,
|
SHEEP,
|
||||||
COW,
|
COW,
|
||||||
CHICKEN,
|
CHICKEN,
|
||||||
SQUID,
|
SQUID,
|
||||||
WOLF,
|
WOLF,
|
||||||
MOOSHROOM,
|
MOOSHROOM,
|
||||||
SNOWMAN,
|
SNOWMAN,
|
||||||
OCELOT,
|
OCELOT,
|
||||||
IRON_GOLEM,
|
IRON_GOLEM,
|
||||||
HORSE,
|
HORSE,
|
||||||
RABBIT,
|
RABBIT,
|
||||||
VILLAGER;
|
VILLAGER;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ package org.spacehq.mc.protocol.data.game.values.entity;
|
||||||
|
|
||||||
public enum ModifierOperation {
|
public enum ModifierOperation {
|
||||||
|
|
||||||
ADD,
|
ADD,
|
||||||
ADD_MULTIPLIED,
|
ADD_MULTIPLIED,
|
||||||
MULTIPLY;
|
MULTIPLY;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,17 +2,17 @@ package org.spacehq.mc.protocol.data.game.values.entity;
|
||||||
|
|
||||||
public enum ModifierType {
|
public enum ModifierType {
|
||||||
|
|
||||||
CREATURE_FLEE_SPEED_BONUS,
|
CREATURE_FLEE_SPEED_BONUS,
|
||||||
ENDERMAN_ATTACK_SPEED_BOOST,
|
ENDERMAN_ATTACK_SPEED_BOOST,
|
||||||
SPRINT_SPEED_BOOST,
|
SPRINT_SPEED_BOOST,
|
||||||
PIGZOMBIE_ATTACK_SPEED_BOOST,
|
PIGZOMBIE_ATTACK_SPEED_BOOST,
|
||||||
WITCH_DRINKING_SPEED_PENALTY,
|
WITCH_DRINKING_SPEED_PENALTY,
|
||||||
ZOMBIE_BABY_SPEED_BOOST,
|
ZOMBIE_BABY_SPEED_BOOST,
|
||||||
ITEM_MODIFIER,
|
ITEM_MODIFIER,
|
||||||
SPEED_POTION_MODIFIER,
|
SPEED_POTION_MODIFIER,
|
||||||
HEALTH_BOOST_POTION_MODIFIER,
|
HEALTH_BOOST_POTION_MODIFIER,
|
||||||
SLOW_POTION_MODIFIER,
|
SLOW_POTION_MODIFIER,
|
||||||
STRENGTH_POTION_MODIFIER,
|
STRENGTH_POTION_MODIFIER,
|
||||||
WEAKNESS_POTION_MODIFIER;
|
WEAKNESS_POTION_MODIFIER;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,27 +2,27 @@ package org.spacehq.mc.protocol.data.game.values.entity;
|
||||||
|
|
||||||
public enum ObjectType {
|
public enum ObjectType {
|
||||||
|
|
||||||
BOAT,
|
BOAT,
|
||||||
ITEM,
|
ITEM,
|
||||||
MINECART,
|
MINECART,
|
||||||
PRIMED_TNT,
|
PRIMED_TNT,
|
||||||
ENDER_CRYSTAL,
|
ENDER_CRYSTAL,
|
||||||
ARROW,
|
ARROW,
|
||||||
SNOWBALL,
|
SNOWBALL,
|
||||||
EGG,
|
EGG,
|
||||||
GHAST_FIREBALL,
|
GHAST_FIREBALL,
|
||||||
BLAZE_FIREBALL,
|
BLAZE_FIREBALL,
|
||||||
ENDER_PEARL,
|
ENDER_PEARL,
|
||||||
WITHER_HEAD_PROJECTILE,
|
WITHER_HEAD_PROJECTILE,
|
||||||
FALLING_BLOCK,
|
FALLING_BLOCK,
|
||||||
ITEM_FRAME,
|
ITEM_FRAME,
|
||||||
EYE_OF_ENDER,
|
EYE_OF_ENDER,
|
||||||
POTION,
|
POTION,
|
||||||
FALLING_DRAGON_EGG,
|
FALLING_DRAGON_EGG,
|
||||||
EXP_BOTTLE,
|
EXP_BOTTLE,
|
||||||
FIREWORK_ROCKET,
|
FIREWORK_ROCKET,
|
||||||
LEASH_KNOT,
|
LEASH_KNOT,
|
||||||
ARMOR_STAND,
|
ARMOR_STAND,
|
||||||
FISH_HOOK;
|
FISH_HOOK;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,31 +2,31 @@ package org.spacehq.mc.protocol.data.game.values.entity;
|
||||||
|
|
||||||
public class ProjectileData implements ObjectData {
|
public class ProjectileData implements ObjectData {
|
||||||
|
|
||||||
private int ownerId;
|
private int ownerId;
|
||||||
|
|
||||||
public ProjectileData(int ownerId) {
|
public ProjectileData(int ownerId) {
|
||||||
this.ownerId = ownerId;
|
this.ownerId = ownerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getOwnerId() {
|
public int getOwnerId() {
|
||||||
return this.ownerId;
|
return this.ownerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
ProjectileData that = (ProjectileData) o;
|
ProjectileData that = (ProjectileData) o;
|
||||||
|
|
||||||
if (ownerId != that.ownerId) return false;
|
if(ownerId != that.ownerId) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return ownerId;
|
return ownerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,31 +2,31 @@ package org.spacehq.mc.protocol.data.game.values.entity;
|
||||||
|
|
||||||
public class SplashPotionData implements ObjectData {
|
public class SplashPotionData implements ObjectData {
|
||||||
|
|
||||||
private int potionData;
|
private int potionData;
|
||||||
|
|
||||||
public SplashPotionData(int potionData) {
|
public SplashPotionData(int potionData) {
|
||||||
this.potionData = potionData;
|
this.potionData = potionData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPotionData() {
|
public int getPotionData() {
|
||||||
return this.potionData;
|
return this.potionData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
SplashPotionData that = (SplashPotionData) o;
|
SplashPotionData that = (SplashPotionData) o;
|
||||||
|
|
||||||
if (potionData != that.potionData) return false;
|
if(potionData != that.potionData) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return potionData;
|
return potionData;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@ package org.spacehq.mc.protocol.data.game.values.entity.player;
|
||||||
|
|
||||||
public enum Animation {
|
public enum Animation {
|
||||||
|
|
||||||
SWING_ARM,
|
SWING_ARM,
|
||||||
DAMAGE,
|
DAMAGE,
|
||||||
LEAVE_BED,
|
LEAVE_BED,
|
||||||
EAT_FOOD,
|
EAT_FOOD,
|
||||||
CRITICAL_HIT,
|
CRITICAL_HIT,
|
||||||
ENCHANTMENT_CRITICAL_HIT;
|
ENCHANTMENT_CRITICAL_HIT;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,16 +2,16 @@ package org.spacehq.mc.protocol.data.game.values.entity.player;
|
||||||
|
|
||||||
public enum BlockBreakStage {
|
public enum BlockBreakStage {
|
||||||
|
|
||||||
STAGE_1,
|
STAGE_1,
|
||||||
STAGE_2,
|
STAGE_2,
|
||||||
STAGE_3,
|
STAGE_3,
|
||||||
STAGE_4,
|
STAGE_4,
|
||||||
STAGE_5,
|
STAGE_5,
|
||||||
STAGE_6,
|
STAGE_6,
|
||||||
STAGE_7,
|
STAGE_7,
|
||||||
STAGE_8,
|
STAGE_8,
|
||||||
STAGE_9,
|
STAGE_9,
|
||||||
STAGE_10,
|
STAGE_10,
|
||||||
RESET;
|
RESET;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ package org.spacehq.mc.protocol.data.game.values.entity.player;
|
||||||
|
|
||||||
public enum CombatState {
|
public enum CombatState {
|
||||||
|
|
||||||
ENTER_COMBAT,
|
ENTER_COMBAT,
|
||||||
END_COMBAT,
|
END_COMBAT,
|
||||||
ENTITY_DEAD;
|
ENTITY_DEAD;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import org.spacehq.mc.protocol.data.game.values.world.notify.ClientNotificationV
|
||||||
|
|
||||||
public enum GameMode implements ClientNotificationValue {
|
public enum GameMode implements ClientNotificationValue {
|
||||||
|
|
||||||
SURVIVAL,
|
SURVIVAL,
|
||||||
CREATIVE,
|
CREATIVE,
|
||||||
ADVENTURE,
|
ADVENTURE,
|
||||||
SPECTATOR;
|
SPECTATOR;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ package org.spacehq.mc.protocol.data.game.values.entity.player;
|
||||||
|
|
||||||
public enum InteractAction {
|
public enum InteractAction {
|
||||||
|
|
||||||
INTERACT,
|
INTERACT,
|
||||||
ATTACK,
|
ATTACK,
|
||||||
INTERACT_AT;
|
INTERACT_AT;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@ package org.spacehq.mc.protocol.data.game.values.entity.player;
|
||||||
|
|
||||||
public enum PlayerAction {
|
public enum PlayerAction {
|
||||||
|
|
||||||
START_DIGGING,
|
START_DIGGING,
|
||||||
CANCEL_DIGGING,
|
CANCEL_DIGGING,
|
||||||
FINISH_DIGGING,
|
FINISH_DIGGING,
|
||||||
DROP_ITEM_STACK,
|
DROP_ITEM_STACK,
|
||||||
DROP_ITEM,
|
DROP_ITEM,
|
||||||
RELEASE_USE_ITEM;
|
RELEASE_USE_ITEM;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,12 @@ package org.spacehq.mc.protocol.data.game.values.entity.player;
|
||||||
|
|
||||||
public enum PlayerState {
|
public enum PlayerState {
|
||||||
|
|
||||||
START_SNEAKING,
|
START_SNEAKING,
|
||||||
STOP_SNEAKING,
|
STOP_SNEAKING,
|
||||||
LEAVE_BED,
|
LEAVE_BED,
|
||||||
START_SPRINTING,
|
START_SPRINTING,
|
||||||
STOP_SPRINTING,
|
STOP_SPRINTING,
|
||||||
RIDING_JUMP,
|
RIDING_JUMP,
|
||||||
OPEN_INVENTORY;
|
OPEN_INVENTORY;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@ package org.spacehq.mc.protocol.data.game.values.entity.player;
|
||||||
|
|
||||||
public enum PositionElement {
|
public enum PositionElement {
|
||||||
|
|
||||||
X,
|
X,
|
||||||
Y,
|
Y,
|
||||||
Z,
|
Z,
|
||||||
PITCH,
|
PITCH,
|
||||||
YAW;
|
YAW;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,9 @@ package org.spacehq.mc.protocol.data.game.values.scoreboard;
|
||||||
|
|
||||||
public enum NameTagVisibility {
|
public enum NameTagVisibility {
|
||||||
|
|
||||||
ALWAYS,
|
ALWAYS,
|
||||||
NEVER,
|
NEVER,
|
||||||
HIDE_FOR_OTHER_TEAMS,
|
HIDE_FOR_OTHER_TEAMS,
|
||||||
HIDE_FOR_OWN_TEAM;
|
HIDE_FOR_OWN_TEAM;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ package org.spacehq.mc.protocol.data.game.values.scoreboard;
|
||||||
|
|
||||||
public enum ObjectiveAction {
|
public enum ObjectiveAction {
|
||||||
|
|
||||||
ADD,
|
ADD,
|
||||||
REMOVE,
|
REMOVE,
|
||||||
UPDATE;
|
UPDATE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package org.spacehq.mc.protocol.data.game.values.scoreboard;
|
||||||
|
|
||||||
public enum ScoreType {
|
public enum ScoreType {
|
||||||
|
|
||||||
INTEGER,
|
INTEGER,
|
||||||
HEARTS;
|
HEARTS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package org.spacehq.mc.protocol.data.game.values.scoreboard;
|
||||||
|
|
||||||
public enum ScoreboardAction {
|
public enum ScoreboardAction {
|
||||||
|
|
||||||
ADD_OR_UPDATE,
|
ADD_OR_UPDATE,
|
||||||
REMOVE;
|
REMOVE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,25 +2,25 @@ package org.spacehq.mc.protocol.data.game.values.scoreboard;
|
||||||
|
|
||||||
public enum ScoreboardPosition {
|
public enum ScoreboardPosition {
|
||||||
|
|
||||||
PLAYER_LIST,
|
PLAYER_LIST,
|
||||||
SIDEBAR,
|
SIDEBAR,
|
||||||
BELOW_NAME,
|
BELOW_NAME,
|
||||||
|
|
||||||
SIDEBAR_TEAM_BLACK,
|
SIDEBAR_TEAM_BLACK,
|
||||||
SIDEBAR_TEAM_DARK_BLUE,
|
SIDEBAR_TEAM_DARK_BLUE,
|
||||||
SIDEBAR_TEAM_DARK_GREEN,
|
SIDEBAR_TEAM_DARK_GREEN,
|
||||||
SIDEBAR_TEAM_DARK_AQUA,
|
SIDEBAR_TEAM_DARK_AQUA,
|
||||||
SIDEBAR_TEAM_DARK_RED,
|
SIDEBAR_TEAM_DARK_RED,
|
||||||
SIDEBAR_TEAM_DARK_PURPLE,
|
SIDEBAR_TEAM_DARK_PURPLE,
|
||||||
SIDEBAR_TEAM_GOLD,
|
SIDEBAR_TEAM_GOLD,
|
||||||
SIDEBAR_TEAM_GRAY,
|
SIDEBAR_TEAM_GRAY,
|
||||||
SIDEBAR_TEAM_DARK_GRAY,
|
SIDEBAR_TEAM_DARK_GRAY,
|
||||||
SIDEBAR_TEAM_BLUE,
|
SIDEBAR_TEAM_BLUE,
|
||||||
SIDEBAR_TEAM_GREEN,
|
SIDEBAR_TEAM_GREEN,
|
||||||
SIDEBAR_TEAM_AQUA,
|
SIDEBAR_TEAM_AQUA,
|
||||||
SIDEBAR_TEAM_RED,
|
SIDEBAR_TEAM_RED,
|
||||||
SIDEBAR_TEAM_LIGHT_PURPLE,
|
SIDEBAR_TEAM_LIGHT_PURPLE,
|
||||||
SIDEBAR_TEAM_YELLOW,
|
SIDEBAR_TEAM_YELLOW,
|
||||||
SIDEBAR_TEAM_WHITE;
|
SIDEBAR_TEAM_WHITE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@ package org.spacehq.mc.protocol.data.game.values.scoreboard;
|
||||||
|
|
||||||
public enum TeamAction {
|
public enum TeamAction {
|
||||||
|
|
||||||
CREATE,
|
CREATE,
|
||||||
REMOVE,
|
REMOVE,
|
||||||
UPDATE,
|
UPDATE,
|
||||||
ADD_PLAYER,
|
ADD_PLAYER,
|
||||||
REMOVE_PLAYER;
|
REMOVE_PLAYER;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,22 +2,22 @@ package org.spacehq.mc.protocol.data.game.values.scoreboard;
|
||||||
|
|
||||||
public enum TeamColor {
|
public enum TeamColor {
|
||||||
|
|
||||||
NONE,
|
NONE,
|
||||||
BLACK,
|
BLACK,
|
||||||
DARK_BLUE,
|
DARK_BLUE,
|
||||||
DARK_GREEN,
|
DARK_GREEN,
|
||||||
DARK_AQUA,
|
DARK_AQUA,
|
||||||
DARK_RED,
|
DARK_RED,
|
||||||
DARK_PURPLE,
|
DARK_PURPLE,
|
||||||
GOLD,
|
GOLD,
|
||||||
GRAY,
|
GRAY,
|
||||||
DARK_GRAY,
|
DARK_GRAY,
|
||||||
BLUE,
|
BLUE,
|
||||||
GREEN,
|
GREEN,
|
||||||
AQUA,
|
AQUA,
|
||||||
RED,
|
RED,
|
||||||
LIGHT_PURPLE,
|
LIGHT_PURPLE,
|
||||||
YELLOW,
|
YELLOW,
|
||||||
WHITE;
|
WHITE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ package org.spacehq.mc.protocol.data.game.values.setting;
|
||||||
|
|
||||||
public enum ChatVisibility {
|
public enum ChatVisibility {
|
||||||
|
|
||||||
FULL,
|
FULL,
|
||||||
SYSTEM,
|
SYSTEM,
|
||||||
HIDDEN;
|
HIDDEN;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,9 @@ package org.spacehq.mc.protocol.data.game.values.setting;
|
||||||
|
|
||||||
public enum Difficulty {
|
public enum Difficulty {
|
||||||
|
|
||||||
PEACEFUL,
|
PEACEFUL,
|
||||||
EASY,
|
EASY,
|
||||||
NORMAL,
|
NORMAL,
|
||||||
HARD;
|
HARD;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,12 @@ package org.spacehq.mc.protocol.data.game.values.setting;
|
||||||
|
|
||||||
public enum SkinPart {
|
public enum SkinPart {
|
||||||
|
|
||||||
CAPE,
|
CAPE,
|
||||||
JACKET,
|
JACKET,
|
||||||
LEFT_SLEEVE,
|
LEFT_SLEEVE,
|
||||||
RIGHT_SLEEVE,
|
RIGHT_SLEEVE,
|
||||||
LEFT_PANTS_LEG,
|
LEFT_PANTS_LEG,
|
||||||
RIGHT_PANTS_LEG,
|
RIGHT_PANTS_LEG,
|
||||||
HAT;
|
HAT;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,37 +2,37 @@ package org.spacehq.mc.protocol.data.game.values.statistic;
|
||||||
|
|
||||||
public enum Achievement implements Statistic {
|
public enum Achievement implements Statistic {
|
||||||
|
|
||||||
OPEN_INVENTORY,
|
OPEN_INVENTORY,
|
||||||
GET_WOOD,
|
GET_WOOD,
|
||||||
MAKE_WORKBENCH,
|
MAKE_WORKBENCH,
|
||||||
MAKE_PICKAXE,
|
MAKE_PICKAXE,
|
||||||
MAKE_FURNACE,
|
MAKE_FURNACE,
|
||||||
GET_IRON,
|
GET_IRON,
|
||||||
MAKE_HOE,
|
MAKE_HOE,
|
||||||
MAKE_BREAD,
|
MAKE_BREAD,
|
||||||
MAKE_CAKE,
|
MAKE_CAKE,
|
||||||
MAKE_IRON_PICKAXE,
|
MAKE_IRON_PICKAXE,
|
||||||
COOK_FISH,
|
COOK_FISH,
|
||||||
RIDE_MINECART_1000_BLOCKS,
|
RIDE_MINECART_1000_BLOCKS,
|
||||||
MAKE_SWORD,
|
MAKE_SWORD,
|
||||||
KILL_ENEMY,
|
KILL_ENEMY,
|
||||||
KILL_COW,
|
KILL_COW,
|
||||||
FLY_PIG,
|
FLY_PIG,
|
||||||
SNIPE_SKELETON,
|
SNIPE_SKELETON,
|
||||||
GET_DIAMONDS,
|
GET_DIAMONDS,
|
||||||
GIVE_DIAMONDS,
|
GIVE_DIAMONDS,
|
||||||
ENTER_PORTAL,
|
ENTER_PORTAL,
|
||||||
ATTACKED_BY_GHAST,
|
ATTACKED_BY_GHAST,
|
||||||
GET_BLAZE_ROD,
|
GET_BLAZE_ROD,
|
||||||
MAKE_POTION,
|
MAKE_POTION,
|
||||||
GO_TO_THE_END,
|
GO_TO_THE_END,
|
||||||
DEFEAT_ENDER_DRAGON,
|
DEFEAT_ENDER_DRAGON,
|
||||||
DEAL_18_OR_MORE_DAMAGE,
|
DEAL_18_OR_MORE_DAMAGE,
|
||||||
MAKE_BOOKCASE,
|
MAKE_BOOKCASE,
|
||||||
BREED_COW,
|
BREED_COW,
|
||||||
SPAWN_WITHER,
|
SPAWN_WITHER,
|
||||||
KILL_WITHER,
|
KILL_WITHER,
|
||||||
MAKE_FULL_BEACON,
|
MAKE_FULL_BEACON,
|
||||||
EXPLORE_ALL_BIOMES;
|
EXPLORE_ALL_BIOMES;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,14 @@ package org.spacehq.mc.protocol.data.game.values.statistic;
|
||||||
|
|
||||||
public class BreakBlockStatistic implements Statistic {
|
public class BreakBlockStatistic implements Statistic {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
|
|
||||||
public BreakBlockStatistic(int id) {
|
public BreakBlockStatistic(int id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,31 +2,31 @@ package org.spacehq.mc.protocol.data.game.values.statistic;
|
||||||
|
|
||||||
public class BreakItemStatistic implements Statistic {
|
public class BreakItemStatistic implements Statistic {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
|
|
||||||
public BreakItemStatistic(int id) {
|
public BreakItemStatistic(int id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
BreakItemStatistic that = (BreakItemStatistic) o;
|
BreakItemStatistic that = (BreakItemStatistic) o;
|
||||||
|
|
||||||
if (id != that.id) return false;
|
if(id != that.id) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,31 +2,31 @@ package org.spacehq.mc.protocol.data.game.values.statistic;
|
||||||
|
|
||||||
public class CraftItemStatistic implements Statistic {
|
public class CraftItemStatistic implements Statistic {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
|
|
||||||
public CraftItemStatistic(int id) {
|
public CraftItemStatistic(int id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
CraftItemStatistic that = (CraftItemStatistic) o;
|
CraftItemStatistic that = (CraftItemStatistic) o;
|
||||||
|
|
||||||
if (id != that.id) return false;
|
if(id != that.id) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,28 +2,28 @@ package org.spacehq.mc.protocol.data.game.values.statistic;
|
||||||
|
|
||||||
public enum GenericStatistic implements Statistic {
|
public enum GenericStatistic implements Statistic {
|
||||||
|
|
||||||
TIMES_LEFT_GAME,
|
TIMES_LEFT_GAME,
|
||||||
MINUTES_PLAYED,
|
MINUTES_PLAYED,
|
||||||
BLOCKS_WALKED,
|
BLOCKS_WALKED,
|
||||||
BLOCKS_SWAM,
|
BLOCKS_SWAM,
|
||||||
BLOCKS_FALLEN,
|
BLOCKS_FALLEN,
|
||||||
BLOCKS_CLIMBED,
|
BLOCKS_CLIMBED,
|
||||||
BLOCKS_FLOWN,
|
BLOCKS_FLOWN,
|
||||||
BLOCKS_DOVE,
|
BLOCKS_DOVE,
|
||||||
BLOCKS_TRAVELLED_IN_MINECART,
|
BLOCKS_TRAVELLED_IN_MINECART,
|
||||||
BLOCKS_TRAVELLED_IN_BOAT,
|
BLOCKS_TRAVELLED_IN_BOAT,
|
||||||
BLOCKS_RODE_ON_PIG,
|
BLOCKS_RODE_ON_PIG,
|
||||||
BLOCKS_RODE_ON_HORSE,
|
BLOCKS_RODE_ON_HORSE,
|
||||||
TIMES_JUMPED,
|
TIMES_JUMPED,
|
||||||
TIMES_DROPPED_ITEMS,
|
TIMES_DROPPED_ITEMS,
|
||||||
TIMES_DEALT_DAMAGE,
|
TIMES_DEALT_DAMAGE,
|
||||||
DAMAGE_TAKEN,
|
DAMAGE_TAKEN,
|
||||||
DEATHS,
|
DEATHS,
|
||||||
MOB_KILLS,
|
MOB_KILLS,
|
||||||
ANIMALS_BRED,
|
ANIMALS_BRED,
|
||||||
PLAYERS_KILLED,
|
PLAYERS_KILLED,
|
||||||
FISH_CAUGHT,
|
FISH_CAUGHT,
|
||||||
JUNK_FISHED,
|
JUNK_FISHED,
|
||||||
TREASURE_FISHED;
|
TREASURE_FISHED;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,31 +2,31 @@ package org.spacehq.mc.protocol.data.game.values.statistic;
|
||||||
|
|
||||||
public class UseItemStatistic implements Statistic {
|
public class UseItemStatistic implements Statistic {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
|
|
||||||
public UseItemStatistic(int id) {
|
public UseItemStatistic(int id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
UseItemStatistic that = (UseItemStatistic) o;
|
UseItemStatistic that = (UseItemStatistic) o;
|
||||||
|
|
||||||
if (id != that.id) return false;
|
if(id != that.id) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package org.spacehq.mc.protocol.data.game.values.window;
|
||||||
|
|
||||||
public enum ClickItemParam implements WindowActionParam {
|
public enum ClickItemParam implements WindowActionParam {
|
||||||
|
|
||||||
LEFT_CLICK,
|
LEFT_CLICK,
|
||||||
RIGHT_CLICK;
|
RIGHT_CLICK;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,6 @@ package org.spacehq.mc.protocol.data.game.values.window;
|
||||||
|
|
||||||
public enum CreativeGrabParam implements WindowActionParam {
|
public enum CreativeGrabParam implements WindowActionParam {
|
||||||
|
|
||||||
GRAB;
|
GRAB;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,9 @@ package org.spacehq.mc.protocol.data.game.values.window;
|
||||||
|
|
||||||
public enum DropItemParam implements WindowActionParam {
|
public enum DropItemParam implements WindowActionParam {
|
||||||
|
|
||||||
DROP_FROM_SELECTED,
|
DROP_FROM_SELECTED,
|
||||||
DROP_SELECTED_STACK,
|
DROP_SELECTED_STACK,
|
||||||
LEFT_CLICK_OUTSIDE_NOT_HOLDING,
|
LEFT_CLICK_OUTSIDE_NOT_HOLDING,
|
||||||
RIGHT_CLICK_OUTSIDE_NOT_HOLDING;
|
RIGHT_CLICK_OUTSIDE_NOT_HOLDING;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,6 @@ package org.spacehq.mc.protocol.data.game.values.window;
|
||||||
|
|
||||||
public enum FillStackParam implements WindowActionParam {
|
public enum FillStackParam implements WindowActionParam {
|
||||||
|
|
||||||
FILL;
|
FILL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,14 +3,14 @@ package org.spacehq.mc.protocol.data.game.values.window;
|
||||||
|
|
||||||
public enum MoveToHotbarParam implements WindowActionParam {
|
public enum MoveToHotbarParam implements WindowActionParam {
|
||||||
|
|
||||||
SLOT_1,
|
SLOT_1,
|
||||||
SLOT_2,
|
SLOT_2,
|
||||||
SLOT_3,
|
SLOT_3,
|
||||||
SLOT_4,
|
SLOT_4,
|
||||||
SLOT_5,
|
SLOT_5,
|
||||||
SLOT_6,
|
SLOT_6,
|
||||||
SLOT_7,
|
SLOT_7,
|
||||||
SLOT_8,
|
SLOT_8,
|
||||||
SLOT_9;
|
SLOT_9;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package org.spacehq.mc.protocol.data.game.values.window;
|
||||||
|
|
||||||
public enum ShiftClickItemParam implements WindowActionParam {
|
public enum ShiftClickItemParam implements WindowActionParam {
|
||||||
|
|
||||||
LEFT_CLICK,
|
LEFT_CLICK,
|
||||||
RIGHT_CLICK;
|
RIGHT_CLICK;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,11 @@ package org.spacehq.mc.protocol.data.game.values.window;
|
||||||
|
|
||||||
public enum SpreadItemParam implements WindowActionParam {
|
public enum SpreadItemParam implements WindowActionParam {
|
||||||
|
|
||||||
LEFT_MOUSE_BEGIN_DRAG,
|
LEFT_MOUSE_BEGIN_DRAG,
|
||||||
LEFT_MOUSE_ADD_SLOT,
|
LEFT_MOUSE_ADD_SLOT,
|
||||||
LEFT_MOUSE_END_DRAG,
|
LEFT_MOUSE_END_DRAG,
|
||||||
RIGHT_MOUSE_BEGIN_DRAG,
|
RIGHT_MOUSE_BEGIN_DRAG,
|
||||||
RIGHT_MOUSE_ADD_SLOT,
|
RIGHT_MOUSE_ADD_SLOT,
|
||||||
RIGHT_MOUSE_END_DRAG;
|
RIGHT_MOUSE_END_DRAG;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,12 @@ package org.spacehq.mc.protocol.data.game.values.window;
|
||||||
|
|
||||||
public enum WindowAction {
|
public enum WindowAction {
|
||||||
|
|
||||||
CLICK_ITEM,
|
CLICK_ITEM,
|
||||||
SHIFT_CLICK_ITEM,
|
SHIFT_CLICK_ITEM,
|
||||||
MOVE_TO_HOTBAR_SLOT,
|
MOVE_TO_HOTBAR_SLOT,
|
||||||
CREATIVE_GRAB_MAX_STACK,
|
CREATIVE_GRAB_MAX_STACK,
|
||||||
DROP_ITEM,
|
DROP_ITEM,
|
||||||
SPREAD_ITEM,
|
SPREAD_ITEM,
|
||||||
FILL_STACK;
|
FILL_STACK;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,18 +2,18 @@ package org.spacehq.mc.protocol.data.game.values.window;
|
||||||
|
|
||||||
public enum WindowType {
|
public enum WindowType {
|
||||||
|
|
||||||
GENERIC_INVENTORY,
|
GENERIC_INVENTORY,
|
||||||
ANVIL,
|
ANVIL,
|
||||||
BEACON,
|
BEACON,
|
||||||
BREWING_STAND,
|
BREWING_STAND,
|
||||||
CHEST,
|
CHEST,
|
||||||
CRAFTING_TABLE,
|
CRAFTING_TABLE,
|
||||||
DISPENSER,
|
DISPENSER,
|
||||||
DROPPER,
|
DROPPER,
|
||||||
ENCHANTING_TABLE,
|
ENCHANTING_TABLE,
|
||||||
FURNACE,
|
FURNACE,
|
||||||
HOPPER,
|
HOPPER,
|
||||||
VILLAGER,
|
VILLAGER,
|
||||||
HORSE;
|
HORSE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,25 +27,29 @@ public enum EnchantmentTableProperty implements WindowProperty {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The enchantment for slot 1.
|
* The enchantment for slot 1.
|
||||||
|
*
|
||||||
* @see #getEnchantment(int, int)
|
* @see #getEnchantment(int, int)
|
||||||
*/
|
*/
|
||||||
ENCHANTMENT_SLOT_1,
|
ENCHANTMENT_SLOT_1,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The enchantment for slot 2.
|
* The enchantment for slot 2.
|
||||||
|
*
|
||||||
* @see #getEnchantment(int, int)
|
* @see #getEnchantment(int, int)
|
||||||
*/
|
*/
|
||||||
ENCHANTMENT_SLOT_2,
|
ENCHANTMENT_SLOT_2,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The enchantment for slot 3.
|
* The enchantment for slot 3.
|
||||||
|
*
|
||||||
* @see #getEnchantment(int, int)
|
* @see #getEnchantment(int, int)
|
||||||
*/
|
*/
|
||||||
ENCHANTMENT_SLOT_3;
|
ENCHANTMENT_SLOT_3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Packs enchantment type and level into one integer as used for the ENCHANTMENT_SLOT_X properties.
|
* Packs enchantment type and level into one integer as used for the ENCHANTMENT_SLOT_X properties.
|
||||||
* @param type Id of the enchantment
|
*
|
||||||
|
* @param type Id of the enchantment
|
||||||
* @param level Level of the enchantment
|
* @param level Level of the enchantment
|
||||||
* @return Packed value
|
* @return Packed value
|
||||||
* @see #getEnchantmentType(int)
|
* @see #getEnchantmentType(int)
|
||||||
|
@ -57,6 +61,7 @@ public enum EnchantmentTableProperty implements WindowProperty {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unpacks the enchantment type from one integer as used for the ENCHANTMENT_SLOT_X properties.
|
* Unpacks the enchantment type from one integer as used for the ENCHANTMENT_SLOT_X properties.
|
||||||
|
*
|
||||||
* @param enchantmentInfo Packed value
|
* @param enchantmentInfo Packed value
|
||||||
* @return Id of the enchantment
|
* @return Id of the enchantment
|
||||||
* @see #getEnchantment(int, int)
|
* @see #getEnchantment(int, int)
|
||||||
|
@ -67,6 +72,7 @@ public enum EnchantmentTableProperty implements WindowProperty {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unpacks the enchantment level from one integer as used for the ENCHANTMENT_SLOT_X properties.
|
* Unpacks the enchantment level from one integer as used for the ENCHANTMENT_SLOT_X properties.
|
||||||
|
*
|
||||||
* @param enchantmentInfo Packed value
|
* @param enchantmentInfo Packed value
|
||||||
* @return Level of the enchantment
|
* @return Level of the enchantment
|
||||||
* @see #getEnchantment(int, int)
|
* @see #getEnchantment(int, int)
|
||||||
|
|
|
@ -2,31 +2,31 @@ package org.spacehq.mc.protocol.data.game.values.world;
|
||||||
|
|
||||||
public class CustomSound implements Sound {
|
public class CustomSound implements Sound {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
public CustomSound(String name) {
|
public CustomSound(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
CustomSound that = (CustomSound) o;
|
CustomSound that = (CustomSound) o;
|
||||||
|
|
||||||
if (!name.equals(that.name)) return false;
|
if(!name.equals(that.name)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return name.hashCode();
|
return name.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,208 +2,208 @@ package org.spacehq.mc.protocol.data.game.values.world;
|
||||||
|
|
||||||
public enum GenericSound implements Sound {
|
public enum GenericSound implements Sound {
|
||||||
|
|
||||||
CLICK,
|
CLICK,
|
||||||
FIZZ,
|
FIZZ,
|
||||||
FIRE_AMBIENT,
|
FIRE_AMBIENT,
|
||||||
IGNITE_FIRE,
|
IGNITE_FIRE,
|
||||||
WATER_AMBIENT,
|
WATER_AMBIENT,
|
||||||
LAVA_AMBIENT,
|
LAVA_AMBIENT,
|
||||||
LAVA_POP,
|
LAVA_POP,
|
||||||
HARP,
|
HARP,
|
||||||
BASS_DRUM,
|
BASS_DRUM,
|
||||||
SNARE_DRUM,
|
SNARE_DRUM,
|
||||||
HI_HAT,
|
HI_HAT,
|
||||||
DOUBLE_BASS,
|
DOUBLE_BASS,
|
||||||
PISTON_EXTEND,
|
PISTON_EXTEND,
|
||||||
PISTON_RETRACT,
|
PISTON_RETRACT,
|
||||||
PORTAL_AMBIENT,
|
PORTAL_AMBIENT,
|
||||||
TNT_PRIMED,
|
TNT_PRIMED,
|
||||||
BOW_HIT,
|
BOW_HIT,
|
||||||
COLLECT_ITEM,
|
COLLECT_ITEM,
|
||||||
COLLECT_EXP,
|
COLLECT_EXP,
|
||||||
SUCCESSFUL_HIT,
|
SUCCESSFUL_HIT,
|
||||||
FIREWORK_BLAST,
|
FIREWORK_BLAST,
|
||||||
FIREWORK_LARGE_BLAST,
|
FIREWORK_LARGE_BLAST,
|
||||||
FIREWORK_FAR_BLAST,
|
FIREWORK_FAR_BLAST,
|
||||||
FIREWORK_FAR_LARGE_BLAST,
|
FIREWORK_FAR_LARGE_BLAST,
|
||||||
FIREWORK_TWINKLE,
|
FIREWORK_TWINKLE,
|
||||||
FIREWORK_FAR_TWINKLE,
|
FIREWORK_FAR_TWINKLE,
|
||||||
RAIN_AMBIENT,
|
RAIN_AMBIENT,
|
||||||
WITHER_SPAWN,
|
WITHER_SPAWN,
|
||||||
ENDER_DRAGON_DEATH,
|
ENDER_DRAGON_DEATH,
|
||||||
FIRE_PROJECTILE,
|
FIRE_PROJECTILE,
|
||||||
DOOR_OPEN,
|
DOOR_OPEN,
|
||||||
DOOR_CLOSE,
|
DOOR_CLOSE,
|
||||||
GHAST_CHARGE,
|
GHAST_CHARGE,
|
||||||
GHAST_FIRE,
|
GHAST_FIRE,
|
||||||
POUND_WOODEN_DOOR,
|
POUND_WOODEN_DOOR,
|
||||||
POUND_METAL_DOOR,
|
POUND_METAL_DOOR,
|
||||||
BREAK_WOODEN_DOOR,
|
BREAK_WOODEN_DOOR,
|
||||||
WITHER_SHOOT,
|
WITHER_SHOOT,
|
||||||
BAT_TAKE_OFF,
|
BAT_TAKE_OFF,
|
||||||
INFECT_VILLAGER,
|
INFECT_VILLAGER,
|
||||||
DISINFECT_VILLAGER,
|
DISINFECT_VILLAGER,
|
||||||
ANVIL_BREAK,
|
ANVIL_BREAK,
|
||||||
ANVIL_USE,
|
ANVIL_USE,
|
||||||
ANVIL_LAND,
|
ANVIL_LAND,
|
||||||
BREAK_SPLASH_POTION,
|
BREAK_SPLASH_POTION,
|
||||||
THORNS_DAMAGE,
|
THORNS_DAMAGE,
|
||||||
EXPLOSION,
|
EXPLOSION,
|
||||||
CAVE_AMBIENT,
|
CAVE_AMBIENT,
|
||||||
OPEN_CHEST,
|
OPEN_CHEST,
|
||||||
CLOSE_CHEST,
|
CLOSE_CHEST,
|
||||||
DIG_STONE,
|
DIG_STONE,
|
||||||
DIG_WOOD,
|
DIG_WOOD,
|
||||||
DIG_GRAVEL,
|
DIG_GRAVEL,
|
||||||
DIG_GRASS,
|
DIG_GRASS,
|
||||||
DIG_CLOTH,
|
DIG_CLOTH,
|
||||||
DIG_SAND,
|
DIG_SAND,
|
||||||
DIG_SNOW,
|
DIG_SNOW,
|
||||||
DIG_GLASS,
|
DIG_GLASS,
|
||||||
ANVIL_STEP,
|
ANVIL_STEP,
|
||||||
LADDER_STEP,
|
LADDER_STEP,
|
||||||
STONE_STEP,
|
STONE_STEP,
|
||||||
WOOD_STEP,
|
WOOD_STEP,
|
||||||
GRAVEL_STEP,
|
GRAVEL_STEP,
|
||||||
GRASS_STEP,
|
GRASS_STEP,
|
||||||
CLOTH_STEP,
|
CLOTH_STEP,
|
||||||
SAND_STEP,
|
SAND_STEP,
|
||||||
SNOW_STEP,
|
SNOW_STEP,
|
||||||
BURP,
|
BURP,
|
||||||
SADDLE_HORSE,
|
SADDLE_HORSE,
|
||||||
ENDER_DRAGON_FLAP_WINGS,
|
ENDER_DRAGON_FLAP_WINGS,
|
||||||
THUNDER_AMBIENT,
|
THUNDER_AMBIENT,
|
||||||
LAUNCH_FIREWORKS,
|
LAUNCH_FIREWORKS,
|
||||||
CREEPER_PRIMED,
|
CREEPER_PRIMED,
|
||||||
ENDERMAN_STARE,
|
ENDERMAN_STARE,
|
||||||
ENDERMAN_TELEPORT,
|
ENDERMAN_TELEPORT,
|
||||||
IRON_GOLEM_THROW,
|
IRON_GOLEM_THROW,
|
||||||
IRON_GOLEM_WALK,
|
IRON_GOLEM_WALK,
|
||||||
ZOMBIE_PIGMAN_ANGRY,
|
ZOMBIE_PIGMAN_ANGRY,
|
||||||
SILVERFISH_STEP,
|
SILVERFISH_STEP,
|
||||||
SKELETON_STEP,
|
SKELETON_STEP,
|
||||||
SPIDER_STEP,
|
SPIDER_STEP,
|
||||||
ZOMBIE_STEP,
|
ZOMBIE_STEP,
|
||||||
ZOMBIE_CURE,
|
ZOMBIE_CURE,
|
||||||
CHICKEN_LAY_EGG,
|
CHICKEN_LAY_EGG,
|
||||||
CHICKEN_STEP,
|
CHICKEN_STEP,
|
||||||
COW_STEP,
|
COW_STEP,
|
||||||
HORSE_EATING,
|
HORSE_EATING,
|
||||||
HORSE_LAND,
|
HORSE_LAND,
|
||||||
HORSE_WEAR_ARMOR,
|
HORSE_WEAR_ARMOR,
|
||||||
HORSE_GALLOP,
|
HORSE_GALLOP,
|
||||||
HORSE_BREATHE,
|
HORSE_BREATHE,
|
||||||
HORSE_WOOD_STEP,
|
HORSE_WOOD_STEP,
|
||||||
HORSE_SOFT_STEP,
|
HORSE_SOFT_STEP,
|
||||||
HORSE_JUMP,
|
HORSE_JUMP,
|
||||||
SHEAR_SHEEP,
|
SHEAR_SHEEP,
|
||||||
PIG_STEP,
|
PIG_STEP,
|
||||||
SHEEP_STEP,
|
SHEEP_STEP,
|
||||||
VILLAGER_YES,
|
VILLAGER_YES,
|
||||||
VILLAGER_NO,
|
VILLAGER_NO,
|
||||||
WOLF_STEP,
|
WOLF_STEP,
|
||||||
WOLF_SHAKE,
|
WOLF_SHAKE,
|
||||||
DRINK,
|
DRINK,
|
||||||
EAT,
|
EAT,
|
||||||
LEVEL_UP,
|
LEVEL_UP,
|
||||||
FISH_HOOK_SPLASH,
|
FISH_HOOK_SPLASH,
|
||||||
ITEM_BREAK,
|
ITEM_BREAK,
|
||||||
SWIM,
|
SWIM,
|
||||||
SPLASH,
|
SPLASH,
|
||||||
HURT,
|
HURT,
|
||||||
DEATH,
|
DEATH,
|
||||||
BIG_FALL,
|
BIG_FALL,
|
||||||
SMALL_FALL,
|
SMALL_FALL,
|
||||||
MOB_SWIM,
|
MOB_SWIM,
|
||||||
MOB_SPLASH,
|
MOB_SPLASH,
|
||||||
PLAYER_SWIM,
|
PLAYER_SWIM,
|
||||||
PLAYER_SPLASH,
|
PLAYER_SPLASH,
|
||||||
ENDER_DRAGON_GROWL,
|
ENDER_DRAGON_GROWL,
|
||||||
WITHER_IDLE,
|
WITHER_IDLE,
|
||||||
BLAZE_BREATHE,
|
BLAZE_BREATHE,
|
||||||
ENDERMAN_SCREAM,
|
ENDERMAN_SCREAM,
|
||||||
ENDERMAN_IDLE,
|
ENDERMAN_IDLE,
|
||||||
GHAST_MOAN,
|
GHAST_MOAN,
|
||||||
ZOMBIE_PIGMAN_IDLE,
|
ZOMBIE_PIGMAN_IDLE,
|
||||||
SILVERFISH_IDLE,
|
SILVERFISH_IDLE,
|
||||||
SKELETON_IDLE,
|
SKELETON_IDLE,
|
||||||
SPIDER_IDLE,
|
SPIDER_IDLE,
|
||||||
WITCH_IDLE,
|
WITCH_IDLE,
|
||||||
ZOMBIE_IDLE,
|
ZOMBIE_IDLE,
|
||||||
BAT_IDLE,
|
BAT_IDLE,
|
||||||
CHICKEN_IDLE,
|
CHICKEN_IDLE,
|
||||||
COW_IDLE,
|
COW_IDLE,
|
||||||
HORSE_IDLE,
|
HORSE_IDLE,
|
||||||
DONKEY_IDLE,
|
DONKEY_IDLE,
|
||||||
ZOMBIE_HORSE_IDLE,
|
ZOMBIE_HORSE_IDLE,
|
||||||
SKELETON_HORSE_IDLE,
|
SKELETON_HORSE_IDLE,
|
||||||
OCELOT_PURR,
|
OCELOT_PURR,
|
||||||
OCELOT_PURR_MEOW,
|
OCELOT_PURR_MEOW,
|
||||||
OCELOT_MEOW,
|
OCELOT_MEOW,
|
||||||
PIG_IDLE,
|
PIG_IDLE,
|
||||||
SHEEP_IDLE,
|
SHEEP_IDLE,
|
||||||
VILLAGER_HAGGLE,
|
VILLAGER_HAGGLE,
|
||||||
VILLAGER_IDLE,
|
VILLAGER_IDLE,
|
||||||
WOLF_GROWL,
|
WOLF_GROWL,
|
||||||
WOLF_PANT,
|
WOLF_PANT,
|
||||||
WOLF_WHINE,
|
WOLF_WHINE,
|
||||||
WOLF_BARK,
|
WOLF_BARK,
|
||||||
MOB_BIG_FALL,
|
MOB_BIG_FALL,
|
||||||
MOB_SMALL_FALL,
|
MOB_SMALL_FALL,
|
||||||
PLAYER_BIG_FALL,
|
PLAYER_BIG_FALL,
|
||||||
PLAYER_SMALL_FALL,
|
PLAYER_SMALL_FALL,
|
||||||
ENDER_DRAGON_HURT,
|
ENDER_DRAGON_HURT,
|
||||||
WITHER_HURT,
|
WITHER_HURT,
|
||||||
WITHER_DEATH,
|
WITHER_DEATH,
|
||||||
BLAZE_HURT,
|
BLAZE_HURT,
|
||||||
BLAZE_DEATH,
|
BLAZE_DEATH,
|
||||||
CREEPER_HURT,
|
CREEPER_HURT,
|
||||||
CREEPER_DEATH,
|
CREEPER_DEATH,
|
||||||
ENDERMAN_HURT,
|
ENDERMAN_HURT,
|
||||||
ENDERMAN_DEATH,
|
ENDERMAN_DEATH,
|
||||||
GHAST_HURT,
|
GHAST_HURT,
|
||||||
GHAST_DEATH,
|
GHAST_DEATH,
|
||||||
IRON_GOLEM_HURT,
|
IRON_GOLEM_HURT,
|
||||||
IRON_GOLEM_DEATH,
|
IRON_GOLEM_DEATH,
|
||||||
MOB_HURT,
|
MOB_HURT,
|
||||||
MOB_DEATH,
|
MOB_DEATH,
|
||||||
ZOMBIE_PIGMAN_HURT,
|
ZOMBIE_PIGMAN_HURT,
|
||||||
ZOMBIE_PIGMAN_DEATH,
|
ZOMBIE_PIGMAN_DEATH,
|
||||||
SILVERFISH_HURT,
|
SILVERFISH_HURT,
|
||||||
SILVERFISH_DEATH,
|
SILVERFISH_DEATH,
|
||||||
SKELETON_HURT,
|
SKELETON_HURT,
|
||||||
SKELETON_DEATH,
|
SKELETON_DEATH,
|
||||||
SLIME,
|
SLIME,
|
||||||
BIG_SLIME,
|
BIG_SLIME,
|
||||||
SPIDER_DEATH,
|
SPIDER_DEATH,
|
||||||
WITCH_HURT,
|
WITCH_HURT,
|
||||||
WITCH_DEATH,
|
WITCH_DEATH,
|
||||||
ZOMBIE_HURT,
|
ZOMBIE_HURT,
|
||||||
ZOMBIE_DEATH,
|
ZOMBIE_DEATH,
|
||||||
PLAYER_HURT,
|
PLAYER_HURT,
|
||||||
PLAYER_DEATH,
|
PLAYER_DEATH,
|
||||||
WOLF_HURT,
|
WOLF_HURT,
|
||||||
WOLF_DEATH,
|
WOLF_DEATH,
|
||||||
VILLAGER_HURT,
|
VILLAGER_HURT,
|
||||||
VILLAGER_DEATH,
|
VILLAGER_DEATH,
|
||||||
PIG_DEATH,
|
PIG_DEATH,
|
||||||
OCELOT_HURT,
|
OCELOT_HURT,
|
||||||
HORSE_HURT,
|
HORSE_HURT,
|
||||||
DONKEY_HURT,
|
DONKEY_HURT,
|
||||||
ZOMBIE_HORSE_HURT,
|
ZOMBIE_HORSE_HURT,
|
||||||
SKELETON_HORSE_HURT,
|
SKELETON_HORSE_HURT,
|
||||||
HORSE_DEATH,
|
HORSE_DEATH,
|
||||||
DONKEY_DEATH,
|
DONKEY_DEATH,
|
||||||
ZOMBIE_HORSE_DEATH,
|
ZOMBIE_HORSE_DEATH,
|
||||||
SKELETON_HORSE_DEATH,
|
SKELETON_HORSE_DEATH,
|
||||||
COW_HURT,
|
COW_HURT,
|
||||||
CHICKEN_HURT,
|
CHICKEN_HURT,
|
||||||
BAT_HURT,
|
BAT_HURT,
|
||||||
BAT_DEATH,
|
BAT_DEATH,
|
||||||
RABBIT_IDLE,
|
RABBIT_IDLE,
|
||||||
RABBIT_HOP,
|
RABBIT_HOP,
|
||||||
RABBIT_HURT,
|
RABBIT_HURT,
|
||||||
RABBIT_DEATH,
|
RABBIT_DEATH,
|
||||||
MOB_ATTACK;
|
MOB_ATTACK;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,60 +1,60 @@
|
||||||
package org.spacehq.mc.protocol.data.game.values.world;
|
package org.spacehq.mc.protocol.data.game.values.world;
|
||||||
|
|
||||||
public enum Particle {
|
public enum Particle {
|
||||||
EXPLOSION_NORMAL,
|
EXPLOSION_NORMAL,
|
||||||
EXPLOSION_LARGE,
|
EXPLOSION_LARGE,
|
||||||
EXPLOSION_HUGE,
|
EXPLOSION_HUGE,
|
||||||
FIREWORKS_SPARK,
|
FIREWORKS_SPARK,
|
||||||
WATER_BUBBLE,
|
WATER_BUBBLE,
|
||||||
WATER_SPLASH,
|
WATER_SPLASH,
|
||||||
WATER_WAKE,
|
WATER_WAKE,
|
||||||
SUSPENDED,
|
SUSPENDED,
|
||||||
SUSPENDED_DEPTH,
|
SUSPENDED_DEPTH,
|
||||||
CRIT,
|
CRIT,
|
||||||
CRIT_MAGIC,
|
CRIT_MAGIC,
|
||||||
SMOKE_NORMAL,
|
SMOKE_NORMAL,
|
||||||
SMOKE_LARGE,
|
SMOKE_LARGE,
|
||||||
SPELL,
|
SPELL,
|
||||||
SPELL_INSTANT,
|
SPELL_INSTANT,
|
||||||
SPELL_MOB,
|
SPELL_MOB,
|
||||||
SPELL_MOB_AMBIENT,
|
SPELL_MOB_AMBIENT,
|
||||||
SPELL_WITCH,
|
SPELL_WITCH,
|
||||||
DRIP_WATER,
|
DRIP_WATER,
|
||||||
DRIP_LAVA,
|
DRIP_LAVA,
|
||||||
VILLAGER_ANGRY,
|
VILLAGER_ANGRY,
|
||||||
VILLAGER_HAPPY,
|
VILLAGER_HAPPY,
|
||||||
TOWN_AURA,
|
TOWN_AURA,
|
||||||
NOTE,
|
NOTE,
|
||||||
PORTAL,
|
PORTAL,
|
||||||
ENCHANTMENT_TABLE,
|
ENCHANTMENT_TABLE,
|
||||||
FLAME,
|
FLAME,
|
||||||
LAVA,
|
LAVA,
|
||||||
FOOTSTEP,
|
FOOTSTEP,
|
||||||
CLOUD,
|
CLOUD,
|
||||||
REDSTONE,
|
REDSTONE,
|
||||||
SNOWBALL,
|
SNOWBALL,
|
||||||
SNOW_SHOVEL,
|
SNOW_SHOVEL,
|
||||||
SLIME,
|
SLIME,
|
||||||
HEART,
|
HEART,
|
||||||
BARRIER,
|
BARRIER,
|
||||||
ICON_CRACK(2),
|
ICON_CRACK(2),
|
||||||
BLOCK_CRACK(1),
|
BLOCK_CRACK(1),
|
||||||
BLOCK_DUST(1),
|
BLOCK_DUST(1),
|
||||||
WATER_DROP,
|
WATER_DROP,
|
||||||
ITEM_TAKE,
|
ITEM_TAKE,
|
||||||
MOB_APPEARANCE;
|
MOB_APPEARANCE;
|
||||||
|
|
||||||
private int dataLength;
|
private int dataLength;
|
||||||
|
|
||||||
private Particle() {
|
private Particle() {
|
||||||
this(0);
|
this(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Particle(int dataLength) {
|
private Particle(int dataLength) {
|
||||||
this.dataLength = dataLength;
|
this.dataLength = dataLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDataLength() {
|
public int getDataLength() {
|
||||||
return this.dataLength;
|
return this.dataLength;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package org.spacehq.mc.protocol.data.game.values.world;
|
package org.spacehq.mc.protocol.data.game.values.world;
|
||||||
|
|
||||||
public enum WorldBorderAction {
|
public enum WorldBorderAction {
|
||||||
SET_SIZE,
|
SET_SIZE,
|
||||||
LERP_SIZE,
|
LERP_SIZE,
|
||||||
SET_CENTER,
|
SET_CENTER,
|
||||||
INITIALIZE,
|
INITIALIZE,
|
||||||
SET_WARNING_TIME,
|
SET_WARNING_TIME,
|
||||||
SET_WARNING_BLOCKS;
|
SET_WARNING_BLOCKS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,12 @@ package org.spacehq.mc.protocol.data.game.values.world;
|
||||||
|
|
||||||
public enum WorldType {
|
public enum WorldType {
|
||||||
|
|
||||||
DEFAULT,
|
DEFAULT,
|
||||||
FLAT,
|
FLAT,
|
||||||
LARGE_BIOMES,
|
LARGE_BIOMES,
|
||||||
AMPLIFIED,
|
AMPLIFIED,
|
||||||
CUSTOMIZED,
|
CUSTOMIZED,
|
||||||
DEBUG,
|
DEBUG,
|
||||||
DEFAULT_1_1;
|
DEFAULT_1_1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,40 +4,40 @@ import org.spacehq.mc.protocol.data.game.Position;
|
||||||
|
|
||||||
public class BlockChangeRecord {
|
public class BlockChangeRecord {
|
||||||
|
|
||||||
private Position position;
|
private Position position;
|
||||||
private int block;
|
private int block;
|
||||||
|
|
||||||
public BlockChangeRecord(Position position, int block) {
|
public BlockChangeRecord(Position position, int block) {
|
||||||
this.position = position;
|
this.position = position;
|
||||||
this.block = block;
|
this.block = block;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Position getPosition() {
|
public Position getPosition() {
|
||||||
return this.position;
|
return this.position;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBlock() {
|
public int getBlock() {
|
||||||
return this.block;
|
return this.block;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
BlockChangeRecord record = (BlockChangeRecord) o;
|
BlockChangeRecord record = (BlockChangeRecord) o;
|
||||||
|
|
||||||
if (block != record.block) return false;
|
if(block != record.block) return false;
|
||||||
if (!position.equals(record.position)) return false;
|
if(!position.equals(record.position)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = position.hashCode();
|
int result = position.hashCode();
|
||||||
result = 31 * result + block;
|
result = 31 * result + block;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,48 +2,48 @@ package org.spacehq.mc.protocol.data.game.values.world.block;
|
||||||
|
|
||||||
public class ExplodedBlockRecord {
|
public class ExplodedBlockRecord {
|
||||||
|
|
||||||
private int x;
|
private int x;
|
||||||
private int y;
|
private int y;
|
||||||
private int z;
|
private int z;
|
||||||
|
|
||||||
public ExplodedBlockRecord(int x, int y, int z) {
|
public ExplodedBlockRecord(int x, int y, int z) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.z = z;
|
this.z = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getX() {
|
public int getX() {
|
||||||
return this.x;
|
return this.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getY() {
|
public int getY() {
|
||||||
return this.y;
|
return this.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getZ() {
|
public int getZ() {
|
||||||
return this.z;
|
return this.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
ExplodedBlockRecord that = (ExplodedBlockRecord) o;
|
ExplodedBlockRecord that = (ExplodedBlockRecord) o;
|
||||||
|
|
||||||
if (x != that.x) return false;
|
if(x != that.x) return false;
|
||||||
if (y != that.y) return false;
|
if(y != that.y) return false;
|
||||||
if (z != that.z) return false;
|
if(z != that.z) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = x;
|
int result = x;
|
||||||
result = 31 * result + y;
|
result = 31 * result + y;
|
||||||
result = 31 * result + z;
|
result = 31 * result + z;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@ package org.spacehq.mc.protocol.data.game.values.world.block;
|
||||||
|
|
||||||
public enum UpdatedTileType {
|
public enum UpdatedTileType {
|
||||||
|
|
||||||
MOB_SPAWNER,
|
MOB_SPAWNER,
|
||||||
COMMAND_BLOCK,
|
COMMAND_BLOCK,
|
||||||
BEACON,
|
BEACON,
|
||||||
SKULL,
|
SKULL,
|
||||||
FLOWER_POT,
|
FLOWER_POT,
|
||||||
BANNER;
|
BANNER;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,31 +2,31 @@ package org.spacehq.mc.protocol.data.game.values.world.block.value;
|
||||||
|
|
||||||
public class ChestValue implements BlockValue {
|
public class ChestValue implements BlockValue {
|
||||||
|
|
||||||
private int viewers;
|
private int viewers;
|
||||||
|
|
||||||
public ChestValue(int viewers) {
|
public ChestValue(int viewers) {
|
||||||
this.viewers = viewers;
|
this.viewers = viewers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getViewers() {
|
public int getViewers() {
|
||||||
return this.viewers;
|
return this.viewers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
ChestValue that = (ChestValue) o;
|
ChestValue that = (ChestValue) o;
|
||||||
|
|
||||||
if (viewers != that.viewers) return false;
|
if(viewers != that.viewers) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return viewers;
|
return viewers;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,6 @@ package org.spacehq.mc.protocol.data.game.values.world.block.value;
|
||||||
|
|
||||||
public enum ChestValueType implements BlockValueType {
|
public enum ChestValueType implements BlockValueType {
|
||||||
|
|
||||||
VIEWING_PLAYER_COUNT;
|
VIEWING_PLAYER_COUNT;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,31 +2,31 @@ package org.spacehq.mc.protocol.data.game.values.world.block.value;
|
||||||
|
|
||||||
public class GenericBlockValue implements BlockValue {
|
public class GenericBlockValue implements BlockValue {
|
||||||
|
|
||||||
private int value;
|
private int value;
|
||||||
|
|
||||||
public GenericBlockValue(int value) {
|
public GenericBlockValue(int value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getValue() {
|
public int getValue() {
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
GenericBlockValue that = (GenericBlockValue) o;
|
GenericBlockValue that = (GenericBlockValue) o;
|
||||||
|
|
||||||
if (value != that.value) return false;
|
if(value != that.value) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,6 @@ package org.spacehq.mc.protocol.data.game.values.world.block.value;
|
||||||
|
|
||||||
public enum GenericBlockValueType implements BlockValueType {
|
public enum GenericBlockValueType implements BlockValueType {
|
||||||
|
|
||||||
GENERIC;
|
GENERIC;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,6 @@ package org.spacehq.mc.protocol.data.game.values.world.block.value;
|
||||||
|
|
||||||
public enum MobSpawnerValueType implements BlockValueType {
|
public enum MobSpawnerValueType implements BlockValueType {
|
||||||
|
|
||||||
RESET_DELAY;
|
RESET_DELAY;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,35 +2,35 @@ package org.spacehq.mc.protocol.data.game.values.world.block.value;
|
||||||
|
|
||||||
public class NoteBlockValue implements BlockValue {
|
public class NoteBlockValue implements BlockValue {
|
||||||
|
|
||||||
private int pitch;
|
private int pitch;
|
||||||
|
|
||||||
public NoteBlockValue(int pitch) {
|
public NoteBlockValue(int pitch) {
|
||||||
if(pitch < 0 || pitch > 24) {
|
if(pitch < 0 || pitch > 24) {
|
||||||
throw new IllegalArgumentException("Pitch must be between 0 and 24.");
|
throw new IllegalArgumentException("Pitch must be between 0 and 24.");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.pitch = pitch;
|
this.pitch = pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPitch() {
|
public int getPitch() {
|
||||||
return this.pitch;
|
return this.pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
NoteBlockValue that = (NoteBlockValue) o;
|
NoteBlockValue that = (NoteBlockValue) o;
|
||||||
|
|
||||||
if (pitch != that.pitch) return false;
|
if(pitch != that.pitch) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return pitch;
|
return pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@ package org.spacehq.mc.protocol.data.game.values.world.block.value;
|
||||||
|
|
||||||
public enum NoteBlockValueType implements BlockValueType {
|
public enum NoteBlockValueType implements BlockValueType {
|
||||||
|
|
||||||
HARP,
|
HARP,
|
||||||
DOUBLE_BASS,
|
DOUBLE_BASS,
|
||||||
SNARE_DRUM,
|
SNARE_DRUM,
|
||||||
HI_HAT,
|
HI_HAT,
|
||||||
BASS_DRUM;
|
BASS_DRUM;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@ package org.spacehq.mc.protocol.data.game.values.world.block.value;
|
||||||
|
|
||||||
public enum PistonValue implements BlockValue {
|
public enum PistonValue implements BlockValue {
|
||||||
|
|
||||||
DOWN,
|
DOWN,
|
||||||
UP,
|
UP,
|
||||||
SOUTH,
|
SOUTH,
|
||||||
WEST,
|
WEST,
|
||||||
NORTH,
|
NORTH,
|
||||||
EAST;
|
EAST;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package org.spacehq.mc.protocol.data.game.values.world.block.value;
|
||||||
|
|
||||||
public enum PistonValueType implements BlockValueType {
|
public enum PistonValueType implements BlockValueType {
|
||||||
|
|
||||||
PUSHING,
|
PUSHING,
|
||||||
PULLING;
|
PULLING;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,31 +2,31 @@ package org.spacehq.mc.protocol.data.game.values.world.effect;
|
||||||
|
|
||||||
public class BreakBlockEffectData implements WorldEffectData {
|
public class BreakBlockEffectData implements WorldEffectData {
|
||||||
|
|
||||||
private int blockId;
|
private int blockId;
|
||||||
|
|
||||||
public BreakBlockEffectData(int blockId) {
|
public BreakBlockEffectData(int blockId) {
|
||||||
this.blockId = blockId;
|
this.blockId = blockId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBlockId() {
|
public int getBlockId() {
|
||||||
return this.blockId;
|
return this.blockId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
BreakBlockEffectData that = (BreakBlockEffectData) o;
|
BreakBlockEffectData that = (BreakBlockEffectData) o;
|
||||||
|
|
||||||
if (blockId != that.blockId) return false;
|
if(blockId != that.blockId) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return blockId;
|
return blockId;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,31 +2,31 @@ package org.spacehq.mc.protocol.data.game.values.world.effect;
|
||||||
|
|
||||||
public class BreakPotionEffectData implements WorldEffectData {
|
public class BreakPotionEffectData implements WorldEffectData {
|
||||||
|
|
||||||
private int potionId;
|
private int potionId;
|
||||||
|
|
||||||
public BreakPotionEffectData(int potionId) {
|
public BreakPotionEffectData(int potionId) {
|
||||||
this.potionId = potionId;
|
this.potionId = potionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPotionId() {
|
public int getPotionId() {
|
||||||
return this.potionId;
|
return this.potionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
BreakPotionEffectData that = (BreakPotionEffectData) o;
|
BreakPotionEffectData that = (BreakPotionEffectData) o;
|
||||||
|
|
||||||
if (potionId != that.potionId) return false;
|
if(potionId != that.potionId) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return potionId;
|
return potionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,31 +2,31 @@ package org.spacehq.mc.protocol.data.game.values.world.effect;
|
||||||
|
|
||||||
public class HardLandingEffectData implements WorldEffectData {
|
public class HardLandingEffectData implements WorldEffectData {
|
||||||
|
|
||||||
private int damagingDistance;
|
private int damagingDistance;
|
||||||
|
|
||||||
public HardLandingEffectData(int damagingDistance) {
|
public HardLandingEffectData(int damagingDistance) {
|
||||||
this.damagingDistance = damagingDistance;
|
this.damagingDistance = damagingDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDamagingDistance() {
|
public int getDamagingDistance() {
|
||||||
return this.damagingDistance;
|
return this.damagingDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
HardLandingEffectData that = (HardLandingEffectData) o;
|
HardLandingEffectData that = (HardLandingEffectData) o;
|
||||||
|
|
||||||
if (damagingDistance != that.damagingDistance) return false;
|
if(damagingDistance != that.damagingDistance) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return damagingDistance;
|
return damagingDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,12 @@ package org.spacehq.mc.protocol.data.game.values.world.effect;
|
||||||
|
|
||||||
public enum ParticleEffect implements WorldEffect {
|
public enum ParticleEffect implements WorldEffect {
|
||||||
|
|
||||||
SMOKE,
|
SMOKE,
|
||||||
BREAK_BLOCK,
|
BREAK_BLOCK,
|
||||||
BREAK_SPLASH_POTION,
|
BREAK_SPLASH_POTION,
|
||||||
BREAK_EYE_OF_ENDER,
|
BREAK_EYE_OF_ENDER,
|
||||||
MOB_SPAWN,
|
MOB_SPAWN,
|
||||||
BONEMEAL_GROW,
|
BONEMEAL_GROW,
|
||||||
HARD_LANDING_DUST;
|
HARD_LANDING_DUST;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue