"Fixed" Thermonuclear explosions
Looks like the devs were in the middle of rewriting this class Thermonukes would cause a crash because setScale tries to set a dataManager thing that was never registered Once that bug was fixed the crash stopped happening but the explosion didnt do much so I readded a lot of commented out code Works for now, will have to see what the devs were planning to do with this so I can impliment it right or just steal what they did
This commit is contained in:
parent
43915e43f0
commit
1131b22447
1 changed files with 48 additions and 30 deletions
|
@ -2,9 +2,9 @@ package trinity.entities;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
//import icbm.classic.api.ExplosiveRefs;
|
||||
//import icbm.classic.content.blast.BlastEMP;
|
||||
//import icbm.classic.content.blast.threaded.BlastNuclear;
|
||||
import icbm.classic.api.refs.ICBMExplosives;
|
||||
import icbm.classic.content.blast.BlastEMP;
|
||||
// import icbm.classic.content.blast.threaded.BlastNuclear;
|
||||
import nc.init.NCBlocks;
|
||||
import nc.worldgen.biome.NCBiomes;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -65,6 +65,7 @@ public class EntityThermonuclearBlast extends Entity {
|
|||
|
||||
public int age = 0;
|
||||
public int destructionRange = 0;
|
||||
public int falloutIntensity = 0;
|
||||
//public ExplosionBalefire exp;
|
||||
public int speed = 1;
|
||||
public boolean did = false;
|
||||
|
@ -73,6 +74,7 @@ public class EntityThermonuclearBlast extends Entity {
|
|||
protected void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
age = nbt.getInteger("age");
|
||||
destructionRange = nbt.getInteger("destructionRange");
|
||||
falloutIntensity = nbt.getInteger("falloutIntensity");
|
||||
speed = nbt.getInteger("speed");
|
||||
did = nbt.getBoolean("did");
|
||||
|
||||
|
@ -88,6 +90,7 @@ public class EntityThermonuclearBlast extends Entity {
|
|||
protected void writeEntityToNBT(NBTTagCompound nbt) {
|
||||
nbt.setInteger("age", age);
|
||||
nbt.setInteger("destructionRange", destructionRange);
|
||||
nbt.setInteger("falloutIntensity", falloutIntensity);
|
||||
nbt.setInteger("speed", speed);
|
||||
nbt.setBoolean("did", did);
|
||||
|
||||
|
@ -109,20 +112,44 @@ public class EntityThermonuclearBlast extends Entity {
|
|||
//if(GeneralConfig.enableExtendedLogging && !world.isRemote)
|
||||
// MainRegistry.logger.log(Level.INFO, "[NUKE] Initialized BF explosion at " + posX + " / " + posY + " / " + posZ + " with strength " + destructionRange + "!");
|
||||
|
||||
exp = new ExplosionThermonuclear((int)this.posX, (int)this.posY, (int)this.posZ, this.world, this.destructionRange);
|
||||
exp = new ExplosionThermonuclear((int)this.posX, (int)this.posY, (int)this.posZ, this.world, getScale());
|
||||
|
||||
EntityFalloutRain fallout = new EntityFalloutRain(this.world);
|
||||
fallout.posX = this.posX;
|
||||
fallout.posY = this.posY;
|
||||
fallout.posZ = this.posZ;
|
||||
fallout.setScale((int)(this.getScale() * TrinityConfig.fallout_multiplier));
|
||||
fallout.setThermonuclear(true);
|
||||
fallout.setIntensity(this.getIntensity());
|
||||
this.world.spawnEntity(fallout);
|
||||
|
||||
EntityShockwave shock = new EntityShockwave(this.world);
|
||||
shock.posX = this.posX;
|
||||
shock.posY = this.posY;
|
||||
shock.posZ = this.posZ;
|
||||
shock.setScale(this.getScale() * 2);
|
||||
this.world.spawnEntity(shock);
|
||||
|
||||
if(Trinity.ICBMLoaded)
|
||||
{
|
||||
new BlastEMP().setBlastWorld(this.world).setBlastSource(this).setBlastPosition(this.posX, this.posY, this.posZ)
|
||||
.setBlastSize(getScale()*2)
|
||||
.setExplosiveData(ICBMExplosives.EMP)
|
||||
.buildBlast().runBlast();
|
||||
}
|
||||
|
||||
this.did = true;
|
||||
}
|
||||
|
||||
speed += 1; //increase speed to keep up with expansion
|
||||
|
||||
boolean flag = false;
|
||||
boolean shouldDie = false;
|
||||
|
||||
for(int i = 0; i < this.speed; i++)
|
||||
{
|
||||
flag = exp.update();
|
||||
shouldDie = exp.update();
|
||||
|
||||
if(flag) {
|
||||
if(shouldDie) {
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +157,7 @@ public class EntityThermonuclearBlast extends Entity {
|
|||
if(rand.nextInt(5) == 0)
|
||||
this.world.playSound(null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.AMBIENT, 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
|
||||
|
||||
if(!flag)
|
||||
if(!shouldDie)
|
||||
{
|
||||
this.world.playSound(null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_LIGHTNING_THUNDER, SoundCategory.AMBIENT, 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
|
||||
ExplosionNukeGeneric.dealDamage(this.world, (int)this.posX, (int)this.posY, (int)this.posZ, this.destructionRange * 2);
|
||||
|
@ -338,32 +365,23 @@ public class EntityThermonuclearBlast extends Entity {
|
|||
}
|
||||
*/
|
||||
public void setIntensity(int i) {
|
||||
|
||||
this.dataManager.set(INTENSITY, Integer.valueOf(i));
|
||||
this.falloutIntensity = i;
|
||||
}
|
||||
|
||||
public int getIntensity() {
|
||||
|
||||
int intensity = this.dataManager.get(INTENSITY);
|
||||
int intensity = this.falloutIntensity;
|
||||
|
||||
return intensity == 0 ? 1 : intensity;
|
||||
}
|
||||
|
||||
public void setScale(int i) {
|
||||
|
||||
this.dataManager.set(SCALE, Integer.valueOf(i));
|
||||
/*if(Trinity.ICBMLoaded)
|
||||
{
|
||||
new BlastEMP().setBlastWorld(this.world).setBlastSource(this).setBlastPosition(this.posX, this.posY, this.posZ)
|
||||
.setBlastSize(i*2)
|
||||
.setExplosiveData(ExplosiveRefs.EMP)
|
||||
.buildBlast().runBlast();
|
||||
}*/
|
||||
this.destructionRange = i;
|
||||
}
|
||||
|
||||
public int getScale() {
|
||||
|
||||
int scale = this.dataManager.get(SCALE);
|
||||
int scale = this.destructionRange;
|
||||
|
||||
return scale == 0 ? 1 : scale;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue