Update mod for Forge 1.16.5-36.1.0

This commit is contained in:
Stephen Seo 2021-05-21 14:44:31 +09:00
parent 3e6d184971
commit 7f3dfb42e6
28 changed files with 581 additions and 584 deletions

View file

@ -1,11 +1,11 @@
buildscript {
repositories {
maven { url = "http://files.minecraftforge.net/maven" }
maven { url = "https://files.minecraftforge.net/maven" }
jcenter()
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1.+', changing: true
classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.4'
}
}
@ -14,11 +14,12 @@ apply plugin: 'eclipse'
//apply plugin: 'maven-publish'
apply plugin: 'com.github.johnrengelman.shadow'
version = "1.16"
version = "1.17"
group = "com.burnedkirby.TurnBasedMinecraft"
archivesBaseName = "TurnBasedMinecraft"
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
minecraft {
// The mappings can be changed at any time, and must be in the following format.
@ -26,7 +27,7 @@ minecraft {
// stable_# Stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'snapshot', version: '20200514-1.16'
mappings channel: 'official', version: '1.16.5'
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
@ -38,7 +39,7 @@ minecraft {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.markers', 'REGISTRIES'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
@ -54,7 +55,7 @@ minecraft {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.markers', 'REGISTRIES'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
@ -70,12 +71,12 @@ minecraft {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.markers', 'REGISTRIES'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
args '--mod', 'TurnBasedMinecraftMod', '--all', '--output', file('src/generated/resources/')
args '--mod', 'TurnBasedMinecraftMod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources')
mods {
TurnBasedMinecraftMod {
@ -86,11 +87,14 @@ minecraft {
}
}
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.16.3-34.1.0'
minecraft 'net.minecraftforge:forge:1.16.5-36.1.0'
// You may put jars on which you depend on in ./libs or you may define them like so..
// compile "some.group:artifact:version:classifier"

Binary file not shown.

View file

@ -1,5 +1,5 @@
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

53
gradlew vendored
View file

@ -1,5 +1,21 @@
#!/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
@ -28,7 +44,7 @@ APP_NAME="Gradle"
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"
@ -66,6 +82,7 @@ esac
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
@ -109,10 +126,11 @@ if $darwin; 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
@ -138,19 +156,19 @@ if $cygwin ; then
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
@ -159,14 +177,9 @@ save () {
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" "$@"

43
gradlew.bat vendored
View file

@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@ -35,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@ -45,28 +64,14 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell

View file

@ -126,26 +126,21 @@ public class BattleGui extends Screen {
}
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;
@ -156,11 +151,11 @@ public class BattleGui extends Screen {
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);
}));
}
@ -174,11 +169,11 @@ public class BattleGui extends Screen {
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);
}));
}
@ -187,19 +182,19 @@ public class BattleGui extends Screen {
} 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;
@ -209,22 +204,22 @@ public class BattleGui extends Screen {
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;
@ -232,10 +227,10 @@ public class BattleGui extends Screen {
}
@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
@ -251,7 +246,7 @@ public class BattleGui extends Screen {
updateState();
super.func_230430_a_(matrixStack, mouseX, mouseY, partialTicks);
super.render(matrixStack, mouseX, mouseY, partialTicks);
String timeRemainingString = "Time remaining: ";
int timeRemainingInt = timeRemaining.get();
@ -263,13 +258,12 @@ public class BattleGui extends Screen {
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) {
@ -315,7 +309,7 @@ public class BattleGui extends Screen {
.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 {
@ -335,21 +329,23 @@ public class BattleGui extends Screen {
}
}
// @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.func_231046_a_(a, b, c);
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.keyReleased(a, b, c);
}
return false; // TODO verify return value
}
@ -359,6 +355,6 @@ public class BattleGui extends Screen {
}
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);
}
}

View file

@ -180,7 +180,7 @@ public class BattleMusic
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)
{
@ -325,7 +325,7 @@ public class BattleMusic
}
if(resumeMCSounds)
{
Minecraft.getInstance().getSoundHandler().resume();
Minecraft.getInstance().getSoundManager().resume();
}
isPlaying = false;
}

