break config, but now works in 1.21.3
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
plugins {
|
||||
id 'fabric-loom' version '1.7-SNAPSHOT'
|
||||
id 'fabric-loom' version '1.8-SNAPSHOT'
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
|
||||
archivesBaseName = project.archives_base_name
|
||||
version = project.mod_version
|
||||
group = project.maven_group
|
||||
@@ -61,7 +58,7 @@ processResources {
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
|
||||
it.options.release = 17
|
||||
it.options.release = 21
|
||||
}
|
||||
|
||||
java {
|
||||
@@ -69,6 +66,8 @@ java {
|
||||
// if it is present.
|
||||
// If you remove this line, sources will not be generated.
|
||||
withSourcesJar()
|
||||
sourceCompatibility = JavaVersion.VERSION_21
|
||||
targetCompatibility = JavaVersion.VERSION_21
|
||||
}
|
||||
|
||||
jar {
|
||||
|
||||
@@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx1G
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/develop
|
||||
minecraft_version=1.21
|
||||
yarn_mappings=1.21+build.4
|
||||
loader_version=0.15.11
|
||||
minecraft_version=1.21.3
|
||||
yarn_mappings=1.21.3+build.2
|
||||
loader_version=0.16.9
|
||||
|
||||
# Mod Properties
|
||||
mod_version=3.0.0
|
||||
@@ -13,7 +13,7 @@ org.gradle.jvmargs=-Xmx1G
|
||||
archives_base_name=cave_dust
|
||||
|
||||
# Dependencies
|
||||
fabric_version=0.100.4+1.21
|
||||
clothconfig_version=15.0.127
|
||||
modmenu_version=11.0.1
|
||||
kirin_version=1.19.0+1.21
|
||||
fabric_version=0.107.0+1.21.3
|
||||
clothconfig_version=16.0.141
|
||||
modmenu_version=12.0.0-beta.1
|
||||
kirin_version=1.19.1+1.21
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
2
gradlew
vendored
2
gradlew
vendored
@@ -55,7 +55,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
|
||||
@@ -4,6 +4,7 @@ package net.lizistired.cavedust;
|
||||
import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
@@ -90,12 +91,15 @@ public class CaveDust implements ClientModInitializer {
|
||||
|
||||
if (shouldParticlesSpawn(client, config, particlePos)) {
|
||||
if (client.world.getBlockState(particlePos).isAir()) {
|
||||
world.addParticle(config.getParticle(), miniX, miniY, miniZ, config.getVelocityRandomnessRandom() * 0.01, config.getVelocityRandomnessRandom() * 0.01, config.getVelocityRandomnessRandom() * 0.01);
|
||||
//todo
|
||||
//world.addParticle(config.getParticle(), miniX, miniY, miniZ, config.getVelocityRandomnessRandom() * 0.01, config.getVelocityRandomnessRandom() * 0.01, config.getVelocityRandomnessRandom() * 0.01);
|
||||
world.addParticle(CaveDustServer.CAVE_DUST, miniX, miniY, miniZ, config.getVelocityRandomnessRandom() * 0.01, config.getVelocityRandomnessRandom() * 0.01, config.getVelocityRandomnessRandom() * 0.01);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (NullPointerException e) {
|
||||
LOGGER.error(String.valueOf(e));
|
||||
//todo
|
||||
//getConfig().setParticleID(WHITE_ASH_ID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ package net.lizistired.cavedust;
|
||||
import net.lizistired.cavedust.utils.JsonFile;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.particle.ParticleEffect;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
import static net.lizistired.cavedust.CaveDust.*;
|
||||
@@ -122,23 +122,24 @@ public class CaveDustConfig extends JsonFile {
|
||||
return caveDustEnabled;
|
||||
}
|
||||
|
||||
public ParticleEffect setParticle(String particleType){
|
||||
//todo
|
||||
//public Identifier setParticle(String particleType){
|
||||
//particleName = particleType;
|
||||
save();
|
||||
return getParticle();
|
||||
}
|
||||
//save();
|
||||
//return getParticle().get().getKey().get().getValue();
|
||||
//}
|
||||
|
||||
public ParticleEffect getParticle(){
|
||||
try {
|
||||
return (ParticleEffect) Registries.PARTICLE_TYPE.get(Identifier.of(Registries.PARTICLE_TYPE.getEntry(getParticleID()).get().getKey().get().getValue().toString().toLowerCase()));
|
||||
} catch (ClassCastException e) {
|
||||
MinecraftClient.getInstance().player.sendMessage(Text.translatable("debug.cavedust.particleerror"), true);
|
||||
LOGGER.error("Cannot spawn particle, check config.");
|
||||
iterateParticle();
|
||||
save();
|
||||
return getParticle();
|
||||
}
|
||||
}
|
||||
//public ParticleEffect getParticle(){
|
||||
// try {
|
||||
// return Registries.PARTICLE_TYPE.getOptional(Identifier.of(Registries.PARTICLE_TYPE.getOptional(getParticleID()).get().getKey().get().getValue().toString().toLowerCase()));
|
||||
// } catch (ClassCastException e) {
|
||||
// MinecraftClient.getInstance().player.sendMessage(Text.translatable("debug.cavedust.particleerror"), true);
|
||||
// LOGGER.error("Cannot spawn particle, check config.");
|
||||
// iterateParticle();
|
||||
// save();
|
||||
// return getParticle();
|
||||
// }
|
||||
//}
|
||||
|
||||
public boolean getSeaLevelCheck() {
|
||||
return seaLevelCheck;
|
||||
@@ -175,27 +176,29 @@ public class CaveDustConfig extends JsonFile {
|
||||
return getSuperFlatStatus();
|
||||
}
|
||||
|
||||
public void iterateParticle(){
|
||||
if(getParticleID() > Registries.PARTICLE_TYPE.size() - 2) {
|
||||
particleID = 1;
|
||||
save();
|
||||
} else {
|
||||
particleID = getParticleID() + 1;
|
||||
save();
|
||||
}
|
||||
}
|
||||
//todo
|
||||
//public void iterateParticle(){
|
||||
// if(getParticleID() > Registries.PARTICLE_TYPE.size() - 2) {
|
||||
// particleID = 1;
|
||||
// save();
|
||||
// } else {
|
||||
// particleID = getParticleID() + 1;
|
||||
// save();
|
||||
// }
|
||||
//}
|
||||
|
||||
public void setParticleID(int particleID){
|
||||
this.particleID = particleID;
|
||||
save();
|
||||
}
|
||||
|
||||
public int getParticleID(){
|
||||
if ((!Registries.PARTICLE_TYPE.getEntry(particleID).isPresent())) {
|
||||
setParticleID(WHITE_ASH_ID);
|
||||
}
|
||||
return particleID;
|
||||
}
|
||||
//todo
|
||||
//public int getParticleID(){
|
||||
// if ((!Registries.PARTICLE_TYPE.getValueOrThrow())) {
|
||||
// setParticleID(WHITE_ASH_ID);
|
||||
// }
|
||||
// return particleID;
|
||||
//}
|
||||
|
||||
public void resetConfig(){
|
||||
width = 10;
|
||||
|
||||
@@ -67,11 +67,12 @@ public class ModMenuConfigScreen extends GameGui {
|
||||
.onChange(config::setParticleMultiplierMultiplier)
|
||||
.setTextFormat(transText::formatParticleMultiplierMultiplier)
|
||||
.getStyle().setTooltip(Text.translatable("menu.cavedust.particlemultipliermultiplier.tooltip"));
|
||||
addButton(new Button(left, row += 24).onClick(sender ->{
|
||||
config.iterateParticle();
|
||||
sender.getStyle().setText("Particle: " + (getNameOfParticle()));
|
||||
})).getStyle().setText("Particle: " + (getNameOfParticle()))
|
||||
.setTooltip(Text.translatable("menu.cavedust.particle.tooltip"));
|
||||
//todo
|
||||
//addButton(new Button(left, row += 24).onClick(sender ->{
|
||||
// config.iterateParticle();
|
||||
// sender.getStyle().setText("Particle: " + (getNameOfParticle()));
|
||||
//})).getStyle().setText("Particle: " + (getNameOfParticle()))
|
||||
// .setTooltip(Text.translatable("menu.cavedust.particle.tooltip"));
|
||||
|
||||
addButton(new Slider(left += 220, row -= 96, 1, 50, config.getDimensionWidth()))
|
||||
.onChange(config::setDimensionWidth)
|
||||
@@ -107,13 +108,14 @@ public class ModMenuConfigScreen extends GameGui {
|
||||
renderBackground(context, mouseX, mouseY, partialTicks);
|
||||
super.render(context, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
private String getNameOfParticle(){
|
||||
CaveDustConfig config = CaveDust.getInstance().getConfig();
|
||||
config.load();
|
||||
try {
|
||||
return Registries.PARTICLE_TYPE.getEntry(config.getParticleID()).get().getKey().get().getValue().toString();
|
||||
} catch (NoSuchElementException e){
|
||||
return "null";
|
||||
}
|
||||
}
|
||||
//todo
|
||||
//private String getNameOfParticle(){
|
||||
// CaveDustConfig config = CaveDust.getInstance().getConfig();
|
||||
// config.load();
|
||||
// try {
|
||||
// return Registries.PARTICLE_TYPE.getEntry(config.getParticleID()).get().getKey().get().getValue().toString();
|
||||
// } catch (NoSuchElementException e){
|
||||
// return "null";
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ package net.lizistired.cavedust.utils;
|
||||
import com.minelittlepony.common.client.gui.element.AbstractSlider;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class TranslatableTextHelper {
|
||||
public Text formatMaxWidth(AbstractSlider<Float> slider) {
|
||||
return Text.translatable("menu.cavedust.width", (int)Math.floor(slider.getValue()));
|
||||
|
||||
@@ -19,10 +19,7 @@
|
||||
"net.lizistired.cavedust.CaveDust"
|
||||
],
|
||||
"main": [
|
||||
"net.lizistired.cavedust.CaveDustServer"],
|
||||
"modmenu": [
|
||||
"net.lizistired.cavedust.CaveDustModMenuFactory"
|
||||
]
|
||||
"net.lizistired.cavedust.CaveDustServer"]
|
||||
},
|
||||
"mixins": [
|
||||
"dust.mixins.json"
|
||||
@@ -30,7 +27,7 @@
|
||||
"depends": {
|
||||
"fabricloader": ">=0.14.5",
|
||||
"fabric": "*",
|
||||
"minecraft": "1.21",
|
||||
"minecraft": "1.21.3",
|
||||
"java": ">=17"
|
||||
},
|
||||
"suggests": {
|
||||
|
||||
Reference in New Issue
Block a user