v1.23.0, forge 1.20.1-47.1.0
This commit is contained in:
parent
8e8771dfc6
commit
fab8e2d4a0
19 changed files with 653 additions and 438 deletions
11
Changelog.md
11
Changelog.md
|
@ -1,5 +1,16 @@
|
|||
# Upcoming changes
|
||||
|
||||
# Version 1.23.0
|
||||
|
||||
Support reproducible builds. This means that if this mod is compiled, then it
|
||||
should be byte-by-byte exactly the same as another compiled jar (assuming it
|
||||
was compiled with the same version of Java and same mod version.)
|
||||
|
||||
Update to Forge 1.20.1-47.1.0.
|
||||
|
||||
Experimental support for "use item" for unrecognized items. Note that this uses
|
||||
the Minecraft API's `Item.finishUsingItem(...)`.
|
||||
|
||||
# Version 1.22.0
|
||||
|
||||
Update to Forge 1.19.3-44.1.0.
|
||||
|
|
|
@ -58,7 +58,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/libs/TurnBasedMinecraft-1.22.0.jar"
|
||||
finished jar will be saved at "build/libs/TurnBasedMinecraft-1.23.0.jar"
|
||||
|
||||
# Other notes
|
||||
|
||||
|
|
50
build.gradle
50
build.gradle
|
@ -1,20 +1,12 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
maven { url = "https://maven.minecraftforge.net" }
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
dependencies {
|
||||
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '6.0.6'
|
||||
classpath 'com.github.johnrengelman:shadow:8.1.1'
|
||||
}
|
||||
plugins {
|
||||
id 'eclipse'
|
||||
id 'idea'
|
||||
id 'maven-publish'
|
||||
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
|
||||
id 'com.github.johnrengelman.shadow' version '8.1.1'
|
||||
}
|
||||
apply plugin: 'net.minecraftforge.gradle'
|
||||
//apply plugin: 'eclipse'
|
||||
//apply plugin: 'maven-publish'
|
||||
|
||||
version = "1.22.0"
|
||||
version = "1.23.0"
|
||||
group = "com.burnedkirby.TurnBasedMinecraft"
|
||||
archivesBaseName = "TurnBasedMinecraft"
|
||||
|
||||
|
@ -27,11 +19,16 @@ minecraft {
|
|||
// stable_# Stables are built at the discretion of the MCP team.
|
||||
// Use non-default mappings at your own risk. they may not always work.
|
||||
// Simply re-run your setup task after changing the mappings to update your workspace.
|
||||
mappings channel: 'official', version: '1.19.3'
|
||||
mappings channel: mapping_channel, version: mapping_version
|
||||
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
||||
|
||||
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
|
||||
// This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game.
|
||||
// It is REQUIRED to be set to true for this template to function.
|
||||
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
||||
copyIdeResources = true
|
||||
|
||||
// Default run configurations.
|
||||
// These can be tweaked, removed, or duplicated as needed.
|
||||
runs {
|
||||
|
@ -151,7 +148,7 @@ 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.19.3-44.1.1'
|
||||
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
||||
|
||||
// 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
|
||||
|
@ -169,6 +166,25 @@ dependencies {
|
|||
shade files('libs/javamp3-1.0.3.jar')
|
||||
}
|
||||
|
||||
// This block of code expands all declared replace properties in the specified resource targets.
|
||||
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
|
||||
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
|
||||
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
||||
tasks.named('processResources', ProcessResources).configure {
|
||||
var replaceProperties = [
|
||||
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
|
||||
forge_version: forge_version, forge_version_range: forge_version_range,
|
||||
loader_version_range: loader_version_range,
|
||||
mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
|
||||
mod_authors: mod_authors, mod_description: mod_description,
|
||||
]
|
||||
inputs.properties replaceProperties
|
||||
|
||||
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
|
||||
expand replaceProperties + [project: project]
|
||||
}
|
||||
}
|
||||
|
||||
// Example for how to get properties into the manifest for reading by the runtime..
|
||||
jar {
|
||||
archiveClassifier = 'slim'
|
||||
|
|
|
@ -1 +1,55 @@
|
|||
org.gradle.jvmargs=-Xmx4096m
|
||||
org.gradle.daemon=false
|
||||
|
||||
## Environment Properties
|
||||
|
||||
# The Minecraft version must agree with the Forge version to get a valid artifact
|
||||
minecraft_version=1.20.1
|
||||
# The Minecraft version range can use any release version of Minecraft as bounds.
|
||||
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
|
||||
# as they do not follow standard versioning conventions.
|
||||
minecraft_version_range=[1.20.1,1.21)
|
||||
# The Forge version must agree with the Minecraft version to get a valid artifact
|
||||
forge_version=47.1.0
|
||||
# The Forge version range can use any version of Forge as bounds or match the loader version range
|
||||
forge_version_range=[47,)
|
||||
# The loader version range can only use the major version of Forge/FML as bounds
|
||||
loader_version_range=[47,)
|
||||
# The mapping channel to use for mappings.
|
||||
# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"].
|
||||
# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin.
|
||||
#
|
||||
# | Channel | Version | |
|
||||
# |-----------|----------------------|--------------------------------------------------------------------------------|
|
||||
# | official | MCVersion | Official field/method names from Mojang mapping files |
|
||||
# | parchment | YYYY.MM.DD-MCVersion | Open community-sourced parameter names and javadocs layered on top of official |
|
||||
#
|
||||
# You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
|
||||
# See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
|
||||
#
|
||||
# Parchment is an unofficial project maintained by ParchmentMC, separate from Minecraft Forge.
|
||||
# Additional setup is needed to use their mappings, see https://parchmentmc.org/docs/getting-started
|
||||
mapping_channel=official
|
||||
# The mapping version to query from the mapping channel.
|
||||
# This must match the format required by the mapping channel.
|
||||
mapping_version=1.20.1
|
||||
|
||||
## Mod Properties
|
||||
|
||||
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
|
||||
# Must match the String constant located in the main mod class annotated with @Mod.
|
||||
mod_id=com_burnedkirby_turnbasedminecraft
|
||||
# The human-readable display name for the mod.
|
||||
mod_name=TurnBasedMinecraftMod
|
||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=MIT
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=1.23.0
|
||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||
# This should match the base package used for the mod sources.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
#mod_group_id=com.example.examplemod
|
||||
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
|
||||
mod_authors=BurnedKirby a.k.a. Stephen Seo
|
||||
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
|
||||
mod_description=Implements turn-based-battle in Minecraft.
|
||||
|
|
15
settings.gradle
Normal file
15
settings.gradle
Normal file
|
@ -0,0 +1,15 @@
|
|||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven {
|
||||
name = 'MinecraftForge'
|
||||
url = 'https://maven.minecraftforge.net/'
|
||||
}
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
|
||||
}
|
|
@ -7,6 +7,7 @@ import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod;
|
|||
import com.burnedkirby.TurnBasedMinecraft.common.networking.PacketBattleDecision;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.components.AbstractButton;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
|
@ -224,10 +225,10 @@ public class BattleGui extends Screen {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTicks) {
|
||||
public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {
|
||||
if (TurnBasedMinecraftMod.proxy.getLocalBattle() == null) {
|
||||
// drawHoveringText("Waiting...", width / 2 - 50, height / 2);
|
||||
drawString(poseStack, "Waiting...", width / 2 - 50, height / 2, 0xFFFFFFFF);
|
||||
drawString(guiGraphics, "Waiting...", width / 2 - 50, height / 2, 0xFFFFFFFF);
|
||||
return;
|
||||
}
|
||||
if (TurnBasedMinecraftMod.proxy.getLocalBattle().getState() == Battle.State.DECISION
|
||||
|
@ -243,7 +244,7 @@ public class BattleGui extends Screen {
|
|||
|
||||
updateState();
|
||||
|
||||
super.render(poseStack, mouseX, mouseY, partialTicks);
|
||||
super.render(guiGraphics, mouseX, mouseY, partialTicks);
|
||||
|
||||
String timeRemainingString = "Time remaining: ";
|
||||
int timeRemainingInt = timeRemaining.get();
|
||||
|
@ -261,11 +262,11 @@ public class BattleGui extends Screen {
|
|||
timeRemainingString += Integer.toString(timeRemainingInt);
|
||||
}
|
||||
int stringWidth = font.width(timeRemainingString);
|
||||
fill(poseStack, width / 2 - stringWidth / 2, 5, width / 2 + stringWidth / 2, 15, 0x70000000);
|
||||
drawString(poseStack, timeRemainingString, width / 2 - stringWidth / 2, 5, 0xFFFFFFFF);
|
||||
guiGraphics.fill(width / 2 - stringWidth / 2, 5, width / 2 + stringWidth / 2, 15, 0x70000000);
|
||||
drawString(guiGraphics, timeRemainingString, width / 2 - stringWidth / 2, 5, 0xFFFFFFFF);
|
||||
stringWidth = font.width(info);
|
||||
fill(poseStack, width / 2 - stringWidth / 2, 20, width / 2 + stringWidth / 2, 30, 0x70000000);
|
||||
drawString(poseStack, info, width / 2 - stringWidth / 2, 20, 0xFFFFFFFF);
|
||||
guiGraphics.fill(width / 2 - stringWidth / 2, 20, width / 2 + stringWidth / 2, 30, 0x70000000);
|
||||
drawString(guiGraphics, info, width / 2 - stringWidth / 2, 20, 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
protected void buttonActionEvent(AbstractButton button, ButtonAction action) {
|
||||
|
@ -356,8 +357,8 @@ public class BattleGui extends Screen {
|
|||
timeRemaining.set(remaining);
|
||||
}
|
||||
|
||||
private void drawString(PoseStack poseStack, String string, int x, int y, int color) {
|
||||
font.draw(poseStack, string, x, y, color);
|
||||
private void drawString(GuiGraphics guiGraphics, String string, int x, int y, int color) {
|
||||
guiGraphics.drawString(font, string, x, y, color);
|
||||
}
|
||||
|
||||
public void setTurnTimerEnabled(boolean enabled) {
|
||||
|
|
|
@ -333,12 +333,12 @@ public class ClientProxy extends CommonProxy {
|
|||
break;
|
||||
case USED_INVALID:
|
||||
if (pkt.getCustom().length() > 0) {
|
||||
parentComponent.getSiblings().add(Component.literal(" tried to consume "));
|
||||
parentComponent.getSiblings().add(Component.literal(" tried to use "));
|
||||
parentComponent.getSiblings().add(Component.literal(pkt.getCustom()));
|
||||
parentComponent.getSiblings().add(Component.literal(" and failed!"));
|
||||
parentComponent.getSiblings().add(Component.literal("!"));
|
||||
TurnBasedMinecraftMod.proxy.displayComponent(parentComponent);
|
||||
} else {
|
||||
parentComponent.getSiblings().add(Component.literal(" tried to consume an invalid item and failed!"));
|
||||
parentComponent.getSiblings().add(Component.literal(" tried to use an item!"));
|
||||
TurnBasedMinecraftMod.proxy.displayComponent(parentComponent);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.burnedkirby.TurnBasedMinecraft.common.CommonProxy;
|
|||
import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.components.AbstractButton;
|
||||
import net.minecraft.client.gui.narration.NarratedElementType;
|
||||
import net.minecraft.client.gui.narration.NarrationElementOutput;
|
||||
|
@ -39,8 +40,8 @@ public class EntitySelectionButton extends AbstractButton {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(PoseStack poseStack, int mouseX, int mouseY, float partialTicks) {
|
||||
super.renderButton(poseStack, mouseX, mouseY, partialTicks);
|
||||
public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(guiGraphics, 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);
|
||||
|
@ -54,38 +55,38 @@ public class EntitySelectionButton extends AbstractButton {
|
|||
xoffset = -4;
|
||||
}
|
||||
if (health > 200) {
|
||||
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);
|
||||
guiGraphics.fill(xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000);
|
||||
guiGraphics.fill(xpos, getY() + getHeight() * 3 / 5, xpos + 2, getY() + getHeight() * 4 / 5, 0xFFFFFF00);
|
||||
guiGraphics.fill(xpos, getY() + getHeight() * 2 / 5, xpos + 2, getY() + getHeight() * 3 / 5, 0xFF00FF00);
|
||||
guiGraphics.fill(xpos, getY() + getHeight() / 5, xpos + 2, getY() + getHeight() * 2 / 5, 0xFF00FFFF);
|
||||
guiGraphics.fill(xpos, getY(), xpos + 2, getY() + getHeight() / 5, 0xFF0000FF);
|
||||
int healthHeight = ((health - 200) * getHeight() / 100);
|
||||
fill(poseStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFFFFFFFF);
|
||||
guiGraphics.fill(xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFFFFFFFF);
|
||||
} else if (health > 100) {
|
||||
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);
|
||||
guiGraphics.fill(xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000);
|
||||
guiGraphics.fill(xpos, getY() + getHeight() * 3 / 5, xpos + 2, getY() + getHeight() * 4 / 5, 0xFFFFFF00);
|
||||
guiGraphics.fill(xpos, getY() + getHeight() * 2 / 5, xpos + 2, getY() + getHeight() * 3 / 5, 0xFF00FF00);
|
||||
guiGraphics.fill(xpos, getY() + getHeight() / 5, xpos + 2, getY() + getHeight() * 2 / 5, 0xFF00FFFF);
|
||||
int healthHeight = ((health - 100) * getHeight() / 100);
|
||||
fill(poseStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFF0000FF);
|
||||
guiGraphics.fill(xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFF0000FF);
|
||||
} else if (health > 50) {
|
||||
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);
|
||||
guiGraphics.fill(xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000);
|
||||
guiGraphics.fill(xpos, getY() + getHeight() * 3 / 5, xpos + 2, getY() + getHeight() * 4 / 5, 0xFFFFFF00);
|
||||
guiGraphics.fill(xpos, getY() + getHeight() * 2 / 5, xpos + 2, getY() + getHeight() * 3 / 5, 0xFF00FF00);
|
||||
int healthHeight = ((health - 50) * getHeight() / 50);
|
||||
fill(poseStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFF00FFFF);
|
||||
guiGraphics.fill(xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFF00FFFF);
|
||||
} else if (health > 20) {
|
||||
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);
|
||||
guiGraphics.fill(xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000);
|
||||
guiGraphics.fill(xpos, getY() + getHeight() * 3 / 5, xpos + 2, getY() + getHeight() * 4 / 5, 0xFFFFFF00);
|
||||
int healthHeight = ((health - 20) * getHeight() / 30);
|
||||
fill(poseStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFF00FF00);
|
||||
guiGraphics.fill(xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFF00FF00);
|
||||
} else if (health > 10) {
|
||||
fill(poseStack, xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000);
|
||||
guiGraphics.fill(xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000);
|
||||
int healthHeight = ((health - 10) * getHeight() / 10);
|
||||
fill(poseStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFFFFFF00);
|
||||
guiGraphics.fill(xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFFFFFF00);
|
||||
} else {
|
||||
int healthHeight = (health * getHeight() / 10);
|
||||
fill(poseStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFFFF0000);
|
||||
guiGraphics.fill(xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFFFF0000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.burnedkirby.TurnBasedMinecraft.client;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.components.AbstractButton;
|
||||
import net.minecraft.client.gui.narration.NarratedElementType;
|
||||
import net.minecraft.client.gui.narration.NarrationElementOutput;
|
||||
|
@ -22,13 +23,13 @@ public class ItemSelectionButton extends AbstractButton {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(PoseStack poseStack, int mouseX, int mouseY, float partialTicks) {
|
||||
public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float unk) {
|
||||
if (visible) {
|
||||
boolean hovered = mouseX >= getX() && mouseY >= getY() && mouseX < getX() + getWidth() && mouseY < getY() + getHeight();
|
||||
if (hovered) {
|
||||
fill(poseStack, getX(), getY(), getX() + getWidth(), getY() + getHeight(), 0x80FFFFFF);
|
||||
guiGraphics.fill(getX(), getY(), getX() + getWidth(), getY() + getHeight(), 0x80FFFFFF);
|
||||
} else {
|
||||
fill(poseStack, getX(), getY(), getX() + getWidth(), getY() + getHeight(), 0x20707070);
|
||||
guiGraphics.fill(getX(), getY(), getX() + getWidth(), getY() + getHeight(), 0x20707070);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.burnedkirby.TurnBasedMinecraft.common.networking.PacketBattleMessage;
|
|||
|
||||
import com.burnedkirby.TurnBasedMinecraft.common.networking.PacketEditingMessage;
|
||||
import com.burnedkirby.TurnBasedMinecraft.common.networking.PacketGeneralMessage;
|
||||
import net.minecraft.world.damagesource.DamageTypes;
|
||||
import net.minecraft.world.entity.monster.Creeper;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
|
@ -38,7 +39,7 @@ public class AttackEventHandler
|
|||
{
|
||||
iter.remove();
|
||||
}
|
||||
else if(event.getSource().getEntity().equals(attacker.entity) && event.getSource().isProjectile())
|
||||
else if(event.getSource().getEntity().equals(attacker.entity) && event.getSource().is(DamageTypes.ARROW))
|
||||
{
|
||||
iter.remove();
|
||||
if(!isValid)
|
||||
|
@ -60,7 +61,7 @@ public class AttackEventHandler
|
|||
@SubscribeEvent
|
||||
public void entityAttacked(LivingAttackEvent event)
|
||||
{
|
||||
if(event.getEntity().level.isClientSide)
|
||||
if(event.getEntity().level().isClientSide)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -130,7 +131,7 @@ public class AttackEventHandler
|
|||
&& event.getEntity() != event.getSource().getEntity()
|
||||
&& !config.getBattleIgnoringPlayers().contains(event.getSource().getEntity().getId())
|
||||
&& !config.getBattleIgnoringPlayers().contains(event.getEntity().getId())
|
||||
&& event.getEntity().level.dimension().equals(event.getSource().getEntity().level.dimension())
|
||||
&& event.getEntity().level().dimension().equals(event.getSource().getEntity().level().dimension())
|
||||
&& battleManager.checkAttack(event))
|
||||
{
|
||||
// TurnBasedMinecraftMod.logger.debug("Canceled LivingAttackEvent between " + TurnBasedMinecraftMod.proxy.getAttackingEntity() + " and " + event.getEntity());
|
||||
|
@ -150,7 +151,7 @@ public class AttackEventHandler
|
|||
{
|
||||
Config config = TurnBasedMinecraftMod.proxy.getConfig();
|
||||
BattleManager battleManager = TurnBasedMinecraftMod.proxy.getBattleManager();
|
||||
if(event.getEntity().level.isClientSide
|
||||
if(event.getEntity().level().isClientSide
|
||||
|| config.isOldBattleBehaviorEnabled()
|
||||
|| (event.getEntity() != null && battleManager.isRecentlyLeftBattle(event.getEntity().getId()))
|
||||
|| (event.getNewTarget() != null && battleManager.isRecentlyLeftBattle(event.getNewTarget().getId()))
|
||||
|
@ -162,7 +163,7 @@ public class AttackEventHandler
|
|||
&& event.getNewTarget() != null
|
||||
&& !config.getBattleIgnoringPlayers().contains(event.getEntity().getId())
|
||||
&& !config.getBattleIgnoringPlayers().contains(event.getNewTarget().getId())
|
||||
&& event.getEntity().level.dimension().equals(event.getNewTarget().level.dimension()))
|
||||
&& event.getEntity().level().dimension().equals(event.getNewTarget().level().dimension()))
|
||||
{
|
||||
TurnBasedMinecraftMod.proxy.getBattleManager().checkTargeted(event);
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ 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.common.CreativeModeTabRegistry;
|
||||
import net.minecraftforge.network.PacketDistributor;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -786,7 +787,7 @@ public class Battle {
|
|||
((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(((Player) 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 {
|
||||
sendMessageToAllPlayers(PacketBattleMessage.MessageType.BOW_NO_AMMO, next.entity.getId(), 0, 0);
|
||||
|
@ -835,7 +836,7 @@ public class Battle {
|
|||
sendMessageToAllPlayers(PacketBattleMessage.MessageType.ATTACK, nextEntity.getId(), targetEntity.getId(), TurnBasedMinecraftMod.proxy.getAttackingDamage());
|
||||
if (defenseDamageTriggered) {
|
||||
// defense damage
|
||||
DamageSource defenseDamageSource = DamageSource.mobAttack((LivingEntity) targetEntity);
|
||||
DamageSource defenseDamageSource = targetEntity.damageSources().mobAttack((LivingEntity) targetEntity);
|
||||
TurnBasedMinecraftMod.proxy.setAttackingEntity(targetEntity);
|
||||
nextEntity.invulnerableTime = 0;
|
||||
nextEntity.hurt(defenseDamageSource, targetEntityInfo.defenseDamage);
|
||||
|
@ -898,7 +899,7 @@ public class Battle {
|
|||
if (random.nextInt(100) < hitChance) {
|
||||
if (target.remainingDefenses <= 0) {
|
||||
debugLog += " hit success";
|
||||
DamageSource damageSource = DamageSource.mobAttack((LivingEntity) next.entity);
|
||||
DamageSource damageSource = next.entity.damageSources().mobAttack((LivingEntity) next.entity);
|
||||
int damageAmount = next.entityInfo.attackPower;
|
||||
if (next.entityInfo.attackVariance > 0) {
|
||||
damageAmount += random.nextInt(next.entityInfo.attackVariance * 2 + 1) - next.entityInfo.attackVariance;
|
||||
|
@ -942,7 +943,7 @@ public class Battle {
|
|||
sendMessageToAllPlayers(PacketBattleMessage.MessageType.ATTACK, nextEntity.getId(), targetEntity.getId(), finalDamageAmount);
|
||||
if (defenseDamageTriggered) {
|
||||
// defense damage
|
||||
DamageSource defenseDamageSource = DamageSource.mobAttack((LivingEntity) targetEntity);
|
||||
DamageSource defenseDamageSource = targetEntity.damageSources().mobAttack((LivingEntity) targetEntity);
|
||||
TurnBasedMinecraftMod.proxy.setAttackingEntity(targetEntity);
|
||||
nextEntity.invulnerableTime = 0;
|
||||
nextEntity.hurt(defenseDamageSource, targetEntityInfo.defenseDamage);
|
||||
|
@ -1068,24 +1069,28 @@ public class Battle {
|
|||
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;
|
||||
((Player) nextEntity).getInventory().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 (CreativeModeTabs.FOOD_AND_DRINKS.contains(targetItemStack) && targetItem.isEdible()) {
|
||||
final CreativeModeTab foodAndDrinksTab = CreativeModeTabRegistry.getTab(CreativeModeTabs.FOOD_AND_DRINKS.location());
|
||||
if (foodAndDrinksTab.contains(targetItemStack) && 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;
|
||||
((Player) nextEntity).getInventory().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;
|
||||
((Player) nextEntity).getInventory().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());
|
||||
final Entity nextEntity = next.entity;
|
||||
final int nextItemToUse = next.itemToUse;
|
||||
((Player)nextEntity).getInventory().setItem(nextItemToUse, targetItem.finishUsingItem(targetItemStack, nextEntity.level(), (LivingEntity) nextEntity));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1149,7 +1154,7 @@ public class Battle {
|
|||
|
||||
TurnBasedMinecraftMod.proxy.setAttackingEntity(nextEntity);
|
||||
targetEntity.invulnerableTime = 0;
|
||||
targetEntity.hurt(DamageSource.mobAttack((LivingEntity) nextEntity), finalDamageAmount);
|
||||
targetEntity.hurt(nextEntity.damageSources().mobAttack((LivingEntity) nextEntity), finalDamageAmount);
|
||||
TurnBasedMinecraftMod.proxy.setAttackingEntity(null);
|
||||
sendMessageToAllPlayers(PacketBattleMessage.MessageType.ATTACK, nextEntity.getId(), targetEntity.getId(), finalDamageAmount);
|
||||
if (attackEffectTriggered) {
|
||||
|
@ -1194,7 +1199,7 @@ public class Battle {
|
|||
|
||||
TurnBasedMinecraftMod.proxy.setAttackingEntity(nextEntity);
|
||||
targetEntity.invulnerableTime = 0;
|
||||
targetEntity.hurt(DamageSource.mobAttack((LivingEntity) nextEntity), finalDamageAmount);
|
||||
targetEntity.hurt(nextEntity.damageSources().mobAttack((LivingEntity) nextEntity), finalDamageAmount);
|
||||
TurnBasedMinecraftMod.proxy.setAttackingEntity(null);
|
||||
sendMessageToAllPlayers(PacketBattleMessage.MessageType.ATTACK, nextEntity.getId(), targetEntity.getId(), finalDamageAmount);
|
||||
if (attackEffectTriggered) {
|
||||
|
|
|
@ -142,7 +142,7 @@ public class BattleManager
|
|||
Collection<Entity> sideB = new ArrayList<Entity>(1);
|
||||
sideA.add(event.getEntity());
|
||||
sideB.add(event.getSource().getEntity());
|
||||
createBattle(sideA, sideB, event.getEntity().level.dimension());
|
||||
createBattle(sideA, sideB, event.getEntity().level().dimension());
|
||||
logger.debug("Attack Not Canceled: new battle created");
|
||||
}
|
||||
else
|
||||
|
@ -251,7 +251,7 @@ public class BattleManager
|
|||
Collection<Entity> sideB = new ArrayList<Entity>(1);
|
||||
sideA.add(event.getEntity());
|
||||
sideB.add(event.getNewTarget());
|
||||
createBattle(sideA, sideB, event.getEntity().level.dimension());
|
||||
createBattle(sideA, sideB, event.getEntity().level().dimension());
|
||||
logger.debug("neither in battle, at least one is player, creating new battle");
|
||||
}
|
||||
} else {
|
||||
|
@ -365,7 +365,7 @@ public class BattleManager
|
|||
public boolean isInBattle(Entity entity) {
|
||||
synchronized(tempIDPair) {
|
||||
tempIDPair.id = entity.getId();
|
||||
tempIDPair.dim = entity.level.dimension();
|
||||
tempIDPair.dim = entity.level().dimension();
|
||||
return entityToBattleMap.keySet().contains(tempIDPair);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import net.minecraftforge.network.PacketDistributor;
|
|||
public class DimensionChangedHandler {
|
||||
@SubscribeEvent
|
||||
public void dimensionChanged(EntityTravelToDimensionEvent event) {
|
||||
if(event.getEntity().level.isClientSide) {
|
||||
if(event.getEntity().level().isClientSide) {
|
||||
return;
|
||||
}
|
||||
if(TurnBasedMinecraftMod.proxy.getBattleManager().forceLeaveBattle(new EntityIDDimPair(event.getEntity()))
|
||||
|
|
|
@ -21,7 +21,7 @@ public class EntityIDDimPair {
|
|||
|
||||
EntityIDDimPair(Entity entity) {
|
||||
id = entity.getId();
|
||||
dim = entity.level.dimension();
|
||||
dim = entity.level().dimension();
|
||||
}
|
||||
|
||||
public Entity getEntity() {
|
||||
|
|
|
@ -7,9 +7,9 @@ public class HurtEventHandler {
|
|||
@SubscribeEvent
|
||||
public void handleHurtEvent(LivingHurtEvent event) {
|
||||
CommonProxy proxy = TurnBasedMinecraftMod.proxy;
|
||||
if (event.getEntity().level.isClientSide || proxy.getBattleManager() == null) {
|
||||
if (event.getEntity().level().isClientSide || proxy.getBattleManager() == null) {
|
||||
return;
|
||||
} else if (proxy.getConfig().getIgnoreHurtDamageSources().contains(event.getSource().msgId) && proxy.getBattleManager().isInBattle(event.getEntity())) {
|
||||
} else if (proxy.getConfig().getIgnoreHurtDamageSources().contains(event.getSource().getMsgId()) && proxy.getBattleManager().isInBattle(event.getEntity())) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.apache.logging.log4j.Logger;
|
|||
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.22.0";
|
||||
public static final String VERSION = "1.23.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/";
|
||||
|
@ -159,7 +159,7 @@ public class TurnBasedMinecraftMod {
|
|||
})
|
||||
.executes(c -> {
|
||||
proxy.getConfig().addBattleIgnoringPlayer(c.getSource().getPlayerOrException().getId());
|
||||
c.getSource().sendSuccess(Component.literal("Disabled turn-based-combat for current player"), true);
|
||||
c.getSource().sendSuccess(() -> Component.literal("Disabled turn-based-combat for current player"), true);
|
||||
return 1;
|
||||
}));
|
||||
// tbm-disable-all
|
||||
|
@ -182,7 +182,7 @@ public class TurnBasedMinecraftMod {
|
|||
.requires(c -> !proxy.getConfig().getIfOnlyOPsCanDisableTurnBasedForSelf() || c.hasPermission(2))
|
||||
.executes(c -> {
|
||||
proxy.getConfig().removeBattleIgnoringPlayer(c.getSource().getPlayerOrException().getId());
|
||||
c.getSource().sendSuccess(Component.literal("Enabled turn-based-combat for current player"), true);
|
||||
c.getSource().sendSuccess(() -> Component.literal("Enabled turn-based-combat for current player"), true);
|
||||
return 1;
|
||||
}));
|
||||
// tbm-enable-all
|
||||
|
@ -205,7 +205,7 @@ public class TurnBasedMinecraftMod {
|
|||
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(Component.literal("Enabled turn-based-combat for " + player.getDisplayName().getString()), true);
|
||||
c.getSource().sendSuccess(() -> Component.literal("Enabled turn-based-combat for " + player.getDisplayName().getString()), true);
|
||||
}
|
||||
return 1;
|
||||
})));
|
||||
|
@ -217,7 +217,7 @@ public class TurnBasedMinecraftMod {
|
|||
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(Component.literal("Disabled turn-based-combat for " + player.getDisplayName().getString()), true);
|
||||
c.getSource().sendSuccess(() -> Component.literal("Disabled turn-based-combat for " + player.getDisplayName().getString()), true);
|
||||
}
|
||||
return 1;
|
||||
})));
|
||||
|
@ -788,13 +788,15 @@ public class TurnBasedMinecraftMod {
|
|||
return 1;
|
||||
})
|
||||
.then(Commands.literal("leave_battle_cooldown").executes(c -> {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("leave_battle_cooldown requires an integer argument. ");
|
||||
MutableComponent subResponse = Component.literal("leave_battle_cooldown is currently: ");
|
||||
response.getSiblings().add(subResponse);
|
||||
subResponse = Component.literal(String.valueOf(TurnBasedMinecraftMod.proxy.getConfig().getLeaveBattleCooldownSeconds()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, false);
|
||||
return response;
|
||||
}, false);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("cooldown_seconds", IntegerArgumentType.integer())
|
||||
|
@ -813,15 +815,18 @@ public class TurnBasedMinecraftMod {
|
|||
+ cooldown
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully set leave_battle_cooldown to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(cooldown));
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(TurnBasedMinecraftMod.proxy.getConfig().getLeaveBattleCooldownSeconds()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("aggro_start_battle_max_distance").executes(c -> {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("aggro_start_battle_max_distance requires an integer argument. ");
|
||||
MutableComponent subResponse = Component.literal("aggro_start_battle_max_distance is currently: ");
|
||||
response.getSiblings().add(subResponse);
|
||||
|
@ -829,7 +834,8 @@ public class TurnBasedMinecraftMod {
|
|||
TurnBasedMinecraftMod.proxy.getConfig().getAggroStartBattleDistance()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, false);
|
||||
return response;
|
||||
}, false);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("aggro_distance", IntegerArgumentType.integer())
|
||||
|
@ -848,15 +854,18 @@ public class TurnBasedMinecraftMod {
|
|||
+ distance
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully set aggro_start_battle_max_distance to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(distance));
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(TurnBasedMinecraftMod.proxy.getConfig().getAggroStartBattleDistance()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("old_battle_behavior").executes(c -> {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("old_battle_behavior requires a boolean argument. ");
|
||||
MutableComponent subResponse = Component.literal("old_battle_behavior is currently: ");
|
||||
response.getSiblings().add(subResponse);
|
||||
|
@ -864,7 +873,8 @@ public class TurnBasedMinecraftMod {
|
|||
TurnBasedMinecraftMod.proxy.getConfig().isOldBattleBehaviorEnabled()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, false);
|
||||
return response;
|
||||
}, false);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("old_battle_behavior_enabled", BoolArgumentType.bool())
|
||||
|
@ -881,15 +891,18 @@ public class TurnBasedMinecraftMod {
|
|||
+ enabled
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully set old_battle_behavior to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(enabled));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("anyone_can_disable_tbm_for_self").executes(c -> {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("anyone_can_disable_tbm_for_self requires a boolean argument. ");
|
||||
MutableComponent subResponse = Component.literal("anyone_can_disable_tbm_for_self is currently: ");
|
||||
response.getSiblings().add(subResponse);
|
||||
|
@ -897,7 +910,8 @@ public class TurnBasedMinecraftMod {
|
|||
!TurnBasedMinecraftMod.proxy.getConfig().getIfOnlyOPsCanDisableTurnBasedForSelf()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, false);
|
||||
return response;
|
||||
}, false);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("enabled_for_all", BoolArgumentType.bool())
|
||||
|
@ -915,15 +929,18 @@ public class TurnBasedMinecraftMod {
|
|||
+ enabled_for_all
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully set anyone_can_disable_tbm_for_self to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(enabled_for_all));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("max_in_battle").executes(c -> {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("max_in_battle requires an integer argument. ");
|
||||
MutableComponent subResponse = Component.literal("max_in_battle is currently: ");
|
||||
response.getSiblings().add(subResponse);
|
||||
|
@ -931,7 +948,8 @@ public class TurnBasedMinecraftMod {
|
|||
TurnBasedMinecraftMod.proxy.getConfig().getMaxInBattle()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, false);
|
||||
return response;
|
||||
}, false);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("max_amount", IntegerArgumentType.integer())
|
||||
|
@ -950,15 +968,18 @@ public class TurnBasedMinecraftMod {
|
|||
+ max_amount
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully set max_in_battle to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(max_amount));
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(TurnBasedMinecraftMod.proxy.getConfig().getMaxInBattle()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("freeze_battle_combatants").executes(c -> {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("freeze_battle_combatants requires a boolean argument. ");
|
||||
MutableComponent subResponse = Component.literal("freeze_battle_combatants is currently: ");
|
||||
response.getSiblings().add(subResponse);
|
||||
|
@ -966,7 +987,8 @@ public class TurnBasedMinecraftMod {
|
|||
!TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, false);
|
||||
return response;
|
||||
}, false);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("freeze_enabled", BoolArgumentType.bool())
|
||||
|
@ -981,15 +1003,18 @@ public class TurnBasedMinecraftMod {
|
|||
+ enabled
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully set freeze_battle_combatants to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(enabled));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("ignore_battle_types").executes(c -> {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Use ");
|
||||
MutableComponent subResponse = Component.literal("/tbm-server-edit ignore_battle_types add/remove <category> ");
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
|
@ -1016,7 +1041,8 @@ public class TurnBasedMinecraftMod {
|
|||
isFirst = false;
|
||||
}
|
||||
response.getSiblings().add(Component.literal("] "));
|
||||
c.getSource().sendSuccess(response, false);
|
||||
return response;
|
||||
}, false);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.literal("add").executes(c -> {
|
||||
|
@ -1027,6 +1053,8 @@ public class TurnBasedMinecraftMod {
|
|||
String category = StringArgumentType.getString(c, "category");
|
||||
if (TurnBasedMinecraftMod.proxy.getConfig().addIgnoreBattleType(category)
|
||||
&& TurnBasedMinecraftMod.proxy.getConfig().updateConfigAppendToStringArray("server_config.ignore_battle_types", category)) {
|
||||
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully appended category \"");
|
||||
|
||||
MutableComponent sub = Component.literal(category);
|
||||
|
@ -1035,8 +1063,8 @@ public class TurnBasedMinecraftMod {
|
|||
|
||||
sub = Component.literal("\" to ignore_battle_types");
|
||||
response.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1052,6 +1080,7 @@ public class TurnBasedMinecraftMod {
|
|||
String category = StringArgumentType.getString(c, "category");
|
||||
if (TurnBasedMinecraftMod.proxy.getConfig().removeIgnoreBattleType(category)
|
||||
&& TurnBasedMinecraftMod.proxy.getConfig().updateConfigRemoveFromStringArray("server_config.ignore_battle_types", category)) {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully removed category \"");
|
||||
|
||||
MutableComponent sub = Component.literal(category);
|
||||
|
@ -1060,8 +1089,8 @@ public class TurnBasedMinecraftMod {
|
|||
|
||||
sub = Component.literal("\" from ignore_battle_types");
|
||||
response.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1070,12 +1099,13 @@ public class TurnBasedMinecraftMod {
|
|||
return 1;
|
||||
}))))
|
||||
.then(Commands.literal("player_speed").executes(c -> {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit player_speed <0-100>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return parent;
|
||||
}, false);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("speed", IntegerArgumentType.integer()).executes(c -> {
|
||||
|
@ -1091,21 +1121,24 @@ public class TurnBasedMinecraftMod {
|
|||
+ speed
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully set player_speed to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(speed));
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(TurnBasedMinecraftMod.proxy.getConfig().getPlayerSpeed()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("player_haste_speed").executes(c -> {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit player_haste_speed <0-100>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return parent;
|
||||
}, false);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("haste_speed", IntegerArgumentType.integer()).executes(c -> {
|
||||
|
@ -1121,21 +1154,24 @@ public class TurnBasedMinecraftMod {
|
|||
+ haste_speed
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully set player_haste_speed to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(haste_speed));
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(TurnBasedMinecraftMod.proxy.getConfig().getPlayerHasteSpeed()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("player_slow_speed").executes(c -> {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit player_slow_speed <0-100>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return parent;
|
||||
}, false);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("slow_speed", IntegerArgumentType.integer()).executes(c -> {
|
||||
|
@ -1151,21 +1187,24 @@ public class TurnBasedMinecraftMod {
|
|||
+ slow_speed
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully set player_slow_speed to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(slow_speed));
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(TurnBasedMinecraftMod.proxy.getConfig().getPlayerSlowSpeed()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("player_attack_probability").executes(c -> {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit player_attack_probability <1-100>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return parent;
|
||||
}, false);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("probability", IntegerArgumentType.integer()).executes(c -> {
|
||||
|
@ -1181,21 +1220,24 @@ public class TurnBasedMinecraftMod {
|
|||
+ probability
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully set player_attack_probability to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(probability));
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(TurnBasedMinecraftMod.proxy.getConfig().getPlayerAttackProbability()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("player_evasion").executes(c -> {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit player_evasion <0-100>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return parent;
|
||||
}, false);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("evasion", IntegerArgumentType.integer()).executes(c -> {
|
||||
|
@ -1211,21 +1253,24 @@ public class TurnBasedMinecraftMod {
|
|||
+ evasion
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully set player_evasion to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(evasion));
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(TurnBasedMinecraftMod.proxy.getConfig().getPlayerEvasion()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("defense_duration").executes(c -> {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit defense_duration <0-5>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return parent;
|
||||
}, false);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("defends", IntegerArgumentType.integer()).executes(c -> {
|
||||
|
@ -1241,21 +1286,24 @@ public class TurnBasedMinecraftMod {
|
|||
+ defends
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully set defense_duration to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(defends));
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(TurnBasedMinecraftMod.proxy.getConfig().getDefenseDuration()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("flee_good_probability").executes(c -> {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit flee_good_probability <1-100>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return parent;
|
||||
}, false);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("probability", IntegerArgumentType.integer()).executes(c -> {
|
||||
|
@ -1271,21 +1319,24 @@ public class TurnBasedMinecraftMod {
|
|||
+ probability
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully set flee_good_probability to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(probability));
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(TurnBasedMinecraftMod.proxy.getConfig().getFleeGoodProbability()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("flee_bad_probability").executes(c -> {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit flee_bad_probability <1-100>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return parent;
|
||||
}, false);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("probability", IntegerArgumentType.integer()).executes(c -> {
|
||||
|
@ -1301,21 +1352,24 @@ public class TurnBasedMinecraftMod {
|
|||
+ probability
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully set flee_bad_probability to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(probability));
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(TurnBasedMinecraftMod.proxy.getConfig().getFleeBadProbability()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("minimum_hit_percentage").executes(c -> {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit minimum_hit_percentage <1-100>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return parent;
|
||||
}, false);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("percentage", IntegerArgumentType.integer()).executes(c -> {
|
||||
|
@ -1331,21 +1385,24 @@ public class TurnBasedMinecraftMod {
|
|||
+ percentage
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully set minimum_hit_percentage to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(percentage));
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(TurnBasedMinecraftMod.proxy.getConfig().getMinimumHitPercentage()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("battle_turn_wait_forever").executes(c -> {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit battle_turn_wait_forever <true/false>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return parent;
|
||||
}, false);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("enabled", BoolArgumentType.bool()).executes(c -> {
|
||||
|
@ -1357,21 +1414,24 @@ public class TurnBasedMinecraftMod {
|
|||
);
|
||||
c.getSource().sendFailure(Component.literal("Failed to set battle_turn_wait_forever to \"" + (enabled ? "true" : "false") + "\" in config file!"));
|
||||
} else {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully set battle_turn_wait_forever to: ");
|
||||
MutableComponent subResponse = Component.literal((enabled ? "true" : "false"));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("battle_turn_time_seconds").executes(c -> {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit battle_turn_time_seconds <5-60>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return parent;
|
||||
}, false);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("seconds", IntegerArgumentType.integer()).executes(c -> {
|
||||
|
@ -1387,21 +1447,24 @@ public class TurnBasedMinecraftMod {
|
|||
+ seconds
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully set battle_turn_time_seconds to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(seconds));
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(TurnBasedMinecraftMod.proxy.getConfig().getDecisionDurationSeconds()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("creeper_explode_turn").executes(c -> {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit creeper_explode_turn <1-10>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return parent;
|
||||
}, false);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("turns", IntegerArgumentType.integer()).executes(c -> {
|
||||
|
@ -1417,21 +1480,24 @@ public class TurnBasedMinecraftMod {
|
|||
+ turns
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully set creeper_explode_turn to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(turns));
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(TurnBasedMinecraftMod.proxy.getConfig().getCreeperExplodeTurn()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("creeper_stop_explode_on_leave_battle").executes(c -> {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit creeper_stop_explode_on_leave_battle <true/false>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return parent;
|
||||
}, false);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("stop_explode_on_leave", BoolArgumentType.bool()).executes(c -> {
|
||||
|
@ -1447,21 +1513,24 @@ public class TurnBasedMinecraftMod {
|
|||
+ "\" in config file!"
|
||||
));
|
||||
} else {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully set creeper_stop_explode_on_leave_battle to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(stop_explode_on_leave));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("creeper_always_allow_damage").executes(c -> {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit creeper_always_allow_damage <true/false>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return parent;
|
||||
}, false);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("allow_damage", BoolArgumentType.bool()).executes(c -> {
|
||||
|
@ -1477,15 +1546,18 @@ public class TurnBasedMinecraftMod {
|
|||
+ "\" in config file!"
|
||||
));
|
||||
} else {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully set creeper_always_allow_damage to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(allow_damage));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("ignore_damage_sources").executes(c -> {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Use ");
|
||||
MutableComponent subResponse = Component.literal("/tbm-server-edit ignore_damage_sources add/remove <type> ");
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
|
@ -1535,8 +1607,8 @@ public class TurnBasedMinecraftMod {
|
|||
isFirst = false;
|
||||
}
|
||||
response.getSiblings().add(Component.literal("] "));
|
||||
|
||||
c.getSource().sendSuccess(response, false);
|
||||
return response;
|
||||
}, false);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.literal("add").executes(c -> {
|
||||
|
@ -1547,6 +1619,7 @@ public class TurnBasedMinecraftMod {
|
|||
String type = StringArgumentType.getString(c, "type");
|
||||
if (TurnBasedMinecraftMod.proxy.getConfig().addIgnoreHurtDamageSource(type)
|
||||
&& TurnBasedMinecraftMod.proxy.getConfig().updateConfigAppendToStringArray("server_config.ignore_damage_sources", type)) {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully appended Damage Source type \"");
|
||||
|
||||
MutableComponent sub = Component.literal(type);
|
||||
|
@ -1555,8 +1628,8 @@ public class TurnBasedMinecraftMod {
|
|||
|
||||
sub = Component.literal("\" to ignore_damage_sources");
|
||||
response.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1573,6 +1646,7 @@ public class TurnBasedMinecraftMod {
|
|||
String type = StringArgumentType.getString(c, "type");
|
||||
if (TurnBasedMinecraftMod.proxy.getConfig().removeIgnoreHurtDamageSource(type)
|
||||
&& TurnBasedMinecraftMod.proxy.getConfig().updateConfigRemoveFromStringArray("server_config.ignore_damage_sources", type)) {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully removed category \"");
|
||||
|
||||
MutableComponent sub = Component.literal(type);
|
||||
|
@ -1581,8 +1655,8 @@ public class TurnBasedMinecraftMod {
|
|||
|
||||
sub = Component.literal("\" from ignore_damage_sources");
|
||||
response.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1590,12 +1664,13 @@ public class TurnBasedMinecraftMod {
|
|||
return 1;
|
||||
}))))
|
||||
.then(Commands.literal("player_only_battles").executes(c -> {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit player_only_battles <true/false>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return parent;
|
||||
}, false);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("player_only_battles", BoolArgumentType.bool()).executes(c -> {
|
||||
|
@ -1605,11 +1680,13 @@ public class TurnBasedMinecraftMod {
|
|||
TurnBasedMinecraftMod.logger.warn("Failed to set \"server_config.player_only_battles\" in config file!");
|
||||
c.getSource().sendFailure(Component.literal("Failed to set player_only_battles to \"" + player_only_battles + "\" in config file"));
|
||||
} else {
|
||||
c.getSource().sendSuccess(() -> {
|
||||
MutableComponent response = Component.literal("Successfully set player_only_battles to: ");
|
||||
MutableComponent sub = Component.literal(String.valueOf(player_only_battles));
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.getSiblings().add(sub);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return response;
|
||||
}, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
|
|
|
@ -6,18 +6,18 @@
|
|||
# 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="[40,)" #mandatory (34 is current forge version)
|
||||
loaderVersion="${loader_version_range}" #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"
|
||||
# A list of mods - how many allowed here is determined by the individual mod loader
|
||||
[[mods]] #mandatory
|
||||
# The modid of the mod
|
||||
modId="com_burnedkirby_turnbasedminecraft" #mandatory
|
||||
modId="${mod_id}" #mandatory
|
||||
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
|
||||
version="1.22.0" #mandatory
|
||||
version="${mod_version}" #mandatory
|
||||
# A display name for the mod
|
||||
displayName="TurnBasedMinecraftMod" #mandatory
|
||||
displayName="${mod_name}" #mandatory
|
||||
# A URL to query for updates for this mod. See the JSON update specification <here>
|
||||
#updateJSONURL="" #optional
|
||||
# A URL for the "homepage" for this mod, displayed in the mod UI
|
||||
|
@ -27,7 +27,7 @@ displayURL="https://github.com/Stephen-Seo/TurnBasedMinecraftMod" #optional
|
|||
# A text field displayed in the mod UI
|
||||
credits="Thanks for this mod goes to Java" #optional
|
||||
# A text field displayed in the mod UI
|
||||
authors="BurnedKirby" #optional
|
||||
authors="${mod_authors}" #optional
|
||||
# The description text for the mod (multi line!) (#mandatory)
|
||||
description='''
|
||||
Implements turn-based-battle in Minecraft.
|
||||
|
@ -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="[40,)" #mandatory
|
||||
versionRange="${forge_version_range}" #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.19.2,1.20)"
|
||||
versionRange="${minecraft_version_range}"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
# Please do not change this option, the mod uses this to keep track of what new
|
||||
# changes to add to the config.
|
||||
version = 9
|
||||
version = 10
|
||||
# Change this to "true" if you want the config to never be replaced. This means
|
||||
# that you will not get new mob listings from future updates unless this remains
|
||||
# "false"!
|
||||
do_not_overwrite = false
|
||||
|
||||
[client_config]
|
||||
|
@ -1271,3 +1274,33 @@ decision_attack_probability = 100
|
|||
decision_defend_probability = 0
|
||||
decision_flee_probability = 0
|
||||
ignore_battle = false
|
||||
|
||||
[[server_config.entity]]
|
||||
name = "net.minecraft.world.entity.animal.camel.Camel"
|
||||
attack_power = 0
|
||||
attack_probability = 70
|
||||
attack_variance = 0
|
||||
attack_effect = "unknown"
|
||||
defense_damage = 0
|
||||
evasion = 10
|
||||
category = "passive"
|
||||
speed = 55
|
||||
decision_attack_probability = 0
|
||||
decision_defend_probability = 0
|
||||
decision_flee_probability = 90
|
||||
ignore_battle = false
|
||||
|
||||
[[server_config.entity]]
|
||||
name = "net.minecraft.world.entity.animal.sniffer.Sniffer"
|
||||
attack_power = 0
|
||||
attack_probability = 70
|
||||
attack_variance = 0
|
||||
attack_effect = "unknown"
|
||||
defense_damage = 0
|
||||
evasion = 10
|
||||
category = "passive"
|
||||
speed = 15
|
||||
decision_attack_probability = 0
|
||||
decision_defend_probability = 0
|
||||
decision_flee_probability = 90
|
||||
ignore_battle = false
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
"modid": "com_burnedkirby_turnbasedminecraft",
|
||||
"name": "Turn Based Minecraft",
|
||||
"description": "Changes battles to be turn-based.",
|
||||
"version": "1.22.0",
|
||||
"mcversion": "1.18.2",
|
||||
"version": "1.23.0",
|
||||
"mcversion": "1.20.1",
|
||||
"url": "",
|
||||
"updateUrl": "",
|
||||
"authorList": ["Stephen Seo"],
|
||||
|
|
Loading…
Reference in a new issue