falling custom nuke, new rad system, fixed analzyer

This commit is contained in:
HbmMods 2018-11-17 18:13:08 +01:00
parent fa60933ae7
commit 6e6685fa98
27 changed files with 900 additions and 195 deletions

View File

@ -220,6 +220,7 @@ item.custom_hydro.name=AB - Wasserstoffelement
item.custom_amat.name=AB - Antimaterie-Element
item.custom_dirty.name=AB - Schmutziges Element
item.custom_schrab.name=AB - Schrabidiumelement
item.custom_fall.name=AB - Abwurf-Upgrade
container.nukeGadget=The Gadget
container.nukeBoy=Little Boy

View File

@ -220,6 +220,7 @@ item.custom_hydro.name=Custom Nuke Hydrogen Rod
item.custom_amat.name=Custom Nuke Antimatter Rod
item.custom_dirty.name=Custom Nuke Dirty Rod
item.custom_schrab.name=Custom Nuke Schrabidium Rod
item.custom_fall.name=Custom Nuke Drop Upgrade
container.nukeGadget=The Gadget
container.nukeBoy=Little Boy

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -9,6 +9,10 @@ import com.hbm.entity.effect.EntityNukeCloudNoShroom;
import com.hbm.entity.effect.EntityNukeCloudSmall;
import com.hbm.entity.grenade.EntityGrenadeZOMG;
import com.hbm.entity.logic.EntityNukeExplosionPlus;
import com.hbm.entity.missile.EntityMIRV;
import com.hbm.entity.particle.EntityDSmokeFX;
import com.hbm.entity.particle.EntitySmokeFX;
import com.hbm.entity.projectile.EntityFallingNuke;
import com.hbm.explosion.ExplosionChaos;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.explosion.ExplosionParticle;
@ -124,218 +128,234 @@ public class NukeCustom extends BlockContainer implements IBomb {
if (p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z) && !p_149695_1_.isRemote) {
if (entity.isReady()) {
float[] f = entity.returnAllValues();
boolean fall = entity.falls;
int meta = p_149695_1_.getBlockMetadata(x, y, z);
this.onBlockDestroyedByPlayer(p_149695_1_, x, y, z, 1);
entity.clearSlots();
p_149695_1_.setBlockToAir(x, y, z);
igniteTestBomb(p_149695_1_, x, y, z, f);
igniteTestBomb(p_149695_1_, x, y, z, f, fall, meta);
}
}
}
public boolean igniteTestBomb(World world, int x, int y, int z, float[] f) {
public boolean igniteTestBomb(World world, int x, int y, int z, float[] f, boolean fall, int meta) {
if (!world.isRemote) {
world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F); // x,y,z,sound,volume,pitch
float tnt = f[0];
float nuke = f[1];
float hydro = f[2];;
float hydro = f[2];
float amat = f[3];
float dirty = f[4];
float schrab = f[5];
float euph = f[6];
if(euph > 0) {
EntityGrenadeZOMG zomg = new EntityGrenadeZOMG(world);
zomg.posX = x + 0.5;
zomg.posY = y + 0.5;
zomg.posZ = z + 0.5;
ExplosionChaos.zomgMeSinPi(world, x, y, z, 1000, null, zomg);
} else if(schrab > 0) {
nuke += (tnt/2);
hydro += (nuke/2);
amat += (hydro/2);
schrab += (amat/2);
if(!fall) {
if(schrab > 300)
schrab = 300;
explodeCustom(world, x + 0.5, y + 0.5, z + 0.5, tnt, nuke, hydro, amat, dirty, schrab, euph);
world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F);
EntityNukeExplosionPlus entity = new EntityNukeExplosionPlus(world);
entity.posX = x + 0.5;
entity.posY = y + 0.5;
entity.posZ = z + 0.5;
entity.destructionRange = (int)schrab;
entity.speed = MainRegistry.blastSpeed;
entity.coefficient = 1.0F;
entity.waste = false;
world.spawnEntityInWorld(entity);
EntityCloudFleija cloud = new EntityCloudFleija(world, (int)schrab);
cloud.posX = x + 0.5;
cloud.posY = y + 0.5;
cloud.posZ = z + 0.5;
world.spawnEntityInWorld(cloud);
} else {
EntityFallingNuke bomb = new EntityFallingNuke(world, tnt, nuke, hydro, amat, dirty, schrab, euph);
bomb.getDataWatcher().updateObject(20, (byte)meta);
bomb.setPositionAndRotation(x + 0.5, y, z + 0.5, 0, 0);
} else if (amat > 0) {
nuke += (tnt/2);
hydro += (nuke/2);
amat += (hydro/2);
if(amat > 350)
amat = 350;
EntityNukeExplosionPlus entity = new EntityNukeExplosionPlus(world);
entity.posX = x + 0.5;
entity.posY = y + 0.5;
entity.posZ = z + 0.5;
entity.destructionRange = (int)amat;
entity.speed = 25;
entity.coefficient = 10.0F;
entity.wasteRange = (int) (amat * 1.4) + (int) dirty;
world.spawnEntityInWorld(entity);
if(amat < 75) {
ExplosionParticleB.spawnMush(world, x, y - ((int)amat / 10), z);
} else if(amat < 200) {
if(MainRegistry.enableNukeClouds) {
EntityNukeCloudSmall entity2 = new EntityNukeCloudSmall(world, 1000, amat * 0.005F);
entity2.posX = x;
entity2.posY = y - (amat/10);
entity2.posZ = z;
world.spawnEntityInWorld(entity2);
} else {
EntityNukeCloudSmall entity2 = new EntityNukeCloudNoShroom(world, 1000);
entity2.posX = x;
entity2.posY = y - (amat/10);
entity2.posZ = z;
world.spawnEntityInWorld(entity2);
}
} else {
if(MainRegistry.enableNukeClouds) {
EntityNukeCloudBig entity2 = new EntityNukeCloudBig(world, 1000);
entity2.posX = x;
entity2.posY = y - (amat/10);
entity2.posZ = z;
world.spawnEntityInWorld(entity2);
} else {
EntityNukeCloudSmall entity2 = new EntityNukeCloudNoShroom(world, 1000);
entity2.posX = x;
entity2.posY = y - (amat/10);
entity2.posZ = z;
world.spawnEntityInWorld(entity2);
}
}
} else if(hydro > 0) {
nuke += (tnt/2);
hydro += (nuke/2);
if(hydro > 350)
hydro = 350;
EntityNukeExplosionPlus entity = new EntityNukeExplosionPlus(world);
entity.posX = x + 0.5;
entity.posY = y + 0.5;
entity.posZ = z + 0.5;
entity.destructionRange = (int)hydro;
entity.speed = 25;
entity.coefficient = 10.0F;
entity.wasteRange = (int) (hydro * 1.4) + (int) dirty;
world.spawnEntityInWorld(entity);
if(hydro < 75) {
ExplosionParticle.spawnMush(world, x, y - ((int)hydro / 10), z);
} else if(hydro < 200) {
if(MainRegistry.enableNukeClouds) {
EntityNukeCloudSmall entity2 = new EntityNukeCloudSmall(world, 1000, hydro * 0.005F);
entity2.posX = x;
entity2.posY = y - (hydro/10);
entity2.posZ = z;
world.spawnEntityInWorld(entity2);
} else {
EntityNukeCloudSmall entity2 = new EntityNukeCloudNoShroom(world, 1000);
entity2.posX = x;
entity2.posY = y - (hydro/10);
entity2.posZ = z;
world.spawnEntityInWorld(entity2);
}
} else {
if(MainRegistry.enableNukeClouds) {
EntityNukeCloudBig entity2 = new EntityNukeCloudBig(world, 1000);
entity2.posX = x;
entity2.posY = y - (hydro/10);
entity2.posZ = z;
world.spawnEntityInWorld(entity2);
} else {
EntityNukeCloudSmall entity2 = new EntityNukeCloudNoShroom(world, 1000);
entity2.posX = x;
entity2.posY = y - (hydro/10);
entity2.posZ = z;
world.spawnEntityInWorld(entity2);
}
}
} else if(nuke > 0) {
nuke += (tnt/2);
if(nuke > 350)
nuke = 350;
EntityNukeExplosionPlus entity = new EntityNukeExplosionPlus(world);
entity.posX = x + 0.5;
entity.posY = y + 0.5;
entity.posZ = z + 0.5;
entity.destructionRange = (int)nuke;
entity.speed = 25;
entity.coefficient = 10.0F;
entity.wasteRange = (int) (nuke * 1.4) + (int) dirty;
world.spawnEntityInWorld(entity);
if(nuke < 75) {
ExplosionParticle.spawnMush(world, x, y - ((int)nuke / 10), z);
} else if(nuke < 200) {
if(MainRegistry.enableNukeClouds) {
EntityNukeCloudSmall entity2 = new EntityNukeCloudSmall(world, 1000, nuke * 0.005F);
entity2.posX = x;
entity2.posY = y - (nuke/10);
entity2.posZ = z;
world.spawnEntityInWorld(entity2);
} else {
EntityNukeCloudSmall entity2 = new EntityNukeCloudNoShroom(world, 1000);
entity2.posX = x;
entity2.posY = y - (nuke/10);
entity2.posZ = z;
world.spawnEntityInWorld(entity2);
}
} else {
if(MainRegistry.enableNukeClouds) {
EntityNukeCloudBig entity2 = new EntityNukeCloudBig(world, 1000);
entity2.posX = x;
entity2.posY = y - (nuke/10);
entity2.posZ = z;
world.spawnEntityInWorld(entity2);
} else {
EntityNukeCloudSmall entity2 = new EntityNukeCloudNoShroom(world, 1000);
entity2.posX = x;
entity2.posY = y - (nuke/10);
entity2.posZ = z;
world.spawnEntityInWorld(entity2);
}
}
} else if(tnt > 0) {
if(tnt > 100)
tnt = 100;
//world.newExplosion((Entity)null, x + 0.5F, y + 0.5F, z + 0.5F, tnt, field_149933_a.nextInt(5) == 0 ? true : false, true);
ExplosionLarge.explode(world, x, y, z, tnt, true, true, true);
world.spawnEntityInWorld(bomb);
}
}
return false;
}
public static void explodeCustom(World world, double posX, double posY, double posZ, float tnt, float nuke, float hydro, float amat, float dirty, float schrab, float euph) {
if(euph > 0) {
EntityGrenadeZOMG zomg = new EntityGrenadeZOMG(world);
zomg.posX = posX;
zomg.posY = posY;
zomg.posZ = posZ;
ExplosionChaos.zomgMeSinPi(world, posX, posY, posZ, 1000, null, zomg);
} else if(schrab > 0) {
nuke += (tnt/2);
hydro += (nuke/2);
amat += (hydro/2);
schrab += (amat/2);
if(schrab > 300)
schrab = 300;
EntityNukeExplosionPlus entity = new EntityNukeExplosionPlus(world);
entity.posX = posX;
entity.posY = posY;
entity.posZ = posZ;
entity.destructionRange = (int)schrab;
entity.speed = MainRegistry.blastSpeed;
entity.coefficient = 1.0F;
entity.waste = false;
world.spawnEntityInWorld(entity);
EntityCloudFleija cloud = new EntityCloudFleija(world, (int)schrab);
cloud.posX = posX;
cloud.posY = posY;
cloud.posZ = posZ;
world.spawnEntityInWorld(cloud);
} else if (amat > 0) {
nuke += (tnt/2);
hydro += (nuke/2);
amat += (hydro/2);
if(amat > 350)
amat = 350;
EntityNukeExplosionPlus entity = new EntityNukeExplosionPlus(world);
entity.posX = posX;
entity.posY = posY;
entity.posZ = posZ;
entity.destructionRange = (int)amat;
entity.speed = 25;
entity.coefficient = 10.0F;
entity.wasteRange = (int) (amat * 1.4) + (int) dirty;
world.spawnEntityInWorld(entity);
if(amat < 75) {
ExplosionParticleB.spawnMush(world, posX, posY, posZ);
} else if(amat < 200) {
if(MainRegistry.enableNukeClouds) {
EntityNukeCloudSmall entity2 = new EntityNukeCloudSmall(world, 1000, amat * 0.005F);
entity2.posX = posX;
entity2.posY = posY;
entity2.posZ = posZ;
world.spawnEntityInWorld(entity2);
} else {
EntityNukeCloudSmall entity2 = new EntityNukeCloudNoShroom(world, 1000);
entity2.posX = posX;
entity2.posY = posY;
entity2.posZ = posZ;
world.spawnEntityInWorld(entity2);
}
} else {
if(MainRegistry.enableNukeClouds) {
EntityNukeCloudBig entity2 = new EntityNukeCloudBig(world, 1000);
entity2.posX = posX;
entity2.posY = posY;
entity2.posZ = posZ;
world.spawnEntityInWorld(entity2);
} else {
EntityNukeCloudSmall entity2 = new EntityNukeCloudNoShroom(world, 1000);
entity2.posX = posX;
entity2.posY = posY;
entity2.posZ = posZ;
world.spawnEntityInWorld(entity2);
}
}
} else if(hydro > 0) {
nuke += (tnt/2);
hydro += (nuke/2);
if(hydro > 350)
hydro = 350;
EntityNukeExplosionPlus entity = new EntityNukeExplosionPlus(world);
entity.posX = posX;
entity.posY = posY;
entity.posZ = posZ;
entity.destructionRange = (int)hydro;
entity.speed = 25;
entity.coefficient = 10.0F;
entity.wasteRange = (int) (hydro * 1.4) + (int) dirty;
world.spawnEntityInWorld(entity);
if(hydro < 75) {
ExplosionParticle.spawnMush(world, posX, posY, posZ);
} else if(hydro < 200) {
if(MainRegistry.enableNukeClouds) {
EntityNukeCloudSmall entity2 = new EntityNukeCloudSmall(world, 1000, hydro * 0.005F);
entity2.posX = posX;
entity2.posY = posY;
entity2.posZ = posZ;
world.spawnEntityInWorld(entity2);
} else {
EntityNukeCloudSmall entity2 = new EntityNukeCloudNoShroom(world, 1000);
entity2.posX = posX;
entity2.posY = posY;
entity2.posZ = posZ;
world.spawnEntityInWorld(entity2);
}
} else {
if(MainRegistry.enableNukeClouds) {
EntityNukeCloudBig entity2 = new EntityNukeCloudBig(world, 1000);
entity2.posX = posX;
entity2.posY = posY;
entity2.posZ = posZ;
world.spawnEntityInWorld(entity2);
} else {
EntityNukeCloudSmall entity2 = new EntityNukeCloudNoShroom(world, 1000);
entity2.posX = posX;
entity2.posY = posY;
entity2.posZ = posZ;
world.spawnEntityInWorld(entity2);
}
}
} else if(nuke > 0) {
nuke += (tnt/2);
if(nuke > 350)
nuke = 350;
EntityNukeExplosionPlus entity = new EntityNukeExplosionPlus(world);
entity.posX = posX;
entity.posY = posY;
entity.posZ = posZ;
entity.destructionRange = (int)nuke;
entity.speed = 25;
entity.coefficient = 10.0F;
entity.wasteRange = (int) (nuke * 1.4) + (int) dirty;
world.spawnEntityInWorld(entity);
if(nuke < 75) {
ExplosionParticle.spawnMush(world, posX, posY, posZ);
} else if(nuke < 200) {
if(MainRegistry.enableNukeClouds) {
EntityNukeCloudSmall entity2 = new EntityNukeCloudSmall(world, 1000, nuke * 0.005F);
entity2.posX = posX;
entity2.posY = posY;
entity2.posZ = posZ;
world.spawnEntityInWorld(entity2);
} else {
EntityNukeCloudSmall entity2 = new EntityNukeCloudNoShroom(world, 1000);
entity2.posX = posX;
entity2.posY = posY;
entity2.posZ = posZ;
world.spawnEntityInWorld(entity2);
}
} else {
if(MainRegistry.enableNukeClouds) {
EntityNukeCloudBig entity2 = new EntityNukeCloudBig(world, 1000);
entity2.posX = posX;
entity2.posY = posY;
entity2.posZ = posZ;
world.spawnEntityInWorld(entity2);
} else {
EntityNukeCloudSmall entity2 = new EntityNukeCloudNoShroom(world, 1000);
entity2.posX = posX;
entity2.posY = posY;
entity2.posZ = posZ;
world.spawnEntityInWorld(entity2);
}
}
} else if(tnt > 0) {
if(tnt > 100)
tnt = 100;
ExplosionLarge.explode(world, posX, posY, posZ, tnt, true, true, true);
}
}
@Override
public int getRenderType() {
@ -376,10 +396,12 @@ public class NukeCustom extends BlockContainer implements IBomb {
{
if (entity.isReady()) {
float[] f = entity.returnAllValues();
boolean fall = entity.falls;
int meta = world.getBlockMetadata(x, y, z);
this.onBlockDestroyedByPlayer(world, x, y, z, 1);
entity.clearSlots();
world.setBlockToAir(x, y, z);
igniteTestBomb(world, x, y, z, f);
igniteTestBomb(world, x, y, z, f, fall, meta);
}
}
}

View File

@ -20,6 +20,8 @@ import com.hbm.lib.HbmChestContents;
import com.hbm.main.MainRegistry;
import com.hbm.main.ModEventHandler;
import com.hbm.potion.HbmPotion;
import com.hbm.saveddata.RadiationSaveStructure;
import com.hbm.saveddata.RadiationSavedData;
import com.hbm.saveddata.SatelliteSaveStructure;
import com.hbm.saveddata.SatelliteSavedData;
import com.hbm.tileentity.machine.TileEntityCrateSteel;
@ -190,7 +192,57 @@ public class TestEventTester extends Block {
if(!worldObj.isRemote)
worldObj.spawnEntityInWorld(rainbow);*/
RadiationSavedData data = RadiationSavedData.getData(worldObj);
//ALU SETS RAD TO 1000
//BER PRINTS RAD LEVEL
//COP INITIATES CYCLE
//RED FLUSHES ALL RAD
//STE PRINTS RAD CHUNKS
//URA PRINTS TOTAL RAD
if(worldObj.getBlock(x1, y1 - 1, z1) == ModBlocks.block_aluminium) {
Chunk chunk = worldObj.getChunkFromBlockCoords(x1, z1);
data.setRadForCoord(chunk.xPosition, chunk.zPosition, 1000000);
System.out.println(data.getRadNumFromCoord(chunk.xPosition, chunk.zPosition));
}
if(worldObj.getBlock(x1, y1 - 1, z1) == ModBlocks.block_beryllium) {
Chunk chunk = worldObj.getChunkFromBlockCoords(x1, z1);
System.out.println(data.getRadNumFromCoord(chunk.xPosition, chunk.zPosition));
}
if(worldObj.getBlock(x1, y1 - 1, z1) == ModBlocks.block_copper) {
data.updateSystem();
}
if(worldObj.getBlock(x1, y1 - 1, z1) == ModBlocks.block_red_copper) {
Chunk chunk = worldObj.getChunkFromBlockCoords(x1, z1);
data.jettisonData();
}
if(worldObj.getBlock(x1, y1 - 1, z1) == ModBlocks.block_steel) {
System.out.println(data.count);
}
if(worldObj.getBlock(x1, y1 - 1, z1) == ModBlocks.block_uranium) {
float r = 0;
for(RadiationSaveStructure st : data.contamination) {
r += st.radiation;
}
System.out.println(r);
}
}
}

