Added meteorite falling sound.

This commit is contained in:
DangerousMilk 2025-10-14 00:01:03 +02:00
parent bd8ed4920d
commit 59ace7eaf5
5 changed files with 56 additions and 13 deletions

View File

@ -12,11 +12,16 @@ import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
import com.hbm.sound.AudioWrapper;
public class EntityMeteor extends Entity { public class EntityMeteor extends Entity {
public boolean safe = false; public boolean safe = false;
// Audio
private boolean soundStarted = false;
private AudioWrapper audioFly;
public EntityMeteor(World p_i1582_1_) { public EntityMeteor(World p_i1582_1_) {
super(p_i1582_1_); super(p_i1582_1_);
this.ignoreFrustumCheck = true; this.ignoreFrustumCheck = true;
@ -57,6 +62,12 @@ public class EntityMeteor extends Entity {
@Override @Override
public void onUpdate() { public void onUpdate() {
if(!soundStarted) {
this.audioFly = MainRegistry.proxy.getLoopedSound("hbm:entity.meteoriteFallingLoop", (int)this.posX, 5000, (int)this.posZ, 1F, 150F, 1F, 2);
this.audioFly.startSound();
soundStarted = true;
}
if(!worldObj.isRemote && !WorldConfig.enableMeteorStrikes) { if(!worldObj.isRemote && !WorldConfig.enableMeteorStrikes) {
this.setDead(); this.setDead();
@ -72,9 +83,12 @@ public class EntityMeteor extends Entity {
motionY = -2.5; motionY = -2.5;
this.moveEntity(motionX, motionY, motionZ); this.moveEntity(motionX, motionY, motionZ);
this.audioFly.updatePosition((int)this.posX, (int)this.posY, (int)this.posZ);
this.audioFly.keepAlive();
if(!this.worldObj.isRemote && this.posY < 260) { if(!this.worldObj.isRemote && this.posY < 260) {
if(destroyWeakBlocks(worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 6) && this.onGround) { if(destroyWeakBlocks(worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 6) && this.onGround) {
this.audioFly.stopSound();
//worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 5 + rand.nextFloat(), !safe); //worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 5 + rand.nextFloat(), !safe);
if(WorldConfig.enableMeteorTails) { if(WorldConfig.enableMeteorTails) {
ExplosionLarge.spawnParticles(worldObj, posX, posY + 5, posZ, 75); ExplosionLarge.spawnParticles(worldObj, posX, posY + 5, posZ, 75);

View File

@ -135,14 +135,14 @@ public class Meteorite {
switch(rand.nextInt(3)) { switch(rand.nextInt(3)) {
case 0: case 0:
generateLarge(world, rand, x, y, z); generateLarge(world, rand, x, y, z);
world.createExplosion(null, x + 0.5, y + 1.5, z + 0.5, 9F, !safe); world.createExplosion(null, x + 0.5, y + 0.5, z + 0.5, 5F, !safe);
break; break;
case 1: case 1:
world.createExplosion(null, x + 0.5, y + 1.5, z + 0.5, 6F, !safe); world.createExplosion(null, x + 0.5, y + 0.5, z + 0.5, 4F, !safe);
generateMedium(world, rand, x, y, z); generateMedium(world, rand, x, y, z);
break; break;
case 2: case 2:
world.createExplosion(null, x + 0.5, y + 1.5, z + 0.5, 5F, !safe); world.createExplosion(null, x + 0.5, y + 0.5, z + 0.5, 2F, !safe);
generateSmall(world, rand, x, y, z); generateSmall(world, rand, x, y, z);
break; break;
} }

View File

@ -328,8 +328,10 @@
"entity.siegeIdle": {"category": "hostile", "sounds": ["entity/siegeIdle1"]}, "entity.siegeIdle": {"category": "hostile", "sounds": ["entity/siegeIdle1"]},
"entity.siegeHurt": {"category": "hostile", "sounds": ["entity/siegeHurt1", "entity/siegeHurt2"]}, "entity.siegeHurt": {"category": "hostile", "sounds": ["entity/siegeHurt1", "entity/siegeHurt2"]},
"entity.siegeDeath": {"category": "hostile", "sounds": ["entity/siegeDeath1", "entity/siegeDeath2", "entity/siegeDeath3"]}, "entity.siegeDeath": {"category": "hostile", "sounds": ["entity/siegeDeath1", "entity/siegeDeath2", "entity/siegeDeath3"]},
"entity.meteoriteFallingLoop": {"category": "block", "sounds": ["entity/meteoriteFallingLoop"]},
"step.metal": {"category": "player", "sounds": [{"name": "footsteps/metal", "stream": false}]},
"step.metal": {"category": "player", "sounds": [{"name": "footsteps/metal", "stream": false}]},
"step.iron_jump": {"category": "player", "sounds": [{"name": "footsteps/iron_jump", "stream": false}]}, "step.iron_jump": {"category": "player", "sounds": [{"name": "footsteps/iron_jump", "stream": false}]},
"step.iron_land": {"category": "player", "sounds": [{"name": "footsteps/iron_land", "stream": false}]}, "step.iron_land": {"category": "player", "sounds": [{"name": "footsteps/iron_land", "stream": false}]},
"step.iron": {"category": "player", "sounds": ["footsteps/iron1", "footsteps/iron2", "footsteps/iron3", "footsteps/iron4"]}, "step.iron": {"category": "player", "sounds": ["footsteps/iron1", "footsteps/iron2", "footsteps/iron3", "footsteps/iron4"]},

27
vlc-log.txt Normal file
View File

@ -0,0 +1,27 @@
-- logger module started --
main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
-- logger module stopped --
-- logger module started --
main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
-- logger module stopped --
-- logger module started --
main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
-- logger module stopped --
-- logger module started --
main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
-- logger module started --
-- logger module stopped --
-- logger module started --
main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
-- logger module stopped --
-- logger module started --
main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
-- logger module stopped --
-- logger module started --
main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
-- logger module started --
-- logger module started --
-- logger module stopped --
-- logger module started --
main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
-- logger module stopped --