added nuclear charge, fixed battery recharge glitch, fixed creeper spawn

This commit is contained in:
HbmMods 2018-08-13 18:28:03 +02:00
parent 28bf298aec
commit 9399c88f83
14 changed files with 72 additions and 33 deletions

View File

@ -1300,6 +1300,7 @@ item.mask_of_infamy.name=Maske der Schande
tile.det_cord.name=Det Cord
tile.det_charge.name=Sprengladung
tile.det_nuke.name=Atomare Sprengladung
tile.red_barrel.name=Explosives Fass
tile.yellow_barrel.name=Radioaktives Fass

View File

@ -1300,6 +1300,7 @@ item.mask_of_infamy.name=Mask of Infamy
tile.det_cord.name=Det Cord
tile.det_charge.name=Explosive Charge
tile.det_nuke.name=Nuclear Charge
tile.red_barrel.name=Explosive Barrel
tile.yellow_barrel.name=Radioactive Barrel

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 B

View File

@ -175,6 +175,7 @@ public class ModBlocks {
public static Block emp_bomb;
public static Block det_cord;
public static Block det_charge;
public static Block det_nuke;
public static Block red_barrel;
public static Block yellow_barrel;
public static Block crashed_balefire;
@ -697,6 +698,7 @@ public class ModBlocks {
emp_bomb = new BombFloat(Material.iron).setBlockName("emp_bomb").setCreativeTab(MainRegistry.nukeTab).setHardness(5.0F).setResistance(6000.0F);
det_cord = new DetCord(Material.iron).setBlockName("det_cord").setCreativeTab(MainRegistry.nukeTab).setHardness(0.1F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":det_cord");
det_charge = new DetCord(Material.iron).setBlockName("det_charge").setCreativeTab(MainRegistry.nukeTab).setHardness(0.1F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":det_charge");
det_nuke = new DetCord(Material.iron).setBlockName("det_nuke").setCreativeTab(MainRegistry.nukeTab).setHardness(0.1F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":det_nuke");
red_barrel = new RedBarrel(Material.iron).setBlockName("red_barrel").setCreativeTab(MainRegistry.nukeTab).setHardness(0.5F).setResistance(2.5F);
yellow_barrel = new YellowBarrel(Material.iron).setBlockName("yellow_barrel").setCreativeTab(MainRegistry.nukeTab).setHardness(0.5F).setResistance(2.5F);
crashed_balefire = new BlockCrashedBomb(Material.iron).setBlockName("crashed_bomb").setCreativeTab(MainRegistry.nukeTab).setBlockUnbreakable().setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":crashed_balefire");
@ -1127,6 +1129,7 @@ public class ModBlocks {
//GameRegistry.registerBlock(rejuvinator, rejuvinator.getUnlocalizedName());
GameRegistry.registerBlock(det_cord, det_cord.getUnlocalizedName());
GameRegistry.registerBlock(det_charge, det_charge.getUnlocalizedName());
GameRegistry.registerBlock(det_nuke, det_nuke.getUnlocalizedName());
GameRegistry.registerBlock(red_barrel, red_barrel.getUnlocalizedName());
GameRegistry.registerBlock(yellow_barrel, yellow_barrel.getUnlocalizedName());

View File

@ -3,22 +3,52 @@ package com.hbm.blocks.bomb;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.entity.effect.EntityNukeCloudSmall;
import com.hbm.entity.logic.EntityNukeExplosionMK4;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.interfaces.IBomb;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
public class DetCord extends Block implements IBomb {
@SideOnly(Side.CLIENT)
private IIcon iconTop;
public DetCord(Material p_i45394_1_) {
super(p_i45394_1_);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
super.registerBlockIcons(iconRegister);
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":det_nuke_top");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
if(this != ModBlocks.det_nuke)
return this.blockIcon;
return side == 1 ? this.iconTop : (side == 0 ? this.iconTop : this.blockIcon);
}
@Override
public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion p_149723_5_)
{
@ -45,10 +75,21 @@ public class DetCord extends Block implements IBomb {
if(!world.isRemote) {
world.setBlock(x, y, z, Blocks.air);
if(this == ModBlocks.det_cord)
if(this == ModBlocks.det_cord) {
world.createExplosion(null, x + 0.5, y + 0.5, z + 0.5, 1.5F, true);
if(this == ModBlocks.det_charge)
}
if(this == ModBlocks.det_charge) {
ExplosionLarge.explode(world, x, y, z, 15, true, false, false);
}
if(this == ModBlocks.det_nuke) {
world.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(world, MainRegistry.missileRadius, x + 0.5, y + 0.5, z + 0.5));
EntityNukeCloudSmall entity2 = new EntityNukeCloudSmall(world, 1000, MainRegistry.missileRadius * 0.005F);
entity2.posX = x;
entity2.posY = y;
entity2.posZ = z;
world.spawnEntityInWorld(entity2);
}
}
}

View File

@ -77,6 +77,8 @@ public class EntityNukeExplosionMK4 extends Entity {
this.worldObj.spawnEntityInWorld(fallout);
this.setDead();
} else {
this.setDead();
}
}

View File

