mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
explosion chunk loader config
This commit is contained in:
parent
625bdac1a4
commit
58b08ac039
@ -27,6 +27,7 @@ public class BombConfig {
|
|||||||
public static int limitExplosionLifespan = 0;
|
public static int limitExplosionLifespan = 0;
|
||||||
public static int rain = 0;
|
public static int rain = 0;
|
||||||
public static int cont = 0;
|
public static int cont = 0;
|
||||||
|
public static boolean chunkloading = true;
|
||||||
|
|
||||||
public static void loadFromConfig(Configuration config) {
|
public static void loadFromConfig(Configuration config) {
|
||||||
|
|
||||||
@ -100,5 +101,7 @@ public class BombConfig {
|
|||||||
Property rainCont = config.get(CATEGORY_NUKE, "6.06_falloutRainRadiation", 0);
|
Property rainCont = config.get(CATEGORY_NUKE, "6.06_falloutRainRadiation", 0);
|
||||||
rainCont.comment = "Radiation in 100th RADs created by fallout rain";
|
rainCont.comment = "Radiation in 100th RADs created by fallout rain";
|
||||||
cont = rainCont.getInt();
|
cont = rainCont.getInt();
|
||||||
|
|
||||||
|
chunkloading = CommonConfig.createConfigBool(config, CATEGORY_NUKE, "6.XX_enableChunkLoading", "Allows all types of procedural explosions to keep the central chunk loaded.", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,11 +7,10 @@ import com.hbm.explosion.ExplosionBalefire;
|
|||||||
import com.hbm.explosion.ExplosionNukeGeneric;
|
import com.hbm.explosion.ExplosionNukeGeneric;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class EntityBalefire extends Entity {
|
public class EntityBalefire extends EntityExplosionChunkloading {
|
||||||
|
|
||||||
public int age = 0;
|
public int age = 0;
|
||||||
public int destructionRange = 0;
|
public int destructionRange = 0;
|
||||||
@ -53,48 +52,46 @@ public class EntityBalefire extends Entity {
|
|||||||
super(p_i1582_1_);
|
super(p_i1582_1_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onUpdate() {
|
|
||||||
super.onUpdate();
|
|
||||||
|
|
||||||
if(!this.did)
|
|
||||||
{
|
|
||||||
if(GeneralConfig.enableExtendedLogging && !worldObj.isRemote)
|
|
||||||
MainRegistry.logger.log(Level.INFO, "[NUKE] Initialized BF explosion at " + posX + " / " + posY + " / " + posZ + " with strength " + destructionRange + "!");
|
|
||||||
|
|
||||||
exp = new ExplosionBalefire((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, this.destructionRange);
|
|
||||||
|
|
||||||
this.did = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
speed += 1; //increase speed to keep up with expansion
|
|
||||||
|
|
||||||
boolean flag = false;
|
|
||||||
for(int i = 0; i < this.speed; i++)
|
|
||||||
{
|
|
||||||
flag = exp.update();
|
|
||||||
|
|
||||||
if(flag) {
|
|
||||||
this.setDead();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!mute && rand.nextInt(5) == 0)
|
|
||||||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
|
|
||||||
|
|
||||||
if(!flag) {
|
|
||||||
|
|
||||||
if(!mute)
|
|
||||||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
|
|
||||||
|
|
||||||
ExplosionNukeGeneric.dealDamage(this.worldObj, this.posX, this.posY, this.posZ, this.destructionRange * 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
age++;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void entityInit() { }
|
public void onUpdate() {
|
||||||
|
super.onUpdate();
|
||||||
|
|
||||||
|
if(!worldObj.isRemote) loadChunk((int) Math.floor(posX / 16D), (int) Math.floor(posZ / 16D));
|
||||||
|
|
||||||
|
if(!this.did) {
|
||||||
|
if(GeneralConfig.enableExtendedLogging && !worldObj.isRemote)
|
||||||
|
MainRegistry.logger.log(Level.INFO, "[NUKE] Initialized BF explosion at " + posX + " / " + posY + " / " + posZ + " with strength " + destructionRange + "!");
|
||||||
|
|
||||||
|
exp = new ExplosionBalefire((int) this.posX, (int) this.posY, (int) this.posZ, this.worldObj, this.destructionRange);
|
||||||
|
|
||||||
|
this.did = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
speed += 1; // increase speed to keep up with expansion
|
||||||
|
|
||||||
|
boolean flag = false;
|
||||||
|
for(int i = 0; i < this.speed; i++) {
|
||||||
|
flag = exp.update();
|
||||||
|
|
||||||
|
if(flag) {
|
||||||
|
clearChunkLoader();
|
||||||
|
this.setDead();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!mute && rand.nextInt(5) == 0)
|
||||||
|
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
|
||||||
|
|
||||||
|
if(!flag) {
|
||||||
|
|
||||||
|
if(!mute)
|
||||||
|
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
|
||||||
|
|
||||||
|
ExplosionNukeGeneric.dealDamage(this.worldObj, this.posX, this.posY, this.posZ, this.destructionRange * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
age++;
|
||||||
|
}
|
||||||
|
|
||||||
public EntityBalefire mute() {
|
public EntityBalefire mute() {
|
||||||
this.mute = true;
|
this.mute = true;
|
||||||
|
|||||||
@ -1,49 +0,0 @@
|
|||||||
package com.hbm.entity.logic;
|
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public abstract class EntityEnvirEffect extends Entity {
|
|
||||||
|
|
||||||
public int maxAge = 100;
|
|
||||||
public int blockRadius = 7;
|
|
||||||
public int entityRadius = 7;
|
|
||||||
public int chance = 10;
|
|
||||||
public boolean hasBlockEffect = true;
|
|
||||||
public boolean hasEntityEffect = true;
|
|
||||||
|
|
||||||
public EntityEnvirEffect(World p_i1582_1_) {
|
|
||||||
super(p_i1582_1_);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void entityInit() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void readEntityFromNBT(NBTTagCompound nbt) {
|
|
||||||
this.ticksExisted = nbt.getInteger("lifetime");
|
|
||||||
this.maxAge = nbt.getInteger("lifecap");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void writeEntityToNBT(NBTTagCompound nbt) {
|
|
||||||
nbt.setInteger("lifetime", this.ticksExisted);
|
|
||||||
nbt.setInteger("lifecap", this.maxAge);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onUpdate() {
|
|
||||||
|
|
||||||
if(hasBlockEffect && rand.nextInt(chance) == 0)
|
|
||||||
applyBlockEffect();
|
|
||||||
|
|
||||||
if(hasEntityEffect && rand.nextInt(chance) == 0)
|
|
||||||
applyEntityEffect();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void applyBlockEffect() { };
|
|
||||||
private void applyEntityEffect() { };
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
package com.hbm.entity.logic;
|
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class EntityEnvirEffectRad extends EntityEnvirEffect {
|
|
||||||
|
|
||||||
public EntityEnvirEffectRad(World p_i1582_1_) {
|
|
||||||
super(p_i1582_1_);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void randomizeAge(int min, int max) {
|
|
||||||
this.maxAge = min + rand.nextInt(max - min);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
package com.hbm.entity.logic;
|
||||||
|
|
||||||
|
import com.hbm.main.MainRegistry;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.world.ChunkCoordIntPair;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.ForgeChunkManager;
|
||||||
|
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||||
|
import net.minecraftforge.common.ForgeChunkManager.Type;
|
||||||
|
|
||||||
|
public abstract class EntityExplosionChunkloading extends Entity implements IChunkLoader {
|
||||||
|
|
||||||
|
private Ticket loaderTicket;
|
||||||
|
private ChunkCoordIntPair loadedChunk;
|
||||||
|
|
||||||
|
public EntityExplosionChunkloading(World world) {
|
||||||
|
super(world);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void entityInit() {
|
||||||
|
init(ForgeChunkManager.requestTicket(MainRegistry.instance, worldObj, Type.ENTITY));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(Ticket ticket) {
|
||||||
|
if(!worldObj.isRemote && ticket != null) {
|
||||||
|
if(loaderTicket == null) {
|
||||||
|
loaderTicket = ticket;
|
||||||
|
loaderTicket.bindEntity(this);
|
||||||
|
loaderTicket.getModData();
|
||||||
|
}
|
||||||
|
ForgeChunkManager.forceChunk(loaderTicket, new ChunkCoordIntPair(chunkCoordX, chunkCoordZ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadChunk(int x, int z) {
|
||||||
|
|
||||||
|
if(this.loadedChunk == null) {
|
||||||
|
this.loadedChunk = new ChunkCoordIntPair(x, z);
|
||||||
|
ForgeChunkManager.forceChunk(loaderTicket, loadedChunk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearChunkLoader() {
|
||||||
|
if(!worldObj.isRemote && loaderTicket != null && loadedChunk != null) {
|
||||||
|
ForgeChunkManager.unforceChunk(loaderTicket, loadedChunk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -20,14 +20,13 @@ import com.hbm.packet.AuxParticlePacketNT;
|
|||||||
import com.hbm.packet.PacketDispatcher;
|
import com.hbm.packet.PacketDispatcher;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
@Spaghetti("why???")
|
@Spaghetti("why???")
|
||||||
public class EntityNukeExplosionMK3 extends Entity {
|
public class EntityNukeExplosionMK3 extends EntityExplosionChunkloading {
|
||||||
|
|
||||||
public int age = 0;
|
public int age = 0;
|
||||||
public int destructionRange = 0;
|
public int destructionRange = 0;
|
||||||
@ -59,30 +58,31 @@ public class EntityNukeExplosionMK3 extends Entity {
|
|||||||
|
|
||||||
long time = nbt.getLong("milliTime");
|
long time = nbt.getLong("milliTime");
|
||||||
|
|
||||||
if(BombConfig.limitExplosionLifespan > 0 && System.currentTimeMillis() - time > BombConfig.limitExplosionLifespan * 1000)
|
if(BombConfig.limitExplosionLifespan > 0 && System.currentTimeMillis() - time > BombConfig.limitExplosionLifespan * 1000) {
|
||||||
|
this.clearChunkLoader();
|
||||||
this.setDead();
|
this.setDead();
|
||||||
|
}
|
||||||
|
|
||||||
if(this.waste)
|
if(this.waste) {
|
||||||
{
|
exp = new ExplosionNukeAdvanced((int) this.posX, (int) this.posY, (int) this.posZ, this.worldObj, this.destructionRange, this.coefficient, 0);
|
||||||
exp = new ExplosionNukeAdvanced((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, this.destructionRange, this.coefficient, 0);
|
|
||||||
exp.readFromNbt(nbt, "exp_");
|
exp.readFromNbt(nbt, "exp_");
|
||||||
wst = new ExplosionNukeAdvanced((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, (int)(this.destructionRange * 1.8), this.coefficient, 2);
|
wst = new ExplosionNukeAdvanced((int) this.posX, (int) this.posY, (int) this.posZ, this.worldObj, (int) (this.destructionRange * 1.8), this.coefficient, 2);
|
||||||
wst.readFromNbt(nbt, "wst_");
|
wst.readFromNbt(nbt, "wst_");
|
||||||
vap = new ExplosionNukeAdvanced((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, (int)(this.destructionRange * 2.5), this.coefficient, 1);
|
vap = new ExplosionNukeAdvanced((int) this.posX, (int) this.posY, (int) this.posZ, this.worldObj, (int) (this.destructionRange * 2.5), this.coefficient, 1);
|
||||||
vap.readFromNbt(nbt, "vap_");
|
vap.readFromNbt(nbt, "vap_");
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if(extType == 0) {
|
if(extType == 0) {
|
||||||
expl = new ExplosionFleija((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, this.destructionRange, this.coefficient, this.coefficient2);
|
expl = new ExplosionFleija((int) this.posX, (int) this.posY, (int) this.posZ, this.worldObj, this.destructionRange, this.coefficient, this.coefficient2);
|
||||||
expl.readFromNbt(nbt, "expl_");
|
expl.readFromNbt(nbt, "expl_");
|
||||||
}
|
}
|
||||||
if(extType == 1) {
|
if(extType == 1) {
|
||||||
sol = new ExplosionSolinium((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, this.destructionRange, this.coefficient, this.coefficient2);
|
sol = new ExplosionSolinium((int) this.posX, (int) this.posY, (int) this.posZ, this.worldObj, this.destructionRange, this.coefficient, this.coefficient2);
|
||||||
sol.readFromNbt(nbt, "sol_");
|
sol.readFromNbt(nbt, "sol_");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.did = true;
|
this.did = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,6 +121,8 @@ public class EntityNukeExplosionMK3 extends Entity {
|
|||||||
public void onUpdate() {
|
public void onUpdate() {
|
||||||
super.onUpdate();
|
super.onUpdate();
|
||||||
|
|
||||||
|
if(!worldObj.isRemote) loadChunk((int) Math.floor(posX / 16D), (int) Math.floor(posZ / 16D));
|
||||||
|
|
||||||
if(!this.did)
|
if(!this.did)
|
||||||
{
|
{
|
||||||
for(Object player : this.worldObj.playerEntities)
|
for(Object player : this.worldObj.playerEntities)
|
||||||
@ -149,25 +151,31 @@ public class EntityNukeExplosionMK3 extends Entity {
|
|||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
boolean flag3 = false;
|
boolean flag3 = false;
|
||||||
|
|
||||||
for(int i = 0; i < this.speed; i++)
|
for(int i = 0; i < this.speed; i++) {
|
||||||
{
|
if(waste) {
|
||||||
if(waste) {
|
flag = exp.update();
|
||||||
flag = exp.update();
|
wst.update();
|
||||||
wst.update();
|
flag3 = vap.update();
|
||||||
flag3 = vap.update();
|
|
||||||
|
|
||||||
if(flag3) {
|
if(flag3) {
|
||||||
this.setDead();
|
this.clearChunkLoader();
|
||||||
}
|
this.setDead();
|
||||||
} else {
|
}
|
||||||
if(extType == 0)
|
} else {
|
||||||
if(expl.update())
|
if(extType == 0) {
|
||||||
this.setDead();
|
if(expl.update()) {
|
||||||
if(extType == 1)
|
this.clearChunkLoader();
|
||||||
if(sol.update())
|
this.setDead();
|
||||||
this.setDead();
|
}
|
||||||
}
|
}
|
||||||
}
|
if(extType == 1) {
|
||||||
|
if(sol.update()) {
|
||||||
|
this.clearChunkLoader();
|
||||||
|
this.setDead();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!flag)
|
if(!flag)
|
||||||
{
|
{
|
||||||
@ -197,9 +205,6 @@ public class EntityNukeExplosionMK3 extends Entity {
|
|||||||
age++;
|
age++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void entityInit() { }
|
|
||||||
|
|
||||||
public static HashMap<ATEntry, Long> at = new HashMap();
|
public static HashMap<ATEntry, Long> at = new HashMap();
|
||||||
|
|
||||||
public static EntityNukeExplosionMK3 statFacFleija(World world, double x, double y, double z, int range) {
|
public static EntityNukeExplosionMK3 statFacFleija(World world, double x, double y, double z, int range) {
|
||||||
|
|||||||
@ -14,7 +14,6 @@ import com.hbm.util.ContaminationUtil;
|
|||||||
import com.hbm.util.ContaminationUtil.ContaminationType;
|
import com.hbm.util.ContaminationUtil.ContaminationType;
|
||||||
import com.hbm.util.ContaminationUtil.HazardType;
|
import com.hbm.util.ContaminationUtil.HazardType;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
@ -22,7 +21,7 @@ import net.minecraft.util.AxisAlignedBB;
|
|||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class EntityNukeExplosionMK5 extends Entity {
|
public class EntityNukeExplosionMK5 extends EntityExplosionChunkloading {
|
||||||
|
|
||||||
//Strength of the blast
|
//Strength of the blast
|
||||||
public int strength;
|
public int strength;
|
||||||
@ -52,10 +51,13 @@ public class EntityNukeExplosionMK5 extends Entity {
|
|||||||
public void onUpdate() {
|
public void onUpdate() {
|
||||||
|
|
||||||
if(strength == 0) {
|
if(strength == 0) {
|
||||||
|
this.clearChunkLoader();
|
||||||
this.setDead();
|
this.setDead();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!worldObj.isRemote) loadChunk((int) Math.floor(posX / 16D), (int) Math.floor(posZ / 16D));
|
||||||
|
|
||||||
for(Object player : this.worldObj.playerEntities) {
|
for(Object player : this.worldObj.playerEntities) {
|
||||||
((EntityPlayer)player).triggerAchievement(MainRegistry.achManhattan);
|
((EntityPlayer)player).triggerAchievement(MainRegistry.achManhattan);
|
||||||
}
|
}
|
||||||
@ -93,8 +95,10 @@ public class EntityNukeExplosionMK5 extends Entity {
|
|||||||
|
|
||||||
this.worldObj.spawnEntityInWorld(fallout);
|
this.worldObj.spawnEntityInWorld(fallout);
|
||||||
|
|
||||||
|
this.clearChunkLoader();
|
||||||
this.setDead();
|
this.setDead();
|
||||||
} else {
|
} else {
|
||||||
|
this.clearChunkLoader();
|
||||||
this.setDead();
|
this.setDead();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,11 +8,10 @@ import com.hbm.explosion.ExplosionTom;
|
|||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.saveddata.TomSaveData;
|
import com.hbm.saveddata.TomSaveData;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class EntityTomBlast extends Entity {
|
public class EntityTomBlast extends EntityExplosionChunkloading {
|
||||||
|
|
||||||
public int age = 0;
|
public int age = 0;
|
||||||
public int destructionRange = 0;
|
public int destructionRange = 0;
|
||||||
@ -54,6 +53,8 @@ public class EntityTomBlast extends Entity {
|
|||||||
public void onUpdate() {
|
public void onUpdate() {
|
||||||
super.onUpdate();
|
super.onUpdate();
|
||||||
|
|
||||||
|
if(!worldObj.isRemote) loadChunk((int) Math.floor(posX / 16D), (int) Math.floor(posZ / 16D));
|
||||||
|
|
||||||
if(!this.did) {
|
if(!this.did) {
|
||||||
|
|
||||||
if(GeneralConfig.enableExtendedLogging && !worldObj.isRemote)
|
if(GeneralConfig.enableExtendedLogging && !worldObj.isRemote)
|
||||||
@ -89,8 +90,4 @@ public class EntityTomBlast extends Entity {
|
|||||||
|
|
||||||
age++;
|
age++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void entityInit() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,46 +48,36 @@ public abstract class EntityMissileBaseAdvanced extends Entity implements IChunk
|
|||||||
targetZ = (int) posZ;
|
targetZ = (int) posZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canBeCollidedWith()
|
public boolean canBeCollidedWith() {
|
||||||
{
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_)
|
public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) {
|
||||||
{
|
if(this.isEntityInvulnerable()) {
|
||||||
if (this.isEntityInvulnerable())
|
return false;
|
||||||
{
|
} else {
|
||||||
return false;
|
if(!this.isDead && !this.worldObj.isRemote) {
|
||||||
}
|
health -= p_70097_2_;
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!this.isDead && !this.worldObj.isRemote)
|
|
||||||
{
|
|
||||||
health -= p_70097_2_;
|
|
||||||
|
|
||||||
if (this.health <= 0)
|
if(this.health <= 0) {
|
||||||
{
|
this.setDead();
|
||||||
this.setDead();
|
this.killMissile();
|
||||||
this.killMissile();
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void killMissile() {
|
private void killMissile() {
|
||||||
ExplosionLarge.explode(worldObj, posX, posY, posZ, 5, true, false, true);
|
ExplosionLarge.explode(worldObj, posX, posY, posZ, 5, true, false, true);
|
||||||
ExplosionLarge.spawnShrapnelShower(worldObj, posX, posY, posZ, motionX, motionY, motionZ, 15, 0.075);
|
ExplosionLarge.spawnShrapnelShower(worldObj, posX, posY, posZ, motionX, motionY, motionZ, 15, 0.075);
|
||||||
ExplosionLarge.spawnMissileDebris(worldObj, posX, posY, posZ, motionX, motionY, motionZ, 0.25, getDebris(), getDebrisRareDrop());
|
ExplosionLarge.spawnMissileDebris(worldObj, posX, posY, posZ, motionX, motionY, motionZ, 0.25, getDebris(), getDebrisRareDrop());
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityMissileBaseAdvanced(World world, float x, float y, float z, int a, int b) {
|
public EntityMissileBaseAdvanced(World world, float x, float y, float z, int a, int b) {
|
||||||
super(world);
|
super(world);
|
||||||
this.ignoreFrustumCheck = true;
|
this.ignoreFrustumCheck = true;
|
||||||
/*this.posX = x;
|
|
||||||
this.posY = y;
|
|
||||||
this.posZ = z;*/
|
|
||||||
this.setLocationAndAngles(x, y, z, 0, 0);
|
this.setLocationAndAngles(x, y, z, 0, 0);
|
||||||
startX = (int) x;
|
startX = (int) x;
|
||||||
startZ = (int) z;
|
startZ = (int) z;
|
||||||
@ -95,19 +85,19 @@ public abstract class EntityMissileBaseAdvanced extends Entity implements IChunk
|
|||||||
targetZ = b;
|
targetZ = b;
|
||||||
this.motionY = 2;
|
this.motionY = 2;
|
||||||
|
|
||||||
Vec3 vector = Vec3.createVectorHelper(targetX - startX, 0, targetZ - startZ);
|
Vec3 vector = Vec3.createVectorHelper(targetX - startX, 0, targetZ - startZ);
|
||||||
accelXZ = decelY = 1/vector.lengthVector();
|
accelXZ = decelY = 1 / vector.lengthVector();
|
||||||
decelY *= 2;
|
decelY *= 2;
|
||||||
|
|
||||||
velocity = 1;
|
velocity = 1;
|
||||||
|
|
||||||
this.setSize(1.5F, 1.5F);
|
this.setSize(1.5F, 1.5F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void entityInit() {
|
protected void entityInit() {
|
||||||
init(ForgeChunkManager.requestTicket(MainRegistry.instance, worldObj, Type.ENTITY));
|
init(ForgeChunkManager.requestTicket(MainRegistry.instance, worldObj, Type.ENTITY));
|
||||||
this.dataWatcher.addObject(8, Integer.valueOf(this.health));
|
this.dataWatcher.addObject(8, Integer.valueOf(this.health));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -212,7 +202,6 @@ public abstract class EntityMissileBaseAdvanced extends Entity implements IChunk
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!this.worldObj.isRemote)
|
if(!this.worldObj.isRemote)
|
||||||
//this.worldObj.spawnEntityInWorld(new EntitySmokeFX(this.worldObj, this.posX, this.posY, this.posZ, 0.0, 0.0, 0.0));
|
|
||||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacket(posX, posY, posZ, 2),
|
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacket(posX, posY, posZ, 2),
|
||||||
new TargetPoint(worldObj.provider.dimensionId, posX, posY, posZ, 300));
|
new TargetPoint(worldObj.provider.dimensionId, posX, posY, posZ, 300));
|
||||||
|
|
||||||
@ -220,30 +209,28 @@ public abstract class EntityMissileBaseAdvanced extends Entity implements IChunk
|
|||||||
this.worldObj.getBlock((int)this.posX, (int)this.posY, (int)this.posZ) != Blocks.water &&
|
this.worldObj.getBlock((int)this.posX, (int)this.posY, (int)this.posZ) != Blocks.water &&
|
||||||
this.worldObj.getBlock((int)this.posX, (int)this.posY, (int)this.posZ) != Blocks.flowing_water) {
|
this.worldObj.getBlock((int)this.posX, (int)this.posY, (int)this.posZ) != Blocks.flowing_water) {
|
||||||
|
|
||||||
if(!this.worldObj.isRemote)
|
if(!this.worldObj.isRemote) {
|
||||||
{
|
onImpact();
|
||||||
onImpact();
|
}
|
||||||
}
|
this.killAndClear();
|
||||||
this.setDead();
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
loadNeighboringChunks((int)(posX / 16), (int)(posZ / 16));
|
loadNeighboringChunks((int) (posX / 16), (int) (posZ / 16));
|
||||||
|
|
||||||
if(motionY < -1 && this.isCluster && !worldObj.isRemote) {
|
if(motionY < -1 && this.isCluster && !worldObj.isRemote) {
|
||||||
cluster();
|
cluster();
|
||||||
this.setDead();
|
this.setDead();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public boolean isInRangeToRenderDist(double distance)
|
public boolean isInRangeToRenderDist(double distance) {
|
||||||
{
|
return true;
|
||||||
return distance < 500000;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public abstract void onImpact();
|
public abstract void onImpact();
|
||||||
|
|
||||||
@ -272,30 +259,31 @@ public abstract class EntityMissileBaseAdvanced extends Entity implements IChunk
|
|||||||
|
|
||||||
List<ChunkCoordIntPair> loadedChunks = new ArrayList<ChunkCoordIntPair>();
|
List<ChunkCoordIntPair> loadedChunks = new ArrayList<ChunkCoordIntPair>();
|
||||||
|
|
||||||
public void loadNeighboringChunks(int newChunkX, int newChunkZ)
|
public void loadNeighboringChunks(int newChunkX, int newChunkZ) {
|
||||||
{
|
if(!worldObj.isRemote && loaderTicket != null) {
|
||||||
if(!worldObj.isRemote && loaderTicket != null)
|
|
||||||
{
|
|
||||||
for(ChunkCoordIntPair chunk : loadedChunks)
|
|
||||||
{
|
|
||||||
ForgeChunkManager.unforceChunk(loaderTicket, chunk);
|
|
||||||
}
|
|
||||||
|
|
||||||
loadedChunks.clear();
|
clearChunkLoader();
|
||||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX, newChunkZ));
|
|
||||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1, newChunkZ + 1));
|
|
||||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1, newChunkZ - 1));
|
|
||||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1, newChunkZ - 1));
|
|
||||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1, newChunkZ + 1));
|
|
||||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1, newChunkZ));
|
|
||||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX, newChunkZ + 1));
|
|
||||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1, newChunkZ));
|
|
||||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX, newChunkZ - 1));
|
|
||||||
|
|
||||||
for(ChunkCoordIntPair chunk : loadedChunks)
|
loadedChunks.clear();
|
||||||
{
|
loadedChunks.add(new ChunkCoordIntPair(newChunkX, newChunkZ));
|
||||||
ForgeChunkManager.forceChunk(loaderTicket, chunk);
|
loadedChunks.add(new ChunkCoordIntPair(newChunkX + (int) Math.ceil((this.posX + this.motionX) / 16D), newChunkZ + (int) Math.ceil((this.posZ + this.motionZ) / 16D)));
|
||||||
}
|
|
||||||
}
|
for(ChunkCoordIntPair chunk : loadedChunks) {
|
||||||
}
|
ForgeChunkManager.forceChunk(loaderTicket, chunk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void killAndClear() {
|
||||||
|
this.setDead();
|
||||||
|
this.clearChunkLoader();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearChunkLoader() {
|
||||||
|
if(!worldObj.isRemote && loaderTicket != null) {
|
||||||
|
for(ChunkCoordIntPair chunk : loadedChunks) {
|
||||||
|
ForgeChunkManager.unforceChunk(loaderTicket, chunk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.hbm.explosion.nt;
|
package com.hbm.explosion.nt;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public interface IExplosionLogic {
|
public interface IExplosionLogic {
|
||||||
|
|
||||||
public void updateLogic();
|
public void updateLogic();
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import net.minecraft.init.Blocks;
|
|||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public class Mark5 implements IExplosionLogic {
|
public class Mark5 implements IExplosionLogic {
|
||||||
|
|
||||||
//holds rays after being calculated up to where the blocks get removed
|
//holds rays after being calculated up to where the blocks get removed
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user