Made the destruction of weak blocks safe. More sound tweaks

This commit is contained in:
DangerousMilk 2025-10-16 23:08:38 +02:00
parent f87a23d494
commit c3c0be94e3
2 changed files with 16 additions and 10 deletions

View File

@ -27,6 +27,9 @@ public class EntityMeteor extends Entity {
this.ignoreFrustumCheck = true;
this.isImmuneToFire = true;
this.setSize(4F, 4F);
this.audioFly = MainRegistry.proxy.getLoopedSound("hbm:entity.meteoriteFallingLoop", 0, 0, 0, 0F, 100F, 0.9F + this.rand.nextFloat() * 0.2F, 0);
}
public boolean destroyWeakBlocks(World world, int x, int y, int z, int radius) {
@ -48,7 +51,7 @@ public class EntityMeteor extends Entity {
float hardness = block.getBlockHardness(world, blockX, blockY, blockZ);
if (block == Blocks.leaves || block == Blocks.log || hardness <= 0.3F || block == Blocks.water) {
world.setBlockToAir(blockX, blockY, blockZ);
if(!safe) world.setBlockToAir(blockX, blockY, blockZ);
} else {
foundSolidBlock = true;
}
@ -62,13 +65,6 @@ public class EntityMeteor extends Entity {
@Override
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) {
this.setDead();
return;
@ -84,7 +80,6 @@ public class EntityMeteor extends Entity {
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(destroyWeakBlocks(worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 6) && this.onGround) {
@ -104,6 +99,17 @@ public class EntityMeteor extends Entity {
}
}
if(this.motionY <= -2){
if(this.audioFly.isPlaying()) {
//this.audioFly.keepAlive();
//this.audioFly.updateVolume(1F);
}
else
{
//this.audioFly.startSound();
}
}
if(WorldConfig.enableMeteorTails && worldObj.isRemote) {
NBTTagCompound data = new NBTTagCompound();

View File

@ -328,7 +328,7 @@
"entity.siegeIdle": {"category": "hostile", "sounds": ["entity/siegeIdle1"]},
"entity.siegeHurt": {"category": "hostile", "sounds": ["entity/siegeHurt1", "entity/siegeHurt2"]},
"entity.siegeDeath": {"category": "hostile", "sounds": ["entity/siegeDeath1", "entity/siegeDeath2", "entity/siegeDeath3"]},
"entity.meteoriteFallingLoop": {"category": "block", "sounds": ["entity/meteoriteFallingLoop"]},
"entity.meteoriteFallingLoop": {"category": "block", "sounds": [{"name": "entity/meteoriteFallingLoop", "stream": false}]},
"step.metal": {"category": "player", "sounds": [{"name": "footsteps/metal", "stream": false}]},