Compare commits

..

6 Commits

Author SHA1 Message Date
Zoë Gidiere 25d510156d Merge pull request #550 from AllayMC/feat/update-mappings
feat: update mappings to 1.21.11
2026-04-28 17:47:27 +00:00
Zoë Gidiere 2d48731f21 Merge pull request #557 from bananababoo/master
Fixes CloudCommandSender not returning Entity / Player that executed command.
2026-04-28 17:46:03 +00:00
Bananababooy 41af67501c Fix CloudCommandSender incorrectly getting the sender entity / player 2026-03-23 00:45:23 -05:00
daoge_cmd a8dceb9cde feat: update mappings to 1.21.11 2026-01-12 05:03:59 +08:00
dfsek 75dddb2afd Merge pull request #549 from PolyhedralDev/ai-guidelines
Add stuff about LLM-generated code to CONTRIBUTING.MD and PR template
2026-01-10 15:13:17 -07:00
dfsek 2e3ce78521 add ai guidelines 2026-01-09 21:41:33 -07:00
38 changed files with 180 additions and 188 deletions
+2 -1
View File
@@ -44,6 +44,7 @@ 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
@@ -98,7 +99,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.
Please provide reliable evidence of this. LLM-generated code does not satisfy this requirement.
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.)
-->
+1 -1
View File
@@ -21,7 +21,7 @@ jobs:
- name: Set up JDK 21
uses: actions/setup-java@v4.7.1
with:
java-version: '25'
java-version: '21'
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
+5 -2
View File
@@ -258,6 +258,9 @@ 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
@@ -381,7 +384,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.
@@ -391,7 +394,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. (Eg. don't assume
- Don't assume that a specific block, item, or entity exists. (E.g. don't assume
there exists a block called `minecraft:grass_block`)
### Data-Driven
+8 -4
View File
@@ -1,21 +1,25 @@
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 {
return providers.exec {
val stdout = ByteArrayOutputStream()
exec {
commandLine = mutableListOf("git", "rev-parse", "--short", "HEAD")
}.standardOutput.asText.get().trim()
standardOutput = stdout
}
return stdout.toString().trim()
}
fun Project.gitClone(name: String) {
providers.exec {
val stdout = ByteArrayOutputStream()
exec {
commandLine = mutableListOf("git", "clone", name)
standardOutput = stdout
}
}
+13 -13
View File
@@ -32,7 +32,7 @@ object Versions {
}
object Fabric {
const val fabricAPI = "0.140.0+${Mod.minecraft}"
const val fabricAPI = "0.134.1+${Mod.minecraft}"
const val cloud = "2.0.0-beta.13"
}
//
@@ -42,14 +42,14 @@ object Versions {
// }
object Mod {
const val mixin = "0.16.5+mixin.0.8.7"
const val mixin = "0.16.4+mixin.0.8.7"
const val mixinExtras = "0.5.0"
const val minecraft = "1.21.11"
const val yarn = "$minecraft+build.3"
const val fabricLoader = "0.18.3"
const val minecraft = "1.21.10"
const val yarn = "$minecraft+build.1"
const val fabricLoader = "0.18.2"
const val architecturyLoom = "1.13.463"
const val architecuryLoom = "1.11.451"
const val architecturyPlugin = "3.4.162"
}
@@ -60,9 +60,9 @@ object Versions {
// }
object Bukkit {
const val minecraft = "1.21.11-rc3"
const val minecraft = "1.21.10"
const val nms = "$minecraft-R0.1"
const val paperBuild = "$nms-20251208.200020-2"
const val paperBuild = "$nms-20251012.013929-7"
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.13.0"
const val api = "0.20.0"
const val gson = "2.13.2"
const val mappings = "15398c1"
const val mappingsGenerator = "8fa6058"
const val mappings = "366baa6"
const val mappingsGenerator = "e957088"
const val mcmeta = "e85a17c"
const val mcmeta = "c976eb3"
}
object Minestom {
const val minestom = "2025.12.20c-1.21.11"
const val minestom = "2025.10.04-1.21.8"
}
}
Binary file not shown.
+2 -2
View File
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=72f44c9f8ebcb1af43838f45ee5c4aa9c5444898b3468ab3f4af7b6076c5bc3f
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
distributionSha256Sum=845952a9d6afa783db70bb3b0effaae45ae5542ca2bb7929619e8af49cb634cf
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+4 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright © 2015 the original authors.
# Copyright © 2015-2021 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,6 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
@@ -171,6 +172,7 @@ 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" )
@@ -210,6 +212,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
Vendored
+2 -1
View File
@@ -70,10 +70,11 @@ 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%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
"%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" %*
:end
@rem End local scope for the variables with windows NT shell
+1 -1
View File
@@ -2,7 +2,7 @@
## Resource files
Current mapping version: je 1.21.9 to be 1.21.111
Current mapping version: je 1.21.11 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`).
@@ -25,15 +25,15 @@ public class CloudCommandSender implements CommandSender {
@Override
public Optional<Entity> getEntity() {
if(delegate instanceof org.bukkit.entity.Entity entity) {
return Optional.of(BukkitAdapter.adapt(entity));
if(delegate.getExecutor() != null) {
return Optional.of(BukkitAdapter.adapt(delegate.getExecutor()));
}
return Optional.empty();
}
@Override
public Optional<Player> getPlayer() {
if(delegate instanceof org.bukkit.entity.Player player) {
if(delegate.getSender() 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.11");
List<String> SUPPORTED_VERSIONS = List.of("v1.21.9", "v1.21.10");
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.villager.VillagerType;
import net.minecraft.world.entity.npc.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<Identifier, List<Identifier>> terraBiomeMap = new HashMap<>();
private static final Map<ResourceLocation, List<ResourceLocation>> 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();
Identifier vanillaMinecraftKey = Identifier.fromNamespaceAndPath(vanillaBukkitKey.getNamespace(),
ResourceLocation vanillaMinecraftKey = ResourceLocation.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);
Identifier delegateMinecraftKey = Identifier.fromNamespaceAndPath("terra",
ResourceLocation delegateMinecraftKey = ResourceLocation.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.identifier());
terraBiomeMap.computeIfAbsent(vanillaMinecraftKey, i -> new ArrayList<>()).add(delegateKey.location());
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().identifier(),
terra.unwrapKey().orElseThrow().identifier(),
vanilla.unwrapKey().orElseThrow().location(),
terra.unwrapKey().orElseThrow().location(),
vanilla.tags().toList());
vanilla.tags()
.forEach(tag -> collect
@@ -2,8 +2,7 @@ package com.dfsek.terra.bukkit.nms;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.resources.Identifier;
import net.minecraft.world.attribute.EnvironmentAttributes;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.BiomeGenerationSettings;
import net.minecraft.world.level.biome.BiomeSpecialEffects;
@@ -18,7 +17,7 @@ import com.dfsek.terra.bukkit.nms.config.VanillaBiomeProperties;
public class NMSBiomeInjector {
public static <T> Optional<Holder<T>> getEntry(Registry<T> registry, Identifier identifier) {
public static <T> Optional<Holder<T>> getEntry(Registry<T> registry, ResourceLocation identifier) {
return registry.getOptional(identifier)
.flatMap(registry::getResourceKey)
.flatMap(registry::get);
@@ -30,59 +29,55 @@ public class NMSBiomeInjector {
BiomeSpecialEffects.Builder effects = new BiomeSpecialEffects.Builder();
// 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()))
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()))
.grassColorModifier(Objects.requireNonNullElse(vanillaBiomeProperties.getGrassColorModifier(),
vanilla.getSpecialEffects().grassColorModifier()));
// .backgroundMusicVolume(Objects.requireNonNullElse(vanillaBiomeProperties.getMusicVolume(), vanilla.getBackgroundMusicVolume()));
vanilla.getSpecialEffects().getGrassColorModifier()))
.backgroundMusicVolume(Objects.requireNonNullElse(vanillaBiomeProperties.getMusicVolume(), vanilla.getBackgroundMusicVolume()));
if(vanillaBiomeProperties.getGrassColor() == null) {
vanilla.getSpecialEffects().grassColorOverride().ifPresent(effects::grassColorOverride);
vanilla.getSpecialEffects().getGrassColorOverride().ifPresent(effects::grassColorOverride);
} else {
effects.grassColorOverride(vanillaBiomeProperties.getGrassColor());
}
if(vanillaBiomeProperties.getFoliageColor() == null) {
vanilla.getSpecialEffects().foliageColorOverride().ifPresent(effects::foliageColorOverride);
vanilla.getSpecialEffects().getFoliageColorOverride().ifPresent(effects::foliageColorOverride);
} else {
effects.foliageColorOverride(vanillaBiomeProperties.getFoliageColor());
}
// TODO
// if(vanillaBiomeProperties.getParticleConfig() == null) {
// vanilla.getSpecialEffects().getAmbientParticleSettings().ifPresent(effects::ambientParticle);
// } else {
// effects.ambientParticle(vanillaBiomeProperties.getParticleConfig());
// }
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.Identifier;
import net.minecraft.resources.ResourceLocation;
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.attribute.AmbientAdditionsSettings;
import net.minecraft.world.attribute.AmbientMoodSettings;
import net.minecraft.world.entity.npc.villager.VillagerType;
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.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(Identifier.class, (type, o, loader, depthTracker) -> {
Identifier identifier = Identifier.tryParse((String) o);
.registerLoader(ResourceLocation.class, (type, o, loader, depthTracker) -> {
ResourceLocation identifier = ResourceLocation.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(AmbientParticle.class, BiomeParticleConfigTemplate::new)
.registerLoader(AmbientParticleSettings.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.villager.VillagerType;
import net.minecraft.world.entity.npc.VillagerType;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.StructureManager;
import net.minecraft.world.level.biome.Biome;
@@ -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.attribute.AmbientAdditionsSettings;
import net.minecraft.world.level.biome.AmbientAdditionsSettings;
public class BiomeAdditionsSoundTemplate implements ObjectTemplate<AmbientAdditionsSettings> {
@@ -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.attribute.AmbientMoodSettings;
import net.minecraft.world.level.biome.AmbientMoodSettings;
public class BiomeMoodSoundTemplate implements ObjectTemplate<AmbientMoodSettings> {
@@ -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.attribute.AmbientParticle;
import net.minecraft.world.level.biome.AmbientParticleSettings;
import java.util.stream.Stream;
public class BiomeParticleConfigTemplate implements ObjectTemplate<AmbientParticle> {
public class BiomeParticleConfigTemplate implements ObjectTemplate<AmbientParticleSettings> {
@Value("particle")
@Default
private String particle = null;
@@ -23,13 +23,13 @@ public class BiomeParticleConfigTemplate implements ObjectTemplate<AmbientPartic
private Float probability = 0.1f;
@Override
public AmbientParticle get() {
public AmbientParticleSettings get() {
if(particle == null) {
return null;
}
try {
return new AmbientParticle(ParticleArgument.readParticle(new StringReader(particle),
return new AmbientParticleSettings(ParticleArgument.readParticle(new StringReader(particle),
HolderLookup.Provider.create(Stream.of(BuiltInRegistries.PARTICLE_TYPE))), probability);
} catch(CommandSyntaxException e) {
throw new RuntimeException(e);
@@ -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.Identifier;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EntityType;
public class EntityTypeTemplate implements ObjectTemplate<EntityType<?>> {
@Value("id")
@Default
private Identifier id = null;
private ResourceLocation id = null;
@Override
public EntityType<?> get() {
@@ -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.Identifier;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
public class SoundEventTemplate implements ObjectTemplate<SoundEvent> {
@Value("id")
@Default
private Identifier id = null;
private ResourceLocation id = null;
@Value("distance-to-travel")
@Default
@@ -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.villager.VillagerType;
import net.minecraft.world.attribute.AmbientAdditionsSettings;
import net.minecraft.world.attribute.AmbientMoodSettings;
import net.minecraft.world.attribute.AmbientParticle;
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.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 AmbientParticle particleConfig = null;
private AmbientParticleSettings particleConfig = null;
@Value("climate.precipitation")
@Default
@@ -130,7 +130,7 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
return grassColorModifier;
}
public AmbientParticle getParticleConfig() {
public AmbientParticleSettings getParticleConfig() {
return particleConfig;
}
@@ -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.Identifier;
import net.minecraft.world.entity.npc.villager.VillagerType;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.npc.VillagerType;
public class VillagerTypeTemplate implements ObjectTemplate<ResourceKey<VillagerType>> {
@Value("id")
@Default
private Identifier id = null;
private ResourceLocation id = null;
@Override
public ResourceKey<VillagerType> get() {
+1 -1
View File
@@ -1,7 +1,7 @@
import java.util.*
plugins {
id("dev.architectury.loom") version Versions.Mod.architecturyLoom
id("dev.architectury.loom") version Versions.Mod.architecuryLoom
id("architectury-plugin") version Versions.Mod.architecturyPlugin
}
-4
View File
@@ -9,7 +9,3 @@ dependencies {
tasks.named("jar") {
finalizedBy("installAddonsIntoDefaultJar")
}
tasks.withType<JavaCompile>().configureEach {
options.release = 25
}
@@ -20,10 +20,6 @@ tasks.withType<Jar> {
}
}
tasks.withType<JavaCompile>().configureEach {
options.release = 25
}
application {
mainClass.set(javaMainClass)
}
@@ -7,8 +7,6 @@ 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;
@@ -84,9 +82,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(AmbientParticle.class, BiomeParticleConfigTemplate::new)
.registerLoader(AmbientSounds.Mood.class, BiomeMoodSoundTemplate::new)
.registerLoader(AmbientSounds.Additions.class, BiomeAdditionsSoundTemplate::new)
.registerLoader(BiomeEffects.Particle.class, BiomeParticleConfigTemplate::new)
.registerLoader(BiomeEffects.MoodSound.class, BiomeMoodSoundTemplate::new)
.registerLoader(BiomeEffects.AdditionsSound.class, BiomeAdditionsSoundTemplate::new)
.registerLoader(SoundEvent.class, SoundEventTemplate::new);
}
@@ -5,7 +5,6 @@ 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;
@@ -28,11 +27,6 @@ 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);
@@ -47,25 +41,32 @@ 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()));
.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());
Biome.Builder targetBuilder = Biome.builder()
if(effectsBuilder.build().equals(BiomeEffects.PLAINS_EFFECTS)) {
effectsBuilder.fogColor(new Color(0xC0D8FE)); // circumvent a minestom bug
}
Biome target = Biome.builder()
.downfall(mergeNullable(properties.getDownfall(), parent.downfall()))
.precipitation(mergeNullable(properties.getPrecipitation(), parent.hasPrecipitation()))
.hasPrecipitation(mergeNullable(properties.getPrecipitation(), parent.hasPrecipitation()))
.temperature(mergeNullable(properties.getTemperature(), parent.temperature()))
.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();
.temperatureModifier(mergeNullable(properties.getTemperatureModifier(), parent.temperatureModifier()))
.effects(effectsBuilder.build())
.build();
RegistryKey<Biome> registryKey = MinecraftServer.getBiomeRegistry().register(key, target);
return new UserDefinedBiome(key, registryKey, source.getID(), target);
@@ -4,11 +4,10 @@ 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<AmbientSounds.Additions> {
public class BiomeAdditionsSoundTemplate implements ObjectTemplate<BiomeEffects.AdditionsSound> {
@Value("sound")
@Default
private SoundEvent sound = null;
@@ -18,8 +17,8 @@ public class BiomeAdditionsSoundTemplate implements ObjectTemplate<AmbientSounds
private Double soundChance = null;
@Override
public AmbientSounds.Additions get() {
public BiomeEffects.AdditionsSound get() {
if(sound == null) return null;
return new AmbientSounds.Additions(sound, soundChance);
return new BiomeEffects.AdditionsSound(sound, soundChance);
}
}
@@ -4,11 +4,10 @@ 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<AmbientSounds.Mood> {
public class BiomeMoodSoundTemplate implements ObjectTemplate<BiomeEffects.MoodSound> {
@Value("sound")
@Default
private SoundEvent sound = null;
@@ -26,9 +25,9 @@ public class BiomeMoodSoundTemplate implements ObjectTemplate<AmbientSounds.Mood
private Double soundExtraDistance = null;
@Override
public AmbientSounds.Mood get() {
public BiomeEffects.MoodSound get() {
if(sound == null) return null;
return new AmbientSounds.Mood(
return new BiomeEffects.MoodSound(
sound,
soundCultivationTicks,
soundSpawnRange,
@@ -4,12 +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.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<AmbientParticle> {
public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeEffects.Particle> {
@Value("particle")
@Default
private String particle = null;
@@ -19,7 +18,7 @@ public class BiomeParticleConfigTemplate implements ObjectTemplate<AmbientPartic
private Float probability = null;
@Override
public AmbientParticle get() {
public BiomeEffects.Particle get() {
if(particle == null || probability == null) {
return null;
}
@@ -32,9 +31,9 @@ public class BiomeParticleConfigTemplate implements ObjectTemplate<AmbientPartic
return null;
}
return new AmbientParticle(
parsedParticle,
probability
return new BiomeEffects.Particle(
probability,
parsedParticle
);
}
}
@@ -5,16 +5,12 @@ 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")
@@ -47,7 +43,7 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
@Value("particles")
@Default
private AmbientParticle particleConfig = null;
private BiomeEffects.Particle particleConfig = null;
@Value("climate.precipitation")
@Default
@@ -71,11 +67,11 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
@Value("sound.mood-sound")
@Default
private AmbientSounds.Mood moodSound = null;
private BiomeEffects.MoodSound moodSound = null;
@Value("sound.additions-sound")
@Default
private AmbientSounds.Additions additionsSound = null;
private BiomeEffects.AdditionsSound additionsSound = null;
// @Value("sound.music")
// @Default
@@ -109,9 +105,8 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
return grassColorModifier;
}
public List<AmbientParticle> getParticleConfig() {
if (particleConfig == null) return null;
return List.of(particleConfig);
public BiomeEffects.Particle getParticleConfig() {
return particleConfig;
}
public Boolean getPrecipitation() {
@@ -130,12 +125,15 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
return downfall;
}
public AmbientSounds getAmbientSoundConfig() {
List<AmbientSounds.Additions> additions = additionsSound == null ? List.of() : List.of(additionsSound);
return new AmbientSounds(
loopSound,
moodSound,
additions
);
public SoundEvent getLoopSound() {
return loopSound;
}
public BiomeEffects.MoodSound getMoodSound() {
return moodSound;
}
public BiomeEffects.AdditionsSound getAdditionsSound() {
return additionsSound;
}
}
+2 -2
View File
@@ -1,5 +1,5 @@
plugins {
id("dev.architectury.loom") version Versions.Mod.architecturyLoom
id("dev.architectury.loom") version Versions.Mod.architecuryLoom
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.architecturyLoom}")
annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecuryLoom}")
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(AmbientParticle.class, BiomeParticleConfigTemplate::new)
.registerLoader(BiomeParticleConfig.class, BiomeParticleConfigTemplate::new)
.registerLoader(SoundEvent.class, SoundEventTemplate::new)
.registerLoader(BiomeMoodSound.class, BiomeMoodSoundTemplate::new)
.registerLoader(BiomeAdditionsSound.class, BiomeAdditionsSoundTemplate::new)
@@ -8,11 +8,12 @@ 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.attribute.AmbientParticle;
import net.minecraft.world.biome.BiomeParticleConfig;
import java.util.stream.Stream;
public class BiomeParticleConfigTemplate implements ObjectTemplate<AmbientParticle> {
public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeParticleConfig> {
@Value("particle")
@Default
private String particle = null;
@@ -22,13 +23,13 @@ public class BiomeParticleConfigTemplate implements ObjectTemplate<AmbientPartic
private Float probability = 0.1f;
@Override
public AmbientParticle get() {
public BiomeParticleConfig get() {
if(particle == null) {
return null;
}
try {
return new AmbientParticle(
return new BiomeParticleConfig(
ParticleEffectArgumentType.readParameters(new StringReader(particle),
RegistryWrapper.WrapperLookup.of(Stream.of(Registries.PARTICLE_TYPE))),
probability);
@@ -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 AmbientParticle particleConfig = null;
private BiomeParticleConfig particleConfig = null;
@Value("climate.precipitation")
@Default
@@ -131,7 +131,7 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
return grassColorModifier;
}
public AmbientParticle getParticleConfig() {
public BiomeParticleConfig getParticleConfig() {
return particleConfig;
}
@@ -4,9 +4,7 @@ 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;
@@ -25,7 +23,7 @@ public class GenerationSettingsFloraFeaturesMixin {
this.flora = features;
}
@Inject(method = "getFlowerFeatures()Ljava/util/List;", cancellable = true, at = @At("HEAD"))
@Inject(method = "getFlowerFeatures", cancellable = true, at = @At("HEAD"))
public void inject(CallbackInfoReturnable<List<ConfiguredFeature<?, ?>>> cir) {
if(flora != null) {
cir.setReturnValue(flora);
+2 -2
View File
@@ -1,5 +1,5 @@
plugins {
id("dev.architectury.loom") version Versions.Mod.architecturyLoom
id("dev.architectury.loom") version Versions.Mod.architecuryLoom
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.architecturyLoom}")
annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecuryLoom}")
implementation(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }