Features should be almost the same as the NeoForge branch.
- run: cd TurnBasedMinecraftMod && git checkout ${GITHUB_REF_NAME}
- run: cd TurnBasedMinecraftMod && sed -i '/org.gradle.jvmargs/s/Xmx[0-9]\+m/Xmx1024m/' gradle.properties
- run: cd TurnBasedMinecraftMod && ./gradlew --console=plain build
- - run: cd TurnBasedMinecraftMod/build/libs && find . -type f -exec sha256sum '{}' ';' -exec bash -c 'sha256sum {} >> sha256sums.txt' ';' && java --version >> javaVersion.txt && javac --version >> javaVersion.txt
+ - run: cd TurnBasedMinecraftMod/build/libs && find . -regex '.*all.jar$' -exec sha256sum '{}' ';' -exec bash -c 'sha256sum {} >> sha256sums.txt' ';' && java --version >> javaVersion.txt && javac --version >> javaVersion.txt
- name: Create release and attach jar
run: |
curl --fail-with-body -X 'POST' \
id 'eclipse'
id 'idea'
id 'maven-publish'
- id 'net.minecraftforge.gradle' version '[6.0.16,6.2)'
+ id 'net.minecraftforge.gradle' version '[6.0.24,6.2)'
}
version = mod_version
group = mod_group_id
-archivesBaseName = "TurnBasedMinecraft-Forge"
-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'))
+base {
+ archivesName = "TurnBasedMinecraft-Forge"
+}
+
+// Mojang ships Java 21 to end users in 1.20.5+, so your mod should target Java 21.
+java.toolchain.languageVersion = JavaLanguageVersion.of(21)
+println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
jarJar.enable()
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.
+ // The mappings can be changed at any time and must be in the following format.
+ // 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 MinecraftForge
+ // Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started
+ //
+ // 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: mapping_channel, version: mapping_version
- // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
+
+ // Tell FG to not automtically create the reobf tasks, as we now use Official mappings at runtime, If you don't use them at dev time then you'll have to fix your reobf yourself.
+ reobf = false
- // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
+ // When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game.
+ // In most cases, it is not necessary to enable.
+ // enableEclipsePrepareRuns = true
+ // enableIdeaPrepareRuns = true
// 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
+ // When true, this property will add the folder name of all declared run configurations to generated IDE run configurations.
+ // The folder name can be set on a run configuration using the "folderName" property.
+ // By default, the folder name of a run configuration is the name of the Gradle project containing it.
+ // generateRunFolders = true
+
+ // This property enables access transformers for use in development.
+ // They will be applied to the Minecraft artifact.
+ // The access transformer file can be anywhere in the project.
+ // However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge.
+ // This default location is a best practice to automatically put the file in the right place in the final jar.
+ // See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information.
+ // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
+
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
sourceSets.main.resources { srcDir 'src/generated/resources' }
repositories {
+ // Put repositories for dependencies here
+ // ForgeGradle automatically adds the Forge maven and Maven Central for you
+
flatDir {
dir 'libs'
}
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
+ // Example mod dependency with JEI
+ // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
+ // compileOnly "mezz.jei:jei-${mc_version}-common-api:${jei_version}"
+ // compileOnly "mezz.jei:jei-${mc_version}-forge-api:${jei_version}"
+ // runtimeOnly "mezz.jei:jei-${mc_version}-forge:${jei_version}"
+
+ // Example mod dependency using a mod jar from ./libs with a flat dir repository
+ // This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
+ // The group id is ignored when searching -- in this case, it is "blank"
+ // 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
+
+ // Hack fix for now, force jopt-simple to be exactly 5.0.4 because Mojang ships that version, but some transitive dependencies request 6.0+
+ implementation('net.sf.jopt-simple:jopt-simple:5.0.4') { version { strictly '5.0.4' } }
+
implementation 'fr.delthas:javamp3:1.0.3'
implementation 'com.github.stephengold:j-ogg-vorbis:1.0.4'
}
// This is the preferred method to reobfuscate your jar file
- finalizedBy 'reobfJar'
+ //finalizedBy 'reobfJar'
}
// Reproducible Builds
it.output.resourcesDir = dir
it.java.destinationDirectory = dir
}
+
+// Ensure "jarJar" is run after "build"
+tasks.named("build").configure {
+ finalizedBy "jarJar"
+}
-org.gradle.jvmargs=-Xmx4096m
+# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
+# This is required to provide enough memory for the Minecraft decompilation process.
+org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
+
## Environment Properties
# The Minecraft version must agree with the Forge version to get a valid artifact
-minecraft_version=1.20.4
+minecraft_version=1.21.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.4,1.21)
+minecraft_version_range=[1.21.1,1.22)
# The Forge version must agree with the Minecraft version to get a valid artifact
-forge_version=49.0.19
+forge_version=52.0.21
# The Forge version range can use any version of Forge as bounds or match the loader version range
forge_version_range=[0,)
# The loader version range can only use the major version of Forge/FML as bounds
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.4
+mapping_version=1.21.1
+
## Mod Properties
# 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.25.2
+mod_version=1.26.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
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
// set volume
FloatControl gainControl = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
- gainControl.setValue(volume * 20.0f - 20.0f); // in decibels
+ gainControl.setValue(BattleMusic.percentageToDecibels(volume)); // in decibels
clip.loop(Clip.LOOP_CONTINUOUSLY);
clip.start();
return !sillyMusic.isEmpty();
}
+ public static float percentageToDecibels(float percentage) {
+ if (percentage > 1.0F) {
+ return 0.0F;
+ } else if (percentage <= 0.0F) {
+ return Float.NEGATIVE_INFINITY;
+ } else {
+ return (float) (Math.log10(percentage) * 20.0);
+ }
+ }
+
private class MP3Streamer implements Runnable
{
private AtomicBoolean keepPlaying;
sdl.open(audioFormat);
{
FloatControl volumeControl = (FloatControl) sdl.getControl(FloatControl.Type.MASTER_GAIN);
- volumeControl.setValue(volume * 20.0f - 20.0f); // in decibels
+ volumeControl.setValue(BattleMusic.percentageToDecibels(volume)); // in decibels
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
sdl.open(audioFormat);
{
FloatControl volumeControl = (FloatControl) sdl.getControl(FloatControl.Type.MASTER_GAIN);
- volumeControl.setValue(volume * 20.0f - 20.0f); // in decibels
+ volumeControl.setValue(BattleMusic.percentageToDecibels(volume)); // in decibels
}
AudioInputStream ais = reader.getAudioInputStream(oggVorbisFile);
--- /dev/null
+package com.burnedkirby.TurnBasedMinecraft.client;
+
+import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod;
+import net.minecraftforge.common.ForgeConfigSpec;
+import org.apache.commons.lang3.tuple.Pair;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ClientConfig {
+ public static final ClientConfig CLIENT;
+ public static final ForgeConfigSpec CLIENT_SPEC;
+
+ static {
+ Pair<ClientConfig, ForgeConfigSpec> pair =
+ new ForgeConfigSpec.Builder().configure(ClientConfig::new);
+ CLIENT = pair.getKey();
+ CLIENT_SPEC = pair.getValue();
+ }
+
+ public final ForgeConfigSpec.ConfigValue<List<? extends String>> battleMusicList;
+ public final ForgeConfigSpec.ConfigValue<List<? extends String>> sillyMusicList;
+ public final ForgeConfigSpec.DoubleValue sillyMusicThreshold;
+ public final ForgeConfigSpec.BooleanValue volumeAffectedByMasterVolume;
+ public final ForgeConfigSpec.BooleanValue volumeAffectedByMusicVolume;
+ public final ForgeConfigSpec.DoubleValue musicVolume;
+
+ ClientConfig(ForgeConfigSpec.Builder builder) {
+ //builder.push("music");
+
+ List<String> battleMusicList = new ArrayList<String>(8);
+ battleMusicList.add("monster");
+ battleMusicList.add("animal");
+ battleMusicList.add("boss");
+ battleMusicList.add("player");
+ this.battleMusicList = builder.comment("What categories of mobs that play \"battle\" music")
+ .translation(TurnBasedMinecraftMod.MODID + ".clientconfig.battle_music_list")
+ .defineList("battleMusicList", battleMusicList, (v) -> v instanceof String);
+
+ List<String> sillyMusicList = new ArrayList<String>(4);
+ sillyMusicList.add("passive");
+ this.sillyMusicList = builder.comment("What categories of mobs that play \"silly\" music")
+ .translation(TurnBasedMinecraftMod.MODID + ".clientconfig.silly_music_list")
+ .defineList("sillyMusicList", sillyMusicList, (v) -> true);
+
+ this.sillyMusicThreshold =
+ builder.comment("Minimum percentage of silly entities in battle to use silly music")
+ .translation(TurnBasedMinecraftMod.MODID + ".clientconfig.silly_percentage")
+ .defineInRange("sillyMusicThreshold", 0.4, 0.0, 1.0);
+
+ this.volumeAffectedByMasterVolume = builder.comment(
+ "If \"true\", music volume will be affected by global Master volume setting")
+ .translation(TurnBasedMinecraftMod.MODID + ".clientconfig.volume_affected_by_master")
+ .define("volumeAffectedByMasterVolume", true);
+
+ this.volumeAffectedByMusicVolume = builder.comment(
+ "If \"true\", music volume will be affected by global Music volume setting")
+ .translation(TurnBasedMinecraftMod.MODID + ".clientconfig.volume_affected_by_volume")
+ .define("volumeAffectedByMusicVolume", true);
+
+ this.musicVolume =
+ builder.comment("Volume of battle/silly music as a percentage between 0.0 and 1.0")
+ .translation(TurnBasedMinecraftMod.MODID + ".clientconfig.music_volume")
+ .defineInRange("musicVolume", 0.7, 0.0, 1.0);
+
+ //builder.pop();
+ }
+}
--- /dev/null
+package com.burnedkirby.TurnBasedMinecraft.client;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiGraphics;
+import net.minecraft.client.gui.components.*;
+import net.minecraft.client.gui.screens.Screen;
+import net.minecraft.network.chat.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ClientConfigGui extends net.minecraft.client.gui.screens.Screen {
+ private final int widget_height = 20;
+ private boolean dirtyFlag;
+ private boolean accepted;
+ private EditBox battleListEditBox = null;
+ private EditBox sillyListEditBox = null;
+ private SliderPercentage sillyMusicThresholdSlider = null;
+ private Checkbox affectedByMasterVolCheckbox = null;
+ private Checkbox affectedByMusicVolCheckbox = null;
+ private SliderPercentage volumeSlider = null;
+
+ public ClientConfigGui() {
+ super(Component.literal("TurnBasedMC Client Config"));
+
+ dirtyFlag = true;
+
+ accepted = false;
+ }
+
+ public void onDirty() {
+ clearWidgets();
+
+ // Initialize GUI elements.
+ int widget_x_offset = 5;
+ int widget_width = this.width / 2 - widget_x_offset * 2;
+ int top_offset = 5;
+
+ addRenderableWidget(
+ new StringWidget(this.width / 2 - widget_width + widget_x_offset, top_offset,
+ widget_width, widget_height, Component.literal("Battle Music Categories"),
+ font));
+ if (battleListEditBox == null) {
+ battleListEditBox =
+ new EditBox(font, this.width / 2 + widget_x_offset, top_offset, widget_width,
+ widget_height, Component.literal("Battle Music Categories Edit Box"));
+ } else {
+ battleListEditBox.setPosition(this.width / 2 + widget_x_offset, top_offset);
+ battleListEditBox.setSize(widget_width, widget_height);
+ }
+ String tempString = "";
+ for (String category : ClientConfig.CLIENT.battleMusicList.get()) {
+ if (tempString.isEmpty()) {
+ tempString = category;
+ } else {
+ tempString += "," + category;
+ }
+ }
+ battleListEditBox.setMaxLength(128);
+ battleListEditBox.setValue(tempString);
+ addRenderableWidget(battleListEditBox);
+
+ top_offset += widget_height;
+
+ addRenderableWidget(
+ new StringWidget(this.width / 2 - widget_width + widget_x_offset, top_offset,
+ widget_width, widget_height, Component.literal("Silly Music Categories"),
+ font));
+ if (sillyListEditBox == null) {
+ sillyListEditBox =
+ new EditBox(font, this.width / 2 + widget_x_offset, top_offset, widget_width,
+ widget_height, Component.literal("Silly Music Categories Edit Box"));
+ } else {
+ sillyListEditBox.setPosition(this.width / 2 + widget_x_offset, top_offset);
+ sillyListEditBox.setSize(widget_width, widget_height);
+ }
+ tempString = "";
+ for (String category : ClientConfig.CLIENT.sillyMusicList.get()) {
+ if (tempString.isEmpty()) {
+ tempString = category;
+ } else {
+ tempString += "," + category;
+ }
+ }
+ sillyListEditBox.setMaxLength(128);
+ sillyListEditBox.setValue(tempString);
+ addRenderableWidget(sillyListEditBox);
+
+ top_offset += widget_height;
+
+ StringWidget stringWidget =
+ new StringWidget(this.width / 2 - widget_width + widget_x_offset, top_offset,
+ widget_width, widget_height, Component.literal("Silly Music Threshold"), font);
+ stringWidget.setTooltip(Tooltip.create(
+ Component.literal("Ratio of minimum of silly mobs in battle to play silly music")));
+ addRenderableWidget(stringWidget);
+ if (sillyMusicThresholdSlider == null) {
+ sillyMusicThresholdSlider =
+ new SliderPercentage(this.width / 2 + widget_x_offset, top_offset, widget_width,
+ widget_height, Component.literal("Silly Music Threshold: " +
+ String.format("%.1f%%", ClientConfig.CLIENT.sillyMusicThreshold.get() * 100.0)),
+ ClientConfig.CLIENT.sillyMusicThreshold.get(), "Silly Music Threshold: ");
+ } else {
+ sillyMusicThresholdSlider.setPosition(this.width / 2 + widget_x_offset, top_offset);
+ sillyMusicThresholdSlider.setSize(widget_width, widget_height);
+ }
+ addRenderableWidget(sillyMusicThresholdSlider);
+
+ top_offset += widget_height;
+
+ stringWidget =
+ new StringWidget(this.width / 2 - widget_width + widget_x_offset, top_offset,
+ widget_width, widget_height, Component.literal("Affected by Master Vol."),
+ font);
+ stringWidget.setTooltip(Tooltip.create(
+ Component.literal("If enabled, volume is affected by global master volume.")));
+ addRenderableWidget(stringWidget);
+ if (affectedByMasterVolCheckbox == null) {
+ affectedByMasterVolCheckbox = Checkbox.builder(Component.literal(""), font)
+ .pos(this.width / 2 + widget_x_offset, top_offset).build();
+ } else {
+ affectedByMasterVolCheckbox.setPosition(this.width / 2 + widget_x_offset,
+ top_offset);
+ }
+ if ((ClientConfig.CLIENT.volumeAffectedByMasterVolume.get() &&
+ !affectedByMasterVolCheckbox.selected()) ||
+ (!ClientConfig.CLIENT.volumeAffectedByMasterVolume.get() &&
+ affectedByMasterVolCheckbox.selected())) {
+ affectedByMasterVolCheckbox.onPress();
+ }
+ addRenderableWidget(affectedByMasterVolCheckbox);
+
+ top_offset += widget_height;
+
+ stringWidget =
+ new StringWidget(this.width / 2 - widget_width + widget_x_offset, top_offset,
+ widget_width, widget_height, Component.literal("Affected by Music Vol."), font);
+ stringWidget.setTooltip(Tooltip.create(
+ Component.literal("If enabled, volume is affected by global music volume.")));
+ addRenderableWidget(stringWidget);
+ if (affectedByMusicVolCheckbox == null) {
+ affectedByMusicVolCheckbox = Checkbox.builder(Component.literal(""), font)
+ .pos(this.width / 2 + widget_x_offset, top_offset).build();
+ } else {
+ affectedByMusicVolCheckbox.setPosition(this.width / 2 + widget_x_offset,
+ top_offset);
+ }
+ if ((ClientConfig.CLIENT.volumeAffectedByMusicVolume.get() &&
+ !affectedByMusicVolCheckbox.selected()) ||
+ (!ClientConfig.CLIENT.volumeAffectedByMusicVolume.get() &&
+ affectedByMusicVolCheckbox.selected())) {
+ affectedByMusicVolCheckbox.onPress();
+ }
+ addRenderableWidget(affectedByMusicVolCheckbox);
+
+ top_offset += widget_height;
+
+ stringWidget =
+ new StringWidget(this.width / 2 - widget_width + widget_x_offset, top_offset,
+ widget_width, widget_height, Component.literal("Music Volume"), font);
+ stringWidget.setTooltip(
+ Tooltip.create(Component.literal("Volume of battle/silly music")));
+ addRenderableWidget(stringWidget);
+ if (volumeSlider == null) {
+ volumeSlider =
+ new SliderPercentage(this.width / 2 + widget_x_offset, top_offset, widget_width,
+ widget_height, Component.literal(
+ "Volume: " + String.format("%.1f%%", ClientConfig.CLIENT.musicVolume.get() * 100.0)),
+ ClientConfig.CLIENT.musicVolume.get(), "Volume: ");
+ } else {
+ volumeSlider.setPosition(this.width / 2 + widget_x_offset, top_offset);
+ volumeSlider.setSize(widget_width, widget_height);
+ }
+ addRenderableWidget(volumeSlider);
+
+ addRenderableWidget(Button.builder(Component.literal("Cancel"),
+ (b) -> Minecraft.getInstance().setScreen(null))
+ .bounds(this.width / 2 - widget_width + widget_x_offset,
+ this.height - widget_height, widget_width, widget_height).build());
+ addRenderableWidget(Button.builder(Component.literal("Accept"), (b) -> {
+ accepted = true;
+ }).bounds(this.width / 2 + widget_x_offset, this.height - widget_height, widget_width,
+ widget_height).build());
+
+ dirtyFlag = false;
+ }
+
+ private void doAccepted() {
+ String temp = battleListEditBox.getValue();
+ {
+ List<String> battleList = new ArrayList<String>();
+ for (String category : temp.split(",")) {
+ battleList.add(category.strip());
+ }
+ ClientConfig.CLIENT.battleMusicList.set(battleList);
+ }
+
+ temp = sillyListEditBox.getValue();
+ {
+ List<String> sillyList = new ArrayList<String>();
+ for (String category : temp.split(",")) {
+ sillyList.add(category.strip());
+ }
+ ClientConfig.CLIENT.sillyMusicList.set(sillyList);
+ }
+
+ ClientConfig.CLIENT.sillyMusicThreshold.set(sillyMusicThresholdSlider.percentage);
+
+ ClientConfig.CLIENT.volumeAffectedByMasterVolume.set(affectedByMasterVolCheckbox.selected());
+
+ ClientConfig.CLIENT.volumeAffectedByMusicVolume.set(affectedByMusicVolCheckbox.selected());
+
+ ClientConfig.CLIENT.musicVolume.set(volumeSlider.percentage);
+
+ ClientConfig.CLIENT_SPEC.save();
+ }
+
+ @Override
+ public boolean isPauseScreen() {
+ return true;
+ }
+
+ @Override
+ public void render(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) {
+ if (accepted) {
+ doAccepted();
+ Minecraft.getInstance().setScreen(null);
+ return;
+ }
+ if (dirtyFlag) {
+ onDirty();
+ }
+ super.render(pGuiGraphics, pMouseX, pMouseY, pPartialTick);
+ }
+
+ @Override
+ public void resize(Minecraft pMinecraft, int pWidth, int pHeight) {
+ dirtyFlag = true;
+ super.resize(pMinecraft, pWidth, pHeight);
+ }
+
+ private static class SliderPercentage extends AbstractSliderButton {
+ private final String messagePrefix;
+ private double percentage;
+
+ public SliderPercentage(int x, int y, int width, int height, Component message, double percentage, String messagePrefix) {
+ super(x, y, width, height, message, percentage);
+ this.percentage = percentage;
+ this.messagePrefix = messagePrefix;
+ }
+
+ @Override
+ protected void updateMessage() {
+ setMessage(
+ Component.literal(messagePrefix + String.format("%.1f%%", percentage * 100.0)));
+ }
+
+ @Override
+ protected void applyValue() {
+ percentage = value;
+ }
+ }
+}
@Override
public void playBattleMusic() {
Options gs = Minecraft.getInstance().options;
- battleMusic.playBattle(gs.getSoundSourceVolume(SoundSource.MUSIC) * gs.getSoundSourceVolume(SoundSource.MASTER));
+ float volume = ClientConfig.CLIENT.musicVolume.get().floatValue();
+ if (ClientConfig.CLIENT.volumeAffectedByMasterVolume.get()) {
+ volume *= gs.getSoundSourceVolume(SoundSource.MASTER);
+ }
+ if (ClientConfig.CLIENT.volumeAffectedByMusicVolume.get()) {
+ volume *= gs.getSoundSourceVolume(SoundSource.MUSIC);
+ }
+ battleMusic.playBattle(volume);
}
@Override
public void playSillyMusic() {
Options gs = Minecraft.getInstance().options;
- battleMusic.playSilly(gs.getSoundSourceVolume(SoundSource.MUSIC) * gs.getSoundSourceVolume(SoundSource.MASTER));
+ float volume = ClientConfig.CLIENT.musicVolume.get().floatValue();
+ if (ClientConfig.CLIENT.volumeAffectedByMasterVolume.get()) {
+ volume *= gs.getSoundSourceVolume(SoundSource.MASTER);
+ }
+ if (ClientConfig.CLIENT.volumeAffectedByMusicVolume.get()) {
+ volume *= gs.getSoundSourceVolume(SoundSource.MUSIC);
+ }
+ battleMusic.playSilly(volume);
}
@Override
if (localBattle == null) {
return;
}
- if (type == null || type.isEmpty() || getConfig().isBattleMusicType(type)) {
+ if (type == null || type.isEmpty() || ClientConfig.CLIENT.battleMusicList.get().contains(type)) {
++battleMusicCount;
- } else if (getConfig().isSillyMusicType(type)) {
+ } else if (ClientConfig.CLIENT.sillyMusicList.get().contains(type)) {
++sillyMusicCount;
} else {
++battleMusicCount;
battleMusicCount = 0;
sillyMusicCount = 0;
return;
- } else if (type == null || type.isEmpty() || getConfig().isBattleMusicType(type)) {
+ } else if (type == null || type.isEmpty() || ClientConfig.CLIENT.battleMusicList.get().contains(type)) {
--battleMusicCount;
- } else if (getConfig().isSillyMusicType(type)) {
+ } else if (ClientConfig.CLIENT.sillyMusicList.get().contains(type)) {
--sillyMusicCount;
} else {
--battleMusicCount;
percentage = 100.0f * (float) sillyMusicCount / (float) (sillyMusicCount + battleMusicCount);
}
- if (percentage >= (float) getConfig().getSillyMusicThreshold()) {
+ if (percentage >= ClientConfig.CLIENT.sillyMusicThreshold.get().floatValue()) {
if (battleMusic.isPlaying()) {
if (!battleMusic.isPlayingSilly() && battleMusic.hasSillyMusic()) {
stopMusic(false);
}
}
}
-}
+
+ @Override
+ public void showClientConfigGui() {
+ Minecraft.getInstance().setScreen(new ClientConfigGui());
+ }
+}
\ No newline at end of file
final Entity targetEntity = target.entity;
final float yawDirection = Utility.yawDirection(next.entity.getX(), next.entity.getZ(), target.entity.getX(), target.entity.getZ());
final float pitchDirection = Utility.pitchDirection(next.entity.getX(), next.entity.getY(), next.entity.getZ(), target.entity.getX(), target.entity.getY(), target.entity.getZ());
- final int randomTimeLeft = random.nextInt(heldItemStack.getItem().getUseDuration(heldItemStack) / 3);
+ final int randomTimeLeft = random.nextInt(heldItemStack.getUseDuration((LivingEntity)next.entity) / 3);
if (TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled()) {
next.yaw = yawDirection;
next.pitch = pitchDirection;
debugLog += " null";
sendMessageToAllPlayers(PacketBattleMessage.MessageType.USED_ITEM, next.entity.getId(), 0, PacketBattleMessage.UsedItemAction.USED_NOTHING.getValue());
break;
- } else if (targetItem.isEdible()) {
+ } else if (Utility.isItemEdible(targetItemStack)) {
debugLog += " food";
sendMessageToAllPlayers(PacketBattleMessage.MessageType.USED_ITEM, next.entity.getId(), 0, PacketBattleMessage.UsedItemAction.USED_FOOD.getValue(), targetItemStack.getDisplayName().getString());
final Entity nextEntity = next.entity;
} else {
// then check vanilla foods
final CreativeModeTab foodAndDrinksTab = CreativeModeTabRegistry.getTab(CreativeModeTabs.FOOD_AND_DRINKS.location());
- if (foodAndDrinksTab.contains(targetItemStack) && targetItem.isEdible()) {
+ if (foodAndDrinksTab.contains(targetItemStack) && Utility.isItemEdible(targetItemStack)) {
debugLog += " food";
sendMessageToAllPlayers(PacketBattleMessage.MessageType.USED_ITEM, next.entity.getId(), 0, PacketBattleMessage.UsedItemAction.USED_FOOD.getValue(), targetItemStack.getDisplayName().getString());
final Entity nextEntity = next.entity;
}
public <MSG> void handlePacket(MSG msg,CustomPayloadEvent.Context ctx) {}
-}
+
+ public void showClientConfigGui() {}
+}
\ No newline at end of file
private int fleeBadProbability = 35;
private int minimumHitPercentage = 4;
private int maxInBattle = 8;
- private Set<String> musicBattleTypes;
- private Set<String> musicSillyTypes;
private boolean freezeCombatantsInBattle = false;
- private int sillyMusicThreshold = 40;
private int configVersion = 0;
private Set<Integer> battleIgnoringPlayers = null;
private boolean onlyOPsSelfDisableTB = true;
customEntityInfoMap = new HashMap<String, EntityInfo>();
ignoreBattleTypes = new HashSet<String>();
this.logger = logger;
- musicBattleTypes = new HashSet<String>();
- musicSillyTypes = new HashSet<String>();
battleIgnoringPlayers = new HashSet<Integer>();
possibleIgnoreHurtDamageSources = new HashSet<String>();
ignoreHurtDamageSources = new HashSet<String>();
{
CommentedFileConfig conf = getConfigObj(configFile);
- // client config
- try {
- Collection<String> battle_music_categories = conf.get("client_config.battle_music");
- if (battle_music_categories != null) {
- for (String category : battle_music_categories) {
- musicBattleTypes.add(category);
- }
- } else {
- musicBattleTypes.add("monster");
- musicBattleTypes.add("animal");
- musicBattleTypes.add("boss");
- musicBattleTypes.add("player");
- logNotFound("client_config.battle_music");
- }
- } catch (ClassCastException e) {
- musicBattleTypes.add("monster");
- musicBattleTypes.add("animal");
- musicBattleTypes.add("boss");
- musicBattleTypes.add("player");
- logTOMLInvalidValue("client_config.battle_music");
- }
-
- try {
- Collection<String> silly_music_categories = conf.get("client_config.silly_music");
- if (silly_music_categories != null) {
- for (String category : silly_music_categories) {
- musicSillyTypes.add(category);
- }
- } else {
- musicSillyTypes.add("passive");
- logNotFound("client_config.silly_music");
- }
- } catch (ClassCastException e) {
- musicSillyTypes.add("passive");
- logTOMLInvalidValue("client_config.silly_music");
- }
-
- try {
- OptionalInt silly_music_threshold = conf.getOptionalInt("client_config.silly_music_threshold");
- if(silly_music_threshold.isPresent()) {
- this.sillyMusicThreshold = silly_music_threshold.getAsInt();
- } else {
- this.sillyMusicThreshold = 40;
- logNotFound("client_config.silly_music_threshold", "40");
- }
- } catch (ClassCastException e) {
- this.sillyMusicThreshold = 40;
- logTOMLInvalidValue("client_config.silly_music_threshold", "40");
- }
-
// server_config
try {
OptionalInt leave_battle_cooldown = conf.getOptionalInt("server_config.leave_battle_cooldown");
this.maxInBattle = maxInBattle;
}
- public boolean isBattleMusicType(String type)
- {
- return musicBattleTypes.contains(type.toLowerCase());
- }
-
- public boolean isSillyMusicType(String type)
- {
- return musicSillyTypes.contains(type.toLowerCase());
- }
-
public boolean isFreezeCombatantsEnabled()
{
return freezeCombatantsInBattle;
freezeCombatantsInBattle = enabled;
}
- public int getSillyMusicThreshold()
- {
- return sillyMusicThreshold;
- }
-
public int getConfigVersion()
{
return configVersion;
{
if(this == FIRE)
{
- entity.setSecondsOnFire(duration / 20);
+ entity.setRemainingFireTicks(duration / 2);
return;
}
else if(this != UNKNOWN)
package com.burnedkirby.TurnBasedMinecraft.common;
+import com.burnedkirby.TurnBasedMinecraft.client.ClientConfig;
import com.burnedkirby.TurnBasedMinecraft.client.ClientProxy;
import com.burnedkirby.TurnBasedMinecraft.common.networking.*;
import com.mojang.brigadier.LiteralMessage;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.common.Mod;
+import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLDedicatedServerSetupEvent;
public static final String MUSIC_SILLY = MUSIC_ROOT + "silly/";
public static final String MUSIC_BATTLE = MUSIC_ROOT + "battle/";
- private static final Integer PROTOCOL_VERSION = 3;
- private static final ResourceLocation HANDLER_ID = new ResourceLocation(MODID, "main_channel");
+ private static final Integer PROTOCOL_VERSION = 4;
+ private static final ResourceLocation HANDLER_ID = ResourceLocation.fromNamespaceAndPath(MODID, "main_channel");
private static final SimpleChannel HANDLER = ChannelBuilder
.named(HANDLER_ID)
public static CommonProxy proxy;
- public TurnBasedMinecraftMod() {
- FMLJavaModLoadingContext.get().getModEventBus().addListener(this::firstInit);
- FMLJavaModLoadingContext.get().getModEventBus().addListener(this::secondInitClient);
- FMLJavaModLoadingContext.get().getModEventBus().addListener(this::secondInitServer);
+ public TurnBasedMinecraftMod(FMLJavaModLoadingContext ctx) {
+ ctx.getModEventBus().addListener(this::firstInit);
+ ctx.getModEventBus().addListener(this::secondInitClient);
+ ctx.getModEventBus().addListener(this::secondInitServer);
MinecraftForge.EVENT_BUS.register(this);
+
+ ctx.registerConfig(ModConfig.Type.CLIENT, ClientConfig.CLIENT_SPEC);
}
private void firstInit(final FMLCommonSetupEvent event) {
.decoder(new PacketEditingMessage.Decoder())
.consumerNetworkThread(new PacketEditingMessage.Consumer())
.add();
+ HANDLER.messageBuilder(PacketClientGui.class, NetworkDirection.PLAY_TO_CLIENT)
+ .encoder(new PacketClientGui.Encoder())
+ .decoder(new PacketClientGui.Decoder())
+ .consumerNetworkThread(new PacketClientGui.Consumer())
+ .add();
// register event handler(s)
MinecraftForge.EVENT_BUS.register(new AttackEventHandler());
return 1;
})))
);
+
+ // tbm-client-edit
+ event.getDispatcher().register(
+ Commands.literal("tbm-client-edit").executes(c -> {
+ ServerPlayer player = c.getSource().getPlayerOrException();
+ getHandler().send(new PacketClientGui(), PacketDistributor.PLAYER.with(player));
+ return 1;
+ })
+ );
}
@SubscribeEvent
package com.burnedkirby.TurnBasedMinecraft.common;
+import net.minecraft.core.component.DataComponents;
import net.minecraft.core.registries.Registries;
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.item.ItemStack;
import net.minecraft.world.level.Level;
public class Utility
}
public static ResourceKey<Level> deserializeDimension(String dimString) {
- ResourceLocation dimRes = new ResourceLocation(dimString);
+ ResourceLocation dimRes = ResourceLocation.parse(dimString);
return ResourceKey.create(Registries.DIMENSION, dimRes);
}
+
+ public static boolean isItemEdible(ItemStack itemStack) {
+ return itemStack.get(DataComponents.FOOD) != null;
+ }
}
package com.burnedkirby.TurnBasedMinecraft.common.networking;
-import java.util.function.BiConsumer;
-import java.util.function.Function;
-
import com.burnedkirby.TurnBasedMinecraft.common.Battle;
-import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod;
import com.burnedkirby.TurnBasedMinecraft.common.Battle.Decision;
-
+import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod;
+import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.server.level.ServerPlayer;
-import net.minecraft.network.FriendlyByteBuf;
import net.minecraftforge.event.network.CustomPayloadEvent;
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+
public class PacketBattleDecision
{
private int battleID;
this.targetIDOrItemID = targetIDOrItemID;
}
- public static class Encoder implements BiConsumer<PacketBattleDecision, FriendlyByteBuf> {
+ public static class Encoder implements BiConsumer<PacketBattleDecision, RegistryFriendlyByteBuf> {
public Encoder() {}
@Override
- public void accept(PacketBattleDecision pkt, FriendlyByteBuf buf) {
+ public void accept(PacketBattleDecision pkt, RegistryFriendlyByteBuf buf) {
buf.writeInt(pkt.battleID);
buf.writeInt(pkt.decision.getValue());
buf.writeInt(pkt.targetIDOrItemID);
}
}
- public static class Decoder implements Function<FriendlyByteBuf, PacketBattleDecision> {
+ public static class Decoder implements Function<RegistryFriendlyByteBuf, PacketBattleDecision> {
public Decoder() {}
@Override
- public PacketBattleDecision apply(FriendlyByteBuf buf) {
+ public PacketBattleDecision apply(RegistryFriendlyByteBuf buf) {
return new PacketBattleDecision(buf.readInt(), Decision.valueOf(buf.readInt()), buf.readInt());
}
}
package com.burnedkirby.TurnBasedMinecraft.common.networking;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.function.BiConsumer;
-import java.util.function.Function;
-
import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod;
-
import net.minecraft.client.Minecraft;
+import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.world.entity.Entity;
-import net.minecraft.network.FriendlyByteBuf;
import net.minecraftforge.event.network.CustomPayloadEvent;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+
public class PacketBattleInfo
{
private Collection<Integer> sideA;
this.turnTimerEnabled = turnTimerEnabled;
}
- public static class Encoder implements BiConsumer<PacketBattleInfo, FriendlyByteBuf> {
+ public static class Encoder implements BiConsumer<PacketBattleInfo, RegistryFriendlyByteBuf> {
public Encoder() {}
@Override
- public void accept(PacketBattleInfo msg, FriendlyByteBuf buf) {
+ public void accept(PacketBattleInfo msg, RegistryFriendlyByteBuf buf) {
buf.writeInt(msg.sideA.size());
buf.writeInt(msg.sideB.size());
for(Integer id : msg.sideA) {
}
}
- public static class Decoder implements Function<FriendlyByteBuf, PacketBattleInfo> {
+ public static class Decoder implements Function<RegistryFriendlyByteBuf, PacketBattleInfo> {
public Decoder() {}
@Override
- public PacketBattleInfo apply(FriendlyByteBuf buf) {
+ public PacketBattleInfo apply(RegistryFriendlyByteBuf buf) {
int sideACount = buf.readInt();
int sideBCount = buf.readInt();
Collection<Integer> sideA = new ArrayList<Integer>(sideACount);
package com.burnedkirby.TurnBasedMinecraft.common.networking;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.function.BiConsumer;
-import java.util.function.Function;
-
import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod;
-
import com.burnedkirby.TurnBasedMinecraft.common.Utility;
-import net.minecraft.network.FriendlyByteBuf;
+import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.Level;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.event.network.CustomPayloadEvent;
import net.minecraftforge.fml.DistExecutor;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+
public class PacketBattleMessage
{
public enum MessageType
this.custom = custom;
}
- public static class Encoder implements BiConsumer<PacketBattleMessage, FriendlyByteBuf> {
+ public static class Encoder implements BiConsumer<PacketBattleMessage, RegistryFriendlyByteBuf> {
public Encoder() {}
@Override
- public void accept(PacketBattleMessage pkt, FriendlyByteBuf buf) {
+ public void accept(PacketBattleMessage pkt, RegistryFriendlyByteBuf buf) {
buf.writeInt(pkt.messageType.getValue());
buf.writeInt(pkt.entityIDFrom);
buf.writeInt(pkt.entityIDTo);
}
}
- public static class Decoder implements Function<FriendlyByteBuf, PacketBattleMessage> {
+ public static class Decoder implements Function<RegistryFriendlyByteBuf, PacketBattleMessage> {
public Decoder() {}
@Override
- public PacketBattleMessage apply(FriendlyByteBuf buf) {
+ public PacketBattleMessage apply(RegistryFriendlyByteBuf buf) {
return new PacketBattleMessage(
MessageType.valueOf(
buf.readInt()),
package com.burnedkirby.TurnBasedMinecraft.common.networking;
-import java.util.function.BiConsumer;
-import java.util.function.Function;
-
import com.burnedkirby.TurnBasedMinecraft.common.Battle;
import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod;
-
-import net.minecraft.network.FriendlyByteBuf;
+import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraftforge.event.network.CustomPayloadEvent;
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+
public class PacketBattleRequestInfo
{
private int battleID;
this.battleID = battleID;
}
- public static class Encoder implements BiConsumer<PacketBattleRequestInfo, FriendlyByteBuf> {
+ public static class Encoder implements BiConsumer<PacketBattleRequestInfo, RegistryFriendlyByteBuf> {
public Encoder() {}
@Override
- public void accept(PacketBattleRequestInfo pkt, FriendlyByteBuf buf) {
+ public void accept(PacketBattleRequestInfo pkt, RegistryFriendlyByteBuf buf) {
buf.writeInt(pkt.battleID);
}
}
- public static class Decoder implements Function<FriendlyByteBuf, PacketBattleRequestInfo> {
+ public static class Decoder implements Function<RegistryFriendlyByteBuf, PacketBattleRequestInfo> {
public Decoder() {}
@Override
- public PacketBattleRequestInfo apply(FriendlyByteBuf buf) {
+ public PacketBattleRequestInfo apply(RegistryFriendlyByteBuf buf) {
return new PacketBattleRequestInfo(buf.readInt());
}
}
--- /dev/null
+package com.burnedkirby.TurnBasedMinecraft.common.networking;
+
+import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod;
+import net.minecraft.network.RegistryFriendlyByteBuf;
+import net.minecraftforge.api.distmarker.Dist;
+import net.minecraftforge.event.network.CustomPayloadEvent;
+import net.minecraftforge.fml.DistExecutor;
+
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+
+public class PacketClientGui {
+ int reserved;
+
+ public PacketClientGui() {
+ reserved = 0;
+ }
+
+ public PacketClientGui(int reserved) {
+ this.reserved = reserved;
+ }
+
+ public static class Encoder implements BiConsumer<PacketClientGui, RegistryFriendlyByteBuf> {
+ public Encoder() {}
+
+ @Override
+ public void accept(PacketClientGui pkt, RegistryFriendlyByteBuf buf) {
+ buf.writeInt(pkt.reserved);
+ }
+ }
+
+ public static class Decoder implements Function<RegistryFriendlyByteBuf, PacketClientGui> {
+ public Decoder() {}
+
+ @Override
+ public PacketClientGui apply(RegistryFriendlyByteBuf registryFriendlyByteBuf) {
+ return new PacketClientGui(registryFriendlyByteBuf.readInt());
+ }
+ }
+
+ public static class Consumer implements BiConsumer<PacketClientGui, CustomPayloadEvent.Context> {
+ public Consumer() {}
+
+ @Override
+ public void accept(PacketClientGui pkt, CustomPayloadEvent.Context ctx) {
+ ctx.enqueueWork(() -> {
+ DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> TurnBasedMinecraftMod.proxy.showClientConfigGui());
+ });
+ ctx.setPacketHandled(true);
+ }
+ }
+}
import com.burnedkirby.TurnBasedMinecraft.common.EntityInfo;
import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod;
-import net.minecraft.network.FriendlyByteBuf;
+import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.event.network.CustomPayloadEvent;
import net.minecraftforge.fml.DistExecutor;
}
}
- public static class Encoder implements BiConsumer<PacketEditingMessage, FriendlyByteBuf> {
+ public static class Encoder implements BiConsumer<PacketEditingMessage, RegistryFriendlyByteBuf> {
public Encoder() {}
@Override
- public void accept(PacketEditingMessage pkt, FriendlyByteBuf buf) {
+ public void accept(PacketEditingMessage pkt, RegistryFriendlyByteBuf buf) {
buf.writeInt(pkt.type.getValue());
if(pkt.entityInfo.classType != null) {
buf.writeUtf(pkt.entityInfo.classType.getName());
}
}
- public static class Decoder implements Function<FriendlyByteBuf, PacketEditingMessage> {
+ public static class Decoder implements Function<RegistryFriendlyByteBuf, PacketEditingMessage> {
public Decoder() {}
@Override
- public PacketEditingMessage apply(FriendlyByteBuf buf) {
+ public PacketEditingMessage apply(RegistryFriendlyByteBuf buf) {
Type type = Type.valueOf(buf.readInt());
EntityInfo einfo = new EntityInfo();
try {
package com.burnedkirby.TurnBasedMinecraft.common.networking;
-import java.util.function.BiConsumer;
-import java.util.function.Function;
-
import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod;
-
-import net.minecraft.network.FriendlyByteBuf;
+import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.event.network.CustomPayloadEvent;
import net.minecraftforge.fml.DistExecutor;
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+
public class PacketGeneralMessage
{
String message;
this.message = message;
}
- public static class Encoder implements BiConsumer<PacketGeneralMessage, FriendlyByteBuf> {
+ public static class Encoder implements BiConsumer<PacketGeneralMessage, RegistryFriendlyByteBuf> {
public Encoder() {}
@Override
- public void accept(PacketGeneralMessage pkt, FriendlyByteBuf buf) {
+ public void accept(PacketGeneralMessage pkt, RegistryFriendlyByteBuf buf) {
buf.writeUtf(pkt.message);
}
}
- public static class Decoder implements Function<FriendlyByteBuf, PacketGeneralMessage> {
+ public static class Decoder implements Function<RegistryFriendlyByteBuf, PacketGeneralMessage> {
public Decoder() {}
@Override
- public PacketGeneralMessage apply(FriendlyByteBuf buf) {
+ public PacketGeneralMessage apply(RegistryFriendlyByteBuf buf) {
return new PacketGeneralMessage(buf.readUtf());
}
}
# Please do not change this option, the mod uses this to keep track of what new
# changes to add to the config.
-version = 10
+version = 11
# 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]
-
-# What categories play this type of music (battle_music). Unknown categories will default to this type.
-battle_music = ["monster", "animal", "boss", "player"]
-# What categories play this type of music (silly_music).
-silly_music = ["passive"]
-
-# Minimum percentage of silly entities in battle to use silly music.
-silly_music_threshold = 40
+# Note that client config is no longer stored here but rather in the settings.
[server_config]
decision_flee_probability = 0
ignore_battle = false
+[[server_config.entity]]
+name = "net.minecraft.world.entity.monster.Bogged"
+attack_power = 3
+attack_probability = 75
+attack_variance = 1
+attack_effect = "poison"
+attack_effect_probability = 50
+defense_damage = 0
+evasion = 10
+category = "monster"
+speed = 20
+decision_attack_probability = 100
+decision_defend_probability = 0
+decision_flee_probability = 0
+ignore_battle = false
+
+[[server_config.entity]]
+name = "net.minecraft.world.entity.monster.breeze.Breeze"
+attack_power = 1
+attack_probability = 50
+attack_effect = "unknown"
+attack_variance = 0
+defense_damage = 0
+evasion = 45
+category = "monster"
+speed = 45
+decision_attack_probability = 100
+decision_defend_probability = 0
+decision_flee_probability = 0
+ignore_battle = false
+
[[server_config.entity]]
name = "net.minecraft.world.entity.monster.CaveSpider"
attack_power = 2
decision_flee_probability = 100
ignore_battle = false
+[[server_config.entity]]
+name = "net.minecraft.world.entity.animal.armadillo.Armadillo"
+attack_power = 0
+attack_probability = 0
+attack_variance = 0
+attack_effect = "unknown"
+defense_damage = 0
+evasion = 10
+category = "passive"
+speed = 20
+decision_attack_probability = 0
+decision_defend_probability = 50
+decision_flee_probability = 50
+ignore_battle = false
+
[[server_config.entity]]
name = "net.minecraft.world.entity.animal.axolotl.Axolotl"
attack_power = 2