@ -256,31 +256,9 @@ public class EntityNuclearCreeper extends EntityMob {
double d9 = MathHelper.sqrt_double(d5 * d5 + d6 * d6 + d7 * d7);
if (d9 < wat)
{
if(entity instanceof EntityPlayer && Library.checkForHazmat((EntityPlayer)entity))
{
/*Library.damageSuit(((EntityPlayer)entity), 0);
Library.damageSuit(((EntityPlayer)entity), 1);
Library.damageSuit(((EntityPlayer)entity), 2);
Library.damageSuit(((EntityPlayer)entity), 3);*/
} else if(entity instanceof EntityCreeper) {
EntityNuclearCreeper creep = new EntityNuclearCreeper(this.worldObj);
creep.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);
//creep.setRotationYawHead(((EntityCreeper)entity).rotationYawHead);
if(!entity.isDead)
if(!worldObj.isRemote)
worldObj.spawnEntityInWorld(creep);
entity.setDead();
} else if(entity instanceof EntityVillager) {
EntityZombie creep = new EntityZombie(this.worldObj);
creep.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);
entity.setDead();
if(!this.worldObj.isRemote)
this.worldObj.spawnEntityInWorld(creep);
} else if(entity instanceof EntityLivingBase && !(entity instanceof EntityNuclearCreeper) && !(entity instanceof EntityMooshroom) && !(entity instanceof EntityZombie))
if(entity instanceof EntityLivingBase && !(entity instanceof EntityNuclearCreeper))
{
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.poison.getId(), 5 * 20, 1));
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 15 * 20, 0));
Library.applyRadiation(entity, 20, 9, 5, 2);
}
}
}

View File

@ -22,6 +22,7 @@ public class ItemBattery extends Item {
this.chargeRate = chargeRate;
this.dischargeRate = dischargeRate;
this.setMaxDamage(100);
this.canRepair = false;
}
@Override

View File

@ -17,6 +17,7 @@ public class ItemFuelRod extends ItemRadioactive {
this.lifeTime = life;
this.heat = heat;
this.setMaxDamage(100);
this.canRepair = false;
}
@Override

View File

@ -33,6 +33,7 @@ public class WatzFuel extends ItemRadioactive {
this.heatMultiplier = heatMultiplier;
this.decayMultiplier = decayMultiplier;
this.setMaxDamage(100);
this.canRepair = false;
}
@Override

View File

@ -294,6 +294,8 @@ public class ItemClip extends Item {
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_stinger_ammo, 2));
if(player.inventory.hasItem(ModItems.gun_fatman))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_fatman_ammo, 2));
if(player.inventory.hasItem(ModItems.gun_proto))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_fatman_ammo, 8));
if(player.inventory.hasItem(ModItems.gun_mirv))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_mirv_ammo, 1));
if(player.inventory.hasItem(ModItems.gun_bf))

View File

@ -882,6 +882,7 @@ public class CraftingManager {
//GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.therm_exo), 1), new Object[] { "TGT", "TUT", "TGT", 'T', "plateTitanium", 'U', ModItems.thermo_unit_exo, 'G', ModItems.circuit_gold }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.det_cord), 8), new Object[] { "TNT", "NGN", "TNT", 'T', "plateIron", 'N', "dustNiter", 'G', Items.gunpowder }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.det_charge), 1), new Object[] { "PDP", "DTD", "PDP", 'P', "plateSteel", 'D', ModBlocks.det_cord, 'T', Blocks.tnt }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.det_nuke), 1), new Object[] { "PDP", "DCD", "PDP", 'P', "plateDesh", 'D', ModBlocks.det_charge, 'C', ModItems.man_core }));
////GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.rejuvinator), 1), new Object[] { "TDT", "PCP", "TST", 'P', ModItems.pipes_steel, 'T', ModBlocks.factory_titanium_hull, 'D', "ingotDesh", 'S', "ingotSchrabidium", 'C', Items.clock }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.emp_bomb), 1), new Object[] { "LML", "LCL", "LML", 'L', "plateLead", 'M', ModItems.magnetron, 'C', ModItems.circuit_gold }));

View File

@ -1,5 +1,7 @@
package com.hbm.main;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import com.hbm.entity.missile.EntityMissileBaseAdvanced;
@ -90,7 +92,7 @@ public class ModEventHandler
public void worldTick(WorldTickEvent event) {
/////
try {
//try {
/////
if(event.world != null && !event.world.isRemote && event.world.provider.isSurfaceWorld() && MainRegistry.enableMeteorStrikes) {
@ -98,7 +100,7 @@ public class ModEventHandler
if(!event.world.playerEntities.isEmpty()) {
EntityPlayer p = (EntityPlayer)event.world.playerEntities.get(event.world.rand.nextInt(event.world.playerEntities.size()));
if(p.dimension == 0) {
if(p != null && p.dimension == 0) {
EntityMeteor meteor = new EntityMeteor(event.world);
meteor.posX = p.posX + event.world.rand.nextInt(201) - 100;
meteor.posY = 384;
@ -127,16 +129,20 @@ public class ModEventHandler
if(event.world != null && !event.world.isRemote) {
if(!event.world.loadedEntityList.isEmpty()) {
for(Object e : event.world.loadedEntityList) {
List<Object> oList = new ArrayList<Object>();
oList.addAll(event.world.loadedEntityList);
for(Object e : oList) {
if(e instanceof EntityLivingBase) {
EntityLivingBase entity = (EntityLivingBase) e;
PotionEffect effect = entity.getActivePotionEffect(HbmPotion.radiation);
if(effect != null) {
if(effect != null && !entity.isDead && entity.getHealth() > 0) {
if(entity instanceof EntityCreeper) {
if(event.world.rand.nextInt(5) == 0) {
if(event.world.rand.nextInt(5) == 0 ) {
EntityNuclearCreeper creep = new EntityNuclearCreeper(event.world);
creep.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);
@ -206,9 +212,10 @@ public class ModEventHandler
}
//////////////////////
} catch(Exception x) {
/*} catch(Exception x) {
MainRegistry.logger.error("Ouchie, something has happened in the NTM world tick event.");
}
}*/
//////////////////////
}