View file

@ -49,10 +49,10 @@ public class ClientProxy extends CommonProxy
@Override
public void setBattleGuiAsGui()
{
if(Minecraft.getInstance().currentScreen != battleGui)
if(Minecraft.getInstance().screen != battleGui)
{
battleGui.turnEnd();
Minecraft.getInstance().displayGuiScreen(battleGui);
Minecraft.getInstance().setScreen(battleGui);
}
}
@ -78,7 +78,7 @@ public class ClientProxy extends CommonProxy
public void battleEnded()
{
localBattle = null;
Minecraft.getInstance().displayGuiScreen(null);
Minecraft.getInstance().setScreen(null);
stopMusic(true);
battleMusicCount = 0;
sillyMusicCount = 0;
@ -93,15 +93,15 @@ public class ClientProxy extends CommonProxy
@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
@ -163,10 +163,10 @@ public class ClientProxy extends CommonProxy
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());
}
@ -235,11 +235,11 @@ public class ClientProxy extends CommonProxy
@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);
}
}

View file

@ -26,9 +26,9 @@ public class EntitySelectionButton extends Button {
}
@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();
@ -78,22 +78,10 @@ public class EntitySelectionButton extends Button {
}
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;
}
}

View file

@ -17,9 +17,8 @@ public class ItemSelectionButton extends Button {
}
@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);
@ -30,23 +29,10 @@ public class ItemSelectionButton extends Button {
}
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);
}
}
}

View file

@ -17,11 +17,11 @@ public class AttackEventHandler
{
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;
}
@ -38,7 +38,7 @@ public class AttackEventHandler
{
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)
@ -46,7 +46,7 @@ public class AttackEventHandler
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;
}
@ -60,7 +60,7 @@ public class AttackEventHandler
@SubscribeEvent
public void entityAttacked(LivingAttackEvent event)
{
if(event.getEntity().world.isRemote)
if(event.getEntity().level.isClientSide)
{
return;
}
@ -69,9 +69,9 @@ public class AttackEventHandler
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;
@ -84,13 +84,13 @@ public class AttackEventHandler
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));
}
@ -114,9 +114,9 @@ public class AttackEventHandler
}
}
}
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");
@ -126,11 +126,11 @@ public class AttackEventHandler
}
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());
@ -150,19 +150,19 @@ public class AttackEventHandler
{
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);
}

View file

