mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
torex: the comeback
This commit is contained in:
parent
f7bdf1d632
commit
56cdc3ffe7
@ -22,7 +22,7 @@ public class EntityNukeTorex extends Entity {
|
||||
public double rollerSize = 1;
|
||||
public double heat = 1;
|
||||
public ArrayList<Cloudlet> cloudlets = new ArrayList();
|
||||
public static int cloudletLife = 200;
|
||||
//public static int cloudletLife = 200;
|
||||
|
||||
public EntityNukeTorex(World world) {
|
||||
super(world);
|
||||
@ -30,41 +30,42 @@ public class EntityNukeTorex extends Entity {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() { }
|
||||
protected void entityInit() {
|
||||
this.dataWatcher.addObject(10, new Float(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
this.ticksExisted++;
|
||||
//this.ticksExisted++;
|
||||
|
||||
double s = this.getScale();
|
||||
int maxAge = (int) (90 * 20 * s);
|
||||
int maxAge = this.getMaxAge();
|
||||
|
||||
if(worldObj.isRemote) {
|
||||
|
||||
double range = (torusWidth - rollerSize) * 0.25;
|
||||
|
||||
if(this.ticksExisted + cloudletLife * 2 < maxAge) {
|
||||
double simSpeed = getSimulationSpeed();
|
||||
int toSpawn = (int) Math.ceil(10 * simSpeed * simSpeed);
|
||||
int lifetime = Math.min((ticksExisted * ticksExisted) + 200, maxAge - ticksExisted + 200);
|
||||
|
||||
int toSpawn = (int) Math.ceil(10 * getSimulationSpeed());
|
||||
|
||||
for(int i = 0; i < toSpawn; i++) {
|
||||
double y = posY + rand.nextGaussian() - 3; //this.ticksExisted < 60 ? this.posY + this.coreHeight : posY + rand.nextGaussian() - 3;
|
||||
Cloudlet cloud = new Cloudlet(posX + rand.nextGaussian() * range, y, posZ + rand.nextGaussian() * range, (float)(rand.nextDouble() * 2D * Math.PI), 0);
|
||||
cloud.setScale(1F + this.ticksExisted * 0.001F * (float) s, 5F * (float) s);
|
||||
cloudlets.add(cloud);
|
||||
}
|
||||
for(int i = 0; i < toSpawn; i++) {
|
||||
double y = posY + rand.nextGaussian() - 3; //this.ticksExisted < 60 ? this.posY + this.coreHeight : posY + rand.nextGaussian() - 3;
|
||||
Cloudlet cloud = new Cloudlet(posX + rand.nextGaussian() * range, y, posZ + rand.nextGaussian() * range, (float)(rand.nextDouble() * 2D * Math.PI), 0, lifetime);
|
||||
cloud.setScale(1F + this.ticksExisted * 0.005F * (float) s, 5F * (float) s);
|
||||
cloudlets.add(cloud);
|
||||
}
|
||||
|
||||
if(ticksExisted < 200) {
|
||||
if(ticksExisted < 100) {
|
||||
|
||||
int cloudCount = ticksExisted * 3;
|
||||
int cloudCount = ticksExisted * 5;
|
||||
int shockLife = 200 - ticksExisted * 9 / 10;
|
||||
|
||||
for(int i = 0; i < cloudCount; i++) {
|
||||
Vec3 vec = Vec3.createVectorHelper((ticksExisted + rand.nextDouble()) * 2, 0, 0);
|
||||
Vec3 vec = Vec3.createVectorHelper((ticksExisted * 2 + rand.nextDouble()) * 2, 0, 0);
|
||||
float rot = (float) (Math.PI * 2 * rand.nextDouble());
|
||||
vec.rotateAroundY(rot);
|
||||
this.cloudlets.add(new Cloudlet(vec.xCoord + posX, worldObj.getHeightValue((int) (vec.xCoord + posX) + 1, (int) (vec.zCoord + posZ)), vec.zCoord + posZ, rot, 0)
|
||||
.setScale(5F * (float) s, 2F * (float) s)
|
||||
this.cloudlets.add(new Cloudlet(vec.xCoord + posX, worldObj.getHeightValue((int) (vec.xCoord + posX) + 1, (int) (vec.zCoord + posZ)), vec.zCoord + posZ, rot, 0, shockLife)
|
||||
.setScale(5F, 2F)
|
||||
.setMotion(0));
|
||||
}
|
||||
}
|
||||
@ -90,16 +91,24 @@ public class EntityNukeTorex extends Entity {
|
||||
|
||||
public double getSimulationSpeed() {
|
||||
|
||||
if(EntityNukeTorex.this.ticksExisted > 45 * 20) {
|
||||
int timeLeft = 1600 - EntityNukeTorex.this.ticksExisted;
|
||||
return MathHelper.clamp_double((double) timeLeft / 900D, 0, 1);
|
||||
int lifetime = getMaxAge();
|
||||
int simSlow = lifetime / 4;
|
||||
int simStop = lifetime / 2;
|
||||
int life = EntityNukeTorex.this.ticksExisted;
|
||||
|
||||
if(life > simStop) {
|
||||
return 0D;
|
||||
}
|
||||
|
||||
if(life > simSlow) {
|
||||
return 1D - ((double)(life - simSlow) / (double)(simStop - simSlow));
|
||||
}
|
||||
|
||||
return 1.0D;
|
||||
}
|
||||
|
||||
public double getScale() {
|
||||
return 1.0D;
|
||||
return this.dataWatcher.getWatchableObjectFloat(10);
|
||||
}
|
||||
|
||||
public double getSaturation() {
|
||||
@ -107,9 +116,35 @@ public class EntityNukeTorex extends Entity {
|
||||
return 1D - (d * d * d * d);
|
||||
}
|
||||
|
||||
public double getGreying() {
|
||||
|
||||
int lifetime = getMaxAge();
|
||||
int greying = lifetime * 3 / 4;
|
||||
|
||||
if(ticksExisted > greying) {
|
||||
return 1 + ((double)(ticksExisted - greying) / (double)(lifetime - greying));
|
||||
}
|
||||
|
||||
return 1D;
|
||||
}
|
||||
|
||||
public float getAlpha() {
|
||||
|
||||
int lifetime = getMaxAge();
|
||||
int fadeOut = lifetime * 3 / 4;
|
||||
int life = EntityNukeTorex.this.ticksExisted;
|
||||
|
||||
if(life > fadeOut) {
|
||||
float fac = (float)(life - fadeOut) / (float)(lifetime - fadeOut);
|
||||
return 1F - fac * fac;
|
||||
}
|
||||
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
public int getMaxAge() {
|
||||
double s = this.getScale();
|
||||
return (int) (90 * 20 * s);
|
||||
return (int) (45 * 20 * s);
|
||||
}
|
||||
|
||||
public class Cloudlet {
|
||||
@ -124,6 +159,7 @@ public class EntityNukeTorex extends Entity {
|
||||
public double motionY;
|
||||
public double motionZ;
|
||||
public int age;
|
||||
public int cloudletLife;
|
||||
public float angle;
|
||||
public boolean isDead = false;
|
||||
float rangeMod = 1.0F;
|
||||
@ -131,11 +167,12 @@ public class EntityNukeTorex extends Entity {
|
||||
public Vec3 color;
|
||||
public Vec3 prevColor;
|
||||
|
||||
public Cloudlet(double posX, double posY, double posZ, float angle, int age) {
|
||||
public Cloudlet(double posX, double posY, double posZ, float angle, int age, int maxAge) {
|
||||
this.posX = posX;
|
||||
this.posY = posY;
|
||||
this.posZ = posZ;
|
||||
this.age = age;
|
||||
this.cloudletLife = maxAge;
|
||||
this.angle = angle;
|
||||
this.rangeMod = 0.3F + rand.nextFloat() * 0.7F;
|
||||
this.colorMod = 0.8F + rand.nextFloat() * 0.2F;
|
||||
@ -265,14 +302,15 @@ public class EntityNukeTorex extends Entity {
|
||||
}
|
||||
|
||||
public Vec3 getInterpColor(float interp) {
|
||||
double greying = EntityNukeTorex.this.getGreying();
|
||||
return Vec3.createVectorHelper(
|
||||
prevColor.xCoord + (color.xCoord - prevColor.xCoord) * interp,
|
||||
prevColor.yCoord + (color.yCoord - prevColor.yCoord) * interp,
|
||||
prevColor.zCoord + (color.zCoord - prevColor.zCoord) * interp);
|
||||
(prevColor.xCoord + (color.xCoord - prevColor.xCoord) * interp) * greying,
|
||||
(prevColor.yCoord + (color.yCoord - prevColor.yCoord) * interp) * greying,
|
||||
(prevColor.zCoord + (color.zCoord - prevColor.zCoord) * interp) * greying);
|
||||
}
|
||||
|
||||
public float getAlpha() {
|
||||
return 1F - ((float)age / (float)cloudletLife);
|
||||
return (1F - ((float)age / (float)cloudletLife)) * EntityNukeTorex.this.getAlpha();
|
||||
}
|
||||
|
||||
private float startingScale = 1;
|
||||
|
||||
@ -38,11 +38,11 @@ public class ItemWandD extends Item {
|
||||
|
||||
if(pos != null) {
|
||||
|
||||
TomSaveData data = TomSaveData.forWorld(world);
|
||||
/*TomSaveData data = TomSaveData.forWorld(world);
|
||||
data.impact = false;
|
||||
data.fire = 0F;
|
||||
data.dust = 0F;
|
||||
data.markDirty();
|
||||
data.markDirty();*/
|
||||
|
||||
/*EntityTomBlast tom = new EntityTomBlast(world);
|
||||
tom.posX = pos.blockX;
|
||||
@ -68,9 +68,10 @@ public class ItemWandD extends Item {
|
||||
|
||||
/*OilSpot.generateOilSpot(world, pos.blockX, pos.blockZ, 20, 500);*/
|
||||
|
||||
/*EntityNukeTorex torex = new EntityNukeTorex(world);
|
||||
EntityNukeTorex torex = new EntityNukeTorex(world);
|
||||
torex.setPositionAndRotation(pos.blockX, pos.blockY + 1, pos.blockZ, 0, 0);
|
||||
world.spawnEntityInWorld(torex);*/
|
||||
//torex.getDataWatcher().updateObject(10, 2F);
|
||||
world.spawnEntityInWorld(torex);
|
||||
|
||||
/*EntitySiegeTunneler tunneler = new EntitySiegeTunneler(world);
|
||||
tunneler.setPosition(pos.blockX, pos.blockY + 1, pos.blockZ);
|
||||
|
||||
@ -896,7 +896,7 @@ public class CraftingManager {
|
||||
addRecipeAuto(new ItemStack(Items.lead, 4), new Object[] { "RSR", 'R', DictFrame.fromOne(ModItems.plant_item, EnumPlantType.ROPE), 'S', KEY_SLIME });
|
||||
addRecipeAuto(new ItemStack(ModItems.rag, 4), new Object[] { "SW", "WS", 'S', Items.string, 'W', Blocks.wool });
|
||||
|
||||
addShapelessAuto(new ItemStack(ModItems.solid_fuel, 10), new Object[] { Fluids.HEATINGOIL.getDict(1000), KEY_TOOL_CHEMISTRYSET });
|
||||
addShapelessAuto(new ItemStack(ModItems.solid_fuel, 2), new Object[] { Fluids.HEATINGOIL.getDict(1000), KEY_TOOL_CHEMISTRYSET });
|
||||
addShapelessAuto(new ItemStack(ModItems.canister_full, 2, Fluids.LUBRICANT.getID()), new Object[] { Fluids.HEATINGOIL.getDict(1000), Fluids.UNSATURATEDS.getDict(1000), ModItems.canister_empty, ModItems.canister_empty, KEY_TOOL_CHEMISTRYSET });
|
||||
|
||||
addRecipeAuto(new ItemStack(ModBlocks.machine_condenser), new Object[] { "SIS", "ICI", "SIS", 'S', STEEL.ingot(), 'I', IRON.plate(), 'C', ModItems.board_copper });
|
||||
|
||||
@ -13,6 +13,7 @@ import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.generic.BlockAshes;
|
||||
import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.entity.effect.EntityNukeTorex;
|
||||
import com.hbm.entity.mob.EntityHunterChopper;
|
||||
import com.hbm.entity.projectile.EntityChopperMine;
|
||||
import com.hbm.extprop.HbmLivingProps;
|
||||
@ -167,6 +168,18 @@ public class ModEventHandlerClient {
|
||||
}
|
||||
}
|
||||
|
||||
List<EntityNukeTorex> torex = world.getEntitiesWithinAABB(EntityNukeTorex.class, player.boundingBox.expand(100, 100, 100));
|
||||
|
||||
if(!torex.isEmpty()) {
|
||||
EntityNukeTorex t = torex.get(0);
|
||||
List<String> text = new ArrayList();
|
||||
text.add("Speed: " + t.getSimulationSpeed());
|
||||
text.add("Alpha: " + t.getAlpha());
|
||||
text.add("Age: " + t.ticksExisted + " / " + t.getMaxAge());
|
||||
text.add("Clouds: " + t.cloudlets.size());
|
||||
ILookOverlay.printGeneric(event, "DEBUG", 0xff0000, 0x4040000, text);
|
||||
}
|
||||
|
||||
/*List<String> text = new ArrayList();
|
||||
text.add("IMPACT: " + ImpactWorldHandler.getImpactForClient(world));
|
||||
text.add("DUST: " + ImpactWorldHandler.getDustForClient(world));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user