From bc080b2f6f9dbe85c5366bbf29481b647608da5e Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Tue, 17 May 2022 14:47:42 +0900 Subject: [PATCH] Update for forge-1.18.2-40.1.0 (mod ver 1.18.0) --- Changelog.md | 5 + README.md | 2 +- build.gradle | 392 +++++---- gradle.properties | 1 + gradle/wrapper/gradle-wrapper.jar | Bin 59203 -> 59536 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 269 +++--- .../TurnBasedMinecraft/client/BattleGui.java | 82 +- .../client/BattleMusic.java | 17 +- .../client/ClientProxy.java | 821 +++++++++++++++++- .../client/EntitySelectionButton.java | 60 +- .../client/ItemSelectionButton.java | 16 +- .../common/AttackEventHandler.java | 18 +- .../common/AttackerViaBow.java | 2 +- .../TurnBasedMinecraft/common/Battle.java | 169 ++-- .../common/BattleManager.java | 66 +- .../TurnBasedMinecraft/common/Combatant.java | 26 +- .../common/CommonProxy.java | 118 +-- .../common/DimensionChangedHandler.java | 8 +- .../common/EditingInfo.java | 6 +- .../common/EntityIDDimPair.java | 11 +- .../TurnBasedMinecraft/common/EntityInfo.java | 68 +- .../common/PlayerJoinEventHandler.java | 4 +- .../common/TurnBasedMinecraftMod.java | 413 +++++---- .../TurnBasedMinecraft/common/Utility.java | 26 +- .../networking/PacketBattleDecision.java | 32 +- .../common/networking/PacketBattleInfo.java | 74 +- .../networking/PacketBattleMessage.java | 233 +---- .../networking/PacketBattleRequestInfo.java | 28 +- .../networking/PacketEditingMessage.java | 626 +------------ .../networking/PacketGeneralMessage.java | 26 +- src/main/resources/META-INF/mods.toml | 8 +- .../TBM_Config.toml | 482 +++++----- src/main/resources/mcmod.info | 4 +- 34 files changed, 2086 insertions(+), 2029 deletions(-) create mode 100644 gradle.properties diff --git a/Changelog.md b/Changelog.md index 5b1b23d..e4bdf2e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,10 @@ # Upcoming changes +# Version 1.18.0 + +Mod now works with Forge-1.18.2-40.1.0 . +Note that the mod's version is confusingly similar (1.18.0). + # Version 1.17.2 (try to) Fix potential freeze bug when an entity leaves battle. diff --git a/README.md b/README.md index 0e12c4f..1b98811 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ configured for them.) # Building Simply invoke `./gradlew build` in the mod directory and after some time the -finished jar will be saved at "build/reobfShadowJar/output.jar" +finished jar will be saved at "build/libs/TurnBasedMinecraft-1.18.0.jar" # Other notes diff --git a/build.gradle b/build.gradle index 9f1ee80..7f14b10 100644 --- a/build.gradle +++ b/build.gradle @@ -1,169 +1,223 @@ -buildscript { - repositories { - maven { url = "https://files.minecraftforge.net/maven" } - jcenter() - mavenCentral() - } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1.+', changing: true - classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.4' - } -} -apply plugin: 'net.minecraftforge.gradle' -apply plugin: 'eclipse' -//apply plugin: 'maven-publish' -apply plugin: 'com.github.johnrengelman.shadow' - -version = "1.17.2" -group = "com.burnedkirby.TurnBasedMinecraft" -archivesBaseName = "TurnBasedMinecraft" - -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. - // snapshot_YYYYMMDD Snapshot are built nightly. - // 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: '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') - - // Default run configurations. - // These can be tweaked, removed, or duplicated as needed. - runs { - client { - workingDirectory project.file('run') - - // Recommended logging data for a userdev environment - property 'forge.logging.markers', 'REGISTRIES' - - // Recommended logging level for the console - property 'forge.logging.console.level', 'debug' - - mods { - TurnBasedMinecraftMod { - source sourceSets.main - } - } - } - - server { - workingDirectory project.file('run') - - // Recommended logging data for a userdev environment - property 'forge.logging.markers', 'REGISTRIES' - - // Recommended logging level for the console - property 'forge.logging.console.level', 'debug' - - mods { - TurnBasedMinecraftMod { - source sourceSets.main - } - } - } - - data { - workingDirectory project.file('run') - - // Recommended logging data for a userdev environment - 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/'), '--existing', file('src/main/resources') - - mods { - TurnBasedMinecraftMod { - source sourceSets.main - } - } - } - } -} - -// 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.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" - // compile "some.group:artifact:version" - - // Real examples - // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env - // compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env - - // The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. - // provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' - - // These dependencies get remapped to your current MCP mappings - // deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev' - - // For more info... - // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html - // http://www.gradle.org/docs/current/userguide/dependency_management.html - - compile files('libs/javamp3-1.0.3.jar') - - shadow files('libs/javamp3-1.0.3.jar') -} - -shadowJar { - project.configurations.shadow.setTransitive(true); - configurations = [project.configurations.shadow] - relocate 'fr.delthas', 'com.burnedkirby.tbm_repack.fr.delthas' - classifier '' // replace the default jar -} - -reobf { - shadowJar {} // reobfuscate the shadowed jar -} - -// Example for how to get properties into the manifest for reading by the runtime.. -jar { - manifest { - attributes([ - "Specification-Title": "TurnBasedMinecraftMod", - "Specification-Vendor": "TurnBasedMinecraftMod_BK", - "Specification-Version": "1", // We are version 1 of ourselves - "Implementation-Title": project.name, - "Implementation-Version": "${version}", - "Implementation-Vendor" :"TurnBasedMinecraftMod_BK", - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), -// "ContainedDeps": "javamp3-1.0.3.jar" - ]) - } -} - -// Example configuration to allow publishing using the maven-publish task -// we define a custom artifact that is sourced from the reobfJar output task -// and then declare that to be published -// Note you'll need to add a repository here -//def reobfFile = file("$buildDir/reobfJar/output.jar") -//def reobfArtifact = artifacts.add('default', reobfFile) { -// type 'jar' -// builtBy 'reobfJar' -//} -//publishing { -// publications { -// mavenJava(MavenPublication) { -// artifact reobfArtifact -// } -// } -// repositories { -// maven { -// url "file:///${project.projectDir}/mcmodsrepo" -// } -// } -//} +buildscript { + repositories { + maven { url = "https://maven.minecraftforge.net" } + jcenter() + mavenCentral() + gradlePluginPortal() + } + dependencies { + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true + classpath 'gradle.plugin.com.github.johnrengelman:shadow:7.1.2' + } +} +apply plugin: 'net.minecraftforge.gradle' +//apply plugin: 'eclipse' +//apply plugin: 'maven-publish' + +version = "1.18.0" +group = "com.burnedkirby.TurnBasedMinecraft" +archivesBaseName = "TurnBasedMinecraft" + +java.toolchain.languageVersion = JavaLanguageVersion.of(17) +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. + // snapshot_YYYYMMDD Snapshot are built nightly. + // 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: 'official', version: '1.18.2' + // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. + + // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') + + // Default run configurations. + // These can be tweaked, removed, or duplicated as needed. + runs { + client { + workingDirectory project.file('run') + + // Recommended logging data for a userdev environment + property 'forge.logging.markers', 'REGISTRIES' + + // Recommended logging level for the console + property 'forge.logging.console.level', 'debug' + + // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. + property 'forge.enabledGameTestNamespaces', 'TurnBasedMinecraftMod' + + mods { + TurnBasedMinecraftMod { + source sourceSets.main + } + } + } + + server { + workingDirectory project.file('run') + + // Recommended logging data for a userdev environment + property 'forge.logging.markers', 'REGISTRIES' + + // Recommended logging level for the console + property 'forge.logging.console.level', 'debug' + + // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. + property 'forge.enabledGameTestNamespaces', 'TurnBasedMinecraftMod' + + mods { + TurnBasedMinecraftMod { + source sourceSets.main + } + } + } + + // This run config launches GameTestServer and runs all registered gametests, then exits. + // By default, the server will crash when no gametests are provided. + // The gametest system is also enabled by default for other run configs under the /test command. + gameTestServer { + workingDirectory project.file('run') + + // Recommended logging data for a userdev environment + // The markers can be added/remove as needed separated by commas. + // "SCAN": For mods scan. + // "REGISTRIES": For firing of registry events. + // "REGISTRYDUMP": For getting the contents of all registries. + property 'forge.logging.markers', 'REGISTRIES' + + // Recommended logging level for the console + // You can set various levels here. + // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels + property 'forge.logging.console.level', 'debug' + + // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. + property 'forge.enabledGameTestNamespaces', 'TurnBasedMinecraftMod' + + mods { + TurnBasedMinecraftMod { + source sourceSets.main + } + } + } + + data { + workingDirectory project.file('run') + + // Recommended logging data for a userdev environment + 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/'), '--existing', file('src/main/resources') + + mods { + TurnBasedMinecraftMod { + source sourceSets.main + } + } + } + } +} + +// Include resources generated by data generators. +sourceSets.main.resources { srcDir 'src/generated/resources' } + +//repositories { +// // Put repositories for dependencies here +// // ForgeGradle automatically adds the Forge maven and Maven Central for you +// +// // If you have mod jar dependencies in ./libs, you can declare them as a repository like so: +// // flatDir { +// // dir 'libs' +// // } +// mavenCentral() +// jcenter() +// +// dependencies { +// classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.4' +// } +//} + +apply plugin: 'com.github.johnrengelman.shadow' + +configurations { + shade + impelmentation.extendsFrom shade +} + +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.18.2-40.1.0' + + // Real mod deobf dependency examples - these get remapped to your current mappings + // compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency + // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency + // implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency + + // Examples using mod jars from ./libs + // implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}") + + // For more info... + // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html + // http://www.gradle.org/docs/current/userguide/dependency_management.html + implementation files('libs/javamp3-1.0.3.jar') + + shade files('libs/javamp3-1.0.3.jar') +} + +// Example for how to get properties into the manifest for reading by the runtime.. +jar { + archiveClassifier = 'slim' + manifest { + attributes([ + "Specification-Title": "TurnBasedMinecraftMod", + "Specification-Vendor": "TurnBasedMinecraftMod_BK", + "Specification-Version": "1", // We are version 1 of ourselves + "Implementation-Title": project.name, + "Implementation-Version": "${version}", + "Implementation-Vendor" :"TurnBasedMinecraftMod_BK", + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), +// "ContainedDeps": "javamp3-1.0.3.jar" + ]) + } +} + +shadowJar { + archiveClassifier = '' + //project.configurations.shadow.setTransitive(true); + configurations = [project.configurations.shade] + relocate 'fr.delthas', 'com.burnedkirby.tbm_repack.fr.delthas' + finalizedBy 'reobfShadowJar' +} + +assemble.dependsOn shadowJar + +reobf { + shadowJar {} // reobfuscate the shadowed jar +} + +// Example configuration to allow publishing using the maven-publish task +// we define a custom artifact that is sourced from the reobfJar output task +// and then declare that to be published +// Note you'll need to add a repository here +//def reobfFile = file("$buildDir/reobfJar/output.jar") +//def reobfArtifact = artifacts.add('default', reobfFile) { +// type 'jar' +// builtBy 'reobfJar' +//} +//publishing { +// publications { +// mavenJava(MavenPublication) { +// artifact reobfArtifact +// } +// } +// repositories { +// maven { +// url "file:///${project.projectDir}/mcmodsrepo" +// } +// } +//} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..8fe20ee --- /dev/null +++ b/gradle.properties @@ -0,0 +1 @@ +org.gradle.jvmargs=-Xmx4096m diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c023ec8b20f512888fe07c5bd3ff77bb8f..7454180f2ae8848c63b8b4dea2cb829da983f2fa 100644 GIT binary patch delta 18435 zcmY&<19zBR)MXm8v2EM7ZQHi-#I|kQZfv7Tn#Q)%81v4zX3d)U4d4 zYYc!v@NU%|U;_sM`2z(4BAilWijmR>4U^KdN)D8%@2KLcqkTDW%^3U(Wg>{qkAF z&RcYr;D1I5aD(N-PnqoEeBN~JyXiT(+@b`4Pv`;KmkBXYN48@0;iXuq6!ytn`vGp$ z6X4DQHMx^WlOek^bde&~cvEO@K$oJ}i`T`N;M|lX0mhmEH zuRpo!rS~#&rg}ajBdma$$}+vEhz?JAFUW|iZEcL%amAg_pzqul-B7Itq6Y_BGmOCC zX*Bw3rFz3R)DXpCVBkI!SoOHt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4z3Oa2SPRURqEahB1B^h{7~+p03SwzqL9QU#$3-X zdYtQ?-K5xDAdfomEd6(yPtZ!yY_<35bMedeq`z2JWorljz5-f9<^93HM-$#+acw%9r!JOM%O<|BR`W& zd-%j_?b^q7Kl6{q^N{cg2u;11rFB5EP+oqG9&pHD#_Mo@aNMj;LUvsl&nK(ca(hT( zzFc2oHC6WQv8g7jo+3ZSwK+9G$cvfRnql)?g=XeQ3+LTh3)79nhEle8OqS3T$qn(> z(=5Bg?EWq-ldEywgzXW965%H(9^ik*rH(8dNdkbcS9|ow&_r`X~R^R?B+(oTiMzzlx8KnHqUi z8Rh-)VAnS-CO+3}yxqm8)X+N+uzieFVm-F#syP#M1p5&$wX3MJ8 z+R@grZ*5G^Uh4I@VT=>C4RJNc^~3mx$kS1F{L?3)BzdduD2MZKdu#jNno&f2&d{?` zW(>$oktzY@GO{|Ln~Bt^A4)(%?l-&(Dm!iL#$K_xOyhwAf=K2<+Bom zw7|hl6E5}B$d%n0sfZvfQRy9Fyz2~ z83#=#LaHnf1th^k*p|ux8!!8pfHE!)x*%=_hAddl)P%4h4%&8!5-W#xqqb}c=H(i|wqcIS&oDQ{ zhI7N-$f$ra3=RjPmMh?-IEkJYQ<}R9Z!}wmp$#~Uc%u1oh#TP}wF*kJJmQX2#27kL z_dz(yKufo<=m71bZfLp^Ll#t3(IHkrgMcvx@~om%Ib(h(<$Da7urTI`x|%`wD--sN zJEEa>4DGSEG?0ulkosfj8IMNN4)B=ZtvGG{|4Fp=Xhg!wPNgYzS>{Bp%%Qa+624X@ X49Luk)baa85H9$5YCsTPT`SVRWMtMW diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 28ff446..41dfb87 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 4f906e0..c53aefa 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${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='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# 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 - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - 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" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# 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" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/BattleGui.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/BattleGui.java index fa33683..22d1c87 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/BattleGui.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/BattleGui.java @@ -1,24 +1,20 @@ package com.burnedkirby.TurnBasedMinecraft.client; -import java.util.ConcurrentModificationException; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.atomic.AtomicInteger; - import com.burnedkirby.TurnBasedMinecraft.common.Battle; import com.burnedkirby.TurnBasedMinecraft.common.Combatant; import com.burnedkirby.TurnBasedMinecraft.common.Config; import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod; import com.burnedkirby.TurnBasedMinecraft.common.networking.PacketBattleDecision; - -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.widget.button.Button; -import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.util.math.vector.Matrix4f; -import net.minecraft.util.text.StringTextComponent; +import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.network.chat.TextComponent; + +import java.util.ConcurrentModificationException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; public class BattleGui extends Screen { private AtomicInteger timeRemaining; @@ -27,7 +23,6 @@ public class BattleGui extends Screen { private MenuState state; private boolean stateChanged; private String info; - private Matrix4f identity; private enum MenuState { MAIN_MENU(0), ATTACK_TARGET(1), ITEM_ACTION(2), WAITING(3), SWITCH_ITEM(4), USE_ITEM(5); @@ -84,14 +79,12 @@ public class BattleGui extends Screen { } public BattleGui() { - super(new StringTextComponent("Battle Gui")); + super(new TextComponent("Battle Gui")); timeRemaining = new AtomicInteger((int) (Config.BATTLE_DECISION_DURATION_NANO_DEFAULT / 1000000000L)); lastInstant = System.nanoTime(); elapsedTime = 0; state = MenuState.MAIN_MENU; stateChanged = true; - identity = new Matrix4f(); - identity.setIdentity(); } private void setState(MenuState state) { @@ -126,21 +119,20 @@ public class BattleGui extends Screen { } stateChanged = false; - buttons.clear(); - children.clear(); + clearWidgets(); switch (state) { case MAIN_MENU: info = "What will you do?"; - addButton(new Button(width * 3 / 7 - 25, 40, 50, 20, new StringTextComponent("Attack"), (button) -> { + addRenderableWidget(new Button(width * 3 / 7 - 25, 40, 50, 20, new TextComponent("Attack"), (button) -> { buttonActionEvent(button, ButtonAction.ATTACK); })); - addButton(new Button(width * 4 / 7 - 25, 40, 50, 20, new StringTextComponent("Defend"), (button) -> { + addRenderableWidget(new Button(width * 4 / 7 - 25, 40, 50, 20, new TextComponent("Defend"), (button) -> { buttonActionEvent(button, ButtonAction.DEFEND); })); - addButton(new Button(width * 3 / 7 - 25, 60, 50, 20, new StringTextComponent("Item"), (button) -> { + addRenderableWidget(new Button(width * 3 / 7 - 25, 60, 50, 20, new TextComponent("Item"), (button) -> { buttonActionEvent(button, ButtonAction.ITEM); })); - addButton(new Button(width * 4 / 7 - 25, 60, 50, 20, new StringTextComponent("Flee"), (button) -> { + addRenderableWidget(new Button(width * 4 / 7 - 25, 60, 50, 20, new TextComponent("Flee"), (button) -> { buttonActionEvent(button, ButtonAction.FLEE); })); break; @@ -151,11 +143,11 @@ public class BattleGui extends Screen { for (Map.Entry e : TurnBasedMinecraftMod.proxy.getLocalBattle() .getSideAEntrySet()) { if (e.getValue().entity != null) { - addButton(new EntitySelectionButton(width / 4 - 60, y, 120, 20, e.getValue().entity.getName().getString(), e.getKey(), true, (button) -> { + addRenderableWidget(new EntitySelectionButton(width / 4 - 60, y, 120, 20, e.getValue().entity.getName().getString(), e.getKey(), true, (button) -> { buttonActionEvent(button, ButtonAction.ATTACK_TARGET); })); } else { - addButton(new EntitySelectionButton(width / 4 - 60, y, 120, 20, "Unknown", e.getKey(), true, (button) -> { + addRenderableWidget(new EntitySelectionButton(width / 4 - 60, y, 120, 20, "Unknown", e.getKey(), true, (button) -> { buttonActionEvent(button, ButtonAction.ATTACK_TARGET); })); } @@ -169,11 +161,11 @@ public class BattleGui extends Screen { for (Map.Entry e : TurnBasedMinecraftMod.proxy.getLocalBattle() .getSideBEntrySet()) { if (e.getValue().entity != null) { - addButton(new EntitySelectionButton(width * 3 / 4 - 60, y, 120, 20, e.getValue().entity.getName().getString(), e.getKey(), false, (button) -> { + addRenderableWidget(new EntitySelectionButton(width * 3 / 4 - 60, y, 120, 20, e.getValue().entity.getName().getString(), e.getKey(), false, (button) -> { buttonActionEvent(button, ButtonAction.ATTACK_TARGET); })); } else { - addButton(new EntitySelectionButton(width * 3 / 4 - 60, y, 120, 20, "Unknown", e.getKey(), false, (button) -> { + addRenderableWidget(new EntitySelectionButton(width * 3 / 4 - 60, y, 120, 20, "Unknown", e.getKey(), false, (button) -> { buttonActionEvent(button, ButtonAction.ATTACK_TARGET); })); } @@ -182,19 +174,19 @@ public class BattleGui extends Screen { } catch (ConcurrentModificationException e) { // ignored } - addButton(new Button(width / 2 - 30, height - 120, 60, 20, new StringTextComponent("Cancel"), (button) -> { + addRenderableWidget(new Button(width / 2 - 30, height - 120, 60, 20, new TextComponent("Cancel"), (button) -> { buttonActionEvent(button, ButtonAction.CANCEL); })); break; case ITEM_ACTION: info = "What will you do with an item?"; - addButton(new Button(width * 1 / 4 - 40, height - 120, 80, 20, new StringTextComponent("Switch Held"), (button) -> { + addRenderableWidget(new Button(width * 1 / 4 - 40, height - 120, 80, 20, new TextComponent("Switch Held"), (button) -> { buttonActionEvent(button, ButtonAction.SWITCH_HELD_ITEM); })); - addButton(new Button(width * 2 / 4 - 40, height - 120, 80, 20, new StringTextComponent("Use"), (button) -> { + addRenderableWidget(new Button(width * 2 / 4 - 40, height - 120, 80, 20, new TextComponent("Use"), (button) -> { buttonActionEvent(button, ButtonAction.DECIDE_USE_ITEM); })); - addButton(new Button(width * 3 / 4 - 40, height - 120, 80, 20, new StringTextComponent("Cancel"), (button) -> { + addRenderableWidget(new Button(width * 3 / 4 - 40, height - 120, 80, 20, new TextComponent("Cancel"), (button) -> { buttonActionEvent(button, ButtonAction.CANCEL); })); break; @@ -204,22 +196,22 @@ public class BattleGui extends Screen { case SWITCH_ITEM: info = "To which item will you switch to?"; for (int i = 0; i < 9; ++i) { - addButton(new ItemSelectionButton(width / 2 - 88 + i * 20, height - 19, 16, 16, "", i, (button) -> { + addRenderableWidget(new ItemSelectionButton(width / 2 - 88 + i * 20, height - 19, 16, 16, "", i, (button) -> { buttonActionEvent(button, ButtonAction.DO_ITEM_SWITCH); })); } - addButton(new Button(width / 2 - 40, height - 120, 80, 20, new StringTextComponent("Cancel"), (button) -> { + addRenderableWidget(new Button(width / 2 - 40, height - 120, 80, 20, new TextComponent("Cancel"), (button) -> { buttonActionEvent(button, ButtonAction.CANCEL); })); break; case USE_ITEM: info = "Which item will you use?"; for (int i = 0; i < 9; ++i) { - addButton(new ItemSelectionButton(width / 2 - 88 + i * 20, height - 19, 16, 16, "", i, (button) -> { + addRenderableWidget(new ItemSelectionButton(width / 2 - 88 + i * 20, height - 19, 16, 16, "", i, (button) -> { buttonActionEvent(button, ButtonAction.DO_USE_ITEM); })); } - addButton(new Button(width / 2 - 40, height - 120, 80, 20, new StringTextComponent("Cancel"), (button) -> { + addRenderableWidget(new Button(width / 2 - 40, height - 120, 80, 20, new TextComponent("Cancel"), (button) -> { buttonActionEvent(button, ButtonAction.CANCEL); })); break; @@ -227,10 +219,10 @@ public class BattleGui extends Screen { } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { + public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTicks) { if (TurnBasedMinecraftMod.proxy.getLocalBattle() == null) { // drawHoveringText("Waiting...", width / 2 - 50, height / 2); - drawString(matrixStack, "Waiting...", width / 2 - 50, height / 2, 0xFFFFFFFF); + drawString(poseStack, "Waiting...", width / 2 - 50, height / 2, 0xFFFFFFFF); return; } if (TurnBasedMinecraftMod.proxy.getLocalBattle().getState() == Battle.State.DECISION @@ -246,7 +238,7 @@ public class BattleGui extends Screen { updateState(); - super.render(matrixStack, mouseX, mouseY, partialTicks); + super.render(poseStack, mouseX, mouseY, partialTicks); String timeRemainingString = "Time remaining: "; int timeRemainingInt = timeRemaining.get(); @@ -259,11 +251,11 @@ public class BattleGui extends Screen { } timeRemainingString += Integer.toString(timeRemainingInt); 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); + fill(poseStack, width / 2 - stringWidth / 2, 5, width / 2 + stringWidth / 2, 15, 0x70000000); + drawString(poseStack, 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); + fill(poseStack, width / 2 - stringWidth / 2, 20, width / 2 + stringWidth / 2, 30, 0x70000000); + drawString(poseStack, info, width / 2 - stringWidth / 2, 20, 0xFFFFFFFF); } protected void buttonActionEvent(Button button, ButtonAction action) { @@ -309,7 +301,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.selected = ((ItemSelectionButton) button).getID(); + Minecraft.getInstance().player.getInventory().selected = ((ItemSelectionButton) button).getID(); } setState(MenuState.WAITING); } else { @@ -354,7 +346,7 @@ public class BattleGui extends Screen { timeRemaining.set(remaining); } - private void drawString(MatrixStack matrixStack, String string, int x, int y, int color) { - font.draw(matrixStack, string, x, y, color); + private void drawString(PoseStack poseStack, String string, int x, int y, int color) { + font.draw(poseStack, string, x, y, color); } } diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/BattleMusic.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/BattleMusic.java index adb37fb..a48ccb5 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/BattleMusic.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/BattleMusic.java @@ -1,21 +1,18 @@ package com.burnedkirby.TurnBasedMinecraft.client; -import java.io.*; -import java.util.ArrayList; -import java.util.concurrent.atomic.AtomicBoolean; +import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod; +import fr.delthas.javamp3.Sound; +import net.minecraft.client.Minecraft; +import org.apache.logging.log4j.Logger; import javax.sound.midi.MidiChannel; import javax.sound.midi.MidiSystem; import javax.sound.midi.MidiUnavailableException; import javax.sound.midi.Sequencer; import javax.sound.sampled.*; - -import fr.delthas.javamp3.Sound; -import org.apache.logging.log4j.Logger; - -import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod; - -import net.minecraft.client.Minecraft; +import java.io.*; +import java.util.ArrayList; +import java.util.concurrent.atomic.AtomicBoolean; public class BattleMusic { diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/ClientProxy.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/ClientProxy.java index f11d253..a87421d 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/ClientProxy.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/ClientProxy.java @@ -2,18 +2,25 @@ package com.burnedkirby.TurnBasedMinecraft.client; import com.burnedkirby.TurnBasedMinecraft.common.Battle; import com.burnedkirby.TurnBasedMinecraft.common.CommonProxy; - -import net.minecraft.client.GameSettings; +import com.burnedkirby.TurnBasedMinecraft.common.EntityInfo; +import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod; +import com.burnedkirby.TurnBasedMinecraft.common.networking.PacketBattleMessage; +import com.burnedkirby.TurnBasedMinecraft.common.networking.PacketEditingMessage; +import com.burnedkirby.TurnBasedMinecraft.common.networking.PacketGeneralMessage; import net.minecraft.client.Minecraft; -import net.minecraft.entity.Entity; -import net.minecraft.util.RegistryKey; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.text.Color; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.world.World; +import net.minecraft.client.Options; +import net.minecraft.network.chat.ClickEvent; +import net.minecraft.network.chat.HoverEvent; +import net.minecraft.network.chat.TextColor; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.resources.ResourceKey; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.Level; +import net.minecraftforge.network.NetworkEvent; import java.util.UUID; +import java.util.function.Supplier; public class ClientProxy extends CommonProxy { @@ -93,15 +100,15 @@ public class ClientProxy extends CommonProxy @Override public void playBattleMusic() { - GameSettings gs = Minecraft.getInstance().options; - battleMusic.playBattle(gs.getSoundSourceVolume(SoundCategory.MUSIC) * gs.getSoundSourceVolume(SoundCategory.MASTER)); + Options gs = Minecraft.getInstance().options; + battleMusic.playBattle(gs.getSoundSourceVolume(SoundSource.MUSIC) * gs.getSoundSourceVolume(SoundSource.MASTER)); } @Override public void playSillyMusic() { - GameSettings gs = Minecraft.getInstance().options; - battleMusic.playSilly(gs.getSoundSourceVolume(SoundCategory.MUSIC) * gs.getSoundSourceVolume(SoundCategory.MASTER)); + Options gs = Minecraft.getInstance().options; + battleMusic.playSilly(gs.getSoundSourceVolume(SoundSource.MUSIC) * gs.getSoundSourceVolume(SoundSource.MASTER)); } @Override @@ -149,17 +156,17 @@ public class ClientProxy extends CommonProxy @Override public void displayString(String message) { - StringTextComponent prefix = new StringTextComponent("TBM: "); - prefix.withStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true)); - StringTextComponent text = new StringTextComponent(message); + TextComponent prefix = new TextComponent("TBM: "); + prefix.withStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true)); + TextComponent text = new TextComponent(message); prefix.getSiblings().add(text); - text.withStyle(text.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)).withBold(false)); + text.withStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false)); // UUID is required by sendMessage, but appears to be unused, so just give dummy UUID Minecraft.getInstance().player.sendMessage(prefix, UUID.randomUUID()); } @Override - public void displayTextComponent(ITextComponent text) + public void displayTextComponent(TextComponent text) { // UUID is required by sendMessage, but appears to be unused, so just give dummy UUID Minecraft.getInstance().player.sendMessage(text, UUID.randomUUID()); @@ -231,7 +238,783 @@ public class ClientProxy extends CommonProxy } @Override - public Entity getEntity(int id, RegistryKey dim) { + public Entity getEntity(int id, ResourceKey dim) { return Minecraft.getInstance().level.getEntity(id); } + + @Override + public void handlePacket(MSG msg, Supplier ctx) { + if (msg.getClass() == PacketBattleMessage.class) { + PacketBattleMessage pkt = (PacketBattleMessage)msg; + Entity fromEntity = getEntity(pkt.getEntityIDFrom(), pkt.getDimension()); + String from = "Unknown"; + if(fromEntity != null) + { + from = fromEntity.getDisplayName().getString(); + } + else if(TurnBasedMinecraftMod.proxy.getLocalBattle() != null) + { + fromEntity = TurnBasedMinecraftMod.proxy.getLocalBattle().getCombatantEntity(pkt.getEntityIDFrom()); + if(fromEntity != null) + { + from = fromEntity.getDisplayName().getString(); + } + } + Entity toEntity = TurnBasedMinecraftMod.proxy.getEntity(pkt.getEntityIDTo(), pkt.getDimension()); + String to = "Unknown"; + if(toEntity != null) + { + to = toEntity.getDisplayName().getString(); + } + else if(TurnBasedMinecraftMod.proxy.getLocalBattle() != null) + { + toEntity = TurnBasedMinecraftMod.proxy.getLocalBattle().getCombatantEntity(pkt.getEntityIDTo()); + if(toEntity != null) + { + to = toEntity.getDisplayName().getString(); + } + } + + switch(pkt.getMessageType()) + { + case ENTERED: + TurnBasedMinecraftMod.proxy.displayString(from + " entered battle!"); + if(TurnBasedMinecraftMod.proxy.getLocalBattle() == null || TurnBasedMinecraftMod.proxy.getLocalBattle().getId() != pkt.getAmount()) + { + TurnBasedMinecraftMod.proxy.createLocalBattle(pkt.getAmount()); + } + TurnBasedMinecraftMod.proxy.battleStarted(); + TurnBasedMinecraftMod.proxy.typeEnteredBattle(pkt.getCustom()); + break; + case FLEE: + if(pkt.getAmount() != 0) + { + TurnBasedMinecraftMod.proxy.displayString(from + " fled battle!"); + TurnBasedMinecraftMod.proxy.typeLeftBattle(pkt.getCustom()); + } + else + { + TurnBasedMinecraftMod.proxy.displayString(from + " tried to flee battle but failed!"); + } + break; + case DIED: + TurnBasedMinecraftMod.proxy.displayString(from + " died in battle!"); + TurnBasedMinecraftMod.proxy.typeLeftBattle(pkt.getCustom()); + break; + case ENDED: + TurnBasedMinecraftMod.proxy.displayString("Battle has ended!"); + TurnBasedMinecraftMod.proxy.battleEnded(); + break; + case ATTACK: + TurnBasedMinecraftMod.proxy.displayString(from + " attacked " + to + " and dealt " + pkt.getAmount() + " damage!"); + break; + case DEFEND: + TurnBasedMinecraftMod.proxy.displayString(from + " blocked " + to + "'s attack!"); + break; + case DEFENSE_DAMAGE: + TurnBasedMinecraftMod.proxy.displayString(from + " retaliated from " + to + "'s attack and dealt " + pkt.getAmount() + " damage!"); + break; + case MISS: + TurnBasedMinecraftMod.proxy.displayString(from + " attacked " + to + " but missed!"); + break; + case DEFENDING: + TurnBasedMinecraftMod.proxy.displayString(from + " is defending!"); + break; + case DID_NOTHING: + TurnBasedMinecraftMod.proxy.displayString(from + " did nothing!"); + break; + case USED_ITEM: + switch(PacketBattleMessage.UsedItemAction.valueOf(pkt.getAmount())) + { + case USED_NOTHING: + TurnBasedMinecraftMod.proxy.displayString(from + " tried to use nothing!"); + break; + case USED_INVALID: + if(pkt.getCustom().length() > 0) + { + TurnBasedMinecraftMod.proxy.displayString(from + " tried to consume " + pkt.getCustom() + " and failed!"); + } + else + { + TurnBasedMinecraftMod.proxy.displayString(from + " tried to consume an invalid item and failed!"); + } + break; + case USED_FOOD: + TurnBasedMinecraftMod.proxy.displayString(from + " ate a " + pkt.getCustom() + "!"); + break; + case USED_POTION: + TurnBasedMinecraftMod.proxy.displayString(from + " drank a " + pkt.getCustom() + "!"); + break; + } + break; + case TURN_BEGIN: + TurnBasedMinecraftMod.proxy.displayString("The turn begins!"); + TurnBasedMinecraftMod.proxy.battleGuiTurnBegin(); + break; + case TURN_END: + if(TurnBasedMinecraftMod.proxy.getLocalBattle() != null) + { + if(pkt.getAmount() == 0) + { + TurnBasedMinecraftMod.proxy.displayString("The turn ended!"); + } + else + { + TurnBasedMinecraftMod.proxy.displayString("The turn ended (abnormally due to internal error)!"); + } + } + TurnBasedMinecraftMod.proxy.battleGuiTurnEnd(); + break; + case SWITCHED_ITEM: + if(pkt.getAmount() != 0) + { + TurnBasedMinecraftMod.proxy.displayString(from + " switched to a different item!"); + } + else + { + TurnBasedMinecraftMod.proxy.displayString(from + " switched to a different item but failed because it was invalid!"); + } + break; + case WAS_AFFECTED: + TurnBasedMinecraftMod.proxy.displayString(to + " was " + pkt.getCustom() + " by " + from + "!"); + break; + case BECAME_CREATIVE: + TurnBasedMinecraftMod.proxy.displayString(from + " entered creative mode and left battle!"); + break; + case FIRED_ARROW: + TurnBasedMinecraftMod.proxy.displayString(from + " let loose an arrow towards " + to + "!"); + break; + case ARROW_HIT: + TurnBasedMinecraftMod.proxy.displayString(to + " was hit by " + from + "'s arrow!"); + break; + case BOW_NO_AMMO: + TurnBasedMinecraftMod.proxy.displayString(from + " tried to use their bow but ran out of ammo!"); + break; + case CREEPER_WAIT: { + TextComponent prefix = new TextComponent("TBM: "); + prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true)); + TextComponent message = new TextComponent(from + " is charging up!"); + message.setStyle(message.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00))); + prefix.getSiblings().add(message); + TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); + } + break; + case CREEPER_WAIT_FINAL: { + TextComponent prefix = new TextComponent("TBM: "); + prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true)); + TextComponent message = new TextComponent(from + " is about to explode!"); + message.setStyle(message.getStyle().withColor(TextColor.fromRgb(0xFFFF5050))); + prefix.getSiblings().add(message); + TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); + } + break; + case CREEPER_EXPLODE: { + TextComponent prefix = new TextComponent("TBM: "); + prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true)); + TextComponent message = new TextComponent(from + " exploded!"); + message.setStyle(message.getStyle().withColor(TextColor.fromRgb(0xFFFF0000))); + prefix.getSiblings().add(message); + TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); + } + break; + } + } else if (msg.getClass() == PacketGeneralMessage.class) { + PacketGeneralMessage pkt = (PacketGeneralMessage)msg; + displayString(pkt.getMessage()); + } else if (msg.getClass() == PacketEditingMessage.class) { + PacketEditingMessage pkt = (PacketEditingMessage)msg; + switch(pkt.getType()) + { + case ATTACK_ENTITY: + { + TextComponent prefix = new TextComponent("TBM: "); + prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true)); + TextComponent text = new TextComponent("Attack the entity you want to edit for TurnBasedMinecraftMod. "); + text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false)); + + TextComponent cancel = new TextComponent("Cancel"); + cancel.setStyle(cancel.getStyle().withColor(TextColor.fromRgb(0xFFFF0000)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit cancel"))); + text.getSiblings().add(cancel); + + prefix.getSiblings().add(text); + TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); + break; + } + case PICK_EDIT: + { + TextComponent prefix = new TextComponent("TBM: "); + prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true)); + TextComponent text = new TextComponent("Edit what value? "); + text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false)); + + TextComponent option = new TextComponent("IgB"); + // HoverEvent.Action.SHOW_TEXT is probably SHOW_TEXT + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit ignoreBattle")) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("IgnoreBattle")))); + TextComponent value = new TextComponent("(" + pkt.getEntityInfo().ignoreBattle + ") "); + value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF))); + option.getSiblings().add(value); + text.getSiblings().add(option); + + option = new TextComponent("AP"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackPower")) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("AttackPower")))); + value = new TextComponent("(" + pkt.getEntityInfo().attackPower + ") "); + value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF))); + option.getSiblings().add(value); + text.getSiblings().add(option); + + option = new TextComponent("APr"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackProbability")) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("AttackProbability")))); + value = new TextComponent("(" + pkt.getEntityInfo().attackProbability + "%) "); + value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF))); + option.getSiblings().add(value); + text.getSiblings().add(option); + + option = new TextComponent("AV"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackVariance")) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("AttackVariance")))); + value = new TextComponent("(" + pkt.getEntityInfo().attackVariance + ") "); + value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF))); + option.getSiblings().add(value); + text.getSiblings().add(option); + + option = new TextComponent("AE"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffect")) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("AttackEffect")))); + value = new TextComponent("(" + pkt.getEntityInfo().attackEffect.toString() + ") "); + value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF))); + option.getSiblings().add(value); + text.getSiblings().add(option); + + option = new TextComponent("AEPr"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffectProbability")) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("AttackEffectProbability")))); + value = new TextComponent("(" + pkt.getEntityInfo().attackEffectProbability + "%) "); + value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF))); + option.getSiblings().add(value); + text.getSiblings().add(option); + + option = new TextComponent("DD"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamage")) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("DefenseDamage")))); + value = new TextComponent("(" + pkt.getEntityInfo().defenseDamage + ") "); + value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF))); + option.getSiblings().add(value); + text.getSiblings().add(option); + + option = new TextComponent("DDPr"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamageProbability")) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("DefenseDamageProbability")))); + value = new TextComponent("(" + pkt.getEntityInfo().defenseDamageProbability + "%) "); + value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF))); + option.getSiblings().add(value); + text.getSiblings().add(option); + + option = new TextComponent("E"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit evasion")) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("Evasion")))); + value = new TextComponent("(" + pkt.getEntityInfo().evasion + "%) "); + value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF))); + option.getSiblings().add(value); + text.getSiblings().add(option); + + option = new TextComponent("S"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit speed")) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("Speed")))); + value = new TextComponent("(" + pkt.getEntityInfo().speed + ") "); + value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF))); + option.getSiblings().add(value); + text.getSiblings().add(option); + + option = new TextComponent("C"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category")) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("Category")))); + value = new TextComponent("(" + pkt.getEntityInfo().category + ") "); + value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF))); + option.getSiblings().add(value); + text.getSiblings().add(option); + + option = new TextComponent("DecA"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionAttack")) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("DecisionAttack")))); + value = new TextComponent("(" + pkt.getEntityInfo().decisionAttack + "%) "); + value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF))); + option.getSiblings().add(value); + text.getSiblings().add(option); + + option = new TextComponent("DecD"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionDefend")) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("DecisionDefend")))); + value = new TextComponent("(" + pkt.getEntityInfo().decisionDefend + "%) "); + value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF))); + option.getSiblings().add(value); + text.getSiblings().add(option); + + option = new TextComponent("DecF"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionFlee")) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("DecisionFlee")))); + value = new TextComponent("(" + pkt.getEntityInfo().decisionFlee + "%) "); + value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF))); + option.getSiblings().add(value); + text.getSiblings().add(option); + + option = new TextComponent("Finished Editing"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit finish"))); + text.getSiblings().add(option); + text.getSiblings().add(new TextComponent(" ")); + + option = new TextComponent("Cancel"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFF0000)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit cancel"))); + text.getSiblings().add(option); + + prefix.getSiblings().add(text); + TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); + break; + } + case EDIT_IGNORE_BATTLE: + { + TextComponent prefix = new TextComponent("TBM: "); + prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true)); + TextComponent text = new TextComponent("ignoreBattle: "); + text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false)); + + TextComponent option = new TextComponent("true"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit ignoreBattle true"))); + text.getSiblings().add(option); + + text.getSiblings().add(new TextComponent(" ")); + + option = new TextComponent("false"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFF0000)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit ignoreBattle false"))); + text.getSiblings().add(option); + + prefix.getSiblings().add(text); + TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); + break; + } + case EDIT_ATTACK_POWER: + { + TextComponent prefix = new TextComponent("TBM: "); + prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true)); + TextComponent text = new TextComponent("attackPower: "); + text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false)); + + for(int i = 0; i <= 15; ++i) + { + TextComponent option = new TextComponent(Integer.toString(i)); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackPower " + Integer.toString(i)))); + text.getSiblings().add(option); + if(i < 15) + { + text.getSiblings().add(new TextComponent(", ")); + } + } + + text.getSiblings().add(new TextComponent(" (or use command \"/tbm-edit edit attackPower \")")); + + prefix.getSiblings().add(text); + TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); + break; + } + case EDIT_ATTACK_PROBABILITY: + { + TextComponent prefix = new TextComponent("TBM: "); + prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true)); + TextComponent text = new TextComponent("attackProbability: "); + text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false)); + + for(int i = 10; i <= 100; i += 10) + { + TextComponent option = new TextComponent(Integer.toString(i) + "%"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackProbability " + Integer.toString(i)))); + text.getSiblings().add(option); + if(i < 100) + { + text.getSiblings().add(new TextComponent(", ")); + } + } + + text.getSiblings().add(new TextComponent(" (or use command \"/tbm-edit edit attackProbability \")")); + + prefix.getSiblings().add(text); + TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); + break; + } + case EDIT_ATTACK_VARIANCE: + { + TextComponent prefix = new TextComponent("TBM: "); + prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true)); + TextComponent text = new TextComponent("attackVariance: "); + text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false)); + + for(int i = 0; i <= 10; ++i) + { + TextComponent option = new TextComponent(Integer.toString(i)); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackVariance " + Integer.toString(i)))); + text.getSiblings().add(option); + if(i < 10) + { + text.getSiblings().add(new TextComponent(", ")); + } + } + + text.getSiblings().add(new TextComponent(" (or use command \"/tbm-edit edit attackVariance \")")); + + prefix.getSiblings().add(text); + TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); + break; + } + case EDIT_ATTACK_EFFECT: + { + TextComponent prefix = new TextComponent("TBM: "); + prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true)); + TextComponent text = new TextComponent("attackEffect: "); + text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false)); + + for(EntityInfo.Effect e : EntityInfo.Effect.values()) + { + TextComponent option = new TextComponent(e.toString()); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffect " + e.toString()))); + text.getSiblings().add(option); + if(e != EntityInfo.Effect.UNKNOWN) + { + // TODO find a better way to handle printing comma for items before last + text.getSiblings().add(new TextComponent(", ")); + } + } + + prefix.getSiblings().add(text); + TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); + break; + } + case EDIT_ATTACK_EFFECT_PROBABILITY: + { + TextComponent prefix = new TextComponent("TBM: "); + prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true)); + TextComponent text = new TextComponent("attackEffectProbability: "); + text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false)); + + for(int i = 0; i <= 100; i += 10) + { + TextComponent option = new TextComponent(Integer.toString(i) + "%"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffectProbability " + Integer.toString(i)))); + text.getSiblings().add(option); + if(i < 100) + { + text.getSiblings().add(new TextComponent(", ")); + } + } + + text.getSiblings().add(new TextComponent(" (or use command \"/tbm-edit edit attackEffectProbability \")")); + + prefix.getSiblings().add(text); + TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); + break; + } + case EDIT_DEFENSE_DAMAGE: + { + TextComponent prefix = new TextComponent("TBM: "); + prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true)); + TextComponent text = new TextComponent("defenseDamage: "); + text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false)); + + for(int i = 0; i <= 15; ++i) + { + TextComponent option = new TextComponent(Integer.toString(i)); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamage " + Integer.toString(i)))); + text.getSiblings().add(option); + if(i < 15) + { + text.getSiblings().add(new TextComponent(", ")); + } + } + + text.getSiblings().add(new TextComponent(" (or use command \"/tbm-edit edit defenseDamage \")")); + + prefix.getSiblings().add(text); + TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); + break; + } + case EDIT_DEFENSE_DAMAGE_PROBABILITY: + { + TextComponent prefix = new TextComponent("TBM: "); + prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true)); + TextComponent text = new TextComponent("defenseDamageProbability: "); + text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false)); + + for(int i = 0; i <= 100; i += 10) + { + TextComponent option = new TextComponent(Integer.toString(i) + "%"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamageProbability " + Integer.toString(i)))); + text.getSiblings().add(option); + if(i < 100) + { + text.getSiblings().add(new TextComponent(", ")); + } + } + + text.getSiblings().add(new TextComponent(" (or use command \"/tbm-edit edit defenseDamageProbability \")")); + + prefix.getSiblings().add(text); + TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); + break; + } + case EDIT_EVASION: + { + TextComponent prefix = new TextComponent("TBM: "); + prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true)); + TextComponent text = new TextComponent("evasion: "); + text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false)); + + for(int i = 0; i <= 100; i += 10) + { + TextComponent option = new TextComponent(Integer.toString(i) + "%"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit evasion " + Integer.toString(i)))); + text.getSiblings().add(option); + if(i < 100) + { + text.getSiblings().add(new TextComponent(", ")); + } + } + + text.getSiblings().add(new TextComponent(" (or use command \"/tbm-edit edit evasion \")")); + + prefix.getSiblings().add(text); + TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); + break; + } + case EDIT_SPEED: + { + TextComponent prefix = new TextComponent("TBM: "); + prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true)); + TextComponent text = new TextComponent("speed: "); + text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false)); + + for(int i = 0; i <= 100; i += 10) + { + TextComponent option = new TextComponent(Integer.toString(i)); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit speed " + Integer.toString(i)))); + text.getSiblings().add(option); + if(i < 100) + { + text.getSiblings().add(new TextComponent(", ")); + } + } + + text.getSiblings().add(new TextComponent(" (or use command \"/tbm-edit edit speed \")")); + + prefix.getSiblings().add(text); + TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); + break; + } + case EDIT_CATEGORY: + { + TextComponent prefix = new TextComponent("TBM: "); + prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true)); + TextComponent text = new TextComponent("category: "); + text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false)); + + TextComponent option = new TextComponent("monster"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category monster"))); + if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("monster")) + { + TextComponent optionInfo = new TextComponent("(battle-"); + optionInfo.setStyle(optionInfo.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF))); + TextComponent optionInfoBool = new TextComponent("disabled"); + optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(TextColor.fromRgb(0xFFFF0000))); + optionInfo.getSiblings().add(optionInfoBool); + optionInfo.getSiblings().add(new TextComponent(")")); + option.getSiblings().add(optionInfo); + } + else + { + TextComponent optionInfo = new TextComponent("(battle-"); + optionInfo.setStyle(optionInfo.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF))); + TextComponent optionInfoBool = new TextComponent("enabled"); + optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(TextColor.fromRgb(0xFF00FF00))); + optionInfo.getSiblings().add(optionInfoBool); + optionInfo.getSiblings().add(new TextComponent(")")); + option.getSiblings().add(optionInfo); + } + text.getSiblings().add(option); + text.getSiblings().add(new TextComponent(", ")); + + option = new TextComponent("animal"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category animal"))); + if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("animal")) + { + TextComponent optionInfo = new TextComponent("(battle-"); + optionInfo.setStyle(optionInfo.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF))); + TextComponent optionInfoBool = new TextComponent("disabled"); + optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(TextColor.fromRgb(0xFFFF0000))); + optionInfo.getSiblings().add(optionInfoBool); + optionInfo.getSiblings().add(new TextComponent(")")); + option.getSiblings().add(optionInfo); + } + else + { + TextComponent optionInfo = new TextComponent("(battle-"); + optionInfo.setStyle(optionInfo.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF))); + TextComponent optionInfoBool = new TextComponent("enabled"); + optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(TextColor.fromRgb(0xFF00FF00))); + optionInfo.getSiblings().add(optionInfoBool); + optionInfo.getSiblings().add(new TextComponent(")")); + option.getSiblings().add(optionInfo); + } + text.getSiblings().add(option); + text.getSiblings().add(new TextComponent(", ")); + + option = new TextComponent("passive"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category passive"))); + if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("passive")) + { + TextComponent optionInfo = new TextComponent("(battle-"); + optionInfo.setStyle(optionInfo.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF))); + TextComponent optionInfoBool = new TextComponent("disabled"); + optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(TextColor.fromRgb(0xFFFF0000))); + optionInfo.getSiblings().add(optionInfoBool); + optionInfo.getSiblings().add(new TextComponent(")")); + option.getSiblings().add(optionInfo); + } + else + { + TextComponent optionInfo = new TextComponent("(battle-"); + optionInfo.setStyle(optionInfo.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF))); + TextComponent optionInfoBool = new TextComponent("enabled"); + optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(TextColor.fromRgb(0xFF00FF00))); + optionInfo.getSiblings().add(optionInfoBool); + optionInfo.getSiblings().add(new TextComponent(")")); + option.getSiblings().add(optionInfo); + } + text.getSiblings().add(option); + text.getSiblings().add(new TextComponent(", ")); + + option = new TextComponent("boss"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category boss"))); + if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("boss")) + { + TextComponent optionInfo = new TextComponent("(battle-"); + optionInfo.setStyle(optionInfo.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF))); + TextComponent optionInfoBool = new TextComponent("disabled"); + optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(TextColor.fromRgb(0xFFFF0000))); + optionInfo.getSiblings().add(optionInfoBool); + optionInfo.getSiblings().add(new TextComponent(")")); + option.getSiblings().add(optionInfo); + } + else + { + TextComponent optionInfo = new TextComponent("(battle-"); + optionInfo.setStyle(optionInfo.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF))); + TextComponent optionInfoBool = new TextComponent("enabled"); + optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(TextColor.fromRgb(0xFF00FF00))); + optionInfo.getSiblings().add(optionInfoBool); + optionInfo.getSiblings().add(new TextComponent(")")); + option.getSiblings().add(optionInfo); + } + text.getSiblings().add(option); + text.getSiblings().add(new TextComponent(", ")); + + option = new TextComponent("player"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category player"))); + if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("player")) + { + TextComponent optionInfo = new TextComponent("(battle-"); + optionInfo.setStyle(optionInfo.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF))); + TextComponent optionInfoBool = new TextComponent("disabled"); + optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(TextColor.fromRgb(0xFFFF0000))); + optionInfo.getSiblings().add(optionInfoBool); + optionInfo.getSiblings().add(new TextComponent(")")); + option.getSiblings().add(optionInfo); + } + else + { + TextComponent optionInfo = new TextComponent("(battle-"); + optionInfo.setStyle(optionInfo.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF))); + TextComponent optionInfoBool = new TextComponent("enabled"); + optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(TextColor.fromRgb(0xFF00FF00))); + optionInfo.getSiblings().add(optionInfoBool); + optionInfo.getSiblings().add(new TextComponent(")")); + option.getSiblings().add(optionInfo); + } + text.getSiblings().add(option); + + text.getSiblings().add(new TextComponent(" (or use command \"/tbm-edit edit category \")")); + + prefix.getSiblings().add(text); + TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); + break; + } + case EDIT_DECISION_ATTACK: + { + TextComponent prefix = new TextComponent("TBM: "); + prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true)); + TextComponent text = new TextComponent("decisionAttack: "); + text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false)); + + for(int i = 0; i <= 100; i += 10) + { + TextComponent option = new TextComponent(Integer.toString(i) + "%"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionAttack " + Integer.toString(i)))); + text.getSiblings().add(option); + if(i < 100) + { + text.getSiblings().add(new TextComponent(", ")); + } + } + + prefix.getSiblings().add(text); + TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); + break; + } + case EDIT_DECISION_DEFEND: + { + TextComponent prefix = new TextComponent("TBM: "); + prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true)); + TextComponent text = new TextComponent("decisionDefend: "); + text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false)); + + for(int i = 0; i <= 100; i += 10) + { + TextComponent option = new TextComponent(Integer.toString(i) + "%"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionDefend " + Integer.toString(i)))); + text.getSiblings().add(option); + if(i < 100) + { + text.getSiblings().add(new TextComponent(", ")); + } + } + + prefix.getSiblings().add(text); + TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); + break; + } + case EDIT_DECISION_FLEE: + { + TextComponent prefix = new TextComponent("TBM: "); + prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true)); + TextComponent text = new TextComponent("decisionFlee: "); + text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false)); + + for(int i = 0; i <= 100; i += 10) + { + TextComponent option = new TextComponent(Integer.toString(i) + "%"); + option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionFlee " + Integer.toString(i)))); + text.getSiblings().add(option); + if(i < 100) + { + text.getSiblings().add(new TextComponent(", ")); + } + } + + prefix.getSiblings().add(text); + TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); + break; + } + default: + break; + } + } + } } diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/EntitySelectionButton.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/EntitySelectionButton.java index 99a017b..59cd729 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/EntitySelectionButton.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/EntitySelectionButton.java @@ -1,18 +1,18 @@ package com.burnedkirby.TurnBasedMinecraft.client; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.widget.button.Button; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.util.text.StringTextComponent; +import net.minecraft.client.gui.components.Button; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.network.chat.TextComponent; public class EntitySelectionButton extends Button { private int entityID; private boolean isSideA; - public EntitySelectionButton(int x, int y, int widthIn, int heightIn, String buttonText, int entityID, boolean isSideA, Button.IPressable onPress) { - super(x, y, widthIn, heightIn, new StringTextComponent(buttonText), onPress); + public EntitySelectionButton(int x, int y, int widthIn, int heightIn, String buttonText, int entityID, boolean isSideA, Button.OnPress onPress) { + super(x, y, widthIn, heightIn, new TextComponent(buttonText), onPress); this.entityID = entityID; this.isSideA = isSideA; } @@ -26,8 +26,8 @@ public class EntitySelectionButton extends Button { } @Override - public void renderButton(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { - super.renderButton(matrixStack, mouseX, mouseY, partialTicks); + public void renderButton(PoseStack poseStack, int mouseX, int mouseY, float partialTicks) { + super.renderButton(poseStack, 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); @@ -41,38 +41,38 @@ public class EntitySelectionButton extends Button { xoffset = -4; } if (health > 200) { - fill(matrixStack, xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000); - fill(matrixStack, xpos, getY() + getHeight() * 3 / 5, xpos + 2, getY() + getHeight() * 4 / 5, 0xFFFFFF00); - fill(matrixStack, xpos, getY() + getHeight() * 2 / 5, xpos + 2, getY() + getHeight() * 3 / 5, 0xFF00FF00); - fill(matrixStack, xpos, getY() + getHeight() / 5, xpos + 2, getY() + getHeight() * 2 / 5, 0xFF00FFFF); - fill(matrixStack, xpos, getY(), xpos + 2, getY() + getHeight() / 5, 0xFF0000FF); + fill(poseStack, xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000); + fill(poseStack, xpos, getY() + getHeight() * 3 / 5, xpos + 2, getY() + getHeight() * 4 / 5, 0xFFFFFF00); + fill(poseStack, xpos, getY() + getHeight() * 2 / 5, xpos + 2, getY() + getHeight() * 3 / 5, 0xFF00FF00); + fill(poseStack, xpos, getY() + getHeight() / 5, xpos + 2, getY() + getHeight() * 2 / 5, 0xFF00FFFF); + fill(poseStack, xpos, getY(), xpos + 2, getY() + getHeight() / 5, 0xFF0000FF); int healthHeight = ((health - 200) * getHeight() / 100); - fill(matrixStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFFFFFFFF); + fill(poseStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFFFFFFFF); } else if (health > 100) { - fill(matrixStack, xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000); - fill(matrixStack, xpos, getY() + getHeight() * 3 / 5, xpos + 2, getY() + getHeight() * 4 / 5, 0xFFFFFF00); - fill(matrixStack, xpos, getY() + getHeight() * 2 / 5, xpos + 2, getY() + getHeight() * 3 / 5, 0xFF00FF00); - fill(matrixStack, xpos, getY() + getHeight() / 5, xpos + 2, getY() + getHeight() * 2 / 5, 0xFF00FFFF); + fill(poseStack, xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000); + fill(poseStack, xpos, getY() + getHeight() * 3 / 5, xpos + 2, getY() + getHeight() * 4 / 5, 0xFFFFFF00); + fill(poseStack, xpos, getY() + getHeight() * 2 / 5, xpos + 2, getY() + getHeight() * 3 / 5, 0xFF00FF00); + fill(poseStack, xpos, getY() + getHeight() / 5, xpos + 2, getY() + getHeight() * 2 / 5, 0xFF00FFFF); int healthHeight = ((health - 100) * getHeight() / 100); - fill(matrixStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFF0000FF); + fill(poseStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFF0000FF); } else if (health > 50) { - fill(matrixStack, xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000); - fill(matrixStack, xpos, getY() + getHeight() * 3 / 5, xpos + 2, getY() + getHeight() * 4 / 5, 0xFFFFFF00); - fill(matrixStack, xpos, getY() + getHeight() * 2 / 5, xpos + 2, getY() + getHeight() * 3 / 5, 0xFF00FF00); + fill(poseStack, xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000); + fill(poseStack, xpos, getY() + getHeight() * 3 / 5, xpos + 2, getY() + getHeight() * 4 / 5, 0xFFFFFF00); + fill(poseStack, xpos, getY() + getHeight() * 2 / 5, xpos + 2, getY() + getHeight() * 3 / 5, 0xFF00FF00); int healthHeight = ((health - 50) * getHeight() / 50); - fill(matrixStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFF00FFFF); + fill(poseStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFF00FFFF); } else if (health > 20) { - fill(matrixStack, xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000); - fill(matrixStack, xpos, getY() + getHeight() * 3 / 5, xpos + 2, getY() + getHeight() * 4 / 5, 0xFFFFFF00); + fill(poseStack, xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000); + fill(poseStack, xpos, getY() + getHeight() * 3 / 5, xpos + 2, getY() + getHeight() * 4 / 5, 0xFFFFFF00); int healthHeight = ((health - 20) * getHeight() / 30); - fill(matrixStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFF00FF00); + fill(poseStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFF00FF00); } else if (health > 10) { - fill(matrixStack, xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000); + fill(poseStack, xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000); int healthHeight = ((health - 10) * getHeight() / 10); - fill(matrixStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFFFFFF00); + fill(poseStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFFFFFF00); } else { int healthHeight = (health * getHeight() / 10); - fill(matrixStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFFFF0000); + fill(poseStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFFFF0000); } } } diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/ItemSelectionButton.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/ItemSelectionButton.java index 56f1e2a..1e3bd62 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/ItemSelectionButton.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/ItemSelectionButton.java @@ -1,14 +1,14 @@ package com.burnedkirby.TurnBasedMinecraft.client; -import com.mojang.blaze3d.matrix.MatrixStack; -import net.minecraft.client.gui.widget.button.Button; -import net.minecraft.util.text.StringTextComponent; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.components.Button; +import net.minecraft.network.chat.TextComponent; public class ItemSelectionButton extends Button { private int itemStackID; - public ItemSelectionButton(int x, int y, int widthIn, int heightIn, String buttonText, int itemStackID, Button.IPressable onPress) { - super(x, y, widthIn, heightIn, new StringTextComponent(buttonText), onPress); + public ItemSelectionButton(int x, int y, int widthIn, int heightIn, String buttonText, int itemStackID, Button.OnPress onPress) { + super(x, y, widthIn, heightIn, new TextComponent(buttonText), onPress); this.itemStackID = itemStackID; } @@ -17,13 +17,13 @@ public class ItemSelectionButton extends Button { } @Override - public void renderButton(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { + public void renderButton(PoseStack poseStack, 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); + fill(poseStack, getX(), getY(), getX() + getWidth(), getY() + getHeight(), 0x80FFFFFF); } else { - fill(matrixStack, getX(), getY(), getX() + getWidth(), getY() + getHeight(), 0x20707070); + fill(poseStack, getX(), getY(), getX() + getWidth(), getY() + getHeight(), 0x20707070); } } } diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/AttackEventHandler.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/AttackEventHandler.java index 79de50b..59de6e0 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/AttackEventHandler.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/AttackEventHandler.java @@ -6,12 +6,12 @@ import com.burnedkirby.TurnBasedMinecraft.common.networking.PacketBattleMessage; import com.burnedkirby.TurnBasedMinecraft.common.networking.PacketEditingMessage; import com.burnedkirby.TurnBasedMinecraft.common.networking.PacketGeneralMessage; -import net.minecraft.entity.monster.CreeperEntity; -import net.minecraft.entity.player.ServerPlayerEntity; +import net.minecraft.world.entity.monster.Creeper; +import net.minecraft.server.level.ServerPlayer; import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.network.PacketDistributor; +import net.minecraftforge.network.PacketDistributor; public class AttackEventHandler { @@ -81,7 +81,7 @@ public class AttackEventHandler if(!event.getEntity().hasCustomName()) { TurnBasedMinecraftMod.logger.error("Cannot edit custom name from entity without custom name"); - TurnBasedMinecraftMod.getHandler().send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity)editingInfo.editor), new PacketGeneralMessage("Cannot edit custom name from entity without custom name")); + TurnBasedMinecraftMod.getHandler().send(PacketDistributor.PLAYER.with(() -> (ServerPlayer)editingInfo.editor), new PacketGeneralMessage("Cannot edit custom name from entity without custom name")); return; } editingInfo.entityInfo = config.getCustomEntityInfo(event.getEntity().getCustomName().getString()); @@ -90,9 +90,9 @@ public class AttackEventHandler 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().getString() + "\"")); + TurnBasedMinecraftMod.getHandler().send(PacketDistributor.PLAYER.with(() -> (ServerPlayer)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)); + TurnBasedMinecraftMod.getHandler().send(PacketDistributor.PLAYER.with(() -> (ServerPlayer)editingInfo.editor), new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo)); } else { @@ -106,9 +106,9 @@ public class AttackEventHandler { editingInfo.entityInfo = editingInfo.entityInfo.clone(); } - TurnBasedMinecraftMod.getHandler().send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity)editingInfo.editor), new PacketGeneralMessage("Editing entity \"" + editingInfo.entityInfo.classType.getName() + "\"")); + TurnBasedMinecraftMod.getHandler().send(PacketDistributor.PLAYER.with(() -> (ServerPlayer)editingInfo.editor), new PacketGeneralMessage("Editing entity \"" + editingInfo.entityInfo.classType.getName() + "\"")); TurnBasedMinecraftMod.logger.info("Begin editing \"" + editingInfo.entityInfo.classType.getName() + "\""); - TurnBasedMinecraftMod.getHandler().send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity)editingInfo.editor), new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo)); + TurnBasedMinecraftMod.getHandler().send(PacketDistributor.PLAYER.with(() -> (ServerPlayer)editingInfo.editor), new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo)); } return; } @@ -116,7 +116,7 @@ public class AttackEventHandler } if(event.getEntity() != null && event.getSource().getEntity() != null && (battleManager.isRecentlyLeftBattle(event.getEntity().getId()) || battleManager.isRecentlyLeftBattle(event.getSource().getEntity().getId()))) { - if(event.getSource().getEntity().getEntity() instanceof CreeperEntity && TurnBasedMinecraftMod.proxy.getConfig().getCreeperAlwaysAllowDamage()) { + if(event.getSource().getEntity() instanceof Creeper && TurnBasedMinecraftMod.proxy.getConfig().getCreeperAlwaysAllowDamage()) { event.setCanceled(false); } else { // TurnBasedMinecraftMod.logger.debug("Canceled attack"); diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/AttackerViaBow.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/AttackerViaBow.java index 1b545e2..b7d279f 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/AttackerViaBow.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/AttackerViaBow.java @@ -1,6 +1,6 @@ package com.burnedkirby.TurnBasedMinecraft.common; -import net.minecraft.entity.Entity; +import net.minecraft.world.entity.Entity; public class AttackerViaBow { diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Battle.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Battle.java index 1bacc90..6caeb69 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Battle.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Battle.java @@ -1,24 +1,23 @@ package com.burnedkirby.TurnBasedMinecraft.common; +import com.burnedkirby.TurnBasedMinecraft.common.networking.PacketBattleInfo; +import com.burnedkirby.TurnBasedMinecraft.common.networking.PacketBattleMessage; +import net.minecraft.resources.ResourceKey; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.monster.Creeper; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.*; +import net.minecraft.world.level.Level; +import net.minecraftforge.network.PacketDistributor; + import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; -import com.burnedkirby.TurnBasedMinecraft.common.networking.PacketBattleInfo; -import com.burnedkirby.TurnBasedMinecraft.common.networking.PacketBattleMessage; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.MobEntity; -import net.minecraft.entity.monster.CreeperEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.item.*; -import net.minecraft.util.DamageSource; -import net.minecraft.util.RegistryKey; -import net.minecraft.world.World; -import net.minecraftforge.fml.network.PacketDistributor; - public class Battle { private final int id; @@ -44,7 +43,7 @@ public class Battle public String debugLog; // TODO remove after freeze bug has been found - private RegistryKey dimension; + private ResourceKey dimension; public enum State { @@ -117,7 +116,7 @@ public class Battle } } - public Battle(BattleManager battleManager, int id, Collection sideA, Collection sideB, boolean isServer, RegistryKey dimension) + public Battle(BattleManager battleManager, int id, Collection sideA, Collection sideB, boolean isServer, ResourceKey dimension) { this.battleManager = battleManager; this.isServer = isServer; @@ -147,7 +146,7 @@ public class Battle entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getMatchingEntityInfo(e); } - if(entityInfo == null && !(e instanceof PlayerEntity) && TurnBasedMinecraftMod.proxy.isServerRunning()) + if(entityInfo == null && !(e instanceof Player) && TurnBasedMinecraftMod.proxy.isServerRunning()) { continue; } @@ -155,7 +154,7 @@ public class Battle newCombatant.isSideA = true; newCombatant.battleID = getId(); this.sideA.put(e.getId(), newCombatant); - if(e instanceof PlayerEntity) + if(e instanceof Player) { newCombatant.recalcSpeedOnCompare = true; playerCount.incrementAndGet(); @@ -165,8 +164,8 @@ public class Battle { newCombatant.x = e.getX(); newCombatant.z = e.getZ(); - newCombatant.yaw = e.xRot; - newCombatant.pitch = e.yRot; + newCombatant.yaw = e.getXRot(); + newCombatant.pitch = e.getYRot(); } } } @@ -185,7 +184,7 @@ public class Battle entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getMatchingEntityInfo(e); } - if(entityInfo == null && !(e instanceof PlayerEntity) && TurnBasedMinecraftMod.proxy.isServerRunning()) + if(entityInfo == null && !(e instanceof Player) && TurnBasedMinecraftMod.proxy.isServerRunning()) { continue; } @@ -193,7 +192,7 @@ public class Battle newCombatant.isSideA = false; newCombatant.battleID = getId(); this.sideB.put(e.getId(), newCombatant); - if(e instanceof PlayerEntity) + if(e instanceof Player) { newCombatant.recalcSpeedOnCompare = true; playerCount.incrementAndGet(); @@ -203,8 +202,8 @@ public class Battle { newCombatant.x = e.getX(); newCombatant.z = e.getZ(); - newCombatant.yaw = e.xRot; - newCombatant.pitch = e.yRot; + newCombatant.yaw = e.getXRot(); + newCombatant.pitch = e.getYRot(); } } } @@ -217,7 +216,7 @@ public class Battle { sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, c.entity.getId(), 0, id, c.entityInfo.category); } - else if(c.entity instanceof PlayerEntity) + else if(c.entity instanceof Player) { sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, c.entity.getId(), 0, id, "player"); } @@ -232,7 +231,7 @@ public class Battle { sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, c.entity.getId(), 0, id, c.entityInfo.category); } - else if(c.entity instanceof PlayerEntity) + else if(c.entity instanceof Player) { sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, c.entity.getId(), 0, id, "player"); } @@ -316,7 +315,7 @@ public class Battle entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getMatchingEntityInfo(e); } - if(entityInfo == null && !(e instanceof PlayerEntity) && TurnBasedMinecraftMod.proxy.isServerRunning()) + if(entityInfo == null && !(e instanceof Player) && TurnBasedMinecraftMod.proxy.isServerRunning()) { return; } @@ -331,7 +330,7 @@ public class Battle { sideA.put(e.getId(), newCombatant); } - if(e instanceof PlayerEntity) + if(e instanceof Player) { newCombatant.recalcSpeedOnCompare = true; playerCount.incrementAndGet(); @@ -345,8 +344,8 @@ public class Battle { newCombatant.x = e.getX(); newCombatant.z = e.getZ(); - newCombatant.yaw = e.xRot; - newCombatant.pitch = e.yRot; + newCombatant.yaw = e.getXRot(); + newCombatant.pitch = e.getYRot(); } if(isServer) { @@ -354,7 +353,7 @@ public class Battle { sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, newCombatant.entity.getId(), 0, id, newCombatant.entityInfo.category); } - else if(newCombatant.entity instanceof PlayerEntity) + else if(newCombatant.entity instanceof Player) { sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, newCombatant.entity.getId(), 0, id, "player"); } @@ -379,7 +378,7 @@ public class Battle entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getMatchingEntityInfo(e); } - if(entityInfo == null && !(e instanceof PlayerEntity) && TurnBasedMinecraftMod.proxy.isServerRunning()) + if(entityInfo == null && !(e instanceof Player) && TurnBasedMinecraftMod.proxy.isServerRunning()) { return; } @@ -394,7 +393,7 @@ public class Battle { sideB.put(e.getId(), newCombatant); } - if(e instanceof PlayerEntity) + if(e instanceof Player) { newCombatant.recalcSpeedOnCompare = true; playerCount.incrementAndGet(); @@ -408,8 +407,8 @@ public class Battle { newCombatant.x = e.getX(); newCombatant.z = e.getZ(); - newCombatant.yaw = e.xRot; - newCombatant.pitch = e.yRot; + newCombatant.yaw = e.getXRot(); + newCombatant.pitch = e.getYRot(); } if(isServer) { @@ -417,7 +416,7 @@ public class Battle { sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, newCombatant.entity.getId(), 0, id, newCombatant.entityInfo.category); } - else if(newCombatant.entity instanceof PlayerEntity) + else if(newCombatant.entity instanceof Player) { sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, newCombatant.entity.getId(), 0, id, "player"); } @@ -545,7 +544,7 @@ public class Battle PacketBattleInfo infoPacket = new PacketBattleInfo(getSideAIDs(), getSideBIDs(), timer); for(Combatant p : players.values()) { - TurnBasedMinecraftMod.getHandler().send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity)p.entity), infoPacket); + TurnBasedMinecraftMod.getHandler().send(PacketDistributor.PLAYER.with(() -> (ServerPlayer)p.entity), infoPacket); } } @@ -565,7 +564,7 @@ public class Battle { if(p.entity.isAlive()) { - TurnBasedMinecraftMod.getHandler().send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) p.entity), packet); + TurnBasedMinecraftMod.getHandler().send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) p.entity), packet); } } } @@ -590,7 +589,7 @@ public class Battle { category = entry.getValue().entityInfo.category; } - else if(entry.getValue().entity instanceof PlayerEntity) + else if(entry.getValue().entity instanceof Player) { category = "player"; } @@ -611,7 +610,7 @@ public class Battle { category = entry.getValue().entityInfo.category; } - else if(entry.getValue().entity instanceof PlayerEntity) + else if(entry.getValue().entity instanceof Player) { category = "player"; } @@ -639,7 +638,7 @@ public class Battle for(Iterator> iter = players.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = iter.next(); - if(entry.getValue().entity != null && ((PlayerEntity)entry.getValue().entity).isCreative()) + if(entry.getValue().entity != null && ((Player)entry.getValue().entity).isCreative()) { sendMessageToAllPlayers(PacketBattleMessage.MessageType.BECAME_CREATIVE, entry.getValue().entity.getId(), 0, 0); iter.remove(); @@ -702,9 +701,9 @@ public class Battle private void removeCombatantPostRemove(Combatant c) { - if(c.entity instanceof PlayerEntity) + if(c.entity instanceof Player) { - TurnBasedMinecraftMod.getHandler().send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) c.entity), new PacketBattleMessage(PacketBattleMessage.MessageType.ENDED, 0, 0, dimension, 0)); + TurnBasedMinecraftMod.getHandler().send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) c.entity), new PacketBattleMessage(PacketBattleMessage.MessageType.ENDED, 0, 0, dimension, 0)); } battleManager.addRecentlyLeftBattle(c); } @@ -831,9 +830,9 @@ public class Battle for(Combatant c : sideA.values()) { // picking decision for sideA non-players - if(!(c.entity instanceof PlayerEntity) && c.decision == Decision.UNDECIDED && c.entityInfo != null) + if(!(c.entity instanceof Player) && c.decision == Decision.UNDECIDED && c.entityInfo != null) { - if(c.entity instanceof CreeperEntity) { + if(c.entity instanceof Creeper) { if(c.creeperTurns++ < TurnBasedMinecraftMod.proxy.getConfig().getCreeperExplodeTurn()) { c.decision = Decision.CREEPER_WAIT; } else { @@ -858,9 +857,9 @@ public class Battle } for(Combatant c : sideB.values()) { - if(!(c.entity instanceof PlayerEntity) && c.decision == Decision.UNDECIDED && c.entityInfo != null) + if(!(c.entity instanceof Player) && c.decision == Decision.UNDECIDED && c.entityInfo != null) { - if(c.entity instanceof CreeperEntity) { + if(c.entity instanceof Creeper) { if(c.creeperTurns++ < TurnBasedMinecraftMod.proxy.getConfig().getCreeperExplodeTurn()) { c.decision = Decision.CREEPER_WAIT; } else { @@ -934,7 +933,7 @@ public class Battle case ATTACK: debugLog += " attack"; Combatant target = null; - if(next.entity instanceof PlayerEntity) + if(next.entity instanceof Player) { debugLog += " as player"; target = sideA.get(next.targetEntityID); @@ -946,11 +945,11 @@ public class Battle { continue; } - ItemStack heldItemStack = ((PlayerEntity)next.entity).getMainHandItem(); + ItemStack heldItemStack = ((Player)next.entity).getMainHandItem(); if(heldItemStack.getItem() instanceof BowItem) { debugLog += " with bow"; - if(Utility.doesPlayerHaveArrows((PlayerEntity)next.entity)) + if(Utility.doesPlayerHaveArrows((Player)next.entity)) { final Entity nextEntity = next.entity; final Entity targetEntity = target.entity; @@ -963,10 +962,10 @@ public class Battle next.pitch = pitchDirection; } // have player look at attack target - ((ServerPlayerEntity)nextEntity).connection.teleport(nextEntity.getX(), nextEntity.getY(), nextEntity.getZ(), yawDirection, pitchDirection); + ((ServerPlayer)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.releaseUsing(((PlayerEntity)nextEntity).getMainHandItem(), nextEntity.level, (LivingEntity) nextEntity, randomTimeLeft); + itemBow.releaseUsing(((Player)nextEntity).getMainHandItem(), nextEntity.level, (LivingEntity) nextEntity, randomTimeLeft); sendMessageToAllPlayers(PacketBattleMessage.MessageType.FIRED_ARROW, nextEntity.getId(), targetEntity.getId(), 0); } else @@ -977,7 +976,7 @@ public class Battle } debugLog += " without bow"; int hitChance = TurnBasedMinecraftMod.proxy.getConfig().getPlayerAttackProbability(); - if(target.entity instanceof PlayerEntity) + if(target.entity instanceof Player) { hitChance = hitChance * (100 - TurnBasedMinecraftMod.proxy.getConfig().getPlayerEvasion()) / 100; } @@ -1001,7 +1000,7 @@ public class Battle 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) + if(!(targetEntity instanceof Player) && targetEntityInfo.defenseDamage > 0 && targetEntityInfo.defenseDamageProbability > 0) { if(random.nextInt(100) < targetEntityInfo.defenseDamageProbability) { @@ -1022,10 +1021,10 @@ public class Battle next.pitch = pitchDirection; } // have player look at attack target - ((ServerPlayerEntity)nextEntity).connection.teleport(nextEntity.getX(), nextEntity.getY(), nextEntity.getZ(), yawDirection, pitchDirection); + ((ServerPlayer)nextEntity).connection.teleport(nextEntity.getX(), nextEntity.getY(), nextEntity.getZ(), yawDirection, pitchDirection); TurnBasedMinecraftMod.proxy.setAttackingEntity(nextEntity); TurnBasedMinecraftMod.proxy.setAttackingDamage(0); - ((PlayerEntity)nextEntity).attack(targetEntity); + ((Player)nextEntity).attack(targetEntity); TurnBasedMinecraftMod.proxy.setAttackingEntity(null); sendMessageToAllPlayers(PacketBattleMessage.MessageType.ATTACK, nextEntity.getId(), targetEntity.getId(), TurnBasedMinecraftMod.proxy.getAttackingDamage()); if(defenseDamageTriggered) @@ -1056,7 +1055,7 @@ public class Battle else { debugLog += " as mob"; - LivingEntity attackTarget = ((MobEntity)next.entity).getTarget(); + LivingEntity attackTarget = ((Mob)next.entity).getTarget(); if(attackTarget != null && hasCombatant(attackTarget.getId())) { debugLog += " to targeted"; @@ -1101,7 +1100,7 @@ public class Battle continue; } int hitChance = next.entityInfo.attackProbability; - if(target.entity instanceof PlayerEntity) + if(target.entity instanceof Player) { hitChance = hitChance * (100 - TurnBasedMinecraftMod.proxy.getConfig().getPlayerEvasion()) / 100; } @@ -1137,7 +1136,7 @@ public class Battle final boolean defenseDamageTriggered; final boolean attackEffectTriggered; - if(!(targetEntity instanceof PlayerEntity) && targetEntityInfo.defenseDamage > 0 && targetEntityInfo.defenseDamageProbability > 0) + if(!(targetEntity instanceof Player) && targetEntityInfo.defenseDamage > 0 && targetEntityInfo.defenseDamageProbability > 0) { if(random.nextInt(100) < targetEntityInfo.defenseDamageProbability) { @@ -1217,7 +1216,7 @@ public class Battle { for(Combatant c : sideB.values()) { - if(c.entity instanceof PlayerEntity) + if(c.entity instanceof Player) { if(TurnBasedMinecraftMod.proxy.getConfig().getPlayerSpeed() > fastestEnemySpeed) { @@ -1237,7 +1236,7 @@ public class Battle { for(Combatant c : sideA.values()) { - if(c.entity instanceof PlayerEntity) + if(c.entity instanceof Player) { if(TurnBasedMinecraftMod.proxy.getConfig().getPlayerSpeed() > fastestEnemySpeed) { @@ -1254,7 +1253,7 @@ public class Battle } } int fleeProbability = 0; - if(next.entity instanceof PlayerEntity) + if(next.entity instanceof Player) { if(fastestEnemySpeed >= TurnBasedMinecraftMod.proxy.getConfig().getPlayerSpeed()) { @@ -1286,7 +1285,7 @@ public class Battle { fleeingCategory = next.entityInfo.category; } - else if(next.entity instanceof PlayerEntity) + else if(next.entity instanceof Player) { fleeingCategory = "player"; } @@ -1308,43 +1307,33 @@ public class Battle sendMessageToAllPlayers(PacketBattleMessage.MessageType.USED_ITEM, next.entity.getId(), 0, PacketBattleMessage.UsedItemAction.USED_INVALID.getValue()); break; } - ItemStack targetItemStack = ((PlayerEntity)next.entity).inventory.getItem(next.itemToUse); + ItemStack targetItemStack = ((Player) next.entity).getInventory().getItem(next.itemToUse); Item targetItem = targetItemStack.getItem(); if(targetItem == null) { debugLog += " null"; sendMessageToAllPlayers(PacketBattleMessage.MessageType.USED_ITEM, next.entity.getId(), 0, PacketBattleMessage.UsedItemAction.USED_NOTHING.getValue()); break; - } - // check if use item is a food - boolean isFood = false; - // first check other mod foods - for(ItemGroup itemGroup : BattleManager.getOtherFoodItemGroups()) { - if(targetItem.getItemCategory() == itemGroup && targetItem.isEdible()) { - isFood = true; - break; - } - } - if(isFood) { + } else if(targetItem.isEdible()) { debugLog += " food"; 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.setItem(nextItemToUse, targetItem.finishUsingItem(targetItemStack, nextEntity.level, (LivingEntity)nextEntity)); + ((Player) nextEntity).getInventory().setItem(nextItemToUse, targetItem.finishUsingItem(targetItemStack, nextEntity.level, (LivingEntity)nextEntity)); } else { // then check vanilla foods - if (targetItem.getItemCategory() == ItemGroup.TAB_FOOD && targetItem.isEdible()) { + if (targetItem.getItemCategory() == CreativeModeTab.TAB_FOOD && targetItem.isEdible()) { debugLog += " food"; 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.setItem(nextItemToUse, targetItem.finishUsingItem(targetItemStack, nextEntity.level, (LivingEntity) nextEntity)); + ((Player) nextEntity).getInventory().setItem(nextItemToUse, targetItem.finishUsingItem(targetItemStack, nextEntity.level, (LivingEntity) nextEntity)); } else if (targetItem instanceof PotionItem) { debugLog += " potion"; 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.setItem(nextItemToUse, targetItem.finishUsingItem(targetItemStack, nextEntity.level, (LivingEntity) nextEntity)); + ((Player) nextEntity).getInventory().setItem(nextItemToUse, targetItem.finishUsingItem(targetItemStack, nextEntity.level, (LivingEntity) nextEntity)); } else { debugLog += " non-consumable"; sendMessageToAllPlayers(PacketBattleMessage.MessageType.USED_ITEM, next.entity.getId(), 0, PacketBattleMessage.UsedItemAction.USED_INVALID.getValue(), targetItemStack.getDisplayName().getString()); @@ -1359,7 +1348,7 @@ public class Battle } final Entity nextEntity = next.entity; final int nextItemToUse = next.itemToUse; - ((PlayerEntity) nextEntity).inventory.selected = nextItemToUse; + ((Player) nextEntity).getInventory().selected = nextItemToUse; sendMessageToAllPlayers(PacketBattleMessage.MessageType.SWITCHED_ITEM, next.entity.getId(), 0, 1); } break; @@ -1379,7 +1368,7 @@ public class Battle for (Combatant c : sideA.values()) { if (c.entity.getId() != next.entity.getId()) { int hitChance = next.entityInfo.attackProbability; - if (c.entity instanceof PlayerEntity) { + if (c.entity instanceof Player) { hitChance = hitChance * (100 - TurnBasedMinecraftMod.proxy.getConfig().getPlayerEvasion()) / 100; } else { hitChance = hitChance * (100 - c.entityInfo.evasion) / 100; @@ -1423,7 +1412,7 @@ public class Battle for(Combatant c : sideB.values()) { if (c.entity.getId() != next.entity.getId()) { int hitChance = next.entityInfo.attackProbability; - if (c.entity instanceof PlayerEntity) { + if (c.entity instanceof Player) { hitChance = hitChance * (100 - TurnBasedMinecraftMod.proxy.getConfig().getPlayerEvasion()) / 100; } else { hitChance = hitChance * (100 - c.entityInfo.evasion) / 100; @@ -1464,7 +1453,7 @@ public class Battle } } } - ((CreeperEntity)nextEntity).setSwellDir(1000000); + ((Creeper)nextEntity).setSwellDir(1000000); } break; } @@ -1509,20 +1498,20 @@ public class Battle private void defuseCreepers() { for(Combatant c : sideA.values()) { - if(c.entity instanceof CreeperEntity) { + if(c.entity instanceof Creeper) { if(c.creeperTurns <= TurnBasedMinecraftMod.proxy.getConfig().getCreeperExplodeTurn()) { - ((CreeperEntity)c.entity).setSwellDir(-10); + ((Creeper)c.entity).setSwellDir(-10); } else { - ((CreeperEntity)c.entity).setSwellDir(1000000); + ((Creeper)c.entity).setSwellDir(1000000); } } } for(Combatant c : sideB.values()) { - if(c.entity instanceof CreeperEntity) { + if(c.entity instanceof Creeper) { if(c.creeperTurns <= TurnBasedMinecraftMod.proxy.getConfig().getCreeperExplodeTurn()) { - ((CreeperEntity)c.entity).setSwellDir(-10); + ((Creeper)c.entity).setSwellDir(-10); } else { - ((CreeperEntity) c.entity).setSwellDir(1000000); + ((Creeper) c.entity).setSwellDir(1000000); } } } diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/BattleManager.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/BattleManager.java index d76a430..01d8668 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/BattleManager.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/BattleManager.java @@ -1,26 +1,19 @@ package com.burnedkirby.TurnBasedMinecraft.common; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import net.minecraft.entity.monster.CreeperEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.item.ItemGroup; -import net.minecraft.util.RegistryKey; -import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.network.PacketDistributor; -import org.apache.logging.log4j.Logger; - import com.burnedkirby.TurnBasedMinecraft.common.networking.PacketGeneralMessage; - -import net.minecraft.entity.Entity; +import net.minecraft.resources.ResourceKey; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.monster.Creeper; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent; +import net.minecraftforge.network.PacketDistributor; +import org.apache.logging.log4j.Logger; + +import java.util.*; public class BattleManager { @@ -30,8 +23,7 @@ public class BattleManager private Map recentlyLeftBattle; private BattleUpdater battleUpdater; private Map entityToBattleMap; - private static Collection otherFoodItemGroups = new ArrayList<>(); - + public BattleManager(Logger logger) { this.logger = logger; @@ -75,9 +67,9 @@ 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()) + if(!((event.getEntity() instanceof Player && !((Player)event.getEntity()).isCreative()) || (config.getEntityInfoReference(receiverClassName) != null || config.getCustomEntityInfoReference(receiverCustomName) != null)) - || !((event.getSource().getEntity() instanceof PlayerEntity && !((PlayerEntity)event.getSource().getEntity()).isCreative()) + || !((event.getSource().getEntity() instanceof Player && !((Player)event.getSource().getEntity()).isCreative()) || (config.getEntityInfoReference(attackerClassName) != null || config.getCustomEntityInfoReference(attackerCustomName) != null))) { // logger.debug("BattleManager: Failed first check, attacker is \"" + attackerClassName + "\", defender is \"" + receiverClassName + "\""); @@ -138,7 +130,7 @@ public class BattleManager return true; } else if(attackerBattle == null && defenderBattle == null) { // neither entity is in battle - if(event.getEntity() instanceof PlayerEntity || event.getSource().getEntity() instanceof PlayerEntity) + if(event.getEntity() instanceof Player || event.getSource().getEntity() instanceof Player) { // at least one of the entities is a player, create Battle Collection sideA = new ArrayList(1); @@ -204,7 +196,7 @@ public class BattleManager } EntityInfo targetedInfo; - if(event.getTarget() instanceof PlayerEntity) + if(event.getTarget() instanceof Player) { targetedInfo = null; } @@ -216,7 +208,7 @@ public class BattleManager targetedInfo = TurnBasedMinecraftMod.proxy.getConfig().getMatchingEntityInfo(event.getTarget()); } } - if((event.getTarget() instanceof PlayerEntity && ((PlayerEntity)event.getTarget()).isCreative()) + if((event.getTarget() instanceof Player && ((Player)event.getTarget()).isCreative()) || attackerInfo == null || attackerInfo.ignoreBattle || TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType(attackerInfo.category) @@ -241,7 +233,7 @@ public class BattleManager return; } else if(attackerBattle == null && defenderBattle == null) { // neither in battle - if(event.getEntity() instanceof PlayerEntity || event.getTarget() instanceof PlayerEntity) + if(event.getEntity() instanceof Player || event.getTarget() instanceof Player) { // at least one is a player, create battle Collection sideA = new ArrayList(1); @@ -277,7 +269,7 @@ public class BattleManager } } - private Battle createBattle(Collection sideA, Collection sideB, RegistryKey dimension) + private Battle createBattle(Collection sideA, Collection sideB, ResourceKey dimension) { Battle newBattle = null; while(battleMap.containsKey(IDCounter)) @@ -313,8 +305,8 @@ public class BattleManager { c.time = System.nanoTime(); Config config = TurnBasedMinecraftMod.proxy.getConfig(); - 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!")); + if(c.entity instanceof ServerPlayer) { + TurnBasedMinecraftMod.getHandler().send(PacketDistributor.PLAYER.with(()->(ServerPlayer) c.entity), new PacketGeneralMessage("You just left battle! " + config.getLeaveBattleCooldownSeconds() + " seconds until you can attack/be-attacked again!")); } recentlyLeftBattle.put(c.entity.getId(), c); entityToBattleMap.remove(new EntityIDDimPair(c.entity)); @@ -326,15 +318,15 @@ public class BattleManager for(Iterator> iter = recentlyLeftBattle.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = iter.next(); - if(entry.getValue().entity instanceof CreeperEntity && TurnBasedMinecraftMod.proxy.getConfig().getCreeperStopExplodeOnLeaveBattle()) { - ((CreeperEntity)entry.getValue().entity).setSwellDir(-10); + if(entry.getValue().entity instanceof Creeper && TurnBasedMinecraftMod.proxy.getConfig().getCreeperStopExplodeOnLeaveBattle()) { + ((Creeper)entry.getValue().entity).setSwellDir(-10); } if(current - entry.getValue().time > TurnBasedMinecraftMod.proxy.getConfig().getLeaveBattleCooldownNanos()) { iter.remove(); - if(entry.getValue().entity instanceof ServerPlayerEntity) + if(entry.getValue().entity instanceof ServerPlayer) { - TurnBasedMinecraftMod.getHandler().send(PacketDistributor.PLAYER.with(()->(ServerPlayerEntity)entry.getValue().entity), new PacketGeneralMessage("Timer ended, you can now attack/be-attacked again.")); + TurnBasedMinecraftMod.getHandler().send(PacketDistributor.PLAYER.with(()->(ServerPlayer)entry.getValue().entity), new PacketGeneralMessage("Timer ended, you can now attack/be-attacked again.")); } } } @@ -358,12 +350,4 @@ public class BattleManager } return result; } - - public static void addOtherModItemGroup(ItemGroup itemGroup) { - otherFoodItemGroups.add(itemGroup); - } - - public static Collection getOtherFoodItemGroups() { - return otherFoodItemGroups; - } } \ No newline at end of file diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Combatant.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Combatant.java index 0141ea5..28bc88f 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Combatant.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Combatant.java @@ -2,11 +2,11 @@ package com.burnedkirby.TurnBasedMinecraft.common; import java.util.Comparator; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.potion.EffectInstance; -import net.minecraft.potion.Effects; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; public class Combatant { @@ -53,18 +53,18 @@ public class Combatant @Override public int compare(Combatant c0, Combatant c1) { - if(c0.entity instanceof PlayerEntity && c0.recalcSpeedOnCompare) + if(c0.entity instanceof Player && c0.recalcSpeedOnCompare) { LivingEntity c0Entity = (LivingEntity)c0.entity; boolean isHaste = false; boolean isSlow = false; - for(EffectInstance e : c0Entity.getActiveEffects()) + for(MobEffectInstance e : c0Entity.getActiveEffects()) { - if(e.getEffect().equals(Effects.MOVEMENT_SPEED) || e.getEffect().equals(Effects.DIG_SPEED)) + if(e.getEffect().equals(MobEffects.MOVEMENT_SPEED) || e.getEffect().equals(MobEffects.DIG_SPEED)) { isHaste = true; } - else if(e.getEffect().equals(Effects.MOVEMENT_SLOWDOWN) || e.getEffect().equals(Effects.DIG_SLOWDOWN)) + else if(e.getEffect().equals(MobEffects.MOVEMENT_SLOWDOWN) || e.getEffect().equals(MobEffects.DIG_SLOWDOWN)) { isSlow = true; } @@ -87,18 +87,18 @@ public class Combatant } } - if(c1.entity instanceof PlayerEntity && c1.recalcSpeedOnCompare) + if(c1.entity instanceof Player && c1.recalcSpeedOnCompare) { LivingEntity c1Entity = (LivingEntity)c1.entity; boolean isHaste = false; boolean isSlow = false; - for(EffectInstance e : c1Entity.getActiveEffects()) + for(MobEffectInstance e : c1Entity.getActiveEffects()) { - if(e.getEffect().equals(Effects.MOVEMENT_SPEED)) + if(e.getEffect().equals(MobEffects.MOVEMENT_SPEED)) { isHaste = true; } - else if(e.getEffect().equals(Effects.MOVEMENT_SLOWDOWN)) + else if(e.getEffect().equals(MobEffects.MOVEMENT_SLOWDOWN)) { isSlow = true; } diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/CommonProxy.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/CommonProxy.java index 3074f69..69e8ef4 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/CommonProxy.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/CommonProxy.java @@ -1,20 +1,19 @@ package com.burnedkirby.TurnBasedMinecraft.common; -import java.lang.reflect.Field; -import java.util.*; - -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemGroup; -import net.minecraft.util.RegistryKey; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.world.DimensionType; -import net.minecraft.world.World; -import net.minecraftforge.fml.ModContainer; -import net.minecraftforge.fml.ModList; -import net.minecraftforge.fml.server.ServerLifecycleHooks; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +import net.minecraftforge.network.NetworkEvent; +import net.minecraftforge.server.ServerLifecycleHooks; import org.apache.logging.log4j.Logger; -import net.minecraft.entity.Entity; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Map; +import java.util.Set; +import java.util.function.Supplier; public class CommonProxy { @@ -75,96 +74,11 @@ public class CommonProxy { config = new Config(logger); postInitClient(); - pamsFoodIntegrationLoading(); logger.debug("postInit proxy for com_burnedkirby_turnbasedminecraft"); } protected void postInitClient() {} - private final void pamsFoodIntegrationLoading() { - // TODO: generalize other mod's food loading via config with a list of mod ids - - // pamhc2foodcore - { - ModList modList = ModList.get(); - Optional pamsFoodCoreContainer = modList.getModContainerById("pamhc2foodcore"); - if (pamsFoodCoreContainer.isPresent()) { - Object pamsFoodCore = pamsFoodCoreContainer.get().getMod(); - try { - Field itemGroupField = pamsFoodCore.getClass().getField("ITEM_GROUP"); - ItemGroup foodItemGroup = (ItemGroup) itemGroupField.get(null); - if(foodItemGroup != null) { - BattleManager.addOtherModItemGroup(foodItemGroup); - } else { - throw new NullPointerException(); - } - } catch (Exception e) { - TurnBasedMinecraftMod.logger.info("Failed to get pamhc2foodcore ITEM_GROUP"); - } - } - } - - // pamhc2crops - { - ModList modList = ModList.get(); - Optional pamsFoodCoreContainer = modList.getModContainerById("pamhc2crops"); - if (pamsFoodCoreContainer.isPresent()) { - Object pamsFoodCore = pamsFoodCoreContainer.get().getMod(); - try { - Field itemGroupField = pamsFoodCore.getClass().getField("ITEM_GROUP"); - ItemGroup foodItemGroup = (ItemGroup) itemGroupField.get(null); - if(foodItemGroup != null) { - BattleManager.addOtherModItemGroup(foodItemGroup); - } else { - throw new NullPointerException(); - } - } catch (Exception e) { - TurnBasedMinecraftMod.logger.info("Failed to get pamhc2crops ITEM_GROUP"); - } - } - } - - // pamhc2trees - { - ModList modList = ModList.get(); - Optional pamsFoodCoreContainer = modList.getModContainerById("pamhc2trees"); - if (pamsFoodCoreContainer.isPresent()) { - Object pamsFoodCore = pamsFoodCoreContainer.get().getMod(); - try { - Field itemGroupField = pamsFoodCore.getClass().getField("ITEM_GROUP"); - ItemGroup foodItemGroup = (ItemGroup) itemGroupField.get(null); - if(foodItemGroup != null) { - BattleManager.addOtherModItemGroup(foodItemGroup); - } else { - throw new NullPointerException(); - } - } catch (Exception e) { - TurnBasedMinecraftMod.logger.info("Failed to get pamhc2trees ITEM_GROUP"); - } - } - } - - // pamhc2foodextended - { - ModList modList = ModList.get(); - Optional pamsFoodCoreContainer = modList.getModContainerById("pamhc2foodextended"); - if (pamsFoodCoreContainer.isPresent()) { - Object pamsFoodCore = pamsFoodCoreContainer.get().getMod(); - try { - Field itemGroupField = pamsFoodCore.getClass().getField("ITEM_GROUP"); - ItemGroup foodItemGroup = (ItemGroup) itemGroupField.get(null); - if(foodItemGroup != null) { - BattleManager.addOtherModItemGroup(foodItemGroup); - } else { - throw new NullPointerException(); - } - } catch (Exception e) { - TurnBasedMinecraftMod.logger.info("Failed to get pamhc2foodextended ITEM_GROUP"); - } - } - } - } - public final void setLogger(Logger logger) { this.logger = logger; @@ -182,7 +96,7 @@ public class CommonProxy public void displayString(String message) {} - public void displayTextComponent(ITextComponent textComponent) {} + public void displayTextComponent(TextComponent textComponent) {} public final boolean isServerRunning() { @@ -241,7 +155,7 @@ public class CommonProxy return editingPlayers.get(id); } - protected final EditingInfo setEditingPlayer(PlayerEntity player) + protected final EditingInfo setEditingPlayer(Player player) { return editingPlayers.put(player.getId(), new EditingInfo(player)); } @@ -251,7 +165,9 @@ public class CommonProxy return editingPlayers.remove(id); } - public Entity getEntity(int id, RegistryKey dim) { + public Entity getEntity(int id, ResourceKey dim) { return ServerLifecycleHooks.getCurrentServer().getLevel(dim).getEntity(id); } + + public void handlePacket(MSG msg, Supplier ctx) {} } diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/DimensionChangedHandler.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/DimensionChangedHandler.java index 2c21226..bcc3481 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/DimensionChangedHandler.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/DimensionChangedHandler.java @@ -1,10 +1,10 @@ package com.burnedkirby.TurnBasedMinecraft.common; import com.burnedkirby.TurnBasedMinecraft.common.networking.PacketGeneralMessage; -import net.minecraft.entity.player.ServerPlayerEntity; +import net.minecraft.server.level.ServerPlayer; import net.minecraftforge.event.entity.EntityTravelToDimensionEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.network.PacketDistributor; +import net.minecraftforge.network.PacketDistributor; public class DimensionChangedHandler { @SubscribeEvent @@ -13,9 +13,9 @@ public class DimensionChangedHandler { return; } if(TurnBasedMinecraftMod.proxy.getBattleManager().forceLeaveBattle(new EntityIDDimPair(event.getEntity())) - && event.getEntity() instanceof ServerPlayerEntity) { + && event.getEntity() instanceof ServerPlayer) { TurnBasedMinecraftMod.getHandler().send( - PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity)event.getEntity()), + PacketDistributor.PLAYER.with(() -> (ServerPlayer)event.getEntity()), new PacketGeneralMessage("Left battle due to moving to a different dimension")); } } diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/EditingInfo.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/EditingInfo.java index a81b9a6..d2d2609 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/EditingInfo.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/EditingInfo.java @@ -1,10 +1,10 @@ package com.burnedkirby.TurnBasedMinecraft.common; -import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.world.entity.player.Player; public class EditingInfo { - public PlayerEntity editor; + public Player editor; public EntityInfo entityInfo; public boolean isPendingEntitySelection; public boolean isEditingCustomName; @@ -17,7 +17,7 @@ public class EditingInfo isEditingCustomName = false; } - public EditingInfo(PlayerEntity player) + public EditingInfo(Player player) { editor = player; entityInfo = null; diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/EntityIDDimPair.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/EntityIDDimPair.java index f258746..81778a3 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/EntityIDDimPair.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/EntityIDDimPair.java @@ -1,13 +1,12 @@ package com.burnedkirby.TurnBasedMinecraft.common; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.Entity; -import net.minecraft.util.RegistryKey; -import net.minecraft.world.World; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.Level; public class EntityIDDimPair { public int id; - public RegistryKey dim; + public ResourceKey dim; EntityIDDimPair() { id = 0; @@ -15,7 +14,7 @@ public class EntityIDDimPair { dim = null; } - EntityIDDimPair(int id, RegistryKey dim) { + EntityIDDimPair(int id, ResourceKey dim) { this.id = id; this.dim = dim; } diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/EntityInfo.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/EntityInfo.java index 8415b5f..57bd414 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/EntityInfo.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/EntityInfo.java @@ -1,8 +1,8 @@ package com.burnedkirby.TurnBasedMinecraft.common; -import net.minecraft.entity.LivingEntity; -import net.minecraft.potion.EffectInstance; -import net.minecraft.potion.Effects; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.LivingEntity; public class EntityInfo { @@ -194,71 +194,71 @@ public class EntityInfo } } - public EffectInstance getPotionEffect() + public MobEffectInstance getPotionEffect() { return getPotionEffect(20 * 7, 0); } - public EffectInstance getPotionEffect(int duration, int amplifier) { + public MobEffectInstance getPotionEffect(int duration, int amplifier) { switch(this) { case SPEED: - return new EffectInstance(Effects.MOVEMENT_SPEED, duration, amplifier); + return new MobEffectInstance(MobEffects.MOVEMENT_SPEED, duration, amplifier); case SLOW: - return new EffectInstance(Effects.MOVEMENT_SLOWDOWN, duration, amplifier); + return new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, duration, amplifier); case HASTE: - return new EffectInstance(Effects.DIG_SPEED, duration, amplifier); + return new MobEffectInstance(MobEffects.DIG_SPEED, duration, amplifier); case MINING_FATIGUE: - return new EffectInstance(Effects.DIG_SLOWDOWN, duration, amplifier); + return new MobEffectInstance(MobEffects.DIG_SLOWDOWN, duration, amplifier); case STRENGTH: - return new EffectInstance(Effects.DAMAGE_BOOST, duration, amplifier); + return new MobEffectInstance(MobEffects.DAMAGE_BOOST, duration, amplifier); case JUMP_BOOST: - return new EffectInstance(Effects.JUMP, duration, amplifier); + return new MobEffectInstance(MobEffects.JUMP, duration, amplifier); case NAUSEA: - return new EffectInstance(Effects.CONFUSION, duration, amplifier); + return new MobEffectInstance(MobEffects.CONFUSION, duration, amplifier); case REGENERATION: - return new EffectInstance(Effects.REGENERATION, duration, amplifier); + return new MobEffectInstance(MobEffects.REGENERATION, duration, amplifier); case RESISTANCE: - return new EffectInstance(Effects.DAMAGE_RESISTANCE, duration, amplifier); + return new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, duration, amplifier); case FIRE_RESISTANCE: - return new EffectInstance(Effects.FIRE_RESISTANCE, duration, amplifier); + return new MobEffectInstance(MobEffects.FIRE_RESISTANCE, duration, amplifier); case WATER_BREATHING: - return new EffectInstance(Effects.WATER_BREATHING, duration, amplifier); + return new MobEffectInstance(MobEffects.WATER_BREATHING, duration, amplifier); case INVISIBILITY: - return new EffectInstance(Effects.INVISIBILITY, duration, amplifier); + return new MobEffectInstance(MobEffects.INVISIBILITY, duration, amplifier); case BLINDNESS: - return new EffectInstance(Effects.BLINDNESS, duration, amplifier); + return new MobEffectInstance(MobEffects.BLINDNESS, duration, amplifier); case NIGHT_VISION: - return new EffectInstance(Effects.NIGHT_VISION, duration, amplifier); + return new MobEffectInstance(MobEffects.NIGHT_VISION, duration, amplifier); case HUNGER: - return new EffectInstance(Effects.HUNGER, duration, amplifier); + return new MobEffectInstance(MobEffects.HUNGER, duration, amplifier); case WEAKNESS: - return new EffectInstance(Effects.WEAKNESS, duration, amplifier); + return new MobEffectInstance(MobEffects.WEAKNESS, duration, amplifier); case POISON: - return new EffectInstance(Effects.POISON, duration, amplifier); + return new MobEffectInstance(MobEffects.POISON, duration, amplifier); case WITHER: - return new EffectInstance(Effects.WITHER, duration, amplifier); + return new MobEffectInstance(MobEffects.WITHER, duration, amplifier); case HEALTH_BOOST: - return new EffectInstance(Effects.HEALTH_BOOST, duration, amplifier); + return new MobEffectInstance(MobEffects.HEALTH_BOOST, duration, amplifier); case ABSORPTION: - return new EffectInstance(Effects.ABSORPTION, duration, amplifier); + return new MobEffectInstance(MobEffects.ABSORPTION, duration, amplifier); case SATURATION: - return new EffectInstance(Effects.SATURATION, duration, amplifier); + return new MobEffectInstance(MobEffects.SATURATION, duration, amplifier); case GLOWING: - return new EffectInstance(Effects.GLOWING, duration, amplifier); + return new MobEffectInstance(MobEffects.GLOWING, duration, amplifier); case LEVITATION: - return new EffectInstance(Effects.LEVITATION, duration, amplifier); + return new MobEffectInstance(MobEffects.LEVITATION, duration, amplifier); case LUCK: - return new EffectInstance(Effects.LUCK, duration, amplifier); + return new MobEffectInstance(MobEffects.LUCK, duration, amplifier); case UNLUCK: - return new EffectInstance(Effects.UNLUCK, duration, amplifier); + return new MobEffectInstance(MobEffects.UNLUCK, duration, amplifier); case SLOW_FALLING: - return new EffectInstance(Effects.SLOW_FALLING, duration, amplifier); + return new MobEffectInstance(MobEffects.SLOW_FALLING, duration, amplifier); case CONDUIT_POWER: - return new EffectInstance(Effects.CONDUIT_POWER, duration, amplifier); + return new MobEffectInstance(MobEffects.CONDUIT_POWER, duration, amplifier); case DOLPHINS_GRACE: - return new EffectInstance(Effects.DOLPHINS_GRACE, duration, amplifier); + return new MobEffectInstance(MobEffects.DOLPHINS_GRACE, duration, amplifier); case BAD_OMEN: - return new EffectInstance(Effects.BAD_OMEN, duration, amplifier); + return new MobEffectInstance(MobEffects.BAD_OMEN, duration, amplifier); case FIRE: // FIRE is not a PotionEffect and must be applied directly to the Entity return null; diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/PlayerJoinEventHandler.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/PlayerJoinEventHandler.java index 775204f..b115629 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/PlayerJoinEventHandler.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/PlayerJoinEventHandler.java @@ -1,6 +1,6 @@ package com.burnedkirby.TurnBasedMinecraft.common; -import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.world.entity.player.Player; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -13,7 +13,7 @@ public class PlayerJoinEventHandler { return; } - if(event.getEntity() instanceof PlayerEntity && TurnBasedMinecraftMod.proxy.getConfig().getBattleDisabledForAll()) + if(event.getEntity() instanceof Player && TurnBasedMinecraftMod.proxy.getConfig().getBattleDisabledForAll()) { TurnBasedMinecraftMod.proxy.getConfig().addBattleIgnoringPlayer(event.getEntity().getId()); } diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/TurnBasedMinecraftMod.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/TurnBasedMinecraftMod.java index 2deee8f..4ca7222 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/TurnBasedMinecraftMod.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/TurnBasedMinecraftMod.java @@ -9,33 +9,33 @@ import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; -import net.minecraft.command.Commands; -import net.minecraft.command.arguments.EntityArgument; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.StringTextComponent; +import net.minecraft.commands.Commands; +import net.minecraft.commands.arguments.EntityArgument; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.RegisterCommandsEvent; +import net.minecraftforge.event.server.ServerStartingEvent; +import net.minecraftforge.event.server.ServerStoppingEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLDedicatedServerSetupEvent; -import net.minecraftforge.fml.event.server.FMLServerStartingEvent; -import net.minecraftforge.fml.event.server.FMLServerStoppingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.fml.network.NetworkRegistry; -import net.minecraftforge.fml.network.PacketDistributor; -import net.minecraftforge.fml.network.simple.SimpleChannel; +import net.minecraftforge.network.NetworkRegistry; +import net.minecraftforge.network.PacketDistributor; +import net.minecraftforge.network.simple.SimpleChannel; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @Mod(TurnBasedMinecraftMod.MODID) -public class TurnBasedMinecraftMod -{ +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.17.2"; + public static final String VERSION = "1.18.0"; 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/"; @@ -45,25 +45,25 @@ public class TurnBasedMinecraftMod public static final String MUSIC_ROOT = CONFIG_DIRECTORY + "Music/"; public static final String MUSIC_SILLY = MUSIC_ROOT + "silly/"; public static final String MUSIC_BATTLE = MUSIC_ROOT + "battle/"; - + private static final String PROTOCOL_VERSION = Integer.toString(1); private static final ResourceLocation HANDLER_ID = new ResourceLocation(MODID, "main_channel"); private static final SimpleChannel HANDLER = NetworkRegistry.ChannelBuilder - .named(HANDLER_ID) - .clientAcceptedVersions(PROTOCOL_VERSION::equals) - .serverAcceptedVersions(PROTOCOL_VERSION::equals) - .networkProtocolVersion(() -> PROTOCOL_VERSION) - .simpleChannel(); + .named(HANDLER_ID) + .clientAcceptedVersions(PROTOCOL_VERSION::equals) + .serverAcceptedVersions(PROTOCOL_VERSION::equals) + .networkProtocolVersion(() -> PROTOCOL_VERSION) + .simpleChannel(); protected static Logger logger = LogManager.getLogger(); - + public static ResourceLocation getNetResourceLocation() { - return HANDLER_ID; + return HANDLER_ID; } - + public static SimpleChannel getHandler() { - return HANDLER; + return HANDLER; } - + public static CommonProxy proxy; public TurnBasedMinecraftMod() { @@ -74,51 +74,50 @@ public class TurnBasedMinecraftMod MinecraftForge.EVENT_BUS.register(this); } - private void firstInit(final FMLCommonSetupEvent event) - { - proxy = DistExecutor.safeRunForDist(()-> ClientProxy::new, ()-> CommonProxy::new); + private void firstInit(final FMLCommonSetupEvent event) { + proxy = DistExecutor.safeRunForDist(() -> ClientProxy::new, () -> CommonProxy::new); proxy.setLogger(logger); proxy.initialize(); // register packets int packetHandlerID = 0; HANDLER.registerMessage( - packetHandlerID++, - PacketBattleInfo.class, - PacketBattleInfo::encode, - PacketBattleInfo::decode, - PacketBattleInfo.Handler::handle); + packetHandlerID++, + PacketBattleInfo.class, + PacketBattleInfo::encode, + PacketBattleInfo::decode, + PacketBattleInfo::handle); HANDLER.registerMessage( - packetHandlerID++, - PacketBattleRequestInfo.class, - PacketBattleRequestInfo::encode, - PacketBattleRequestInfo::decode, - PacketBattleRequestInfo.Handler::handle); + packetHandlerID++, + PacketBattleRequestInfo.class, + PacketBattleRequestInfo::encode, + PacketBattleRequestInfo::decode, + PacketBattleRequestInfo::handle); HANDLER.registerMessage( - packetHandlerID++, - PacketBattleDecision.class, - PacketBattleDecision::encode, - PacketBattleDecision::decode, - PacketBattleDecision.Handler::handle); + packetHandlerID++, + PacketBattleDecision.class, + PacketBattleDecision::encode, + PacketBattleDecision::decode, + PacketBattleDecision::handle); HANDLER.registerMessage( - packetHandlerID++, - PacketBattleMessage.class, - PacketBattleMessage::encode, - PacketBattleMessage::decode, - PacketBattleMessage.Handler::handle); + packetHandlerID++, + PacketBattleMessage.class, + PacketBattleMessage::encode, + PacketBattleMessage::decode, + PacketBattleMessage::handle); HANDLER.registerMessage( - packetHandlerID++, - PacketGeneralMessage.class, - PacketGeneralMessage::encode, - PacketGeneralMessage::decode, - PacketGeneralMessage.Handler::handle); + packetHandlerID++, + PacketGeneralMessage.class, + PacketGeneralMessage::encode, + PacketGeneralMessage::decode, + PacketGeneralMessage::handle); HANDLER.registerMessage( - packetHandlerID++, - PacketEditingMessage.class, - PacketEditingMessage::encode, - PacketEditingMessage::decode, - PacketEditingMessage.Handler::handle); - + packetHandlerID++, + PacketEditingMessage.class, + PacketEditingMessage::encode, + PacketEditingMessage::decode, + PacketEditingMessage::handle); + // register event handler(s) MinecraftForge.EVENT_BUS.register(new AttackEventHandler()); MinecraftForge.EVENT_BUS.register(new PlayerJoinEventHandler()); @@ -127,108 +126,106 @@ public class TurnBasedMinecraftMod logger.debug("Init com_burnedkirby_turnbasedminecraft"); } - private void secondInitClient(final FMLClientSetupEvent event) - { - proxy.postInit(); + private void secondInitClient(final FMLClientSetupEvent event) { + proxy.postInit(); } - - private void secondInitServer(final FMLDedicatedServerSetupEvent event) - { - proxy.postInit(); + + private void secondInitServer(final FMLDedicatedServerSetupEvent event) { + proxy.postInit(); } - + @SubscribeEvent - public void serverStarting(FMLServerStartingEvent event) - { + public void serverStarting(ServerStartingEvent event) { logger.debug("About to initialize BattleManager"); - if(proxy.initializeBattleManager()) - { + if (proxy.initializeBattleManager()) { logger.debug("Initialized BattleManager"); } - + proxy.getConfig().clearBattleIgnoringPlayers(); - - // register commands + } + + @SubscribeEvent + public void registerCommands(RegisterCommandsEvent event) { // tbm-disable - event.getServer().getCommands().getDispatcher().register( + event.getDispatcher().register( Commands.literal("tbm-disable") .requires(c -> { return !proxy.getConfig().getIfOnlyOPsCanDisableTurnBasedForSelf() || c.hasPermission(2); }) - .executes( c -> { + .executes(c -> { proxy.getConfig().addBattleIgnoringPlayer(c.getSource().getPlayerOrException().getId()); - c.getSource().sendSuccess(new StringTextComponent("Disabled turn-based-combat for current player"), true); + c.getSource().sendSuccess(new TextComponent("Disabled turn-based-combat for current player"), true); return 1; })); // tbm-disable-all - event.getServer().getCommands().getDispatcher().register( + event.getDispatcher().register( Commands.literal("tbm-disable-all") .requires(c -> { return c.hasPermission(2); }) .executes(c -> { proxy.getConfig().setBattleDisabledForAll(true); - for(ServerPlayerEntity player : c.getSource().getServer().getPlayerList().getPlayers()) { + for (ServerPlayer player : c.getSource().getServer().getPlayerList().getPlayers()) { 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().getCommands().getDispatcher().register( + event.getDispatcher().register( Commands.literal("tbm-enable") .requires(c -> !proxy.getConfig().getIfOnlyOPsCanDisableTurnBasedForSelf() || c.hasPermission(2)) .executes(c -> { proxy.getConfig().removeBattleIgnoringPlayer(c.getSource().getPlayerOrException().getId()); - c.getSource().sendSuccess(new StringTextComponent("Enabled turn-based-combat for current player"), true); + c.getSource().sendSuccess(new TextComponent("Enabled turn-based-combat for current player"), true); return 1; })); // tbm-enable-all - event.getServer().getCommands().getDispatcher().register( + event.getDispatcher().register( Commands.literal("tbm-enable-all") .requires(c -> c.hasPermission(2)) .executes(c -> { proxy.getConfig().setBattleDisabledForAll(false); proxy.getConfig().clearBattleIgnoringPlayers(); - for(ServerPlayerEntity player: c.getSource().getServer().getPlayerList().getPlayers()) { + for (ServerPlayer player : c.getSource().getServer().getPlayerList().getPlayers()) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketGeneralMessage("OP enabled turn-based-combat for everyone")); } return 1; })); // tbm-set-enable - event.getServer().getCommands().getDispatcher().register( + event.getDispatcher().register( Commands.literal("tbm-set-enable") .requires(c -> c.hasPermission(2)) .then(Commands.argument("targets", EntityArgument.players()).executes(c -> { - for(ServerPlayerEntity player : EntityArgument.getPlayers(c, "targets")) { + for (ServerPlayer player : EntityArgument.getPlayers(c, "targets")) { proxy.getConfig().addBattleIgnoringPlayer(player.getId()); getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketGeneralMessage("OP enabled turn-based-combat for you")); - c.getSource().sendSuccess(new StringTextComponent("Enabled turn-based-combat for " + player.getDisplayName().getString()), true); + c.getSource().sendSuccess(new TextComponent("Enabled turn-based-combat for " + player.getDisplayName().getString()), true); } return 1; }))); // tbm-set-disable - event.getServer().getCommands().getDispatcher().register( + event.getDispatcher().register( Commands.literal("tbm-set-disable") .requires(c -> c.hasPermission(2)) .then(Commands.argument("targets", EntityArgument.players()).executes(c -> { - for(ServerPlayerEntity player : EntityArgument.getPlayers(c, "targets")) { + for (ServerPlayer player : EntityArgument.getPlayers(c, "targets")) { proxy.getConfig().removeBattleIgnoringPlayer(player.getId()); getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketGeneralMessage("OP disabled turn-based-combat for you")); - c.getSource().sendSuccess(new StringTextComponent("Disabled turn-based-combat for " + player.getDisplayName().getString()), true); + c.getSource().sendSuccess(new TextComponent("Disabled turn-based-combat for " + player.getDisplayName().getString()), true); } return 1; }))); // tbm-edit - event.getServer().getCommands().getDispatcher().register( + event.getDispatcher().register( Commands.literal("tbm-edit") .requires(c -> c.hasPermission(2)) .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = proxy.getEditingInfo(player.getId()); - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { proxy.setEditingPlayer(player); @@ -239,17 +236,17 @@ public class TurnBasedMinecraftMod }) .then(Commands.literal("finish") .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { - if(!proxy.getConfig().editEntityEntry(editingInfo.entityInfo)) { + 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.getId()); } else { proxy.removeEditingInfo(player.getId()); getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketGeneralMessage("Entity info saved in config and loaded.")); } - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -259,9 +256,9 @@ public class TurnBasedMinecraftMod })) .then(Commands.literal("cancel") .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); - if(editingInfo != null) { + if (editingInfo != null) { proxy.removeEditingInfo(player.getId()); getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketGeneralMessage("Cancelled editing entry.")); } @@ -269,12 +266,12 @@ public class TurnBasedMinecraftMod })) .then(Commands.literal("custom") .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { Message exceptionMessage = new LiteralMessage("Invalid action for tbm-edit"); throw new CommandSyntaxException(new SimpleCommandExceptionType(exceptionMessage), exceptionMessage); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { proxy.setEditingPlayer(player); @@ -286,11 +283,11 @@ public class TurnBasedMinecraftMod })) .then(Commands.literal("edit") .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo)); - } else if(editingInfo != null){ + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -300,11 +297,11 @@ public class TurnBasedMinecraftMod }) .then(Commands.literal("ignoreBattle") .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_IGNORE_BATTLE)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -314,13 +311,13 @@ public class TurnBasedMinecraftMod }) .then(Commands.argument("ignoreBattle", BoolArgumentType.bool()) .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); boolean ignoreBattle = BoolArgumentType.getBool(c, "ignoreBattle"); - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { editingInfo.entityInfo.ignoreBattle = ignoreBattle; getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -331,11 +328,11 @@ public class TurnBasedMinecraftMod ) .then(Commands.literal("attackPower") .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_ATTACK_POWER)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -345,16 +342,16 @@ public class TurnBasedMinecraftMod }) .then(Commands.argument("attackPower", IntegerArgumentType.integer()) .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); int attackPower = IntegerArgumentType.getInteger(c, "attackPower"); - if(attackPower < 0) { + if (attackPower < 0) { attackPower = 0; } - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { editingInfo.entityInfo.attackPower = attackPower; getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -365,11 +362,11 @@ public class TurnBasedMinecraftMod ) .then(Commands.literal("attackProbability") .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_ATTACK_PROBABILITY)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -379,18 +376,18 @@ public class TurnBasedMinecraftMod }) .then(Commands.argument("attackProbability", IntegerArgumentType.integer()) .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); int attackProbability = IntegerArgumentType.getInteger(c, "attackProbability"); - if(attackProbability < 0) { + if (attackProbability < 0) { attackProbability = 0; - } else if(attackProbability > 100) { + } else if (attackProbability > 100) { attackProbability = 100; } - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { editingInfo.entityInfo.attackProbability = attackProbability; getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -401,11 +398,11 @@ public class TurnBasedMinecraftMod ) .then(Commands.literal("attackVariance") .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_ATTACK_VARIANCE)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -415,16 +412,16 @@ public class TurnBasedMinecraftMod }) .then(Commands.argument("attackVariance", IntegerArgumentType.integer()) .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); int attackVariance = IntegerArgumentType.getInteger(c, "attackVariance"); - if(attackVariance < 0) { + if (attackVariance < 0) { attackVariance = 0; } - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { editingInfo.entityInfo.attackVariance = attackVariance; getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -435,11 +432,11 @@ public class TurnBasedMinecraftMod ) .then(Commands.literal("attackEffect") .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_ATTACK_EFFECT)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -449,13 +446,13 @@ public class TurnBasedMinecraftMod }) .then(Commands.argument("attackEffect", StringArgumentType.word()) .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer 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) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { editingInfo.entityInfo.attackEffect = effect; getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -466,11 +463,11 @@ public class TurnBasedMinecraftMod ) .then(Commands.literal("attackEffectProbability") .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_ATTACK_EFFECT_PROBABILITY)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -480,18 +477,18 @@ public class TurnBasedMinecraftMod }) .then(Commands.argument("attackEffectProbability", IntegerArgumentType.integer()) .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); int attackEffectProbability = IntegerArgumentType.getInteger(c, "attackEffectProbability"); - if(attackEffectProbability < 0) { + if (attackEffectProbability < 0) { attackEffectProbability = 0; - } else if(attackEffectProbability > 100) { + } else if (attackEffectProbability > 100) { attackEffectProbability = 100; } - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { editingInfo.entityInfo.attackEffectProbability = attackEffectProbability; getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -502,11 +499,11 @@ public class TurnBasedMinecraftMod ) .then(Commands.literal("defenseDamage") .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_DEFENSE_DAMAGE)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -516,16 +513,16 @@ public class TurnBasedMinecraftMod }) .then(Commands.argument("defenseDamage", IntegerArgumentType.integer()) .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); int defenseDamage = IntegerArgumentType.getInteger(c, "defenseDamage"); - if(defenseDamage < 0) { + if (defenseDamage < 0) { defenseDamage = 0; } - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { editingInfo.entityInfo.defenseDamage = defenseDamage; getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -536,11 +533,11 @@ public class TurnBasedMinecraftMod ) .then(Commands.literal("defenseDamageProbability") .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_DEFENSE_DAMAGE_PROBABILITY)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -550,18 +547,18 @@ public class TurnBasedMinecraftMod }) .then(Commands.argument("defenseDamageProbability", IntegerArgumentType.integer()) .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); int defenseDamageProbability = IntegerArgumentType.getInteger(c, "defenseDamageProbability"); - if(defenseDamageProbability < 0) { + if (defenseDamageProbability < 0) { defenseDamageProbability = 0; - } else if(defenseDamageProbability > 100) { + } else if (defenseDamageProbability > 100) { defenseDamageProbability = 100; } - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { editingInfo.entityInfo.defenseDamageProbability = defenseDamageProbability; getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -572,11 +569,11 @@ public class TurnBasedMinecraftMod ) .then(Commands.literal("evasion") .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_EVASION)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -586,18 +583,18 @@ public class TurnBasedMinecraftMod }) .then(Commands.argument("evasion", IntegerArgumentType.integer()) .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); int evasion = IntegerArgumentType.getInteger(c, "evasion"); - if(evasion < 0) { + if (evasion < 0) { evasion = 0; - } else if(evasion > 100) { + } else if (evasion > 100) { evasion = 100; } - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { editingInfo.entityInfo.evasion = evasion; getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -608,11 +605,11 @@ public class TurnBasedMinecraftMod ) .then(Commands.literal("speed") .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_SPEED)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -622,16 +619,16 @@ public class TurnBasedMinecraftMod }) .then(Commands.argument("speed", IntegerArgumentType.integer()) .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); int speed = IntegerArgumentType.getInteger(c, "speed"); - if(speed < 0) { + if (speed < 0) { speed = 0; } - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { editingInfo.entityInfo.speed = speed; getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -642,11 +639,11 @@ public class TurnBasedMinecraftMod ) .then(Commands.literal("category") .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_CATEGORY)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -656,13 +653,13 @@ public class TurnBasedMinecraftMod }) .then(Commands.argument("category", StringArgumentType.word()) .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); String category = StringArgumentType.getString(c, "category"); - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { editingInfo.entityInfo.category = category; getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -673,11 +670,11 @@ public class TurnBasedMinecraftMod ) .then(Commands.literal("decisionAttack") .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_DECISION_ATTACK)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -687,18 +684,18 @@ public class TurnBasedMinecraftMod }) .then(Commands.argument("decisionAttack", IntegerArgumentType.integer()) .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); int decisionAttack = IntegerArgumentType.getInteger(c, "decisionAttack"); - if(decisionAttack < 0) { + if (decisionAttack < 0) { decisionAttack = 0; - } else if(decisionAttack > 100) { + } else if (decisionAttack > 100) { decisionAttack = 100; } - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { editingInfo.entityInfo.decisionAttack = decisionAttack; getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -709,11 +706,11 @@ public class TurnBasedMinecraftMod ) .then(Commands.literal("decisionDefend") .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_DECISION_DEFEND)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -723,18 +720,18 @@ public class TurnBasedMinecraftMod }) .then(Commands.argument("decisionDefend", IntegerArgumentType.integer()) .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); int decisionDefend = IntegerArgumentType.getInteger(c, "decisionDefend"); - if(decisionDefend < 0) { + if (decisionDefend < 0) { decisionDefend = 0; - } else if(decisionDefend > 100) { + } else if (decisionDefend > 100) { decisionDefend = 100; } - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { editingInfo.entityInfo.decisionDefend = decisionDefend; getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -745,11 +742,11 @@ public class TurnBasedMinecraftMod ) .then(Commands.literal("decisionFlee") .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.EDIT_DECISION_FLEE)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -759,13 +756,13 @@ public class TurnBasedMinecraftMod }) .then(Commands.argument("decisionFlee", IntegerArgumentType.integer()) .executes(c -> { - ServerPlayerEntity player = c.getSource().getPlayerOrException(); + ServerPlayer player = c.getSource().getPlayerOrException(); EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId()); int decisionFlee = IntegerArgumentType.getInteger(c, "decisionFlee"); - if(editingInfo != null && !editingInfo.isPendingEntitySelection) { + if (editingInfo != null && !editingInfo.isPendingEntitySelection) { editingInfo.entityInfo.decisionFlee = decisionFlee; getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo)); - } else if(editingInfo != null) { + } else if (editingInfo != null) { getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY)); } else { Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\")."); @@ -777,13 +774,11 @@ public class TurnBasedMinecraftMod ) ); } - + @SubscribeEvent - public void serverStopping(FMLServerStoppingEvent event) - { + public void serverStopping(ServerStoppingEvent event) { logger.debug("About to cleanup BattleManager"); - if(proxy.cleanupBattleManager()) - { + if (proxy.cleanupBattleManager()) { logger.debug("Cleaned up BattleManager"); } } diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Utility.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Utility.java index a3571af..2a783f3 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Utility.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Utility.java @@ -1,12 +1,12 @@ package com.burnedkirby.TurnBasedMinecraft.common; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ArrowItem; -import net.minecraft.util.RegistryKey; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.registry.Registry; -import net.minecraft.world.World; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ArrowItem; +import net.minecraft.world.level.Level; public class Utility { @@ -37,11 +37,11 @@ public class Utility } } - public static boolean doesPlayerHaveArrows(PlayerEntity player) + public static boolean doesPlayerHaveArrows(Player player) { - for(int i = 0; i < player.inventory.getContainerSize(); ++i) + for(int i = 0; i < player.getInventory().getContainerSize(); ++i) { - if(player.inventory.getItem(i).getItem() instanceof ArrowItem) + if(player.getInventory().getItem(i).getItem() instanceof ArrowItem) { return true; } @@ -54,12 +54,12 @@ public class Utility 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 dimObject) { + public static String serializeDimension(ResourceKey dimObject) { return dimObject.getRegistryName().toString(); } - public static RegistryKey deserializeDimension(String dimString) { + public static ResourceKey deserializeDimension(String dimString) { ResourceLocation dimRes = new ResourceLocation(dimString); - return RegistryKey.create(Registry.DIMENSION_REGISTRY, dimRes); + return ResourceKey.create(Registry.DIMENSION_REGISTRY, dimRes); } } diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketBattleDecision.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketBattleDecision.java index 7b5f391..517ecd0 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketBattleDecision.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketBattleDecision.java @@ -6,9 +6,9 @@ import com.burnedkirby.TurnBasedMinecraft.common.Battle; import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod; import com.burnedkirby.TurnBasedMinecraft.common.Battle.Decision; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.network.PacketBuffer; -import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraftforge.network.NetworkEvent; public class PacketBattleDecision { @@ -25,27 +25,25 @@ public class PacketBattleDecision this.targetIDOrItemID = targetIDOrItemID; } - public static void encode(PacketBattleDecision pkt, PacketBuffer buf) { + public static void encode(PacketBattleDecision pkt, FriendlyByteBuf buf) { buf.writeInt(pkt.battleID); buf.writeInt(pkt.decision.getValue()); buf.writeInt(pkt.targetIDOrItemID); } - public static PacketBattleDecision decode(PacketBuffer buf) { + public static PacketBattleDecision decode(FriendlyByteBuf buf) { return new PacketBattleDecision(buf.readInt(), Decision.valueOf(buf.readInt()), buf.readInt()); } - public static class Handler { - public static void handle(final PacketBattleDecision pkt, Supplier ctx) { - ctx.get().enqueueWork(() -> { - Battle b = TurnBasedMinecraftMod.proxy.getBattleManager().getBattleByID(pkt.battleID); - if(b != null) - { - ServerPlayerEntity player = ctx.get().getSender(); - b.setDecision(player.getId(), pkt.decision, pkt.targetIDOrItemID); - } - }); - ctx.get().setPacketHandled(true); - } + public static void handle(final PacketBattleDecision pkt, Supplier ctx) { + ctx.get().enqueueWork(() -> { + Battle b = TurnBasedMinecraftMod.proxy.getBattleManager().getBattleByID(pkt.battleID); + if(b != null) + { + ServerPlayer player = ctx.get().getSender(); + b.setDecision(player.getId(), pkt.decision, pkt.targetIDOrItemID); + } + }); + ctx.get().setPacketHandled(true); } } diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketBattleInfo.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketBattleInfo.java index 568f6dd..698dc99 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketBattleInfo.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketBattleInfo.java @@ -7,9 +7,9 @@ import java.util.function.Supplier; import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod; import net.minecraft.client.Minecraft; -import net.minecraft.entity.Entity; -import net.minecraft.network.PacketBuffer; -import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraft.world.entity.Entity; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraftforge.network.NetworkEvent; public class PacketBattleInfo { @@ -23,27 +23,27 @@ public class PacketBattleInfo sideB = new ArrayList(); decisionNanos = TurnBasedMinecraftMod.proxy.getConfig().getDecisionDurationNanos(); } - + public PacketBattleInfo(Collection sideA, Collection sideB, long decisionNanos) { this.sideA = sideA; this.sideB = sideB; this.decisionNanos = decisionNanos; } - - public static void encode(PacketBattleInfo pkt, PacketBuffer buf) { - buf.writeInt(pkt.sideA.size()); - buf.writeInt(pkt.sideB.size()); - for(Integer id : pkt.sideA) { + + public static void encode(PacketBattleInfo msg, FriendlyByteBuf buf) { + buf.writeInt(msg.sideA.size()); + buf.writeInt(msg.sideB.size()); + for(Integer id : msg.sideA) { buf.writeInt(id); } - for(Integer id : pkt.sideB) { + for(Integer id : msg.sideB) { buf.writeInt(id); } - buf.writeLong(pkt.decisionNanos); + buf.writeLong(msg.decisionNanos); } - - public static PacketBattleInfo decode(PacketBuffer buf) { + + public static PacketBattleInfo decode(FriendlyByteBuf buf) { int sideACount = buf.readInt(); int sideBCount = buf.readInt(); Collection sideA = new ArrayList(sideACount); @@ -58,34 +58,32 @@ public class PacketBattleInfo return new PacketBattleInfo(sideA, sideB, decisionNanos); } - public static class Handler { - public static void handle(final PacketBattleInfo pkt, Supplier ctx) { - ctx.get().enqueueWork(() -> { - if(TurnBasedMinecraftMod.proxy.getLocalBattle() == null) + public static void handle(final PacketBattleInfo pkt, Supplier ctx) { + ctx.get().enqueueWork(() -> { + if(TurnBasedMinecraftMod.proxy.getLocalBattle() == null) + { + return; + } + TurnBasedMinecraftMod.proxy.getLocalBattle().clearCombatants(); + for(Integer id : pkt.sideA) + { + Entity e = Minecraft.getInstance().level.getEntity(id); + if(e != null) { - return; + TurnBasedMinecraftMod.proxy.getLocalBattle().addCombatantToSideA(e); } - TurnBasedMinecraftMod.proxy.getLocalBattle().clearCombatants(); - for(Integer id : pkt.sideA) + } + for(Integer id : pkt.sideB) + { + Entity e = Minecraft.getInstance().level.getEntity(id); + if(e != null) { - Entity e = Minecraft.getInstance().level.getEntity(id); - if(e != null) - { - TurnBasedMinecraftMod.proxy.getLocalBattle().addCombatantToSideA(e); - } + TurnBasedMinecraftMod.proxy.getLocalBattle().addCombatantToSideB(e); } - for(Integer id : pkt.sideB) - { - Entity e = Minecraft.getInstance().level.getEntity(id); - if(e != null) - { - TurnBasedMinecraftMod.proxy.getLocalBattle().addCombatantToSideB(e); - } - } - TurnBasedMinecraftMod.proxy.setBattleGuiTime((int)(pkt.decisionNanos / 1000000000L)); - TurnBasedMinecraftMod.proxy.setBattleGuiBattleChanged(); - }); - ctx.get().setPacketHandled(true); - } + } + TurnBasedMinecraftMod.proxy.setBattleGuiTime((int)(pkt.decisionNanos / 1000000000L)); + TurnBasedMinecraftMod.proxy.setBattleGuiBattleChanged(); + }); + ctx.get().setPacketHandled(true); } } diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketBattleMessage.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketBattleMessage.java index 3e93d90..1011284 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketBattleMessage.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketBattleMessage.java @@ -7,13 +7,12 @@ import java.util.function.Supplier; import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod; import com.burnedkirby.TurnBasedMinecraft.common.Utility; -import net.minecraft.entity.Entity; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.RegistryKey; -import net.minecraft.util.text.Color; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.world.World; -import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.level.Level; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.fml.DistExecutor; +import net.minecraftforge.network.NetworkEvent; public class PacketBattleMessage { @@ -102,17 +101,40 @@ public class PacketBattleMessage return map.get(value); } } - + MessageType messageType; int entityIDFrom; int entityIDTo; int amount; String custom; - RegistryKey dimension; - + ResourceKey dimension; + + public MessageType getMessageType() { + return messageType; + } + + public int getEntityIDFrom() { + return entityIDFrom; + } + + public int getEntityIDTo() { + return entityIDTo; + } + + public int getAmount() { + return amount; + } + + public String getCustom() { + return custom; + } + + public ResourceKey getDimension() { + return dimension; + } public PacketBattleMessage() { custom = new String(); } - public PacketBattleMessage(MessageType messageType, int entityIDFrom, int entityIDTo, RegistryKey dimension, int amount) + public PacketBattleMessage(MessageType messageType, int entityIDFrom, int entityIDTo, ResourceKey dimension, int amount) { this.messageType = messageType; this.entityIDFrom = entityIDFrom; @@ -122,7 +144,7 @@ public class PacketBattleMessage custom = new String(); } - public PacketBattleMessage(MessageType messageType, int entityIDFrom, int entityIDTo, RegistryKey dimension, int amount, String custom) + public PacketBattleMessage(MessageType messageType, int entityIDFrom, int entityIDTo, ResourceKey dimension, int amount, String custom) { this.messageType = messageType; this.entityIDFrom = entityIDFrom; @@ -132,7 +154,7 @@ public class PacketBattleMessage this.custom = custom; } - public static void encode(PacketBattleMessage pkt, PacketBuffer buf) { + public static void encode(PacketBattleMessage pkt, FriendlyByteBuf buf) { buf.writeInt(pkt.messageType.getValue()); buf.writeInt(pkt.entityIDFrom); buf.writeInt(pkt.entityIDTo); @@ -141,7 +163,7 @@ public class PacketBattleMessage buf.writeUtf(pkt.custom); } - public static PacketBattleMessage decode(PacketBuffer buf) { + public static PacketBattleMessage decode(FriendlyByteBuf buf) { return new PacketBattleMessage( MessageType.valueOf( buf.readInt()), @@ -152,183 +174,10 @@ public class PacketBattleMessage buf.readUtf()); } - public static class Handler { - public static void handle(final PacketBattleMessage pkt, Supplier ctx) { - ctx.get().enqueueWork(() -> { - Entity fromEntity = TurnBasedMinecraftMod.proxy.getEntity(pkt.entityIDFrom, pkt.dimension); - String from = "Unknown"; - if(fromEntity != null) - { - from = fromEntity.getDisplayName().getString(); - } - else if(TurnBasedMinecraftMod.proxy.getLocalBattle() != null) - { - fromEntity = TurnBasedMinecraftMod.proxy.getLocalBattle().getCombatantEntity(pkt.entityIDFrom); - if(fromEntity != null) - { - from = fromEntity.getDisplayName().getString(); - } - } - Entity toEntity = TurnBasedMinecraftMod.proxy.getEntity(pkt.entityIDTo, pkt.dimension); - String to = "Unknown"; - if(toEntity != null) - { - to = toEntity.getDisplayName().getString(); - } - else if(TurnBasedMinecraftMod.proxy.getLocalBattle() != null) - { - toEntity = TurnBasedMinecraftMod.proxy.getLocalBattle().getCombatantEntity(pkt.entityIDTo); - if(toEntity != null) - { - to = toEntity.getDisplayName().getString(); - } - } - - switch(pkt.messageType) - { - case ENTERED: - TurnBasedMinecraftMod.proxy.displayString(from + " entered battle!"); - if(TurnBasedMinecraftMod.proxy.getLocalBattle() == null || TurnBasedMinecraftMod.proxy.getLocalBattle().getId() != pkt.amount) - { - TurnBasedMinecraftMod.proxy.createLocalBattle(pkt.amount); - } - TurnBasedMinecraftMod.proxy.battleStarted(); - TurnBasedMinecraftMod.proxy.typeEnteredBattle(pkt.custom); - break; - case FLEE: - if(pkt.amount != 0) - { - TurnBasedMinecraftMod.proxy.displayString(from + " fled battle!"); - TurnBasedMinecraftMod.proxy.typeLeftBattle(pkt.custom); - } - else - { - TurnBasedMinecraftMod.proxy.displayString(from + " tried to flee battle but failed!"); - } - break; - case DIED: - TurnBasedMinecraftMod.proxy.displayString(from + " died in battle!"); - TurnBasedMinecraftMod.proxy.typeLeftBattle(pkt.custom); - break; - case ENDED: - TurnBasedMinecraftMod.proxy.displayString("Battle has ended!"); - TurnBasedMinecraftMod.proxy.battleEnded(); - break; - case ATTACK: - TurnBasedMinecraftMod.proxy.displayString(from + " attacked " + to + " and dealt " + pkt.amount + " damage!"); - break; - case DEFEND: - TurnBasedMinecraftMod.proxy.displayString(from + " blocked " + to + "'s attack!"); - break; - case DEFENSE_DAMAGE: - TurnBasedMinecraftMod.proxy.displayString(from + " retaliated from " + to + "'s attack and dealt " + pkt.amount + " damage!"); - break; - case MISS: - TurnBasedMinecraftMod.proxy.displayString(from + " attacked " + to + " but missed!"); - break; - case DEFENDING: - TurnBasedMinecraftMod.proxy.displayString(from + " is defending!"); - break; - case DID_NOTHING: - TurnBasedMinecraftMod.proxy.displayString(from + " did nothing!"); - break; - case USED_ITEM: - switch(UsedItemAction.valueOf(pkt.amount)) - { - case USED_NOTHING: - TurnBasedMinecraftMod.proxy.displayString(from + " tried to use nothing!"); - break; - case USED_INVALID: - if(pkt.custom.length() > 0) - { - TurnBasedMinecraftMod.proxy.displayString(from + " tried to consume " + pkt.custom + " and failed!"); - } - else - { - TurnBasedMinecraftMod.proxy.displayString(from + " tried to consume an invalid item and failed!"); - } - break; - case USED_FOOD: - TurnBasedMinecraftMod.proxy.displayString(from + " ate a " + pkt.custom + "!"); - break; - case USED_POTION: - TurnBasedMinecraftMod.proxy.displayString(from + " drank a " + pkt.custom + "!"); - break; - } - break; - case TURN_BEGIN: - TurnBasedMinecraftMod.proxy.displayString("The turn begins!"); - TurnBasedMinecraftMod.proxy.battleGuiTurnBegin(); - break; - case TURN_END: - if(TurnBasedMinecraftMod.proxy.getLocalBattle() != null) - { - if(pkt.amount == 0) - { - TurnBasedMinecraftMod.proxy.displayString("The turn ended!"); - } - else - { - TurnBasedMinecraftMod.proxy.displayString("The turn ended (abnormally due to internal error)!"); - } - } - TurnBasedMinecraftMod.proxy.battleGuiTurnEnd(); - break; - case SWITCHED_ITEM: - if(pkt.amount != 0) - { - TurnBasedMinecraftMod.proxy.displayString(from + " switched to a different item!"); - } - else - { - TurnBasedMinecraftMod.proxy.displayString(from + " switched to a different item but failed because it was invalid!"); - } - break; - case WAS_AFFECTED: - TurnBasedMinecraftMod.proxy.displayString(to + " was " + pkt.custom + " by " + from + "!"); - break; - case BECAME_CREATIVE: - TurnBasedMinecraftMod.proxy.displayString(from + " entered creative mode and left battle!"); - break; - case FIRED_ARROW: - TurnBasedMinecraftMod.proxy.displayString(from + " let loose an arrow towards " + to + "!"); - break; - case ARROW_HIT: - TurnBasedMinecraftMod.proxy.displayString(to + " was hit by " + from + "'s arrow!"); - break; - case BOW_NO_AMMO: - TurnBasedMinecraftMod.proxy.displayString(from + " tried to use their bow but ran out of ammo!"); - break; - case CREEPER_WAIT: { - StringTextComponent prefix = new StringTextComponent("TBM: "); - prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true)); - StringTextComponent message = new StringTextComponent(from + " is charging up!"); - 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.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true)); - StringTextComponent message = new StringTextComponent(from + " is about to explode!"); - 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.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true)); - StringTextComponent message = new StringTextComponent(from + " exploded!"); - message.setStyle(message.getStyle().withColor(Color.fromRgb(0xFFFF0000))); - prefix.getSiblings().add(message); - TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); - } - break; - } - }); - ctx.get().setPacketHandled(true); - } + public static void handle(final PacketBattleMessage pkt, Supplier ctx) { + ctx.get().enqueueWork(() -> { + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> TurnBasedMinecraftMod.proxy.handlePacket(pkt, ctx)); + }); + ctx.get().setPacketHandled(true); } } diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketBattleRequestInfo.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketBattleRequestInfo.java index 9d267ee..b78896b 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketBattleRequestInfo.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketBattleRequestInfo.java @@ -6,8 +6,8 @@ import com.burnedkirby.TurnBasedMinecraft.common.Battle; import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod; import io.netty.buffer.Unpooled; -import net.minecraft.network.PacketBuffer; -import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraftforge.network.NetworkEvent; public class PacketBattleRequestInfo { @@ -20,24 +20,22 @@ public class PacketBattleRequestInfo this.battleID = battleID; } - public static void encode(PacketBattleRequestInfo pkt, PacketBuffer buf) { + public static void encode(PacketBattleRequestInfo pkt, FriendlyByteBuf buf) { buf.writeInt(pkt.battleID); } - public static PacketBattleRequestInfo decode(PacketBuffer buf) { + public static PacketBattleRequestInfo decode(FriendlyByteBuf buf) { return new PacketBattleRequestInfo(buf.readInt()); } - public static class Handler { - public static void handle(final PacketBattleRequestInfo pkt, Supplier ctx) { - ctx.get().enqueueWork(() -> { - Battle b = TurnBasedMinecraftMod.proxy.getBattleManager().getBattleByID(pkt.battleID); - if(b == null) { - return; - } - TurnBasedMinecraftMod.getHandler().reply(new PacketBattleInfo(b.getSideAIDs(), b.getSideBIDs(), b.getTimerSeconds()), ctx.get()); - }); - ctx.get().setPacketHandled(true); - } + public static void handle(final PacketBattleRequestInfo pkt, Supplier ctx) { + ctx.get().enqueueWork(() -> { + Battle b = TurnBasedMinecraftMod.proxy.getBattleManager().getBattleByID(pkt.battleID); + if(b == null) { + return; + } + TurnBasedMinecraftMod.getHandler().reply(new PacketBattleInfo(b.getSideAIDs(), b.getSideBIDs(), b.getTimerSeconds()), ctx.get()); + }); + ctx.get().setPacketHandled(true); } } diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketEditingMessage.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketEditingMessage.java index 654507c..4cdddaa 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketEditingMessage.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketEditingMessage.java @@ -2,13 +2,10 @@ package com.burnedkirby.TurnBasedMinecraft.common.networking; import com.burnedkirby.TurnBasedMinecraft.common.EntityInfo; import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.text.Color; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.event.ClickEvent; -import net.minecraft.util.text.event.HoverEvent; -import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.fml.DistExecutor; +import net.minecraftforge.network.NetworkEvent; import java.util.HashMap; import java.util.Map; @@ -66,6 +63,14 @@ public class PacketEditingMessage Type type = Type.ATTACK_ENTITY; EntityInfo entityInfo = new EntityInfo(); + public Type getType() { + return type; + } + + public EntityInfo getEntityInfo() { + return entityInfo; + } + public PacketEditingMessage() {} public PacketEditingMessage(Type type) @@ -82,7 +87,7 @@ public class PacketEditingMessage } } - public static void encode(PacketEditingMessage pkt, PacketBuffer buf) { + public static void encode(PacketEditingMessage pkt, FriendlyByteBuf buf) { buf.writeInt(pkt.type.getValue()); if(pkt.entityInfo.classType != null) { buf.writeUtf(pkt.entityInfo.classType.getName()); @@ -106,7 +111,7 @@ public class PacketEditingMessage buf.writeUtf(pkt.entityInfo.customName); } - public static PacketEditingMessage decode(PacketBuffer buf) { + public static PacketEditingMessage decode(FriendlyByteBuf buf) { Type type = Type.valueOf(buf.readInt()); EntityInfo einfo = new EntityInfo(); try { @@ -130,603 +135,10 @@ public class PacketEditingMessage return new PacketEditingMessage(type, einfo); } - public static class Handler { - public static void handle(final PacketEditingMessage pkt, Supplier ctx) { - ctx.get().enqueueWork(() -> { - switch(pkt.type) - { - case ATTACK_ENTITY: - { - StringTextComponent prefix = new StringTextComponent("TBM: "); - prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true)); - StringTextComponent text = new StringTextComponent("Attack the entity you want to edit for TurnBasedMinecraftMod. "); - text.setStyle(text.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)).withBold(false)); - - StringTextComponent cancel = new StringTextComponent("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); - TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); - break; - } - case PICK_EDIT: - { - StringTextComponent prefix = new StringTextComponent("TBM: "); - prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true)); - StringTextComponent text = new StringTextComponent("Edit what value? "); - text.setStyle(text.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)).withBold(false)); - - StringTextComponent option = new StringTextComponent("IgB"); - // 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.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF))); - option.getSiblings().add(value); - text.getSiblings().add(option); - - option = new StringTextComponent("AP"); - 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.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF))); - option.getSiblings().add(value); - text.getSiblings().add(option); - - option = new StringTextComponent("APr"); - 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.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF))); - option.getSiblings().add(value); - text.getSiblings().add(option); - - option = new StringTextComponent("AV"); - 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.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF))); - option.getSiblings().add(value); - text.getSiblings().add(option); - - option = new StringTextComponent("AE"); - 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.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF))); - option.getSiblings().add(value); - text.getSiblings().add(option); - - option = new StringTextComponent("AEPr"); - 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.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF))); - option.getSiblings().add(value); - text.getSiblings().add(option); - - option = new StringTextComponent("DD"); - 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.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF))); - option.getSiblings().add(value); - text.getSiblings().add(option); - - option = new StringTextComponent("DDPr"); - 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.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF))); - option.getSiblings().add(value); - text.getSiblings().add(option); - - option = new StringTextComponent("E"); - 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.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF))); - option.getSiblings().add(value); - text.getSiblings().add(option); - - option = new StringTextComponent("S"); - 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.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF))); - option.getSiblings().add(value); - text.getSiblings().add(option); - - option = new StringTextComponent("C"); - 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.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF))); - option.getSiblings().add(value); - text.getSiblings().add(option); - - option = new StringTextComponent("DecA"); - 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.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF))); - option.getSiblings().add(value); - text.getSiblings().add(option); - - option = new StringTextComponent("DecD"); - 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.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF))); - option.getSiblings().add(value); - text.getSiblings().add(option); - - option = new StringTextComponent("DecF"); - 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.setStyle(value.getStyle().withColor(Color.fromRgb(0xFFFFFFFF))); - option.getSiblings().add(value); - text.getSiblings().add(option); - - option = new StringTextComponent("Finished Editing"); - 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.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); - TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); - break; - } - case EDIT_IGNORE_BATTLE: - { - StringTextComponent prefix = new StringTextComponent("TBM: "); - prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true)); - StringTextComponent text = new StringTextComponent("ignoreBattle: "); - text.setStyle(text.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)).withBold(false)); - - StringTextComponent option = new StringTextComponent("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.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); - TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); - break; - } - case EDIT_ATTACK_POWER: - { - StringTextComponent prefix = new StringTextComponent("TBM: "); - prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true)); - StringTextComponent text = new StringTextComponent("attackPower: "); - 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.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) - { - text.getSiblings().add(new StringTextComponent(", ")); - } - } - - text.getSiblings().add(new StringTextComponent(" (or use command \"/tbm-edit edit attackPower \")")); - - prefix.getSiblings().add(text); - TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); - break; - } - case EDIT_ATTACK_PROBABILITY: - { - StringTextComponent prefix = new StringTextComponent("TBM: "); - prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true)); - StringTextComponent text = new StringTextComponent("attackProbability: "); - 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.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) - { - text.getSiblings().add(new StringTextComponent(", ")); - } - } - - text.getSiblings().add(new StringTextComponent(" (or use command \"/tbm-edit edit attackProbability \")")); - - prefix.getSiblings().add(text); - TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); - break; - } - case EDIT_ATTACK_VARIANCE: - { - StringTextComponent prefix = new StringTextComponent("TBM: "); - prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true)); - StringTextComponent text = new StringTextComponent("attackVariance: "); - 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.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) - { - text.getSiblings().add(new StringTextComponent(", ")); - } - } - - text.getSiblings().add(new StringTextComponent(" (or use command \"/tbm-edit edit attackVariance \")")); - - prefix.getSiblings().add(text); - TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); - break; - } - case EDIT_ATTACK_EFFECT: - { - StringTextComponent prefix = new StringTextComponent("TBM: "); - prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true)); - StringTextComponent text = new StringTextComponent("attackEffect: "); - text.setStyle(text.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)).withBold(false)); - - for(EntityInfo.Effect e : EntityInfo.Effect.values()) - { - StringTextComponent option = new StringTextComponent(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) - { - // TODO find a better way to handle printing comma for items before last - text.getSiblings().add(new StringTextComponent(", ")); - } - } - - prefix.getSiblings().add(text); - TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); - break; - } - case EDIT_ATTACK_EFFECT_PROBABILITY: - { - StringTextComponent prefix = new StringTextComponent("TBM: "); - prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true)); - StringTextComponent text = new StringTextComponent("attackEffectProbability: "); - 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.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) - { - text.getSiblings().add(new StringTextComponent(", ")); - } - } - - text.getSiblings().add(new StringTextComponent(" (or use command \"/tbm-edit edit attackEffectProbability \")")); - - prefix.getSiblings().add(text); - TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); - break; - } - case EDIT_DEFENSE_DAMAGE: - { - StringTextComponent prefix = new StringTextComponent("TBM: "); - prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true)); - StringTextComponent text = new StringTextComponent("defenseDamage: "); - 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.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) - { - text.getSiblings().add(new StringTextComponent(", ")); - } - } - - text.getSiblings().add(new StringTextComponent(" (or use command \"/tbm-edit edit defenseDamage \")")); - - prefix.getSiblings().add(text); - TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); - break; - } - case EDIT_DEFENSE_DAMAGE_PROBABILITY: - { - StringTextComponent prefix = new StringTextComponent("TBM: "); - prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true)); - StringTextComponent text = new StringTextComponent("defenseDamageProbability: "); - 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.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) - { - text.getSiblings().add(new StringTextComponent(", ")); - } - } - - text.getSiblings().add(new StringTextComponent(" (or use command \"/tbm-edit edit defenseDamageProbability \")")); - - prefix.getSiblings().add(text); - TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); - break; - } - case EDIT_EVASION: - { - StringTextComponent prefix = new StringTextComponent("TBM: "); - prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true)); - StringTextComponent text = new StringTextComponent("evasion: "); - 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.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) - { - text.getSiblings().add(new StringTextComponent(", ")); - } - } - - text.getSiblings().add(new StringTextComponent(" (or use command \"/tbm-edit edit evasion \")")); - - prefix.getSiblings().add(text); - TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); - break; - } - case EDIT_SPEED: - { - StringTextComponent prefix = new StringTextComponent("TBM: "); - prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true)); - StringTextComponent text = new StringTextComponent("speed: "); - 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.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) - { - text.getSiblings().add(new StringTextComponent(", ")); - } - } - - text.getSiblings().add(new StringTextComponent(" (or use command \"/tbm-edit edit speed \")")); - - prefix.getSiblings().add(text); - TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); - break; - } - case EDIT_CATEGORY: - { - StringTextComponent prefix = new StringTextComponent("TBM: "); - prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true)); - StringTextComponent text = new StringTextComponent("category: "); - text.setStyle(text.getStyle().withColor(Color.fromRgb(0xFFFFFFFF)).withBold(false)); - - StringTextComponent option = new StringTextComponent("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.setStyle(optionInfo.getStyle().withColor(Color.fromRgb(0xFFFFFFFF))); - StringTextComponent optionInfoBool = new StringTextComponent("disabled"); - optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(Color.fromRgb(0xFFFF0000))); - optionInfo.getSiblings().add(optionInfoBool); - optionInfo.getSiblings().add(new StringTextComponent(")")); - option.getSiblings().add(optionInfo); - } - else - { - StringTextComponent optionInfo = new StringTextComponent("(battle-"); - optionInfo.setStyle(optionInfo.getStyle().withColor(Color.fromRgb(0xFFFFFFFF))); - StringTextComponent optionInfoBool = new StringTextComponent("enabled"); - optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(Color.fromRgb(0xFF00FF00))); - optionInfo.getSiblings().add(optionInfoBool); - optionInfo.getSiblings().add(new StringTextComponent(")")); - option.getSiblings().add(optionInfo); - } - text.getSiblings().add(option); - text.getSiblings().add(new StringTextComponent(", ")); - - option = new StringTextComponent("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.setStyle(optionInfo.getStyle().withColor(Color.fromRgb(0xFFFFFFFF))); - StringTextComponent optionInfoBool = new StringTextComponent("disabled"); - optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(Color.fromRgb(0xFFFF0000))); - optionInfo.getSiblings().add(optionInfoBool); - optionInfo.getSiblings().add(new StringTextComponent(")")); - option.getSiblings().add(optionInfo); - } - else - { - StringTextComponent optionInfo = new StringTextComponent("(battle-"); - optionInfo.setStyle(optionInfo.getStyle().withColor(Color.fromRgb(0xFFFFFFFF))); - StringTextComponent optionInfoBool = new StringTextComponent("enabled"); - optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(Color.fromRgb(0xFF00FF00))); - optionInfo.getSiblings().add(optionInfoBool); - optionInfo.getSiblings().add(new StringTextComponent(")")); - option.getSiblings().add(optionInfo); - } - text.getSiblings().add(option); - text.getSiblings().add(new StringTextComponent(", ")); - - option = new StringTextComponent("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.setStyle(optionInfo.getStyle().withColor(Color.fromRgb(0xFFFFFFFF))); - StringTextComponent optionInfoBool = new StringTextComponent("disabled"); - optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(Color.fromRgb(0xFFFF0000))); - optionInfo.getSiblings().add(optionInfoBool); - optionInfo.getSiblings().add(new StringTextComponent(")")); - option.getSiblings().add(optionInfo); - } - else - { - StringTextComponent optionInfo = new StringTextComponent("(battle-"); - optionInfo.setStyle(optionInfo.getStyle().withColor(Color.fromRgb(0xFFFFFFFF))); - StringTextComponent optionInfoBool = new StringTextComponent("enabled"); - optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(Color.fromRgb(0xFF00FF00))); - optionInfo.getSiblings().add(optionInfoBool); - optionInfo.getSiblings().add(new StringTextComponent(")")); - option.getSiblings().add(optionInfo); - } - text.getSiblings().add(option); - text.getSiblings().add(new StringTextComponent(", ")); - - option = new StringTextComponent("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.setStyle(optionInfo.getStyle().withColor(Color.fromRgb(0xFFFFFFFF))); - StringTextComponent optionInfoBool = new StringTextComponent("disabled"); - optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(Color.fromRgb(0xFFFF0000))); - optionInfo.getSiblings().add(optionInfoBool); - optionInfo.getSiblings().add(new StringTextComponent(")")); - option.getSiblings().add(optionInfo); - } - else - { - StringTextComponent optionInfo = new StringTextComponent("(battle-"); - optionInfo.setStyle(optionInfo.getStyle().withColor(Color.fromRgb(0xFFFFFFFF))); - StringTextComponent optionInfoBool = new StringTextComponent("enabled"); - optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(Color.fromRgb(0xFF00FF00))); - optionInfo.getSiblings().add(optionInfoBool); - optionInfo.getSiblings().add(new StringTextComponent(")")); - option.getSiblings().add(optionInfo); - } - text.getSiblings().add(option); - text.getSiblings().add(new StringTextComponent(", ")); - - option = new StringTextComponent("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.setStyle(optionInfo.getStyle().withColor(Color.fromRgb(0xFFFFFFFF))); - StringTextComponent optionInfoBool = new StringTextComponent("disabled"); - optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(Color.fromRgb(0xFFFF0000))); - optionInfo.getSiblings().add(optionInfoBool); - optionInfo.getSiblings().add(new StringTextComponent(")")); - option.getSiblings().add(optionInfo); - } - else - { - StringTextComponent optionInfo = new StringTextComponent("(battle-"); - optionInfo.setStyle(optionInfo.getStyle().withColor(Color.fromRgb(0xFFFFFFFF))); - StringTextComponent optionInfoBool = new StringTextComponent("enabled"); - optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(Color.fromRgb(0xFF00FF00))); - optionInfo.getSiblings().add(optionInfoBool); - optionInfo.getSiblings().add(new StringTextComponent(")")); - option.getSiblings().add(optionInfo); - } - text.getSiblings().add(option); - - text.getSiblings().add(new StringTextComponent(" (or use command \"/tbm-edit edit category \")")); - - prefix.getSiblings().add(text); - TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); - break; - } - case EDIT_DECISION_ATTACK: - { - StringTextComponent prefix = new StringTextComponent("TBM: "); - prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true)); - StringTextComponent text = new StringTextComponent("decisionAttack: "); - 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.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) - { - text.getSiblings().add(new StringTextComponent(", ")); - } - } - - prefix.getSiblings().add(text); - TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); - break; - } - case EDIT_DECISION_DEFEND: - { - StringTextComponent prefix = new StringTextComponent("TBM: "); - prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true)); - StringTextComponent text = new StringTextComponent("decisionDefend: "); - 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.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) - { - text.getSiblings().add(new StringTextComponent(", ")); - } - } - - prefix.getSiblings().add(text); - TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); - break; - } - case EDIT_DECISION_FLEE: - { - StringTextComponent prefix = new StringTextComponent("TBM: "); - prefix.setStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true)); - StringTextComponent text = new StringTextComponent("decisionFlee: "); - 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.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) - { - text.getSiblings().add(new StringTextComponent(", ")); - } - } - - prefix.getSiblings().add(text); - TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); - break; - } - default: - break; - } - }); - ctx.get().setPacketHandled(true); - } + public static void handle(final PacketEditingMessage pkt, Supplier ctx) { + ctx.get().enqueueWork(() -> { + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> TurnBasedMinecraftMod.proxy.handlePacket(pkt, ctx)); + }); + ctx.get().setPacketHandled(true); } } diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketGeneralMessage.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketGeneralMessage.java index a14392c..374a6b3 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketGeneralMessage.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketGeneralMessage.java @@ -4,12 +4,18 @@ import java.util.function.Supplier; import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod; -import net.minecraft.network.PacketBuffer; -import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.fml.DistExecutor; +import net.minecraftforge.network.NetworkEvent; public class PacketGeneralMessage { String message; + + public String getMessage() { + return message; + } public PacketGeneralMessage() { @@ -21,20 +27,18 @@ public class PacketGeneralMessage this.message = message; } - public static void encode(PacketGeneralMessage pkt, PacketBuffer buf) { + public static void encode(PacketGeneralMessage pkt, FriendlyByteBuf buf) { buf.writeUtf(pkt.message); } - public static PacketGeneralMessage decode(PacketBuffer buf) { + public static PacketGeneralMessage decode(FriendlyByteBuf buf) { return new PacketGeneralMessage(buf.readUtf()); } - public static class Handler { - public static void handle(final PacketGeneralMessage pkt, Supplier ctx) { - ctx.get().enqueueWork(() -> { - TurnBasedMinecraftMod.proxy.displayString(pkt.message); - }); - ctx.get().setPacketHandled(true); - } + public static void handle(final PacketGeneralMessage pkt, Supplier ctx) { + ctx.get().enqueueWork(() -> { + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> TurnBasedMinecraftMod.proxy.handlePacket(pkt, ctx)); + }); + ctx.get().setPacketHandled(true); } } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 99b8c78..55cd457 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -6,7 +6,7 @@ # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml modLoader="javafml" #mandatory # A version range to match for said mod loader - for regular FML @Mod it will be the forge version -loaderVersion="[34,)" #mandatory (34 is current forge version) +loaderVersion="[40,)" #mandatory (34 is current forge version) # A URL to refer people to when problems occur with this mod issueTrackerURL="https://github.com/Stephen-Seo/TurnBasedMinecraftMod/issues" #optional license="MIT" @@ -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.17.2" #mandatory +version="1.18.0" #mandatory # A display name for the mod displayName="TurnBasedMinecraftMod" #mandatory # A URL to query for updates for this mod. See the JSON update specification @@ -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="[36,)" #mandatory + versionRange="[40,)" #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.5,1.17)" + versionRange="[1.18.2,1.19)" ordering="NONE" side="BOTH" diff --git a/src/main/resources/assets/com_burnedkirby_turnbasedminecraft/TBM_Config.toml b/src/main/resources/assets/com_burnedkirby_turnbasedminecraft/TBM_Config.toml index 686f3a8..b5823aa 100644 --- a/src/main/resources/assets/com_burnedkirby_turnbasedminecraft/TBM_Config.toml +++ b/src/main/resources/assets/com_burnedkirby_turnbasedminecraft/TBM_Config.toml @@ -1,6 +1,6 @@ # Please do not change this option, the mod uses this to keep track of what new # changes to add to the config. -version = 6 +version = 7 do_not_overwrite = false [client_config] @@ -98,7 +98,7 @@ creeper_always_allow_damage = true # decision_flee_probability: Percentage of entity choosing to flee on turn. [[server_config.entity]] -name = "net.minecraft.entity.monster.BlazeEntity" +name = "net.minecraft.world.entity.monster.Blaze" attack_power = 5 attack_probability = 50 attack_effect = "fire" @@ -111,7 +111,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.CaveSpiderEntity" +name = "net.minecraft.world.entity.monster.CaveSpider" attack_power = 2 attack_probability = 75 attack_effect = "poison" @@ -124,7 +124,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.CreeperEntity" +name = "net.minecraft.world.entity.monster.Creeper" ignore_battle = false attack_power = 13 attack_probability = 95 @@ -137,7 +137,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.DrownedEntity" +name = "net.minecraft.world.entity.monster.Drowned" attack_power = 3 attack_probability = 70 attack_variance = 2 @@ -149,7 +149,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.ElderGuardianEntity" +name = "net.minecraft.world.entity.monster.ElderGuardian" attack_power = 8 attack_probability = 65 defense_damage = 2 @@ -162,7 +162,7 @@ decision_defend_probability = 20 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.EndermanEntity" +name = "net.minecraft.world.entity.monster.EnderMan" attack_power = 7 attack_probability = 80 evasion = 40 @@ -173,7 +173,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.EndermiteEntity" +name = "net.minecraft.world.entity.monster.Endermite" attack_power = 2 attack_probability = 80 evasion = 40 @@ -184,7 +184,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.EvokerEntity" +name = "net.minecraft.world.entity.monster.Evoker" attack_power = 6 attack_probability = 60 evasion = 35 @@ -195,7 +195,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.GhastEntity" +name = "net.minecraft.world.entity.monster.Ghast" ignore_battle = true attack_power = 13 attack_probability = 20 @@ -207,7 +207,7 @@ decision_defend_probability = 0 decision_flee_probability = 25 [[server_config.entity]] -name = "net.minecraft.entity.monster.GiantEntity" +name = "net.minecraft.world.entity.monster.Giant" attack_power = 11 attack_probability = 35 evasion = 2 @@ -218,7 +218,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.GuardianEntity" +name = "net.minecraft.world.entity.monster.Guardian" attack_power = 6 attack_probability = 55 defense_damage = 2 @@ -231,7 +231,7 @@ decision_defend_probability = 20 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.HoglinEntity" +name = "net.minecraft.world.entity.monster.hoglin.Hoglin" attack_power = 6 attack_variance = 2 attack_probability = 60 @@ -243,7 +243,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.HuskEntity" +name = "net.minecraft.world.entity.monster.Husk" attack_power = 3 attack_probability = 70 attack_effect = "hunger" @@ -256,7 +256,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.IllusionerEntity" +name = "net.minecraft.world.entity.monster.Illusioner" attack_power = 2 attack_probability = 70 attack_variance = 2 @@ -268,7 +268,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.passive.IronGolemEntity" +name = "net.minecraft.world.entity.animal.IronGolem" attack_power = 14 attack_probability = 85 attack_variance = 7 @@ -280,7 +280,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.MagmaCubeEntity" +name = "net.minecraft.world.entity.monster.MagmaCube" attack_power = 3 attack_probability = 35 evasion = 12 @@ -291,7 +291,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.piglin.PiglinEntity" +name = "net.minecraft.world.entity.monster.piglin.Piglin" attack_power = 5 attack_variance = 2 attack_probability = 70 @@ -303,7 +303,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.piglin.PiglinBruteEntity" +name = "net.minecraft.world.entity.monster.piglin.PiglinBrute" attack_power = 10 attack_variance = 2 attack_probability = 75 @@ -315,7 +315,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.PhantomEntity" +name = "net.minecraft.world.entity.monster.Phantom" attack_power = 2 attack_probability = 90 attack_variance = 1 @@ -327,7 +327,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.PillagerEntity" +name = "net.minecraft.world.entity.monster.Pillager" attack_power = 3 attack_probability = 60 attack_variance = 1 @@ -339,7 +339,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.RavagerEntity" +name = "net.minecraft.world.entity.monster.Ravager" attack_power = 12 attack_probability = 70 attack_variance = 4 @@ -351,7 +351,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.ShulkerEntity" +name = "net.minecraft.world.entity.monster.Shulker" attack_power = 4 attack_probability = 80 evasion = 15 @@ -362,7 +362,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.SilverfishEntity" +name = "net.minecraft.world.entity.monster.Silverfish" attack_power = 1 attack_probability = 85 evasion = 37 @@ -373,7 +373,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.SkeletonEntity" +name = "net.minecraft.world.entity.monster.Skeleton" attack_power = 3 attack_probability = 75 attack_variance = 1 @@ -385,7 +385,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.SlimeEntity" +name = "net.minecraft.world.entity.monster.Slime" attack_power = 2 attack_probability = 35 evasion = 10 @@ -396,7 +396,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.SpiderEntity" +name = "net.minecraft.world.entity.monster.Spider" attack_power = 2 attack_probability = 70 evasion = 25 @@ -407,7 +407,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.StrayEntity" +name = "net.minecraft.world.entity.monster.Stray" attack_power = 3 attack_probability = 75 attack_variance = 1 @@ -421,7 +421,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.VexEntity" +name = "net.minecraft.world.entity.monster.Vex" attack_power = 9 attack_probability = 65 evasion = 30 @@ -432,7 +432,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.VindicatorEntity" +name = "net.minecraft.world.entity.monster.Vindicator" attack_power = 13 attack_probability = 70 evasion = 10 @@ -443,7 +443,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.WitchEntity" +name = "net.minecraft.world.entity.monster.Witch" attack_power = 5 attack_probability = 75 attack_variance = 1 @@ -455,7 +455,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.WitherSkeletonEntity" +name = "net.minecraft.world.entity.monster.WitherSkeleton" attack_power = 8 attack_probability = 70 attack_effect = "wither" @@ -468,7 +468,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.ZoglinEntity" +name = "net.minecraft.world.entity.monster.Zoglin" attack_power = 6 attack_variance = 2 attack_probability = 60 @@ -480,7 +480,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.ZombieEntity" +name = "net.minecraft.world.entity.monster.Zombie" attack_power = 3 attack_probability = 70 evasion = 5 @@ -491,7 +491,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.ZombifiedPiglinEntity" +name = "net.minecraft.world.entity.monster.ZombifiedPiglin" attack_power = 8 attack_probability = 70 evasion = 10 @@ -502,7 +502,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.monster.ZombieVillagerEntity" +name = "net.minecraft.world.entity.monster.ZombieVillager" attack_power = 3 attack_probability = 70 evasion = 5 @@ -513,7 +513,18 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.passive.BatEntity" +name = "net.minecraft.world.entity.animal.axolotl.Axolotl" +attack_power = 2 +attack_probability = 70 +evasion = 25 +category = "passive" +speed = 65 +decision_attack_probability = 70 +decision_defend_probability = 20 +decision_flee_probability = 10 + +[[server_config.entity]] +name = "net.minecraft.world.entity.ambient.Bat" attack_power = 0 attack_probability = 70 evasion = 35 @@ -524,7 +535,7 @@ decision_defend_probability = 0 decision_flee_probability = 90 [[server_config.entity]] -name = "net.minecraft.entity.passive.BeeEntity" +name = "net.minecraft.world.entity.animal.Bee" attack_power = 2 attack_probability = 65 evasion = 30 @@ -537,107 +548,7 @@ attack_effect = "poison" attack_effect_probability = 50 [[server_config.entity]] -name = "net.minecraft.entity.passive.ChickenEntity" -attack_power = 0 -attack_probability = 70 -evasion = 10 -category = "passive" -speed = 35 -decision_attack_probability = 0 -decision_defend_probability = 0 -decision_flee_probability = 90 - -[[server_config.entity]] -name = "net.minecraft.entity.passive.CowEntity" -attack_power = 0 -attack_probability = 50 -evasion = 1 -category = "passive" -speed = 20 -decision_attack_probability = 0 -decision_defend_probability = 10 -decision_flee_probability = 80 - -[[server_config.entity]] -name = "net.minecraft.entity.passive.DolphinEntity" -attack_power = 3 -attack_probability = 80 -attack_variance = 1 -evasion = 45 -category = "passive" -speed = 75 -decision_attack_probability = 70 -decision_defend_probability = 0 -decision_flee_probability = 30 - -[[server_config.entity]] -name = "net.minecraft.entity.passive.FoxEntity" -attack_power = 2 -attack_probability = 70 -evasion = 65 -category = "animal" -speed = 65 -decision_attack_probability = 70 -decision_defend_probability = 0 -decision_flee_probability = 25 - -[[server_config.entity]] -name = "net.minecraft.entity.passive.horse.DonkeyEntity" -attack_power = 0 -attack_probability = 70 -evasion = 10 -category = "passive" -speed = 65 -decision_attack_probability = 0 -decision_defend_probability = 0 -decision_flee_probability = 90 - -[[server_config.entity]] -name = "net.minecraft.entity.passive.horse.HorseEntity" -attack_power = 0 -attack_probability = 70 -evasion = 10 -category = "passive" -speed = 65 -decision_attack_probability = 0 -decision_defend_probability = 0 -decision_flee_probability = 90 - -[[server_config.entity]] -name = "net.minecraft.entity.passive.horse.LlamaEntity" -attack_power = 1 -attack_probability = 70 -evasion = 10 -category = "passive" -speed = 50 -decision_attack_probability = 65 -decision_defend_probability = 0 -decision_flee_probability = 25 - -[[server_config.entity]] -name = "net.minecraft.entity.passive.MooshroomEntity" -attack_power = 0 -attack_probability = 70 -evasion = 1 -category = "passive" -speed = 20 -decision_attack_probability = 0 -decision_defend_probability = 10 -decision_flee_probability = 80 - -[[server_config.entity]] -name = "net.minecraft.entity.passive.horse.MuleEntity" -attack_power = 0 -attack_probability = 70 -evasion = 10 -category = "passive" -speed = 50 -decision_attack_probability = 0 -decision_defend_probability = 0 -decision_flee_probability = 90 - -[[server_config.entity]] -name = "net.minecraft.entity.passive.OcelotEntity" +name = "net.minecraft.world.entity.animal.Cat" attack_power = 1 attack_probability = 70 attack_variance = 1 @@ -649,106 +560,85 @@ decision_defend_probability = 0 decision_flee_probability = 90 [[server_config.entity]] -name = "net.minecraft.entity.passive.PandaEntity" -attack_power = 6 -attack_probability = 60 +name = "net.minecraft.world.entity.animal.Chicken" +attack_power = 0 +attack_probability = 70 evasion = 10 category = "passive" -speed = 30 -decision_attack_probability = 45 -decision_defend_probability = 25 +speed = 35 +decision_attack_probability = 0 +decision_defend_probability = 0 +decision_flee_probability = 90 + +[[server_config.entity]] +name = "net.minecraft.world.entity.animal.Cow" +attack_power = 0 +attack_probability = 50 +evasion = 1 +category = "passive" +speed = 20 +decision_attack_probability = 0 +decision_defend_probability = 10 +decision_flee_probability = 80 + +[[server_config.entity]] +name = "net.minecraft.world.entity.animal.Dolphin" +attack_power = 3 +attack_probability = 80 +attack_variance = 1 +evasion = 45 +category = "passive" +speed = 75 +decision_attack_probability = 70 +decision_defend_probability = 0 decision_flee_probability = 30 [[server_config.entity]] -name = "net.minecraft.entity.passive.ParrotEntity" -attack_power = 0 +name = "net.minecraft.world.entity.animal.Fox" +attack_power = 2 attack_probability = 70 -evasion = 35 -category = "passive" -speed = 70 -decision_attack_probability = 0 +evasion = 65 +category = "animal" +speed = 65 +decision_attack_probability = 70 decision_defend_probability = 0 -decision_flee_probability = 90 +decision_flee_probability = 25 [[server_config.entity]] -name = "net.minecraft.entity.passive.PigEntity" +name = "net.minecraft.world.entity.animal.horse.Donkey" attack_power = 0 attack_probability = 70 evasion = 10 category = "passive" -speed = 30 -decision_attack_probability = 0 -decision_defend_probability = 5 -decision_flee_probability = 85 - -[[server_config.entity]] -name = "net.minecraft.entity.passive.PolarBearEntity" -attack_power = 6 -attack_probability = 67 -evasion = 5 -category = "animal" -speed = 35 -decision_attack_probability = 100 -decision_defend_probability = 0 -decision_flee_probability = 0 - -[[server_config.entity]] -name = "net.minecraft.entity.passive.RabbitEntity" -attack_power = 0 -attack_probability = 70 -evasion = 40 -category = "passive" -speed = 75 -decision_attack_probability = 0 -decision_defend_probability = 0 -decision_flee_probability = 100 - -[[server_config.entity]] -name = "net.minecraft.entity.passive.SheepEntity" -attack_power = 0 -attack_probability = 70 -evasion = 5 -category = "passive" -speed = 30 -decision_attack_probability = 0 -decision_defend_probability = 0 -decision_flee_probability = 90 - -[[server_config.entity]] -name = "net.minecraft.entity.passive.horse.SkeletonHorseEntity" -attack_power = 0 -attack_probability = 70 -evasion = 5 -category = "passive" speed = 65 decision_attack_probability = 0 decision_defend_probability = 0 decision_flee_probability = 90 [[server_config.entity]] -name = "net.minecraft.entity.passive.SnowGolemEntity" -attack_power = 0 -attack_probability = 80 -evasion = 5 -category = "passive" -speed = 60 -decision_attack_probability = 100 -decision_defend_probability = 0 -decision_flee_probability = 0 - -[[server_config.entity]] -name = "net.minecraft.entity.passive.SquidEntity" +name = "net.minecraft.world.entity.animal.horse.Horse" attack_power = 0 attack_probability = 70 -evasion = 15 +evasion = 10 category = "passive" -speed = 40 +speed = 65 decision_attack_probability = 0 decision_defend_probability = 0 decision_flee_probability = 90 [[server_config.entity]] -name = "net.minecraft.entity.passive.horse.TraderLlamaEntity" +name = "net.minecraft.world.entity.animal.goat.Goat" +attack_power = 2 +attack_probability = 70 +evasion = 30 +category = "passive" +speed = 60 +decision_attack_probability = 75 +decision_defend_probability = 20 +decision_flee_probability = 5 + +[[server_config.entity]] +name = "net.minecraft.world.entity.animal.horse.Llama" attack_power = 1 attack_probability = 70 evasion = 10 @@ -759,7 +649,151 @@ decision_defend_probability = 0 decision_flee_probability = 25 [[server_config.entity]] -name = "net.minecraft.entity.merchant.villager.VillagerEntity" +name = "net.minecraft.world.entity.animal.MushroomCow" +attack_power = 0 +attack_probability = 70 +evasion = 1 +category = "passive" +speed = 20 +decision_attack_probability = 0 +decision_defend_probability = 10 +decision_flee_probability = 80 + +[[server_config.entity]] +name = "net.minecraft.world.entity.animal.horse.Mule" +attack_power = 0 +attack_probability = 70 +evasion = 10 +category = "passive" +speed = 50 +decision_attack_probability = 0 +decision_defend_probability = 0 +decision_flee_probability = 90 + +[[server_config.entity]] +name = "net.minecraft.world.entity.animal.Ocelot" +attack_power = 1 +attack_probability = 70 +attack_variance = 1 +evasion = 30 +category = "passive" +speed = 75 +decision_attack_probability = 0 +decision_defend_probability = 0 +decision_flee_probability = 90 + +[[server_config.entity]] +name = "net.minecraft.world.entity.animal.Panda" +attack_power = 6 +attack_probability = 60 +evasion = 10 +category = "passive" +speed = 30 +decision_attack_probability = 45 +decision_defend_probability = 25 +decision_flee_probability = 30 + +[[server_config.entity]] +name = "net.minecraft.world.entity.animal.Parrot" +attack_power = 0 +attack_probability = 70 +evasion = 35 +category = "passive" +speed = 70 +decision_attack_probability = 0 +decision_defend_probability = 0 +decision_flee_probability = 90 + +[[server_config.entity]] +name = "net.minecraft.world.entity.animal.Pig" +attack_power = 0 +attack_probability = 70 +evasion = 10 +category = "passive" +speed = 30 +decision_attack_probability = 0 +decision_defend_probability = 5 +decision_flee_probability = 85 + +[[server_config.entity]] +name = "net.minecraft.world.entity.animal.PolarBear" +attack_power = 6 +attack_probability = 67 +evasion = 5 +category = "animal" +speed = 35 +decision_attack_probability = 100 +decision_defend_probability = 0 +decision_flee_probability = 0 + +[[server_config.entity]] +name = "net.minecraft.world.entity.animal.Rabbit" +attack_power = 0 +attack_probability = 70 +evasion = 40 +category = "passive" +speed = 75 +decision_attack_probability = 0 +decision_defend_probability = 0 +decision_flee_probability = 100 + +[[server_config.entity]] +name = "net.minecraft.world.entity.animal.Sheep" +attack_power = 0 +attack_probability = 70 +evasion = 5 +category = "passive" +speed = 30 +decision_attack_probability = 0 +decision_defend_probability = 0 +decision_flee_probability = 90 + +[[server_config.entity]] +name = "net.minecraft.world.entity.animal.horse.SkeletonHorse" +attack_power = 0 +attack_probability = 70 +evasion = 5 +category = "passive" +speed = 65 +decision_attack_probability = 0 +decision_defend_probability = 0 +decision_flee_probability = 90 + +[[server_config.entity]] +name = "net.minecraft.world.entity.animal.SnowGolem" +attack_power = 0 +attack_probability = 80 +evasion = 5 +category = "passive" +speed = 60 +decision_attack_probability = 100 +decision_defend_probability = 0 +decision_flee_probability = 0 + +[[server_config.entity]] +name = "net.minecraft.world.entity.animal.Squid" +attack_power = 0 +attack_probability = 70 +evasion = 15 +category = "passive" +speed = 40 +decision_attack_probability = 0 +decision_defend_probability = 0 +decision_flee_probability = 90 + +[[server_config.entity]] +name = "net.minecraft.world.entity.animal.horse.TraderLlama" +attack_power = 1 +attack_probability = 70 +evasion = 10 +category = "passive" +speed = 50 +decision_attack_probability = 65 +decision_defend_probability = 0 +decision_flee_probability = 25 + +[[server_config.entity]] +name = "net.minecraft.world.entity.npc.Villager" attack_power = 0 attack_probability = 70 evasion = 5 @@ -770,7 +804,7 @@ decision_defend_probability = 10 decision_flee_probability = 80 [[server_config.entity]] -name = "net.minecraft.entity.passive.WolfEntity" +name = "net.minecraft.world.entity.animal.Wolf" attack_power = 4 attack_probability = 70 evasion = 20 @@ -781,7 +815,7 @@ decision_defend_probability = 15 decision_flee_probability = 5 [[server_config.entity]] -name = "net.minecraft.entity.passive.horse.ZombieHorseEntity" +name = "net.minecraft.world.entity.animal.horse.ZombieHorse" attack_power = 0 attack_probability = 70 evasion = 8 @@ -792,7 +826,7 @@ decision_defend_probability = 0 decision_flee_probability = 90 [[server_config.entity]] -name = "net.minecraft.entity.passive.fish.CodEntity" +name = "net.minecraft.world.entity.animal.Cod" attack_power = 0 attack_probability = 50 evasion = 50 @@ -803,7 +837,7 @@ decision_defend_probability = 0 decision_flee_probability = 75 [[server_config.entity]] -name = "net.minecraft.entity.passive.fish.PufferfishEntity" +name = "net.minecraft.world.entity.animal.Pufferfish" attack_power = 0 attack_probability = 50 defense_damage = 3 @@ -816,7 +850,7 @@ decision_defend_probability = 0 decision_flee_probability = 65 [[server_config.entity]] -name = "net.minecraft.entity.passive.fish.SalmonEntity" +name = "net.minecraft.world.entity.animal.Salmon" attack_power = 0 attack_probability = 50 evasion = 50 @@ -827,7 +861,7 @@ decision_defend_probability = 0 decision_flee_probability = 75 [[server_config.entity]] -name = "net.minecraft.entity.passive.StriderEntity" +name = "net.minecraft.world.entity.monster.Strider" attack_power = 0 attack_probability = 50 evasion = 35 @@ -838,7 +872,7 @@ decision_defend_probability = 10 decision_flee_probability = 90 [[server_config.entity]] -name = "net.minecraft.entity.passive.fish.TropicalFishEntity" +name = "net.minecraft.world.entity.animal.TropicalFish" attack_power = 0 attack_probability = 50 evasion = 50 @@ -849,7 +883,7 @@ decision_defend_probability = 0 decision_flee_probability = 75 [[server_config.entity]] -name = "net.minecraft.entity.passive.TurtleEntity" +name = "net.minecraft.world.entity.animal.Turtle" attack_power = 0 attack_probability = 20 evasion = 35 @@ -860,7 +894,7 @@ decision_defend_probability = 40 decision_flee_probability = 60 [[server_config.entity]] -name = "net.minecraft.entity.merchant.villager.WanderingTraderEntity" +name = "net.minecraft.world.entity.npc.WanderingTrader" attack_power = 0 attack_probability = 70 evasion = 5 @@ -871,7 +905,7 @@ decision_defend_probability = 10 decision_flee_probability = 80 [[server_config.entity]] -name = "net.minecraft.entity.boss.dragon.EnderDragonEntity" +name = "net.minecraft.world.entity.boss.enderdragon.EnderDragon" attack_power = 10 attack_probability = 70 attack_variance = 2 @@ -883,7 +917,7 @@ decision_defend_probability = 0 decision_flee_probability = 0 [[server_config.entity]] -name = "net.minecraft.entity.boss.WitherEntity" +name = "net.minecraft.world.entity.boss.wither.WitherBoss" attack_power = 8 attack_probability = 70 attack_effect = "wither" diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index b61db10..14779bf 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,8 +3,8 @@ "modid": "com_burnedkirby_turnbasedminecraft", "name": "Turn Based Minecraft", "description": "Changes battles to be turn-based.", - "version": "1.17.2", - "mcversion": "1.16.3", + "version": "1.18.0", + "mcversion": "1.18.2", "url": "", "updateUrl": "", "authorList": ["Stephen Seo"],