@ -138,7 +138,7 @@ public class Battle
{
EntityInfo entityInfo;
try {
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getCustomEntityInfoReference(e.getCustomName().getUnformattedComponentText());
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getCustomEntityInfoReference(e.getCustomName().getString());
} catch(NullPointerException exception) {
entityInfo = null;
}
@ -154,19 +154,19 @@ public class Battle
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;
}
}
}
@ -176,7 +176,7 @@ public class Battle
{
EntityInfo entityInfo;
try {
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getCustomEntityInfoReference(e.getCustomName().getUnformattedComponentText());
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getCustomEntityInfoReference(e.getCustomName().getString());
} catch(NullPointerException exception) {
entityInfo = null;
}
@ -192,19 +192,19 @@ public class Battle
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;
}
}
}
@ -215,30 +215,30 @@ public class Battle
{
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);
}
}
}
@ -276,14 +276,14 @@ public class Battle
{
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;
}
@ -295,7 +295,7 @@ public class Battle
{
for(Combatant c : sideAEntryQueue)
{
if(c.entity.getEntityId() == entityID)
if(c.entity.getId() == entityID)
{
return true;
}
@ -307,7 +307,7 @@ public class Battle
{
EntityInfo entityInfo;
try {
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getCustomEntityInfoReference(e.getCustomName().getUnformattedComponentText());
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getCustomEntityInfoReference(e.getCustomName().getString());
} catch(NullPointerException exception) {
entityInfo = null;
}
@ -329,13 +329,13 @@ public class Battle
}
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();
@ -343,24 +343,24 @@ public class Battle
}
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();
@ -370,7 +370,7 @@ public class Battle
{
EntityInfo entityInfo;
try {
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getCustomEntityInfoReference(e.getCustomName().getUnformattedComponentText());
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getCustomEntityInfoReference(e.getCustomName().getString());
} catch(NullPointerException exception) {
entityInfo = null;
}
@ -392,13 +392,13 @@ public class Battle
}
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();
@ -406,24 +406,24 @@ public class Battle
}
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();
@ -465,7 +465,7 @@ public class Battle
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;
}
@ -475,7 +475,7 @@ public class Battle
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;
}
@ -594,7 +594,7 @@ public class Battle
{
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();)
@ -615,7 +615,7 @@ public class Battle
{
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())
@ -641,7 +641,7 @@ public class Battle
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());
@ -677,19 +677,23 @@ public class Battle
{
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();
}
@ -713,14 +717,14 @@ public class Battle
}
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;
}
@ -805,12 +809,12 @@ public class Battle
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())
@ -914,7 +918,7 @@ public class Battle
continue;
}
debugLog = next.entity.getDisplayName().getUnformattedComponentText();
debugLog = next.entity.getDisplayName().getString();
next.remainingDefenses = 0;
@ -925,7 +929,7 @@ public class Battle
{
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";
@ -942,7 +946,7 @@ public class Battle
{
continue;
}
ItemStack heldItemStack = ((PlayerEntity)next.entity).getHeldItemMainhand();
ItemStack heldItemStack = ((PlayerEntity)next.entity).getMainHandItem();
if(heldItemStack.getItem() instanceof BowItem)
{
debugLog += " with bow";
@ -950,8 +954,8 @@ public class Battle
{
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())
{
@ -959,15 +963,15 @@ public class Battle
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;
}
@ -994,8 +998,8 @@ public class Battle
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)
{
@ -1018,20 +1022,20 @@ public class Battle
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
@ -1039,24 +1043,24 @@ public class Battle
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
{
@ -1114,7 +1118,7 @@ public class Battle
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)
{
@ -1166,23 +1170,23 @@ public class Battle
}
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
@ -1190,21 +1194,21 @@ public class Battle
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";
@ -1286,14 +1290,14 @@ public class Battle
{
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:
@ -1301,66 +1305,66 @@ public class Battle
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;
@ -1393,18 +1397,18 @@ public class Battle
}
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;
@ -1437,17 +1441,17 @@ public class Battle
}
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;
}
@ -1494,18 +1498,18 @@ public class Battle
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);
}
}
}

View file

@ -55,19 +55,19 @@ public class BattleManager
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;
}
@ -75,7 +75,7 @@ public class BattleManager
// 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 + "\"");
@ -92,8 +92,8 @@ public class BattleManager
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 {
@ -105,14 +105,14 @@ public class BattleManager
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 {
@ -122,12 +122,12 @@ public class BattleManager
}
// 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;
}
@ -136,14 +136,14 @@ public class BattleManager
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
@ -157,7 +157,7 @@ public class BattleManager
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());
@ -167,12 +167,12 @@ public class BattleManager
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());
}
}
@ -184,13 +184,13 @@ public class BattleManager
{
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;
}
@ -227,11 +227,11 @@ public class BattleManager
// 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;
}
@ -246,7 +246,7 @@ public class BattleManager
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 {
@ -255,7 +255,7 @@ public class BattleManager
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());
@ -265,7 +265,7 @@ public class BattleManager
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());
@ -314,7 +314,7 @@ public class BattleManager
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));
}
@ -325,7 +325,7 @@ public class BattleManager
{
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())
{

View file

@ -58,13 +58,13 @@ public class Combatant
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;
}
@ -92,13 +92,13 @@ public class Combatant
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;
}

View file

@ -154,7 +154,7 @@ public class CommonProxy
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)
@ -163,6 +163,6 @@ public class CommonProxy
}
public Entity getEntity(int id, RegistryKey<World> dim) {
return ServerLifecycleHooks.getCurrentServer().getWorld(dim).getEntityByID(id);
return ServerLifecycleHooks.getCurrentServer().getLevel(dim).getEntity(id);
}
}

