mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-18 10:32:30 +00:00
use Ranges
This commit is contained in:
parent
d5f0b69bc7
commit
f877f861cf
@ -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.Default;
|
||||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.util.Range;
|
||||||
|
|
||||||
import net.minecraft.registry.Registries;
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.sound.MusicSound;
|
import net.minecraft.sound.MusicSound;
|
||||||
import net.minecraft.sound.SoundEvent;
|
import net.minecraft.sound.SoundEvent;
|
||||||
@ -13,13 +16,9 @@ public class MusicSoundTemplate implements ObjectTemplate<MusicSound> {
|
|||||||
@Default
|
@Default
|
||||||
private SoundEvent sound = null;
|
private SoundEvent sound = null;
|
||||||
|
|
||||||
@Value("min-delay")
|
@Value("delay")
|
||||||
@Default
|
@Default
|
||||||
private Integer minDelay = null;
|
private Range delay = null;
|
||||||
|
|
||||||
@Value("max-delay")
|
|
||||||
@Default
|
|
||||||
private Integer maxDelay = null;
|
|
||||||
|
|
||||||
@Value("replace-current-music")
|
@Value("replace-current-music")
|
||||||
@Default
|
@Default
|
||||||
@ -27,10 +26,10 @@ public class MusicSoundTemplate implements ObjectTemplate<MusicSound> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MusicSound get() {
|
public MusicSound get() {
|
||||||
if(sound == null || minDelay == null || maxDelay == null || replaceCurrentMusic == null) {
|
if(sound == null || delay == null || replaceCurrentMusic == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return new MusicSound(Registries.SOUND_EVENT.getEntry(sound), minDelay, maxDelay, replaceCurrentMusic);
|
return new MusicSound(Registries.SOUND_EVENT.getEntry(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.Default;
|
||||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.util.Range;
|
||||||
|
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
|
import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
|
||||||
|
|
||||||
@ -16,16 +19,12 @@ public class SpawnEntryTemplate implements ObjectTemplate<SpawnEntry> {
|
|||||||
@Default
|
@Default
|
||||||
private Integer weight = null;
|
private Integer weight = null;
|
||||||
|
|
||||||
@Value("min-group-size")
|
@Value("group-size")
|
||||||
@Default
|
@Default
|
||||||
private Integer minGroupSize = null;
|
private Range groupSize = null;
|
||||||
|
|
||||||
@Value("max-group-size")
|
|
||||||
@Default
|
|
||||||
private Integer maxGroupSize = null;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SpawnEntry get() {
|
public SpawnEntry get() {
|
||||||
return new SpawnEntry(type, weight, minGroupSize, maxGroupSize);
|
return new SpawnEntry(type, weight, groupSize.getMin(), groupSize.getMax());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user