mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
77 lines
2.1 KiB
Java
77 lines
2.1 KiB
Java
package com.hbm.blocks;
|
|
|
|
import java.util.Random;
|
|
|
|
import com.hbm.explosion.ExplosionThermo;
|
|
import com.hbm.lib.RefStrings;
|
|
|
|
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.World;
|
|
|
|
public class BombThermo extends Block {
|
|
|
|
private World worldObj;
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
private IIcon iconTop;
|
|
|
|
protected BombThermo(Material p_i45394_1_) {
|
|
super(p_i45394_1_);
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
|
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":therm_top");
|
|
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + (this == ModBlocks.therm_exo ? ":therm_exo" : ":therm_endo"));
|
|
}
|
|
|
|
@Override
|
|
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
|
{
|
|
if(this == ModBlocks.therm_endo)
|
|
{
|
|
return Item.getItemFromBlock(ModBlocks.therm_endo);
|
|
}
|
|
|
|
return Item.getItemFromBlock(ModBlocks.therm_exo);
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public IIcon getIcon(int side, int metadata) {
|
|
return side == 1 ? this.iconTop : (side == 0 ? this.iconTop : this.blockIcon);
|
|
}
|
|
|
|
@Override
|
|
public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_)
|
|
{
|
|
this.worldObj = p_149695_1_;
|
|
if (p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z))
|
|
{
|
|
p_149695_1_.setBlock(x, y, z, Blocks.air);
|
|
if(this == ModBlocks.therm_endo)
|
|
{
|
|
ExplosionThermo.freeze(p_149695_1_, x, y, z, 15);
|
|
ExplosionThermo.freezer(p_149695_1_, x, y, z, 20);
|
|
}
|
|
|
|
if(this == ModBlocks.therm_exo)
|
|
{
|
|
ExplosionThermo.scorch(p_149695_1_, x, y, z, 15);
|
|
ExplosionThermo.setEntitiesOnFire(p_149695_1_, x, y, z, 20);
|
|
}
|
|
|
|
p_149695_1_.createExplosion(null, x, y, z, 5.0F, true);
|
|
}
|
|
}
|
|
|
|
}
|