View File

@ -41,7 +41,6 @@ public class EntityMissileNuclear extends EntityMissileBaseAdvanced {
entity2.posX = this.posX;
entity2.posY = this.posY/* - 9*/;
entity2.posZ = this.posZ;
entity2.getDataWatcher().updateObject(18, 2F);
this.worldObj.spawnEntityInWorld(entity2);
}

View File

@ -0,0 +1,103 @@
package com.hbm.entity.projectile;
import com.hbm.blocks.bomb.NukeCustom;
import com.hbm.entity.logic.EntityNukeExplosionMK4;
import com.hbm.entity.missile.EntityBombletSelena;
import com.hbm.entity.particle.EntitySSmokeFX;
import com.hbm.explosion.ExplosionChaos;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.explosion.ExplosionParticle;
import com.hbm.explosion.ExplosionParticleB;
import com.hbm.main.MainRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.init.Blocks;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public class EntityFallingNuke extends EntityThrowable {
float tnt;
float nuke;
float hydro;
float amat;
float dirty;
float schrab;
float euph;
public EntityFallingNuke(World p_i1582_1_) {
super(p_i1582_1_);
this.ignoreFrustumCheck = true;
}
public EntityFallingNuke(World p_i1582_1_, float tnt, float nuke, float hydro, float amat, float dirty, float schrab, float euph) {
super(p_i1582_1_);
this.ignoreFrustumCheck = true;
this.tnt = tnt;
this.nuke = nuke;
this.hydro = hydro;
this.amat = amat;
this.dirty = dirty;
this.schrab = schrab;
this.euph = euph;
this.prevRotationYaw = this.rotationYaw = 90;
this.prevRotationPitch = this.rotationPitch = 90;
}
protected void entityInit() {
this.dataWatcher.addObject(20, Byte.valueOf((byte)0));
}
@Override
public void onUpdate() {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.posX += this.motionX;
this.posY += this.motionY;
this.posZ += this.motionZ;
this.motionX *= 0.99;
this.motionZ *= 0.99;
this.motionY -= 0.05D;
if(motionY < -1)
motionY = -1;
this.rotation();
if(this.worldObj.getBlock((int)this.posX, (int)this.posY, (int)this.posZ) != Blocks.air)
{
if(!this.worldObj.isRemote)
{
NukeCustom.explodeCustom(worldObj, posX, posY, posZ, tnt, nuke, hydro, amat, dirty, schrab, euph);
this.setDead();
}
}
}
public void rotation() {
this.prevRotationPitch = rotationPitch;
if(rotationPitch > -75)
this.rotationPitch -= 2;
}
@Override
protected void onImpact(MovingObjectPosition p_70184_1_) {
}
@Override
@SideOnly(Side.CLIENT)
public boolean isInRangeToRenderDist(double distance)
{
return distance < 25000;
}
}

