mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-05-20 16:50:28 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| db930739d7 | |||
| 9686372238 | |||
| 2120dde0db | |||
| f780450a7c | |||
| e870a9eb8d | |||
| e99ae48f1a | |||
| 2e2b315ab7 | |||
| 04554b886a | |||
| d3429626b5 | |||
| 349ce6654c | |||
| b04156bb45 |
@@ -44,7 +44,6 @@ You must put an x in all the boxes that it applies to. (Like this: [x])
|
||||
<!-- There is an included `.editorconfig` file in the base of the repo. Please use a plugin for your IDE of choice that follows those settings. -->
|
||||
- [ ] I have read the [`CONTRIBUTING.md`](https://github.com/PolyhedralDev/Terra/blob/master/CONTRIBUTING.md)
|
||||
document in the root of the git repository.
|
||||
- [ ] LLM-based tools were not used to create this PR. (ChatGPT, Claude, etc)
|
||||
|
||||
#### Types of changes
|
||||
|
||||
@@ -99,7 +98,7 @@ You must put an x in all the boxes that it applies to. (Like this: [x])
|
||||
- [ ] I am not the original author of this code, but it is in public domain or
|
||||
released under [GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html) or a compatible license.
|
||||
<!--
|
||||
Please provide reliable evidence of this. LLM-generated code does not satisfy this requirement.
|
||||
Please provide reliable evidence of this.
|
||||
NOTE: for compatible licenses, you must make sure to add the included license somewhere in the program, if so required.
|
||||
(And even if it's not required, it's still nice to do it. Also add attribution somewhere.)
|
||||
-->
|
||||
|
||||
@@ -21,7 +21,7 @@ jobs:
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4.7.1
|
||||
with:
|
||||
java-version: '21'
|
||||
java-version: '25'
|
||||
distribution: 'temurin'
|
||||
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
||||
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
||||
|
||||
+2
-5
@@ -258,9 +258,6 @@ as [GitHub Pull Requests](https://guides.github.com/activities/forking/#making-a
|
||||
see instead** and why.
|
||||
- **Explain why this enhancement would be useful** to most Terra users and isn't
|
||||
something that can or should be implemented as an addon.
|
||||
- **Do not use LLM/"AI" tools to create your pull request.** Your pr should be written
|
||||
by you. Using an LLM to automate small, tedious tasks (regex and other fiddly things like it)
|
||||
is acceptable, but submitting a low-effort, completely LLM-generated PR will result in a ban.
|
||||
|
||||
## Styleguides
|
||||
|
||||
@@ -384,7 +381,7 @@ compatibilities are welcome and encouraged, in the form of addons.**
|
||||
|
||||
### Platform-Agnostic Design
|
||||
|
||||
Terra must, at all times, remain platform-agnostic. This means it must be able
|
||||
Terra must, at all times, remain platform agnostic. This means it must be able
|
||||
to run on theoretically any voxel based platform. Including non-minecraft games
|
||||
like Terasology.
|
||||
|
||||
@@ -394,7 +391,7 @@ it'll be running on.
|
||||
Examples:
|
||||
|
||||
- Don't assume the world height is 256.
|
||||
- Don't assume that a specific block, item, or entity exists. (E.g. don't assume
|
||||
- Don't assume that a specific block, item, or entity exists. (Eg. don't assume
|
||||
there exists a block called `minecraft:grass_block`)
|
||||
|
||||
### Data-Driven
|
||||
|
||||
@@ -1,25 +1,21 @@
|
||||
import java.io.ByteArrayOutputStream
|
||||
import org.gradle.api.Action
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.support.serviceOf
|
||||
|
||||
|
||||
var isPrerelease = false
|
||||
|
||||
|
||||
fun Project.getGitHash(): String {
|
||||
val stdout = ByteArrayOutputStream()
|
||||
exec {
|
||||
return providers.exec {
|
||||
commandLine = mutableListOf("git", "rev-parse", "--short", "HEAD")
|
||||
standardOutput = stdout
|
||||
}
|
||||
return stdout.toString().trim()
|
||||
}.standardOutput.asText.get().trim()
|
||||
}
|
||||
|
||||
fun Project.gitClone(name: String) {
|
||||
val stdout = ByteArrayOutputStream()
|
||||
exec {
|
||||
providers.exec {
|
||||
commandLine = mutableListOf("git", "clone", name)
|
||||
standardOutput = stdout
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ object Versions {
|
||||
}
|
||||
|
||||
object Fabric {
|
||||
const val fabricAPI = "0.134.1+${Mod.minecraft}"
|
||||
const val fabricAPI = "0.140.0+${Mod.minecraft}"
|
||||
const val cloud = "2.0.0-beta.13"
|
||||
}
|
||||
//
|
||||
@@ -42,14 +42,14 @@ object Versions {
|
||||
// }
|
||||
|
||||
object Mod {
|
||||
const val mixin = "0.16.4+mixin.0.8.7"
|
||||
const val mixin = "0.16.5+mixin.0.8.7"
|
||||
const val mixinExtras = "0.5.0"
|
||||
|
||||
const val minecraft = "1.21.10"
|
||||
const val yarn = "$minecraft+build.1"
|
||||
const val fabricLoader = "0.18.2"
|
||||
const val minecraft = "1.21.11"
|
||||
const val yarn = "$minecraft+build.3"
|
||||
const val fabricLoader = "0.18.3"
|
||||
|
||||
const val architecuryLoom = "1.11.451"
|
||||
const val architecturyLoom = "1.13.463"
|
||||
const val architecturyPlugin = "3.4.162"
|
||||
|
||||
}
|
||||
@@ -60,9 +60,9 @@ object Versions {
|
||||
// }
|
||||
|
||||
object Bukkit {
|
||||
const val minecraft = "1.21.10"
|
||||
const val minecraft = "1.21.11-rc3"
|
||||
const val nms = "$minecraft-R0.1"
|
||||
const val paperBuild = "$nms-20251012.013929-7"
|
||||
const val paperBuild = "$nms-20251208.200020-2"
|
||||
const val paper = paperBuild
|
||||
const val paperLib = "1.0.8"
|
||||
const val reflectionRemapper = "0.1.3"
|
||||
@@ -86,16 +86,16 @@ object Versions {
|
||||
}
|
||||
|
||||
object Allay {
|
||||
const val api = "0.20.0"
|
||||
const val api = "0.13.0"
|
||||
const val gson = "2.13.2"
|
||||
|
||||
const val mappings = "366baa6"
|
||||
const val mappingsGenerator = "e957088"
|
||||
const val mappings = "15398c1"
|
||||
const val mappingsGenerator = "8fa6058"
|
||||
|
||||
const val mcmeta = "c976eb3"
|
||||
const val mcmeta = "e85a17c"
|
||||
}
|
||||
|
||||
object Minestom {
|
||||
const val minestom = "2025.10.04-1.21.8"
|
||||
const val minestom = "2025.12.20c-1.21.11"
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+2
-2
@@ -1,7 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionSha256Sum=845952a9d6afa783db70bb3b0effaae45ae5542ca2bb7929619e8af49cb634cf
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
|
||||
distributionSha256Sum=72f44c9f8ebcb1af43838f45ee5c4aa9c5444898b3468ab3f4af7b6076c5bc3f
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -114,7 +114,6 @@ case "$( uname )" in #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH="\\\"\\\""
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@@ -172,7 +171,6 @@ fi
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
@@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
|
||||
Vendored
+1
-2
@@ -70,11 +70,10 @@ goto fail
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
## Resource files
|
||||
|
||||
Current mapping version: je 1.21.11 to be 1.21.111
|
||||
Current mapping version: je 1.21.9 to be 1.21.111
|
||||
|
||||
- `mapping/biomes.json` and `mapping/items.json` are obtained from [GeyserMC/mappings](https://github.com/GeyserMC/mappings).
|
||||
- `mapping/blocks.json` is obtained from [GeyserMC/mappings-generator](https://github.com/GeyserMC/mappings-generator) (path: `https://github.com/GeyserMC/mappings-generator/blob/master/generator_blocks.json`).
|
||||
|
||||
+3
-3
@@ -25,15 +25,15 @@ public class CloudCommandSender implements CommandSender {
|
||||
|
||||
@Override
|
||||
public Optional<Entity> getEntity() {
|
||||
if(delegate.getExecutor() != null) {
|
||||
return Optional.of(BukkitAdapter.adapt(delegate.getExecutor()));
|
||||
if(delegate instanceof org.bukkit.entity.Entity entity) {
|
||||
return Optional.of(BukkitAdapter.adapt(entity));
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Player> getPlayer() {
|
||||
if(delegate.getSender() instanceof org.bukkit.entity.Player player) {
|
||||
if(delegate instanceof org.bukkit.entity.Player player) {
|
||||
return Optional.of(BukkitAdapter.adapt(player));
|
||||
}
|
||||
return Optional.empty();
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.dfsek.terra.bukkit.util.VersionUtil;
|
||||
|
||||
|
||||
public interface NMSInitializer {
|
||||
List<String> SUPPORTED_VERSIONS = List.of("v1.21.9", "v1.21.10");
|
||||
List<String> SUPPORTED_VERSIONS = List.of("v1.21.11");
|
||||
String MINECRAFT_VERSION = VersionUtil.getMinecraftVersionInfo().toString();
|
||||
String TERRA_PACKAGE = NMSInitializer.class.getPackageName();
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ import net.minecraft.core.HolderSet.Named;
|
||||
import net.minecraft.core.MappedRegistry;
|
||||
import net.minecraft.core.RegistrationInfo;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.entity.npc.VillagerType;
|
||||
import net.minecraft.world.entity.npc.villager.VillagerType;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.slf4j.Logger;
|
||||
@@ -34,7 +34,7 @@ import com.dfsek.terra.registry.master.ConfigRegistry;
|
||||
public class AwfulBukkitHacks {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AwfulBukkitHacks.class);
|
||||
|
||||
private static final Map<ResourceLocation, List<ResourceLocation>> terraBiomeMap = new HashMap<>();
|
||||
private static final Map<Identifier, List<Identifier>> terraBiomeMap = new HashMap<>();
|
||||
|
||||
public static void registerBiomes(ConfigRegistry configRegistry) {
|
||||
try {
|
||||
@@ -50,7 +50,7 @@ public class AwfulBukkitHacks {
|
||||
BukkitPlatformBiome platformBiome = (BukkitPlatformBiome) biome.getPlatformBiome();
|
||||
|
||||
NamespacedKey vanillaBukkitKey = platformBiome.getHandle().getKey();
|
||||
ResourceLocation vanillaMinecraftKey = ResourceLocation.fromNamespaceAndPath(vanillaBukkitKey.getNamespace(),
|
||||
Identifier vanillaMinecraftKey = Identifier.fromNamespaceAndPath(vanillaBukkitKey.getNamespace(),
|
||||
vanillaBukkitKey.getKey());
|
||||
|
||||
VanillaBiomeProperties vanillaBiomeProperties = biome.getContext().get(VanillaBiomeProperties.class);
|
||||
@@ -58,7 +58,7 @@ public class AwfulBukkitHacks {
|
||||
Biome platform = NMSBiomeInjector.createBiome(biomeRegistry.get(vanillaMinecraftKey).orElseThrow().value(),
|
||||
vanillaBiomeProperties);
|
||||
|
||||
ResourceLocation delegateMinecraftKey = ResourceLocation.fromNamespaceAndPath("terra",
|
||||
Identifier delegateMinecraftKey = Identifier.fromNamespaceAndPath("terra",
|
||||
NMSBiomeInjector.createBiomeID(pack, key));
|
||||
NamespacedKey delegateBukkitKey = NamespacedKey.fromString(delegateMinecraftKey.toString());
|
||||
ResourceKey<Biome> delegateKey = ResourceKey.create(Registries.BIOME, delegateMinecraftKey);
|
||||
@@ -75,7 +75,7 @@ public class AwfulBukkitHacks {
|
||||
Objects.requireNonNullElse(vanillaBiomeProperties.getVillagerType(),
|
||||
villagerMap.getOrDefault(delegateKey, VillagerType.PLAINS)));
|
||||
|
||||
terraBiomeMap.computeIfAbsent(vanillaMinecraftKey, i -> new ArrayList<>()).add(delegateKey.location());
|
||||
terraBiomeMap.computeIfAbsent(vanillaMinecraftKey, i -> new ArrayList<>()).add(delegateKey.identifier());
|
||||
|
||||
LOGGER.debug("Registered biome: " + delegateKey);
|
||||
} catch(NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
|
||||
@@ -100,8 +100,8 @@ public class AwfulBukkitHacks {
|
||||
tb -> NMSBiomeInjector.getEntry(biomeRegistry, tb).ifPresentOrElse(
|
||||
terra -> {
|
||||
LOGGER.debug("{} (vanilla for {}): {}",
|
||||
vanilla.unwrapKey().orElseThrow().location(),
|
||||
terra.unwrapKey().orElseThrow().location(),
|
||||
vanilla.unwrapKey().orElseThrow().identifier(),
|
||||
terra.unwrapKey().orElseThrow().identifier(),
|
||||
vanilla.tags().toList());
|
||||
vanilla.tags()
|
||||
.forEach(tag -> collect
|
||||
|
||||
+42
-37
@@ -2,7 +2,8 @@ package com.dfsek.terra.bukkit.nms;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.attribute.EnvironmentAttributes;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.biome.BiomeGenerationSettings;
|
||||
import net.minecraft.world.level.biome.BiomeSpecialEffects;
|
||||
@@ -17,7 +18,7 @@ import com.dfsek.terra.bukkit.nms.config.VanillaBiomeProperties;
|
||||
|
||||
public class NMSBiomeInjector {
|
||||
|
||||
public static <T> Optional<Holder<T>> getEntry(Registry<T> registry, ResourceLocation identifier) {
|
||||
public static <T> Optional<Holder<T>> getEntry(Registry<T> registry, Identifier identifier) {
|
||||
return registry.getOptional(identifier)
|
||||
.flatMap(registry::getResourceKey)
|
||||
.flatMap(registry::get);
|
||||
@@ -29,55 +30,59 @@ public class NMSBiomeInjector {
|
||||
|
||||
BiomeSpecialEffects.Builder effects = new BiomeSpecialEffects.Builder();
|
||||
|
||||
effects.fogColor(Objects.requireNonNullElse(vanillaBiomeProperties.getFogColor(), vanilla.getFogColor()))
|
||||
.waterColor(Objects.requireNonNullElse(vanillaBiomeProperties.getWaterColor(), vanilla.getWaterColor()))
|
||||
.waterFogColor(Objects.requireNonNullElse(vanillaBiomeProperties.getWaterFogColor(), vanilla.getWaterFogColor()))
|
||||
.skyColor(Objects.requireNonNullElse(vanillaBiomeProperties.getSkyColor(), vanilla.getSkyColor()))
|
||||
// TODO: Migrate to EnvironmentAttributes
|
||||
// builder.setAttribute(EnvironmentAttributes.FOG_COLOR, Objects.requireNonNullElse(vanillaBiomeProperties.getFogColor(), vanilla.getAttributes().get(EnvironmentAttributes.FOG_COLOR)))
|
||||
|
||||
// effects.fogColor(Objects.requireNonNullElse(vanillaBiomeProperties.getFogColor(), vanilla.getFogColor()));
|
||||
effects.waterColor(Objects.requireNonNullElse(vanillaBiomeProperties.getWaterColor(), vanilla.getWaterColor()))
|
||||
// .waterFogColor(Objects.requireNonNullElse(vanillaBiomeProperties.getWaterFogColor(), vanilla.getWaterFogColor()))
|
||||
// .skyColor(Objects.requireNonNullElse(vanillaBiomeProperties.getSkyColor(), vanilla.getSkyColor()))
|
||||
.grassColorModifier(Objects.requireNonNullElse(vanillaBiomeProperties.getGrassColorModifier(),
|
||||
vanilla.getSpecialEffects().getGrassColorModifier()))
|
||||
.backgroundMusicVolume(Objects.requireNonNullElse(vanillaBiomeProperties.getMusicVolume(), vanilla.getBackgroundMusicVolume()));
|
||||
vanilla.getSpecialEffects().grassColorModifier()));
|
||||
// .backgroundMusicVolume(Objects.requireNonNullElse(vanillaBiomeProperties.getMusicVolume(), vanilla.getBackgroundMusicVolume()));
|
||||
|
||||
if(vanillaBiomeProperties.getGrassColor() == null) {
|
||||
vanilla.getSpecialEffects().getGrassColorOverride().ifPresent(effects::grassColorOverride);
|
||||
vanilla.getSpecialEffects().grassColorOverride().ifPresent(effects::grassColorOverride);
|
||||
} else {
|
||||
effects.grassColorOverride(vanillaBiomeProperties.getGrassColor());
|
||||
}
|
||||
|
||||
if(vanillaBiomeProperties.getFoliageColor() == null) {
|
||||
vanilla.getSpecialEffects().getFoliageColorOverride().ifPresent(effects::foliageColorOverride);
|
||||
vanilla.getSpecialEffects().foliageColorOverride().ifPresent(effects::foliageColorOverride);
|
||||
} else {
|
||||
effects.foliageColorOverride(vanillaBiomeProperties.getFoliageColor());
|
||||
}
|
||||
|
||||
if(vanillaBiomeProperties.getParticleConfig() == null) {
|
||||
vanilla.getSpecialEffects().getAmbientParticleSettings().ifPresent(effects::ambientParticle);
|
||||
} else {
|
||||
effects.ambientParticle(vanillaBiomeProperties.getParticleConfig());
|
||||
}
|
||||
// TODO
|
||||
// if(vanillaBiomeProperties.getParticleConfig() == null) {
|
||||
// vanilla.getSpecialEffects().getAmbientParticleSettings().ifPresent(effects::ambientParticle);
|
||||
// } else {
|
||||
// effects.ambientParticle(vanillaBiomeProperties.getParticleConfig());
|
||||
// }
|
||||
|
||||
if(vanillaBiomeProperties.getLoopSound() == null) {
|
||||
vanilla.getSpecialEffects().getAmbientLoopSoundEvent().ifPresent(effects::ambientLoopSound);
|
||||
} else {
|
||||
RegistryFetcher.soundEventRegistry().get(vanillaBiomeProperties.getLoopSound().location()).ifPresent(effects::ambientLoopSound);
|
||||
}
|
||||
// if(vanillaBiomeProperties.getLoopSound() == null) {
|
||||
// vanilla.getSpecialEffects().getAmbientLoopSoundEvent().ifPresent(effects::ambientLoopSound);
|
||||
// } else {
|
||||
// RegistryFetcher.soundEventRegistry().get(vanillaBiomeProperties.getLoopSound().location()).ifPresent(effects::ambientLoopSound);
|
||||
// }
|
||||
|
||||
if(vanillaBiomeProperties.getMoodSound() == null) {
|
||||
vanilla.getSpecialEffects().getAmbientMoodSettings().ifPresent(effects::ambientMoodSound);
|
||||
} else {
|
||||
effects.ambientMoodSound(vanillaBiomeProperties.getMoodSound());
|
||||
}
|
||||
|
||||
if(vanillaBiomeProperties.getAdditionsSound() == null) {
|
||||
vanilla.getSpecialEffects().getAmbientAdditionsSettings().ifPresent(effects::ambientAdditionsSound);
|
||||
} else {
|
||||
effects.ambientAdditionsSound(vanillaBiomeProperties.getAdditionsSound());
|
||||
}
|
||||
|
||||
if(vanillaBiomeProperties.getMusic() == null) {
|
||||
vanilla.getSpecialEffects().getBackgroundMusic().ifPresent(effects::backgroundMusic);
|
||||
} else {
|
||||
effects.backgroundMusic(vanillaBiomeProperties.getMusic());
|
||||
}
|
||||
// if(vanillaBiomeProperties.getMoodSound() == null) {
|
||||
// vanilla.getSpecialEffects().getAmbientMoodSettings().ifPresent(effects::ambientMoodSound);
|
||||
// } else {
|
||||
// effects.ambientMoodSound(vanillaBiomeProperties.getMoodSound());
|
||||
// }
|
||||
//
|
||||
// if(vanillaBiomeProperties.getAdditionsSound() == null) {
|
||||
// vanilla.getSpecialEffects().getAmbientAdditionsSettings().ifPresent(effects::ambientAdditionsSound);
|
||||
// } else {
|
||||
// effects.ambientAdditionsSound(vanillaBiomeProperties.getAdditionsSound());
|
||||
// }
|
||||
//
|
||||
// if(vanillaBiomeProperties.getMusic() == null) {
|
||||
// vanilla.getSpecialEffects().getBackgroundMusic().ifPresent(effects::backgroundMusic);
|
||||
// } else {
|
||||
// effects.backgroundMusic(vanillaBiomeProperties.getMusic());
|
||||
// }
|
||||
|
||||
builder.hasPrecipitation(Objects.requireNonNullElse(vanillaBiomeProperties.getPrecipitation(), vanilla.hasPrecipitation()));
|
||||
|
||||
|
||||
@@ -2,15 +2,15 @@ package com.dfsek.terra.bukkit.nms;
|
||||
|
||||
import com.dfsek.tectonic.api.TypeRegistry;
|
||||
import com.dfsek.tectonic.api.exception.LoadException;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.sounds.Music;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.attribute.AmbientParticle;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import net.minecraft.world.entity.npc.VillagerType;
|
||||
import net.minecraft.world.level.biome.AmbientAdditionsSettings;
|
||||
import net.minecraft.world.level.biome.AmbientMoodSettings;
|
||||
import net.minecraft.world.level.biome.AmbientParticleSettings;
|
||||
import net.minecraft.world.attribute.AmbientAdditionsSettings;
|
||||
import net.minecraft.world.attribute.AmbientMoodSettings;
|
||||
import net.minecraft.world.entity.npc.villager.VillagerType;
|
||||
import net.minecraft.world.level.biome.Biome.Precipitation;
|
||||
import net.minecraft.world.level.biome.Biome.TemperatureModifier;
|
||||
import net.minecraft.world.level.biome.BiomeSpecialEffects.GrassColorModifier;
|
||||
@@ -52,8 +52,8 @@ public class NMSPlatform extends PlatformImpl {
|
||||
public void register(TypeRegistry registry) {
|
||||
super.register(registry);
|
||||
registry.registerLoader(PlatformBiome.class, (type, o, loader, depthTracker) -> parseBiome((String) o, depthTracker))
|
||||
.registerLoader(ResourceLocation.class, (type, o, loader, depthTracker) -> {
|
||||
ResourceLocation identifier = ResourceLocation.tryParse((String) o);
|
||||
.registerLoader(Identifier.class, (type, o, loader, depthTracker) -> {
|
||||
Identifier identifier = Identifier.tryParse((String) o);
|
||||
if(identifier == null)
|
||||
throw new LoadException("Invalid identifier: " + o, depthTracker);
|
||||
return identifier;
|
||||
@@ -67,7 +67,7 @@ public class NMSPlatform extends PlatformImpl {
|
||||
(type, o, loader, depthTracker) -> TemperatureModifier.valueOf(((String) o).toUpperCase(
|
||||
Locale.ROOT)))
|
||||
.registerLoader(MobCategory.class, (type, o, loader, depthTracker) -> MobCategory.valueOf((String) o))
|
||||
.registerLoader(AmbientParticleSettings.class, BiomeParticleConfigTemplate::new)
|
||||
.registerLoader(AmbientParticle.class, BiomeParticleConfigTemplate::new)
|
||||
.registerLoader(SoundEvent.class, SoundEventTemplate::new)
|
||||
.registerLoader(AmbientMoodSettings.class, BiomeMoodSoundTemplate::new)
|
||||
.registerLoader(AmbientAdditionsSettings.class, BiomeAdditionsSoundTemplate::new)
|
||||
|
||||
@@ -7,7 +7,7 @@ import net.minecraft.core.MappedRegistry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.server.level.ChunkMap;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.entity.npc.VillagerType;
|
||||
import net.minecraft.world.entity.npc.villager.VillagerType;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.StructureManager;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.level.biome.AmbientAdditionsSettings;
|
||||
import net.minecraft.world.attribute.AmbientAdditionsSettings;
|
||||
|
||||
|
||||
public class BiomeAdditionsSoundTemplate implements ObjectTemplate<AmbientAdditionsSettings> {
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.level.biome.AmbientMoodSettings;
|
||||
import net.minecraft.world.attribute.AmbientMoodSettings;
|
||||
|
||||
|
||||
public class BiomeMoodSoundTemplate implements ObjectTemplate<AmbientMoodSettings> {
|
||||
|
||||
+4
-4
@@ -8,12 +8,12 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import net.minecraft.commands.arguments.ParticleArgument;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.world.level.biome.AmbientParticleSettings;
|
||||
import net.minecraft.world.attribute.AmbientParticle;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
||||
public class BiomeParticleConfigTemplate implements ObjectTemplate<AmbientParticleSettings> {
|
||||
public class BiomeParticleConfigTemplate implements ObjectTemplate<AmbientParticle> {
|
||||
@Value("particle")
|
||||
@Default
|
||||
private String particle = null;
|
||||
@@ -23,13 +23,13 @@ public class BiomeParticleConfigTemplate implements ObjectTemplate<AmbientPartic
|
||||
private Float probability = 0.1f;
|
||||
|
||||
@Override
|
||||
public AmbientParticleSettings get() {
|
||||
public AmbientParticle get() {
|
||||
if(particle == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return new AmbientParticleSettings(ParticleArgument.readParticle(new StringReader(particle),
|
||||
return new AmbientParticle(ParticleArgument.readParticle(new StringReader(particle),
|
||||
HolderLookup.Provider.create(Stream.of(BuiltInRegistries.PARTICLE_TYPE))), probability);
|
||||
} catch(CommandSyntaxException e) {
|
||||
throw new RuntimeException(e);
|
||||
|
||||
+2
-2
@@ -4,14 +4,14 @@ import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
|
||||
|
||||
public class EntityTypeTemplate implements ObjectTemplate<EntityType<?>> {
|
||||
@Value("id")
|
||||
@Default
|
||||
private ResourceLocation id = null;
|
||||
private Identifier id = null;
|
||||
|
||||
@Override
|
||||
public EntityType<?> get() {
|
||||
|
||||
+2
-2
@@ -3,14 +3,14 @@ package com.dfsek.terra.bukkit.nms.config;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
|
||||
|
||||
public class SoundEventTemplate implements ObjectTemplate<SoundEvent> {
|
||||
@Value("id")
|
||||
@Default
|
||||
private ResourceLocation id = null;
|
||||
private Identifier id = null;
|
||||
|
||||
@Value("distance-to-travel")
|
||||
@Default
|
||||
|
||||
+6
-6
@@ -6,10 +6,10 @@ import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.sounds.Music;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.entity.npc.VillagerType;
|
||||
import net.minecraft.world.level.biome.AmbientAdditionsSettings;
|
||||
import net.minecraft.world.level.biome.AmbientMoodSettings;
|
||||
import net.minecraft.world.level.biome.AmbientParticleSettings;
|
||||
import net.minecraft.world.entity.npc.villager.VillagerType;
|
||||
import net.minecraft.world.attribute.AmbientAdditionsSettings;
|
||||
import net.minecraft.world.attribute.AmbientMoodSettings;
|
||||
import net.minecraft.world.attribute.AmbientParticle;
|
||||
import net.minecraft.world.level.biome.Biome.TemperatureModifier;
|
||||
import net.minecraft.world.level.biome.BiomeSpecialEffects.GrassColorModifier;
|
||||
import net.minecraft.world.level.biome.MobSpawnSettings;
|
||||
@@ -52,7 +52,7 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
|
||||
|
||||
@Value("particles")
|
||||
@Default
|
||||
private AmbientParticleSettings particleConfig = null;
|
||||
private AmbientParticle particleConfig = null;
|
||||
|
||||
@Value("climate.precipitation")
|
||||
@Default
|
||||
@@ -130,7 +130,7 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
|
||||
return grassColorModifier;
|
||||
}
|
||||
|
||||
public AmbientParticleSettings getParticleConfig() {
|
||||
public AmbientParticle getParticleConfig() {
|
||||
return particleConfig;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -5,14 +5,14 @@ import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.npc.VillagerType;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.entity.npc.villager.VillagerType;
|
||||
|
||||
|
||||
public class VillagerTypeTemplate implements ObjectTemplate<ResourceKey<VillagerType>> {
|
||||
@Value("id")
|
||||
@Default
|
||||
private ResourceLocation id = null;
|
||||
private Identifier id = null;
|
||||
|
||||
@Override
|
||||
public ResourceKey<VillagerType> get() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import java.util.*
|
||||
|
||||
plugins {
|
||||
id("dev.architectury.loom") version Versions.Mod.architecuryLoom
|
||||
id("dev.architectury.loom") version Versions.Mod.architecturyLoom
|
||||
id("architectury-plugin") version Versions.Mod.architecturyPlugin
|
||||
}
|
||||
|
||||
|
||||
@@ -9,3 +9,7 @@ dependencies {
|
||||
tasks.named("jar") {
|
||||
finalizedBy("installAddonsIntoDefaultJar")
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
options.release = 25
|
||||
}
|
||||
@@ -20,6 +20,10 @@ tasks.withType<Jar> {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
options.release = 25
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass.set(javaMainClass)
|
||||
}
|
||||
|
||||
+5
-3
@@ -7,6 +7,8 @@ import net.kyori.adventure.util.RGBLike;
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.instance.Instance;
|
||||
import net.minestom.server.sound.SoundEvent;
|
||||
import net.minestom.server.world.attribute.AmbientParticle;
|
||||
import net.minestom.server.world.attribute.AmbientSounds;
|
||||
import net.minestom.server.world.biome.BiomeEffects;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -82,9 +84,9 @@ public final class TerraMinestomPlatform extends AbstractPlatform {
|
||||
(TypeLoader<EntityType>) (annotatedType, o, configLoader, depthTracker) -> new MinestomEntityType((String) o))
|
||||
.registerLoader(BlockState.class,
|
||||
(TypeLoader<BlockState>) (annotatedType, o, configLoader, depthTracker) -> worldHandle.createBlockState((String) o))
|
||||
.registerLoader(BiomeEffects.Particle.class, BiomeParticleConfigTemplate::new)
|
||||
.registerLoader(BiomeEffects.MoodSound.class, BiomeMoodSoundTemplate::new)
|
||||
.registerLoader(BiomeEffects.AdditionsSound.class, BiomeAdditionsSoundTemplate::new)
|
||||
.registerLoader(AmbientParticle.class, BiomeParticleConfigTemplate::new)
|
||||
.registerLoader(AmbientSounds.Mood.class, BiomeMoodSoundTemplate::new)
|
||||
.registerLoader(AmbientSounds.Additions.class, BiomeAdditionsSoundTemplate::new)
|
||||
.registerLoader(SoundEvent.class, SoundEventTemplate::new);
|
||||
}
|
||||
|
||||
|
||||
+19
-20
@@ -5,6 +5,7 @@ import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.color.Color;
|
||||
import net.minestom.server.registry.DynamicRegistry;
|
||||
import net.minestom.server.registry.RegistryKey;
|
||||
import net.minestom.server.world.attribute.EnvironmentAttribute;
|
||||
import net.minestom.server.world.biome.Biome;
|
||||
import net.minestom.server.world.biome.BiomeEffects;
|
||||
import org.intellij.lang.annotations.Subst;
|
||||
@@ -27,6 +28,11 @@ public class MinestomUserDefinedBiomeFactory implements BiomeFactory {
|
||||
return first;
|
||||
}
|
||||
|
||||
private static <T> void applyAttributeIfNotNull(Biome.Builder biomeBuilder, EnvironmentAttribute<T> attribute, T value) {
|
||||
if (value == null) return;
|
||||
biomeBuilder.setAttribute(attribute, value);
|
||||
}
|
||||
|
||||
@Subst("value")
|
||||
protected static String createBiomeID(ConfigPack pack, String biomeId) {
|
||||
return pack.getID().toLowerCase() + "/" + biomeId.toLowerCase(Locale.ROOT);
|
||||
@@ -41,32 +47,25 @@ public class MinestomUserDefinedBiomeFactory implements BiomeFactory {
|
||||
Key key = Key.key("terra", createBiomeID(pack, source.getID()));
|
||||
|
||||
BiomeEffects.Builder effectsBuilder = BiomeEffects.builder()
|
||||
.fogColor(mergeNullable(properties.getFogColor(), parentEffects.fogColor()))
|
||||
.skyColor(mergeNullable(properties.getSkyColor(), parentEffects.skyColor()))
|
||||
.waterColor(mergeNullable(properties.getWaterColor(), parentEffects.waterColor()))
|
||||
.waterFogColor(mergeNullable(properties.getWaterFogColor(), parentEffects.waterFogColor()))
|
||||
.foliageColor(mergeNullable(properties.getFoliageColor(), parentEffects.foliageColor()))
|
||||
.grassColor(mergeNullable(properties.getGrassColor(), parentEffects.grassColor()))
|
||||
.grassColorModifier(mergeNullable(properties.getGrassColorModifier(), parentEffects.grassColorModifier()))
|
||||
.biomeParticle(mergeNullable(properties.getParticleConfig(), parentEffects.biomeParticle()))
|
||||
.ambientSound(mergeNullable(properties.getLoopSound(), parentEffects.ambientSound()))
|
||||
.moodSound(mergeNullable(properties.getMoodSound(), parentEffects.moodSound()))
|
||||
.additionsSound(mergeNullable(properties.getAdditionsSound(), parentEffects.additionsSound()))
|
||||
// TODO music
|
||||
.music(parentEffects.music())
|
||||
.musicVolume(parentEffects.musicVolume());
|
||||
.grassColorModifier(mergeNullable(properties.getGrassColorModifier(), parentEffects.grassColorModifier()));
|
||||
|
||||
if(effectsBuilder.build().equals(BiomeEffects.PLAINS_EFFECTS)) {
|
||||
effectsBuilder.fogColor(new Color(0xC0D8FE)); // circumvent a minestom bug
|
||||
}
|
||||
|
||||
Biome target = Biome.builder()
|
||||
Biome.Builder targetBuilder = Biome.builder()
|
||||
.downfall(mergeNullable(properties.getDownfall(), parent.downfall()))
|
||||
.hasPrecipitation(mergeNullable(properties.getPrecipitation(), parent.hasPrecipitation()))
|
||||
.precipitation(mergeNullable(properties.getPrecipitation(), parent.hasPrecipitation()))
|
||||
.temperature(mergeNullable(properties.getTemperature(), parent.temperature()))
|
||||
.temperatureModifier(mergeNullable(properties.getTemperatureModifier(), parent.temperatureModifier()))
|
||||
.effects(effectsBuilder.build())
|
||||
.build();
|
||||
.effects(effectsBuilder.build());
|
||||
|
||||
applyAttributeIfNotNull(targetBuilder, EnvironmentAttribute.FOG_COLOR, properties.getFogColor());
|
||||
applyAttributeIfNotNull(targetBuilder, EnvironmentAttribute.SKY_COLOR, properties.getSkyColor());
|
||||
applyAttributeIfNotNull(targetBuilder, EnvironmentAttribute.WATER_FOG_COLOR, properties.getWaterFogColor());
|
||||
applyAttributeIfNotNull(targetBuilder, EnvironmentAttribute.AMBIENT_PARTICLES, properties.getParticleConfig());
|
||||
applyAttributeIfNotNull(targetBuilder, EnvironmentAttribute.AMBIENT_SOUNDS, properties.getAmbientSoundConfig());
|
||||
// TODO music
|
||||
|
||||
Biome target = targetBuilder.build();
|
||||
|
||||
RegistryKey<Biome> registryKey = MinecraftServer.getBiomeRegistry().register(key, target);
|
||||
return new UserDefinedBiome(key, registryKey, source.getID(), target);
|
||||
|
||||
+4
-3
@@ -4,10 +4,11 @@ import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
import net.minestom.server.sound.SoundEvent;
|
||||
import net.minestom.server.world.attribute.AmbientSounds;
|
||||
import net.minestom.server.world.biome.BiomeEffects;
|
||||
|
||||
|
||||
public class BiomeAdditionsSoundTemplate implements ObjectTemplate<BiomeEffects.AdditionsSound> {
|
||||
public class BiomeAdditionsSoundTemplate implements ObjectTemplate<AmbientSounds.Additions> {
|
||||
@Value("sound")
|
||||
@Default
|
||||
private SoundEvent sound = null;
|
||||
@@ -17,8 +18,8 @@ public class BiomeAdditionsSoundTemplate implements ObjectTemplate<BiomeEffects.
|
||||
private Double soundChance = null;
|
||||
|
||||
@Override
|
||||
public BiomeEffects.AdditionsSound get() {
|
||||
public AmbientSounds.Additions get() {
|
||||
if(sound == null) return null;
|
||||
return new BiomeEffects.AdditionsSound(sound, soundChance);
|
||||
return new AmbientSounds.Additions(sound, soundChance);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -4,10 +4,11 @@ import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
import net.minestom.server.sound.SoundEvent;
|
||||
import net.minestom.server.world.attribute.AmbientSounds;
|
||||
import net.minestom.server.world.biome.BiomeEffects;
|
||||
|
||||
|
||||
public class BiomeMoodSoundTemplate implements ObjectTemplate<BiomeEffects.MoodSound> {
|
||||
public class BiomeMoodSoundTemplate implements ObjectTemplate<AmbientSounds.Mood> {
|
||||
@Value("sound")
|
||||
@Default
|
||||
private SoundEvent sound = null;
|
||||
@@ -25,9 +26,9 @@ public class BiomeMoodSoundTemplate implements ObjectTemplate<BiomeEffects.MoodS
|
||||
private Double soundExtraDistance = null;
|
||||
|
||||
@Override
|
||||
public BiomeEffects.MoodSound get() {
|
||||
public AmbientSounds.Mood get() {
|
||||
if(sound == null) return null;
|
||||
return new BiomeEffects.MoodSound(
|
||||
return new AmbientSounds.Mood(
|
||||
sound,
|
||||
soundCultivationTicks,
|
||||
soundSpawnRange,
|
||||
|
||||
+6
-5
@@ -4,11 +4,12 @@ import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
import net.minestom.server.particle.Particle;
|
||||
import net.minestom.server.world.attribute.AmbientParticle;
|
||||
import net.minestom.server.world.biome.BiomeEffects;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeEffects.Particle> {
|
||||
public class BiomeParticleConfigTemplate implements ObjectTemplate<AmbientParticle> {
|
||||
@Value("particle")
|
||||
@Default
|
||||
private String particle = null;
|
||||
@@ -18,7 +19,7 @@ public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeEffects.
|
||||
private Float probability = null;
|
||||
|
||||
@Override
|
||||
public BiomeEffects.Particle get() {
|
||||
public AmbientParticle get() {
|
||||
if(particle == null || probability == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -31,9 +32,9 @@ public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeEffects.
|
||||
return null;
|
||||
}
|
||||
|
||||
return new BiomeEffects.Particle(
|
||||
probability,
|
||||
parsedParticle
|
||||
return new AmbientParticle(
|
||||
parsedParticle,
|
||||
probability
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+17
-15
@@ -5,12 +5,16 @@ import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
import net.kyori.adventure.util.RGBLike;
|
||||
import net.minestom.server.sound.SoundEvent;
|
||||
import net.minestom.server.world.attribute.AmbientParticle;
|
||||
import net.minestom.server.world.attribute.AmbientSounds;
|
||||
import net.minestom.server.world.biome.Biome.TemperatureModifier;
|
||||
import net.minestom.server.world.biome.BiomeEffects;
|
||||
import net.minestom.server.world.biome.BiomeEffects.GrassColorModifier;
|
||||
|
||||
import com.dfsek.terra.api.properties.Properties;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class VanillaBiomeProperties implements ConfigTemplate, Properties {
|
||||
@Value("colors.grass")
|
||||
@@ -43,7 +47,7 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
|
||||
|
||||
@Value("particles")
|
||||
@Default
|
||||
private BiomeEffects.Particle particleConfig = null;
|
||||
private AmbientParticle particleConfig = null;
|
||||
|
||||
@Value("climate.precipitation")
|
||||
@Default
|
||||
@@ -67,11 +71,11 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
|
||||
|
||||
@Value("sound.mood-sound")
|
||||
@Default
|
||||
private BiomeEffects.MoodSound moodSound = null;
|
||||
private AmbientSounds.Mood moodSound = null;
|
||||
|
||||
@Value("sound.additions-sound")
|
||||
@Default
|
||||
private BiomeEffects.AdditionsSound additionsSound = null;
|
||||
private AmbientSounds.Additions additionsSound = null;
|
||||
|
||||
// @Value("sound.music")
|
||||
// @Default
|
||||
@@ -105,8 +109,9 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
|
||||
return grassColorModifier;
|
||||
}
|
||||
|
||||
public BiomeEffects.Particle getParticleConfig() {
|
||||
return particleConfig;
|
||||
public List<AmbientParticle> getParticleConfig() {
|
||||
if (particleConfig == null) return null;
|
||||
return List.of(particleConfig);
|
||||
}
|
||||
|
||||
public Boolean getPrecipitation() {
|
||||
@@ -125,15 +130,12 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
|
||||
return downfall;
|
||||
}
|
||||
|
||||
public SoundEvent getLoopSound() {
|
||||
return loopSound;
|
||||
}
|
||||
|
||||
public BiomeEffects.MoodSound getMoodSound() {
|
||||
return moodSound;
|
||||
}
|
||||
|
||||
public BiomeEffects.AdditionsSound getAdditionsSound() {
|
||||
return additionsSound;
|
||||
public AmbientSounds getAmbientSoundConfig() {
|
||||
List<AmbientSounds.Additions> additions = additionsSound == null ? List.of() : List.of(additionsSound);
|
||||
return new AmbientSounds(
|
||||
loopSound,
|
||||
moodSound,
|
||||
additions
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id("dev.architectury.loom") version Versions.Mod.architecuryLoom
|
||||
id("dev.architectury.loom") version Versions.Mod.architecturyLoom
|
||||
id("architectury-plugin") version Versions.Mod.architecturyPlugin
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ dependencies {
|
||||
|
||||
compileOnly("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
|
||||
annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
|
||||
annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecuryLoom}")
|
||||
annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecturyLoom}")
|
||||
|
||||
minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}")
|
||||
mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2")
|
||||
|
||||
@@ -14,11 +14,11 @@ import net.minecraft.sound.MusicSound;
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.village.VillagerType;
|
||||
import net.minecraft.world.attribute.AmbientParticle;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.Biome.Precipitation;
|
||||
import net.minecraft.world.biome.Biome.TemperatureModifier;
|
||||
import net.minecraft.world.biome.BiomeEffects.GrassColorModifier;
|
||||
import net.minecraft.world.biome.BiomeParticleConfig;
|
||||
import net.minecraft.world.biome.SpawnSettings;
|
||||
import net.minecraft.world.biome.source.MultiNoiseBiomeSourceParameterList;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
@@ -87,7 +87,7 @@ public abstract class ModPlatform extends AbstractPlatform {
|
||||
.registerLoader(TemperatureModifier.class,
|
||||
(type, o, loader, depthTracker) -> TemperatureModifier.valueOf(((String) o).toUpperCase()))
|
||||
.registerLoader(SpawnGroup.class, (type, o, loader, depthTracker) -> SpawnGroup.valueOf((String) o))
|
||||
.registerLoader(BiomeParticleConfig.class, BiomeParticleConfigTemplate::new)
|
||||
.registerLoader(AmbientParticle.class, BiomeParticleConfigTemplate::new)
|
||||
.registerLoader(SoundEvent.class, SoundEventTemplate::new)
|
||||
.registerLoader(BiomeMoodSound.class, BiomeMoodSoundTemplate::new)
|
||||
.registerLoader(BiomeAdditionsSound.class, BiomeAdditionsSoundTemplate::new)
|
||||
|
||||
+4
-5
@@ -8,12 +8,11 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import net.minecraft.command.argument.ParticleEffectArgumentType;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.RegistryWrapper;
|
||||
import net.minecraft.world.biome.BiomeParticleConfig;
|
||||
|
||||
import net.minecraft.world.attribute.AmbientParticle;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
||||
public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeParticleConfig> {
|
||||
public class BiomeParticleConfigTemplate implements ObjectTemplate<AmbientParticle> {
|
||||
@Value("particle")
|
||||
@Default
|
||||
private String particle = null;
|
||||
@@ -23,13 +22,13 @@ public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeParticle
|
||||
private Float probability = 0.1f;
|
||||
|
||||
@Override
|
||||
public BiomeParticleConfig get() {
|
||||
public AmbientParticle get() {
|
||||
if(particle == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return new BiomeParticleConfig(
|
||||
return new AmbientParticle(
|
||||
ParticleEffectArgumentType.readParameters(new StringReader(particle),
|
||||
RegistryWrapper.WrapperLookup.of(Stream.of(Registries.PARTICLE_TYPE))),
|
||||
probability);
|
||||
|
||||
+3
-3
@@ -9,9 +9,9 @@ import net.minecraft.sound.BiomeMoodSound;
|
||||
import net.minecraft.sound.MusicSound;
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
import net.minecraft.village.VillagerType;
|
||||
import net.minecraft.world.attribute.AmbientParticle;
|
||||
import net.minecraft.world.biome.Biome.TemperatureModifier;
|
||||
import net.minecraft.world.biome.BiomeEffects.GrassColorModifier;
|
||||
import net.minecraft.world.biome.BiomeParticleConfig;
|
||||
import net.minecraft.world.biome.SpawnSettings;
|
||||
|
||||
import com.dfsek.terra.api.properties.Properties;
|
||||
@@ -52,7 +52,7 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
|
||||
|
||||
@Value("particles")
|
||||
@Default
|
||||
private BiomeParticleConfig particleConfig = null;
|
||||
private AmbientParticle particleConfig = null;
|
||||
|
||||
@Value("climate.precipitation")
|
||||
@Default
|
||||
@@ -131,7 +131,7 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
|
||||
return grassColorModifier;
|
||||
}
|
||||
|
||||
public BiomeParticleConfig getParticleConfig() {
|
||||
public AmbientParticle getParticleConfig() {
|
||||
return particleConfig;
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -4,7 +4,9 @@ import net.minecraft.world.biome.GenerationSettings;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import org.spongepowered.asm.mixin.Implements;
|
||||
import org.spongepowered.asm.mixin.Interface;
|
||||
import org.spongepowered.asm.mixin.Intrinsic;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
@@ -23,7 +25,7 @@ public class GenerationSettingsFloraFeaturesMixin {
|
||||
this.flora = features;
|
||||
}
|
||||
|
||||
@Inject(method = "getFlowerFeatures", cancellable = true, at = @At("HEAD"))
|
||||
@Inject(method = "getFlowerFeatures()Ljava/util/List;", cancellable = true, at = @At("HEAD"))
|
||||
public void inject(CallbackInfoReturnable<List<ConfiguredFeature<?, ?>>> cir) {
|
||||
if(flora != null) {
|
||||
cir.setReturnValue(flora);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id("dev.architectury.loom") version Versions.Mod.architecuryLoom
|
||||
id("dev.architectury.loom") version Versions.Mod.architecturyLoom
|
||||
id("architectury-plugin") version Versions.Mod.architecturyPlugin
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ dependencies {
|
||||
compileOnly("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
|
||||
compileOnly("io.github.llamalad7:mixinextras-common:${Versions.Mod.mixinExtras}")
|
||||
annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
|
||||
annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecuryLoom}")
|
||||
annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecturyLoom}")
|
||||
|
||||
implementation(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user