Requested changes

This commit is contained in:
Zoë
2022-07-14 19:43:50 -07:00
parent f75880acac
commit 4b518c28a0
15 changed files with 57 additions and 59 deletions
-2
View File
@@ -34,8 +34,6 @@ object Versions {
const val yarn = "$minecraft+build.1"
const val fabricLoader = "0.14.2"
const val minecraftGudAsm = "v0.3.1"
const val architecuryLoom = "0.12.0.290"
const val architecturyPlugin = "3.4-SNAPSHOT"
@@ -9,6 +9,7 @@ package com.dfsek.terra.addons.biome;
import org.jetbrains.annotations.Nullable;
import java.util.Optional;
import java.util.Set;
import com.dfsek.terra.api.properties.Context;
@@ -44,8 +45,8 @@ public class UserDefinedBiome implements Biome {
}
@Override
public @Nullable PlatformBiome getPlatformBiome() {
return platformBiome;
public Optional<PlatformBiome> getPlatformBiome() {
return Optional.ofNullable(platformBiome);
}
@Override
@@ -10,6 +10,7 @@ package com.dfsek.terra.api.world.biome;
import org.jetbrains.annotations.Nullable;
import java.util.Optional;
import java.util.Set;
import com.dfsek.terra.api.properties.PropertyHolder;
@@ -26,7 +27,7 @@ public interface Biome extends PropertyHolder, StringIdentifiable {
*
* @return The platform biome.
*/
@Nullable PlatformBiome getPlatformBiome();
Optional<PlatformBiome> getPlatformBiome();
/**
* Get the color of this biome.
@@ -1,5 +1,7 @@
package com.dfsek.terra.bukkit.generator;
import com.dfsek.terra.bukkit.world.BukkitPlatformBiome;
import org.bukkit.generator.BiomeProvider;
import org.bukkit.generator.WorldInfo;
import org.jetbrains.annotations.NotNull;
@@ -20,13 +22,13 @@ public class BukkitBiomeProvider extends BiomeProvider implements Handle {
@Override
public @NotNull org.bukkit.block.Biome getBiome(@NotNull WorldInfo worldInfo, int x, int y, int z) {
Biome biome = delegate.getBiome(x, y, z, worldInfo.getSeed());
return (org.bukkit.block.Biome) biome.getPlatformBiome().getHandle();
return ((BukkitPlatformBiome)biome.getPlatformBiome().get()).getBukkitBiome();
}
@Override
public @NotNull List<org.bukkit.block.Biome> getBiomes(@NotNull WorldInfo worldInfo) {
return StreamSupport.stream(delegate.getBiomes().spliterator(), false)
.map(terraBiome -> (org.bukkit.block.Biome) terraBiome.getPlatformBiome().getHandle())
.map(terraBiome -> ((BukkitPlatformBiome)terraBiome.getPlatformBiome().get()).getBukkitBiome())
.collect(Collectors.toList());
}
@@ -0,0 +1,10 @@
package com.dfsek.terra.bukkit.world;
import com.dfsek.terra.api.world.biome.PlatformBiome;
import org.bukkit.block.Biome;
public interface BukkitPlatformBiome extends PlatformBiome {
Biome getBukkitBiome();
}
@@ -6,7 +6,6 @@ import com.dfsek.tectonic.api.exception.LoadException;
import com.dfsek.terra.api.addon.BaseAddon;
import com.dfsek.terra.api.world.biome.PlatformBiome;
import com.dfsek.terra.bukkit.BukkitAddon;
import com.dfsek.terra.bukkit.TerraBukkitPlugin;
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.BiomeAdditionsSoundTemplate;
@@ -3,6 +3,8 @@ package com.dfsek.terra.bukkit.nms.v1_19_R1.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 com.dfsek.terra.api.util.Range;
import net.minecraft.sounds.Music;
import net.minecraft.sounds.SoundEvent;
@@ -12,13 +14,10 @@ public class MusicSoundTemplate implements ObjectTemplate<Music> {
@Default
private SoundEvent sound = null;
@Value("min-delay")
@Value("delay")
@Default
private Integer minDelay = null;
@Value("max-delay")
@Default
private Integer maxDelay = null;
private Range delay = null;
@Value("replace-current-music")
@Default
@@ -26,10 +25,10 @@ public class MusicSoundTemplate implements ObjectTemplate<Music> {
@Override
public Music get() {
if(sound == null || minDelay == null || maxDelay == null || replaceCurrentMusic == null) {
if(sound == null || delay == null || replaceCurrentMusic == null) {
return null;
} else {
return new Music(sound, minDelay, maxDelay, replaceCurrentMusic);
return new Music(sound, delay.getMin(), delay.getMax(), replaceCurrentMusic);
}
}
}
@@ -20,17 +20,21 @@ package com.dfsek.terra.bukkit.nms.v1_19_R1.config;
import com.dfsek.terra.api.world.biome.PlatformBiome;
import com.dfsek.terra.bukkit.nms.v1_19_R1.util.MinecraftUtil;
import com.dfsek.terra.bukkit.world.BukkitPlatformBiome;
import net.minecraft.core.Registry;
import net.minecraft.data.BuiltinRegistries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.biome.Biome;
import org.bukkit.craftbukkit.v1_19_R1.block.CraftBlock;
public class ProtoPlatformBiome implements PlatformBiome {
public class ProtoPlatformBiome implements PlatformBiome, BukkitPlatformBiome {
private final ResourceLocation identifier;
private final ResourceKey<Biome> biome;
public ProtoPlatformBiome(ResourceLocation identifier, ResourceKey<Biome> biome) {
this.identifier = identifier;
this.biome = biome;
@@ -48,4 +52,9 @@ public class ProtoPlatformBiome implements PlatformBiome {
public ResourceKey<Biome> getBiome() {
return biome;
}
@Override
public org.bukkit.block.Biome getBukkitBiome() {
return org.bukkit.block.Biome.CUSTOM;
}
}
@@ -3,6 +3,8 @@ package com.dfsek.terra.bukkit.nms.v1_19_R1.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 com.dfsek.terra.api.util.Range;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData;
@@ -16,16 +18,12 @@ public class SpawnEntryTemplate implements ObjectTemplate<SpawnerData> {
@Default
private Integer weight = null;
@Value("min-group-size")
@Value("group-size")
@Default
private Integer minGroupSize = null;
@Value("max-group-size")
@Default
private Integer maxGroupSize = null;
private Range groupSize = null;
@Override
public SpawnerData get() {
return new SpawnerData(type, weight, minGroupSize, maxGroupSize);
return new SpawnerData(type, weight, groupSize.getMin(), groupSize.getMax());
}
}
-3
View File
@@ -15,9 +15,6 @@ dependencies {
annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecuryLoom}")
modImplementation("com.github.the-glitch-network:minecraft-gudasm:${Versions.Mod.minecraftGudAsm}")
include("com.github.the-glitch-network:minecraft-gudasm:${Versions.Mod.minecraftGudAsm}")
implementation(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
"developmentFabric"(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
shaded(project(path = ":platforms:mixin-common", configuration = "transformProductionFabric")) { isTransitive = false }
@@ -3,6 +3,9 @@ package com.dfsek.terra.mod.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 com.dfsek.terra.api.util.Range;
import net.minecraft.sound.MusicSound;
import net.minecraft.sound.SoundEvent;
@@ -12,13 +15,9 @@ public class MusicSoundTemplate implements ObjectTemplate<MusicSound> {
@Default
private SoundEvent sound = null;
@Value("min-delay")
@Value("delay")
@Default
private Integer minDelay = null;
@Value("max-delay")
@Default
private Integer maxDelay = null;
private Range delay = null;
@Value("replace-current-music")
@Default
@@ -26,10 +25,10 @@ public class MusicSoundTemplate implements ObjectTemplate<MusicSound> {
@Override
public MusicSound get() {
if(sound == null || minDelay == null || maxDelay == null || replaceCurrentMusic == null) {
if(sound == null || delay == null || replaceCurrentMusic == null) {
return null;
} else {
return new MusicSound(sound, minDelay, maxDelay, replaceCurrentMusic);
return new MusicSound(sound, delay.getMin(), delay.getMax(), replaceCurrentMusic);
}
}
}
@@ -3,6 +3,9 @@ package com.dfsek.terra.mod.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 com.dfsek.terra.api.util.Range;
import net.minecraft.entity.EntityType;
import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
@@ -16,16 +19,12 @@ public class SpawnEntryTemplate implements ObjectTemplate<SpawnEntry> {
@Default
private Integer weight = null;
@Value("min-group-size")
@Value("group-size")
@Default
private Integer minGroupSize = null;
@Value("max-group-size")
@Default
private Integer maxGroupSize = null;
private Range groupSize = null;
@Override
public SpawnEntry get() {
return new SpawnEntry(type, weight, minGroupSize, maxGroupSize);
return new SpawnEntry(type, weight, groupSize.getMin(), groupSize.getMax());
}
}
@@ -45,7 +45,7 @@ public class TerraBiomeSource extends BiomeSource {
.stream(pack.getBiomeProvider()
.getBiomes()
.spliterator(), false)
.map(b -> biomes.getOrCreateEntry(((ProtoPlatformBiome) b.getPlatformBiome()).getBiome())));
.map(b -> biomes.getOrCreateEntry(((ProtoPlatformBiome) b.getPlatformBiome().get()).getBiome())));
this.biomeRegistry = biomes;
this.pack = pack;
@@ -63,7 +63,7 @@ public class TerraBiomeSource extends BiomeSource {
.entryOf(((ProtoPlatformBiome) pack
.getBiomeProvider()
.getBiome(biomeX << 2, biomeY << 2, biomeZ << 2, SeedHack.getSeed(noiseSampler))
.getPlatformBiome()).getBiome()
.getPlatformBiome().get()).getBiome()
);
}
@@ -11,11 +11,6 @@ dependencies {
annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecuryLoom}")
modImplementation("com.github.the-glitch-network:minecraft-gudasm:${Versions.Mod.minecraftGudAsm}") {
exclude("net.fabricmc")
exclude("net.fabricmc.fabric-api")
}
implementation(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}")
-9
View File
@@ -15,15 +15,6 @@ dependencies {
annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecuryLoom}")
modImplementation("com.github.the-glitch-network:minecraft-gudasm:${Versions.Mod.minecraftGudAsm}") {
exclude("net.fabricmc")
exclude("net.fabricmc.fabric-api")
}
include("com.github.the-glitch-network:minecraft-gudasm:${Versions.Mod.minecraftGudAsm}") {
exclude("net.fabricmc")
exclude("net.fabricmc.fabric-api")
}
implementation(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
"developmentQuilt"(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
shaded(project(path = ":platforms:mixin-common", configuration = "transformProductionQuilt")) { isTransitive = false }