diff --git a/build.gradle b/build.gradle index 67dde15..ab87dab 100644 --- a/build.gradle +++ b/build.gradle @@ -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 { diff --git a/gradle.properties b/gradle.properties index 2993c53..00e5b5b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a441313..9355b41 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/gradlew b/gradlew index 1aa94a4..b740cf1 100755 --- a/gradlew +++ b/gradlew @@ -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/. diff --git a/src/main/java/net/lizistired/cavedust/CaveDust.java b/src/main/java/net/lizistired/cavedust/CaveDust.java index 83435d9..2a5447d 100644 --- a/src/main/java/net/lizistired/cavedust/CaveDust.java +++ b/src/main/java/net/lizistired/cavedust/CaveDust.java @@ -4,6 +4,7 @@ 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 @@ private void createCaveDust(MinecraftClient client) { 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); } } diff --git a/src/main/java/net/lizistired/cavedust/CaveDustConfig.java b/src/main/java/net/lizistired/cavedust/CaveDustConfig.java index 33fc2aa..8a0ba36 100644 --- a/src/main/java/net/lizistired/cavedust/CaveDustConfig.java +++ b/src/main/java/net/lizistired/cavedust/CaveDustConfig.java @@ -3,8 +3,8 @@ 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 boolean getCaveDustEnabled(){ return caveDustEnabled; } - public ParticleEffect setParticle(String particleType){ + //todo + //public Identifier setParticle(String particleType){ //particleName = particleType; - save(); - return getParticle(); - } - - 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(); - } - } + //save(); + //return getParticle().get().getKey().get().getValue(); + //} + + //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 boolean setSuperFlatStatus(){ 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; diff --git a/src/main/java/net/lizistired/cavedust/ModMenuConfigScreen.java b/src/main/java/net/lizistired/cavedust/ModMenuConfigScreen.java index 516d047..83ca681 100644 --- a/src/main/java/net/lizistired/cavedust/ModMenuConfigScreen.java +++ b/src/main/java/net/lizistired/cavedust/ModMenuConfigScreen.java @@ -67,11 +67,12 @@ public void init() { .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 void render(DrawContext context, int mouseX, int mouseY, float partialTic 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"; + // } + //} } diff --git a/src/main/java/net/lizistired/cavedust/utils/TranslatableTextHelper.java b/src/main/java/net/lizistired/cavedust/utils/TranslatableTextHelper.java index 9d24951..a8aa570 100644 --- a/src/main/java/net/lizistired/cavedust/utils/TranslatableTextHelper.java +++ b/src/main/java/net/lizistired/cavedust/utils/TranslatableTextHelper.java @@ -3,8 +3,6 @@ import com.minelittlepony.common.client.gui.element.AbstractSlider; import net.minecraft.text.Text; -import javax.swing.*; - public class TranslatableTextHelper { public Text formatMaxWidth(AbstractSlider slider) { return Text.translatable("menu.cavedust.width", (int)Math.floor(slider.getValue())); diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 331dc88..085efff 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -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": {