mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-11-27 00:14:19 +00:00
feat: 26.1.2
This commit is contained in:
1 parent
25d510156d
commit
7b44ea93ba
21 files changed
+153
-96
No files matched your search
@@ -18,10 +18,10 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- name: Set up JDK 21
|
||||
- name: Set up JDK 25
|
||||
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
|
||||
|
||||
@@ -24,7 +24,7 @@ dependencies {
|
||||
//TODO Allow pulling from Versions.kt
|
||||
implementation("com.gradleup.shadow", "shadow-gradle-plugin", "8.3.9")
|
||||
|
||||
implementation("io.papermc.paperweight.userdev", "io.papermc.paperweight.userdev.gradle.plugin", "2.0.0-beta.18")
|
||||
implementation("io.papermc.paperweight.userdev", "io.papermc.paperweight.userdev.gradle.plugin", "2.0.0-beta.21")
|
||||
implementation("org.ow2.asm", "asm", "9.9")
|
||||
implementation("org.ow2.asm", "asm-tree", "9.9")
|
||||
implementation("com.dfsek.tectonic", "common", "4.3.1")
|
||||
|
||||
@@ -7,19 +7,14 @@ 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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,15 +60,15 @@ object Versions {
|
||||
// }
|
||||
|
||||
object Bukkit {
|
||||
const val minecraft = "1.21.10"
|
||||
const val minecraft = "26.1.2"
|
||||
const val nms = "$minecraft-R0.1"
|
||||
const val paperBuild = "$nms-20251012.013929-7"
|
||||
const val paperBuild = "26.1.2.build.60-stable"
|
||||
const val paper = paperBuild
|
||||
const val paperLib = "1.0.8"
|
||||
const val reflectionRemapper = "0.1.3"
|
||||
const val paperDevBundle = paperBuild
|
||||
const val runPaper = "2.3.1"
|
||||
const val paperWeight = "2.0.0-beta.19"
|
||||
const val paperWeight = "2.0.0-beta.21"
|
||||
const val cloud = "2.0.0-beta.12"
|
||||
const val multiverse = "5.3.0"
|
||||
}
|
||||
|
||||
+1
-1
@@ -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
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -12,6 +12,10 @@ dependencies {
|
||||
shaded("xyz.jpenilla", "reflection-remapper", Versions.Bukkit.reflectionRemapper)
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
options.release = 25
|
||||
}
|
||||
|
||||
tasks {
|
||||
shadowJar {
|
||||
relocate("io.papermc.lib", "com.dfsek.terra.lib.paperlib")
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
repositories {
|
||||
|
||||
}
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
options.release = 25
|
||||
}
|
||||
|
||||
dependencies {
|
||||
shadedApi(project(":common:implementation:base"))
|
||||
|
||||
@@ -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("v26.1.2");
|
||||
String MINECRAFT_VERSION = VersionUtil.getMinecraftVersionInfo().toString();
|
||||
String TERRA_PACKAGE = NMSInitializer.class.getPackageName();
|
||||
|
||||
|
||||
@@ -2,6 +2,10 @@ plugins {
|
||||
id("io.papermc.paperweight.userdev")
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
options.release = 25
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api(project(":platforms:bukkit:common"))
|
||||
paperweight.paperDevBundle(Versions.Bukkit.paperDevBundle)
|
||||
|
||||
@@ -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
|
||||
|
||||
+93
-41
@@ -1,12 +1,26 @@
|
||||
package com.dfsek.terra.bukkit.nms;
|
||||
|
||||
import com.dfsek.terra.api.registry.key.RegistryKey;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.attribute.AmbientAdditionsSettings;
|
||||
import net.minecraft.world.attribute.AmbientMoodSettings;
|
||||
import net.minecraft.world.attribute.AmbientParticle;
|
||||
import net.minecraft.world.attribute.AmbientSounds;
|
||||
import net.minecraft.world.attribute.BackgroundMusic;
|
||||
import net.minecraft.world.attribute.EnvironmentAttributeMap;
|
||||
import net.minecraft.world.attribute.EnvironmentAttributeMap.Entry;
|
||||
import net.minecraft.world.attribute.EnvironmentAttributes;
|
||||
import net.minecraft.world.attribute.modifier.AttributeModifier;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.biome.BiomeGenerationSettings;
|
||||
import net.minecraft.world.level.biome.BiomeSpecialEffects;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
@@ -17,10 +31,8 @@ import com.dfsek.terra.bukkit.nms.config.VanillaBiomeProperties;
|
||||
|
||||
public class NMSBiomeInjector {
|
||||
|
||||
public static <T> Optional<Holder<T>> getEntry(Registry<T> registry, ResourceLocation identifier) {
|
||||
return registry.getOptional(identifier)
|
||||
.flatMap(registry::getResourceKey)
|
||||
.flatMap(registry::get);
|
||||
public static <T> Optional<Holder<T>> getEntry(Registry<T> registry, Identifier identifier) {
|
||||
return registry.getOptional(identifier).flatMap(registry::getResourceKey).flatMap(registry::get);
|
||||
}
|
||||
|
||||
public static Biome createBiome(Biome vanilla, VanillaBiomeProperties vanillaBiomeProperties)
|
||||
@@ -28,76 +40,116 @@ public class NMSBiomeInjector {
|
||||
Biome.BiomeBuilder builder = new Biome.BiomeBuilder();
|
||||
|
||||
BiomeSpecialEffects.Builder effects = new BiomeSpecialEffects.Builder();
|
||||
EnvironmentAttributeMap attributes = vanilla.getAttributes();
|
||||
|
||||
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().getGrassColorModifier()))
|
||||
.backgroundMusicVolume(Objects.requireNonNullElse(vanillaBiomeProperties.getMusicVolume(), vanilla.getBackgroundMusicVolume()));
|
||||
Integer vanillaFogColour = (Integer) Objects.requireNonNull(attributes.get(EnvironmentAttributes.FOG_COLOR)).argument();
|
||||
Integer vanillaWaterFogColour = (Integer) Objects.requireNonNull(attributes.get(EnvironmentAttributes.WATER_FOG_COLOR)).argument();
|
||||
Integer vanillaSkyColour = (Integer) Objects.requireNonNull(attributes.get(EnvironmentAttributes.SKY_COLOR)).argument();
|
||||
Float vanillaMusicVolume = (Float) Objects.requireNonNull(attributes.get(EnvironmentAttributes.MUSIC_VOLUME)).argument();
|
||||
|
||||
builder.modifyAttribute(EnvironmentAttributes.FOG_COLOR, AttributeModifier.override(),
|
||||
Objects.requireNonNullElse(vanillaBiomeProperties.getFogColor(), vanillaFogColour));
|
||||
builder.modifyAttribute(EnvironmentAttributes.WATER_FOG_COLOR, AttributeModifier.override(),
|
||||
Objects.requireNonNullElse(vanillaBiomeProperties.getWaterFogColor(), vanillaWaterFogColour));
|
||||
builder.modifyAttribute(EnvironmentAttributes.SKY_COLOR, AttributeModifier.override(),
|
||||
Objects.requireNonNullElse(vanillaBiomeProperties.getSkyColor(), vanillaSkyColour));
|
||||
builder.modifyAttribute(EnvironmentAttributes.MUSIC_VOLUME, AttributeModifier.override(),
|
||||
Objects.requireNonNullElse(vanillaBiomeProperties.getMusicVolume(), vanillaMusicVolume));
|
||||
|
||||
effects.waterColor(Objects.requireNonNullElse(vanillaBiomeProperties.getWaterColor(), vanilla.getWaterColor()));
|
||||
effects.grassColorModifier(
|
||||
Objects.requireNonNullElse(vanillaBiomeProperties.getGrassColorModifier(), vanilla.getSpecialEffects().grassColorModifier()));
|
||||
|
||||
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);
|
||||
Entry<?, ?> ambientEntry = attributes.get(EnvironmentAttributes.AMBIENT_PARTICLES);
|
||||
if(ambientEntry != null) {
|
||||
Object arg = ambientEntry.argument();
|
||||
|
||||
// this is not nice
|
||||
if(arg instanceof List<?> rawList) {
|
||||
List<AmbientParticle> ambientParticles =
|
||||
rawList.stream()
|
||||
.filter(AmbientParticle.class::isInstance)
|
||||
.map(AmbientParticle.class::cast)
|
||||
.toList();
|
||||
|
||||
builder.modifyAttribute(
|
||||
EnvironmentAttributes.AMBIENT_PARTICLES,
|
||||
AttributeModifier.override(),
|
||||
ambientParticles
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
effects.ambientParticle(vanillaBiomeProperties.getParticleConfig());
|
||||
builder.modifyAttribute(EnvironmentAttributes.AMBIENT_PARTICLES, AttributeModifier.override(),
|
||||
List.of(vanillaBiomeProperties.getParticleConfig()));
|
||||
}
|
||||
|
||||
if(vanillaBiomeProperties.getLoopSound() == null) {
|
||||
vanilla.getSpecialEffects().getAmbientLoopSoundEvent().ifPresent(effects::ambientLoopSound);
|
||||
} else {
|
||||
RegistryFetcher.soundEventRegistry().get(vanillaBiomeProperties.getLoopSound().location()).ifPresent(effects::ambientLoopSound);
|
||||
Optional<Holder<SoundEvent>> loop = Optional.empty();
|
||||
Optional<AmbientMoodSettings> mood = Optional.empty();
|
||||
List<AmbientAdditionsSettings> additions = Collections.emptyList();
|
||||
|
||||
if(attributes.contains(EnvironmentAttributes.AMBIENT_SOUNDS)) {
|
||||
AmbientSounds sounds =
|
||||
(AmbientSounds) Objects.requireNonNull(attributes.get(EnvironmentAttributes.AMBIENT_SOUNDS)).argument();
|
||||
|
||||
loop = sounds.loop();
|
||||
mood = sounds.mood();
|
||||
additions = sounds.additions();
|
||||
}
|
||||
|
||||
if(vanillaBiomeProperties.getMoodSound() == null) {
|
||||
vanilla.getSpecialEffects().getAmbientMoodSettings().ifPresent(effects::ambientMoodSound);
|
||||
} else {
|
||||
effects.ambientMoodSound(vanillaBiomeProperties.getMoodSound());
|
||||
if(vanillaBiomeProperties.getLoopSound() != null) {
|
||||
loop = RegistryFetcher.soundEventRegistry()
|
||||
.get(vanillaBiomeProperties.getLoopSound().location())
|
||||
.map(ref -> ref);
|
||||
}
|
||||
|
||||
if(vanillaBiomeProperties.getAdditionsSound() == null) {
|
||||
vanilla.getSpecialEffects().getAmbientAdditionsSettings().ifPresent(effects::ambientAdditionsSound);
|
||||
} else {
|
||||
effects.ambientAdditionsSound(vanillaBiomeProperties.getAdditionsSound());
|
||||
if(vanillaBiomeProperties.getMoodSound() != null) {
|
||||
mood = Optional.ofNullable(vanillaBiomeProperties.getMoodSound());
|
||||
}
|
||||
|
||||
if(vanillaBiomeProperties.getAdditionsSound() != null) {
|
||||
additions = Collections.singletonList(vanillaBiomeProperties.getAdditionsSound());
|
||||
}
|
||||
|
||||
builder.modifyAttribute(EnvironmentAttributes.AMBIENT_SOUNDS, AttributeModifier.override(),
|
||||
new AmbientSounds(loop, mood, additions));
|
||||
|
||||
if(vanillaBiomeProperties.getMusic() == null) {
|
||||
vanilla.getSpecialEffects().getBackgroundMusic().ifPresent(effects::backgroundMusic);
|
||||
if(attributes.contains(EnvironmentAttributes.BACKGROUND_MUSIC)) {
|
||||
BackgroundMusic music = (BackgroundMusic) Objects.requireNonNull(attributes.get(EnvironmentAttributes.BACKGROUND_MUSIC))
|
||||
.argument();
|
||||
builder.modifyAttribute(EnvironmentAttributes.BACKGROUND_MUSIC, AttributeModifier.override(), music);
|
||||
}
|
||||
} else {
|
||||
effects.backgroundMusic(vanillaBiomeProperties.getMusic());
|
||||
builder.modifyAttribute(EnvironmentAttributes.BACKGROUND_MUSIC, AttributeModifier.override(),
|
||||
new BackgroundMusic(vanillaBiomeProperties.getMusic()));
|
||||
}
|
||||
|
||||
builder.hasPrecipitation(Objects.requireNonNullElse(vanillaBiomeProperties.getPrecipitation(), vanilla.hasPrecipitation()));
|
||||
|
||||
builder.temperature(Objects.requireNonNullElse(vanillaBiomeProperties.getTemperature(), vanilla.getBaseTemperature()));
|
||||
|
||||
builder.downfall(Objects.requireNonNullElse(vanillaBiomeProperties.getDownfall(), vanilla.climateSettings.downfall()));
|
||||
|
||||
builder.temperatureAdjustment(
|
||||
Objects.requireNonNullElse(vanillaBiomeProperties.getTemperatureModifier(), vanilla.climateSettings.temperatureModifier()));
|
||||
|
||||
builder.mobSpawnSettings(Objects.requireNonNullElse(vanillaBiomeProperties.getSpawnSettings(), vanilla.getMobSettings()));
|
||||
|
||||
return builder
|
||||
.specialEffects(effects.build())
|
||||
.generationSettings(new BiomeGenerationSettings.PlainBuilder().build())
|
||||
.build();
|
||||
return builder.specialEffects(effects.build()).generationSettings(new BiomeGenerationSettings.PlainBuilder().build()).build();
|
||||
}
|
||||
|
||||
public static String createBiomeID(ConfigPack pack, com.dfsek.terra.api.registry.key.RegistryKey biomeID) {
|
||||
return pack.getID()
|
||||
.toLowerCase() + "/" + biomeID.getNamespace().toLowerCase(Locale.ROOT) + "/" + biomeID.getID().toLowerCase(Locale.ROOT);
|
||||
public static String createBiomeID(ConfigPack pack, RegistryKey biomeID) {
|
||||
return pack.getID().toLowerCase() + "/" + biomeID.getNamespace().toLowerCase(Locale.ROOT) + "/" + biomeID.getID().toLowerCase(
|
||||
Locale.ROOT);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -106,8 +106,8 @@ public class NMSChunkGeneratorDelegate extends ChunkGenerator {
|
||||
Beardifier structureWeightSampler = Beardifier.forStructuresInChunk(structureAccessor, chunk.getPos());
|
||||
double threshold = compatibilityOptions.getBeardThreshold();
|
||||
double airThreshold = compatibilityOptions.getAirThreshold();
|
||||
int xi = chunk.getPos().x << 4;
|
||||
int zi = chunk.getPos().z << 4;
|
||||
int xi = chunk.getPos().x() << 4;
|
||||
int zi = chunk.getPos().z() << 4;
|
||||
for(int x = 0; x < 16; x++) {
|
||||
for(int z = 0; z < 16; z++) {
|
||||
int depth = 0;
|
||||
|
||||
@@ -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.AmbientAdditionsSettings;
|
||||
import net.minecraft.world.attribute.AmbientMoodSettings;
|
||||
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.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;
|
||||
@@ -24,7 +24,6 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class Reflection {
|
||||
public static final MappedRegistryProxy MAPPED_REGISTRY;
|
||||
public static final MappedRegistryTagSetProxy MAPPED_REGISTRY_TAG_SET;
|
||||
|
||||
+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.attribute.AmbientAdditionsSettings;
|
||||
import net.minecraft.world.attribute.AmbientMoodSettings;
|
||||
import net.minecraft.world.attribute.AmbientParticle;
|
||||
import net.minecraft.world.entity.npc.villager.VillagerType;
|
||||
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
@@ -4,15 +4,15 @@ 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.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.npc.VillagerType;
|
||||
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() {
|
||||
|
||||
Reference in new issue
Block a user