View File

@ -920,7 +920,7 @@ public class ModItems {
public static Item custom_amat;
public static Item custom_dirty;
public static Item custom_schrab;
public static Item custom_fall;
public static Item battery_generic;
public static Item battery_advanced;
@ -2210,6 +2210,7 @@ public class ModItems {
custom_amat = new ItemCustomLore().setUnlocalizedName("custom_amat").setMaxStackSize(1).setCreativeTab(MainRegistry.nukeTab).setTextureName(RefStrings.MODID + ":custom_amat");
custom_dirty = new ItemCustomLore().setUnlocalizedName("custom_dirty").setMaxStackSize(1).setCreativeTab(MainRegistry.nukeTab).setTextureName(RefStrings.MODID + ":custom_dirty");
custom_schrab = new ItemCustomLore().setUnlocalizedName("custom_schrab").setMaxStackSize(1).setCreativeTab(MainRegistry.nukeTab).setTextureName(RefStrings.MODID + ":custom_schrab");
custom_fall = new ItemCustomLore().setUnlocalizedName("custom_fall").setMaxStackSize(1).setCreativeTab(MainRegistry.nukeTab).setTextureName(RefStrings.MODID + ":custom_fall");
battery_generic = new ItemBattery(50, 1, 1).setUnlocalizedName("battery_generic").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":battery_generic");
battery_advanced = new ItemBattery(200, 5, 5).setUnlocalizedName("battery_advanced").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":battery_advanced");
@ -3876,6 +3877,7 @@ public class ModItems {
GameRegistry.registerItem(custom_amat, custom_amat.getUnlocalizedName());
GameRegistry.registerItem(custom_dirty, custom_dirty.getUnlocalizedName());
GameRegistry.registerItem(custom_schrab, custom_schrab.getUnlocalizedName());
GameRegistry.registerItem(custom_fall, custom_fall.getUnlocalizedName());
//Power Armor
GameRegistry.registerItem(t45_helmet, t45_helmet.getUnlocalizedName());

View File

@ -639,6 +639,12 @@ public class ItemCustomLore extends ItemRadioactive {
list.add("Removes fallout");
}
if(this == ModItems.custom_fall)
{
list.add("That's what you've aaaaaaall been waiting for!");
list.add("Makes bomb drop upon activation");
}
if(this == ModItems.pin)
{
list.add("Can be used with a screwdriver to pick locks.");

View File

@ -30,7 +30,7 @@ public class ItemAnalyzer extends Item {
Block block = world.getBlock(x, y, z);
TileEntity te = world.getTileEntity(x, y, z);
if(!world.isRemote) {
if(world.isRemote) {
player.addChatMessage(new ChatComponentText(
"Block: " + I18n.format(block.getUnlocalizedName() + ".name") + " (" + block.getUnlocalizedName() + ")"
));
@ -38,6 +38,9 @@ public class ItemAnalyzer extends Item {
player.addChatMessage(new ChatComponentText(
"Meta: " + world.getBlockMetadata(x, y, z)
));
}
if(!world.isRemote) {
if(te == null) {
player.addChatMessage(new ChatComponentText(

View File

@ -62,7 +62,7 @@ public class ItemGeigerCounter extends Item {
stack.stackTagCompound.setInteger(name, i);
}
static int getInt(ItemStack stack, String name) {
public static int getInt(ItemStack stack, String name) {
if(stack.hasTagCompound())
return stack.stackTagCompound.getInteger(name);

View File

@ -328,6 +328,7 @@ public class ClientProxy extends ServerProxy
RenderingRegistry.registerEntityRenderingHandler(EntityBooster.class, new RenderBoosterMissile());
RenderingRegistry.registerEntityRenderingHandler(EntityBomber.class, new RenderBomber());
RenderingRegistry.registerEntityRenderingHandler(EntityBurningFOEQ.class, new RenderFOEQ());
RenderingRegistry.registerEntityRenderingHandler(EntityFallingNuke.class, new RenderFallingNuke());
RenderingRegistry.registerEntityRenderingHandler(EntityMissileTaint.class, new RenderMissileTaint());
RenderingRegistry.registerEntityRenderingHandler(EntityMissileMicro.class, new RenderMissileTaint());

View File

@ -170,6 +170,7 @@ import com.hbm.entity.projectile.EntityChopperMine;
import com.hbm.entity.projectile.EntityCombineBall;
import com.hbm.entity.projectile.EntityDischarge;
import com.hbm.entity.projectile.EntityExplosiveBeam;
import com.hbm.entity.projectile.EntityFallingNuke;
import com.hbm.entity.projectile.EntityFire;
import com.hbm.entity.projectile.EntityLN2;
import com.hbm.entity.projectile.EntityLaser;
@ -859,6 +860,7 @@ public class MainRegistry
EntityRegistry.registerModEntity(EntityGrenadeIFSpark.class, "entity_grenade_ironshod", 127, this, 250, 1, true);
EntityRegistry.registerModEntity(EntityGrenadeIFHopwire.class, "entity_grenade_ironshod", 128, this, 250, 1, true);
EntityRegistry.registerModEntity(EntityGrenadeIFNull.class, "entity_grenade_ironshod", 129, this, 250, 1, true);
EntityRegistry.registerModEntity(EntityFallingNuke.class, "entity_falling_bomb", 130, this, 1000, 1, true);
EntityRegistry.registerGlobalEntityID(EntityNuclearCreeper.class, "entity_mob_nuclear_creeper", EntityRegistry.findGlobalUniqueEntityId(), 0x204131, 0x75CE00);
EntityRegistry.registerGlobalEntityID(EntityTaintedCreeper.class, "entity_mob_tainted_creeper", EntityRegistry.findGlobalUniqueEntityId(), 0x813b9b, 0xd71fdd);

View File

@ -10,7 +10,10 @@ import com.hbm.entity.projectile.EntityMeteor;
import com.hbm.items.ModItems;
import com.hbm.lib.ModDamageSource;
import com.hbm.lib.RefStrings;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.RadSurveyPacket;
import com.hbm.potion.HbmPotion;
import com.hbm.saveddata.RadiationSavedData;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
@ -25,12 +28,14 @@ import net.minecraft.entity.passive.EntityCow;
import net.minecraft.entity.passive.EntityMooshroom;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.event.entity.EntityEvent.EnteringChunk;
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
@ -94,6 +99,31 @@ public class ModEventHandler
//try {
/////
if(event.world != null && !event.world.isRemote) {
if(!event.world.playerEntities.isEmpty()) {
for(Object o : event.world.playerEntities) {
EntityPlayer player = (EntityPlayer)o;
RadiationSavedData data = RadiationSavedData.getData(player.worldObj);
Chunk chunk = player.worldObj.getChunkFromBlockCoords((int)player.posX, (int)player.posZ);
float[] rads = new float[9];
rads[0] = data.getRadNumFromCoord(chunk.xPosition + 1, chunk.zPosition + 1);
rads[1] = data.getRadNumFromCoord(chunk.xPosition, chunk.zPosition + 1);
rads[2] = data.getRadNumFromCoord(chunk.xPosition - 1, chunk.zPosition + 1);
rads[3] = data.getRadNumFromCoord(chunk.xPosition - 1, chunk.zPosition);
rads[4] = data.getRadNumFromCoord(chunk.xPosition - 1, chunk.zPosition - 1);
rads[5] = data.getRadNumFromCoord(chunk.xPosition, chunk.zPosition - 1);
rads[6] = data.getRadNumFromCoord(chunk.xPosition + 1, chunk.zPosition - 1);
rads[7] = data.getRadNumFromCoord(chunk.xPosition + 1, chunk.zPosition);
rads[8] = data.getRadNumFromCoord(chunk.xPosition, chunk.zPosition);
PacketDispatcher.wrapper.sendTo(new RadSurveyPacket(rads), (EntityPlayerMP) player);
}
}
}
if(event.world != null && !event.world.isRemote && event.world.provider.isSurfaceWorld() && MainRegistry.enableMeteorStrikes) {
if(event.world.rand.nextInt(meteorShower > 0 ? MainRegistry.meteorShowerChance : MainRegistry.meteorStrikeChance) == 0) {
if(!event.world.playerEntities.isEmpty()) {

View File

@ -2,7 +2,11 @@ package com.hbm.main;
import com.hbm.entity.mob.EntityHunterChopper;
import com.hbm.entity.projectile.EntityChopperMine;
import com.hbm.items.ModItems;
import com.hbm.items.tool.ItemGeigerCounter;
import com.hbm.lib.Library;
import com.hbm.render.misc.RenderScreenOverlay;
import com.hbm.saveddata.RadiationSavedData;
import com.hbm.sound.MovingSoundChopper;
import com.hbm.sound.MovingSoundChopperMine;
import com.hbm.sound.MovingSoundCrashing;
@ -14,10 +18,49 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import net.minecraftforge.client.event.sound.PlaySoundEvent17;
public class ModEventHandlerClient {
@SubscribeEvent
public void onOverlayRender(RenderGameOverlayEvent event) {
if(event.type == ElementType.HOTBAR) {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if(player.inventory.hasItem(ModItems.geiger_counter)) {
float rads = 0;
for(int i = 0; i < player.inventory.getSizeInventory(); i++) {
if(player.inventory.getStackInSlot(i) != null && player.inventory.getStackInSlot(i).getItem() == ModItems.geiger_counter) {
rads = ItemGeigerCounter.getInt(player.inventory.getStackInSlot(i), "ticker");
break;
}
}
////TEST
RadiationSavedData data = RadiationSavedData.getData(player.worldObj);
Chunk chunk = player.worldObj.getChunkFromBlockCoords((int)player.posX, (int)player.posZ);
rads = data.getRadNumFromCoord(chunk.xPosition, chunk.zPosition);
////TEST
//if(player.worldObj.rand.nextInt(100) == 0)
// System.out.println(rads);
RenderScreenOverlay.renderRadCounter(event.resolution, rads, Minecraft.getMinecraft().ingameGUI);
}
}
}
@SubscribeEvent
public void onPlaySound(PlaySoundEvent17 e) {

View File

@ -2,6 +2,7 @@ package com.hbm.packet;
import com.hbm.interfaces.IConsumer;
import com.hbm.interfaces.ISource;
import com.hbm.tileentity.bomb.TileEntityNukeCustom;
import com.hbm.tileentity.bomb.TileEntityTurretCIWS;
import com.hbm.tileentity.bomb.TileEntityTurretCheapo;
import com.hbm.tileentity.deco.TileEntityBomber;
@ -197,6 +198,11 @@ public class AuxGaugePacket implements IMessage {
if(m.id == 0)
boiler.heat = m.value;
}
if (te instanceof TileEntityNukeCustom) {
TileEntityNukeCustom nuke = (TileEntityNukeCustom)te;
nuke.falls = m.value == 1;
}
} catch (Exception x) {}
return null;

View File

@ -71,6 +71,8 @@ public class PacketDispatcher {
wrapper.registerMessage(SatPanelPacket.Handler.class, SatPanelPacket.class, i++, Side.CLIENT);
//Packet to send block break particles
wrapper.registerMessage(ParticleBurstPacket.Handler.class, ParticleBurstPacket.class, i++, Side.CLIENT);
//Packet to send chunk radiation info to individual players
wrapper.registerMessage(RadSurveyPacket.Handler.class, RadSurveyPacket.class, i++, Side.CLIENT);
}
}

View File

@ -0,0 +1,81 @@
package com.hbm.packet;
import com.hbm.interfaces.IConsumer;
import com.hbm.interfaces.ISource;
import com.hbm.saveddata.RadiationSavedData;
import com.hbm.tileentity.machine.TileEntityMachinePress;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.chunk.Chunk;
public class RadSurveyPacket implements IMessage {
float[] rad;
public RadSurveyPacket()
{
}
public RadSurveyPacket(float[] rad)
{
this.rad = rad;
}
@Override
public void fromBytes(ByteBuf buf) {
rad = new float[9];
for(int i = 0; i < 9; i++)
rad[i] = buf.readFloat();
}
@Override
public void toBytes(ByteBuf buf) {
for(int i = 0; i < 9; i++)
buf.writeFloat(rad[i]);
}
public static class Handler implements IMessageHandler<RadSurveyPacket, IMessage> {
@Override
@SideOnly(Side.CLIENT)
public IMessage onMessage(RadSurveyPacket m, MessageContext ctx) {
try {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
RadiationSavedData data = RadiationSavedData.getData(player.worldObj);
data.jettisonData();
Chunk[] chunks = new Chunk[9];
chunks[0] = player.worldObj.getChunkFromBlockCoords((int)player.posX + 16, (int)player.posZ + 16);
chunks[1] = player.worldObj.getChunkFromBlockCoords((int)player.posX, (int)player.posZ + 16);
chunks[2] = player.worldObj.getChunkFromBlockCoords((int)player.posX - 16, (int)player.posZ + 16);
chunks[3] = player.worldObj.getChunkFromBlockCoords((int)player.posX - 16, (int)player.posZ);
chunks[4] = player.worldObj.getChunkFromBlockCoords((int)player.posX - 16, (int)player.posZ - 16);
chunks[5] = player.worldObj.getChunkFromBlockCoords((int)player.posX, (int)player.posZ - 16);
chunks[6] = player.worldObj.getChunkFromBlockCoords((int)player.posX + 16, (int)player.posZ - 16);
chunks[7] = player.worldObj.getChunkFromBlockCoords((int)player.posX + 16, (int)player.posZ);
chunks[8] = player.worldObj.getChunkFromBlockCoords((int)player.posX, (int)player.posZ);
for(int i = 0; i < 9; i++)
data.createEntry(chunks[i].xPosition, chunks[i].zPosition, m.rad[i]);
} catch (Exception x) { }
return null;
}
}
}

View File

@ -0,0 +1,64 @@
package com.hbm.render.entity;
import org.lwjgl.opengl.GL11;
import com.hbm.lib.RefStrings;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
public class RenderFallingNuke extends Render {
private static final ResourceLocation objTesterModelRL = new ResourceLocation(/*"/assets/" + */RefStrings.MODID, "models/LilBoy1.obj");
private IModelCustom boyModel;
private ResourceLocation boyTexture;
public RenderFallingNuke() {
boyModel = AdvancedModelLoader.loadModel(objTesterModelRL);
boyTexture = new ResourceLocation(RefStrings.MODID, "textures/models/CustomNuke.png");
}
@Override
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) {
GL11.glPushMatrix();
GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
switch(p_76986_1_.getDataWatcher().getWatchableObjectByte(20))
{
case 2:
GL11.glRotatef(90, 0F, 1F, 0F);
GL11.glTranslated(-2.0D, 0.0D, 0.0D); break;
case 4:
GL11.glRotatef(180, 0F, 1F, 0F);
GL11.glTranslated(-2.0D, 0.0D, 0.0D); break;
case 3:
GL11.glRotatef(270, 0F, 1F, 0F);
GL11.glTranslated(-2.0D, 0.0D, 0.0D); break;
case 5:
GL11.glRotatef(0, 0F, 1F, 0F);
GL11.glTranslated(-2.0D, 0.0D, 0.0D); break;
}
float f = p_76986_1_.prevRotationPitch + (p_76986_1_.rotationPitch - p_76986_1_.prevRotationPitch) * p_76986_9_;
if(f < -80)
f = 0;
//GL11.glRotatef(p_76986_1_.prevRotationYaw + (p_76986_1_.rotationYaw - p_76986_1_.prevRotationYaw) * p_76986_9_ - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(f, 0.0F, 0.0F, 1.0F);
bindTexture(boyTexture);
boyModel.renderAll();
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
return new ResourceLocation(RefStrings.MODID +":textures/models/TheGadget3_.png");
}
}

View File

@ -0,0 +1,71 @@
package com.hbm.render.misc;
import org.lwjgl.opengl.GL11;
import com.hbm.lib.RefStrings;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.util.ResourceLocation;
public class RenderScreenOverlay {
private static final ResourceLocation misc = new ResourceLocation(RefStrings.MODID + ":textures/misc/overlay_misc.png");
public static void renderRadCounter(ScaledResolution resolution, float radiation, Gui gui) {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(false);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_ALPHA_TEST);
int length = 74;
int maxRad = 1000;
int bar = getScaled(radiation, maxRad, 74);
if(radiation >= 1 && radiation <= 999)
bar -= (2 + Minecraft.getMinecraft().theWorld.rand.nextInt(5));
int posX = 16;
int posY = resolution.getScaledHeight() - 18 - 2;
Minecraft.getMinecraft().renderEngine.bindTexture(misc);
gui.drawTexturedModalRect(posX, posY, 0, 0, 94, 18);
gui.drawTexturedModalRect(posX + 1, posY + 1, 1, 19, bar, 16);
if(radiation >= maxRad * 0.75) {
gui.drawTexturedModalRect(posX + length + 2, posY - 18, 36, 36, 18, 18);
} else if(radiation >= maxRad * 0.5) {
gui.drawTexturedModalRect(posX + length + 2, posY - 18, 18, 36, 18, 18);
} else if(radiation >= maxRad * 0.25) {
gui.drawTexturedModalRect(posX + length + 2, posY - 18, 0, 36, 18, 18);
}
if(radiation > 1000) {
Minecraft.getMinecraft().fontRenderer.drawString(">1000 RAD/s", posX, posY - 8, 0xFF0000);
} else if(radiation >= 1) {
Minecraft.getMinecraft().fontRenderer.drawString(((int)Math.round(radiation)) + " RAD/s", posX, posY - 8, 0xFF0000);
} else if(radiation > 0) {
Minecraft.getMinecraft().fontRenderer.drawString("<1 RAD/s", posX, posY - 8, 0xFF0000);
}
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(true);
GL11.glPopMatrix();
}
private static int getScaled(double cur, double max, double scale) {
return (int) Math.min(cur / max * scale, scale);
}
}

View File

@ -0,0 +1,35 @@
package com.hbm.saveddata;
import java.util.Arrays;
import com.hbm.handler.FluidTypeHandler.FluidType;
import net.minecraft.nbt.NBTTagCompound;
public class RadiationSaveStructure {
public int chunkX;
public int chunkY;
public float radiation;
public RadiationSaveStructure() { }
public RadiationSaveStructure(int x, int y, float rad) {
chunkX = x;
chunkY = y;
radiation = rad;
}
public void readFromNBT(NBTTagCompound nbt, int index) {
chunkX = nbt.getInteger("rad_" + index + "_x");
chunkY = nbt.getInteger("rad_" + index + "_y");
radiation = nbt.getFloat("rad_" + index + "_level");
}
public void writeToNBT(NBTTagCompound nbt, int index) {
nbt.setInteger("rad_" + index + "_x", chunkX);
nbt.setInteger("rad_" + index + "_y", chunkY);
nbt.setFloat("rad_" + index + "_level", radiation);
}
}

View File

@ -0,0 +1,173 @@
package com.hbm.saveddata;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraft.world.WorldSavedData;
public class RadiationSavedData extends WorldSavedData {
public int count;
public List<RadiationSaveStructure> contamination = new ArrayList();
private World worldObj;
public RadiationSavedData(String p_i2141_1_) {
super(p_i2141_1_);
}
public RadiationSavedData(World p_i1678_1_)
{
super("radiation");
this.worldObj = p_i1678_1_;
this.markDirty();
}
public boolean doesEntryExist(int x, int y) {
return getRadFromCoord(x, y) != null;
}
public void createEntry(int x, int y, float rad) {
contamination.add(new RadiationSaveStructure(x, y, rad));
count = contamination.size();
}
public void deleteEntry(RadiationSaveStructure struct) {
contamination.remove(struct);
count = contamination.size();
}
public void jettisonData() {
contamination.clear();
count = contamination.size();
}
public void setRadForCoord(int x, int y, float radiation) {
RadiationSaveStructure entry = null;
for(RadiationSaveStructure rad : contamination)
if(rad.chunkX == x && rad.chunkY == y) {
entry = rad;
break;
}
if(entry == null) {
entry = new RadiationSaveStructure(x, y, radiation);
contamination.add(entry);
count = contamination.size();
}
entry.radiation = radiation;
}
public RadiationSaveStructure getRadFromCoord(int x, int y) {
for(RadiationSaveStructure rad : contamination)
if(rad.chunkX == x && rad.chunkY == y)
return rad;
return null;
}
public float getRadNumFromCoord(int x, int y) {
for(RadiationSaveStructure rad : contamination)
if(rad.chunkX == x && rad.chunkY == y)
return rad.radiation;
return 0F;
}
public void updateSystem() {
List<RadiationSaveStructure> tempList = new ArrayList(contamination);
contamination.clear();
for(RadiationSaveStructure struct : tempList) {
if(struct.radiation != 0) {
if(struct.radiation > 1) {
float[] rads = new float[9];
rads[0] = getRadNumFromCoord(struct.chunkX + 1, struct.chunkY + 1);
rads[1] = getRadNumFromCoord(struct.chunkX, struct.chunkY + 1);
rads[2] = getRadNumFromCoord(struct.chunkX - 1, struct.chunkY + 1);
rads[3] = getRadNumFromCoord(struct.chunkX - 1, struct.chunkY);
rads[4] = getRadNumFromCoord(struct.chunkX - 1, struct.chunkY - 1);
rads[5] = getRadNumFromCoord(struct.chunkX, struct.chunkY - 1);
rads[6] = getRadNumFromCoord(struct.chunkX + 1, struct.chunkY - 1);
rads[7] = getRadNumFromCoord(struct.chunkX + 1, struct.chunkY);
rads[8] = getRadNumFromCoord(struct.chunkX, struct.chunkY);
float main = 0.6F;
float side = 0.075F;
float corner = 0.025F;
setRadForCoord(struct.chunkX + 1, struct.chunkY + 1, rads[0] + struct.radiation * corner);
setRadForCoord(struct.chunkX, struct.chunkY + 1, rads[1] + struct.radiation * side);
setRadForCoord(struct.chunkX - 1, struct.chunkY + 1, rads[2] + struct.radiation * corner);
setRadForCoord(struct.chunkX - 1, struct.chunkY, rads[3] + struct.radiation * side);
setRadForCoord(struct.chunkX - 1, struct.chunkY - 1, rads[4] + struct.radiation * corner);
setRadForCoord(struct.chunkX, struct.chunkY - 1, rads[5] + struct.radiation * side);
setRadForCoord(struct.chunkX + 1, struct.chunkY - 1, rads[6] + struct.radiation * corner);
setRadForCoord(struct.chunkX + 1, struct.chunkY, rads[7] + struct.radiation * side);
setRadForCoord(struct.chunkX, struct.chunkY, rads[8] + struct.radiation * main);
} else {
this.setRadForCoord(struct.chunkX, struct.chunkY, getRadNumFromCoord(struct.chunkX, struct.chunkY) + struct.radiation);
}
}
}
count = contamination.size();
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
count = nbt.getInteger("radCount");
for(int i = 0; i < count; i++) {
RadiationSaveStructure struct = new RadiationSaveStructure();
struct.readFromNBT(nbt, i);
createEntry(struct.chunkX, struct.chunkY, struct.radiation);
//contamination.add(struct);
}
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
nbt.setInteger("radCount", contamination.size());
for(int i = 0; i < contamination.size(); i++) {
contamination.get(i).writeToNBT(nbt, i);
}
}
public static RadiationSavedData getData(World worldObj) {
RadiationSavedData data = (RadiationSavedData)worldObj.perWorldStorage.loadData(RadiationSavedData.class, "radiation");
if(data == null) {
worldObj.perWorldStorage.setData("radiation", new RadiationSavedData(worldObj));
data = (RadiationSavedData)worldObj.perWorldStorage.loadData(RadiationSavedData.class, "radiation");
}
return data;
}
}

View File

@ -2,6 +2,8 @@ package com.hbm.tileentity.bomb;
import com.hbm.blocks.ModBlocks;
import com.hbm.items.ModItems;
import com.hbm.packet.AuxGaugePacket;
import com.hbm.packet.PacketDispatcher;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -27,6 +29,7 @@ public class TileEntityNukeCustom extends TileEntity implements ISidedInventory
public float dirtyStrength;
public float schrabStrength;
public float euphStrength;
public boolean falls;
public TileEntityNukeCustom() {
slots = new ItemStack[27];
@ -37,6 +40,7 @@ public class TileEntityNukeCustom extends TileEntity implements ISidedInventory
dirtyStrength = 0;
schrabStrength = 0;
euphStrength = 0;
falls = false;
}
@Override
@ -354,6 +358,10 @@ public class TileEntityNukeCustom extends TileEntity implements ISidedInventory
if(item == ModItems.ingot_euphemium) {
this.euphStrength += 1F;
}
if(item == ModItems.custom_fall) {
this.falls = true;
}
}
}
@ -473,7 +481,7 @@ public class TileEntityNukeCustom extends TileEntity implements ISidedInventory
}
public float[] returnAllValues() {
return new float[] { this.tntStrength, this.nukeStrength, this.hydroStrength, this.amatStrength, this.dirtyStrength, this.schrabStrength, this.euphStrength};
return new float[] { this.tntStrength, this.nukeStrength, this.hydroStrength, this.amatStrength, this.dirtyStrength, this.schrabStrength, this.euphStrength };
}
public void clearSlots() {