mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
eksploshion
This commit is contained in:
parent
4a3b6e6026
commit
9a611c9c8f
@ -1022,10 +1022,10 @@ public class ModBlocks {
|
||||
block_thorium = new BlockHazard().addRadiation(ItemHazard.th232 * ItemHazard.block).toBlock().setBlockName("block_thorium").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_thorium");
|
||||
block_thorium_fuel = new BlockHazard().addRadiation(ItemHazard.thf * ItemHazard.block).toBlock().setBlockName("block_thorium_fuel").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_thorium_fuel");
|
||||
block_neptunium = new BlockHazard().addRadiation(ItemHazard.np237 * ItemHazard.block).toBlock().setBlockName("block_neptunium").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_neptunium");
|
||||
block_polonium = new BlockHazard().addRadiation(ItemHazard.po210 * ItemHazard.block).toBlock().setBlockName("block_polonium").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_polonium");
|
||||
block_polonium = new BlockHotHazard().addRadiation(ItemHazard.po210 * ItemHazard.block).toBlock().setBlockName("block_polonium").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_polonium");
|
||||
block_mox_fuel = new BlockHazard().addRadiation(ItemHazard.mox * ItemHazard.block).toBlock().setBlockName("block_mox_fuel").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_mox_fuel");
|
||||
block_plutonium = new BlockHazard().addRadiation(ItemHazard.pu * ItemHazard.block).toBlock().setBlockName("block_plutonium").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_plutonium");
|
||||
block_pu238 = new BlockHazard().addRadiation(ItemHazard.pu238 * ItemHazard.block).toBlock().setBlockName("block_pu238").setCreativeTab(MainRegistry.blockTab).setLightLevel(5F/15F).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_pu238");
|
||||
block_pu238 = new BlockHotHazard().addRadiation(ItemHazard.pu238 * ItemHazard.block).toBlock().setBlockName("block_pu238").setCreativeTab(MainRegistry.blockTab).setLightLevel(5F/15F).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_pu238");
|
||||
block_pu239 = new BlockHazard().addRadiation(ItemHazard.pu239 * ItemHazard.block).toBlock().setBlockName("block_pu239").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_pu239");
|
||||
block_pu240 = new BlockHazard().addRadiation(ItemHazard.pu240 * ItemHazard.block).toBlock().setBlockName("block_pu240").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_pu240");
|
||||
block_pu_mix = new BlockHazard().addRadiation(ItemHazard.purg * ItemHazard.block).toBlock().setBlockName("block_pu_mix").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_pu_mix");
|
||||
@ -1067,7 +1067,7 @@ public class ModBlocks {
|
||||
block_fiberglass = new BlockRotatablePillar(Material.cloth, RefStrings.MODID + ":block_fiberglass_top").setBlockName("block_fiberglass").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeCloth).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_fiberglass_side");
|
||||
block_asbestos = new BlockOutgas(Material.cloth, true, 5, true).addAsbestos().toBlock().setBlockName("block_asbestos").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeCloth).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_asbestos");
|
||||
block_cobalt = new BlockGeneric(Material.iron).setBlockName("block_cobalt").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_cobalt");
|
||||
block_lithium = new BlockLithium(Material.iron).setBlockName("block_lithium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_lithium");
|
||||
block_lithium = new BlockLithium(Material.iron).addHydroReactivity().toBlock().setBlockName("block_lithium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_lithium");
|
||||
block_white_phosphorus = new BlockHazard(Material.rock).addFire(15).toBlock().setBlockName("block_white_phosphorus").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_white_phosphorus");
|
||||
block_red_phosphorus = new BlockHazardFalling().addFire(15).toBlock().setStepSound(Block.soundTypeSand).setBlockName("block_red_phosphorus").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_red_phosphorus");
|
||||
block_fallout = new BlockHazardFalling().addRadiation(ItemHazard.fo * ItemHazard.block).toBlock().setStepSound(Block.soundTypeGravel).setBlockName("block_fallout").setCreativeTab(MainRegistry.blockTab).setHardness(0.2F).setBlockTextureName(RefStrings.MODID + ":ash");
|
||||
@ -1129,11 +1129,11 @@ public class ModBlocks {
|
||||
brick_compound = new BlockGeneric(Material.rock).setBlockName("brick_compound").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(10000.0F).setBlockTextureName(RefStrings.MODID + ":brick_compound");
|
||||
cmb_brick = new BlockGeneric(Material.rock).setBlockName("cmb_brick").setCreativeTab(MainRegistry.blockTab).setHardness(25.0F).setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":cmb_brick");
|
||||
cmb_brick_reinforced = new BlockGeneric(Material.rock).setBlockName("cmb_brick_reinforced").setCreativeTab(MainRegistry.blockTab).setHardness(25.0F).setResistance(60000.0F).setBlockTextureName(RefStrings.MODID + ":cmb_brick_reinforced");
|
||||
brick_asbestos = new BlockOutgas(Material.rock, true, 5, true).setBlockName("brick_asbestos").setCreativeTab(MainRegistry.blockTab).setResistance(1000.0F).setBlockTextureName(RefStrings.MODID + ":brick_asbestos");
|
||||
brick_asbestos = new BlockOutgas(Material.rock, true, 5, true).addAsbestos().toBlock().setBlockName("brick_asbestos").setCreativeTab(MainRegistry.blockTab).setResistance(1000.0F).setBlockTextureName(RefStrings.MODID + ":brick_asbestos");
|
||||
|
||||
tile_lab = new BlockOutgas(Material.rock, false, 5, true).setBlockName("tile_lab").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(1.0F).setResistance(20.0F).setBlockTextureName(RefStrings.MODID + ":tile_lab");
|
||||
tile_lab_cracked = new BlockOutgas(Material.rock, false, 5, true).setBlockName("tile_lab_cracked").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(1.0F).setResistance(20.0F).setBlockTextureName(RefStrings.MODID + ":tile_lab_cracked");
|
||||
tile_lab_broken = new BlockOutgas(Material.rock, true, 5, true).setBlockName("tile_lab_broken").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(1.0F).setResistance(20.0F).setBlockTextureName(RefStrings.MODID + ":tile_lab_broken");
|
||||
tile_lab_broken = new BlockOutgas(Material.rock, true, 5, true).addAsbestos().toBlock().setBlockName("tile_lab_broken").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(1.0F).setResistance(20.0F).setBlockTextureName(RefStrings.MODID + ":tile_lab_broken");
|
||||
|
||||
block_meteor = new BlockOre(Material.rock).setBlockName("block_meteor").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F).setBlockTextureName(RefStrings.MODID + ":meteor");
|
||||
block_meteor_cobble = new BlockOre(Material.rock).setBlockName("block_meteor_cobble").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F).setBlockTextureName(RefStrings.MODID + ":meteor_cobble");
|
||||
@ -1199,7 +1199,7 @@ public class ModBlocks {
|
||||
frozen_grass = new WasteEarth(Material.ground, false).setBlockName("frozen_grass").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(2.5F);
|
||||
frozen_log = new WasteLog(Material.wood).setBlockName("frozen_log").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(2.5F);
|
||||
frozen_planks = new BlockOre(Material.wood).setBlockName("frozen_planks").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":frozen_planks");
|
||||
fallout = new BlockFallout(Material.snow).setBlockName("fallout").setStepSound(Block.soundTypeGravel).setCreativeTab(MainRegistry.blockTab).setHardness(0.1F).setLightOpacity(0).setBlockTextureName(RefStrings.MODID + ":ash");
|
||||
fallout = new BlockFallout(Material.snow).addRadiation(ItemHazard.fo * ItemHazard.powder * 2).toBlock().setBlockName("fallout").setStepSound(Block.soundTypeGravel).setCreativeTab(MainRegistry.blockTab).setHardness(0.1F).setLightOpacity(0).setBlockTextureName(RefStrings.MODID + ":ash");
|
||||
|
||||
sellafield_slaked = new BlockGeneric(Material.rock).setBlockName("sellafield_slaked").setStepSound(Block.soundTypeStone).setHardness(5.0F).setBlockTextureName(RefStrings.MODID + ":sellafield_slaked");
|
||||
sellafield_0 = new BlockOre(Material.rock, 0.5F, 10F).setBlockName("sellafield_0").setStepSound(Block.soundTypeStone).setHardness(5.0F).setBlockTextureName(RefStrings.MODID + ":sellafield_0");
|
||||
@ -1802,7 +1802,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(block_cobalt, block_cobalt.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_steel, block_steel.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_lead, block_lead.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_lithium, ItemBlockLore.class, block_lithium.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_lithium, ItemBlockHazard.class, block_lithium.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_white_phosphorus, ItemBlockHazard.class, block_white_phosphorus.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_red_phosphorus, ItemBlockHazard.class, block_red_phosphorus.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_yellowcake, ItemBlockHazard.class, block_yellowcake.getUnlocalizedName());
|
||||
@ -1890,16 +1890,16 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(brick_obsidian, brick_obsidian.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(brick_compound, brick_compound.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(brick_light, brick_light.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(brick_asbestos, brick_asbestos.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(brick_asbestos, ItemBlockHazard.class, brick_asbestos.getUnlocalizedName());
|
||||
|
||||
//CMB Building Elements
|
||||
GameRegistry.registerBlock(cmb_brick, cmb_brick.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(cmb_brick_reinforced, cmb_brick_reinforced.getUnlocalizedName());
|
||||
|
||||
//Tiles
|
||||
GameRegistry.registerBlock(tile_lab, tile_lab.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(tile_lab_cracked, tile_lab_cracked.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(tile_lab_broken, tile_lab_broken.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(tile_lab, ItemBlockHazard.class, tile_lab.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(tile_lab_cracked, ItemBlockHazard.class, tile_lab_cracked.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(tile_lab_broken, ItemBlockHazard.class, tile_lab_broken.getUnlocalizedName());
|
||||
|
||||
//Other defensive stuff
|
||||
GameRegistry.registerBlock(barbed_wire, barbed_wire.getUnlocalizedName());
|
||||
|
||||
@ -3,7 +3,9 @@ package com.hbm.blocks.generic;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.interfaces.IItemHazard;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.modules.ItemHazardModule;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@ -17,7 +19,9 @@ import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockFallout extends Block {
|
||||
public class BlockFallout extends Block implements IItemHazard {
|
||||
|
||||
ItemHazardModule module;
|
||||
|
||||
public BlockFallout(Material mat) {
|
||||
super(mat);
|
||||
@ -74,4 +78,9 @@ public class BlockFallout extends Block {
|
||||
public boolean isReplaceable(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemHazardModule getModule() {
|
||||
return module;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,9 +6,12 @@ import com.hbm.interfaces.IItemHazard;
|
||||
import com.hbm.modules.ItemHazardModule;
|
||||
import com.hbm.saveddata.RadiationSavedData;
|
||||
|
||||
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.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockHazard extends Block implements IItemHazard {
|
||||
|
||||
@ -16,10 +19,88 @@ public class BlockHazard extends Block implements IItemHazard {
|
||||
|
||||
private float radIn = 0.0F;
|
||||
private float radMax = 0.0F;
|
||||
private ExtDisplayEffect extEffect = null;
|
||||
|
||||
public BlockHazard() {
|
||||
this(Material.iron);
|
||||
}
|
||||
|
||||
public BlockHazard setDisplayEffect(ExtDisplayEffect extEffect) {
|
||||
this.extEffect = extEffect;
|
||||
return this;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
super.randomDisplayTick(world, x, y, z, rand);
|
||||
|
||||
if(extEffect == null)
|
||||
return;
|
||||
|
||||
switch(extEffect) {
|
||||
case RADFOG:
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
|
||||
if(dir == ForgeDirection.DOWN)
|
||||
continue;
|
||||
|
||||
if(world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ).getMaterial() == Material.air) {
|
||||
|
||||
double ix = x + 0.5F + dir.offsetX + rand.nextDouble() - 0.5D;
|
||||
double iy = y + 0.5F + dir.offsetY + rand.nextDouble() - 0.5D;
|
||||
double iz = z + 0.5F + dir.offsetZ + rand.nextDouble() - 0.5D;
|
||||
|
||||
if(dir.offsetX != 0)
|
||||
ix = x + 0.5F + dir.offsetX * 0.5 + rand.nextDouble() * 0.25 * dir.offsetX;
|
||||
if(dir.offsetY != 0)
|
||||
iy = y + 0.5F + dir.offsetY * 0.5 + rand.nextDouble() * 0.25 * dir.offsetY;
|
||||
if(dir.offsetZ != 0)
|
||||
iz = z + 0.5F + dir.offsetZ * 0.5 + rand.nextDouble() * 0.25 * dir.offsetZ;
|
||||
|
||||
world.spawnParticle("townura", ix, iy, iz, 0.0, 0.0, 0.0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SCHRAB:
|
||||
break;
|
||||
|
||||
case SPARKS:
|
||||
break;
|
||||
|
||||
case FLAMES:
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
|
||||
if(dir == ForgeDirection.DOWN)
|
||||
continue;
|
||||
|
||||
if(world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ).getMaterial() == Material.air) {
|
||||
|
||||
double ix = x + 0.5F + dir.offsetX + rand.nextDouble() - 0.5D;
|
||||
double iy = y + 0.5F + dir.offsetY + rand.nextDouble() - 0.5D;
|
||||
double iz = z + 0.5F + dir.offsetZ + rand.nextDouble() - 0.5D;
|
||||
|
||||
if(dir.offsetX != 0)
|
||||
ix = x + 0.5F + dir.offsetX * 0.5 + rand.nextDouble() * 0.25 * dir.offsetX;
|
||||
if(dir.offsetY != 0)
|
||||
iy = y + 0.5F + dir.offsetY * 0.5 + rand.nextDouble() * 0.25 * dir.offsetY;
|
||||
if(dir.offsetZ != 0)
|
||||
iz = z + 0.5F + dir.offsetZ * 0.5 + rand.nextDouble() * 0.25 * dir.offsetZ;
|
||||
|
||||
world.spawnParticle("flame", ix, iy, iz, 0.0, 0.0, 0.0);
|
||||
world.spawnParticle("smoke", ix, iy, iz, 0.0, 0.0, 0.0);
|
||||
world.spawnParticle("smoke", ix, iy, iz, 0.0, 0.1, 0.0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case LAVAPOP:
|
||||
world.spawnParticle("lava", x + rand.nextFloat(), y + 1.1F, z + rand.nextFloat(), 0.0D, 0.0D, 0.0D);
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
public BlockHazard(Material mat) {
|
||||
super(mat);
|
||||
@ -63,4 +144,12 @@ public class BlockHazard extends Block implements IItemHazard {
|
||||
if(this.radIn > 0)
|
||||
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
|
||||
}
|
||||
|
||||
public static enum ExtDisplayEffect {
|
||||
RADFOG,
|
||||
SPARKS,
|
||||
SCHRAB,
|
||||
FLAMES,
|
||||
LAVAPOP
|
||||
}
|
||||
}
|
||||
|
||||
47
src/main/java/com/hbm/blocks/generic/BlockHotHazard.java
Normal file
47
src/main/java/com/hbm/blocks/generic/BlockHotHazard.java
Normal file
@ -0,0 +1,47 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockHotHazard extends BlockHazard {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
super.randomDisplayTick(world, x, y, z, rand);
|
||||
|
||||
if (world.canLightningStrikeAt(x, y + 1, z)) {
|
||||
|
||||
float ox = rand.nextFloat();
|
||||
float oz = rand.nextFloat();
|
||||
|
||||
world.spawnParticle("cloud", x + ox, y + 1, z + oz, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
|
||||
if(dir == ForgeDirection.DOWN)
|
||||
continue;
|
||||
|
||||
if(world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ).getMaterial() == Material.water) {
|
||||
|
||||
double ix = x + 0.5F + dir.offsetX + rand.nextDouble() - 0.5D;
|
||||
double iy = y + 0.5F + dir.offsetY + rand.nextDouble() - 0.5D;
|
||||
double iz = z + 0.5F + dir.offsetZ + rand.nextDouble() - 0.5D;
|
||||
|
||||
if(dir.offsetX != 0)
|
||||
ix = x + 0.5F + dir.offsetX * 0.5 + rand.nextDouble() * 0.125 * dir.offsetX;
|
||||
if(dir.offsetY != 0)
|
||||
iy = y + 0.5F + dir.offsetY * 0.5 + rand.nextDouble() * 0.125 * dir.offsetY;
|
||||
if(dir.offsetZ != 0)
|
||||
iz = z + 0.5F + dir.offsetZ * 0.5 + rand.nextDouble() * 0.125 * dir.offsetZ;
|
||||
|
||||
world.spawnParticle("cloud", ix, iy, iz, 0.0, 0.0, 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,59 +2,69 @@ package com.hbm.blocks.generic;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.interfaces.IItemHazard;
|
||||
import com.hbm.modules.ItemHazardModule;
|
||||
|
||||
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.world.World;
|
||||
|
||||
public class BlockLithium extends Block {
|
||||
public class BlockLithium extends Block implements IItemHazard {
|
||||
|
||||
ItemHazardModule module;
|
||||
|
||||
public BlockLithium(Material material) {
|
||||
super(material);
|
||||
this.module = new ItemHazardModule();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemHazardModule getModule() {
|
||||
return module;
|
||||
}
|
||||
|
||||
private boolean touchesWater(World world, int x, int y, int z) {
|
||||
|
||||
if(world.isRemote)
|
||||
|
||||
if (world.isRemote)
|
||||
return false;
|
||||
|
||||
return world.getBlock(x + 1, y, z).getMaterial() == Material.water ||
|
||||
world.getBlock(x - 1, y, z).getMaterial() == Material.water ||
|
||||
world.getBlock(x, y + 1, z).getMaterial() == Material.water ||
|
||||
world.getBlock(x, y - 1, z).getMaterial() == Material.water ||
|
||||
world.getBlock(x, y, z + 1).getMaterial() == Material.water ||
|
||||
world.getBlock(x, y, z - 1).getMaterial() == Material.water;
|
||||
|
||||
return world.getBlock(x + 1, y, z).getMaterial() == Material.water
|
||||
|| world.getBlock(x - 1, y, z).getMaterial() == Material.water
|
||||
|| world.getBlock(x, y + 1, z).getMaterial() == Material.water
|
||||
|| world.getBlock(x, y - 1, z).getMaterial() == Material.water
|
||||
|| world.getBlock(x, y, z + 1).getMaterial() == Material.water
|
||||
|| world.getBlock(x, y, z - 1).getMaterial() == Material.water;
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
|
||||
if(touchesWater(world, x, y, z)) {
|
||||
world.func_147480_a(x, y, z, false);
|
||||
world.newExplosion(null, x + 0.5, y + 0.5, z + 0.5, 15, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float fx, float fy, float fz, int meta) {
|
||||
|
||||
if(touchesWater(world, x, y, z)) {
|
||||
world.func_147480_a(x, y, z, false);
|
||||
world.newExplosion(null, x + 0.5, y + 0.5, z + 0.5, 15, false, true);
|
||||
}
|
||||
|
||||
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
|
||||
if (touchesWater(world, x, y, z)) {
|
||||
world.func_147480_a(x, y, z, false);
|
||||
world.newExplosion(null, x + 0.5, y + 0.5, z + 0.5, 15, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float fx, float fy, float fz, int meta) {
|
||||
|
||||
if (touchesWater(world, x, y, z)) {
|
||||
world.func_147480_a(x, y, z, false);
|
||||
world.newExplosion(null, x + 0.5, y + 0.5, z + 0.5, 15, false, true);
|
||||
}
|
||||
|
||||
return meta;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
}
|
||||
|
||||
if(world.canLightningStrikeAt(x, y + 1, z)) {
|
||||
|
||||
float ox = rand.nextFloat();
|
||||
float oz = rand.nextFloat();
|
||||
|
||||
world.spawnParticle("largesmoke", x + ox, y + 1, z + oz, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
|
||||
if (world.canLightningStrikeAt(x, y + 1, z)) {
|
||||
|
||||
float ox = rand.nextFloat();
|
||||
float oz = rand.nextFloat();
|
||||
|
||||
world.spawnParticle("largesmoke", x + ox, y + 1, z + oz, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,6 +34,11 @@ public interface IItemHazard {
|
||||
return this;
|
||||
}
|
||||
|
||||
public default IItemHazard addExplosive(float bang) {
|
||||
this.getModule().addExplosive(bang);
|
||||
return this;
|
||||
}
|
||||
|
||||
//the only ugly part of this entire system is the manual casting so that the rest of the daisychained setters work
|
||||
public default Item toItem() {
|
||||
return (Item)this;
|
||||
|
||||
@ -2419,10 +2419,10 @@ public class ModItems {
|
||||
crystal_trixite = new ItemHazard().addRadiation(ItemHazard.trx * ItemHazard.crystal).toItem().setUnlocalizedName("crystal_trixite").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":crystal_trixite");
|
||||
|
||||
powder_lead = new Item().setUnlocalizedName("powder_lead").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_lead");
|
||||
powder_neptunium = new ItemHazard(ItemHazard.np237 * ItemHazard.ingot, true).setUnlocalizedName("powder_neptunium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_neptunium");
|
||||
powder_polonium = new ItemHazard(ItemHazard.po210 * ItemHazard.ingot, true).setUnlocalizedName("powder_polonium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_polonium");
|
||||
powder_schrabidium = new ItemHazard(ItemHazard.sa326 * ItemHazard.ingot, true, true).setUnlocalizedName("powder_schrabidium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_schrabidium");
|
||||
powder_schrabidate = new ItemHazard(ItemHazard.sa326 * ItemHazard.ingot, true, true).setUnlocalizedName("powder_schrabidate").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_schrabidate");
|
||||
powder_neptunium = new ItemHazard(ItemHazard.np237 * ItemHazard.powder, true).setUnlocalizedName("powder_neptunium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_neptunium");
|
||||
powder_polonium = new ItemHazard(ItemHazard.po210 * ItemHazard.powder, true).setUnlocalizedName("powder_polonium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_polonium");
|
||||
powder_schrabidium = new ItemHazard(ItemHazard.sa326 * ItemHazard.powder, true, true).setUnlocalizedName("powder_schrabidium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_schrabidium");
|
||||
powder_schrabidate = new ItemHazard(ItemHazard.sa326 * ItemHazard.powder, true, true).setUnlocalizedName("powder_schrabidate").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_schrabidate");
|
||||
powder_aluminium = new Item().setUnlocalizedName("powder_aluminium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_aluminium");
|
||||
powder_beryllium = new Item().setUnlocalizedName("powder_beryllium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_beryllium");
|
||||
powder_copper = new Item().setUnlocalizedName("powder_copper").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_copper");
|
||||
@ -2433,7 +2433,7 @@ public class ModItems {
|
||||
powder_uranium = new ItemHazard().addRadiation(ItemHazard.u * ItemHazard.ingot).addFire(5).toItem().setUnlocalizedName("powder_uranium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_uranium");
|
||||
powder_plutonium = new ItemHazard().addRadiation(ItemHazard.pu * ItemHazard.ingot).addFire(5).toItem().setUnlocalizedName("powder_plutonium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_plutonium");
|
||||
dust = new ItemCustomLore().setUnlocalizedName("dust").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":dust");
|
||||
fallout = new ItemHazard().addRadiation(ItemHazard.fo * ItemHazard.ingot).toItem().setUnlocalizedName("fallout").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":fallout");
|
||||
fallout = new ItemHazard().addRadiation(ItemHazard.fo * ItemHazard.powder).toItem().setUnlocalizedName("fallout").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":fallout");
|
||||
powder_advanced_alloy = new Item().setUnlocalizedName("powder_advanced_alloy").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_advanced_alloy");
|
||||
powder_coal = new Item().setUnlocalizedName("powder_coal").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_coal");
|
||||
powder_combine_steel = new Item().setUnlocalizedName("powder_combine_steel").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_combine_steel");
|
||||
@ -2487,7 +2487,7 @@ public class ModItems {
|
||||
powder_lanthanium_tiny = new Item().setUnlocalizedName("powder_lanthanium_tiny").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_lanthanium_tiny");
|
||||
powder_actinium_tiny = new Item().setUnlocalizedName("powder_actinium_tiny").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_actinium_tiny");
|
||||
powder_meteorite_tiny = new Item().setUnlocalizedName("powder_meteorite_tiny").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_meteorite_tiny");
|
||||
powder_yellowcake = new ItemHazard(ItemHazard.u * ItemHazard.ingot).setUnlocalizedName("powder_yellowcake").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_yellowcake");
|
||||
powder_yellowcake = new ItemHazard(ItemHazard.u * ItemHazard.powder).setUnlocalizedName("powder_yellowcake").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_yellowcake");
|
||||
powder_magic = new Item().setUnlocalizedName("powder_magic").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_magic");
|
||||
powder_cloud = new Item().setUnlocalizedName("powder_cloud").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_cloud");
|
||||
powder_balefire = new ItemHazard(500F, true).setUnlocalizedName("powder_balefire").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_balefire");
|
||||
@ -3045,7 +3045,7 @@ public class ModItems {
|
||||
rod_dual_tritium = new ItemHazard(1F).setUnlocalizedName("rod_dual_tritium").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.rod_dual_empty).setTextureName(RefStrings.MODID + ":rod_dual_tritium");
|
||||
rod_quad_tritium = new ItemHazard(2F).setUnlocalizedName("rod_quad_tritium").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.rod_quad_empty).setTextureName(RefStrings.MODID + ":rod_quad_tritium");
|
||||
|
||||
trinitite = new ItemHazard(5F).setUnlocalizedName("trinitite").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":trinitite_new");
|
||||
trinitite = new ItemHazard().addRadiation(ItemHazard.trn * ItemHazard.ingot).toItem().setUnlocalizedName("trinitite").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":trinitite_new");
|
||||
nuclear_waste_long = new ItemHazard(5F).setUnlocalizedName("nuclear_waste_long").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":nuclear_waste_long");
|
||||
nuclear_waste_long_tiny = new ItemHazard(0.5F).setUnlocalizedName("nuclear_waste_long_tiny").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":nuclear_waste_long_tiny");
|
||||
nuclear_waste_short = new ItemHazard(30F, true).setUnlocalizedName("nuclear_waste_short").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":nuclear_waste_short");
|
||||
@ -3092,8 +3092,8 @@ public class ModItems {
|
||||
powder_ice = new ItemCustomLore().setUnlocalizedName("powder_ice").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_ice");
|
||||
powder_poison = new ItemCustomLore().setUnlocalizedName("powder_poison").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_poison");
|
||||
powder_thermite = new ItemCustomLore().setUnlocalizedName("powder_thermite").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_thermite");
|
||||
cordite = new Item().setUnlocalizedName("cordite").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":cordite");
|
||||
ballistite = new Item().setUnlocalizedName("ballistite").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ballistite");
|
||||
cordite = new ItemHazard().addExplosive(5F).toItem().setUnlocalizedName("cordite").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":cordite");
|
||||
ballistite = new ItemHazard().addExplosive(3F).toItem().setUnlocalizedName("ballistite").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ballistite");
|
||||
pellet_gas = new ItemCustomLore().setUnlocalizedName("pellet_gas").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":pellet_gas");
|
||||
magnetron = new ItemCustomLore().setUnlocalizedName("magnetron").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":magnetron_alt");
|
||||
pellet_buckshot = new Item().setUnlocalizedName("pellet_buckshot").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":pellets_lead");
|
||||
|
||||
@ -70,11 +70,6 @@ public class ItemBlockLore extends ItemBlock {
|
||||
list.add("Come on, get a derrick you doofus.");
|
||||
}
|
||||
|
||||
if(this.field_150939_a == ModBlocks.block_lithium) {
|
||||
list.add("It's not my fault you didn't pay");
|
||||
list.add("attention in chemistry class.");
|
||||
}
|
||||
|
||||
if(this.field_150939_a == ModBlocks.machine_mining_laser) {
|
||||
list.add("3x3x3 Multiblock");
|
||||
list.add("Only placeable on a ceiling.");
|
||||
|
||||
@ -30,6 +30,7 @@ public class ItemHazardModule {
|
||||
boolean blinding;
|
||||
boolean asbestos;
|
||||
boolean hydro;
|
||||
float explosive;
|
||||
|
||||
public void addRadiation(float radiation) {
|
||||
this.radiation = radiation;
|
||||
@ -54,6 +55,10 @@ public class ItemHazardModule {
|
||||
public void addHydroReactivity() {
|
||||
this.hydro = true;
|
||||
}
|
||||
|
||||
public void addExplosive(float bang) {
|
||||
this.explosive = bang;
|
||||
}
|
||||
|
||||
public void applyEffects(EntityLivingBase entity, float mod, int slot, boolean currentItem) {
|
||||
|
||||
@ -82,6 +87,19 @@ public class ItemHazardModule {
|
||||
}
|
||||
}
|
||||
|
||||
if(this.explosive > 0 && currentItem) {
|
||||
|
||||
if(!entity.worldObj.isRemote && entity.isBurning() && entity instanceof EntityPlayer) {
|
||||
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
ItemStack held = player.getHeldItem();
|
||||
|
||||
player.inventory.mainInventory[player.inventory.currentItem] = held.getItem().getContainerItem(held);
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
player.worldObj.newExplosion(null, player.posX, player.posY + player.getEyeHeight() - player.getYOffset(), player.posZ, this.explosive, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.blinding && !(entity instanceof EntityPlayer && ArmorUtil.checkForGoggles((EntityPlayer) entity))) {
|
||||
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.blindness.id, 100, 0));
|
||||
}
|
||||
@ -111,6 +129,10 @@ public class ItemHazardModule {
|
||||
list.add(EnumChatFormatting.RED + "[" + I18nUtil.resolveKey("trait.hydro") + "]");
|
||||
}
|
||||
|
||||
if(this.explosive > 0) {
|
||||
list.add(EnumChatFormatting.RED + "[" + I18nUtil.resolveKey("trait.explosive") + "]");
|
||||
}
|
||||
|
||||
if(this.digamma > 0) {
|
||||
float d = ((int) (digamma * 10000F)) / 10F;
|
||||
list.add(EnumChatFormatting.RED + "[" + I18nUtil.resolveKey("trait.digamma") + "]");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user