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 rain = 0;
|
||||
public static int cont = 0;
|
||||
public static boolean chunkloading = true;
|
||||
|
||||
public static void loadFromConfig(Configuration config) {
|
||||
|
||||
@ -100,5 +101,7 @@ public class BombConfig {
|
||||
Property rainCont = config.get(CATEGORY_NUKE, "6.06_falloutRainRadiation", 0);
|
||||
rainCont.comment = "Radiation in 100th RADs created by fallout rain";
|
||||
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.main.MainRegistry;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityBalefire extends Entity {
|
||||
public class EntityBalefire extends EntityExplosionChunkloading {
|
||||
|
||||
public int age = 0;
|
||||
public int destructionRange = 0;
|
||||
@ -53,48 +52,46 @@ public class EntityBalefire extends Entity {
|
||||
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
|
||||
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() {
|
||||
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 cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@Spaghetti("why???")
|
||||
public class EntityNukeExplosionMK3 extends Entity {
|
||||
public class EntityNukeExplosionMK3 extends EntityExplosionChunkloading {
|
||||
|
||||
public int age = 0;
|
||||
public int destructionRange = 0;
|
||||
@ -59,31 +58,32 @@ public class EntityNukeExplosionMK3 extends Entity {
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
if(this.waste)
|
||||
{
|
||||
exp = new ExplosionNukeAdvanced((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, this.destructionRange, this.coefficient, 0);
|
||||
if(this.waste) {
|
||||
exp = new ExplosionNukeAdvanced((int) this.posX, (int) this.posY, (int) this.posZ, this.worldObj, this.destructionRange, this.coefficient, 0);
|
||||
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_");
|
||||
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_");
|
||||
} else {
|
||||
} else {
|
||||
|
||||
if(extType == 0) {
|
||||
expl = new ExplosionFleija((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, this.destructionRange, this.coefficient, this.coefficient2);
|
||||
if(extType == 0) {
|
||||
expl = new ExplosionFleija((int) this.posX, (int) this.posY, (int) this.posZ, this.worldObj, this.destructionRange, this.coefficient, this.coefficient2);
|
||||
expl.readFromNbt(nbt, "expl_");
|
||||
}
|
||||
if(extType == 1) {
|
||||
sol = new ExplosionSolinium((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, this.destructionRange, this.coefficient, this.coefficient2);
|
||||
sol.readFromNbt(nbt, "sol_");
|
||||
}
|
||||
}
|
||||
|
||||
this.did = true;
|
||||
|
||||
}
|
||||
if(extType == 1) {
|
||||
sol = new ExplosionSolinium((int) this.posX, (int) this.posY, (int) this.posZ, this.worldObj, this.destructionRange, this.coefficient, this.coefficient2);
|
||||
sol.readFromNbt(nbt, "sol_");
|
||||
}
|
||||
}
|
||||
|
||||
this.did = true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -120,6 +120,8 @@ public class EntityNukeExplosionMK3 extends Entity {
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(!worldObj.isRemote) loadChunk((int) Math.floor(posX / 16D), (int) Math.floor(posZ / 16D));
|
||||
|
||||
if(!this.did)
|
||||
{
|
||||
@ -149,25 +151,31 @@ public class EntityNukeExplosionMK3 extends Entity {
|
||||
boolean flag = false;
|
||||
boolean flag3 = false;
|
||||
|
||||
for(int i = 0; i < this.speed; i++)
|
||||
{
|
||||
if(waste) {
|
||||
flag = exp.update();
|
||||
wst.update();
|
||||
flag3 = vap.update();
|
||||
|
||||
if(flag3) {
|
||||
this.setDead();
|
||||
}
|
||||
} else {
|
||||
if(extType == 0)
|
||||
if(expl.update())
|
||||
this.setDead();
|
||||
if(extType == 1)
|
||||
if(sol.update())
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
for(int i = 0; i < this.speed; i++) {
|
||||
if(waste) {
|
||||
flag = exp.update();
|
||||
wst.update();
|
||||
flag3 = vap.update();
|
||||
|
||||
if(flag3) {
|
||||
this.clearChunkLoader();
|
||||
this.setDead();
|
||||
}
|
||||
} else {
|
||||
if(extType == 0) {
|
||||
if(expl.update()) {
|
||||
this.clearChunkLoader();
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
if(extType == 1) {
|
||||
if(sol.update()) {
|
||||
this.clearChunkLoader();
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!flag)
|
||||
{
|
||||
@ -196,9 +204,6 @@ public class EntityNukeExplosionMK3 extends Entity {
|
||||
|
||||
age++;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() { }
|
||||
|
||||
public static HashMap<ATEntry, Long> at = new HashMap();
|
||||
|
||||
|
||||
@ -14,7 +14,6 @@ import com.hbm.util.ContaminationUtil;
|
||||
import com.hbm.util.ContaminationUtil.ContaminationType;
|
||||
import com.hbm.util.ContaminationUtil.HazardType;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@ -22,7 +21,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityNukeExplosionMK5 extends Entity {
|
||||
public class EntityNukeExplosionMK5 extends EntityExplosionChunkloading {
|
||||
|
||||
//Strength of the blast
|
||||
public int strength;
|
||||
@ -52,9 +51,12 @@ public class EntityNukeExplosionMK5 extends Entity {
|
||||
public void onUpdate() {
|
||||
|
||||
if(strength == 0) {
|
||||
this.clearChunkLoader();
|
||||
this.setDead();
|
||||
return;
|
||||
}
|
||||
|
||||
if(!worldObj.isRemote) loadChunk((int) Math.floor(posX / 16D), (int) Math.floor(posZ / 16D));
|
||||
|
||||
for(Object player : this.worldObj.playerEntities) {
|
||||
((EntityPlayer)player).triggerAchievement(MainRegistry.achManhattan);
|
||||
@ -92,9 +94,11 @@ public class EntityNukeExplosionMK5 extends Entity {
|
||||
fallout.setScale((int)(this.length * 2.5 + falloutAdd) * BombConfig.falloutRange / 100);
|
||||
|
||||
this.worldObj.spawnEntityInWorld(fallout);
|
||||
|
||||
|
||||
this.clearChunkLoader();
|
||||
this.setDead();
|
||||
} else {
|
||||
this.clearChunkLoader();
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,11 +8,10 @@ import com.hbm.explosion.ExplosionTom;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.saveddata.TomSaveData;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityTomBlast extends Entity {
|
||||
public class EntityTomBlast extends EntityExplosionChunkloading {
|
||||
|
||||
public int age = 0;
|
||||
public int destructionRange = 0;
|
||||
@ -54,6 +53,8 @@ public class EntityTomBlast extends Entity {
|
||||
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)
|
||||
@ -89,8 +90,4 @@ public class EntityTomBlast extends Entity {
|
||||
|
||||
age++;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,46 +48,36 @@ public abstract class EntityMissileBaseAdvanced extends Entity implements IChunk
|
||||
targetZ = (int) posZ;
|
||||
}
|
||||
|
||||
public boolean canBeCollidedWith()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_)
|
||||
{
|
||||
if (this.isEntityInvulnerable())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!this.isDead && !this.worldObj.isRemote)
|
||||
{
|
||||
health -= p_70097_2_;
|
||||
|
||||
if (this.health <= 0)
|
||||
{
|
||||
this.setDead();
|
||||
this.killMissile();
|
||||
}
|
||||
}
|
||||
public boolean canBeCollidedWith() {
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void killMissile() {
|
||||
ExplosionLarge.explode(worldObj, posX, posY, posZ, 5, true, false, true);
|
||||
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());
|
||||
}
|
||||
public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) {
|
||||
if(this.isEntityInvulnerable()) {
|
||||
return false;
|
||||
} else {
|
||||
if(!this.isDead && !this.worldObj.isRemote) {
|
||||
health -= p_70097_2_;
|
||||
|
||||
if(this.health <= 0) {
|
||||
this.setDead();
|
||||
this.killMissile();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void killMissile() {
|
||||
ExplosionLarge.explode(worldObj, posX, posY, posZ, 5, true, false, true);
|
||||
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());
|
||||
}
|
||||
|
||||
public EntityMissileBaseAdvanced(World world, float x, float y, float z, int a, int b) {
|
||||
super(world);
|
||||
this.ignoreFrustumCheck = true;
|
||||
/*this.posX = x;
|
||||
this.posY = y;
|
||||
this.posZ = z;*/
|
||||
this.setLocationAndAngles(x, y, z, 0, 0);
|
||||
startX = (int) x;
|
||||
startZ = (int) z;
|
||||
@ -95,19 +85,19 @@ public abstract class EntityMissileBaseAdvanced extends Entity implements IChunk
|
||||
targetZ = b;
|
||||
this.motionY = 2;
|
||||
|
||||
Vec3 vector = Vec3.createVectorHelper(targetX - startX, 0, targetZ - startZ);
|
||||
accelXZ = decelY = 1/vector.lengthVector();
|
||||
Vec3 vector = Vec3.createVectorHelper(targetX - startX, 0, targetZ - startZ);
|
||||
accelXZ = decelY = 1 / vector.lengthVector();
|
||||
decelY *= 2;
|
||||
|
||||
|
||||
velocity = 1;
|
||||
|
||||
this.setSize(1.5F, 1.5F);
|
||||
this.setSize(1.5F, 1.5F);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
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
|
||||
@ -212,7 +202,6 @@ public abstract class EntityMissileBaseAdvanced extends Entity implements IChunk
|
||||
}
|
||||
|
||||
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),
|
||||
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.flowing_water) {
|
||||
|
||||
if(!this.worldObj.isRemote)
|
||||
{
|
||||
onImpact();
|
||||
}
|
||||
this.setDead();
|
||||
return;
|
||||
}
|
||||
|
||||
loadNeighboringChunks((int)(posX / 16), (int)(posZ / 16));
|
||||
|
||||
if(motionY < -1 && this.isCluster && !worldObj.isRemote) {
|
||||
cluster();
|
||||
this.setDead();
|
||||
return;
|
||||
}
|
||||
if(!this.worldObj.isRemote) {
|
||||
onImpact();
|
||||
}
|
||||
this.killAndClear();
|
||||
return;
|
||||
}
|
||||
|
||||
loadNeighboringChunks((int) (posX / 16), (int) (posZ / 16));
|
||||
|
||||
if(motionY < -1 && this.isCluster && !worldObj.isRemote) {
|
||||
cluster();
|
||||
this.setDead();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isInRangeToRenderDist(double distance)
|
||||
{
|
||||
return distance < 500000;
|
||||
}
|
||||
public boolean isInRangeToRenderDist(double distance) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract void onImpact();
|
||||
|
||||
@ -272,30 +259,31 @@ public abstract class EntityMissileBaseAdvanced extends Entity implements IChunk
|
||||
|
||||
List<ChunkCoordIntPair> loadedChunks = new ArrayList<ChunkCoordIntPair>();
|
||||
|
||||
public void loadNeighboringChunks(int newChunkX, int newChunkZ)
|
||||
{
|
||||
if(!worldObj.isRemote && loaderTicket != null)
|
||||
{
|
||||
for(ChunkCoordIntPair chunk : loadedChunks)
|
||||
{
|
||||
ForgeChunkManager.unforceChunk(loaderTicket, chunk);
|
||||
}
|
||||
public void loadNeighboringChunks(int newChunkX, int newChunkZ) {
|
||||
if(!worldObj.isRemote && loaderTicket != null) {
|
||||
|
||||
clearChunkLoader();
|
||||
|
||||
loadedChunks.clear();
|
||||
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));
|
||||
loadedChunks.clear();
|
||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX, newChunkZ));
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
@Deprecated
|
||||
public interface IExplosionLogic {
|
||||
|
||||
public void updateLogic();
|
||||
|
||||
@ -10,6 +10,7 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@Deprecated
|
||||
public class Mark5 implements IExplosionLogic {
|
||||
|
||||
//holds rays after being calculated up to where the blocks get removed
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user