View file

@ -9,7 +9,7 @@ import net.minecraftforge.fml.network.PacketDistributor;
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()))

View file

@ -11,7 +11,8 @@ public class EntityIDDimPair {
EntityIDDimPair() {
id = 0;
dim = Minecraft.getInstance().world.func_234923_W_();
// dim = Minecraft.getInstance().world.dimension();
dim = null;
}
EntityIDDimPair(int id, RegistryKey<World> dim) {
@ -20,8 +21,8 @@ public class EntityIDDimPair {
}
EntityIDDimPair(Entity entity) {
id = entity.getEntityId();
dim = entity.getEntityWorld().func_234923_W_();
id = entity.getId();
dim = entity.level.dimension();
}
public Entity getEntity() {

View file

@ -202,23 +202,23 @@ public class EntityInfo
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:
@ -276,12 +276,12 @@ public class EntityInfo
{
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));
}
}

View file

@ -9,13 +9,13 @@ public class PlayerJoinEventHandler
@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());
}
}
}

View file

@ -35,7 +35,7 @@ public class TurnBasedMinecraftMod
{
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/";
@ -76,7 +76,7 @@ public class TurnBasedMinecraftMod
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();
@ -150,43 +150,43 @@ public class TurnBasedMinecraftMod
// 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();
@ -196,36 +196,36 @@ public class TurnBasedMinecraftMod
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) {
@ -233,20 +233,20 @@ public class TurnBasedMinecraftMod
} 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) {
@ -259,18 +259,18 @@ public class TurnBasedMinecraftMod
}))
.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);
@ -278,16 +278,16 @@ public class TurnBasedMinecraftMod
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){
@ -300,8 +300,8 @@ public class TurnBasedMinecraftMod
})
.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) {
@ -314,8 +314,8 @@ public class TurnBasedMinecraftMod
})
.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;
@ -331,8 +331,8 @@ public class TurnBasedMinecraftMod
)
.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) {
@ -345,8 +345,8 @@ public class TurnBasedMinecraftMod
})
.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;
@ -365,8 +365,8 @@ public class TurnBasedMinecraftMod
)
.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) {
@ -379,8 +379,8 @@ public class TurnBasedMinecraftMod
})
.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;
@ -401,8 +401,8 @@ public class TurnBasedMinecraftMod
)
.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) {
@ -415,8 +415,8 @@ public class TurnBasedMinecraftMod
})
.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;
@ -435,8 +435,8 @@ public class TurnBasedMinecraftMod
)
.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) {
@ -449,8 +449,8 @@ public class TurnBasedMinecraftMod
})
.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;
@ -466,8 +466,8 @@ public class TurnBasedMinecraftMod
)
.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) {
@ -480,8 +480,8 @@ public class TurnBasedMinecraftMod
})
.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;
@ -502,8 +502,8 @@ public class TurnBasedMinecraftMod
)
.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) {
@ -516,8 +516,8 @@ public class TurnBasedMinecraftMod
})
.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;
@ -536,8 +536,8 @@ public class TurnBasedMinecraftMod
)
.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) {
@ -550,8 +550,8 @@ public class TurnBasedMinecraftMod
})
.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;
@ -572,8 +572,8 @@ public class TurnBasedMinecraftMod
)
.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) {
@ -586,8 +586,8 @@ public class TurnBasedMinecraftMod
})
.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;
@ -608,8 +608,8 @@ public class TurnBasedMinecraftMod
)
.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) {
@ -622,8 +622,8 @@ public class TurnBasedMinecraftMod
})
.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;
@ -642,8 +642,8 @@ public class TurnBasedMinecraftMod
)
.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) {
@ -656,8 +656,8 @@ public class TurnBasedMinecraftMod
})
.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;
@ -673,8 +673,8 @@ public class TurnBasedMinecraftMod
)
.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) {
@ -687,8 +687,8 @@ public class TurnBasedMinecraftMod
})
.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;
@ -709,8 +709,8 @@ public class TurnBasedMinecraftMod
)
.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) {
@ -723,8 +723,8 @@ public class TurnBasedMinecraftMod
})
.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;
@ -745,8 +745,8 @@ public class TurnBasedMinecraftMod
)
.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) {
@ -759,8 +759,8 @@ public class TurnBasedMinecraftMod
})
.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;

