Firefly sounds

This commit is contained in:
paulevsGitch 2020-10-05 20:11:10 +03:00
parent 70e9813002
commit be7fdf20e6
8 changed files with 44 additions and 16 deletions

View file

@ -19,7 +19,7 @@ import ru.betterend.registry.EntityRegistry;
import ru.betterend.registry.FeatureRegistry;
import ru.betterend.registry.ItemRegistry;
import ru.betterend.registry.ItemTagRegistry;
import ru.betterend.registry.SoundsRegistry;
import ru.betterend.registry.SoundRegistry;
import ru.betterend.util.Logger;
import ru.betterend.world.generator.BetterEndBiomeSource;
import ru.betterend.world.surface.DoubleBlockSurfaceBuilder;
@ -31,7 +31,7 @@ public class BetterEnd implements ModInitializer {
@Override
public void onInitialize() {
SoundsRegistry.register();
SoundRegistry.register();
DoubleBlockSurfaceBuilder.register();
ItemRegistry.register();
BlockRegistry.register();

View file

@ -23,12 +23,15 @@ import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.passive.PassiveEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.WorldView;
import ru.betterend.registry.EntityRegistry;
import ru.betterend.registry.SoundRegistry;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
public class EntityDragonfly extends AnimalEntity implements Flutterer {
public EntityDragonfly(EntityType<EntityDragonfly> entityType, World world) {
@ -104,6 +107,16 @@ public class EntityDragonfly extends AnimalEntity implements Flutterer {
return true;
}
@Override
public SoundEvent getAmbientSound() {
return SoundRegistry.ENTITY_DRAGONFLY;
}
@Override
protected float getSoundVolume() {
return MHelper.randRange(0.25F, 0.5F, random);
}
class DragonflyLookControl extends LookControl {
DragonflyLookControl(MobEntity entity) {
super(entity);

View file

@ -4,25 +4,22 @@ import net.minecraft.sound.SoundEvent;
import net.minecraft.util.registry.Registry;
import ru.betterend.BetterEnd;
public class SoundsRegistry
public class SoundRegistry
{
// Music
public static final SoundEvent MUSIC_FOGGY_MUSHROOMLAND = registerMusic("foggy_mushroomland");
public static final SoundEvent MUSIC_FOGGY_MUSHROOMLAND = register("music", "foggy_mushroomland");
// Ambient
public static final SoundEvent AMBIENT_FOGGY_MUSHROOMLAND = registerAmbient("foggy_mushroomland");
public static final SoundEvent AMBIENT_FOGGY_MUSHROOMLAND = register("ambient", "foggy_mushroomland");
// Entity
public static final SoundEvent ENTITY_DRAGONFLY = register("entity", "dragonfly");
public static void register() {}
private static SoundEvent registerMusic(String id)
private static SoundEvent register(String type, String id)
{
id = "betterend.music." + id;
return Registry.register(Registry.SOUND_EVENT, id, new SoundEvent(BetterEnd.makeID(id)));
}
private static SoundEvent registerAmbient(String id)
{
id = "betterend.ambient." + id;
id = "betterend." + type + "." + id;
return Registry.register(Registry.SOUND_EVENT, id, new SoundEvent(BetterEnd.makeID(id)));
}
}

View file

@ -4,7 +4,7 @@ import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EntityRegistry;
import ru.betterend.registry.FeatureRegistry;
import ru.betterend.registry.ParticleRegistry;
import ru.betterend.registry.SoundsRegistry;
import ru.betterend.registry.SoundRegistry;
public class BiomeFoggyMushroomland extends EndBiome {
public BiomeFoggyMushroomland() {
@ -15,8 +15,8 @@ public class BiomeFoggyMushroomland extends EndBiome {
.setWaterFogColor(119, 227, 250)
.setSurface(BlockRegistry.END_MOSS, BlockRegistry.END_MYCELIUM)
.setParticles(ParticleRegistry.GLOWING_SPHERE, 0.001F)
.setLoop(SoundsRegistry.AMBIENT_FOGGY_MUSHROOMLAND)
.setMusic(SoundsRegistry.MUSIC_FOGGY_MUSHROOMLAND)
.setLoop(SoundRegistry.AMBIENT_FOGGY_MUSHROOMLAND)
.setMusic(SoundRegistry.MUSIC_FOGGY_MUSHROOMLAND)
.addFeature(FeatureRegistry.ENDER_ORE)
.addFeature(FeatureRegistry.END_LAKE)
.addFeature(FeatureRegistry.MOSSY_GLOWSHROOM)

View file

@ -23,5 +23,23 @@
"stream": false
}
]
},
"betterend.entity.dragonfly": {
"category": "entity",
"sounds": [
{
"name": "betterend:entity/dragonfly/dragonfly_1",
"stream": false
},
{
"name": "betterend:entity/dragonfly/dragonfly_2",
"stream": false
},
{
"name": "betterend:entity/dragonfly/dragonfly_3",
"stream": false
}
]
}
}