mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-02 16:05:29 +00:00
Merge remote-tracking branch 'origin/dev/biome2' into ver/6.5.0
This commit is contained in:
commit
c7cecaebe6
@ -44,7 +44,6 @@ import com.dfsek.terra.mod.config.ProtoPlatformBiome;
|
||||
import com.dfsek.terra.mod.config.SoundEventTemplate;
|
||||
import com.dfsek.terra.mod.config.SpawnCostConfig;
|
||||
import com.dfsek.terra.mod.config.SpawnEntryTemplate;
|
||||
import com.dfsek.terra.mod.config.SpawnGroupTemplate;
|
||||
import com.dfsek.terra.mod.config.SpawnSettingsTemplate;
|
||||
import com.dfsek.terra.mod.config.SpawnTypeConfig;
|
||||
import com.dfsek.terra.mod.config.VillagerTypeTemplate;
|
||||
@ -82,6 +81,7 @@ public abstract class ModPlatform extends AbstractPlatform {
|
||||
.registerLoader(GrassColorModifier.class,
|
||||
(type, o, loader, depthTracker) -> TemperatureModifier.valueOf(((String) o).toUpperCase(
|
||||
Locale.ROOT)))
|
||||
.registerLoader(SpawnGroup.class,(type, o, loader, depthTracker) -> SpawnGroup.valueOf((String) o))
|
||||
.registerLoader(BiomeParticleConfig.class, BiomeParticleConfigTemplate::new)
|
||||
.registerLoader(SoundEvent.class, SoundEventTemplate::new)
|
||||
.registerLoader(BiomeMoodSound.class, BiomeMoodSoundTemplate::new)
|
||||
|
@ -1,18 +0,0 @@
|
||||
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 net.minecraft.entity.SpawnGroup;
|
||||
|
||||
|
||||
public class SpawnGroupTemplate implements ObjectTemplate<SpawnGroup> {
|
||||
@Value("group")
|
||||
@Default
|
||||
private String group = null;
|
||||
|
||||
@Override
|
||||
public SpawnGroup get() {
|
||||
return SpawnGroup.valueOf(group);
|
||||
}
|
||||
}
|
@ -3,12 +3,19 @@ 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 net.minecraft.entity.SpawnGroup;
|
||||
import net.minecraft.world.biome.SpawnSettings;
|
||||
import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class SpawnSettingsTemplate implements ObjectTemplate<SpawnSettings> {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SpawnTypeConfig.class);
|
||||
private static boolean used = false;
|
||||
@Value("spawns")
|
||||
@Default
|
||||
private List<SpawnTypeConfig> spawns = null;
|
||||
@ -25,7 +32,19 @@ public class SpawnSettingsTemplate implements ObjectTemplate<SpawnSettings> {
|
||||
public SpawnSettings get() {
|
||||
SpawnSettings.Builder builder = new SpawnSettings.Builder();
|
||||
for(SpawnTypeConfig spawn : spawns) {
|
||||
builder.spawn(spawn.getGroup(), spawn.getEntry());
|
||||
SpawnGroup group = spawn.getGroup();
|
||||
if (spawn.getEntries() != null) {
|
||||
for (SpawnEntry entry : spawn.getEntries()) {
|
||||
builder.spawn(group, entry);
|
||||
}
|
||||
} else if (spawn.getEntry() != null) {
|
||||
if(!used) {
|
||||
logger.warn("The entry sub-field of spawns is deprecated. " +
|
||||
"It is recommended to use the entries sub-field instead ");
|
||||
used = true;
|
||||
}
|
||||
builder.spawn(group, spawn.getEntry());
|
||||
}
|
||||
}
|
||||
for(SpawnCostConfig cost : costs) {
|
||||
builder.spawnCost(cost.getType(), cost.getMass(), cost.getGravity());
|
||||
|
@ -6,20 +6,32 @@ import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
import net.minecraft.entity.SpawnGroup;
|
||||
import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class SpawnTypeConfig implements ObjectTemplate<SpawnTypeConfig> {
|
||||
@Value("group")
|
||||
@Default
|
||||
private SpawnGroup group = null;
|
||||
|
||||
|
||||
@Value("entries")
|
||||
@Default
|
||||
private List<SpawnEntry> entries = null;
|
||||
|
||||
@Value("entry")
|
||||
@Default
|
||||
@Deprecated
|
||||
private SpawnEntry entry = null;
|
||||
|
||||
public SpawnGroup getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
|
||||
public List<SpawnEntry> getEntries() {
|
||||
return entries;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public SpawnEntry getEntry() {
|
||||
return entry;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user