View file

@ -39,9 +39,9 @@ public class Utility
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;
}
@ -51,15 +51,15 @@ public class Utility
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);
}
}

View file

@ -42,7 +42,7 @@ public class PacketBattleDecision
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);

View file

@ -68,7 +68,7 @@ public class PacketBattleInfo
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);
@ -76,7 +76,7 @@ public class PacketBattleInfo
}
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);

View file

@ -136,9 +136,9 @@ public class PacketBattleMessage
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) {
@ -147,9 +147,9 @@ public class PacketBattleMessage
buf.readInt()),
buf.readInt(),
buf.readInt(),
Utility.deserializeDimension(buf.readString()),
Utility.deserializeDimension(buf.readUtf()),
buf.readInt(),
buf.readString());
buf.readUtf());
}
public static class Handler {
@ -301,27 +301,27 @@ public class PacketBattleMessage
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);
}

View file

@ -85,48 +85,48 @@ public class PacketEditingMessage
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);
}
@ -138,12 +138,12 @@ public class PacketEditingMessage
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);
@ -153,130 +153,130 @@ public class PacketEditingMessage
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);
@ -286,18 +286,18 @@ public class PacketEditingMessage
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);
@ -307,14 +307,14 @@ public class PacketEditingMessage
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)
{
@ -331,14 +331,14 @@ public class PacketEditingMessage
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)
{
@ -355,14 +355,14 @@ public class PacketEditingMessage
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)
{
@ -379,14 +379,14 @@ public class PacketEditingMessage
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)
{
@ -402,14 +402,14 @@ public class PacketEditingMessage
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)
{
@ -426,14 +426,14 @@ public class PacketEditingMessage
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)
{
@ -450,14 +450,14 @@ public class PacketEditingMessage
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)
{
@ -474,14 +474,14 @@ public class PacketEditingMessage
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)
{
@ -498,14 +498,14 @@ public class PacketEditingMessage
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)
{
@ -522,18 +522,18 @@ public class PacketEditingMessage
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);
@ -541,9 +541,9 @@ public class PacketEditingMessage
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);
@ -552,13 +552,13 @@ public class PacketEditingMessage
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);
@ -566,9 +566,9 @@ public class PacketEditingMessage
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);
@ -577,13 +577,13 @@ public class PacketEditingMessage
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);
@ -591,9 +591,9 @@ public class PacketEditingMessage
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);
@ -602,13 +602,13 @@ public class PacketEditingMessage
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);
@ -616,9 +616,9 @@ public class PacketEditingMessage
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);
@ -627,13 +627,13 @@ public class PacketEditingMessage
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);
@ -641,9 +641,9 @@ public class PacketEditingMessage
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);
@ -659,14 +659,14 @@ public class PacketEditingMessage
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)
{
@ -681,14 +681,14 @@ public class PacketEditingMessage
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)
{
@ -703,14 +703,14 @@ public class PacketEditingMessage
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)
{

View file

@ -22,11 +22,11 @@ public class PacketGeneralMessage
}
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 {

View file

@ -15,7 +15,7 @@ license="MIT"
# 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>
@ -39,7 +39,7 @@ Implements turn-based-battle in Minecraft.
# 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
@ -48,6 +48,6 @@ Implements turn-based-battle in Minecraft.
[[dependencies.com_burnedkirby_turnbasedminecraft]]
modId="minecraft"
mandatory=true
versionRange="[1.16.3,)"
versionRange="[1.16.5,1.17)"
ordering="NONE"
side="BOTH"

View file

@ -3,7 +3,7 @@
"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": "",