buildscript {\r
repositories {\r
- maven { url = "http://files.minecraftforge.net/maven" }\r
+ maven { url = "https://files.minecraftforge.net/maven" }\r
jcenter()\r
mavenCentral()\r
}\r
dependencies {\r
- classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true\r
+ classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1.+', changing: true\r
classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.4'\r
}\r
}\r
//apply plugin: 'maven-publish'\r
apply plugin: 'com.github.johnrengelman.shadow'\r
\r
-version = "1.16"\r
+version = "1.17"\r
group = "com.burnedkirby.TurnBasedMinecraft"\r
archivesBaseName = "TurnBasedMinecraft"\r
\r
-sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.\r
+java.toolchain.languageVersion = JavaLanguageVersion.of(8)\r
+println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))\r
\r
minecraft {\r
// The mappings can be changed at any time, and must be in the following format.\r
// stable_# Stables are built at the discretion of the MCP team.\r
// Use non-default mappings at your own risk. they may not always work.\r
// Simply re-run your setup task after changing the mappings to update your workspace.\r
- mappings channel: 'snapshot', version: '20200514-1.16'\r
+ mappings channel: 'official', version: '1.16.5'\r
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.\r
\r
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')\r
workingDirectory project.file('run')\r
\r
// Recommended logging data for a userdev environment\r
- property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'\r
+ property 'forge.logging.markers', 'REGISTRIES'\r
\r
// Recommended logging level for the console\r
property 'forge.logging.console.level', 'debug'\r
workingDirectory project.file('run')\r
\r
// Recommended logging data for a userdev environment\r
- property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'\r
+ property 'forge.logging.markers', 'REGISTRIES'\r
\r
// Recommended logging level for the console\r
property 'forge.logging.console.level', 'debug'\r
workingDirectory project.file('run')\r
\r
// Recommended logging data for a userdev environment\r
- property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'\r
+ property 'forge.logging.markers', 'REGISTRIES'\r
\r
// Recommended logging level for the console\r
property 'forge.logging.console.level', 'debug'\r
\r
- args '--mod', 'TurnBasedMinecraftMod', '--all', '--output', file('src/generated/resources/')\r
+ args '--mod', 'TurnBasedMinecraftMod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources')\r
\r
mods {\r
TurnBasedMinecraftMod {\r
}\r
}\r
\r
+// Include resources generated by data generators.\r
+sourceSets.main.resources { srcDir 'src/generated/resources' }\r
+\r
dependencies {\r
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed\r
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.\r
// The userdev artifact is a special name and will get all sorts of transformations applied to it.\r
- minecraft 'net.minecraftforge:forge:1.16.3-34.1.0'\r
+ minecraft 'net.minecraftforge:forge:1.16.5-36.1.0'\r
\r
// You may put jars on which you depend on in ./libs or you may define them like so..\r
// compile "some.group:artifact:version:classifier"\r
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
#!/usr/bin/env sh
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
##############################################################################
##
## Gradle start up script for UN*X
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
else
eval `echo args$i`="\"$arg\""
fi
- i=$((i+1))
+ i=`expr $i + 1`
done
case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ 0) set -- ;;
+ 1) set -- "$args0" ;;
+ 2) set -- "$args0" "$args1" ;;
+ 3) set -- "$args0" "$args1" "$args2" ;;
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
-APP_ARGS=$(save "$@")
+APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
-if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
- cd "$(dirname "$0")"
-fi
-
exec "$JAVACMD" "$@"
+@rem\r
+@rem Copyright 2015 the original author or authors.\r
+@rem\r
+@rem Licensed under the Apache License, Version 2.0 (the "License");\r
+@rem you may not use this file except in compliance with the License.\r
+@rem You may obtain a copy of the License at\r
+@rem\r
+@rem https://www.apache.org/licenses/LICENSE-2.0\r
+@rem\r
+@rem Unless required by applicable law or agreed to in writing, software\r
+@rem distributed under the License is distributed on an "AS IS" BASIS,\r
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+@rem See the License for the specific language governing permissions and\r
+@rem limitations under the License.\r
+@rem\r
+\r
@if "%DEBUG%" == "" @echo off\r
@rem ##########################################################################\r
@rem\r
set APP_BASE_NAME=%~n0\r
set APP_HOME=%DIRNAME%\r
\r
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.\r
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi\r
+\r
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\r
-set DEFAULT_JVM_OPTS=\r
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"\r
\r
@rem Find java.exe\r
if defined JAVA_HOME goto findJavaFromJavaHome\r
\r
set JAVA_EXE=java.exe\r
%JAVA_EXE% -version >NUL 2>&1\r
-if "%ERRORLEVEL%" == "0" goto init\r
+if "%ERRORLEVEL%" == "0" goto execute\r
\r
echo.\r
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\r
set JAVA_HOME=%JAVA_HOME:"=%\r
set JAVA_EXE=%JAVA_HOME%/bin/java.exe\r
\r
-if exist "%JAVA_EXE%" goto init\r
+if exist "%JAVA_EXE%" goto execute\r
\r
echo.\r
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\r
\r
goto fail\r
\r
-:init\r
-@rem Get command-line arguments, handling Windows variants\r
-\r
-if not "%OS%" == "Windows_NT" goto win9xME_args\r
-\r
-:win9xME_args\r
-@rem Slurp the command line arguments.\r
-set CMD_LINE_ARGS=\r
-set _SKIP=2\r
-\r
-:win9xME_args_slurp\r
-if "x%~1" == "x" goto execute\r
-\r
-set CMD_LINE_ARGS=%*\r
-\r
:execute\r
@rem Setup the command line\r
\r
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar\r
\r
+\r
@rem Execute Gradle\r
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\r
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*\r
\r
:end\r
@rem End local scope for the variables with windows NT shell\r
}
stateChanged = false;
- // field_230705_e_ is probably a list of buttons
- field_230705_e_.clear();
- // field_230710_m_ is probably a list of gui elements
- field_230710_m_.clear();
+ buttons.clear();
+ children.clear();
switch (state) {
case MAIN_MENU:
info = "What will you do?";
- // func_230480_a_ is probably addButton
- // field_230708_k_ is probably width
- // field_230709_l_ is probably height
- func_230480_a_(new Button(field_230708_k_ * 3 / 7 - 25, 40, 50, 20, new StringTextComponent("Attack"), (button) -> {
+ addButton(new Button(width * 3 / 7 - 25, 40, 50, 20, new StringTextComponent("Attack"), (button) -> {
buttonActionEvent(button, ButtonAction.ATTACK);
}));
- func_230480_a_(new Button(field_230708_k_ * 4 / 7 - 25, 40, 50, 20, new StringTextComponent("Defend"), (button) -> {
+ addButton(new Button(width * 4 / 7 - 25, 40, 50, 20, new StringTextComponent("Defend"), (button) -> {
buttonActionEvent(button, ButtonAction.DEFEND);
}));
- func_230480_a_(new Button(field_230708_k_ * 3 / 7 - 25, 60, 50, 20, new StringTextComponent("Item"), (button) -> {
+ addButton(new Button(width * 3 / 7 - 25, 60, 50, 20, new StringTextComponent("Item"), (button) -> {
buttonActionEvent(button, ButtonAction.ITEM);
}));
- func_230480_a_(new Button(field_230708_k_ * 4 / 7 - 25, 60, 50, 20, new StringTextComponent("Flee"), (button) -> {
+ addButton(new Button(width * 4 / 7 - 25, 60, 50, 20, new StringTextComponent("Flee"), (button) -> {
buttonActionEvent(button, ButtonAction.FLEE);
}));
break;
for (Map.Entry<Integer, Combatant> e : TurnBasedMinecraftMod.proxy.getLocalBattle()
.getSideAEntrySet()) {
if (e.getValue().entity != null) {
- func_230480_a_(new EntitySelectionButton(field_230708_k_ / 4 - 60, y, 120, 20, e.getValue().entity.getName().getString(), e.getKey(), true, (button) -> {
+ addButton(new EntitySelectionButton(width / 4 - 60, y, 120, 20, e.getValue().entity.getName().getString(), e.getKey(), true, (button) -> {
buttonActionEvent(button, ButtonAction.ATTACK_TARGET);
}));
} else {
- func_230480_a_(new EntitySelectionButton(field_230708_k_ / 4 - 60, y, 120, 20, "Unknown", e.getKey(), true, (button) -> {
+ addButton(new EntitySelectionButton(width / 4 - 60, y, 120, 20, "Unknown", e.getKey(), true, (button) -> {
buttonActionEvent(button, ButtonAction.ATTACK_TARGET);
}));
}
for (Map.Entry<Integer, Combatant> e : TurnBasedMinecraftMod.proxy.getLocalBattle()
.getSideBEntrySet()) {
if (e.getValue().entity != null) {
- func_230480_a_(new EntitySelectionButton(field_230708_k_ * 3 / 4 - 60, y, 120, 20, e.getValue().entity.getName().getString(), e.getKey(), false, (button) -> {
+ addButton(new EntitySelectionButton(width * 3 / 4 - 60, y, 120, 20, e.getValue().entity.getName().getString(), e.getKey(), false, (button) -> {
buttonActionEvent(button, ButtonAction.ATTACK_TARGET);
}));
} else {
- func_230480_a_(new EntitySelectionButton(field_230708_k_ * 3 / 4 - 60, y, 120, 20, "Unknown", e.getKey(), false, (button) -> {
+ addButton(new EntitySelectionButton(width * 3 / 4 - 60, y, 120, 20, "Unknown", e.getKey(), false, (button) -> {
buttonActionEvent(button, ButtonAction.ATTACK_TARGET);
}));
}
} catch (ConcurrentModificationException e) {
// ignored
}
- func_230480_a_(new Button(field_230708_k_ / 2 - 30, field_230709_l_ - 120, 60, 20, new StringTextComponent("Cancel"), (button) -> {
+ addButton(new Button(width / 2 - 30, height - 120, 60, 20, new StringTextComponent("Cancel"), (button) -> {
buttonActionEvent(button, ButtonAction.CANCEL);
}));
break;
case ITEM_ACTION:
info = "What will you do with an item?";
- func_230480_a_(new Button(field_230708_k_ * 1 / 4 - 40, field_230709_l_ - 120, 80, 20, new StringTextComponent("Switch Held"), (button) -> {
+ addButton(new Button(width * 1 / 4 - 40, height - 120, 80, 20, new StringTextComponent("Switch Held"), (button) -> {
buttonActionEvent(button, ButtonAction.SWITCH_HELD_ITEM);
}));
- func_230480_a_(new Button(field_230708_k_ * 2 / 4 - 40, field_230709_l_ - 120, 80, 20, new StringTextComponent("Use"), (button) -> {
+ addButton(new Button(width * 2 / 4 - 40, height - 120, 80, 20, new StringTextComponent("Use"), (button) -> {
buttonActionEvent(button, ButtonAction.DECIDE_USE_ITEM);
}));
- func_230480_a_(new Button(field_230708_k_ * 3 / 4 - 40, field_230709_l_ - 120, 80, 20, new StringTextComponent("Cancel"), (button) -> {
+ addButton(new Button(width * 3 / 4 - 40, height - 120, 80, 20, new StringTextComponent("Cancel"), (button) -> {
buttonActionEvent(button, ButtonAction.CANCEL);
}));
break;
case SWITCH_ITEM:
info = "To which item will you switch to?";
for (int i = 0; i < 9; ++i) {
- func_230480_a_(new ItemSelectionButton(field_230708_k_ / 2 - 88 + i * 20, field_230709_l_ - 19, 16, 16, "", i, (button) -> {
+ addButton(new ItemSelectionButton(width / 2 - 88 + i * 20, height - 19, 16, 16, "", i, (button) -> {
buttonActionEvent(button, ButtonAction.DO_ITEM_SWITCH);
}));
}
- func_230480_a_(new Button(field_230708_k_ / 2 - 40, field_230709_l_ - 120, 80, 20, new StringTextComponent("Cancel"), (button) -> {
+ addButton(new Button(width / 2 - 40, height - 120, 80, 20, new StringTextComponent("Cancel"), (button) -> {
buttonActionEvent(button, ButtonAction.CANCEL);
}));
break;
case USE_ITEM:
info = "Which item will you use?";
for (int i = 0; i < 9; ++i) {
- func_230480_a_(new ItemSelectionButton(field_230708_k_ / 2 - 88 + i * 20, field_230709_l_ - 19, 16, 16, "", i, (button) -> {
+ addButton(new ItemSelectionButton(width / 2 - 88 + i * 20, height - 19, 16, 16, "", i, (button) -> {
buttonActionEvent(button, ButtonAction.DO_USE_ITEM);
}));
}
- func_230480_a_(new Button(field_230708_k_ / 2 - 40, field_230709_l_ - 120, 80, 20, new StringTextComponent("Cancel"), (button) -> {
+ addButton(new Button(width / 2 - 40, height - 120, 80, 20, new StringTextComponent("Cancel"), (button) -> {
buttonActionEvent(button, ButtonAction.CANCEL);
}));
break;
}
@Override
- public void func_230430_a_(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
+ public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
if (TurnBasedMinecraftMod.proxy.getLocalBattle() == null) {
- // drawHoveringText("Waiting...", field_230708_k_ / 2 - 50, field_230709_l_ / 2);
- drawString(matrixStack, "Waiting...", field_230708_k_ / 2 - 50, field_230709_l_ / 2, 0xFFFFFFFF);
+ // drawHoveringText("Waiting...", width / 2 - 50, height / 2);
+ drawString(matrixStack, "Waiting...", width / 2 - 50, height / 2, 0xFFFFFFFF);
return;
}
if (TurnBasedMinecraftMod.proxy.getLocalBattle().getState() == Battle.State.DECISION
updateState();
- super.func_230430_a_(matrixStack, mouseX, mouseY, partialTicks);
+ super.render(matrixStack, mouseX, mouseY, partialTicks);
String timeRemainingString = "Time remaining: ";
int timeRemainingInt = timeRemaining.get();
timeRemainingString += "\u00A7c";
}
timeRemainingString += Integer.toString(timeRemainingInt);
- int stringWidth = field_230712_o_.getStringWidth(timeRemainingString);
- // func_238467_a_ is probably fill
- func_238467_a_(matrixStack, field_230708_k_ / 2 - stringWidth / 2, 5, field_230708_k_ / 2 + stringWidth / 2, 15, 0x70000000);
- drawString(matrixStack, timeRemainingString, field_230708_k_ / 2 - stringWidth / 2, 5, 0xFFFFFFFF);
- stringWidth = field_230712_o_.getStringWidth(info);
- func_238467_a_(matrixStack, field_230708_k_ / 2 - stringWidth / 2, 20, field_230708_k_ / 2 + stringWidth / 2, 30, 0x70000000);
- drawString(matrixStack, info, field_230708_k_ / 2 - stringWidth / 2, 20, 0xFFFFFFFF);
+ int stringWidth = font.width(timeRemainingString);
+ fill(matrixStack, width / 2 - stringWidth / 2, 5, width / 2 + stringWidth / 2, 15, 0x70000000);
+ drawString(matrixStack, timeRemainingString, width / 2 - stringWidth / 2, 5, 0xFFFFFFFF);
+ stringWidth = font.width(info);
+ fill(matrixStack, width / 2 - stringWidth / 2, 20, width / 2 + stringWidth / 2, 30, 0x70000000);
+ drawString(matrixStack, info, width / 2 - stringWidth / 2, 20, 0xFFFFFFFF);
}
protected void buttonActionEvent(Button button, ButtonAction action) {
.sendToServer(new PacketBattleDecision(TurnBasedMinecraftMod.proxy.getLocalBattle().getId(),
Battle.Decision.SWITCH_ITEM, ((ItemSelectionButton) button).getID()));
if (((ItemSelectionButton) button).getID() >= 0 && ((ItemSelectionButton) button).getID() < 9) {
- Minecraft.getInstance().player.inventory.currentItem = ((ItemSelectionButton) button).getID();
+ Minecraft.getInstance().player.inventory.selected = ((ItemSelectionButton) button).getID();
}
setState(MenuState.WAITING);
} else {
}
}
-// @Override
-// protected void init() {
-// }
-
- // func_231177_au__ is probably isPauseScreen
@Override
- public boolean func_231177_au__() {
+ public boolean isPauseScreen() {
return false;
}
- // func_231046_a_ is probably keyPressed
@Override
- public boolean func_231046_a_(int a, int b, int c) {
+ public boolean keyPressed(int a, int b, int c) {
+ if (getMinecraft().player.isCreative()) {
+ return super.keyPressed(a, b, c);
+ }
+ return false; // TODO verify return value
+ }
+
+ @Override
+ public boolean keyReleased(int a, int b, int c) {
if (getMinecraft().player.isCreative()) {
- return super.func_231046_a_(a, b, c);
+ return super.keyReleased(a, b, c);
}
return false; // TODO verify return value
}
}
private void drawString(MatrixStack matrixStack, String string, int x, int y, int color) {
- field_230712_o_.func_238405_a_(matrixStack, string, x, y, color);
+ font.draw(matrixStack, string, x, y, color);
}
}
if(initialized && next != null)
{
logger.debug("play called with file " + next.getName() + " and vol " + volume);
- Minecraft.getInstance().getSoundHandler().pause();
+ Minecraft.getInstance().getSoundManager().pause();
String suffix = next.getName().substring(next.getName().length() - 3).toLowerCase();
if(suffix.equals("mid") && sequencer != null)
{
}
if(resumeMCSounds)
{
- Minecraft.getInstance().getSoundHandler().resume();
+ Minecraft.getInstance().getSoundManager().resume();
}
isPlaying = false;
}
@Override
public void setBattleGuiAsGui()
{
- if(Minecraft.getInstance().currentScreen != battleGui)
+ if(Minecraft.getInstance().screen != battleGui)
{
battleGui.turnEnd();
- Minecraft.getInstance().displayGuiScreen(battleGui);
+ Minecraft.getInstance().setScreen(battleGui);
}
}
public void battleEnded()
{
localBattle = null;
- Minecraft.getInstance().displayGuiScreen(null);
+ Minecraft.getInstance().setScreen(null);
stopMusic(true);
battleMusicCount = 0;
sillyMusicCount = 0;
@Override
public void playBattleMusic()
{
- GameSettings gs = Minecraft.getInstance().gameSettings;
- battleMusic.playBattle(gs.getSoundLevel(SoundCategory.MUSIC) * gs.getSoundLevel(SoundCategory.MASTER));
+ GameSettings gs = Minecraft.getInstance().options;
+ battleMusic.playBattle(gs.getSoundSourceVolume(SoundCategory.MUSIC) * gs.getSoundSourceVolume(SoundCategory.MASTER));
}
@Override
public void playSillyMusic()
{
- GameSettings gs = Minecraft.getInstance().gameSettings;
- battleMusic.playSilly(gs.getSoundLevel(SoundCategory.MUSIC) * gs.getSoundLevel(SoundCategory.MASTER));
+ GameSettings gs = Minecraft.getInstance().options;
+ battleMusic.playSilly(gs.getSoundSourceVolume(SoundCategory.MUSIC) * gs.getSoundSourceVolume(SoundCategory.MASTER));
}
@Override
StringTextComponent prefix = new StringTextComponent("TBM: ");
// func_240718_a_ is set color
// func_240713_a_ is set bold
- prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
+ prefix.withStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true));
StringTextComponent text = new StringTextComponent(message);
prefix.getSiblings().add(text);
- text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
+ text.withStyle(text.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)).withBold(false));
// UUID is required by sendMessage, but appears to be unused, so just give dummy UUID
Minecraft.getInstance().player.sendMessage(prefix, UUID.randomUUID());
}
@Override
public void createLocalBattle(int id)
{
- localBattle = new Battle(null, id, null, null, false, Minecraft.getInstance().world.func_234923_W_());
+ localBattle = new Battle(null, id, null, null, false, Minecraft.getInstance().level.dimension());
}
@Override
public Entity getEntity(int id, RegistryKey<World> dim) {
- return Minecraft.getInstance().world.getEntityByID(id);
+ return Minecraft.getInstance().level.getEntity(id);
}
}
}
@Override
- public void func_230430_a_(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
- super.func_230430_a_(matrixStack, mouseX, mouseY, partialTicks);
- Entity e = Minecraft.getInstance().world.getEntityByID(entityID);
+ public void renderButton(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
+ super.renderButton(matrixStack, mouseX, mouseY, partialTicks);
+ Entity e = Minecraft.getInstance().level.getEntity(entityID);
if (e != null && e instanceof LivingEntity && ((LivingEntity) e).isAlive()) {
int health = (int) (((LivingEntity) e).getHealth() + 0.5f);
int xpos = getX();
}
private int getX() {
- return field_230690_l_;
+ return x;
}
private int getY() {
- return field_230691_m_;
- }
-
- private int getWidth() {
- return field_230688_j_;
- }
-
- private int getHeight() {
- return field_230689_k_;
- }
-
- private void fill(MatrixStack matrixStack, int x, int y, int width, int height, int color) {
- func_238467_a_(matrixStack, x, y, width, height, color);
+ return y;
}
}
}
@Override
- public void func_230430_a_(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
- // field_230694_p_ is probably isVisible
- if (field_230694_p_) {
+ public void renderButton(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
+ if (visible) {
boolean hovered = mouseX >= getX() && mouseY >= getY() && mouseX < getX() + getWidth() && mouseY < getY() + getHeight();
if (hovered) {
fill(matrixStack, getX(), getY(), getX() + getWidth(), getY() + getHeight(), 0x80FFFFFF);
}
private int getX() {
- return field_230690_l_;
+ return x;
}
private int getY() {
- return field_230691_m_;
+ return y;
}
-
- private int getWidth() {
- return field_230688_j_;
- }
-
- private int getHeight() {
- return field_230689_k_;
-
- }
-
- private void fill(MatrixStack matrixStack, int x, int y, int width, int height, int color) {
- func_238467_a_(matrixStack, x, y, width, height, color);
- }
-}
+}
\ No newline at end of file
{
private boolean isAttackerValid(LivingAttackEvent event)
{
- if(event.getSource().getTrueSource() == null)
+ if(event.getSource().getEntity() == null)
{
return false;
}
- else if(event.getSource().getTrueSource().equals(TurnBasedMinecraftMod.proxy.getAttackingEntity()))
+ else if(event.getSource().getEntity().equals(TurnBasedMinecraftMod.proxy.getAttackingEntity()))
{
return true;
}
{
iter.remove();
}
- else if(event.getSource().getTrueSource().equals(attacker.entity) && event.getSource().isProjectile())
+ else if(event.getSource().getEntity().equals(attacker.entity) && event.getSource().isProjectile())
{
iter.remove();
if(!isValid)
Battle b = TurnBasedMinecraftMod.proxy.getBattleManager().getBattleByID(attacker.battleID);
if(b != null)
{
- b.sendMessageToAllPlayers(PacketBattleMessage.MessageType.ARROW_HIT, attacker.entity.getEntityId(), event.getEntity().getEntityId(), 0);
+ b.sendMessageToAllPlayers(PacketBattleMessage.MessageType.ARROW_HIT, attacker.entity.getId(), event.getEntity().getId(), 0);
}
isValid = true;
}
@SubscribeEvent
public void entityAttacked(LivingAttackEvent event)
{
- if(event.getEntity().world.isRemote)
+ if(event.getEntity().level.isClientSide)
{
return;
}
BattleManager battleManager = proxy.getBattleManager();
// handle edit entity, pick entity via attack
{
- if(event.getSource().getTrueSource() != null && event.getEntity() != null)
+ if(event.getSource().getEntity() != null && event.getEntity() != null)
{
- final EditingInfo editingInfo = proxy.getEditingInfo(event.getSource().getTrueSource().getEntityId());
+ final EditingInfo editingInfo = proxy.getEditingInfo(event.getSource().getEntity().getId());
if(editingInfo != null && editingInfo.isPendingEntitySelection)
{
editingInfo.isPendingEntitySelection = false;
TurnBasedMinecraftMod.getHandler().send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity)editingInfo.editor), new PacketGeneralMessage("Cannot edit custom name from entity without custom name"));
return;
}
- editingInfo.entityInfo = config.getCustomEntityInfo(event.getEntity().getCustomName().getUnformattedComponentText());
+ editingInfo.entityInfo = config.getCustomEntityInfo(event.getEntity().getCustomName().getString());
if(editingInfo.entityInfo == null)
{
editingInfo.entityInfo = new EntityInfo();
editingInfo.entityInfo.customName = event.getEntity().getCustomName().getString();
}
- TurnBasedMinecraftMod.getHandler().send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity)editingInfo.editor), new PacketGeneralMessage("Editing custom name \"" + event.getEntity().getCustomName().getUnformattedComponentText() + "\""));
+ TurnBasedMinecraftMod.getHandler().send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity)editingInfo.editor), new PacketGeneralMessage("Editing custom name \"" + event.getEntity().getCustomName().getString() + "\""));
TurnBasedMinecraftMod.logger.info("Begin editing custom \"" + event.getEntity().getCustomName().getString() + "\"");
TurnBasedMinecraftMod.getHandler().send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity)editingInfo.editor), new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo));
}
}
}
}
- if(event.getEntity() != null && event.getSource().getTrueSource() != null && (battleManager.isRecentlyLeftBattle(event.getEntity().getEntityId()) || battleManager.isRecentlyLeftBattle(event.getSource().getTrueSource().getEntityId())))
+ if(event.getEntity() != null && event.getSource().getEntity() != null && (battleManager.isRecentlyLeftBattle(event.getEntity().getId()) || battleManager.isRecentlyLeftBattle(event.getSource().getEntity().getId())))
{
- if(event.getSource().getTrueSource().getEntity() instanceof CreeperEntity && TurnBasedMinecraftMod.proxy.getConfig().getCreeperAlwaysAllowDamage()) {
+ if(event.getSource().getEntity().getEntity() instanceof CreeperEntity && TurnBasedMinecraftMod.proxy.getConfig().getCreeperAlwaysAllowDamage()) {
event.setCanceled(false);
} else {
// TurnBasedMinecraftMod.logger.debug("Canceled attack");
}
else if(!isAttackerValid(event)
&& event.getEntity() != null
- && event.getSource().getTrueSource() != null
- && event.getEntity() != event.getSource().getTrueSource()
- && !config.getBattleIgnoringPlayers().contains(event.getSource().getTrueSource().getEntityId())
- && !config.getBattleIgnoringPlayers().contains(event.getEntity().getEntityId())
- && event.getEntity().getEntityWorld().func_234923_W_().equals(event.getSource().getTrueSource().getEntityWorld().func_234923_W_())
+ && event.getSource().getEntity() != null
+ && event.getEntity() != event.getSource().getEntity()
+ && !config.getBattleIgnoringPlayers().contains(event.getSource().getEntity().getId())
+ && !config.getBattleIgnoringPlayers().contains(event.getEntity().getId())
+ && event.getEntity().level.dimension().equals(event.getSource().getEntity().level.dimension())
&& battleManager.checkAttack(event))
{
// TurnBasedMinecraftMod.logger.debug("Canceled LivingAttackEvent between " + TurnBasedMinecraftMod.proxy.getAttackingEntity() + " and " + event.getEntity());
{
Config config = TurnBasedMinecraftMod.proxy.getConfig();
BattleManager battleManager = TurnBasedMinecraftMod.proxy.getBattleManager();
- if(event.getEntity().world.isRemote
+ if(event.getEntity().level.isClientSide
|| config.isOldBattleBehaviorEnabled()
- || (event.getEntity() != null && battleManager.isRecentlyLeftBattle(event.getEntity().getEntityId()))
- || (event.getTarget() != null && battleManager.isRecentlyLeftBattle(event.getTarget().getEntityId()))
+ || (event.getEntity() != null && battleManager.isRecentlyLeftBattle(event.getEntity().getId()))
+ || (event.getTarget() != null && battleManager.isRecentlyLeftBattle(event.getTarget().getId()))
|| (event.getEntity() != null && event.getTarget() != null && Utility.distanceBetweenEntities(event.getEntity(), event.getTarget()) > (double)config.getAggroStartBattleDistance()))
{
return;
}
else if(event.getEntity() != null
&& event.getTarget() != null
- && !config.getBattleIgnoringPlayers().contains(event.getEntity().getEntityId())
- && !config.getBattleIgnoringPlayers().contains(event.getTarget().getEntityId())
- && event.getEntity().getEntityWorld().func_234923_W_().equals(event.getTarget().getEntityWorld().func_234923_W_()))
+ && !config.getBattleIgnoringPlayers().contains(event.getEntity().getId())
+ && !config.getBattleIgnoringPlayers().contains(event.getTarget().getId())
+ && event.getEntity().level.dimension().equals(event.getTarget().level.dimension()))
{
TurnBasedMinecraftMod.proxy.getBattleManager().checkTargeted(event);
}
{
EntityInfo entityInfo;
try {
- entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getCustomEntityInfoReference(e.getCustomName().getUnformattedComponentText());
+ entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getCustomEntityInfoReference(e.getCustomName().getString());
} catch(NullPointerException exception) {
entityInfo = null;
}
Combatant newCombatant = new Combatant(e, entityInfo);
newCombatant.isSideA = true;
newCombatant.battleID = getId();
- this.sideA.put(e.getEntityId(), newCombatant);
+ this.sideA.put(e.getId(), newCombatant);
if(e instanceof PlayerEntity)
{
newCombatant.recalcSpeedOnCompare = true;
playerCount.incrementAndGet();
- players.put(e.getEntityId(), newCombatant);
+ players.put(e.getId(), newCombatant);
}
if(TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled())
{
- newCombatant.x = e.getPosX();
- newCombatant.z = e.getPosZ();
- newCombatant.yaw = e.rotationYaw;
- newCombatant.pitch = e.rotationPitch;
+ newCombatant.x = e.getX();
+ newCombatant.z = e.getZ();
+ newCombatant.yaw = e.xRot;
+ newCombatant.pitch = e.yRot;
}
}
}
{
EntityInfo entityInfo;
try {
- entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getCustomEntityInfoReference(e.getCustomName().getUnformattedComponentText());
+ entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getCustomEntityInfoReference(e.getCustomName().getString());
} catch(NullPointerException exception) {
entityInfo = null;
}
Combatant newCombatant = new Combatant(e, entityInfo);
newCombatant.isSideA = false;
newCombatant.battleID = getId();
- this.sideB.put(e.getEntityId(), newCombatant);
+ this.sideB.put(e.getId(), newCombatant);
if(e instanceof PlayerEntity)
{
newCombatant.recalcSpeedOnCompare = true;
playerCount.incrementAndGet();
- players.put(e.getEntityId(), newCombatant);
+ players.put(e.getId(), newCombatant);
}
if(TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled())
{
- newCombatant.x = e.getPosX();
- newCombatant.z = e.getPosZ();
- newCombatant.yaw = e.rotationYaw;
- newCombatant.pitch = e.rotationPitch;
+ newCombatant.x = e.getX();
+ newCombatant.z = e.getZ();
+ newCombatant.yaw = e.xRot;
+ newCombatant.pitch = e.yRot;
}
}
}
{
if(c.entityInfo != null)
{
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, c.entity.getEntityId(), 0, id, c.entityInfo.category);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, c.entity.getId(), 0, id, c.entityInfo.category);
}
else if(c.entity instanceof PlayerEntity)
{
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, c.entity.getEntityId(), 0, id, "player");
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, c.entity.getId(), 0, id, "player");
}
else
{
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, c.entity.getEntityId(), 0, id);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, c.entity.getId(), 0, id);
}
}
for(Combatant c : this.sideB.values())
{
if(c.entityInfo != null)
{
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, c.entity.getEntityId(), 0, id, c.entityInfo.category);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, c.entity.getId(), 0, id, c.entityInfo.category);
}
else if(c.entity instanceof PlayerEntity)
{
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, c.entity.getEntityId(), 0, id, "player");
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, c.entity.getId(), 0, id, "player");
}
else
{
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, c.entity.getEntityId(), 0, id);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, c.entity.getId(), 0, id);
}
}
}
{
for(Combatant c : sideAEntryQueue)
{
- if(c.entity.getEntityId() == entityID)
+ if(c.entity.getId() == entityID)
{
return true;
}
}
for(Combatant c : sideBEntryQueue)
{
- if(c.entity.getEntityId() == entityID)
+ if(c.entity.getId() == entityID)
{
return true;
}
{
for(Combatant c : sideAEntryQueue)
{
- if(c.entity.getEntityId() == entityID)
+ if(c.entity.getId() == entityID)
{
return true;
}
{
EntityInfo entityInfo;
try {
- entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getCustomEntityInfoReference(e.getCustomName().getUnformattedComponentText());
+ entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getCustomEntityInfoReference(e.getCustomName().getString());
} catch(NullPointerException exception) {
entityInfo = null;
}
}
else
{
- sideA.put(e.getEntityId(), newCombatant);
+ sideA.put(e.getId(), newCombatant);
}
if(e instanceof PlayerEntity)
{
newCombatant.recalcSpeedOnCompare = true;
playerCount.incrementAndGet();
- players.put(e.getEntityId(), newCombatant);
+ players.put(e.getId(), newCombatant);
if(state == State.DECISION)
{
undecidedCount.incrementAndGet();
}
if(TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled())
{
- newCombatant.x = e.getPosX();
- newCombatant.z = e.getPosZ();
- newCombatant.yaw = e.rotationYaw;
- newCombatant.pitch = e.rotationPitch;
+ newCombatant.x = e.getX();
+ newCombatant.z = e.getZ();
+ newCombatant.yaw = e.xRot;
+ newCombatant.pitch = e.yRot;
}
if(isServer)
{
if(newCombatant.entityInfo != null)
{
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, newCombatant.entity.getEntityId(), 0, id, newCombatant.entityInfo.category);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, newCombatant.entity.getId(), 0, id, newCombatant.entityInfo.category);
}
else if(newCombatant.entity instanceof PlayerEntity)
{
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, newCombatant.entity.getEntityId(), 0, id, "player");
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, newCombatant.entity.getId(), 0, id, "player");
}
else
{
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, newCombatant.entity.getEntityId(), 0, id);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, newCombatant.entity.getId(), 0, id);
}
}
notifyPlayersBattleInfo();
{
EntityInfo entityInfo;
try {
- entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getCustomEntityInfoReference(e.getCustomName().getUnformattedComponentText());
+ entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getCustomEntityInfoReference(e.getCustomName().getString());
} catch(NullPointerException exception) {
entityInfo = null;
}
}
else
{
- sideB.put(e.getEntityId(), newCombatant);
+ sideB.put(e.getId(), newCombatant);
}
if(e instanceof PlayerEntity)
{
newCombatant.recalcSpeedOnCompare = true;
playerCount.incrementAndGet();
- players.put(e.getEntityId(), newCombatant);
+ players.put(e.getId(), newCombatant);
if(state == State.DECISION)
{
undecidedCount.incrementAndGet();
}
if(TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled())
{
- newCombatant.x = e.getPosX();
- newCombatant.z = e.getPosZ();
- newCombatant.yaw = e.rotationYaw;
- newCombatant.pitch = e.rotationPitch;
+ newCombatant.x = e.getX();
+ newCombatant.z = e.getZ();
+ newCombatant.yaw = e.xRot;
+ newCombatant.pitch = e.yRot;
}
if(isServer)
{
if(newCombatant.entityInfo != null)
{
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, newCombatant.entity.getEntityId(), 0, id, newCombatant.entityInfo.category);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, newCombatant.entity.getId(), 0, id, newCombatant.entityInfo.category);
}
else if(newCombatant.entity instanceof PlayerEntity)
{
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, newCombatant.entity.getEntityId(), 0, id, "player");
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, newCombatant.entity.getId(), 0, id, "player");
}
else
{
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, newCombatant.entity.getEntityId(), 0, id);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, newCombatant.entity.getId(), 0, id);
}
}
notifyPlayersBattleInfo();
Collection<Integer> sideAIDs = new ArrayList<Integer>(sideA.size());
for(Combatant combatant : sideA.values())
{
- sideAIDs.add(combatant.entity.getEntityId());
+ sideAIDs.add(combatant.entity.getId());
}
return sideAIDs;
}
Collection<Integer> sideBIDs = new ArrayList<Integer>(sideB.size());
for(Combatant combatant : sideB.values())
{
- sideBIDs.add(combatant.entity.getEntityId());
+ sideBIDs.add(combatant.entity.getId());
}
return sideBIDs;
}
{
category = "player";
}
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.DIED, entry.getValue().entity.getEntityId(), 0, 0, category);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.DIED, entry.getValue().entity.getId(), 0, 0, category);
}
}
for(Iterator<Map.Entry<Integer, Combatant>> iter = sideB.entrySet().iterator(); iter.hasNext();)
{
category = "player";
}
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.DIED, entry.getValue().entity.getEntityId(), 0, 0, category);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.DIED, entry.getValue().entity.getId(), 0, 0, category);
}
}
if(players.isEmpty() || sideA.isEmpty() || sideB.isEmpty())
Map.Entry<Integer, Combatant> entry = iter.next();
if(entry.getValue().entity != null && ((PlayerEntity)entry.getValue().entity).isCreative())
{
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.BECAME_CREATIVE, entry.getValue().entity.getEntityId(), 0, 0);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.BECAME_CREATIVE, entry.getValue().entity.getId(), 0, 0);
iter.remove();
sideA.remove(entry.getKey());
sideB.remove(entry.getKey());
{
for(Combatant c : sideA.values())
{
- c.entity.setPositionAndRotation(c.x, c.entity.getPosY(), c.z, c.yaw, c.pitch);
+ c.entity.setPos(c.x, c.entity.getY(), c.z);
+ c.entity.setYBodyRot(c.yaw);
+ c.entity.setYHeadRot(c.pitch);
}
for(Combatant c : sideB.values())
{
- c.entity.setPositionAndRotation(c.x, c.entity.getPosY(), c.z, c.yaw, c.pitch);
+ c.entity.setPos(c.x, c.entity.getY(), c.z);
+ c.entity.setYBodyRot(c.yaw);
+ c.entity.setYHeadRot(c.pitch);
}
}
private void removeCombatant(Combatant c)
{
- sideA.remove(c.entity.getEntityId());
- sideB.remove(c.entity.getEntityId());
- if(players.remove(c.entity.getEntityId()) != null)
+ sideA.remove(c.entity.getId());
+ sideB.remove(c.entity.getId());
+ if(players.remove(c.entity.getId()) != null)
{
playerCount.decrementAndGet();
}
}
for(Iterator<Combatant> iter = sideAEntryQueue.iterator(); iter.hasNext();) {
Combatant c = iter.next();
- if(c.entity.getEntityId() == e.id) {
+ if(c.entity.getId() == e.id) {
iter.remove();
break;
}
}
for(Iterator<Combatant> iter = sideBEntryQueue.iterator(); iter.hasNext();) {
Combatant c = iter.next();
- if(c.entity.getEntityId() == e.id) {
+ if(c.entity.getId() == e.id) {
iter.remove();
break;
}
boolean combatantsChanged = false;
for(Combatant c = sideAEntryQueue.poll(); c != null; c = sideAEntryQueue.poll())
{
- sideA.put(c.entity.getEntityId(), c);
+ sideA.put(c.entity.getId(), c);
combatantsChanged = true;
}
for(Combatant c = sideBEntryQueue.poll(); c != null; c = sideBEntryQueue.poll())
{
- sideB.put(c.entity.getEntityId(), c);
+ sideB.put(c.entity.getId(), c);
combatantsChanged = true;
}
if(TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled())
continue;
}
- debugLog = next.entity.getDisplayName().getUnformattedComponentText();
+ debugLog = next.entity.getDisplayName().getString();
next.remainingDefenses = 0;
{
case UNDECIDED:
debugLog += " undecided";
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.DID_NOTHING, next.entity.getEntityId(), 0, 0);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.DID_NOTHING, next.entity.getId(), 0, 0);
break;
case ATTACK:
debugLog += " attack";
{
continue;
}
- ItemStack heldItemStack = ((PlayerEntity)next.entity).getHeldItemMainhand();
+ ItemStack heldItemStack = ((PlayerEntity)next.entity).getMainHandItem();
if(heldItemStack.getItem() instanceof BowItem)
{
debugLog += " with bow";
{
final Entity nextEntity = next.entity;
final Entity targetEntity = target.entity;
- final float yawDirection = Utility.yawDirection(next.entity.getPosX(), next.entity.getPosZ(), target.entity.getPosX(), target.entity.getPosZ());
- final float pitchDirection = Utility.pitchDirection(next.entity.getPosX(), next.entity.getPosY(), next.entity.getPosZ(), target.entity.getPosX(), target.entity.getPosY(), target.entity.getPosZ());
+ final float yawDirection = Utility.yawDirection(next.entity.getX(), next.entity.getZ(), target.entity.getX(), target.entity.getZ());
+ final float pitchDirection = Utility.pitchDirection(next.entity.getX(), next.entity.getY(), next.entity.getZ(), target.entity.getX(), target.entity.getY(), target.entity.getZ());
final int randomTimeLeft = random.nextInt(heldItemStack.getItem().getUseDuration(heldItemStack) / 3);
if(TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled())
{
next.pitch = pitchDirection;
}
// have player look at attack target
- ((ServerPlayerEntity)nextEntity).connection.setPlayerLocation(nextEntity.getPosX(), nextEntity.getPosY(), nextEntity.getPosZ(), yawDirection, pitchDirection);
+ ((ServerPlayerEntity)nextEntity).connection.teleport(nextEntity.getX(), nextEntity.getY(), nextEntity.getZ(), yawDirection, pitchDirection);
BowItem itemBow = (BowItem)heldItemStack.getItem();
TurnBasedMinecraftMod.proxy.getAttackerViaBowSet().add(new AttackerViaBow(nextEntity, getId()));
- itemBow.onPlayerStoppedUsing(((PlayerEntity)nextEntity).getHeldItemMainhand(), nextEntity.getEntityWorld(), (LivingEntity) nextEntity, randomTimeLeft);
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.FIRED_ARROW, nextEntity.getEntityId(), targetEntity.getEntityId(), 0);
+ itemBow.releaseUsing(((PlayerEntity)nextEntity).getMainHandItem(), nextEntity.level, (LivingEntity) nextEntity, randomTimeLeft);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.FIRED_ARROW, nextEntity.getId(), targetEntity.getId(), 0);
}
else
{
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.BOW_NO_AMMO, next.entity.getEntityId(), 0, 0);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.BOW_NO_AMMO, next.entity.getId(), 0, 0);
}
continue;
}
final Entity nextEntity = next.entity;
final Entity targetEntity = target.entity;
final EntityInfo targetEntityInfo = target.entityInfo;
- final float yawDirection = Utility.yawDirection(next.entity.getPosX(), next.entity.getPosZ(), target.entity.getPosX(), target.entity.getPosZ());
- final float pitchDirection = Utility.pitchDirection(next.entity.getPosX(), next.entity.getPosY(), next.entity.getPosZ(), target.entity.getPosX(), target.entity.getPosY(), target.entity.getPosZ());
+ final float yawDirection = Utility.yawDirection(next.entity.getX(), next.entity.getZ(), target.entity.getX(), target.entity.getZ());
+ final float pitchDirection = Utility.pitchDirection(next.entity.getX(), next.entity.getY(), next.entity.getZ(), target.entity.getX(), target.entity.getY(), target.entity.getZ());
final boolean defenseDamageTriggered;
if(!(targetEntity instanceof PlayerEntity) && targetEntityInfo.defenseDamage > 0 && targetEntityInfo.defenseDamageProbability > 0)
{
next.pitch = pitchDirection;
}
// have player look at attack target
- ((ServerPlayerEntity)nextEntity).connection.setPlayerLocation(nextEntity.getPosX(), nextEntity.getPosY(), nextEntity.getPosZ(), yawDirection, pitchDirection);
+ ((ServerPlayerEntity)nextEntity).connection.teleport(nextEntity.getX(), nextEntity.getY(), nextEntity.getZ(), yawDirection, pitchDirection);
TurnBasedMinecraftMod.proxy.setAttackingEntity(nextEntity);
TurnBasedMinecraftMod.proxy.setAttackingDamage(0);
- ((PlayerEntity)nextEntity).attackTargetEntityWithCurrentItem(targetEntity);
+ ((PlayerEntity)nextEntity).attack(targetEntity);
TurnBasedMinecraftMod.proxy.setAttackingEntity(null);
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.ATTACK, nextEntity.getEntityId(), targetEntity.getEntityId(), TurnBasedMinecraftMod.proxy.getAttackingDamage());
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.ATTACK, nextEntity.getId(), targetEntity.getId(), TurnBasedMinecraftMod.proxy.getAttackingDamage());
if(defenseDamageTriggered)
{
// defense damage
- DamageSource defenseDamageSource = DamageSource.causeMobDamage((LivingEntity) targetEntity);
+ DamageSource defenseDamageSource = DamageSource.mobAttack((LivingEntity) targetEntity);
TurnBasedMinecraftMod.proxy.setAttackingEntity(targetEntity);
- nextEntity.attackEntityFrom(defenseDamageSource, targetEntityInfo.defenseDamage);
+ nextEntity.hurt(defenseDamageSource, targetEntityInfo.defenseDamage);
TurnBasedMinecraftMod.proxy.setAttackingEntity(null);
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.DEFENSE_DAMAGE, targetEntity.getEntityId(), nextEntity.getEntityId(), targetEntityInfo.defenseDamage);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.DEFENSE_DAMAGE, targetEntity.getId(), nextEntity.getId(), targetEntityInfo.defenseDamage);
}
}
else
debugLog += " hit blocked";
// blocked
--target.remainingDefenses;
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.DEFEND, target.entity.getEntityId(), next.entity.getEntityId(), 0);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.DEFEND, target.entity.getId(), next.entity.getId(), 0);
}
}
else
{
debugLog += " hit missed";
// miss
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.MISS, next.entity.getEntityId(), target.entity.getEntityId(), 0);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.MISS, next.entity.getId(), target.entity.getId(), 0);
}
}
else
{
debugLog += " as mob";
- LivingEntity attackTarget = ((MobEntity)next.entity).getAttackTarget();
- if(attackTarget != null && hasCombatant(attackTarget.getEntityId()))
+ LivingEntity attackTarget = ((MobEntity)next.entity).getTarget();
+ if(attackTarget != null && hasCombatant(attackTarget.getId()))
{
debugLog += " to targeted";
- target = getCombatantByID(attackTarget.getEntityId());
+ target = getCombatantByID(attackTarget.getId());
}
else
{
if(target.remainingDefenses <= 0)
{
debugLog += " hit success";
- DamageSource damageSource = DamageSource.causeMobDamage((LivingEntity)next.entity);
+ DamageSource damageSource = DamageSource.mobAttack((LivingEntity)next.entity);
int damageAmount = next.entityInfo.attackPower;
if(next.entityInfo.attackVariance > 0)
{
}
TurnBasedMinecraftMod.proxy.setAttackingEntity(nextEntity);
- targetEntity.attackEntityFrom(damageSource, finalDamageAmount);
+ targetEntity.hurt(damageSource, finalDamageAmount);
TurnBasedMinecraftMod.proxy.setAttackingEntity(null);
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.ATTACK, nextEntity.getEntityId(), targetEntity.getEntityId(), finalDamageAmount);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.ATTACK, nextEntity.getId(), targetEntity.getId(), finalDamageAmount);
if(defenseDamageTriggered)
{
// defense damage
- DamageSource defenseDamageSource = DamageSource.causeMobDamage((LivingEntity)targetEntity);
+ DamageSource defenseDamageSource = DamageSource.mobAttack((LivingEntity)targetEntity);
TurnBasedMinecraftMod.proxy.setAttackingEntity(targetEntity);
- nextEntity.attackEntityFrom(defenseDamageSource, targetEntityInfo.defenseDamage);
+ nextEntity.hurt(defenseDamageSource, targetEntityInfo.defenseDamage);
TurnBasedMinecraftMod.proxy.setAttackingEntity(null);
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.DEFENSE_DAMAGE, targetEntity.getEntityId(), nextEntity.getEntityId(), targetEntityInfo.defenseDamage);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.DEFENSE_DAMAGE, targetEntity.getId(), nextEntity.getId(), targetEntityInfo.defenseDamage);
}
// attack effect
if(attackEffectTriggered)
{
nextEntityInfo.attackEffect.applyEffectToEntity((LivingEntity)targetEntity);
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.WAS_AFFECTED, nextEntity.getEntityId(), targetEntity.getEntityId(), 0, nextEntityInfo.attackEffect.getAffectedString());
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.WAS_AFFECTED, nextEntity.getId(), targetEntity.getId(), 0, nextEntityInfo.attackEffect.getAffectedString());
}
}
else
debugLog += " hit blocked";
// blocked
--target.remainingDefenses;
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.DEFEND, target.entity.getEntityId(), next.entity.getEntityId(), 0);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.DEFEND, target.entity.getId(), next.entity.getId(), 0);
}
}
else
{
debugLog += " hit missed";
// miss
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.MISS, next.entity.getEntityId(), target.entity.getEntityId(), 0);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.MISS, next.entity.getId(), target.entity.getId(), 0);
}
}
break;
case DEFEND:
debugLog += " defend";
next.remainingDefenses = TurnBasedMinecraftMod.proxy.getConfig().getDefenseDuration();
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.DEFENDING, next.entity.getEntityId(), 0, 0);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.DEFENDING, next.entity.getId(), 0, 0);
break;
case FLEE:
debugLog += " flee";
{
fleeingCategory = "player";
}
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.FLEE, next.entity.getEntityId(), 0, 1, fleeingCategory);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.FLEE, next.entity.getId(), 0, 1, fleeingCategory);
removeCombatant(next);
}
else
{
debugLog += " fail";
// flee fail
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.FLEE, next.entity.getEntityId(), 0, 0);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.FLEE, next.entity.getId(), 0, 0);
}
break;
case USE_ITEM:
if(next.itemToUse < 0 || next.itemToUse > 8)
{
debugLog += " invalid";
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.USED_ITEM, next.entity.getEntityId(), 0, PacketBattleMessage.UsedItemAction.USED_INVALID.getValue());
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.USED_ITEM, next.entity.getId(), 0, PacketBattleMessage.UsedItemAction.USED_INVALID.getValue());
break;
}
- ItemStack targetItemStack = ((PlayerEntity)next.entity).inventory.getStackInSlot(next.itemToUse);
+ ItemStack targetItemStack = ((PlayerEntity)next.entity).inventory.getItem(next.itemToUse);
Item targetItem = targetItemStack.getItem();
if(targetItem == null)
{
debugLog += " null";
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.USED_ITEM, next.entity.getEntityId(), 0, PacketBattleMessage.UsedItemAction.USED_NOTHING.getValue());
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.USED_ITEM, next.entity.getId(), 0, PacketBattleMessage.UsedItemAction.USED_NOTHING.getValue());
break;
}
- if(targetItem.getGroup() == ItemGroup.FOOD)
+ if(targetItem.getItemCategory() == ItemGroup.TAB_FOOD)
{
debugLog += " food";
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.USED_ITEM, next.entity.getEntityId(), 0, PacketBattleMessage.UsedItemAction.USED_FOOD.getValue(), targetItemStack.getDisplayName().getString());
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.USED_ITEM, next.entity.getId(), 0, PacketBattleMessage.UsedItemAction.USED_FOOD.getValue(), targetItemStack.getDisplayName().getString());
final Entity nextEntity = next.entity;
final int nextItemToUse = next.itemToUse;
- ((PlayerEntity)nextEntity).inventory.setInventorySlotContents(nextItemToUse, targetItem.onItemUseFinish(targetItemStack, nextEntity.world, (LivingEntity)nextEntity));
+ ((PlayerEntity)nextEntity).inventory.setItem(nextItemToUse, targetItem.finishUsingItem(targetItemStack, nextEntity.level, (LivingEntity)nextEntity));
}
else if(targetItem instanceof PotionItem)
{
debugLog += " potion";
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.USED_ITEM, next.entity.getEntityId(), 0, PacketBattleMessage.UsedItemAction.USED_POTION.getValue(), targetItemStack.getDisplayName().getString());
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.USED_ITEM, next.entity.getId(), 0, PacketBattleMessage.UsedItemAction.USED_POTION.getValue(), targetItemStack.getDisplayName().getString());
final Entity nextEntity = next.entity;
final int nextItemToUse = next.itemToUse;
- ((PlayerEntity)nextEntity).inventory.setInventorySlotContents(nextItemToUse, targetItem.onItemUseFinish(targetItemStack, nextEntity.world, (LivingEntity)nextEntity));
+ ((PlayerEntity)nextEntity).inventory.setItem(nextItemToUse, targetItem.finishUsingItem(targetItemStack, nextEntity.level, (LivingEntity)nextEntity));
}
else
{
debugLog += " non-consumable";
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.USED_ITEM, next.entity.getEntityId(), 0, PacketBattleMessage.UsedItemAction.USED_INVALID.getValue(), targetItemStack.getDisplayName().getString());
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.USED_ITEM, next.entity.getId(), 0, PacketBattleMessage.UsedItemAction.USED_INVALID.getValue(), targetItemStack.getDisplayName().getString());
}
break;
case SWITCH_ITEM: {
debugLog += " switch item";
if (next.itemToUse < 0 || next.itemToUse > 8) {
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.SWITCHED_ITEM, next.entity.getEntityId(), 0, 0);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.SWITCHED_ITEM, next.entity.getId(), 0, 0);
break;
}
final Entity nextEntity = next.entity;
final int nextItemToUse = next.itemToUse;
- ((PlayerEntity) nextEntity).inventory.currentItem = nextItemToUse;
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.SWITCHED_ITEM, next.entity.getEntityId(), 0, 1);
+ ((PlayerEntity) nextEntity).inventory.selected = nextItemToUse;
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.SWITCHED_ITEM, next.entity.getId(), 0, 1);
}
break;
case CREEPER_WAIT:
debugLog += " creeper wait";
if(next.creeperTurns < TurnBasedMinecraftMod.proxy.getConfig().getCreeperExplodeTurn()) {
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.CREEPER_WAIT, next.entity.getEntityId(), 0, 0);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.CREEPER_WAIT, next.entity.getId(), 0, 0);
} else {
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.CREEPER_WAIT_FINAL, next.entity.getEntityId(), 0, 0);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.CREEPER_WAIT_FINAL, next.entity.getId(), 0, 0);
}
break;
case CREEPER_EXPLODE: {
debugLog += " creeper explode";
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.CREEPER_EXPLODE, next.entity.getEntityId(), 0, 0);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.CREEPER_EXPLODE, next.entity.getId(), 0, 0);
final Entity nextEntity = next.entity;
final EntityInfo nextEntityInfo = next.entityInfo;
for (Combatant c : sideA.values()) {
- if (c.entity.getEntityId() != next.entity.getEntityId()) {
+ if (c.entity.getId() != next.entity.getId()) {
int hitChance = next.entityInfo.attackProbability;
if (c.entity instanceof PlayerEntity) {
hitChance = hitChance * (100 - TurnBasedMinecraftMod.proxy.getConfig().getPlayerEvasion()) / 100;
}
TurnBasedMinecraftMod.proxy.setAttackingEntity(nextEntity);
- targetEntity.attackEntityFrom(DamageSource.causeMobDamage((LivingEntity) nextEntity), finalDamageAmount);
+ targetEntity.hurt(DamageSource.mobAttack((LivingEntity) nextEntity), finalDamageAmount);
TurnBasedMinecraftMod.proxy.setAttackingEntity(null);
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.ATTACK, nextEntity.getEntityId(), targetEntity.getEntityId(), finalDamageAmount);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.ATTACK, nextEntity.getId(), targetEntity.getId(), finalDamageAmount);
if(attackEffectTriggered) {
nextEntityInfo.attackEffect.applyEffectToEntity((LivingEntity)targetEntity);
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.WAS_AFFECTED, nextEntity.getEntityId(), targetEntity.getEntityId(), 0, nextEntityInfo.attackEffect.getAffectedString());
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.WAS_AFFECTED, nextEntity.getId(), targetEntity.getId(), 0, nextEntityInfo.attackEffect.getAffectedString());
}
}
}
}
for(Combatant c : sideB.values()) {
- if (c.entity.getEntityId() != next.entity.getEntityId()) {
+ if (c.entity.getId() != next.entity.getId()) {
int hitChance = next.entityInfo.attackProbability;
if (c.entity instanceof PlayerEntity) {
hitChance = hitChance * (100 - TurnBasedMinecraftMod.proxy.getConfig().getPlayerEvasion()) / 100;
}
TurnBasedMinecraftMod.proxy.setAttackingEntity(nextEntity);
- targetEntity.attackEntityFrom(DamageSource.causeMobDamage((LivingEntity) nextEntity), finalDamageAmount);
+ targetEntity.hurt(DamageSource.mobAttack((LivingEntity) nextEntity), finalDamageAmount);
TurnBasedMinecraftMod.proxy.setAttackingEntity(null);
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.ATTACK, nextEntity.getEntityId(), targetEntity.getEntityId(), finalDamageAmount);
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.ATTACK, nextEntity.getId(), targetEntity.getId(), finalDamageAmount);
if(attackEffectTriggered) {
nextEntityInfo.attackEffect.applyEffectToEntity((LivingEntity)targetEntity);
- sendMessageToAllPlayers(PacketBattleMessage.MessageType.WAS_AFFECTED, nextEntity.getEntityId(), targetEntity.getEntityId(), 0, nextEntityInfo.attackEffect.getAffectedString());
+ sendMessageToAllPlayers(PacketBattleMessage.MessageType.WAS_AFFECTED, nextEntity.getId(), targetEntity.getId(), 0, nextEntityInfo.attackEffect.getAffectedString());
}
}
}
}
- ((CreeperEntity)nextEntity).setCreeperState(1000000);
+ ((CreeperEntity)nextEntity).setSwellDir(1000000);
}
break;
}
for(Combatant c : sideA.values()) {
if(c.entity instanceof CreeperEntity) {
if(c.creeperTurns <= TurnBasedMinecraftMod.proxy.getConfig().getCreeperExplodeTurn()) {
- ((CreeperEntity)c.entity).setCreeperState(-10);
+ ((CreeperEntity)c.entity).setSwellDir(-10);
} else {
- ((CreeperEntity)c.entity).setCreeperState(1000000);
+ ((CreeperEntity)c.entity).setSwellDir(1000000);
}
}
}
for(Combatant c : sideB.values()) {
if(c.entity instanceof CreeperEntity) {
if(c.creeperTurns <= TurnBasedMinecraftMod.proxy.getConfig().getCreeperExplodeTurn()) {
- ((CreeperEntity)c.entity).setCreeperState(-10);
+ ((CreeperEntity)c.entity).setSwellDir(-10);
} else {
- ((CreeperEntity) c.entity).setCreeperState(1000000);
+ ((CreeperEntity) c.entity).setSwellDir(1000000);
}
}
}
String receiverCustomName;
try {
- receiverCustomName = event.getEntity().getCustomName().getUnformattedComponentText();
+ receiverCustomName = event.getEntity().getCustomName().getString();
} catch (NullPointerException e) {
receiverCustomName = null;
}
String attackerClassName;
try {
- attackerClassName = event.getSource().getTrueSource().getClass().getName();
+ attackerClassName = event.getSource().getEntity().getClass().getName();
} catch (NullPointerException e) {
attackerClassName = null;
}
String attackerCustomName;
try {
- attackerCustomName = event.getSource().getTrueSource().getCustomName().getUnformattedComponentText();
+ attackerCustomName = event.getSource().getEntity().getCustomName().getString();
} catch (NullPointerException e) {
attackerCustomName = null;
}
// verify that both entities are EntityPlayer and not in creative or has a corresponding EntityInfo
if(!((event.getEntity() instanceof PlayerEntity && !((PlayerEntity)event.getEntity()).isCreative())
|| (config.getEntityInfoReference(receiverClassName) != null || config.getCustomEntityInfoReference(receiverCustomName) != null))
- || !((event.getSource().getTrueSource() instanceof PlayerEntity && !((PlayerEntity)event.getSource().getTrueSource()).isCreative())
+ || !((event.getSource().getEntity() instanceof PlayerEntity && !((PlayerEntity)event.getSource().getEntity()).isCreative())
|| (config.getEntityInfoReference(attackerClassName) != null || config.getCustomEntityInfoReference(attackerCustomName) != null)))
{
// logger.debug("BattleManager: Failed first check, attacker is \"" + attackerClassName + "\", defender is \"" + receiverClassName + "\"");
if(entityInfo != null && (config.isIgnoreBattleType(entityInfo.category) || entityInfo.ignoreBattle))
{
// attacked entity ignores battle
- Battle battle = battleMap.get(entityToBattleMap.get(new EntityIDDimPair(event.getSource().getTrueSource())));
- if(battle != null && battle.hasCombatant(event.getSource().getTrueSource().getEntityId())) {
+ Battle battle = battleMap.get(entityToBattleMap.get(new EntityIDDimPair(event.getSource().getEntity())));
+ if(battle != null && battle.hasCombatant(event.getSource().getEntity().getId())) {
logger.debug("Attack Canceled: attacked ignores battle but attacker in battle");
return true;
} else {
entityInfo = config.getCustomEntityInfoReference(attackerCustomName);
if(entityInfo == null)
{
- entityInfo = config.getMatchingEntityInfo(event.getSource().getTrueSource());
+ entityInfo = config.getMatchingEntityInfo(event.getSource().getEntity());
}
if(entityInfo != null && (config.isIgnoreBattleType(entityInfo.category) || entityInfo.ignoreBattle))
{
// attacker entity ignores battle
Battle battle = battleMap.get(entityToBattleMap.get(new EntityIDDimPair(event.getEntity())));
- if(battle != null && battle.hasCombatant(event.getEntity().getEntityId())) {
+ if(battle != null && battle.hasCombatant(event.getEntity().getId())) {
logger.debug("Attack Canceled: attacker ignores battle but attacked in battle");
return true;
} else {
}
// check if one is in battle
- Battle attackerBattle = battleMap.get(entityToBattleMap.get(new EntityIDDimPair(event.getSource().getTrueSource())));
- if(attackerBattle != null && !attackerBattle.hasCombatant(event.getSource().getTrueSource().getEntityId())) {
+ Battle attackerBattle = battleMap.get(entityToBattleMap.get(new EntityIDDimPair(event.getSource().getEntity())));
+ if(attackerBattle != null && !attackerBattle.hasCombatant(event.getSource().getEntity().getId())) {
attackerBattle = null;
}
Battle defenderBattle = battleMap.get(entityToBattleMap.get(new EntityIDDimPair(event.getEntity())));
- if(defenderBattle != null && !defenderBattle.hasCombatant(event.getEntity().getEntityId())) {
+ if(defenderBattle != null && !defenderBattle.hasCombatant(event.getEntity().getId())) {
defenderBattle = null;
}
return true;
} else if(attackerBattle == null && defenderBattle == null) {
// neither entity is in battle
- if(event.getEntity() instanceof PlayerEntity || event.getSource().getTrueSource() instanceof PlayerEntity)
+ if(event.getEntity() instanceof PlayerEntity || event.getSource().getEntity() instanceof PlayerEntity)
{
// at least one of the entities is a player, create Battle
Collection<Entity> sideA = new ArrayList<Entity>(1);
Collection<Entity> sideB = new ArrayList<Entity>(1);
sideA.add(event.getEntity());
- sideB.add(event.getSource().getTrueSource());
- createBattle(sideA, sideB, event.getEntity().getEntityWorld().func_234923_W_());
+ sideB.add(event.getSource().getEntity());
+ createBattle(sideA, sideB, event.getEntity().level.dimension());
logger.debug("Attack Not Canceled: new battle created");
}
else
if (attackerBattle.getSize() >= config.getMaxInBattle()) {
// battle limit reached, cannot add to battle
return true;
- } else if (attackerBattle.hasCombatantInSideA(event.getSource().getTrueSource().getEntityId())) {
+ } else if (attackerBattle.hasCombatantInSideA(event.getSource().getEntity().getId())) {
attackerBattle.addCombatantToSideB(event.getEntity());
} else {
attackerBattle.addCombatantToSideA(event.getEntity());
if (defenderBattle.getSize() >= config.getMaxInBattle()) {
// battle limit reached, cannot add to battle
return true;
- } else if (defenderBattle.hasCombatantInSideA(event.getEntity().getEntityId())) {
- defenderBattle.addCombatantToSideB(event.getSource().getTrueSource());
+ } else if (defenderBattle.hasCombatantInSideA(event.getEntity().getId())) {
+ defenderBattle.addCombatantToSideB(event.getSource().getEntity());
} else {
- defenderBattle.addCombatantToSideA(event.getSource().getTrueSource());
+ defenderBattle.addCombatantToSideA(event.getSource().getEntity());
}
- entityToBattleMap.put(new EntityIDDimPair(event.getSource().getTrueSource()), defenderBattle.getId());
+ entityToBattleMap.put(new EntityIDDimPair(event.getSource().getEntity()), defenderBattle.getId());
}
}
{
String targetedCustomName;
try {
- targetedCustomName = event.getTarget().getCustomName().getUnformattedComponentText();
+ targetedCustomName = event.getTarget().getCustomName().getString();
} catch (NullPointerException e) {
targetedCustomName = null;
}
String attackerCustomName;
try {
- attackerCustomName = event.getEntity().getCustomName().getUnformattedComponentText();
+ attackerCustomName = event.getEntity().getCustomName().getString();
} catch (NullPointerException e) {
attackerCustomName = null;
}
// check if one is in battle
Battle attackerBattle = battleMap.get(entityToBattleMap.get(new EntityIDDimPair(event.getEntity())));
- if(attackerBattle != null && !attackerBattle.hasCombatant(event.getEntity().getEntityId())) {
+ if(attackerBattle != null && !attackerBattle.hasCombatant(event.getEntity().getId())) {
attackerBattle = null;
}
Battle defenderBattle = battleMap.get(entityToBattleMap.get(new EntityIDDimPair(event.getTarget())));
- if(defenderBattle != null && !defenderBattle.hasCombatant(event.getTarget().getEntityId())) {
+ if(defenderBattle != null && !defenderBattle.hasCombatant(event.getTarget().getId())) {
defenderBattle = null;
}
Collection<Entity> sideB = new ArrayList<Entity>(1);
sideA.add(event.getEntity());
sideB.add(event.getTarget());
- createBattle(sideA, sideB, event.getEntity().getEntityWorld().func_234923_W_());
+ createBattle(sideA, sideB, event.getEntity().level.dimension());
logger.debug("neither in battle, at least one is player, creating new battle");
}
} else {
if (attackerBattle.getSize() >= TurnBasedMinecraftMod.proxy.getConfig().getMaxInBattle()) {
// battle max reached, cannot add to battle
return;
- } else if (attackerBattle.hasCombatantInSideA(event.getEntity().getEntityId())) {
+ } else if (attackerBattle.hasCombatantInSideA(event.getEntity().getId())) {
attackerBattle.addCombatantToSideB(event.getTarget());
} else {
attackerBattle.addCombatantToSideA(event.getTarget());
if (defenderBattle.getSize() >= TurnBasedMinecraftMod.proxy.getConfig().getMaxInBattle()) {
// battle max reached, cannot add to battle
return;
- } else if (defenderBattle.hasCombatantInSideA(event.getTarget().getEntityId())) {
+ } else if (defenderBattle.hasCombatantInSideA(event.getTarget().getId())) {
defenderBattle.addCombatantToSideB(event.getEntity());
} else {
defenderBattle.addCombatantToSideA(event.getEntity());
if(c.entity instanceof ServerPlayerEntity) {
TurnBasedMinecraftMod.getHandler().send(PacketDistributor.PLAYER.with(()->(ServerPlayerEntity) c.entity), new PacketGeneralMessage("You just left battle! " + config.getLeaveBattleCooldownSeconds() + " seconds until you can attack/be-attacked again!"));
}
- recentlyLeftBattle.put(c.entity.getEntityId(), c);
+ recentlyLeftBattle.put(c.entity.getId(), c);
entityToBattleMap.remove(new EntityIDDimPair(c.entity));
}
{
Map.Entry<Integer, Combatant> entry = iter.next();
if(entry.getValue().entity instanceof CreeperEntity && TurnBasedMinecraftMod.proxy.getConfig().getCreeperStopExplodeOnLeaveBattle()) {
- ((CreeperEntity)entry.getValue().entity).setCreeperState(-10);
+ ((CreeperEntity)entry.getValue().entity).setSwellDir(-10);
}
if(current - entry.getValue().time > TurnBasedMinecraftMod.proxy.getConfig().getLeaveBattleCooldownNanos())
{
LivingEntity c0Entity = (LivingEntity)c0.entity;
boolean isHaste = false;
boolean isSlow = false;
- for(EffectInstance e : c0Entity.getActivePotionEffects())
+ for(EffectInstance e : c0Entity.getActiveEffects())
{
- if(e.getEffectName().equals(Effects.HASTE.getName()) || e.getEffectName().equals(Effects.SPEED.getName()))
+ if(e.getEffect().equals(Effects.MOVEMENT_SPEED) || e.getEffect().equals(Effects.DIG_SPEED))
{
isHaste = true;
}
- else if(e.getEffectName().equals(Effects.SLOWNESS.getName()))
+ else if(e.getEffect().equals(Effects.MOVEMENT_SLOWDOWN) || e.getEffect().equals(Effects.DIG_SLOWDOWN))
{
isSlow = true;
}
LivingEntity c1Entity = (LivingEntity)c1.entity;
boolean isHaste = false;
boolean isSlow = false;
- for(EffectInstance e : c1Entity.getActivePotionEffects())
+ for(EffectInstance e : c1Entity.getActiveEffects())
{
- if(e.getEffectName().equals(Effects.HASTE.getName()))
+ if(e.getEffect().equals(Effects.MOVEMENT_SPEED))
{
isHaste = true;
}
- else if(e.getEffectName().equals(Effects.SLOWNESS.getName()))
+ else if(e.getEffect().equals(Effects.MOVEMENT_SLOWDOWN))
{
isSlow = true;
}
protected final EditingInfo setEditingPlayer(PlayerEntity player)
{
- return editingPlayers.put(player.getEntityId(), new EditingInfo(player));
+ return editingPlayers.put(player.getId(), new EditingInfo(player));
}
protected final EditingInfo removeEditingInfo(int id)
}
public Entity getEntity(int id, RegistryKey<World> dim) {
- return ServerLifecycleHooks.getCurrentServer().getWorld(dim).getEntityByID(id);
+ return ServerLifecycleHooks.getCurrentServer().getLevel(dim).getEntity(id);
}
}
public class DimensionChangedHandler {
@SubscribeEvent
public void dimensionChanged(EntityTravelToDimensionEvent event) {
- if(event.getEntity().world.isRemote) {
+ if(event.getEntity().level.isClientSide) {
return;
}
if(TurnBasedMinecraftMod.proxy.getBattleManager().forceLeaveBattle(new EntityIDDimPair(event.getEntity()))
EntityIDDimPair() {
id = 0;
- dim = Minecraft.getInstance().world.func_234923_W_();
+// dim = Minecraft.getInstance().world.dimension();
+ dim = null;
}
EntityIDDimPair(int id, RegistryKey<World> dim) {
}
EntityIDDimPair(Entity entity) {
- id = entity.getEntityId();
- dim = entity.getEntityWorld().func_234923_W_();
+ id = entity.getId();
+ dim = entity.level.dimension();
}
public Entity getEntity() {
public EffectInstance getPotionEffect(int duration, int amplifier) {
switch(this) {
case SPEED:
- return new EffectInstance(Effects.SPEED, duration, amplifier);
+ return new EffectInstance(Effects.MOVEMENT_SPEED, duration, amplifier);
case SLOW:
- return new EffectInstance(Effects.SLOWNESS, duration, amplifier);
+ return new EffectInstance(Effects.MOVEMENT_SLOWDOWN, duration, amplifier);
case HASTE:
- return new EffectInstance(Effects.HASTE, duration, amplifier);
+ return new EffectInstance(Effects.DIG_SPEED, duration, amplifier);
case MINING_FATIGUE:
- return new EffectInstance(Effects.MINING_FATIGUE, duration, amplifier);
+ return new EffectInstance(Effects.DIG_SLOWDOWN, duration, amplifier);
case STRENGTH:
- return new EffectInstance(Effects.STRENGTH, duration, amplifier);
+ return new EffectInstance(Effects.DAMAGE_BOOST, duration, amplifier);
case JUMP_BOOST:
- return new EffectInstance(Effects.JUMP_BOOST, duration, amplifier);
+ return new EffectInstance(Effects.JUMP, duration, amplifier);
case NAUSEA:
- return new EffectInstance(Effects.NAUSEA, duration, amplifier);
+ return new EffectInstance(Effects.CONFUSION, duration, amplifier);
case REGENERATION:
return new EffectInstance(Effects.REGENERATION, duration, amplifier);
case RESISTANCE:
- return new EffectInstance(Effects.RESISTANCE, duration, amplifier);
+ return new EffectInstance(Effects.DAMAGE_RESISTANCE, duration, amplifier);
case FIRE_RESISTANCE:
return new EffectInstance(Effects.FIRE_RESISTANCE, duration, amplifier);
case WATER_BREATHING:
{
if(this == FIRE)
{
- entity.setFire(duration / 20);
+ entity.setSecondsOnFire(duration / 20);
return;
}
else if(this != UNKNOWN)
{
- entity.addPotionEffect(getPotionEffect(duration, amplifier));
+ entity.addEffect(getPotionEffect(duration, amplifier));
}
}
@SubscribeEvent
public void entityJoinHandler(EntityJoinWorldEvent event)
{
- if(event.getWorld().isRemote)
+ if(event.getWorld().isClientSide)
{
return;
}
if(event.getEntity() instanceof PlayerEntity && TurnBasedMinecraftMod.proxy.getConfig().getBattleDisabledForAll())
{
- TurnBasedMinecraftMod.proxy.getConfig().addBattleIgnoringPlayer(event.getEntity().getEntityId());
+ TurnBasedMinecraftMod.proxy.getConfig().addBattleIgnoringPlayer(event.getEntity().getId());
}
}
}
{
public static final String MODID = "com_burnedkirby_turnbasedminecraft";
public static final String NAME = "Turn Based Minecraft Mod";
- public static final String VERSION = "1.16";
+ public static final String VERSION = "1.17";
public static final String CONFIG_FILENAME = "TBM_Config.toml";
public static final String DEFAULT_CONFIG_FILENAME = "TBM_Config_DEFAULT.toml";
public static final String CONFIG_DIRECTORY = "config/TurnBasedMinecraft/";
private void firstInit(final FMLCommonSetupEvent event)
{
- proxy = DistExecutor.safeRunForDist(()->()->new ClientProxy(), ()->()->new CommonProxy());
+ proxy = DistExecutor.safeRunForDist(()-> ClientProxy::new, ()-> CommonProxy::new);
proxy.setLogger(logger);
proxy.initialize();
// register commands
// tbm-disable
- event.getServer().getCommandManager().getDispatcher().register(
+ event.getServer().getCommands().getDispatcher().register(
Commands.literal("tbm-disable")
.requires(c -> {
- return !proxy.getConfig().getIfOnlyOPsCanDisableTurnBasedForSelf() || c.hasPermissionLevel(2);
+ return !proxy.getConfig().getIfOnlyOPsCanDisableTurnBasedForSelf() || c.hasPermission(2);
})
.executes( c -> {
- proxy.getConfig().addBattleIgnoringPlayer(c.getSource().asPlayer().getEntityId());
- c.getSource().sendFeedback(new StringTextComponent("Disabled turn-based-combat for current player"), true);
+ proxy.getConfig().addBattleIgnoringPlayer(c.getSource().getPlayerOrException().getId());
+ c.getSource().sendSuccess(new StringTextComponent("Disabled turn-based-combat for current player"), true);
return 1;
}));
// tbm-disable-all
- event.getServer().getCommandManager().getDispatcher().register(
+ event.getServer().getCommands().getDispatcher().register(
Commands.literal("tbm-disable-all")
.requires(c -> {
- return c.hasPermissionLevel(2);
+ return c.hasPermission(2);
})
.executes(c -> {
proxy.getConfig().setBattleDisabledForAll(true);
for(ServerPlayerEntity player : c.getSource().getServer().getPlayerList().getPlayers()) {
- proxy.getConfig().addBattleIgnoringPlayer(player.getEntityId());
+ proxy.getConfig().addBattleIgnoringPlayer(player.getId());
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketGeneralMessage("OP disabled turn-based-combat for everyone"));
}
return 1;
}));
// tbm-enable
- event.getServer().getCommandManager().getDispatcher().register(
+ event.getServer().getCommands().getDispatcher().register(
Commands.literal("tbm-enable")
- .requires(c -> !proxy.getConfig().getIfOnlyOPsCanDisableTurnBasedForSelf() || c.hasPermissionLevel(2))
+ .requires(c -> !proxy.getConfig().getIfOnlyOPsCanDisableTurnBasedForSelf() || c.hasPermission(2))
.executes(c -> {
- proxy.getConfig().removeBattleIgnoringPlayer(c.getSource().asPlayer().getEntityId());
- c.getSource().sendFeedback(new StringTextComponent("Enabled turn-based-combat for current player"), true);
+ proxy.getConfig().removeBattleIgnoringPlayer(c.getSource().getPlayerOrException().getId());
+ c.getSource().sendSuccess(new StringTextComponent("Enabled turn-based-combat for current player"), true);
return 1;
}));
// tbm-enable-all
- event.getServer().getCommandManager().getDispatcher().register(
+ event.getServer().getCommands().getDispatcher().register(
Commands.literal("tbm-enable-all")
- .requires(c -> c.hasPermissionLevel(2))
+ .requires(c -> c.hasPermission(2))
.executes(c -> {
proxy.getConfig().setBattleDisabledForAll(false);
proxy.getConfig().clearBattleIgnoringPlayers();
return 1;
}));
// tbm-set-enable
- event.getServer().getCommandManager().getDispatcher().register(
+ event.getServer().getCommands().getDispatcher().register(
Commands.literal("tbm-set-enable")
- .requires(c -> c.hasPermissionLevel(2))
+ .requires(c -> c.hasPermission(2))
.then(Commands.argument("targets", EntityArgument.players()).executes(c -> {
for(ServerPlayerEntity player : EntityArgument.getPlayers(c, "targets")) {
- proxy.getConfig().addBattleIgnoringPlayer(player.getEntityId());
+ proxy.getConfig().addBattleIgnoringPlayer(player.getId());
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketGeneralMessage("OP enabled turn-based-combat for you"));
- c.getSource().sendFeedback(new StringTextComponent("Enabled turn-based-combat for " + player.getDisplayName().getUnformattedComponentText()), true);
+ c.getSource().sendSuccess(new StringTextComponent("Enabled turn-based-combat for " + player.getDisplayName().getString()), true);
}
return 1;
})));
// tbm-set-disable
- event.getServer().getCommandManager().getDispatcher().register(
+ event.getServer().getCommands().getDispatcher().register(
Commands.literal("tbm-set-disable")
- .requires(c -> c.hasPermissionLevel(2))
+ .requires(c -> c.hasPermission(2))
.then(Commands.argument("targets", EntityArgument.players()).executes(c -> {
for(ServerPlayerEntity player : EntityArgument.getPlayers(c, "targets")) {
- proxy.getConfig().removeBattleIgnoringPlayer(player.getEntityId());
+ proxy.getConfig().removeBattleIgnoringPlayer(player.getId());
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketGeneralMessage("OP disabled turn-based-combat for you"));
- c.getSource().sendFeedback(new StringTextComponent("Disabled turn-based-combat for " + player.getDisplayName().getUnformattedComponentText()), true);
+ c.getSource().sendSuccess(new StringTextComponent("Disabled turn-based-combat for " + player.getDisplayName().getString()), true);
}
return 1;
})));
// tbm-edit
- event.getServer().getCommandManager().getDispatcher().register(
+ event.getServer().getCommands().getDispatcher().register(
Commands.literal("tbm-edit")
- .requires(c -> c.hasPermissionLevel(2))
+ .requires(c -> c.hasPermission(2))
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = proxy.getEditingInfo(player.getId());
if(editingInfo != null && !editingInfo.isPendingEntitySelection) {
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo));
} else if(editingInfo != null) {
} else {
proxy.setEditingPlayer(player);
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY));
- logger.info("Begin editing TBM Entity for player \"" + player.getDisplayName().getUnformattedComponentText() + "\" (\"" + c.getSource().getName() + "\")");
+ logger.info("Begin editing TBM Entity for player \"" + player.getDisplayName().getString() + "\" (\"" + c.getSource().getDisplayName() + "\")");
}
return 1;
})
.then(Commands.literal("finish")
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
if(editingInfo != null && !editingInfo.isPendingEntitySelection) {
if(!proxy.getConfig().editEntityEntry(editingInfo.entityInfo)) {
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketGeneralMessage("An error occurred while attempting to save an entry to the config"));
- proxy.removeEditingInfo(player.getEntityId());
+ proxy.removeEditingInfo(player.getId());
} else {
- proxy.removeEditingInfo(player.getEntityId());
+ proxy.removeEditingInfo(player.getId());
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketGeneralMessage("Entity info saved in config and loaded."));
}
} else if(editingInfo != null) {
}))
.then(Commands.literal("cancel")
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
if(editingInfo != null) {
- proxy.removeEditingInfo(player.getEntityId());
+ proxy.removeEditingInfo(player.getId());
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketGeneralMessage("Cancelled editing entry."));
}
return 1;
}))
.then(Commands.literal("custom")
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
if(editingInfo != null && !editingInfo.isPendingEntitySelection) {
Message exceptionMessage = new LiteralMessage("Invalid action for tbm-edit");
throw new CommandSyntaxException(new SimpleCommandExceptionType(exceptionMessage), exceptionMessage);
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY));
} else {
proxy.setEditingPlayer(player);
- proxy.getEditingInfo(player.getEntityId()).isEditingCustomName = true;
+ proxy.getEditingInfo(player.getId()).isEditingCustomName = true;
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY));
- logger.info("Begin editing custom TBM Entity for player \"" + player.getDisplayName().getUnformattedComponentText() + "\" (\"" + c.getSource().getName() + "\")");
+ logger.info("Begin editing custom TBM Entity for player \"" + player.getDisplayName().getString() + "\" (\"" + c.getSource().getDisplayName() + "\")");
}
return 1;
}))
.then(Commands.literal("edit")
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
if(editingInfo != null && !editingInfo.isPendingEntitySelection) {
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo));
} else if(editingInfo != null){
})
.then(Commands.literal("ignoreBattle")
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
if(editingInfo != null && !editingInfo.isPendingEntitySelection) {
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_IGNORE_BATTLE));
} else if(editingInfo != null) {
})
.then(Commands.argument("ignoreBattle", BoolArgumentType.bool())
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
boolean ignoreBattle = BoolArgumentType.getBool(c, "ignoreBattle");
if(editingInfo != null && !editingInfo.isPendingEntitySelection) {
editingInfo.entityInfo.ignoreBattle = ignoreBattle;
)
.then(Commands.literal("attackPower")
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
if(editingInfo != null && !editingInfo.isPendingEntitySelection) {
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_ATTACK_POWER));
} else if(editingInfo != null) {
})
.then(Commands.argument("attackPower", IntegerArgumentType.integer())
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
int attackPower = IntegerArgumentType.getInteger(c, "attackPower");
if(attackPower < 0) {
attackPower = 0;
)
.then(Commands.literal("attackProbability")
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
if(editingInfo != null && !editingInfo.isPendingEntitySelection) {
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_ATTACK_PROBABILITY));
} else if(editingInfo != null) {
})
.then(Commands.argument("attackProbability", IntegerArgumentType.integer())
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
int attackProbability = IntegerArgumentType.getInteger(c, "attackProbability");
if(attackProbability < 0) {
attackProbability = 0;
)
.then(Commands.literal("attackVariance")
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
if(editingInfo != null && !editingInfo.isPendingEntitySelection) {
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_ATTACK_VARIANCE));
} else if(editingInfo != null) {
})
.then(Commands.argument("attackVariance", IntegerArgumentType.integer())
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
int attackVariance = IntegerArgumentType.getInteger(c, "attackVariance");
if(attackVariance < 0) {
attackVariance = 0;
)
.then(Commands.literal("attackEffect")
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
if(editingInfo != null && !editingInfo.isPendingEntitySelection) {
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_ATTACK_EFFECT));
} else if(editingInfo != null) {
})
.then(Commands.argument("attackEffect", StringArgumentType.word())
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
EntityInfo.Effect effect = EntityInfo.Effect.fromString(StringArgumentType.getString(c, "attackEffect"));
if(editingInfo != null && !editingInfo.isPendingEntitySelection) {
editingInfo.entityInfo.attackEffect = effect;
)
.then(Commands.literal("attackEffectProbability")
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
if(editingInfo != null && !editingInfo.isPendingEntitySelection) {
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_ATTACK_EFFECT_PROBABILITY));
} else if(editingInfo != null) {
})
.then(Commands.argument("attackEffectProbability", IntegerArgumentType.integer())
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
int attackEffectProbability = IntegerArgumentType.getInteger(c, "attackEffectProbability");
if(attackEffectProbability < 0) {
attackEffectProbability = 0;
)
.then(Commands.literal("defenseDamage")
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
if(editingInfo != null && !editingInfo.isPendingEntitySelection) {
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_DEFENSE_DAMAGE));
} else if(editingInfo != null) {
})
.then(Commands.argument("defenseDamage", IntegerArgumentType.integer())
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
int defenseDamage = IntegerArgumentType.getInteger(c, "defenseDamage");
if(defenseDamage < 0) {
defenseDamage = 0;
)
.then(Commands.literal("defenseDamageProbability")
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
if(editingInfo != null && !editingInfo.isPendingEntitySelection) {
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_DEFENSE_DAMAGE_PROBABILITY));
} else if(editingInfo != null) {
})
.then(Commands.argument("defenseDamageProbability", IntegerArgumentType.integer())
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
int defenseDamageProbability = IntegerArgumentType.getInteger(c, "defenseDamageProbability");
if(defenseDamageProbability < 0) {
defenseDamageProbability = 0;
)
.then(Commands.literal("evasion")
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
if(editingInfo != null && !editingInfo.isPendingEntitySelection) {
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_EVASION));
} else if(editingInfo != null) {
})
.then(Commands.argument("evasion", IntegerArgumentType.integer())
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
int evasion = IntegerArgumentType.getInteger(c, "evasion");
if(evasion < 0) {
evasion = 0;
)
.then(Commands.literal("speed")
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
if(editingInfo != null && !editingInfo.isPendingEntitySelection) {
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_SPEED));
} else if(editingInfo != null) {
})
.then(Commands.argument("speed", IntegerArgumentType.integer())
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
int speed = IntegerArgumentType.getInteger(c, "speed");
if(speed < 0) {
speed = 0;
)
.then(Commands.literal("category")
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
if(editingInfo != null && !editingInfo.isPendingEntitySelection) {
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_CATEGORY));
} else if(editingInfo != null) {
})
.then(Commands.argument("category", StringArgumentType.word())
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
String category = StringArgumentType.getString(c, "category");
if(editingInfo != null && !editingInfo.isPendingEntitySelection) {
editingInfo.entityInfo.category = category;
)
.then(Commands.literal("decisionAttack")
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
if(editingInfo != null && !editingInfo.isPendingEntitySelection) {
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_DECISION_ATTACK));
} else if(editingInfo != null) {
})
.then(Commands.argument("decisionAttack", IntegerArgumentType.integer())
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
int decisionAttack = IntegerArgumentType.getInteger(c, "decisionAttack");
if(decisionAttack < 0) {
decisionAttack = 0;
)
.then(Commands.literal("decisionDefend")
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
if(editingInfo != null && !editingInfo.isPendingEntitySelection) {
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_DECISION_DEFEND));
} else if(editingInfo != null) {
})
.then(Commands.argument("decisionDefend", IntegerArgumentType.integer())
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
int decisionDefend = IntegerArgumentType.getInteger(c, "decisionDefend");
if(decisionDefend < 0) {
decisionDefend = 0;
)
.then(Commands.literal("decisionFlee")
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
if(editingInfo != null && !editingInfo.isPendingEntitySelection) {
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_DECISION_FLEE));
} else if(editingInfo != null) {
})
.then(Commands.argument("decisionFlee", IntegerArgumentType.integer())
.executes(c -> {
- ServerPlayerEntity player = c.getSource().asPlayer();
- EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getEntityId());
+ ServerPlayerEntity player = c.getSource().getPlayerOrException();
+ EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
int decisionFlee = IntegerArgumentType.getInteger(c, "decisionFlee");
if(editingInfo != null && !editingInfo.isPendingEntitySelection) {
editingInfo.entityInfo.decisionFlee = decisionFlee;
public static boolean doesPlayerHaveArrows(PlayerEntity player)
{
- for(int i = 0; i < player.inventory.getSizeInventory(); ++i)
+ for(int i = 0; i < player.inventory.getContainerSize(); ++i)
{
- if(player.inventory.getStackInSlot(i).getItem() instanceof ArrowItem)
+ if(player.inventory.getItem(i).getItem() instanceof ArrowItem)
{
return true;
}
public static double distanceBetweenEntities(Entity a, Entity b)
{
- return Math.sqrt(Math.pow(a.getPosX() - b.getPosX(), 2.0) + Math.pow(a.getPosY()- b.getPosY(), 2.0) + Math.pow(a.getPosZ()- b.getPosZ(), 2.0));
+ return Math.sqrt(Math.pow(a.getX() - b.getX(), 2.0) + Math.pow(a.getY()- b.getY(), 2.0) + Math.pow(a.getZ()- b.getZ(), 2.0));
}
public static String serializeDimension(RegistryKey<World> dimObject) {
- return dimObject.func_240901_a_().toString();
+ return dimObject.getRegistryName().toString();
}
public static RegistryKey<World> deserializeDimension(String dimString) {
ResourceLocation dimRes = new ResourceLocation(dimString);
- return RegistryKey.func_240903_a_(Registry.field_239699_ae_, dimRes);
+ return RegistryKey.create(Registry.DIMENSION_REGISTRY, dimRes);
}
}
if(b != null)
{
ServerPlayerEntity player = ctx.get().getSender();
- b.setDecision(player.getEntityId(), pkt.decision, pkt.targetIDOrItemID);
+ b.setDecision(player.getId(), pkt.decision, pkt.targetIDOrItemID);
}
});
ctx.get().setPacketHandled(true);
TurnBasedMinecraftMod.proxy.getLocalBattle().clearCombatants();
for(Integer id : pkt.sideA)
{
- Entity e = Minecraft.getInstance().world.getEntityByID(id);
+ Entity e = Minecraft.getInstance().level.getEntity(id);
if(e != null)
{
TurnBasedMinecraftMod.proxy.getLocalBattle().addCombatantToSideA(e);
}
for(Integer id : pkt.sideB)
{
- Entity e = Minecraft.getInstance().world.getEntityByID(id);
+ Entity e = Minecraft.getInstance().level.getEntity(id);
if(e != null)
{
TurnBasedMinecraftMod.proxy.getLocalBattle().addCombatantToSideB(e);
buf.writeInt(pkt.messageType.getValue());
buf.writeInt(pkt.entityIDFrom);
buf.writeInt(pkt.entityIDTo);
- buf.writeString(Utility.serializeDimension(pkt.dimension));
+ buf.writeUtf(Utility.serializeDimension(pkt.dimension));
buf.writeInt(pkt.amount);
- buf.writeString(pkt.custom);
+ buf.writeUtf(pkt.custom);
}
public static PacketBattleMessage decode(PacketBuffer buf) {
buf.readInt()),
buf.readInt(),
buf.readInt(),
- Utility.deserializeDimension(buf.readString()),
+ Utility.deserializeDimension(buf.readUtf()),
buf.readInt(),
- buf.readString());
+ buf.readUtf());
}
public static class Handler {
break;
case CREEPER_WAIT: {
StringTextComponent prefix = new StringTextComponent("TBM: ");
- prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
+ prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true));
StringTextComponent message = new StringTextComponent(from + " is charging up!");
- message.func_230530_a_(message.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)));
+ message.setStyle(message.getStyle().withColor(Color.fromRgb(0xFFFFFF00)));
prefix.getSiblings().add(message);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
}
break;
case CREEPER_WAIT_FINAL: {
StringTextComponent prefix = new StringTextComponent("TBM: ");
- prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
+ prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true));
StringTextComponent message = new StringTextComponent(from + " is about to explode!");
- message.func_230530_a_(message.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFF5050)));
+ message.setStyle(message.getStyle().withColor(Color.fromRgb(0xFFFF5050)));
prefix.getSiblings().add(message);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
}
break;
case CREEPER_EXPLODE: {
StringTextComponent prefix = new StringTextComponent("TBM: ");
- prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
+ prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true));
StringTextComponent message = new StringTextComponent(from + " exploded!");
- message.func_230530_a_(message.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFF0000)));
+ message.setStyle(message.getStyle().withColor(Color.fromRgb(0xFFFF0000)));
prefix.getSiblings().add(message);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
}
public static void encode(PacketEditingMessage pkt, PacketBuffer buf) {
buf.writeInt(pkt.type.getValue());
if(pkt.entityInfo.classType != null) {
- buf.writeString(pkt.entityInfo.classType.getName());
+ buf.writeUtf(pkt.entityInfo.classType.getName());
} else {
- buf.writeString("unknown");
+ buf.writeUtf("unknown");
}
buf.writeBoolean(pkt.entityInfo.ignoreBattle);
buf.writeInt(pkt.entityInfo.attackPower);
buf.writeInt(pkt.entityInfo.attackProbability);
buf.writeInt(pkt.entityInfo.attackVariance);
- buf.writeString(pkt.entityInfo.attackEffect.toString());
+ buf.writeUtf(pkt.entityInfo.attackEffect.toString());
buf.writeInt(pkt.entityInfo.attackEffectProbability);
buf.writeInt(pkt.entityInfo.defenseDamage);
buf.writeInt(pkt.entityInfo.defenseDamageProbability);
buf.writeInt(pkt.entityInfo.evasion);
buf.writeInt(pkt.entityInfo.speed);
- buf.writeString(pkt.entityInfo.category);
+ buf.writeUtf(pkt.entityInfo.category);
buf.writeInt(pkt.entityInfo.decisionAttack);
buf.writeInt(pkt.entityInfo.decisionDefend);
buf.writeInt(pkt.entityInfo.decisionFlee);
- buf.writeString(pkt.entityInfo.customName);
+ buf.writeUtf(pkt.entityInfo.customName);
}
public static PacketEditingMessage decode(PacketBuffer buf) {
Type type = Type.valueOf(buf.readInt());
EntityInfo einfo = new EntityInfo();
try {
- einfo.classType = einfo.getClass().getClassLoader().loadClass(buf.readString());
+ einfo.classType = einfo.getClass().getClassLoader().loadClass(buf.readUtf());
} catch (ClassNotFoundException e) { /* ignored */ }
einfo.ignoreBattle = buf.readBoolean();
einfo.attackPower = buf.readInt();
einfo.attackProbability = buf.readInt();
einfo.attackVariance = buf.readInt();
- einfo.attackEffect = EntityInfo.Effect.fromString(buf.readString());
+ einfo.attackEffect = EntityInfo.Effect.fromString(buf.readUtf());
einfo.attackEffectProbability = buf.readInt();
einfo.defenseDamage = buf.readInt();
einfo.defenseDamageProbability = buf.readInt();
einfo.evasion = buf.readInt();
einfo.speed = buf.readInt();
- einfo.category = buf.readString();
+ einfo.category = buf.readUtf();
einfo.decisionAttack = buf.readInt();
einfo.decisionDefend = buf.readInt();
einfo.decisionFlee = buf.readInt();
- einfo.customName = buf.readString();
+ einfo.customName = buf.readUtf();
return new PacketEditingMessage(type, einfo);
}
case ATTACK_ENTITY:
{
StringTextComponent prefix = new StringTextComponent("TBM: ");
- prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
+ prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true));
StringTextComponent text = new StringTextComponent("Attack the entity you want to edit for TurnBasedMinecraftMod. ");
- text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
+ text.setStyle(text.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)).withBold(false));
StringTextComponent cancel = new StringTextComponent("Cancel");
- cancel.func_230530_a_(cancel.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFF0000)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit cancel")));
+ cancel.setStyle(cancel.getStyle().withColor(Color.fromRgb(0xFFFF0000)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit cancel")));
text.getSiblings().add(cancel);
prefix.getSiblings().add(text);
case PICK_EDIT:
{
StringTextComponent prefix = new StringTextComponent("TBM: ");
- prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
+ prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true));
StringTextComponent text = new StringTextComponent("Edit what value? ");
- text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
+ text.setStyle(text.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)).withBold(false));
StringTextComponent option = new StringTextComponent("IgB");
- // HoverEvent.Action.field_230550_a_ is probably SHOW_TEXT
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit ignoreBattle"))
- .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("IgnoreBattle"))));
+ // HoverEvent.Action.SHOW_TEXT is probably SHOW_TEXT
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit ignoreBattle"))
+ .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("IgnoreBattle"))));
StringTextComponent value = new StringTextComponent("(" + pkt.entityInfo.ignoreBattle + ") ");
- value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
+ value.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("AP");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackPower"))
- .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("AttackPower"))));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackPower"))
+ .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("AttackPower"))));
value = new StringTextComponent("(" + pkt.entityInfo.attackPower + ") ");
- value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
+ value.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("APr");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackProbability"))
- .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("AttackProbability"))));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackProbability"))
+ .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("AttackProbability"))));
value = new StringTextComponent("(" + pkt.entityInfo.attackProbability + "%) ");
- value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
+ value.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("AV");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackVariance"))
- .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("AttackVariance"))));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackVariance"))
+ .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("AttackVariance"))));
value = new StringTextComponent("(" + pkt.entityInfo.attackVariance + ") ");
- value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
+ value.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("AE");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffect"))
- .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("AttackEffect"))));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffect"))
+ .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("AttackEffect"))));
value = new StringTextComponent("(" + pkt.entityInfo.attackEffect.toString() + ") ");
- value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
+ value.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("AEPr");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffectProbability"))
- .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("AttackEffectProbability"))));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffectProbability"))
+ .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("AttackEffectProbability"))));
value = new StringTextComponent("(" + pkt.entityInfo.attackEffectProbability + "%) ");
- value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
+ value.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("DD");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamage"))
- .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("DefenseDamage"))));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamage"))
+ .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("DefenseDamage"))));
value = new StringTextComponent("(" + pkt.entityInfo.defenseDamage + ") ");
- value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
+ value.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("DDPr");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamageProbability"))
- .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("DefenseDamageProbability"))));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamageProbability"))
+ .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("DefenseDamageProbability"))));
value = new StringTextComponent("(" + pkt.entityInfo.defenseDamageProbability + "%) ");
- value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
+ value.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("E");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit evasion"))
- .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("Evasion"))));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit evasion"))
+ .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("Evasion"))));
value = new StringTextComponent("(" + pkt.entityInfo.evasion + "%) ");
- value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
+ value.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("S");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit speed"))
- .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("Speed"))));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit speed"))
+ .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("Speed"))));
value = new StringTextComponent("(" + pkt.entityInfo.speed + ") ");
- value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
+ value.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("C");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category"))
- .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("Category"))));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category"))
+ .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("Category"))));
value = new StringTextComponent("(" + pkt.entityInfo.category + ") ");
- value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
+ value.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("DecA");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionAttack"))
- .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("DecisionAttack"))));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionAttack"))
+ .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("DecisionAttack"))));
value = new StringTextComponent("(" + pkt.entityInfo.decisionAttack + "%) ");
- value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
+ value.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("DecD");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionDefend"))
- .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("DecisionDefend"))));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionDefend"))
+ .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("DecisionDefend"))));
value = new StringTextComponent("(" + pkt.entityInfo.decisionDefend + "%) ");
- value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
+ value.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("DecF");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionFlee"))
- .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("DecisionFlee"))));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionFlee"))
+ .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("DecisionFlee"))));
value = new StringTextComponent("(" + pkt.entityInfo.decisionFlee + "%) ");
- value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
+ value.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("Finished Editing");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit finish")));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit finish")));
text.getSiblings().add(option);
text.getSiblings().add(new StringTextComponent(" "));
option = new StringTextComponent("Cancel");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFF0000)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit cancel")));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFF0000)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit cancel")));
text.getSiblings().add(option);
prefix.getSiblings().add(text);
case EDIT_IGNORE_BATTLE:
{
StringTextComponent prefix = new StringTextComponent("TBM: ");
- prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
+ prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true));
StringTextComponent text = new StringTextComponent("ignoreBattle: ");
- text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
+ text.setStyle(text.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)).withBold(false));
StringTextComponent option = new StringTextComponent("true");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit ignoreBattle true")));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit ignoreBattle true")));
text.getSiblings().add(option);
text.getSiblings().add(new StringTextComponent(" "));
option = new StringTextComponent("false");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFF0000)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit ignoreBattle false")));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFF0000)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit ignoreBattle false")));
text.getSiblings().add(option);
prefix.getSiblings().add(text);
case EDIT_ATTACK_POWER:
{
StringTextComponent prefix = new StringTextComponent("TBM: ");
- prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
+ prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true));
StringTextComponent text = new StringTextComponent("attackPower: ");
- text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
+ text.setStyle(text.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)).withBold(false));
for(int i = 0; i <= 15; ++i)
{
StringTextComponent option = new StringTextComponent(Integer.toString(i));
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackPower " + Integer.toString(i))));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackPower " + Integer.toString(i))));
text.getSiblings().add(option);
if(i < 15)
{
case EDIT_ATTACK_PROBABILITY:
{
StringTextComponent prefix = new StringTextComponent("TBM: ");
- prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
+ prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true));
StringTextComponent text = new StringTextComponent("attackProbability: ");
- text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
+ text.setStyle(text.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)).withBold(false));
for(int i = 10; i <= 100; i += 10)
{
StringTextComponent option = new StringTextComponent(Integer.toString(i) + "%");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackProbability " + Integer.toString(i))));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackProbability " + Integer.toString(i))));
text.getSiblings().add(option);
if(i < 100)
{
case EDIT_ATTACK_VARIANCE:
{
StringTextComponent prefix = new StringTextComponent("TBM: ");
- prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
+ prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true));
StringTextComponent text = new StringTextComponent("attackVariance: ");
- text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
+ text.setStyle(text.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)).withBold(false));
for(int i = 0; i <= 10; ++i)
{
StringTextComponent option = new StringTextComponent(Integer.toString(i));
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackVariance " + Integer.toString(i))));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackVariance " + Integer.toString(i))));
text.getSiblings().add(option);
if(i < 10)
{
case EDIT_ATTACK_EFFECT:
{
StringTextComponent prefix = new StringTextComponent("TBM: ");
- prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
+ prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true));
StringTextComponent text = new StringTextComponent("attackEffect: ");
- text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
+ text.setStyle(text.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)).withBold(false));
for(EntityInfo.Effect e : EntityInfo.Effect.values())
{
StringTextComponent option = new StringTextComponent(e.toString());
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffect " + e.toString())));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffect " + e.toString())));
text.getSiblings().add(option);
if(e != EntityInfo.Effect.UNKNOWN)
{
case EDIT_ATTACK_EFFECT_PROBABILITY:
{
StringTextComponent prefix = new StringTextComponent("TBM: ");
- prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
+ prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true));
StringTextComponent text = new StringTextComponent("attackEffectProbability: ");
- text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
+ text.setStyle(text.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)).withBold(false));
for(int i = 0; i <= 100; i += 10)
{
StringTextComponent option = new StringTextComponent(Integer.toString(i) + "%");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffectProbability " + Integer.toString(i))));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffectProbability " + Integer.toString(i))));
text.getSiblings().add(option);
if(i < 100)
{
case EDIT_DEFENSE_DAMAGE:
{
StringTextComponent prefix = new StringTextComponent("TBM: ");
- prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
+ prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true));
StringTextComponent text = new StringTextComponent("defenseDamage: ");
- text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
+ text.setStyle(text.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)).withBold(false));
for(int i = 0; i <= 15; ++i)
{
StringTextComponent option = new StringTextComponent(Integer.toString(i));
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamage " + Integer.toString(i))));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamage " + Integer.toString(i))));
text.getSiblings().add(option);
if(i < 15)
{
case EDIT_DEFENSE_DAMAGE_PROBABILITY:
{
StringTextComponent prefix = new StringTextComponent("TBM: ");
- prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
+ prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true));
StringTextComponent text = new StringTextComponent("defenseDamageProbability: ");
- text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
+ text.setStyle(text.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)).withBold(false));
for(int i = 0; i <= 100; i += 10)
{
StringTextComponent option = new StringTextComponent(Integer.toString(i) + "%");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamageProbability " + Integer.toString(i))));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamageProbability " + Integer.toString(i))));
text.getSiblings().add(option);
if(i < 100)
{
case EDIT_EVASION:
{
StringTextComponent prefix = new StringTextComponent("TBM: ");
- prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
+ prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true));
StringTextComponent text = new StringTextComponent("evasion: ");
- text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
+ text.setStyle(text.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)).withBold(false));
for(int i = 0; i <= 100; i += 10)
{
StringTextComponent option = new StringTextComponent(Integer.toString(i) + "%");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit evasion " + Integer.toString(i))));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit evasion " + Integer.toString(i))));
text.getSiblings().add(option);
if(i < 100)
{
case EDIT_SPEED:
{
StringTextComponent prefix = new StringTextComponent("TBM: ");
- prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
+ prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true));
StringTextComponent text = new StringTextComponent("speed: ");
- text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
+ text.setStyle(text.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)).withBold(false));
for(int i = 0; i <= 100; i += 10)
{
StringTextComponent option = new StringTextComponent(Integer.toString(i));
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit speed " + Integer.toString(i))));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit speed " + Integer.toString(i))));
text.getSiblings().add(option);
if(i < 100)
{
case EDIT_CATEGORY:
{
StringTextComponent prefix = new StringTextComponent("TBM: ");
- prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
+ prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true));
StringTextComponent text = new StringTextComponent("category: ");
- text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
+ text.setStyle(text.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)).withBold(false));
StringTextComponent option = new StringTextComponent("monster");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category monster")));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category monster")));
if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("monster"))
{
StringTextComponent optionInfo = new StringTextComponent("(battle-");
- optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
+ optionInfo.setStyle(optionInfo.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)));
StringTextComponent optionInfoBool = new StringTextComponent("disabled");
- optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFF0000)));
+ optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(Color.fromRgb(0xFFFF0000)));
optionInfo.getSiblings().add(optionInfoBool);
optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
else
{
StringTextComponent optionInfo = new StringTextComponent("(battle-");
- optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
+ optionInfo.setStyle(optionInfo.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)));
StringTextComponent optionInfoBool = new StringTextComponent("enabled");
- optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)));
+ optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(Color.fromRgb(0xFF00FF00)));
optionInfo.getSiblings().add(optionInfoBool);
optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
text.getSiblings().add(new StringTextComponent(", "));
option = new StringTextComponent("animal");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category animal")));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category animal")));
if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("animal"))
{
StringTextComponent optionInfo = new StringTextComponent("(battle-");
- optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
+ optionInfo.setStyle(optionInfo.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)));
StringTextComponent optionInfoBool = new StringTextComponent("disabled");
- optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFF0000)));
+ optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(Color.fromRgb(0xFFFF0000)));
optionInfo.getSiblings().add(optionInfoBool);
optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
else
{
StringTextComponent optionInfo = new StringTextComponent("(battle-");
- optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
+ optionInfo.setStyle(optionInfo.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)));
StringTextComponent optionInfoBool = new StringTextComponent("enabled");
- optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)));
+ optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(Color.fromRgb(0xFF00FF00)));
optionInfo.getSiblings().add(optionInfoBool);
optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
text.getSiblings().add(new StringTextComponent(", "));
option = new StringTextComponent("passive");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category passive")));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category passive")));
if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("passive"))
{
StringTextComponent optionInfo = new StringTextComponent("(battle-");
- optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
+ optionInfo.setStyle(optionInfo.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)));
StringTextComponent optionInfoBool = new StringTextComponent("disabled");
- optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFF0000)));
+ optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(Color.fromRgb(0xFFFF0000)));
optionInfo.getSiblings().add(optionInfoBool);
optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
else
{
StringTextComponent optionInfo = new StringTextComponent("(battle-");
- optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
+ optionInfo.setStyle(optionInfo.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)));
StringTextComponent optionInfoBool = new StringTextComponent("enabled");
- optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)));
+ optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(Color.fromRgb(0xFF00FF00)));
optionInfo.getSiblings().add(optionInfoBool);
optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
text.getSiblings().add(new StringTextComponent(", "));
option = new StringTextComponent("boss");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category boss")));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category boss")));
if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("boss"))
{
StringTextComponent optionInfo = new StringTextComponent("(battle-");
- optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
+ optionInfo.setStyle(optionInfo.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)));
StringTextComponent optionInfoBool = new StringTextComponent("disabled");
- optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFF0000)));
+ optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(Color.fromRgb(0xFFFF0000)));
optionInfo.getSiblings().add(optionInfoBool);
optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
else
{
StringTextComponent optionInfo = new StringTextComponent("(battle-");
- optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
+ optionInfo.setStyle(optionInfo.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)));
StringTextComponent optionInfoBool = new StringTextComponent("enabled");
- optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)));
+ optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(Color.fromRgb(0xFF00FF00)));
optionInfo.getSiblings().add(optionInfoBool);
optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
text.getSiblings().add(new StringTextComponent(", "));
option = new StringTextComponent("player");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category player")));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category player")));
if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("player"))
{
StringTextComponent optionInfo = new StringTextComponent("(battle-");
- optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
+ optionInfo.setStyle(optionInfo.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)));
StringTextComponent optionInfoBool = new StringTextComponent("disabled");
- optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFF0000)));
+ optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(Color.fromRgb(0xFFFF0000)));
optionInfo.getSiblings().add(optionInfoBool);
optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
else
{
StringTextComponent optionInfo = new StringTextComponent("(battle-");
- optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
+ optionInfo.setStyle(optionInfo.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)));
StringTextComponent optionInfoBool = new StringTextComponent("enabled");
- optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)));
+ optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(Color.fromRgb(0xFF00FF00)));
optionInfo.getSiblings().add(optionInfoBool);
optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
case EDIT_DECISION_ATTACK:
{
StringTextComponent prefix = new StringTextComponent("TBM: ");
- prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
+ prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true));
StringTextComponent text = new StringTextComponent("decisionAttack: ");
- text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
+ text.setStyle(text.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)).withBold(false));
for(int i = 0; i <= 100; i += 10)
{
StringTextComponent option = new StringTextComponent(Integer.toString(i) + "%");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionAttack " + Integer.toString(i))));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionAttack " + Integer.toString(i))));
text.getSiblings().add(option);
if(i < 100)
{
case EDIT_DECISION_DEFEND:
{
StringTextComponent prefix = new StringTextComponent("TBM: ");
- prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
+ prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true));
StringTextComponent text = new StringTextComponent("decisionDefend: ");
- text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
+ text.setStyle(text.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)).withBold(false));
for(int i = 0; i <= 100; i += 10)
{
StringTextComponent option = new StringTextComponent(Integer.toString(i) + "%");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionDefend " + Integer.toString(i))));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionDefend " + Integer.toString(i))));
text.getSiblings().add(option);
if(i < 100)
{
case EDIT_DECISION_FLEE:
{
StringTextComponent prefix = new StringTextComponent("TBM: ");
- prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
+ prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true));
StringTextComponent text = new StringTextComponent("decisionFlee: ");
- text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
+ text.setStyle(text.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)).withBold(false));
for(int i = 0; i <= 100; i += 10)
{
StringTextComponent option = new StringTextComponent(Integer.toString(i) + "%");
- option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionFlee " + Integer.toString(i))));
+ option.setStyle(option.getStyle().withColor(Color.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionFlee " + Integer.toString(i))));
text.getSiblings().add(option);
if(i < 100)
{
}
public static void encode(PacketGeneralMessage pkt, PacketBuffer buf) {
- buf.writeString(pkt.message);
+ buf.writeUtf(pkt.message);
}
public static PacketGeneralMessage decode(PacketBuffer buf) {
- return new PacketGeneralMessage(buf.readString());
+ return new PacketGeneralMessage(buf.readUtf());
}
public static class Handler {
# The modid of the mod
modId="com_burnedkirby_turnbasedminecraft" #mandatory
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
-version="1.16" #mandatory
+version="1.17" #mandatory
# A display name for the mod
displayName="TurnBasedMinecraftMod" #mandatory
# A URL to query for updates for this mod. See the JSON update specification <here>
# Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory
# The version range of the dependency
- versionRange="[34,)" #mandatory
+ versionRange="[36,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER
[[dependencies.com_burnedkirby_turnbasedminecraft]]
modId="minecraft"
mandatory=true
- versionRange="[1.16.3,)"
+ versionRange="[1.16.5,1.17)"
ordering="NONE"
side="BOTH"
"modid": "com_burnedkirby_turnbasedminecraft",
"name": "Turn Based Minecraft",
"description": "Changes battles to be turn-based.",
- "version": "1.16",
+ "version": "1.17",
"mcversion": "1.16.3",
"url": "",
"updateUrl": "",