mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-05-20 00:30:20 +00:00
Merge branch 'master' into dev/7.0-2
This commit is contained in:
@@ -94,7 +94,7 @@ public abstract class ModPlatform extends AbstractPlatform {
|
||||
.registerLoader(MusicSound.class, MusicSoundTemplate::new)
|
||||
.registerLoader(EntityType.class, EntityTypeTemplate::new)
|
||||
.registerLoader(SpawnCostConfig.class, SpawnCostConfig::new)
|
||||
.registerLoader(SpawnEntry.class, SpawnEntryConfig::new)
|
||||
.registerLoader(SpawnEntryConfig.class, SpawnEntryConfig::new)
|
||||
.registerLoader(SpawnTypeConfig.class, SpawnTypeConfig::new)
|
||||
.registerLoader(SpawnSettings.class, SpawnSettingsTemplate::new)
|
||||
.registerLoader(VillagerType.class, VillagerTypeTemplate::new);
|
||||
|
||||
+7
-9
@@ -5,16 +5,20 @@ import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.command.argument.ParticleEffectArgumentType;
|
||||
import net.minecraft.particle.ParticleEffect;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.RegistryWrapper;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.BiomeParticleConfig;
|
||||
|
||||
|
||||
public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeParticleConfig> {
|
||||
@Value("particle")
|
||||
@Default
|
||||
private String particle = null;
|
||||
private Identifier particle = null;
|
||||
|
||||
@Value("probability")
|
||||
@Default
|
||||
@@ -26,13 +30,7 @@ public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeParticle
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return new BiomeParticleConfig(
|
||||
ParticleEffectArgumentType.readParameters(new StringReader(particle),
|
||||
(RegistryWrapper.WrapperLookup) Registries.PARTICLE_TYPE),
|
||||
probability);
|
||||
} catch(CommandSyntaxException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return new BiomeParticleConfig((ParticleEffect) Registries.PARTICLE_TYPE.get(particle),
|
||||
probability);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-4
@@ -8,8 +8,7 @@ import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
|
||||
|
||||
import com.dfsek.terra.api.util.range.Range;
|
||||
|
||||
|
||||
public class SpawnEntryConfig implements ObjectTemplate<SpawnEntry> {
|
||||
public class SpawnEntryConfig implements ObjectTemplate<SpawnEntryConfig> {
|
||||
@Value("type")
|
||||
@Default
|
||||
private EntityType<?> type = null;
|
||||
@@ -26,8 +25,12 @@ public class SpawnEntryConfig implements ObjectTemplate<SpawnEntry> {
|
||||
return weight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpawnEntry get() {
|
||||
public SpawnEntry getSpawnEntry() {
|
||||
return new SpawnEntry(type, groupSize.getMin(), groupSize.getMax());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpawnEntryConfig get() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -27,8 +27,8 @@ public class SpawnSettingsTemplate implements ObjectTemplate<SpawnSettings> {
|
||||
SpawnSettings.Builder builder = new SpawnSettings.Builder();
|
||||
for(SpawnTypeConfig spawn : spawns) {
|
||||
SpawnGroup group = spawn.getGroup();
|
||||
for(SpawnEntryConfig entry : spawn.getEntry()) {
|
||||
builder.spawn(group, entry.getWeight(), entry.get());
|
||||
for(SpawnEntryConfig entry : spawn.getEntries()) {
|
||||
builder.spawn(group, entry.getWeight(), entry.getSpawnEntry());
|
||||
}
|
||||
}
|
||||
for(SpawnCostConfig cost : costs) {
|
||||
|
||||
+3
-3
@@ -15,14 +15,14 @@ public class SpawnTypeConfig implements ObjectTemplate<SpawnTypeConfig> {
|
||||
|
||||
@Value("entries")
|
||||
@Default
|
||||
private List<SpawnEntryConfig> entry = null;
|
||||
private List<SpawnEntryConfig> entries = null;
|
||||
|
||||
public SpawnGroup getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
public List<SpawnEntryConfig> getEntry() {
|
||||
return entry;
|
||||
public List<SpawnEntryConfig> getEntries() {
|
||||
return entries;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -12,10 +12,10 @@ import net.minecraft.village.VillagerType;
|
||||
public class VillagerTypeTemplate implements ObjectTemplate<RegistryKey<VillagerType>> {
|
||||
@Value("id")
|
||||
@Default
|
||||
private String id = null;
|
||||
private Identifier id = null;
|
||||
|
||||
@Override
|
||||
public RegistryKey<VillagerType> get() {
|
||||
return RegistryKey.of(RegistryKeys.VILLAGER_TYPE, Identifier.ofVanilla(id));
|
||||
return RegistryKey.of(RegistryKeys.VILLAGER_TYPE, id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user