mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-15 02:15:34 -04:00
really big refactoring
Enums now use a static array to ordinal mapping (values()) More structure (static final instead of final static) Write constants in CAPS
This commit is contained in:
parent
73f30fc45a
commit
16c5ff8c89
14
.idea/codeStyles/Project.xml
generated
14
.idea/codeStyles/Project.xml
generated
@ -12,6 +12,20 @@
|
||||
<editorconfig>
|
||||
<option name="ENABLED" value="false" />
|
||||
</editorconfig>
|
||||
<codeStyleSettings language="JAVA">
|
||||
<arrangement>
|
||||
<groups>
|
||||
<group>
|
||||
<type>GETTERS_AND_SETTERS</type>
|
||||
<order>KEEP</order>
|
||||
</group>
|
||||
<group>
|
||||
<type>OVERRIDDEN_METHODS</type>
|
||||
<order>BY_NAME</order>
|
||||
</group>
|
||||
</groups>
|
||||
</arrangement>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="kotlin">
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
</codeStyleSettings>
|
||||
|
1
.idea/codeStyles/codeStyleConfig.xml
generated
1
.idea/codeStyles/codeStyleConfig.xml
generated
@ -1,6 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</state>
|
||||
</component>
|
7
.idea/encodings.xml
generated
Normal file
7
.idea/encodings.xml
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
27
.idea/inspectionProfiles/Project_Default.xml
generated
27
.idea/inspectionProfiles/Project_Default.xml
generated
@ -1,11 +1,28 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="CharsetObjectCanBeUsed" enabled="true" level="ERROR" enabled_by_default="true" />
|
||||
<inspection_tool class="ConstantConditions" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="SUGGEST_NULLABLE_ANNOTATIONS" value="false" />
|
||||
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="false" />
|
||||
<option name="REPORT_CONSTANT_REFERENCE_VALUES" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="FieldNamingConvention" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<extension name="ConstantNamingConvention" enabled="true">
|
||||
<option name="m_regex" value="[A-Z][A-Z_\d]*" />
|
||||
<option name="m_minLength" value="2" />
|
||||
<option name="m_maxLength" value="60" />
|
||||
</extension>
|
||||
<extension name="ConstantWithMutableFieldTypeNamingConvention" enabled="true">
|
||||
<option name="m_regex" value="[A-Z][A-Z_\d]*" />
|
||||
<option name="m_minLength" value="2" />
|
||||
<option name="m_maxLength" value="60" />
|
||||
</extension>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="LiteralAsArgToStringEquals" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="MissortedModifiers" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="m_requireAnnotationsFirst" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PyPep8Inspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||
<option name="ignoredErrors">
|
||||
<list>
|
||||
@ -13,5 +30,15 @@
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="RedundantFieldInitialization" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="SizeReplaceableByIsEmpty" enabled="true" level="ERROR" enabled_by_default="true" />
|
||||
<inspection_tool class="UnnecessarilyQualifiedStaticUsage" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="m_ignoreStaticFieldAccesses" value="false" />
|
||||
<option name="m_ignoreStaticMethodCalls" value="false" />
|
||||
<option name="m_ignoreStaticAccessFromStaticContext" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="UnnecessaryConstantArrayCreationExpression" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="UnqualifiedFieldAccess" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="UpperCaseFieldNameNotConstant" enabled="true" level="ERROR" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
@ -13,7 +13,6 @@
|
||||
|
||||
package de.bixilon.minosoft;
|
||||
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.jfoenix.controls.JFXAlert;
|
||||
import com.jfoenix.controls.JFXDialogLayout;
|
||||
import de.bixilon.minosoft.config.Configuration;
|
||||
@ -43,13 +42,12 @@ import javafx.scene.text.Text;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class Minosoft {
|
||||
public static final HashSet<EventManager> eventManagers = new HashSet<>();
|
||||
private static final CountUpAndDownLatch startStatusLatch = new CountUpAndDownLatch(1);
|
||||
public static final HashSet<EventManager> EVENT_MANAGERS = new HashSet<>();
|
||||
private static final CountUpAndDownLatch START_STATUS_LATCH = new CountUpAndDownLatch(1);
|
||||
public static MojangAccount selectedAccount;
|
||||
public static Configuration config;
|
||||
|
||||
@ -65,10 +63,10 @@ public final class Minosoft {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (StartProgressWindow.toolkitLatch.getCount() == 2) {
|
||||
if (StartProgressWindow.TOOLKIT_LATCH.getCount() == 2) {
|
||||
StartProgressWindow.start();
|
||||
}
|
||||
StartProgressWindow.toolkitLatch.await();
|
||||
StartProgressWindow.TOOLKIT_LATCH.await();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
@ -117,20 +115,6 @@ public final class Minosoft {
|
||||
progress.countDown();
|
||||
}, "Configuration", String.format("Load config file (%s)", StaticConfiguration.CONFIG_FILENAME), Priorities.HIGHEST, TaskImportance.REQUIRED));
|
||||
|
||||
taskWorker.addTask(new Task((progress) -> {
|
||||
if (StaticConfiguration.HEADLESS_MODE) {
|
||||
return;
|
||||
}
|
||||
StartProgressWindow.start();
|
||||
}, "JavaFX Toolkit", "Initialize JavaFX", Priorities.HIGHEST));
|
||||
|
||||
taskWorker.addTask(new Task((progress) -> {
|
||||
if (StaticConfiguration.HEADLESS_MODE) {
|
||||
return;
|
||||
}
|
||||
StartProgressWindow.show(startStatusLatch);
|
||||
}, "Progress Window", "Display progress window", Priorities.HIGH, TaskImportance.OPTIONAL, "JavaFX Toolkit", "Configuration"));
|
||||
|
||||
taskWorker.addTask(new Task(progress -> {
|
||||
progress.countUp();
|
||||
LocaleManager.load(config.getString(ConfigurationPaths.StringPaths.GENERAL_LANGUAGE));
|
||||
@ -179,9 +163,14 @@ public final class Minosoft {
|
||||
progress.countDown();
|
||||
}, "LAN Server Listener", "Listener for LAN Servers", Priorities.LOWEST, TaskImportance.OPTIONAL, "Configuration"));
|
||||
|
||||
taskWorker.work(startStatusLatch);
|
||||
if (!StaticConfiguration.HEADLESS_MODE) {
|
||||
taskWorker.addTask(new Task((progress) -> StartProgressWindow.start(), "JavaFX Toolkit", "Initialize JavaFX", Priorities.HIGHEST));
|
||||
|
||||
taskWorker.addTask(new Task((progress) -> StartProgressWindow.show(START_STATUS_LATCH), "Progress Window", "Display progress window", Priorities.HIGH, TaskImportance.OPTIONAL, "JavaFX Toolkit", "Configuration"));
|
||||
}
|
||||
taskWorker.work(START_STATUS_LATCH);
|
||||
try {
|
||||
startStatusLatch.waitUntilZero();
|
||||
START_STATUS_LATCH.waitUntilZero();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -209,7 +198,7 @@ public final class Minosoft {
|
||||
MojangAccount.RefreshStates refreshState = account.refreshToken();
|
||||
if (refreshState == MojangAccount.RefreshStates.ERROR) {
|
||||
account.delete();
|
||||
AccountListCell.listView.getItems().remove(account);
|
||||
AccountListCell.MOJANG_ACCOUNT_LIST_VIEW.getItems().remove(account);
|
||||
selectedAccount = null;
|
||||
return;
|
||||
}
|
||||
@ -232,13 +221,13 @@ public final class Minosoft {
|
||||
*/
|
||||
public static void waitForStartup() {
|
||||
try {
|
||||
startStatusLatch.waitUntilZero();
|
||||
START_STATUS_LATCH.waitUntilZero();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static CountUpAndDownLatch getStartStatusLatch() {
|
||||
return startStatusLatch;
|
||||
return START_STATUS_LATCH;
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ import java.util.Map;
|
||||
|
||||
public class Configuration {
|
||||
public static final int LATEST_CONFIG_VERSION = 1;
|
||||
private final static JsonObject DEFAULT_CONFIGURATION = JsonParser.parseReader(new InputStreamReader(Configuration.class.getResourceAsStream("/config/" + StaticConfiguration.CONFIG_FILENAME))).getAsJsonObject();
|
||||
private static final JsonObject DEFAULT_CONFIGURATION = JsonParser.parseReader(new InputStreamReader(Configuration.class.getResourceAsStream("/config/" + StaticConfiguration.CONFIG_FILENAME))).getAsJsonObject();
|
||||
private final HashMap<ConfigurationPaths.ConfigurationPath, Object> config = new HashMap<>();
|
||||
private final HashBiMap<String, MojangAccount> accountList = HashBiMap.create();
|
||||
private final HashBiMap<Integer, Server> serverList = HashBiMap.create();
|
||||
@ -52,7 +52,6 @@ public class Configuration {
|
||||
|
||||
JsonObject json = Util.readJsonFromFile(file.getAbsolutePath());
|
||||
|
||||
|
||||
int configVersion = (int) getData(json, ConfigurationPaths.IntegerPaths.GENERAL_CONFIG_VERSION);
|
||||
if (configVersion > LATEST_CONFIG_VERSION) {
|
||||
throw new ConfigMigrationException(String.format("Configuration was migrated to newer config format (version=%d, expected=%d). Downgrading the config file is unsupported!", configVersion, LATEST_CONFIG_VERSION));
|
||||
@ -62,27 +61,27 @@ public class Configuration {
|
||||
}
|
||||
|
||||
for (ConfigurationPaths.ConfigurationPath path : ConfigurationPaths.ALL_PATHS) {
|
||||
config.put(path, getData(json, path));
|
||||
this.config.put(path, getData(json, path));
|
||||
}
|
||||
|
||||
// servers
|
||||
for (Map.Entry<String, JsonElement> entry : json.getAsJsonObject("servers").getAsJsonObject("entries").entrySet()) {
|
||||
serverList.put(Integer.parseInt(entry.getKey()), Server.deserialize(entry.getValue().getAsJsonObject()));
|
||||
this.serverList.put(Integer.parseInt(entry.getKey()), Server.deserialize(entry.getValue().getAsJsonObject()));
|
||||
}
|
||||
|
||||
// accounts
|
||||
for (Map.Entry<String, JsonElement> entry : json.getAsJsonObject("accounts").getAsJsonObject("entries").entrySet()) {
|
||||
MojangAccount account = MojangAccount.deserialize(entry.getValue().getAsJsonObject());
|
||||
accountList.put(account.getUserId(), account);
|
||||
this.accountList.put(account.getUserId(), account);
|
||||
}
|
||||
|
||||
final File finalFile = file;
|
||||
new Thread(() -> {
|
||||
while (true) {
|
||||
// wait for interrupt
|
||||
synchronized (lock) {
|
||||
synchronized (this.lock) {
|
||||
try {
|
||||
lock.wait();
|
||||
this.lock.wait();
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
}
|
||||
@ -97,23 +96,23 @@ public class Configuration {
|
||||
return;
|
||||
}
|
||||
JsonObject jsonObject = DEFAULT_CONFIGURATION.deepCopy();
|
||||
synchronized (config) {
|
||||
synchronized (this.config) {
|
||||
|
||||
// accounts
|
||||
JsonObject accountsEntriesJson = jsonObject.getAsJsonObject("servers").getAsJsonObject("entries");
|
||||
for (Map.Entry<Integer, Server> entry : serverList.entrySet()) {
|
||||
for (Map.Entry<Integer, Server> entry : this.serverList.entrySet()) {
|
||||
accountsEntriesJson.add(String.valueOf(entry.getKey()), entry.getValue().serialize());
|
||||
}
|
||||
|
||||
// servers
|
||||
JsonObject serversEntriesJson = jsonObject.getAsJsonObject("accounts").getAsJsonObject("entries");
|
||||
for (Map.Entry<String, MojangAccount> entry : accountList.entrySet()) {
|
||||
for (Map.Entry<String, MojangAccount> entry : this.accountList.entrySet()) {
|
||||
serversEntriesJson.add(entry.getKey(), entry.getValue().serialize());
|
||||
}
|
||||
|
||||
// rest of data
|
||||
for (ConfigurationPaths.ConfigurationPath path : ConfigurationPaths.ALL_PATHS) {
|
||||
saveData(jsonObject, path, config.get(path));
|
||||
saveData(jsonObject, path, this.config.get(path));
|
||||
}
|
||||
}
|
||||
gson.toJson(jsonObject, writer);
|
||||
@ -137,57 +136,57 @@ public class Configuration {
|
||||
}
|
||||
|
||||
public boolean getBoolean(ConfigurationPaths.BooleanPaths path) {
|
||||
return (boolean) config.get(path);
|
||||
return (boolean) this.config.get(path);
|
||||
}
|
||||
|
||||
public void putBoolean(ConfigurationPaths.BooleanPaths path, boolean value) {
|
||||
config.put(path, value);
|
||||
this.config.put(path, value);
|
||||
}
|
||||
|
||||
public int getInt(ConfigurationPaths.IntegerPaths path) {
|
||||
return (int) config.get(path);
|
||||
return (int) this.config.get(path);
|
||||
}
|
||||
|
||||
public void putInt(ConfigurationPaths.IntegerPaths path, int value) {
|
||||
config.put(path, value);
|
||||
this.config.put(path, value);
|
||||
}
|
||||
|
||||
public String getString(ConfigurationPaths.StringPaths path) {
|
||||
return (String) config.get(path);
|
||||
return (String) this.config.get(path);
|
||||
}
|
||||
|
||||
public void putString(ConfigurationPaths.StringPaths path, String value) {
|
||||
config.put(path, value);
|
||||
this.config.put(path, value);
|
||||
}
|
||||
|
||||
public void putMojangAccount(MojangAccount account) {
|
||||
accountList.put(account.getUserId(), account);
|
||||
this.accountList.put(account.getUserId(), account);
|
||||
}
|
||||
|
||||
public void putServer(Server server) {
|
||||
serverList.put(server.getId(), server);
|
||||
this.serverList.put(server.getId(), server);
|
||||
}
|
||||
|
||||
public void removeServer(Server server) {
|
||||
serverList.remove(server.getId());
|
||||
this.serverList.remove(server.getId());
|
||||
}
|
||||
|
||||
public void saveToFile() {
|
||||
synchronized (lock) {
|
||||
lock.notifyAll();
|
||||
synchronized (this.lock) {
|
||||
this.lock.notifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
public void removeAccount(MojangAccount account) {
|
||||
accountList.remove(account.getUserId());
|
||||
this.accountList.remove(account.getUserId());
|
||||
}
|
||||
|
||||
public HashBiMap<Integer, Server> getServerList() {
|
||||
return serverList;
|
||||
return this.serverList;
|
||||
}
|
||||
|
||||
public HashBiMap<String, MojangAccount> getAccountList() {
|
||||
return accountList;
|
||||
return this.accountList;
|
||||
}
|
||||
|
||||
private void migrateConfiguration() throws ConfigMigrationException {
|
||||
|
@ -17,7 +17,7 @@ import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
||||
public abstract class ConfigurationPaths {
|
||||
static HashSet<ConfigurationPath> ALL_PATHS = new HashSet<>();
|
||||
public static final HashSet<ConfigurationPath> ALL_PATHS = new HashSet<>();
|
||||
|
||||
static {
|
||||
ALL_PATHS.addAll(Arrays.asList(StringPaths.values()));
|
||||
|
@ -22,11 +22,11 @@ public class StaticConfiguration {
|
||||
public static final boolean DEBUG_MODE = false; // if true, additional checks will be made to validate data, ... Decreases performance
|
||||
public static final boolean DEBUG_SLOW_LOADING = false; // if true, many Thread.sleep will be executed and the start will be delayed (by a lot)
|
||||
public static String CONFIG_FILENAME = "config.json"; // Filename of minosoft's base configuration (located in AppData/Minosoft/config)
|
||||
public static boolean SKIP_MOJANG_AUTHENTICATION = false; // disables all connections to mojang
|
||||
public static boolean SKIP_MOJANG_AUTHENTICATION; // disables all connections to mojang
|
||||
public static boolean COLORED_LOG = true; // the log should be colored with ANSI (does not affect base components)
|
||||
public static boolean LOG_RELATIVE_TIME = false; // prefix all log messages with the relative start time in milliseconds instead of the formatted time
|
||||
public static boolean VERBOSE_ENTITY_META_DATA_LOGGING = false; // if true, the entity meta data is getting serialized
|
||||
public static boolean HEADLESS_MODE = false; // if true, no gui, rendering or whatever will be loaded or shown
|
||||
public static boolean LOG_RELATIVE_TIME; // prefix all log messages with the relative start time in milliseconds instead of the formatted time
|
||||
public static boolean VERBOSE_ENTITY_META_DATA_LOGGING; // if true, the entity meta data is getting serialized
|
||||
public static boolean HEADLESS_MODE; // if true, no gui, rendering or whatever will be loaded or shown
|
||||
public static String HOME_DIRECTORY;
|
||||
public static final String TEMPORARY_FOLDER = System.getProperty("java.io.tmpdir", HOME_DIRECTORY + "/tmp/") + "/";
|
||||
|
||||
|
@ -22,13 +22,13 @@ public class ChangeableIdentifier extends VersionValueMap<String> {
|
||||
String mod = ProtocolDefinition.DEFAULT_MOD;
|
||||
|
||||
public ChangeableIdentifier(String legacy, String water) {
|
||||
values.put(Versions.LOWEST_VERSION_SUPPORTED.getVersionId(), legacy);
|
||||
values.put(ProtocolDefinition.FLATTING_VERSION_ID, water);
|
||||
this.values.put(Versions.LOWEST_VERSION_SUPPORTED.getVersionId(), legacy);
|
||||
this.values.put(ProtocolDefinition.FLATTING_VERSION_ID, water);
|
||||
}
|
||||
|
||||
public ChangeableIdentifier(String legacy, String water, String mod) {
|
||||
values.put(Versions.LOWEST_VERSION_SUPPORTED.getVersionId(), legacy);
|
||||
values.put(ProtocolDefinition.FLATTING_VERSION_ID, water);
|
||||
this.values.put(Versions.LOWEST_VERSION_SUPPORTED.getVersionId(), legacy);
|
||||
this.values.put(ProtocolDefinition.FLATTING_VERSION_ID, water);
|
||||
this.mod = mod;
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ public class ChangeableIdentifier extends VersionValueMap<String> {
|
||||
name = name.toLowerCase();
|
||||
if (name.indexOf(":") != 0) {
|
||||
String[] splitName = name.split(":", 2);
|
||||
if (!mod.equals(splitName[0])) {
|
||||
if (!this.mod.equals(splitName[0])) {
|
||||
// mod is not correct
|
||||
return false;
|
||||
}
|
||||
|
@ -18,7 +18,9 @@ public enum ChatTextPositions {
|
||||
SYSTEM_MESSAGE,
|
||||
ABOVE_HOTBAR;
|
||||
|
||||
private static final ChatTextPositions[] CHAT_TEXT_POSITIONS = values();
|
||||
|
||||
public static ChatTextPositions byId(int id) {
|
||||
return values()[id];
|
||||
return CHAT_TEXT_POSITIONS[id];
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,9 @@ public enum Difficulties {
|
||||
NORMAL,
|
||||
HARD;
|
||||
|
||||
private static final Difficulties[] DIFFICULTIES = values();
|
||||
|
||||
public static Difficulties byId(int id) {
|
||||
return values()[id];
|
||||
return DIFFICULTIES[id];
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,9 @@ public enum Directions {
|
||||
WEST,
|
||||
EAST;
|
||||
|
||||
private static final Directions[] DIRECTIONS = values();
|
||||
|
||||
public static Directions byId(int id) {
|
||||
return values()[id];
|
||||
return DIRECTIONS[id];
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,9 @@ public enum GameModes {
|
||||
ADVENTURE,
|
||||
SPECTATOR;
|
||||
|
||||
private static final GameModes[] GAME_MODES = values();
|
||||
|
||||
public static GameModes byId(int id) {
|
||||
return values()[id];
|
||||
return GAME_MODES[id];
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,6 @@ public enum LevelTypes {
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return type;
|
||||
return this.type;
|
||||
}
|
||||
}
|
||||
|
@ -26,12 +26,12 @@ public class MapSet<K, V> implements Map.Entry<K, V> {
|
||||
|
||||
@Override
|
||||
public K getKey() {
|
||||
return key;
|
||||
return this.key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V getValue() {
|
||||
return value;
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,7 +45,7 @@ public class Player {
|
||||
int level;
|
||||
int totalExperience;
|
||||
PlayerEntity entity;
|
||||
boolean spawnConfirmed = false;
|
||||
boolean spawnConfirmed;
|
||||
|
||||
ChatComponent tabHeader;
|
||||
ChatComponent tabFooter;
|
||||
@ -53,15 +53,15 @@ public class Player {
|
||||
public Player(MojangAccount account) {
|
||||
this.account = account;
|
||||
// create our own inventory without any properties
|
||||
inventories.put(PLAYER_INVENTORY_ID, new Inventory(null));
|
||||
this.inventories.put(PLAYER_INVENTORY_ID, new Inventory(null));
|
||||
}
|
||||
|
||||
public String getPlayerName() {
|
||||
return account.getPlayerName();
|
||||
return this.account.getPlayerName();
|
||||
}
|
||||
|
||||
public UUID getPlayerUUID() {
|
||||
return account.getUUID();
|
||||
return this.account.getUUID();
|
||||
}
|
||||
|
||||
public MojangAccount getAccount() {
|
||||
@ -69,7 +69,7 @@ public class Player {
|
||||
}
|
||||
|
||||
public float getHealth() {
|
||||
return health;
|
||||
return this.health;
|
||||
}
|
||||
|
||||
public void setHealth(float health) {
|
||||
@ -77,7 +77,7 @@ public class Player {
|
||||
}
|
||||
|
||||
public int getFood() {
|
||||
return food;
|
||||
return this.food;
|
||||
}
|
||||
|
||||
public void setFood(int food) {
|
||||
@ -85,7 +85,7 @@ public class Player {
|
||||
}
|
||||
|
||||
public float getSaturation() {
|
||||
return saturation;
|
||||
return this.saturation;
|
||||
}
|
||||
|
||||
public void setSaturation(float saturation) {
|
||||
@ -93,7 +93,7 @@ public class Player {
|
||||
}
|
||||
|
||||
public BlockPosition getSpawnLocation() {
|
||||
return spawnLocation;
|
||||
return this.spawnLocation;
|
||||
}
|
||||
|
||||
public void setSpawnLocation(BlockPosition spawnLocation) {
|
||||
@ -101,7 +101,7 @@ public class Player {
|
||||
}
|
||||
|
||||
public GameModes getGameMode() {
|
||||
return gameMode;
|
||||
return this.gameMode;
|
||||
}
|
||||
|
||||
public void setGameMode(GameModes gameMode) {
|
||||
@ -109,11 +109,11 @@ public class Player {
|
||||
}
|
||||
|
||||
public World getWorld() {
|
||||
return world;
|
||||
return this.world;
|
||||
}
|
||||
|
||||
public byte getSelectedSlot() {
|
||||
return selectedSlot;
|
||||
return this.selectedSlot;
|
||||
}
|
||||
|
||||
public void setSelectedSlot(byte selectedSlot) {
|
||||
@ -121,7 +121,7 @@ public class Player {
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
return this.level;
|
||||
}
|
||||
|
||||
public void setLevel(int level) {
|
||||
@ -129,7 +129,7 @@ public class Player {
|
||||
}
|
||||
|
||||
public int getTotalExperience() {
|
||||
return totalExperience;
|
||||
return this.totalExperience;
|
||||
}
|
||||
|
||||
public void setTotalExperience(int totalExperience) {
|
||||
@ -151,11 +151,11 @@ public class Player {
|
||||
}
|
||||
|
||||
public void setSlot(int windowId, int slot, Slot data) {
|
||||
inventories.get(windowId).setSlot(slot, data);
|
||||
this.inventories.get(windowId).setSlot(slot, data);
|
||||
}
|
||||
|
||||
public Inventory getInventory(int id) {
|
||||
return inventories.get(id);
|
||||
return this.inventories.get(id);
|
||||
}
|
||||
|
||||
public Slot getSlot(int windowId, InventorySlots.InventoryInterface slot, int versionId) {
|
||||
@ -163,7 +163,7 @@ public class Player {
|
||||
}
|
||||
|
||||
public Slot getSlot(int windowId, int slot) {
|
||||
return inventories.get(windowId).getSlot(slot);
|
||||
return this.inventories.get(windowId).getSlot(slot);
|
||||
}
|
||||
|
||||
public void setSlot(int windowId, InventorySlots.InventoryInterface slot, int versionId, Slot data) {
|
||||
@ -171,15 +171,15 @@ public class Player {
|
||||
}
|
||||
|
||||
public void createInventory(InventoryProperties properties) {
|
||||
inventories.put(properties.getWindowId(), new Inventory(properties));
|
||||
this.inventories.put(properties.getWindowId(), new Inventory(properties));
|
||||
}
|
||||
|
||||
public void deleteInventory(int windowId) {
|
||||
inventories.remove(windowId);
|
||||
this.inventories.remove(windowId);
|
||||
}
|
||||
|
||||
public boolean isSpawnConfirmed() {
|
||||
return spawnConfirmed;
|
||||
return this.spawnConfirmed;
|
||||
}
|
||||
|
||||
public void setSpawnConfirmed(boolean spawnConfirmed) {
|
||||
@ -187,16 +187,16 @@ public class Player {
|
||||
}
|
||||
|
||||
public ScoreboardManager getScoreboardManager() {
|
||||
return scoreboardManager;
|
||||
return this.scoreboardManager;
|
||||
}
|
||||
|
||||
public HashMap<UUID, PlayerListItem> getPlayerList() {
|
||||
return playerList;
|
||||
return this.playerList;
|
||||
}
|
||||
|
||||
public PlayerListItem getPlayerListItem(String name) {
|
||||
// only legacy
|
||||
for (PlayerListItem listItem : playerList.values()) {
|
||||
for (PlayerListItem listItem : this.playerList.values()) {
|
||||
if (listItem.getName().equals(name)) {
|
||||
return listItem;
|
||||
}
|
||||
@ -205,7 +205,7 @@ public class Player {
|
||||
}
|
||||
|
||||
public ChatComponent getTabHeader() {
|
||||
return tabHeader;
|
||||
return this.tabHeader;
|
||||
}
|
||||
|
||||
public void setTabHeader(ChatComponent tabHeader) {
|
||||
@ -213,7 +213,7 @@ public class Player {
|
||||
}
|
||||
|
||||
public ChatComponent getTabFooter() {
|
||||
return tabFooter;
|
||||
return this.tabFooter;
|
||||
}
|
||||
|
||||
public void setTabFooter(ChatComponent tabFooter) {
|
||||
@ -221,7 +221,7 @@ public class Player {
|
||||
}
|
||||
|
||||
public PlayerEntity getEntity() {
|
||||
return entity;
|
||||
return this.entity;
|
||||
}
|
||||
|
||||
public void setEntity(PlayerEntity entity) {
|
||||
|
@ -29,11 +29,11 @@ public class PlayerPropertyData {
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public String getSignature() {
|
||||
return signature;
|
||||
return this.signature;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,7 +25,9 @@ public enum SoundCategories {
|
||||
AMBIENT,
|
||||
VOICE;
|
||||
|
||||
private static final SoundCategories[] SOUND_CATEGORIES = values();
|
||||
|
||||
public static SoundCategories byId(int id) {
|
||||
return values()[id];
|
||||
return SOUND_CATEGORIES[id];
|
||||
}
|
||||
}
|
||||
|
@ -23,10 +23,10 @@ public class Tag {
|
||||
}
|
||||
|
||||
public String getIdentifier() {
|
||||
return identifier;
|
||||
return this.identifier;
|
||||
}
|
||||
|
||||
public int[] getIdList() {
|
||||
return idList;
|
||||
return this.idList;
|
||||
}
|
||||
}
|
||||
|
@ -39,38 +39,38 @@ public class Trade {
|
||||
}
|
||||
|
||||
public Slot getInput1() {
|
||||
return input1;
|
||||
return this.input1;
|
||||
}
|
||||
|
||||
public Slot getInput2() {
|
||||
return input2;
|
||||
return this.input2;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
return this.enabled;
|
||||
}
|
||||
|
||||
public int getUsages() {
|
||||
return usages;
|
||||
return this.usages;
|
||||
}
|
||||
|
||||
public int getMaxUsages() {
|
||||
return maxUsages;
|
||||
return this.maxUsages;
|
||||
}
|
||||
|
||||
public int getXp() {
|
||||
return xp;
|
||||
return this.xp;
|
||||
}
|
||||
|
||||
public int getSpecialPrice() {
|
||||
return specialPrice;
|
||||
return this.specialPrice;
|
||||
}
|
||||
|
||||
public float getPriceMultiplier() {
|
||||
return priceMultiplier;
|
||||
return this.priceMultiplier;
|
||||
}
|
||||
|
||||
public int getDemand() {
|
||||
return demand;
|
||||
return this.demand;
|
||||
}
|
||||
}
|
||||
|
@ -26,16 +26,16 @@ public class VersionValueMap<V> {
|
||||
|
||||
public VersionValueMap(MapSet<Integer, V>[] sets, boolean unused) {
|
||||
for (MapSet<Integer, V> set : sets) {
|
||||
values.put(set.getKey(), set.getValue());
|
||||
this.values.put(set.getKey(), set.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
public VersionValueMap(V value) {
|
||||
values.put(Versions.LOWEST_VERSION_SUPPORTED.getVersionId(), value);
|
||||
this.values.put(Versions.LOWEST_VERSION_SUPPORTED.getVersionId(), value);
|
||||
}
|
||||
|
||||
public V get(int versionId) {
|
||||
Map.Entry<Integer, V> value = values.lowerEntry(versionId);
|
||||
Map.Entry<Integer, V> value = this.values.lowerEntry(versionId);
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
@ -53,6 +53,6 @@ public class VersionValueMap<V> {
|
||||
}
|
||||
|
||||
public TreeMap<Integer, V> getAll() {
|
||||
return values;
|
||||
return this.values;
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class AssetsManager {
|
||||
public static final String ASSETS_CLIENT_JAR_HASH = "f6581c4fd25cde00eecf003354cedc450390eb82"; // sha1 hash of file generated by minosoft (client jar file mappings: name -> hash)
|
||||
public static final String[] RELEVANT_ASSETS = {"minecraft/lang/", "minecraft/sounds/", "minecraft/textures/", "minecraft/font/"};
|
||||
|
||||
private static final HashMap<String, String> assets = new HashMap<>();
|
||||
private static final HashMap<String, String> ASSETS_MAP = new HashMap<>();
|
||||
|
||||
public static void downloadAssetsIndex() throws IOException {
|
||||
Util.downloadFileAsGz(String.format("https://launchermeta.mojang.com/v1/packages/%s/%s.json", ASSETS_INDEX_HASH, ASSETS_INDEX_VERSION), getAssetDiskPath(ASSETS_INDEX_HASH));
|
||||
@ -71,7 +71,7 @@ public class AssetsManager {
|
||||
}
|
||||
|
||||
public static void downloadAllAssets(CountUpAndDownLatch latch) throws IOException {
|
||||
if (assets.size() > 0) {
|
||||
if (!ASSETS_MAP.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@ -80,12 +80,12 @@ public class AssetsManager {
|
||||
Log.printException(e, LogLevels.DEBUG);
|
||||
Log.warn("Could not download assets index. Please check your internet connection");
|
||||
}
|
||||
assets.putAll(verifyAssets(AssetsSource.MOJANG, latch, parseAssetsIndex(ASSETS_INDEX_HASH)));
|
||||
assets.putAll(verifyAssets(AssetsSource.MINOSOFT_GIT, latch, parseAssetsIndex(Util.readJsonAsset("mapping/resources.json"))));
|
||||
ASSETS_MAP.putAll(verifyAssets(AssetsSource.MOJANG, latch, parseAssetsIndex(ASSETS_INDEX_HASH)));
|
||||
ASSETS_MAP.putAll(verifyAssets(AssetsSource.MINOSOFT_GIT, latch, parseAssetsIndex(Util.readJsonAsset("mapping/resources.json"))));
|
||||
latch.addCount(1); // client jar
|
||||
// download assets
|
||||
generateJarAssets();
|
||||
assets.putAll(parseAssetsIndex(ASSETS_CLIENT_JAR_HASH));
|
||||
ASSETS_MAP.putAll(parseAssetsIndex(ASSETS_CLIENT_JAR_HASH));
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ public class AssetsManager {
|
||||
Thread.sleep(100L);
|
||||
}
|
||||
if (!verifyAssetHash(hash, compressed)) {
|
||||
AssetsManager.downloadAsset(source, hash);
|
||||
downloadAsset(source, hash);
|
||||
}
|
||||
latch.countDown();
|
||||
} catch (Exception e) {
|
||||
@ -111,23 +111,23 @@ public class AssetsManager {
|
||||
}
|
||||
|
||||
public static boolean doesAssetExist(String name) {
|
||||
return assets.containsKey(name);
|
||||
return ASSETS_MAP.containsKey(name);
|
||||
}
|
||||
|
||||
public static HashMap<String, String> getAssets() {
|
||||
return assets;
|
||||
public static HashMap<String, String> getAssetsMap() {
|
||||
return ASSETS_MAP;
|
||||
}
|
||||
|
||||
public static InputStreamReader readAsset(String name) throws IOException {
|
||||
return readAssetByHash(assets.get(name));
|
||||
return readAssetByHash(ASSETS_MAP.get(name));
|
||||
}
|
||||
|
||||
public static InputStream readAssetAsStream(String name) throws IOException {
|
||||
return readAssetAsStreamByHash(assets.get(name));
|
||||
return readAssetAsStreamByHash(ASSETS_MAP.get(name));
|
||||
}
|
||||
|
||||
public static JsonElement readJsonAsset(String name) throws IOException {
|
||||
return readJsonAssetByHash(assets.get(name));
|
||||
return readJsonAssetByHash(ASSETS_MAP.get(name));
|
||||
}
|
||||
|
||||
private static void downloadAsset(AssetsSource source, String hash) throws Exception {
|
||||
|
@ -31,11 +31,11 @@ public class CommandArgumentNode extends CommandLiteralNode {
|
||||
|
||||
public CommandArgumentNode(byte flags, InByteBuffer buffer) {
|
||||
super(flags, buffer);
|
||||
parser = CommandParsers.INSTANCE.getParserInstance(buffer.readIdentifier());
|
||||
properties = parser.readParserProperties(buffer);
|
||||
this.parser = CommandParsers.INSTANCE.getParserInstance(buffer.readIdentifier());
|
||||
this.properties = this.parser.readParserProperties(buffer);
|
||||
if (BitByte.isBitMask(flags, 0x10)) {
|
||||
String fullIdentifier = buffer.readIdentifier().getFullIdentifier();
|
||||
suggestionType = switch (fullIdentifier) {
|
||||
this.suggestionType = switch (fullIdentifier) {
|
||||
case "minecraft:ask_server" -> CommandArgumentNode.SuggestionTypes.ASK_SERVER;
|
||||
case "minecraft:all_recipes" -> CommandArgumentNode.SuggestionTypes.ALL_RECIPES;
|
||||
case "minecraft:available_sounds" -> CommandArgumentNode.SuggestionTypes.AVAILABLE_SOUNDS;
|
||||
@ -44,26 +44,26 @@ public class CommandArgumentNode extends CommandLiteralNode {
|
||||
default -> throw new IllegalStateException("Unexpected value: " + fullIdentifier);
|
||||
};
|
||||
} else {
|
||||
suggestionType = null;
|
||||
this.suggestionType = null;
|
||||
}
|
||||
}
|
||||
|
||||
public CommandParser getParser() {
|
||||
return parser;
|
||||
return this.parser;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ParserProperties getProperties() {
|
||||
return properties;
|
||||
return this.properties;
|
||||
}
|
||||
|
||||
public SuggestionTypes getSuggestionType() {
|
||||
return suggestionType;
|
||||
return this.suggestionType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void isSyntaxCorrect(Connection connection, ImprovedStringReader stringReader) throws CommandParseException {
|
||||
parser.isParsable(connection, properties, stringReader);
|
||||
this.parser.isParsable(connection, this.properties, stringReader);
|
||||
super.isSyntaxCorrect(connection, stringReader);
|
||||
}
|
||||
|
||||
|
@ -20,10 +20,10 @@ public class CommandLiteralNode extends CommandNode {
|
||||
|
||||
public CommandLiteralNode(byte flags, InByteBuffer buffer) {
|
||||
super(flags, buffer);
|
||||
name = buffer.readString();
|
||||
this.name = buffer.readString();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
|
@ -36,28 +36,28 @@ public abstract class CommandNode {
|
||||
|
||||
public CommandNode(byte flags, InByteBuffer buffer) {
|
||||
this.isExecutable = BitByte.isBitMask(flags, 0x04);
|
||||
childrenIds = buffer.readVarIntArray();
|
||||
this.childrenIds = buffer.readVarIntArray();
|
||||
if (BitByte.isBitMask(flags, 0x08)) {
|
||||
redirectNodeId = buffer.readVarInt();
|
||||
this.redirectNodeId = buffer.readVarInt();
|
||||
} else {
|
||||
redirectNodeId = -1;
|
||||
this.redirectNodeId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isExecutable() {
|
||||
return isExecutable;
|
||||
return this.isExecutable;
|
||||
}
|
||||
|
||||
public HashMap<String, CommandLiteralNode> getLiteralChildren() {
|
||||
return literalChildren;
|
||||
return this.literalChildren;
|
||||
}
|
||||
|
||||
public HashSet<CommandArgumentNode> getArgumentsChildren() {
|
||||
return argumentsChildren;
|
||||
return this.argumentsChildren;
|
||||
}
|
||||
|
||||
public CommandNode getRedirectNode() {
|
||||
return redirectNode;
|
||||
return this.redirectNode;
|
||||
}
|
||||
|
||||
@DoNotCall
|
||||
@ -70,29 +70,29 @@ public abstract class CommandNode {
|
||||
|
||||
@DoNotCall
|
||||
public int getRedirectNodeId() {
|
||||
return redirectNodeId;
|
||||
return this.redirectNodeId;
|
||||
}
|
||||
|
||||
@DoNotCall
|
||||
public int[] getChildrenIds() {
|
||||
return childrenIds;
|
||||
return this.childrenIds;
|
||||
}
|
||||
|
||||
public void isSyntaxCorrect(Connection connection, ImprovedStringReader stringReader) throws CommandParseException {
|
||||
String nextArgument = stringReader.getUntilNextCommandArgument();
|
||||
if (nextArgument.length() == 0) {
|
||||
if (isExecutable) {
|
||||
if (nextArgument.isEmpty()) {
|
||||
if (this.isExecutable) {
|
||||
return;
|
||||
}
|
||||
throw new RequiresMoreArgumentsCommandParseException(stringReader);
|
||||
}
|
||||
if (literalChildren.containsKey(nextArgument)) {
|
||||
if (this.literalChildren.containsKey(nextArgument)) {
|
||||
stringReader.skip(nextArgument.length() + ProtocolDefinition.COMMAND_SEPARATOR.length());
|
||||
literalChildren.get(nextArgument).isSyntaxCorrect(connection, stringReader);
|
||||
this.literalChildren.get(nextArgument).isSyntaxCorrect(connection, stringReader);
|
||||
return;
|
||||
}
|
||||
CommandParseException lastException = null;
|
||||
for (CommandArgumentNode argumentNode : argumentsChildren) {
|
||||
for (CommandArgumentNode argumentNode : this.argumentsChildren) {
|
||||
int currentPosition = stringReader.getPosition();
|
||||
try {
|
||||
argumentNode.isSyntaxCorrect(connection, stringReader);
|
||||
@ -119,6 +119,12 @@ public abstract class CommandNode {
|
||||
public enum NodeTypes {
|
||||
ROOT,
|
||||
LITERAL,
|
||||
ARGUMENT
|
||||
ARGUMENT;
|
||||
|
||||
private static final NodeTypes[] NODE_TYPES = values();
|
||||
|
||||
public static NodeTypes byId(int id) {
|
||||
return NODE_TYPES[id];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ import de.bixilon.minosoft.util.buffers.ImprovedStringReader;
|
||||
public class FloatParser extends CommandParser {
|
||||
public static final FloatParser FLOAT_PARSER = new FloatParser();
|
||||
|
||||
|
||||
@Override
|
||||
public ParserProperties readParserProperties(InByteBuffer buffer) {
|
||||
return new FloatParserProperties(buffer);
|
||||
|
@ -24,7 +24,6 @@ import de.bixilon.minosoft.util.buffers.ImprovedStringReader;
|
||||
public class IdentifierSelectorArgumentParser extends EntitySelectorArgumentParser {
|
||||
public static final IdentifierSelectorArgumentParser ENTITY_TYPE_IDENTIFIER_SELECTOR_ARGUMENT_PARSER = new IdentifierSelectorArgumentParser();
|
||||
|
||||
|
||||
@Override
|
||||
public void isParsable(Connection connection, ImprovedStringReader stringReader) throws CommandParseException {
|
||||
Pair<String, String> match = readNextArgument(stringReader);
|
||||
|
@ -35,15 +35,15 @@ public class RangeSelectorArgumentParser extends EntitySelectorArgumentParser {
|
||||
}
|
||||
|
||||
public int getMinValue() {
|
||||
return minValue;
|
||||
return this.minValue;
|
||||
}
|
||||
|
||||
public int getMaxValue() {
|
||||
return maxValue;
|
||||
return this.maxValue;
|
||||
}
|
||||
|
||||
public boolean isDecimal() {
|
||||
return decimal;
|
||||
return this.decimal;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -70,7 +70,7 @@ public class RangeSelectorArgumentParser extends EntitySelectorArgumentParser {
|
||||
}
|
||||
|
||||
if (min < getMinValue() || max > getMaxValue()) {
|
||||
throw new ValueOutOfRangeCommandParseException(stringReader, minValue, maxValue, match.getKey());
|
||||
throw new ValueOutOfRangeCommandParseException(stringReader, this.minValue, this.maxValue, match.getKey());
|
||||
}
|
||||
if (min > max) {
|
||||
throw new MinimumBiggerAsMaximumCommandParseException(stringReader, match.getKey());
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
package de.bixilon.minosoft.data.commands.parser.exceptions;
|
||||
|
||||
|
||||
import de.bixilon.minosoft.util.buffers.ImprovedStringReader;
|
||||
|
||||
public class CommandParseException extends Exception {
|
||||
@ -47,18 +46,18 @@ public class CommandParseException extends Exception {
|
||||
}
|
||||
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
return this.errorMessage;
|
||||
}
|
||||
|
||||
public ImprovedStringReader getCommand() {
|
||||
return command;
|
||||
return this.command;
|
||||
}
|
||||
|
||||
public int getStartIndex() {
|
||||
return startIndex;
|
||||
return this.startIndex;
|
||||
}
|
||||
|
||||
public int getEndIndex() {
|
||||
return endIndex;
|
||||
return this.endIndex;
|
||||
}
|
||||
}
|
||||
|
@ -23,22 +23,22 @@ public class DoubleParserProperties implements ParserProperties {
|
||||
public DoubleParserProperties(InByteBuffer buffer) {
|
||||
byte flags = buffer.readByte();
|
||||
if (BitByte.isBitMask(flags, 0x01)) {
|
||||
minValue = buffer.readDouble();
|
||||
this.minValue = buffer.readDouble();
|
||||
} else {
|
||||
minValue = Double.MIN_VALUE;
|
||||
this.minValue = Double.MIN_VALUE;
|
||||
}
|
||||
if (BitByte.isBitMask(flags, 0x02)) {
|
||||
maxValue = buffer.readDouble();
|
||||
this.maxValue = buffer.readDouble();
|
||||
} else {
|
||||
maxValue = Double.MAX_VALUE;
|
||||
this.maxValue = Double.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
public double getMinValue() {
|
||||
return minValue;
|
||||
return this.minValue;
|
||||
}
|
||||
|
||||
public double getMaxValue() {
|
||||
return maxValue;
|
||||
return this.maxValue;
|
||||
}
|
||||
}
|
||||
|
@ -22,15 +22,15 @@ public class EntityParserProperties implements ParserProperties {
|
||||
|
||||
public EntityParserProperties(InByteBuffer buffer) {
|
||||
byte flags = buffer.readByte();
|
||||
onlySingleEntity = BitByte.isBitMask(flags, 0x01);
|
||||
onlyPlayers = BitByte.isBitMask(flags, 0x02);
|
||||
this.onlySingleEntity = BitByte.isBitMask(flags, 0x01);
|
||||
this.onlyPlayers = BitByte.isBitMask(flags, 0x02);
|
||||
}
|
||||
|
||||
public boolean isOnlySingleEntity() {
|
||||
return onlySingleEntity;
|
||||
return this.onlySingleEntity;
|
||||
}
|
||||
|
||||
public boolean isOnlyPlayers() {
|
||||
return onlyPlayers;
|
||||
return this.onlyPlayers;
|
||||
}
|
||||
}
|
||||
|
@ -23,22 +23,22 @@ public class FloatParserProperties implements ParserProperties {
|
||||
public FloatParserProperties(InByteBuffer buffer) {
|
||||
byte flags = buffer.readByte();
|
||||
if (BitByte.isBitMask(flags, 0x01)) {
|
||||
minValue = buffer.readFloat();
|
||||
this.minValue = buffer.readFloat();
|
||||
} else {
|
||||
minValue = Float.MIN_VALUE;
|
||||
this.minValue = Float.MIN_VALUE;
|
||||
}
|
||||
if (BitByte.isBitMask(flags, 0x02)) {
|
||||
maxValue = buffer.readFloat();
|
||||
this.maxValue = buffer.readFloat();
|
||||
} else {
|
||||
maxValue = Float.MAX_VALUE;
|
||||
this.maxValue = Float.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
public float getMinValue() {
|
||||
return minValue;
|
||||
return this.minValue;
|
||||
}
|
||||
|
||||
public float getMaxValue() {
|
||||
return maxValue;
|
||||
return this.maxValue;
|
||||
}
|
||||
}
|
||||
|
@ -23,23 +23,23 @@ public class IntegerParserProperties implements ParserProperties {
|
||||
public IntegerParserProperties(InByteBuffer buffer) {
|
||||
byte flags = buffer.readByte();
|
||||
if (BitByte.isBitMask(flags, 0x01)) {
|
||||
minValue = buffer.readInt();
|
||||
this.minValue = buffer.readInt();
|
||||
} else {
|
||||
minValue = Integer.MIN_VALUE;
|
||||
this.minValue = Integer.MIN_VALUE;
|
||||
}
|
||||
if (BitByte.isBitMask(flags, 0x02)) {
|
||||
maxValue = buffer.readInt();
|
||||
this.maxValue = buffer.readInt();
|
||||
} else {
|
||||
maxValue = Integer.MAX_VALUE;
|
||||
this.maxValue = Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
public int getMinValue() {
|
||||
return minValue;
|
||||
return this.minValue;
|
||||
}
|
||||
|
||||
public int getMaxValue() {
|
||||
return maxValue;
|
||||
return this.maxValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,10 +20,10 @@ public class RangeParserProperties implements ParserProperties {
|
||||
private final boolean allowDecimals;
|
||||
|
||||
public RangeParserProperties(InByteBuffer buffer) {
|
||||
allowDecimals = BitByte.isBitMask(buffer.readByte(), 0x01);
|
||||
this.allowDecimals = BitByte.isBitMask(buffer.readByte(), 0x01);
|
||||
}
|
||||
|
||||
public boolean isAllowDecimals() {
|
||||
return allowDecimals;
|
||||
return this.allowDecimals;
|
||||
}
|
||||
}
|
||||
|
@ -20,10 +20,10 @@ public class ScoreHolderParserProperties implements ParserProperties {
|
||||
private final boolean allowMultiple;
|
||||
|
||||
public ScoreHolderParserProperties(InByteBuffer buffer) {
|
||||
allowMultiple = BitByte.isBitMask(buffer.readByte(), 0x01);
|
||||
this.allowMultiple = BitByte.isBitMask(buffer.readByte(), 0x01);
|
||||
}
|
||||
|
||||
public boolean isAllowMultiple() {
|
||||
return allowMultiple;
|
||||
return this.allowMultiple;
|
||||
}
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ public class StringParserProperties implements ParserProperties {
|
||||
private final boolean allowEmptyString;
|
||||
|
||||
public StringParserProperties(InByteBuffer buffer) {
|
||||
setting = StringSettings.values()[buffer.readVarInt()];
|
||||
allowEmptyString = false;
|
||||
this.setting = StringSettings.byId(buffer.readVarInt());
|
||||
this.allowEmptyString = false;
|
||||
}
|
||||
|
||||
public StringParserProperties(StringSettings setting, boolean allowEmptyString) {
|
||||
@ -30,16 +30,22 @@ public class StringParserProperties implements ParserProperties {
|
||||
}
|
||||
|
||||
public StringSettings getSetting() {
|
||||
return setting;
|
||||
return this.setting;
|
||||
}
|
||||
|
||||
public boolean isAllowEmptyString() {
|
||||
return allowEmptyString;
|
||||
return this.allowEmptyString;
|
||||
}
|
||||
|
||||
public enum StringSettings {
|
||||
SINGLE_WORD,
|
||||
QUOTABLE_PHRASE,
|
||||
GREEDY_PHRASE
|
||||
GREEDY_PHRASE;
|
||||
|
||||
private static final StringSettings[] STRING_SETTINGS = values();
|
||||
|
||||
public static StringSettings byId(int id) {
|
||||
return STRING_SETTINGS[id];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,10 +35,10 @@ public class EntityInformation extends ModIdentifier {
|
||||
}
|
||||
|
||||
public float getWidth() {
|
||||
return width;
|
||||
return this.width;
|
||||
}
|
||||
|
||||
public float getHeight() {
|
||||
return height;
|
||||
return this.height;
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public class EntityMetaData {
|
||||
case POSE -> buffer.readPose();
|
||||
case BLOCK_ID -> buffer.getConnection().getMapping().getBlockById(buffer.readVarInt());
|
||||
case OPT_VAR_INT -> buffer.readVarInt() - 1;
|
||||
case VILLAGER_DATA -> new VillagerData(VillagerData.VillagerTypes.values()[buffer.readVarInt()], VillagerData.VillagerProfessions.byId(buffer.readVarInt(), buffer.getVersionId()), VillagerData.VillagerLevels.values()[buffer.readVarInt()]);
|
||||
case VILLAGER_DATA -> new VillagerData(VillagerData.VillagerTypes.byId(buffer.readVarInt()), VillagerData.VillagerProfessions.byId(buffer.readVarInt(), buffer.getVersionId()), VillagerData.VillagerLevels.byId(buffer.readVarInt()));
|
||||
case OPT_BLOCK_ID -> {
|
||||
int blockId = buffer.readVarInt();
|
||||
if (blockId == 0) {
|
||||
@ -90,7 +90,7 @@ public class EntityMetaData {
|
||||
}
|
||||
|
||||
public MetaDataHashMap getSets() {
|
||||
return sets;
|
||||
return this.sets;
|
||||
}
|
||||
|
||||
public enum EntityMetaDataValueTypes {
|
||||
@ -121,11 +121,11 @@ public class EntityMetaData {
|
||||
final VersionValueMap<Integer> valueMap;
|
||||
|
||||
EntityMetaDataValueTypes(MapSet<Integer, Integer>[] values) {
|
||||
valueMap = new VersionValueMap<>(values, true);
|
||||
this.valueMap = new VersionValueMap<>(values, true);
|
||||
}
|
||||
|
||||
EntityMetaDataValueTypes(int id) {
|
||||
valueMap = new VersionValueMap<>(id);
|
||||
this.valueMap = new VersionValueMap<>(id);
|
||||
}
|
||||
|
||||
public static EntityMetaDataValueTypes byId(int id, int versionId) {
|
||||
@ -138,7 +138,7 @@ public class EntityMetaData {
|
||||
}
|
||||
|
||||
public int getId(Integer versionId) {
|
||||
Integer ret = valueMap.get(versionId);
|
||||
Integer ret = this.valueMap.get(versionId);
|
||||
if (ret == null) {
|
||||
return -2;
|
||||
}
|
||||
@ -206,7 +206,7 @@ public class EntityMetaData {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <K> K get(EntityMetaDataFields field) {
|
||||
Integer index = connection.getMapping().getEntityMetaDataIndex(field);
|
||||
Integer index = EntityMetaData.this.connection.getMapping().getEntityMetaDataIndex(field);
|
||||
if (index == null) {
|
||||
// ups, index not found. Index not available in this version?, mappings broken or mappings not available
|
||||
return field.getDefaultValue();
|
||||
|
@ -58,7 +58,6 @@ public enum EntityMetaDataFields {
|
||||
ABSTRACT_ARROW_PIERCE_LEVEL((byte) 0),
|
||||
ABSTRACT_ARROW_OWNER_UUID,
|
||||
|
||||
|
||||
FISHING_HOOK_HOOKED_ENTITY(0),
|
||||
FISHING_HOOK_CATCHABLE(false),
|
||||
|
||||
@ -67,7 +66,6 @@ public enum EntityMetaDataFields {
|
||||
THROWN_TRIDENT_LOYALTY_LEVEL(0),
|
||||
THROWN_TRIDENT_FOIL(false),
|
||||
|
||||
|
||||
BOAT_HURT(0),
|
||||
BOAT_HURT_DIRECTION(1),
|
||||
BOAT_DAMAGE_TAKEN(0f),
|
||||
@ -267,7 +265,6 @@ public enum EntityMetaDataFields {
|
||||
|
||||
THROWN_EYE_OF_ENDER_ITEM,
|
||||
|
||||
|
||||
// pretty old stuff here. 1.8 mostly (or even after, I don't know and I don't care)
|
||||
LEGACY_SKELETON_TYPE((byte) 0),
|
||||
LEGACY_ENDERMAN_CARRIED_BLOCK(0),
|
||||
@ -287,7 +284,7 @@ public enum EntityMetaDataFields {
|
||||
private final Object defaultValue;
|
||||
|
||||
EntityMetaDataFields() {
|
||||
defaultValue = null;
|
||||
this.defaultValue = null;
|
||||
}
|
||||
|
||||
EntityMetaDataFields(Object defaultValue) {
|
||||
@ -296,6 +293,6 @@ public enum EntityMetaDataFields {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <K> K getDefaultValue() {
|
||||
return (K) defaultValue;
|
||||
return (K) this.defaultValue;
|
||||
}
|
||||
}
|
||||
|
@ -25,10 +25,10 @@ public class EntityProperty {
|
||||
}
|
||||
|
||||
public double getValue() {
|
||||
return value;
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public HashMap<UUID, EntityPropertyModifier> getModifiers() {
|
||||
return modifiers;
|
||||
return this.modifiers;
|
||||
}
|
||||
}
|
||||
|
@ -24,11 +24,11 @@ public enum EntityPropertyKeys {
|
||||
HORSE_JUMP_STRENGTH("horse.jumpStrength"),
|
||||
ZOMBIE_SPAWN_REINFORCEMENT("zombie.spawnReinforcements");
|
||||
|
||||
final static HashBiMap<String, EntityPropertyKeys> keys = HashBiMap.create();
|
||||
private static final HashBiMap<String, EntityPropertyKeys> KEYS = HashBiMap.create();
|
||||
|
||||
static {
|
||||
for (EntityPropertyKeys key : values()) {
|
||||
keys.put(key.getIdentifier(), key);
|
||||
KEYS.put(key.getIdentifier(), key);
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,10 +39,10 @@ public enum EntityPropertyKeys {
|
||||
}
|
||||
|
||||
public static EntityPropertyKeys byName(String name) {
|
||||
return keys.get(name);
|
||||
return KEYS.get(name);
|
||||
}
|
||||
|
||||
public String getIdentifier() {
|
||||
return identifier;
|
||||
return this.identifier;
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class EntityPropertyModifier {
|
||||
}
|
||||
|
||||
public double getAmount() {
|
||||
return amount;
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public void setAmount(double amount) {
|
||||
|
@ -58,11 +58,11 @@ public enum Objects {
|
||||
DRAGON_FIREBALL(93, DragonFireball.class),
|
||||
TRIDENT(94, ThrownTrident.class);
|
||||
|
||||
final static HashBiMap<Integer, Objects> objects = HashBiMap.create();
|
||||
private static final HashBiMap<Integer, Objects> ID_OBJECT_MAP = HashBiMap.create();
|
||||
|
||||
static {
|
||||
for (Objects object : values()) {
|
||||
objects.put(object.getId(), object);
|
||||
ID_OBJECT_MAP.put(object.getId(), object);
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,14 +75,14 @@ public enum Objects {
|
||||
}
|
||||
|
||||
public static Objects byId(int id) {
|
||||
return objects.get(id);
|
||||
return ID_OBJECT_MAP.get(id);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public Class<? extends Entity> getClazz() {
|
||||
return clazz;
|
||||
return this.clazz;
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,9 @@ public enum Poses {
|
||||
SNEAKING,
|
||||
DYING;
|
||||
|
||||
private static final Poses[] POSES = values();
|
||||
|
||||
public static Poses byId(int id) {
|
||||
return values()[id];
|
||||
return POSES[id];
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
*/
|
||||
package de.bixilon.minosoft.data.entities
|
||||
|
||||
class Rotation(val yaw: Int, val pitch: Int) {
|
||||
data class Rotation(val yaw: Int, val pitch: Int) {
|
||||
|
||||
override fun toString(): String {
|
||||
return String.format("raw=%d, pitch=%d", yaw, pitch)
|
||||
|
@ -63,9 +63,27 @@ data class VillagerData(val type: VillagerTypes, val profession: VillagerProfess
|
||||
|
||||
enum class VillagerTypes {
|
||||
DESSERT, JUNGLE, PLAINS, SAVANNA, SNOW, SWAMP, TAIGA;
|
||||
|
||||
companion object {
|
||||
private val VILLAGER_TYPES: Array<VillagerTypes> = values()
|
||||
|
||||
@JvmStatic
|
||||
fun byId(id: Int): VillagerTypes {
|
||||
return VILLAGER_TYPES[id]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum class VillagerLevels {
|
||||
NOVICE, APPRENTICE, JOURNEYMAN, EXPERT, MASTER;
|
||||
|
||||
companion object {
|
||||
private val VILLAGER_LEVELS: Array<VillagerLevels> = values()
|
||||
|
||||
@JvmStatic
|
||||
fun byId(id: Int): VillagerLevels {
|
||||
return VILLAGER_LEVELS[id]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,15 +28,15 @@ public class BedEntityMetaData extends BlockEntityMetaData {
|
||||
|
||||
public BedEntityMetaData(NBTTag nbt) {
|
||||
if (nbt == null) {
|
||||
color = ChatColors.RED;
|
||||
this.color = ChatColors.RED;
|
||||
return;
|
||||
}
|
||||
if (nbt instanceof StringTag stringTag) {
|
||||
// yes, we support bed rgb colors :D
|
||||
color = new RGBColor(stringTag.getValue());
|
||||
this.color = new RGBColor(stringTag.getValue());
|
||||
return;
|
||||
}
|
||||
color = switch (((IntTag) nbt).getValue()) {
|
||||
this.color = switch (((IntTag) nbt).getValue()) {
|
||||
case 0 -> new RGBColor(255, 255, 255); // white
|
||||
case 1 -> new RGBColor(234, 103, 3); // orange
|
||||
case 2 -> new RGBColor(199, 78, 189); // magenta
|
||||
@ -58,6 +58,6 @@ public class BedEntityMetaData extends BlockEntityMetaData {
|
||||
}
|
||||
|
||||
public RGBColor getColor() {
|
||||
return color;
|
||||
return this.color;
|
||||
}
|
||||
}
|
||||
|
@ -26,13 +26,13 @@ public class CampfireBlockEntityMetaData extends BlockEntityMetaData {
|
||||
}
|
||||
|
||||
public CampfireBlockEntityMetaData(ListTag nbt) {
|
||||
items = new Slot[4];
|
||||
this.items = new Slot[4];
|
||||
for (CompoundTag tag : nbt.<CompoundTag>getValue()) {
|
||||
items[tag.getByteTag("Slot").getValue()] = new Slot(new Item(tag.getStringTag("id").getValue()), tag.getByteTag("Count").getValue());
|
||||
this.items[tag.getByteTag("Slot").getValue()] = new Slot(new Item(tag.getStringTag("id").getValue()), tag.getByteTag("Count").getValue());
|
||||
}
|
||||
}
|
||||
|
||||
public Slot[] getItems() {
|
||||
return items;
|
||||
return this.items;
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,6 @@ public abstract class AgeableMob extends PathfinderMob {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isBaby")
|
||||
public boolean isBaby() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.AGEABLE_IS_BABY);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.AGEABLE_IS_BABY);
|
||||
}
|
||||
}
|
||||
|
@ -55,11 +55,11 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
public int getEntityId() {
|
||||
return entityId;
|
||||
return this.entityId;
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
return this.location;
|
||||
}
|
||||
|
||||
public void setLocation(Location location) {
|
||||
@ -67,33 +67,33 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
public void setLocation(RelativeLocation relativeLocation) {
|
||||
location = new Location(location.getX() + relativeLocation.getX(), location.getY() + relativeLocation.getY(), location.getZ() + relativeLocation.getZ());
|
||||
this.location = new Location(this.location.getX() + relativeLocation.getX(), this.location.getY() + relativeLocation.getY(), this.location.getZ() + relativeLocation.getZ());
|
||||
}
|
||||
|
||||
public void setEquipment(HashMap<InventorySlots.EntityInventorySlots, Slot> slots) {
|
||||
equipment.putAll(slots);
|
||||
this.equipment.putAll(slots);
|
||||
}
|
||||
|
||||
public Slot getEquipment(InventorySlots.EntityInventorySlots slot) {
|
||||
return equipment.get(slot);
|
||||
return this.equipment.get(slot);
|
||||
}
|
||||
|
||||
public UUID getUUID() {
|
||||
return uuid;
|
||||
return this.uuid;
|
||||
}
|
||||
|
||||
public HashSet<StatusEffect> getEffectList() {
|
||||
return effectList;
|
||||
return this.effectList;
|
||||
}
|
||||
|
||||
public void addEffect(StatusEffect effect) {
|
||||
// effect already applied, maybe the duration or the amplifier changed?
|
||||
effectList.removeIf(listEffect -> listEffect.getEffect() == effect.getEffect());
|
||||
effectList.add(effect);
|
||||
this.effectList.removeIf(listEffect -> listEffect.getEffect() == effect.getEffect());
|
||||
this.effectList.add(effect);
|
||||
}
|
||||
|
||||
public void removeEffect(MobEffect effect) {
|
||||
effectList.removeIf(listEffect -> listEffect.getEffect() == effect);
|
||||
this.effectList.removeIf(listEffect -> listEffect.getEffect() == effect);
|
||||
}
|
||||
|
||||
public void attachTo(int vehicleId) {
|
||||
@ -101,19 +101,19 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
public boolean isAttached() {
|
||||
return attachedTo != -1;
|
||||
return this.attachedTo != -1;
|
||||
}
|
||||
|
||||
public int getAttachedEntity() {
|
||||
return attachedTo;
|
||||
return this.attachedTo;
|
||||
}
|
||||
|
||||
public void detach() {
|
||||
attachedTo = -1;
|
||||
this.attachedTo = -1;
|
||||
}
|
||||
|
||||
public EntityRotation getRotation() {
|
||||
return rotation;
|
||||
return this.rotation;
|
||||
}
|
||||
|
||||
public void setRotation(EntityRotation rotation) {
|
||||
@ -121,7 +121,7 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
public void setRotation(int yaw, int pitch) {
|
||||
this.rotation = new EntityRotation(yaw, pitch, rotation.getHeadYaw());
|
||||
this.rotation = new EntityRotation(yaw, pitch, this.rotation.getHeadYaw());
|
||||
}
|
||||
|
||||
public void setRotation(int yaw, int pitch, int headYaw) {
|
||||
@ -129,12 +129,12 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
public void setHeadRotation(int headYaw) {
|
||||
this.rotation = new EntityRotation(rotation.getYaw(), rotation.getPitch(), headYaw);
|
||||
this.rotation = new EntityRotation(this.rotation.getYaw(), this.rotation.getPitch(), headYaw);
|
||||
}
|
||||
|
||||
@Unsafe
|
||||
public EntityMetaData getMetaData() {
|
||||
return metaData;
|
||||
return this.metaData;
|
||||
}
|
||||
|
||||
@Unsafe
|
||||
@ -146,11 +146,11 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
public EntityInformation getEntityInformation() {
|
||||
return information;
|
||||
return this.information;
|
||||
}
|
||||
|
||||
private boolean getEntityFlag(int bitMask) {
|
||||
return metaData.getSets().getBitMask(EntityMetaDataFields.ENTITY_FLAGS, bitMask);
|
||||
return this.metaData.getSets().getBitMask(EntityMetaDataFields.ENTITY_FLAGS, bitMask);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "onFire")
|
||||
@ -187,28 +187,28 @@ public abstract class Entity {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "airSupply")
|
||||
private int getAirSupply() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.ENTITY_AIR_SUPPLY);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.ENTITY_AIR_SUPPLY);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "customName")
|
||||
@Nullable
|
||||
private ChatComponent getCustomName() {
|
||||
return metaData.getSets().getChatComponent(EntityMetaDataFields.ENTITY_CUSTOM_NAME);
|
||||
return this.metaData.getSets().getChatComponent(EntityMetaDataFields.ENTITY_CUSTOM_NAME);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "customNameVisible")
|
||||
public boolean isCustomNameVisible() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.ENTITY_CUSTOM_NAME_VISIBLE);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.ENTITY_CUSTOM_NAME_VISIBLE);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isSilent")
|
||||
public boolean isSilent() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.ENTITY_SILENT);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.ENTITY_SILENT);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "hasNoGravity")
|
||||
public boolean hasNoGravity() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.ENTITY_NO_GRAVITY);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.ENTITY_NO_GRAVITY);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "pose")
|
||||
@ -222,20 +222,20 @@ public abstract class Entity {
|
||||
if (isFlyingWithElytra()) {
|
||||
return Poses.FLYING;
|
||||
}
|
||||
return metaData.getSets().getPose(EntityMetaDataFields.ENTITY_POSE);
|
||||
return this.metaData.getSets().getPose(EntityMetaDataFields.ENTITY_POSE);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "ticksFrozen")
|
||||
public int getTicksFrozen() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.ENTITY_TICKS_FROZEN);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.ENTITY_TICKS_FROZEN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (information == null) {
|
||||
if (this.information == null) {
|
||||
return this.getClass().getCanonicalName();
|
||||
}
|
||||
return String.format("%s:%s", information.getMod(), information.getIdentifier());
|
||||
return String.format("%s:%s", this.information.getMod(), this.information.getIdentifier());
|
||||
}
|
||||
|
||||
public String getEntityMetaDataAsString() {
|
||||
|
@ -24,7 +24,7 @@ public class ExperienceOrb extends Entity {
|
||||
|
||||
public ExperienceOrb(Connection connection, int entityId, UUID uuid, Location location, EntityRotation rotation) {
|
||||
super(connection, entityId, uuid, location, rotation);
|
||||
count = 0;
|
||||
this.count = 0;
|
||||
}
|
||||
|
||||
public ExperienceOrb(Connection connection, int entityId, Location location, int count) {
|
||||
@ -34,6 +34,6 @@ public class ExperienceOrb extends Entity {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "count")
|
||||
public int getCount() {
|
||||
return count;
|
||||
return this.count;
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public abstract class LivingEntity extends Entity {
|
||||
}
|
||||
|
||||
private boolean getLivingEntityFlag(int bitMask) {
|
||||
return metaData.getSets().getBitMask(EntityMetaDataFields.LIVING_ENTITY_FLAGS, bitMask);
|
||||
return this.metaData.getSets().getBitMask(EntityMetaDataFields.LIVING_ENTITY_FLAGS, bitMask);
|
||||
}
|
||||
|
||||
// = isUsingItem
|
||||
@ -50,33 +50,33 @@ public abstract class LivingEntity extends Entity {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "health")
|
||||
public float getHealth() {
|
||||
return metaData.getSets().getFloat(EntityMetaDataFields.LIVING_ENTITY_HEALTH);
|
||||
return this.metaData.getSets().getFloat(EntityMetaDataFields.LIVING_ENTITY_HEALTH);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "effectColor")
|
||||
public int getEffectColor() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.LIVING_ENTITY_EFFECT_COLOR);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.LIVING_ENTITY_EFFECT_COLOR);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isEffectAmbient")
|
||||
public boolean getEffectAmbient() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.LIVING_ENTITY_EFFECT_AMBIENCE);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.LIVING_ENTITY_EFFECT_AMBIENCE);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "arrowsInEntity")
|
||||
public int getArrowCount() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.LIVING_ENTITY_ARROW_COUNT);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.LIVING_ENTITY_ARROW_COUNT);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "absorptionHearts")
|
||||
public int getAbsorptionHearts() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.LIVING_ENTITY_ABSORPTION_HEARTS);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.LIVING_ENTITY_ABSORPTION_HEARTS);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "bedLocation")
|
||||
@Nullable
|
||||
public BlockPosition getBedLocation() {
|
||||
return metaData.getSets().getPosition(EntityMetaDataFields.LIVING_ENTITY_BED_POSITION);
|
||||
return this.metaData.getSets().getPosition(EntityMetaDataFields.LIVING_ENTITY_BED_POSITION);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public abstract class Mob extends LivingEntity {
|
||||
}
|
||||
|
||||
private boolean getMobFlags(int bitMask) {
|
||||
return metaData.getSets().getBitMask(EntityMetaDataFields.MOB_FLAGS, bitMask);
|
||||
return this.metaData.getSets().getBitMask(EntityMetaDataFields.MOB_FLAGS, bitMask);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isNoAI")
|
||||
|
@ -28,7 +28,7 @@ public abstract class TamableAnimal extends Animal {
|
||||
}
|
||||
|
||||
private boolean getTameableFlag(int bitMask) {
|
||||
return metaData.getSets().getBitMask(EntityMetaDataFields.TAMABLE_ENTITY_FLAGS, bitMask);
|
||||
return this.metaData.getSets().getBitMask(EntityMetaDataFields.TAMABLE_ENTITY_FLAGS, bitMask);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isSitting")
|
||||
@ -44,6 +44,6 @@ public abstract class TamableAnimal extends Animal {
|
||||
@EntityMetaDataFunction(identifier = "ownerUUID")
|
||||
@Nullable
|
||||
public UUID getOwner() {
|
||||
return metaData.getSets().getUUID(EntityMetaDataFields.TAMABLE_ENTITY_OWNER_UUID);
|
||||
return this.metaData.getSets().getUUID(EntityMetaDataFields.TAMABLE_ENTITY_OWNER_UUID);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public class Bat extends AmbientCreature {
|
||||
}
|
||||
|
||||
private boolean getBatFlag(int bitMask) {
|
||||
return metaData.getSets().getBitMask(EntityMetaDataFields.BAT_FLAGS, bitMask);
|
||||
return this.metaData.getSets().getBitMask(EntityMetaDataFields.BAT_FLAGS, bitMask);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "hanging")
|
||||
|
@ -28,7 +28,7 @@ public class Bee extends Animal {
|
||||
}
|
||||
|
||||
private boolean getBeeFlag(int bitMask) {
|
||||
return metaData.getSets().getBitMask(EntityMetaDataFields.BEE_FLAGS, bitMask);
|
||||
return this.metaData.getSets().getBitMask(EntityMetaDataFields.BEE_FLAGS, bitMask);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isAngry")
|
||||
@ -48,6 +48,6 @@ public class Bee extends Animal {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "remainingAngerTime")
|
||||
public int getRemainingAngerTimer() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.BEE_REMAINING_ANGER_TIME);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.BEE_REMAINING_ANGER_TIME);
|
||||
}
|
||||
}
|
||||
|
@ -32,22 +32,22 @@ public class Cat extends TamableAnimal {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "variant")
|
||||
public CatVariants getVariant() {
|
||||
return CatVariants.values()[metaData.getSets().getInt(EntityMetaDataFields.CAT_VARIANT)];
|
||||
return CatVariants.byId(this.metaData.getSets().getInt(EntityMetaDataFields.CAT_VARIANT));
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "lying")
|
||||
public boolean isLying() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.CAT_IS_LYING);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.CAT_IS_LYING);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "relaxed")
|
||||
public boolean isRelaxed() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.CAT_IS_RELAXED);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.CAT_IS_RELAXED);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "collarColor")
|
||||
public RGBColor getCollarColor() {
|
||||
return ChatColors.getColorById(metaData.getSets().getInt(EntityMetaDataFields.CAT_GET_COLLAR_COLOR));
|
||||
return ChatColors.getColorById(this.metaData.getSets().getInt(EntityMetaDataFields.CAT_GET_COLLAR_COLOR));
|
||||
}
|
||||
|
||||
public enum CatVariants {
|
||||
@ -59,6 +59,12 @@ public class Cat extends TamableAnimal {
|
||||
CALICO,
|
||||
PERSIAN,
|
||||
RAGDOLL,
|
||||
ALL_BLACK
|
||||
ALL_BLACK;
|
||||
|
||||
private static final CatVariants[] CAT_VARIANTS = values();
|
||||
|
||||
public static CatVariants byId(int id) {
|
||||
return CAT_VARIANTS[id];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,11 +30,11 @@ public class Fox extends Animal {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "variant")
|
||||
public int getVariant() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.FOX_VARIANT);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.FOX_VARIANT);
|
||||
}
|
||||
|
||||
private boolean getFoxFlag(int bitMask) {
|
||||
return metaData.getSets().getBitMask(EntityMetaDataFields.FOX_FLAGS, bitMask);
|
||||
return this.metaData.getSets().getBitMask(EntityMetaDataFields.FOX_FLAGS, bitMask);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isSitting")
|
||||
@ -75,12 +75,12 @@ public class Fox extends Animal {
|
||||
@EntityMetaDataFunction(identifier = "trusted1")
|
||||
@Nullable
|
||||
public UUID getFirstTrusted() {
|
||||
return metaData.getSets().getUUID(EntityMetaDataFields.FOX_TRUSTED_1);
|
||||
return this.metaData.getSets().getUUID(EntityMetaDataFields.FOX_TRUSTED_1);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "trusted2")
|
||||
@Nullable
|
||||
public UUID getSecondTrusted() {
|
||||
return metaData.getSets().getUUID(EntityMetaDataFields.FOX_TRUSTED_2);
|
||||
return this.metaData.getSets().getUUID(EntityMetaDataFields.FOX_TRUSTED_2);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public class IronGolem extends AbstractGolem {
|
||||
}
|
||||
|
||||
private boolean getIronGolemFlag(int bitMask) {
|
||||
return metaData.getSets().getBitMask(EntityMetaDataFields.IRON_GOLEM_FLAGS, bitMask);
|
||||
return this.metaData.getSets().getBitMask(EntityMetaDataFields.IRON_GOLEM_FLAGS, bitMask);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isPlayerCreated")
|
||||
|
@ -29,6 +29,6 @@ public class Mooshroom extends Cow {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "variant")
|
||||
public String getVariant() {
|
||||
return metaData.getSets().getString(EntityMetaDataFields.MOOSHROOM_VARIANT);
|
||||
return this.metaData.getSets().getString(EntityMetaDataFields.MOOSHROOM_VARIANT);
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,6 @@ public class Ocelot extends Animal {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "trusting")
|
||||
public boolean isTrusting() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.OCELOT_IS_TRUSTING);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.OCELOT_IS_TRUSTING);
|
||||
}
|
||||
}
|
||||
|
@ -29,31 +29,31 @@ public class Panda extends Animal {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "unhappyTimer")
|
||||
public int getUnhappyTimer() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.PANDA_UNHAPPY_TIMER);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.PANDA_UNHAPPY_TIMER);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "sneezeTimer")
|
||||
public int getSneezeTimer() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.PANDA_SNEEZE_TIMER);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.PANDA_SNEEZE_TIMER);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "eatTimer")
|
||||
public int getEatTimer() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.PANDA_EAT_TIMER);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.PANDA_EAT_TIMER);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "mainGene")
|
||||
public Genes getMainGene() {
|
||||
return Genes.values()[metaData.getSets().getInt(EntityMetaDataFields.PANDA_MAIN_GENE)];
|
||||
return Genes.byId(this.metaData.getSets().getInt(EntityMetaDataFields.PANDA_MAIN_GENE));
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "hiddenGene")
|
||||
public Genes getHiddenGene() {
|
||||
return Genes.values()[metaData.getSets().getInt(EntityMetaDataFields.PANDA_HIDDEN_GAME)];
|
||||
return Genes.byId(this.metaData.getSets().getInt(EntityMetaDataFields.PANDA_HIDDEN_GAME));
|
||||
}
|
||||
|
||||
private boolean getPandaFlag(int bitMask) {
|
||||
return metaData.getSets().getBitMask(EntityMetaDataFields.PANDA_FLAGS, bitMask);
|
||||
return this.metaData.getSets().getBitMask(EntityMetaDataFields.PANDA_FLAGS, bitMask);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isSneezing")
|
||||
@ -83,6 +83,11 @@ public class Panda extends Animal {
|
||||
PLAYFUL,
|
||||
BROWN,
|
||||
WEAK,
|
||||
AGGRESSIVE
|
||||
AGGRESSIVE;
|
||||
private static final Genes[] GENES = values();
|
||||
|
||||
public static Genes byId(int id) {
|
||||
return GENES[id];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class Parrot extends ShoulderRidingAnimal {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "variant")
|
||||
public ParrotVariants getVariant() {
|
||||
return ParrotVariants.values()[metaData.getSets().getInt(EntityMetaDataFields.PARROT_VARIANT)];
|
||||
return ParrotVariants.byId(this.metaData.getSets().getInt(EntityMetaDataFields.PARROT_VARIANT));
|
||||
}
|
||||
|
||||
public enum ParrotVariants {
|
||||
@ -37,6 +37,12 @@ public class Parrot extends ShoulderRidingAnimal {
|
||||
BLUE,
|
||||
GREEN,
|
||||
YELLOW_BLUE,
|
||||
GREY
|
||||
GREY;
|
||||
|
||||
private static final ParrotVariants[] PARROT_VARIANTS = values();
|
||||
|
||||
public static ParrotVariants byId(int id) {
|
||||
return PARROT_VARIANTS[id];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,11 +29,11 @@ public class Pig extends Animal {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "hasSaddle")
|
||||
public boolean hasSaddle() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.PIG_HAS_SADDLE);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.PIG_HAS_SADDLE);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "boostTime")
|
||||
public int getBoostTime() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.PIG_BOOST_TIME);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.PIG_BOOST_TIME);
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,6 @@ public class PolarBear extends Animal {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isStanding")
|
||||
public boolean isStanding() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.POLAR_BEAR_STANDING);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.POLAR_BEAR_STANDING);
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,6 @@ public class Rabbit extends Animal {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "variant")
|
||||
public int getVariant() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.RABBIT_VARIANT);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.RABBIT_VARIANT);
|
||||
}
|
||||
}
|
||||
|
@ -31,11 +31,11 @@ public class Sheep extends Animal {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "color")
|
||||
private RGBColor getColor() {
|
||||
return ChatColors.getColorById(metaData.getSets().getByte(EntityMetaDataFields.SHEEP_FLAGS) & 0xF);
|
||||
return ChatColors.getColorById(this.metaData.getSets().getByte(EntityMetaDataFields.SHEEP_FLAGS) & 0xF);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isSheared")
|
||||
private boolean isSheared() {
|
||||
return metaData.getSets().getBitMask(EntityMetaDataFields.SHEEP_FLAGS, 0x10);
|
||||
return this.metaData.getSets().getBitMask(EntityMetaDataFields.SHEEP_FLAGS, 0x10);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public class SnowGolem extends AbstractGolem {
|
||||
}
|
||||
|
||||
private boolean getPumpkinFlags(int bitMask) {
|
||||
return metaData.getSets().getBitMask(EntityMetaDataFields.SNOW_GOLEM_FLAGS, bitMask);
|
||||
return this.metaData.getSets().getBitMask(EntityMetaDataFields.SNOW_GOLEM_FLAGS, bitMask);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "pumpkinHat")
|
||||
|
@ -29,16 +29,16 @@ public class Strider extends Animal {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "boostTime")
|
||||
private int getBoostTime() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.STRIDER_TIME_TO_BOOST);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.STRIDER_TIME_TO_BOOST);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isSuffocating")
|
||||
private boolean isSuffocating() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.STRIDER_IS_SUFFOCATING);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.STRIDER_IS_SUFFOCATING);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "hasSaddle")
|
||||
private boolean hasSaddle() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.STRIDER_HAS_SADDLE);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.STRIDER_HAS_SADDLE);
|
||||
}
|
||||
}
|
||||
|
@ -32,32 +32,32 @@ public class Turtle extends Animal {
|
||||
@EntityMetaDataFunction(identifier = "homePosition")
|
||||
@Nullable
|
||||
public BlockPosition getHomePosition() {
|
||||
return metaData.getSets().getPosition(EntityMetaDataFields.TURTLE_HOME_POSITION);
|
||||
return this.metaData.getSets().getPosition(EntityMetaDataFields.TURTLE_HOME_POSITION);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "hasEgg")
|
||||
public boolean hasEgg() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.TURTLE_HAS_EGG);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.TURTLE_HAS_EGG);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isLayingEgg")
|
||||
public boolean isLayingEgg() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.TURTLE_IS_LAYING_EGG);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.TURTLE_IS_LAYING_EGG);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "travelPosition")
|
||||
@Nullable
|
||||
public BlockPosition getTravelPosition() {
|
||||
return metaData.getSets().getPosition(EntityMetaDataFields.TURTLE_TRAVEL_POSITION);
|
||||
return this.metaData.getSets().getPosition(EntityMetaDataFields.TURTLE_TRAVEL_POSITION);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isGoingHome")
|
||||
public boolean isGoingHome() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.TURTLE_IS_GOING_HOME);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.TURTLE_IS_GOING_HOME);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isTraveling")
|
||||
public boolean isTraveling() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.TURTLE_IS_TRAVELING);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.TURTLE_IS_TRAVELING);
|
||||
}
|
||||
}
|
||||
|
@ -32,28 +32,28 @@ public class Wolf extends TamableAnimal {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isBegging")
|
||||
public boolean isBegging() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.WOLF_IS_BEGGING);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.WOLF_IS_BEGGING);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "collarColor")
|
||||
public RGBColor getCollarColor() {
|
||||
return ChatColors.getColorById(metaData.getSets().getInt(EntityMetaDataFields.WOLF_COLLAR_COLOR));
|
||||
return ChatColors.getColorById(this.metaData.getSets().getInt(EntityMetaDataFields.WOLF_COLLAR_COLOR));
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "angerTime")
|
||||
public int getAngerTime() {
|
||||
if (versionId <= 47) {// ToDo
|
||||
return metaData.getSets().getBitMask(EntityMetaDataFields.TAMABLE_ENTITY_FLAGS, 0x02) ? 1 : 0;
|
||||
if (this.versionId <= 47) {// ToDo
|
||||
return this.metaData.getSets().getBitMask(EntityMetaDataFields.TAMABLE_ENTITY_FLAGS, 0x02) ? 1 : 0;
|
||||
}
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.WOLF_ANGER_TIME);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.WOLF_ANGER_TIME);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "health")
|
||||
@Override
|
||||
public float getHealth() {
|
||||
if (versionId > 562) {
|
||||
if (this.versionId > 562) {
|
||||
return super.getHealth();
|
||||
}
|
||||
return metaData.getSets().getFloat(EntityMetaDataFields.WOLF_HEALTH);
|
||||
return this.metaData.getSets().getFloat(EntityMetaDataFields.WOLF_HEALTH);
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,6 @@ public class Hoglin extends Animal {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "immuneToZombification")
|
||||
public boolean isImmuneToZombification() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.HOGLIN_IMMUNE_TO_ZOMBIFICATION);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.HOGLIN_IMMUNE_TO_ZOMBIFICATION);
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,6 @@ public abstract class AbstractChestedHorse extends AbstractHorse {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "hasChest")
|
||||
public boolean hasChest() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.ABSTRACT_CHESTED_HORSE_HAS_CHEST);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.ABSTRACT_CHESTED_HORSE_HAS_CHEST);
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public abstract class AbstractHorse extends Animal {
|
||||
}
|
||||
|
||||
private boolean getAbstractHorseFlag(int bitMask) {
|
||||
return metaData.getSets().getBitMask(EntityMetaDataFields.ABSTRACT_HORSE_FLAGS, bitMask);
|
||||
return this.metaData.getSets().getBitMask(EntityMetaDataFields.ABSTRACT_HORSE_FLAGS, bitMask);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isTame")
|
||||
@ -64,6 +64,6 @@ public abstract class AbstractHorse extends Animal {
|
||||
|
||||
@Nullable
|
||||
public UUID getOwner() {
|
||||
return metaData.getSets().getUUID(EntityMetaDataFields.ABSTRACT_HORSE_OWNER_UUID);
|
||||
return this.metaData.getSets().getUUID(EntityMetaDataFields.ABSTRACT_HORSE_OWNER_UUID);
|
||||
}
|
||||
}
|
||||
|
@ -33,11 +33,11 @@ public class Horse extends AbstractHorse {
|
||||
}
|
||||
|
||||
private boolean getAbstractHorseFlag(int bitMask) {
|
||||
return metaData.getSets().getBitMask(EntityMetaDataFields.ABSTRACT_HORSE_FLAGS, bitMask);
|
||||
return this.metaData.getSets().getBitMask(EntityMetaDataFields.ABSTRACT_HORSE_FLAGS, bitMask);
|
||||
}
|
||||
|
||||
private int getVariant() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.HORSE_VARIANT);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.HORSE_VARIANT);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "color")
|
||||
@ -53,10 +53,10 @@ public class Horse extends AbstractHorse {
|
||||
@EntityMetaDataFunction(identifier = "armor")
|
||||
@Nullable
|
||||
public Item getArmor() {
|
||||
if (versionId <= 47) { // ToDo
|
||||
if (this.versionId <= 47) { // ToDo
|
||||
return null;
|
||||
}
|
||||
return switch (metaData.getSets().getInt(EntityMetaDataFields.LEGACY_HORSE_ARMOR)) {
|
||||
return switch (this.metaData.getSets().getInt(EntityMetaDataFields.LEGACY_HORSE_ARMOR)) {
|
||||
default -> null;
|
||||
case 1 -> LEGACY_IRON_ARMOR;
|
||||
case 2 -> LEGACY_GOLD_ARMOR;
|
||||
@ -73,8 +73,10 @@ public class Horse extends AbstractHorse {
|
||||
GRAY,
|
||||
DARK_BROWN;
|
||||
|
||||
private static final HorseColors[] HORSE_COLORS = values();
|
||||
|
||||
public static HorseColors byId(int id) {
|
||||
return values()[id];
|
||||
return HORSE_COLORS[id];
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,8 +87,10 @@ public class Horse extends AbstractHorse {
|
||||
WHITE_DOTS,
|
||||
BLACK_DOTS;
|
||||
|
||||
private static final HorseDots[] HORSE_DOTS = values();
|
||||
|
||||
public static HorseDots byId(int id) {
|
||||
return values()[id];
|
||||
return HORSE_DOTS[id];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,16 +29,16 @@ public class Llama extends AbstractChestedHorse {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "strength")
|
||||
public int getStrength() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.LLAMA_STRENGTH);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.LLAMA_STRENGTH);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "carpetColor")
|
||||
public int getCarpetColor() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.LLAMA_CARPET_COLOR);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.LLAMA_CARPET_COLOR);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "variant")
|
||||
public int getVariant() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.LLAMA_VARIANT);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.LLAMA_VARIANT);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public abstract class AbstractFish extends WaterAnimal {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isFromBucket")
|
||||
public boolean isFromBucket() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.ABSTRACT_FISH_FROM_BUCKET);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.ABSTRACT_FISH_FROM_BUCKET);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,17 +32,17 @@ public class Dolphin extends WaterAnimal {
|
||||
@EntityMetaDataFunction(identifier = "treasurePosition")
|
||||
@Nullable
|
||||
public BlockPosition getTreasurePosition() {
|
||||
return metaData.getSets().getPosition(EntityMetaDataFields.DOLPHIN_TREASURE_POSITION);
|
||||
return this.metaData.getSets().getPosition(EntityMetaDataFields.DOLPHIN_TREASURE_POSITION);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "hasFish")
|
||||
public boolean hasFish() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.DOLPHIN_HAS_FISH);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.DOLPHIN_HAS_FISH);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "moistnessLevel")
|
||||
public int getMoistnessLevel() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.DOLPHIN_MOISTNESS_LEVEL);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.DOLPHIN_MOISTNESS_LEVEL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,6 @@ public class PufferFish extends AbstractFish {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "puffState")
|
||||
public int getPuffState() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.PUFFERFISH_PUFF_STATE);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.PUFFERFISH_PUFF_STATE);
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,6 @@ public class TropicalFish extends AbstractSchoolingFish {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "variant")
|
||||
public int getVariant() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.TROPICAL_FISH_VARIANT);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.TROPICAL_FISH_VARIANT);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class EnderDragon extends Mob {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "phase")
|
||||
public DragonPhases getPhase() {
|
||||
return DragonPhases.values()[metaData.getSets().getInt(EntityMetaDataFields.ENDER_DRAGON_PHASE)];
|
||||
return DragonPhases.byId(this.metaData.getSets().getInt(EntityMetaDataFields.ENDER_DRAGON_PHASE));
|
||||
}
|
||||
|
||||
public enum DragonPhases {
|
||||
@ -44,6 +44,12 @@ public class EnderDragon extends Mob {
|
||||
SITTING_ATTACKING,
|
||||
CHARGE_PLAYER,
|
||||
DEATH,
|
||||
HOVER
|
||||
HOVER;
|
||||
|
||||
private static final DragonPhases[] DRAGON_PHASES = values();
|
||||
|
||||
public static DragonPhases byId(int id) {
|
||||
return DRAGON_PHASES[id];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,21 +30,21 @@ public class WitherBoss extends Monster {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "centerHeadTargetEntityId")
|
||||
public int getCenterHeadTargetEntityId() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.WITHER_BOSS_CENTER_HEAD_TARGET_ENTITY_ID);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.WITHER_BOSS_CENTER_HEAD_TARGET_ENTITY_ID);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "leftHeadTargetEntityId")
|
||||
public int getLeftHeadTargetEntityId() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.WITHER_BOSS_LEFT_HEAD_TARGET_ENTITY_ID);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.WITHER_BOSS_LEFT_HEAD_TARGET_ENTITY_ID);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "rightHeadTargetEntityId")
|
||||
public int getRightHeadTargetEntityId() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.WITHER_BOSS_RIGHT_HEAD_TARGET_ENTITY_ID);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.WITHER_BOSS_RIGHT_HEAD_TARGET_ENTITY_ID);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "invulnerableTime")
|
||||
public int getInvulnerableTime() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.WITHER_BOSS_INVULNERABLE_TIME);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.WITHER_BOSS_INVULNERABLE_TIME);
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class ArmorStand extends LivingEntity {
|
||||
}
|
||||
|
||||
private boolean getArmorStandFlag(int bitMask) {
|
||||
return metaData.getSets().getBitMask(EntityMetaDataFields.ARMOR_STAND_FLAGS, bitMask);
|
||||
return this.metaData.getSets().getBitMask(EntityMetaDataFields.ARMOR_STAND_FLAGS, bitMask);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isSmall")
|
||||
@ -54,32 +54,32 @@ public class ArmorStand extends LivingEntity {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "headRotation")
|
||||
public EntityRotation getHeadRotation() {
|
||||
return metaData.getSets().getRotation(EntityMetaDataFields.ARMOR_STAND_HEAD_ROTATION);
|
||||
return this.metaData.getSets().getRotation(EntityMetaDataFields.ARMOR_STAND_HEAD_ROTATION);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "bodyRotation")
|
||||
public EntityRotation getBodyRotation() {
|
||||
return metaData.getSets().getRotation(EntityMetaDataFields.ARMOR_STAND_BODY_ROTATION);
|
||||
return this.metaData.getSets().getRotation(EntityMetaDataFields.ARMOR_STAND_BODY_ROTATION);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "leftArmRotation")
|
||||
public EntityRotation getLeftArmRotation() {
|
||||
return metaData.getSets().getRotation(EntityMetaDataFields.ARMOR_STAND_LEFT_ARM_ROTATION);
|
||||
return this.metaData.getSets().getRotation(EntityMetaDataFields.ARMOR_STAND_LEFT_ARM_ROTATION);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "rightArmRotation")
|
||||
public EntityRotation getRightArmRotation() {
|
||||
return metaData.getSets().getRotation(EntityMetaDataFields.ARMOR_STAND_RIGHT_ARM_ROTATION);
|
||||
return this.metaData.getSets().getRotation(EntityMetaDataFields.ARMOR_STAND_RIGHT_ARM_ROTATION);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "leftLegRotation")
|
||||
public EntityRotation getLeftLegRotation() {
|
||||
return metaData.getSets().getRotation(EntityMetaDataFields.ARMOR_STAND_LEFT_LAG_ROTATION);
|
||||
return this.metaData.getSets().getRotation(EntityMetaDataFields.ARMOR_STAND_LEFT_LAG_ROTATION);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "leftRightRotation")
|
||||
public EntityRotation getRightLegRotation() {
|
||||
return metaData.getSets().getRotation(EntityMetaDataFields.ARMOR_STAND_RIGHT_LAG_ROTATION);
|
||||
return this.metaData.getSets().getRotation(EntityMetaDataFields.ARMOR_STAND_RIGHT_LAG_ROTATION);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,16 +29,15 @@ public class ItemFrame extends HangingEntity {
|
||||
super(connection, entityId, uuid, location, rotation);
|
||||
}
|
||||
|
||||
|
||||
@EntityMetaDataFunction(identifier = "item")
|
||||
@Nullable
|
||||
public Slot getItem() {
|
||||
return metaData.getSets().getSlot(EntityMetaDataFields.ITEM_FRAME_ITEM);
|
||||
return this.metaData.getSets().getSlot(EntityMetaDataFields.ITEM_FRAME_ITEM);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "itemRotationLevel")
|
||||
public int get() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.ITEM_FRAME_ROTATION);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.ITEM_FRAME_ROTATION);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ public class Painting extends Entity {
|
||||
|
||||
public Painting(Connection connection, int entityId, UUID uuid, Location location, EntityRotation rotation) {
|
||||
super(connection, entityId, uuid, location, rotation);
|
||||
direction = Directions.NORTH;
|
||||
motive = new Motive("kebab");
|
||||
this.direction = Directions.NORTH;
|
||||
this.motive = new Motive("kebab");
|
||||
}
|
||||
|
||||
public Painting(Connection connection, int entityId, UUID uuid, BlockPosition position, Directions direction, Motive motive) {
|
||||
@ -42,11 +42,11 @@ public class Painting extends Entity {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "direction")
|
||||
public Directions getDirection() {
|
||||
return direction;
|
||||
return this.direction;
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "motive")
|
||||
public Motive getMotive() {
|
||||
return motive;
|
||||
return this.motive;
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class ItemEntity extends Entity {
|
||||
@EntityMetaDataFunction(identifier = "item")
|
||||
@Nullable
|
||||
public Slot getItem() {
|
||||
return metaData.getSets().getSlot(EntityMetaDataFields.ITEM_ITEM);
|
||||
return this.metaData.getSets().getSlot(EntityMetaDataFields.ITEM_ITEM);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,6 @@ public class PrimedTNT extends Entity {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "fuseTime")
|
||||
public int getFuseTime() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.PRIMED_TNT_FUSE_TIME);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.PRIMED_TNT_FUSE_TIME);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public class Blaze extends Monster {
|
||||
}
|
||||
|
||||
private boolean getFlag(int bitMask) {
|
||||
return metaData.getSets().getBitMask(EntityMetaDataFields.BLAZE_FLAGS, bitMask);
|
||||
return this.metaData.getSets().getBitMask(EntityMetaDataFields.BLAZE_FLAGS, bitMask);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isBurning")
|
||||
|
@ -29,16 +29,16 @@ public class Creeper extends Monster {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "state")
|
||||
public int getState() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.CREEPER_STATE);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.CREEPER_STATE);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isCharged")
|
||||
public boolean isCharged() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.CREEPER_IS_CHARGED);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.CREEPER_IS_CHARGED);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isIgnited")
|
||||
public boolean isIgnited() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.CREEPER_IS_IGNITED);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.CREEPER_IS_IGNITED);
|
||||
}
|
||||
}
|
||||
|
@ -32,19 +32,19 @@ public class Enderman extends AbstractSkeleton {
|
||||
@EntityMetaDataFunction(identifier = "carriedBlock")
|
||||
@Nullable
|
||||
public Block getCarriedBlock() {
|
||||
if (versionId <= 47) { // ToDo: No clue here
|
||||
return connection.getMapping().getBlockById(metaData.getSets().getInt(EntityMetaDataFields.LEGACY_ENDERMAN_CARRIED_BLOCK) << 4 | metaData.getSets().getInt(EntityMetaDataFields.LEGACY_ENDERMAN_CARRIED_BLOCK_DATA));
|
||||
if (this.versionId <= 47) { // ToDo: No clue here
|
||||
return this.connection.getMapping().getBlockById(this.metaData.getSets().getInt(EntityMetaDataFields.LEGACY_ENDERMAN_CARRIED_BLOCK) << 4 | this.metaData.getSets().getInt(EntityMetaDataFields.LEGACY_ENDERMAN_CARRIED_BLOCK_DATA));
|
||||
}
|
||||
return metaData.getSets().getBlock(EntityMetaDataFields.ENDERMAN_CARRIED_BLOCK);
|
||||
return this.metaData.getSets().getBlock(EntityMetaDataFields.ENDERMAN_CARRIED_BLOCK);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isScreaming")
|
||||
public boolean isScreaming() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.ENDERMAN_IS_SCREAMING);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.ENDERMAN_IS_SCREAMING);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isStarring")
|
||||
public boolean isStarring() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.ENDERMAN_IS_STARRING);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.ENDERMAN_IS_STARRING);
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,6 @@ public class Ghast extends FlyingMob {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isAttacking")
|
||||
public boolean isAttacking() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.GHAST_IS_ATTACKING);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.GHAST_IS_ATTACKING);
|
||||
}
|
||||
}
|
||||
|
@ -29,11 +29,11 @@ public class Guardian extends Monster {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isMoving")
|
||||
public boolean isMoving() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.GUARDIAN_IS_MOVING);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.GUARDIAN_IS_MOVING);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "attackedEntityId")
|
||||
public int getAttackEntityId() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.GUARDIAN_TARGET_ENTITY_ID);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.GUARDIAN_TARGET_ENTITY_ID);
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,6 @@ public class Phantom extends FlyingMob {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "size")
|
||||
public int getSize() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.PHANTOM_SIZE);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.PHANTOM_SIZE);
|
||||
}
|
||||
}
|
||||
|
@ -35,22 +35,22 @@ public class Shulker extends AbstractGolem {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "attachmentFace")
|
||||
public Directions getAttachmentFace() {
|
||||
return metaData.getSets().getDirection(EntityMetaDataFields.SHULKER_ATTACH_FACE);
|
||||
return this.metaData.getSets().getDirection(EntityMetaDataFields.SHULKER_ATTACH_FACE);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "attachmentPosition")
|
||||
@Nullable
|
||||
public BlockPosition getAttachmentPosition() {
|
||||
return metaData.getSets().getPosition(EntityMetaDataFields.SHULKER_ATTACHMENT_POSITION);
|
||||
return this.metaData.getSets().getPosition(EntityMetaDataFields.SHULKER_ATTACHMENT_POSITION);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "peek")
|
||||
public byte getPeek() {
|
||||
return metaData.getSets().getByte(EntityMetaDataFields.SHULKER_PEEK);
|
||||
return this.metaData.getSets().getByte(EntityMetaDataFields.SHULKER_PEEK);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "color")
|
||||
public RGBColor getColor() {
|
||||
return ChatColors.getColorById(metaData.getSets().getByte(EntityMetaDataFields.SHULKER_COLOR));
|
||||
return ChatColors.getColorById(this.metaData.getSets().getByte(EntityMetaDataFields.SHULKER_COLOR));
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,6 @@ public class Slime extends Mob {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "size")
|
||||
public int getSize() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.SLIME_SIZE);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.SLIME_SIZE);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public class Spider extends Monster {
|
||||
}
|
||||
|
||||
private boolean getSpiderFlag(int bitMask) {
|
||||
return metaData.getSets().getBitMask(EntityMetaDataFields.SPIDER_FLAGS, bitMask);
|
||||
return this.metaData.getSets().getBitMask(EntityMetaDataFields.SPIDER_FLAGS, bitMask);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isClimbing")
|
||||
|
@ -28,10 +28,9 @@ public class Vex extends Monster {
|
||||
}
|
||||
|
||||
private boolean getVexFlag(int bitMask) {
|
||||
return metaData.getSets().getBitMask(EntityMetaDataFields.VEX_FLAGS, bitMask);
|
||||
return this.metaData.getSets().getBitMask(EntityMetaDataFields.VEX_FLAGS, bitMask);
|
||||
}
|
||||
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isAttacking")
|
||||
public boolean isAttacking() {
|
||||
return getVexFlag(0x01);
|
||||
|
@ -29,6 +29,6 @@ public class Zoglin extends Monster {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isBaby")
|
||||
public boolean isBaby() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.ZOGLIN_IS_BABY);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.ZOGLIN_IS_BABY);
|
||||
}
|
||||
}
|
||||
|
@ -29,17 +29,17 @@ public class Zombie extends Monster {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isBaby")
|
||||
public boolean isBaby() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.ZOMBIE_IS_BABY);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.ZOMBIE_IS_BABY);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "specialType")
|
||||
public int getSpecialType() {
|
||||
return metaData.getSets().getInt(EntityMetaDataFields.ZOMBIE_SPECIAL_TYPE);
|
||||
return this.metaData.getSets().getInt(EntityMetaDataFields.ZOMBIE_SPECIAL_TYPE);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isConvertingToDrowned")
|
||||
public boolean isConvertingToDrowned() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.ZOMBIE_DROWNING_CONVERSION);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.ZOMBIE_DROWNING_CONVERSION);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,12 +30,12 @@ public class ZombieVillager extends Zombie {
|
||||
|
||||
@EntityMetaDataFunction(identifier = "isConverting")
|
||||
public boolean isConverting() {
|
||||
return metaData.getSets().getBoolean(EntityMetaDataFields.ZOMBIE_VILLAGER_IS_CONVERTING);
|
||||
return this.metaData.getSets().getBoolean(EntityMetaDataFields.ZOMBIE_VILLAGER_IS_CONVERTING);
|
||||
}
|
||||
|
||||
@EntityMetaDataFunction(identifier = "villagerData")
|
||||
public VillagerData getVillagerData() {
|
||||
return metaData.getSets().getVillagerData(EntityMetaDataFields.ZOMBIE_VILLAGER_DATA);
|
||||
return this.metaData.getSets().getVillagerData(EntityMetaDataFields.ZOMBIE_VILLAGER_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user