mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Explosive block rework:
* All blocks now spawn entities when destroyed by an explosion, rather than instantly exploding * Explosive/Waste barrels now fly off as an entity, exploding when contacting a surface * All other explosives instead spawn a zero tick entity to prevent a stack overflow while retaining existing behaviour * onShot behaviour added to simplify blocks that should explode when shot at
This commit is contained in:
parent
d3e7a9b857
commit
1734e45646
15
src/main/java/api/hbm/block/IFuckingExplode.java
Normal file
15
src/main/java/api/hbm/block/IFuckingExplode.java
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package api.hbm.block;
|
||||||
|
|
||||||
|
import com.hbm.entity.item.EntityTNTPrimedBase;
|
||||||
|
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public interface IFuckingExplode {
|
||||||
|
|
||||||
|
// Anything that can be detonated by another explosion should implement this and spawn an EntityTNTPrimedBase when hit by an explosion
|
||||||
|
// This prevents chained explosions causing a stack overflow
|
||||||
|
// Note that the block can still safely immediately explode, as long as the source isn't another explosion
|
||||||
|
|
||||||
|
public void explodeEntity(World world, double x, double y, double z, EntityTNTPrimedBase entity);
|
||||||
|
|
||||||
|
}
|
||||||
@ -1723,12 +1723,12 @@ public class ModBlocks {
|
|||||||
det_charge = new ExplosiveCharge(Material.iron).setBlockName("det_charge").setCreativeTab(MainRegistry.nukeTab).setHardness(0.1F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":det_charge");
|
det_charge = new ExplosiveCharge(Material.iron).setBlockName("det_charge").setCreativeTab(MainRegistry.nukeTab).setHardness(0.1F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":det_charge");
|
||||||
det_nuke = new ExplosiveCharge(Material.iron).setBlockName("det_nuke").setCreativeTab(MainRegistry.nukeTab).setHardness(0.1F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":det_nuke");
|
det_nuke = new ExplosiveCharge(Material.iron).setBlockName("det_nuke").setCreativeTab(MainRegistry.nukeTab).setHardness(0.1F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":det_nuke");
|
||||||
det_miner = new DetMiner(Material.iron, RefStrings.MODID + ":det_miner_top").setBlockName("det_miner").setCreativeTab(MainRegistry.nukeTab).setHardness(0.1F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":det_miner_side");
|
det_miner = new DetMiner(Material.iron, RefStrings.MODID + ":det_miner_top").setBlockName("det_miner").setCreativeTab(MainRegistry.nukeTab).setHardness(0.1F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":det_miner_side");
|
||||||
red_barrel = new RedBarrel(Material.iron).setBlockName("red_barrel").setCreativeTab(MainRegistry.nukeTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":barrel_red");
|
red_barrel = new RedBarrel(Material.iron, true).setBlockName("red_barrel").setCreativeTab(MainRegistry.nukeTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":barrel_red");
|
||||||
pink_barrel = new RedBarrel(Material.iron).setBlockName("pink_barrel").setCreativeTab(MainRegistry.nukeTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":barrel_pink");
|
pink_barrel = new RedBarrel(Material.iron, true).setBlockName("pink_barrel").setCreativeTab(MainRegistry.nukeTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":barrel_pink");
|
||||||
yellow_barrel = new YellowBarrel(Material.iron).setBlockName("yellow_barrel").setCreativeTab(MainRegistry.nukeTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":barrel_yellow");
|
yellow_barrel = new YellowBarrel(Material.iron).setBlockName("yellow_barrel").setCreativeTab(MainRegistry.nukeTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":barrel_yellow");
|
||||||
vitrified_barrel = new YellowBarrel(Material.iron).setBlockName("vitrified_barrel").setCreativeTab(MainRegistry.nukeTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":barrel_vitrified");
|
vitrified_barrel = new YellowBarrel(Material.iron).setBlockName("vitrified_barrel").setCreativeTab(MainRegistry.nukeTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":barrel_vitrified");
|
||||||
lox_barrel = new RedBarrel(Material.iron).setBlockName("lox_barrel").setCreativeTab(MainRegistry.nukeTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":barrel_lox");
|
lox_barrel = new RedBarrel(Material.iron, false).setBlockName("lox_barrel").setCreativeTab(MainRegistry.nukeTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":barrel_lox");
|
||||||
taint_barrel = new RedBarrel(Material.iron).setBlockName("taint_barrel").setCreativeTab(MainRegistry.nukeTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":barrel_taint");
|
taint_barrel = new RedBarrel(Material.iron, false).setBlockName("taint_barrel").setCreativeTab(MainRegistry.nukeTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":barrel_taint");
|
||||||
crashed_balefire = new BlockCrashedBomb(Material.iron).setBlockName("crashed_bomb").setCreativeTab(MainRegistry.nukeTab).setBlockUnbreakable().setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":crashed_balefire");
|
crashed_balefire = new BlockCrashedBomb(Material.iron).setBlockName("crashed_bomb").setCreativeTab(MainRegistry.nukeTab).setBlockUnbreakable().setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":crashed_balefire");
|
||||||
fireworks = new BlockFireworks(Material.iron).setBlockName("fireworks").setCreativeTab(MainRegistry.nukeTab).setResistance(5.0F);
|
fireworks = new BlockFireworks(Material.iron).setBlockName("fireworks").setCreativeTab(MainRegistry.nukeTab).setResistance(5.0F);
|
||||||
charge_dynamite = new BlockChargeDynamite().setBlockName("charge_dynamite").setCreativeTab(MainRegistry.nukeTab).setResistance(1.0F);
|
charge_dynamite = new BlockChargeDynamite().setBlockName("charge_dynamite").setCreativeTab(MainRegistry.nukeTab).setResistance(1.0F);
|
||||||
|
|||||||
@ -12,10 +12,13 @@ import java.util.Random;
|
|||||||
|
|
||||||
import com.hbm.blocks.BlockContainerBase;
|
import com.hbm.blocks.BlockContainerBase;
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
|
import com.hbm.entity.item.EntityTNTPrimedBase;
|
||||||
import com.hbm.interfaces.IBomb;
|
import com.hbm.interfaces.IBomb;
|
||||||
import com.hbm.tileentity.bomb.TileEntityCharge;
|
import com.hbm.tileentity.bomb.TileEntityCharge;
|
||||||
|
|
||||||
|
import api.hbm.block.IFuckingExplode;
|
||||||
import api.hbm.block.IToolable;
|
import api.hbm.block.IToolable;
|
||||||
|
import codechicken.lib.math.MathHelper;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@ -29,7 +32,7 @@ import net.minecraft.world.IBlockAccess;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public abstract class BlockChargeBase extends BlockContainerBase implements IBomb, IToolable, ITooltipProvider {
|
public abstract class BlockChargeBase extends BlockContainerBase implements IBomb, IToolable, ITooltipProvider, IFuckingExplode {
|
||||||
|
|
||||||
public static boolean safe = false;
|
public static boolean safe = false;
|
||||||
|
|
||||||
@ -134,8 +137,18 @@ public abstract class BlockChargeBase extends BlockContainerBase implements IBom
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion p_149723_5_) {
|
public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion explosion) {
|
||||||
this.explode(world, x, y, z);
|
if(!world.isRemote) {
|
||||||
|
EntityTNTPrimedBase tntPrimed = new EntityTNTPrimedBase(world, x + 0.5D, y + 0.5D, z + 0.5D, explosion != null ? explosion.getExplosivePlacedBy() : null, this);
|
||||||
|
tntPrimed.fuse = 0;
|
||||||
|
tntPrimed.detonateOnCollision = false;
|
||||||
|
world.spawnEntityInWorld(tntPrimed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explodeEntity(World world, double x, double y, double z, EntityTNTPrimedBase entity) {
|
||||||
|
explode(world, MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
55
src/main/java/com/hbm/blocks/bomb/BlockDetonatable.java
Normal file
55
src/main/java/com/hbm/blocks/bomb/BlockDetonatable.java
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
package com.hbm.blocks.bomb;
|
||||||
|
|
||||||
|
import com.hbm.blocks.generic.BlockFlammable;
|
||||||
|
import com.hbm.entity.item.EntityTNTPrimedBase;
|
||||||
|
|
||||||
|
import api.hbm.block.IFuckingExplode;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.world.Explosion;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public abstract class BlockDetonatable extends BlockFlammable implements IFuckingExplode {
|
||||||
|
|
||||||
|
protected int popFuse; // A shorter fuse for when this explosive is dinked by another
|
||||||
|
protected boolean detonateOnCollision;
|
||||||
|
protected boolean detonateOnShot;
|
||||||
|
|
||||||
|
public BlockDetonatable(Material mat, int en, int flam, int popFuse, boolean detonateOnCollision, boolean detonateOnShot) {
|
||||||
|
super(mat, en, flam);
|
||||||
|
this.popFuse = popFuse;
|
||||||
|
this.detonateOnCollision = detonateOnCollision;
|
||||||
|
this.detonateOnShot = detonateOnShot;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion explosion) {
|
||||||
|
if(!world.isRemote) {
|
||||||
|
EntityTNTPrimedBase tntPrimed = new EntityTNTPrimedBase(world, x + 0.5D, y + 0.5D, z + 0.5D, explosion != null ? explosion.getExplosivePlacedBy() : null, this);
|
||||||
|
tntPrimed.fuse = popFuse <= 0 ? 0 : world.rand.nextInt(popFuse) + popFuse / 2;
|
||||||
|
tntPrimed.detonateOnCollision = detonateOnCollision;
|
||||||
|
world.spawnEntityInWorld(tntPrimed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canDropFromExplosion(Explosion explosion) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||||
|
if(!world.isRemote && shouldIgnite(world, x, y, z)) {
|
||||||
|
world.setBlockToAir(x, y, z);
|
||||||
|
onBlockDestroyedByExplosion(world, x, y, z, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onShot(World world, int x, int y, int z) {
|
||||||
|
if (!detonateOnShot) return;
|
||||||
|
|
||||||
|
world.setBlockToAir(x, y, z);
|
||||||
|
explodeEntity(world, x, y, z, null); // insta-explod
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
package com.hbm.blocks.bomb;
|
package com.hbm.blocks.bomb;
|
||||||
|
|
||||||
|
import com.hbm.entity.item.EntityTNTPrimedBase;
|
||||||
import com.hbm.explosion.ExplosionLarge;
|
import com.hbm.explosion.ExplosionLarge;
|
||||||
import com.hbm.explosion.ExplosionNT;
|
import com.hbm.explosion.ExplosionNT;
|
||||||
import com.hbm.interfaces.IBomb;
|
import com.hbm.interfaces.IBomb;
|
||||||
@ -13,17 +14,16 @@ import net.minecraft.entity.EntityLivingBase;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.Explosion;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class BlockPlasticExplosive extends Block implements IBomb {
|
public class BlockPlasticExplosive extends BlockDetonatable implements IBomb {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private IIcon topIcon;
|
private IIcon topIcon;
|
||||||
|
|
||||||
public BlockPlasticExplosive(Material mat) {
|
public BlockPlasticExplosive(Material mat) {
|
||||||
super(mat);
|
super(mat, 0, 0, 0, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@ -68,12 +68,7 @@ public class BlockPlasticExplosive extends Block implements IBomb {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion explosion) {
|
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||||
this.explode(world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) {
|
|
||||||
if(world.isBlockIndirectlyGettingPowered(x, y, z)) {
|
if(world.isBlockIndirectlyGettingPowered(x, y, z)) {
|
||||||
this.explode(world, x, y, z);
|
this.explode(world, x, y, z);
|
||||||
}
|
}
|
||||||
@ -89,4 +84,9 @@ public class BlockPlasticExplosive extends Block implements IBomb {
|
|||||||
|
|
||||||
return BombReturnCode.DETONATED;
|
return BombReturnCode.DETONATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explodeEntity(World world, double x, double y, double z, EntityTNTPrimedBase entity) {
|
||||||
|
explode(world, MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package com.hbm.blocks.bomb;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.hbm.blocks.generic.BlockFlammable;
|
|
||||||
import com.hbm.entity.item.EntityTNTPrimedBase;
|
import com.hbm.entity.item.EntityTNTPrimedBase;
|
||||||
import com.hbm.util.ChatBuilder;
|
import com.hbm.util.ChatBuilder;
|
||||||
|
|
||||||
@ -16,21 +15,18 @@ import net.minecraft.entity.Entity;
|
|||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.projectile.EntityArrow;
|
import net.minecraft.entity.projectile.EntityArrow;
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.Explosion;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
|
|
||||||
public abstract class BlockTNTBase extends BlockFlammable implements IToolable {
|
public abstract class BlockTNTBase extends BlockDetonatable implements IToolable {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT) private IIcon topIcon;
|
@SideOnly(Side.CLIENT) private IIcon topIcon;
|
||||||
@SideOnly(Side.CLIENT) private IIcon bottomIcon;
|
@SideOnly(Side.CLIENT) private IIcon bottomIcon;
|
||||||
|
|
||||||
public BlockTNTBase() {
|
public BlockTNTBase() {
|
||||||
super(Material.tnt, 15, 100);
|
super(Material.tnt, 15, 100, 20, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -62,13 +58,9 @@ public abstract class BlockTNTBase extends BlockFlammable implements IToolable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void checkAndIgnite(World world, int x, int y, int z) {
|
public void checkAndIgnite(World world, int x, int y, int z) {
|
||||||
|
if (shouldIgnite(world, x, y, z)) {
|
||||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
this.onBlockDestroyedByPlayer(world, x, y, z, 1);
|
||||||
if(world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ) == Blocks.fire) {
|
world.setBlockToAir(x, y, z);
|
||||||
this.onBlockDestroyedByPlayer(world, x, y, z, 1);
|
|
||||||
world.setBlockToAir(x, y, z);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,15 +69,6 @@ public abstract class BlockTNTBase extends BlockFlammable implements IToolable {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion explosion) {
|
|
||||||
if(!world.isRemote) {
|
|
||||||
EntityTNTPrimedBase entitytntprimed = new EntityTNTPrimedBase(world, x + 0.5D, y + 0.5D, z + 0.5D, explosion.getExplosivePlacedBy(), this);
|
|
||||||
entitytntprimed.fuse = world.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8;
|
|
||||||
world.spawnEntityInWorld(entitytntprimed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int meta) {
|
public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int meta) {
|
||||||
this.prime(world, x, y, z, meta, (EntityLivingBase) null);
|
this.prime(world, x, y, z, meta, (EntityLivingBase) null);
|
||||||
@ -125,19 +108,12 @@ public abstract class BlockTNTBase extends BlockFlammable implements IToolable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canDropFromExplosion(Explosion explosion) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract void explodeEntity(World world, double x, double y, double z, EntityTNTPrimedBase entity);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister p_149651_1_) {
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
this.blockIcon = p_149651_1_.registerIcon(this.getTextureName() + "_side");
|
this.blockIcon = iconRegister.registerIcon(this.getTextureName() + "_side");
|
||||||
this.topIcon = p_149651_1_.registerIcon(this.getTextureName() + "_top");
|
this.topIcon = iconRegister.registerIcon(this.getTextureName() + "_top");
|
||||||
this.bottomIcon = p_149651_1_.registerIcon(this.getTextureName() + "_bottom");
|
this.bottomIcon = iconRegister.registerIcon(this.getTextureName() + "_bottom");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,16 +1,18 @@
|
|||||||
package com.hbm.blocks.bomb;
|
package com.hbm.blocks.bomb;
|
||||||
|
|
||||||
|
import com.hbm.entity.item.EntityTNTPrimedBase;
|
||||||
|
|
||||||
|
import codechicken.lib.math.MathHelper;
|
||||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.world.Explosion;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class DetCord extends Block implements IDetConnectible {
|
public class DetCord extends BlockDetonatable implements IDetConnectible {
|
||||||
|
|
||||||
public DetCord(Material p_i45394_1_) {
|
public DetCord(Material material) {
|
||||||
super(p_i45394_1_);
|
super(material, 0, 0, 0, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||||
@ -30,16 +32,6 @@ public class DetCord extends Block implements IDetConnectible {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion p_149723_5_) {
|
|
||||||
this.explode(world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canDropFromExplosion(Explosion explosion) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) {
|
public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) {
|
||||||
if(world.isBlockIndirectlyGettingPowered(x, y, z)) {
|
if(world.isBlockIndirectlyGettingPowered(x, y, z)) {
|
||||||
@ -48,10 +40,14 @@ public class DetCord extends Block implements IDetConnectible {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void explode(World world, int x, int y, int z) {
|
public void explode(World world, int x, int y, int z) {
|
||||||
|
|
||||||
if(!world.isRemote) {
|
if(!world.isRemote) {
|
||||||
world.setBlock(x, y, z, Blocks.air);
|
world.setBlock(x, y, z, Blocks.air);
|
||||||
world.createExplosion(null, x + 0.5, y + 0.5, z + 0.5, 1.5F, true);
|
world.createExplosion(null, x + 0.5, y + 0.5, z + 0.5, 1.5F, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explodeEntity(World world, double x, double y, double z, EntityTNTPrimedBase entity) {
|
||||||
|
explode(world, MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,18 +3,21 @@ package com.hbm.blocks.bomb;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.hbm.blocks.machine.BlockPillar;
|
import com.hbm.blocks.machine.BlockPillar;
|
||||||
|
import com.hbm.entity.item.EntityTNTPrimedBase;
|
||||||
import com.hbm.explosion.ExplosionLarge;
|
import com.hbm.explosion.ExplosionLarge;
|
||||||
import com.hbm.explosion.ExplosionNT;
|
import com.hbm.explosion.ExplosionNT;
|
||||||
import com.hbm.explosion.ExplosionNT.ExAttrib;
|
import com.hbm.explosion.ExplosionNT.ExAttrib;
|
||||||
import com.hbm.interfaces.IBomb;
|
import com.hbm.interfaces.IBomb;
|
||||||
|
|
||||||
|
import api.hbm.block.IFuckingExplode;
|
||||||
|
import codechicken.lib.math.MathHelper;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.world.Explosion;
|
import net.minecraft.world.Explosion;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class DetMiner extends BlockPillar implements IBomb {
|
public class DetMiner extends BlockPillar implements IBomb, IFuckingExplode {
|
||||||
|
|
||||||
public DetMiner(Material mat, String top) {
|
public DetMiner(Material mat, String top) {
|
||||||
super(mat, top);
|
super(mat, top);
|
||||||
@ -44,8 +47,13 @@ public class DetMiner extends BlockPillar implements IBomb {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion p_149723_5_) {
|
public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion explosion) {
|
||||||
this.explode(world, x, y, z);
|
if(!world.isRemote) {
|
||||||
|
EntityTNTPrimedBase tntPrimed = new EntityTNTPrimedBase(world, x + 0.5D, y + 0.5D, z + 0.5D, explosion != null ? explosion.getExplosivePlacedBy() : null, this);
|
||||||
|
tntPrimed.fuse = 0;
|
||||||
|
tntPrimed.detonateOnCollision = false;
|
||||||
|
world.spawnEntityInWorld(tntPrimed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -54,4 +62,9 @@ public class DetMiner extends BlockPillar implements IBomb {
|
|||||||
this.explode(world, x, y, z);
|
this.explode(world, x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explodeEntity(World world, double x, double y, double z, EntityTNTPrimedBase entity) {
|
||||||
|
explode(world, MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,12 +3,14 @@ package com.hbm.blocks.bomb;
|
|||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.config.BombConfig;
|
import com.hbm.config.BombConfig;
|
||||||
import com.hbm.entity.effect.EntityNukeTorex;
|
import com.hbm.entity.effect.EntityNukeTorex;
|
||||||
|
import com.hbm.entity.item.EntityTNTPrimedBase;
|
||||||
import com.hbm.entity.logic.EntityNukeExplosionMK5;
|
import com.hbm.entity.logic.EntityNukeExplosionMK5;
|
||||||
import com.hbm.explosion.ExplosionLarge;
|
import com.hbm.explosion.ExplosionLarge;
|
||||||
import com.hbm.explosion.ExplosionNT;
|
import com.hbm.explosion.ExplosionNT;
|
||||||
import com.hbm.interfaces.IBomb;
|
import com.hbm.interfaces.IBomb;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
|
|
||||||
|
import codechicken.lib.math.MathHelper;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@ -16,16 +18,15 @@ import net.minecraft.block.material.Material;
|
|||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.Explosion;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class ExplosiveCharge extends Block implements IBomb, IDetConnectible {
|
public class ExplosiveCharge extends BlockDetonatable implements IBomb, IDetConnectible {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private IIcon iconTop;
|
private IIcon iconTop;
|
||||||
|
|
||||||
public ExplosiveCharge(Material p_i45394_1_) {
|
public ExplosiveCharge(Material material) {
|
||||||
super(p_i45394_1_);
|
super(material, 0, 0, 0, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -47,16 +48,6 @@ public class ExplosiveCharge extends Block implements IBomb, IDetConnectible {
|
|||||||
return side == 1 ? this.iconTop : (side == 0 ? this.iconTop : 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_) {
|
|
||||||
this.explode(world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canDropFromExplosion(Explosion explosion) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) {
|
public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) {
|
||||||
if(world.isBlockIndirectlyGettingPowered(x, y, z)) {
|
if(world.isBlockIndirectlyGettingPowered(x, y, z)) {
|
||||||
@ -85,4 +76,9 @@ public class ExplosiveCharge extends Block implements IBomb, IDetConnectible {
|
|||||||
return BombReturnCode.DETONATED;
|
return BombReturnCode.DETONATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explodeEntity(World world, double x, double y, double z, EntityTNTPrimedBase entity) {
|
||||||
|
explode(world, MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,9 @@ package com.hbm.blocks.generic;
|
|||||||
import com.hbm.blocks.BlockBase;
|
import com.hbm.blocks.BlockBase;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class BlockFlammable extends BlockBase {
|
public class BlockFlammable extends BlockBase {
|
||||||
@ -26,4 +28,17 @@ public class BlockFlammable extends BlockBase {
|
|||||||
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||||
return encouragement;
|
return encouragement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean shouldIgnite(World world, int x, int y, int z) {
|
||||||
|
if(flammability == 0) return false;
|
||||||
|
|
||||||
|
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||||
|
if(world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ) == Blocks.fire) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,65 +3,23 @@ package com.hbm.blocks.generic;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
|
import com.hbm.blocks.bomb.BlockDetonatable;
|
||||||
import com.hbm.blocks.bomb.BlockTaint;
|
import com.hbm.blocks.bomb.BlockTaint;
|
||||||
import com.hbm.blocks.machine.BlockFluidBarrel;
|
import com.hbm.blocks.machine.BlockFluidBarrel;
|
||||||
|
import com.hbm.entity.item.EntityTNTPrimedBase;
|
||||||
import com.hbm.explosion.ExplosionThermo;
|
import com.hbm.explosion.ExplosionThermo;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
import net.minecraft.world.Explosion;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class RedBarrel extends Block {
|
public class RedBarrel extends BlockDetonatable {
|
||||||
|
|
||||||
public RedBarrel(Material p_i45394_1_) {
|
// Flammable barrels also explode when shot
|
||||||
super(p_i45394_1_);
|
public RedBarrel(Material material, boolean flammable) {
|
||||||
}
|
super(material, flammable ? 2 : 0, flammable ? 15 : 0, 100, true, flammable);
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockDestroyedByExplosion(World p_149723_1_, int p_149723_2_, int p_149723_3_, int p_149723_4_, Explosion p_149723_5_) {
|
|
||||||
if(!p_149723_1_.isRemote) {
|
|
||||||
explode(p_149723_1_, p_149723_2_, p_149723_3_, p_149723_4_);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_) {
|
|
||||||
if((this == ModBlocks.red_barrel || this == ModBlocks.pink_barrel) && p_149695_1_.getBlock(x + 1, y, z) == Blocks.fire || p_149695_1_.getBlock(x - 1, y, z) == Blocks.fire || p_149695_1_.getBlock(x, y + 1, z) == Blocks.fire || p_149695_1_.getBlock(x, y - 1, z) == Blocks.fire || p_149695_1_.getBlock(x, y, z + 1) == Blocks.fire || p_149695_1_.getBlock(x, y, z - 1) == Blocks.fire) {
|
|
||||||
if(!p_149695_1_.isRemote)
|
|
||||||
explode(p_149695_1_, x, y, z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void explode(World p_149695_1_, int x, int y, int z) {
|
|
||||||
|
|
||||||
if(this == ModBlocks.red_barrel || this == ModBlocks.pink_barrel)
|
|
||||||
p_149695_1_.newExplosion((Entity) null, x + 0.5F, y + 0.5F, z + 0.5F, 2.5F, true, true);
|
|
||||||
|
|
||||||
if(this == ModBlocks.lox_barrel) {
|
|
||||||
|
|
||||||
p_149695_1_.newExplosion(null, x + 0.5F, y + 0.5F, z + 0.5F, 1F, false, false);
|
|
||||||
|
|
||||||
ExplosionThermo.freeze(p_149695_1_, x, y, z, 7);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this == ModBlocks.taint_barrel) {
|
|
||||||
|
|
||||||
p_149695_1_.newExplosion(null, x + 0.5F, y + 0.5F, z + 0.5F, 1F, false, false);
|
|
||||||
|
|
||||||
Random rand = p_149695_1_.rand;
|
|
||||||
for(int i = 0; i < 100; i++) {
|
|
||||||
int a = rand.nextInt(9) - 4 + x;
|
|
||||||
int b = rand.nextInt(9) - 4 + y;
|
|
||||||
int c = rand.nextInt(9) - 4 + z;
|
|
||||||
if(p_149695_1_.getBlock(a, b, c).isReplaceable(p_149695_1_, a, b, c) && BlockTaint.hasPosNeightbour(p_149695_1_, a, b, c)) {
|
|
||||||
p_149695_1_.setBlock(a, b, c, ModBlocks.taint, rand.nextInt(3) + 4, 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -80,7 +38,7 @@ public class RedBarrel extends Block {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) {
|
public void setBlockBoundsBasedOnState(IBlockAccess access, int x, int y, int z) {
|
||||||
float f = 0.0625F;
|
float f = 0.0625F;
|
||||||
this.setBlockBounds(2 * f, 0.0F, 2 * f, 14 * f, 1.0F, 14 * f);
|
this.setBlockBounds(2 * f, 0.0F, 2 * f, 14 * f, 1.0F, 14 * f);
|
||||||
}
|
}
|
||||||
@ -93,8 +51,28 @@ public class RedBarrel extends Block {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canDropFromExplosion(Explosion p_149659_1_) {
|
public void explodeEntity(World world, double x, double y, double z, EntityTNTPrimedBase entity) {
|
||||||
return false;
|
int ix = MathHelper.floor_double(x), iy = MathHelper.floor_double(y), iz = MathHelper.floor_double(z);
|
||||||
|
|
||||||
|
if(this == ModBlocks.red_barrel || this == ModBlocks.pink_barrel) {
|
||||||
|
world.newExplosion(entity, x, y, z, 2.5F, true, true);
|
||||||
|
} else if(this == ModBlocks.lox_barrel) {
|
||||||
|
world.newExplosion(entity, x, y, z, 1F, false, false);
|
||||||
|
|
||||||
|
ExplosionThermo.freeze(world, ix, iy, iz, 7);
|
||||||
|
} else if(this == ModBlocks.taint_barrel) {
|
||||||
|
world.newExplosion(entity, x, y, z, 1F, false, false);
|
||||||
|
|
||||||
|
Random rand = world.rand;
|
||||||
|
for(int i = 0; i < 100; i++) {
|
||||||
|
int a = rand.nextInt(9) - 4 + ix;
|
||||||
|
int b = rand.nextInt(9) - 4 + iy;
|
||||||
|
int c = rand.nextInt(9) - 4 + iz;
|
||||||
|
if(world.getBlock(a, b, c).isReplaceable(world, a, b, c) && BlockTaint.hasPosNeightbour(world, a, b, c)) {
|
||||||
|
world.setBlock(a, b, c, ModBlocks.taint, rand.nextInt(3) + 4, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,12 +3,15 @@ package com.hbm.blocks.generic;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
|
import com.hbm.blocks.bomb.BlockDetonatable;
|
||||||
import com.hbm.blocks.machine.BlockFluidBarrel;
|
import com.hbm.blocks.machine.BlockFluidBarrel;
|
||||||
|
import com.hbm.entity.item.EntityTNTPrimedBase;
|
||||||
import com.hbm.explosion.ExplosionNukeGeneric;
|
import com.hbm.explosion.ExplosionNukeGeneric;
|
||||||
import com.hbm.handler.radiation.ChunkRadiationManager;
|
import com.hbm.handler.radiation.ChunkRadiationManager;
|
||||||
|
|
||||||
|
import codechicken.lib.math.MathHelper;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
@ -16,40 +19,18 @@ import net.minecraft.world.Explosion;
|
|||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class YellowBarrel extends Block {
|
public class YellowBarrel extends BlockDetonatable {
|
||||||
|
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
|
|
||||||
public YellowBarrel(Material p_i45386_1_) {
|
public YellowBarrel(Material material) {
|
||||||
super(p_i45386_1_);
|
super(material, 0, 0, 100, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockDestroyedByExplosion(World p_149723_1_, int p_149723_2_, int p_149723_3_, int p_149723_4_, Explosion p_149723_5_) {
|
public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion explosion) {
|
||||||
if(!p_149723_1_.isRemote && this == ModBlocks.yellow_barrel) {
|
if (this != ModBlocks.yellow_barrel) return;
|
||||||
explode(p_149723_1_, p_149723_2_, p_149723_3_, p_149723_4_);
|
super.onBlockDestroyedByExplosion(world, x, y, z, explosion);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void explode(World world, int x, int y, int z) {
|
|
||||||
|
|
||||||
if(rand.nextInt(3) == 0) {
|
|
||||||
world.setBlock(x, y, z, ModBlocks.toxic_block);
|
|
||||||
} else {
|
|
||||||
world.createExplosion(null, x, y, z, 18.0F, true);
|
|
||||||
}
|
|
||||||
ExplosionNukeGeneric.waste(world, x, y, z, 35);
|
|
||||||
|
|
||||||
for(int i = -5; i <= 5; i++) {
|
|
||||||
for(int j = -5; j <= 5; j++) {
|
|
||||||
for(int k = -5; k <= 5; k++) {
|
|
||||||
|
|
||||||
if(world.rand.nextInt(5) == 0 && world.getBlock(x + i, y + j, z + k) == Blocks.air)
|
|
||||||
world.setBlock(x + i, y + j, z + k, ModBlocks.gas_radon_dense);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ChunkRadiationManager.proxy.incrementRad(world, x, y, z, 35);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -80,17 +61,12 @@ public class YellowBarrel extends Block {
|
|||||||
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canDropFromExplosion(Explosion p_149659_1_) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void randomDisplayTick(World p_149734_1_, int p_149734_2_, int p_149734_3_, int p_149734_4_, Random p_149734_5_) {
|
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||||
super.randomDisplayTick(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_, p_149734_5_);
|
super.randomDisplayTick(world, x, y, z, rand);
|
||||||
|
|
||||||
p_149734_1_.spawnParticle("townaura", p_149734_2_ + p_149734_5_.nextFloat() * 0.5F + 0.25F, p_149734_3_ + 1.1F, p_149734_4_ + p_149734_5_.nextFloat() * 0.5F + 0.25F, 0.0D, 0.0D, 0.0D);
|
world.spawnParticle("townaura", x + rand.nextFloat() * 0.5F + 0.25F, y + 1.1F, z + rand.nextFloat() * 0.5F + 0.25F, 0.0D, 0.0D, 0.0D);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -115,4 +91,27 @@ public class YellowBarrel extends Block {
|
|||||||
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
|
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explodeEntity(World world, double x, double y, double z, EntityTNTPrimedBase entity) {
|
||||||
|
int ix = MathHelper.floor_double(x), iy = MathHelper.floor_double(y), iz = MathHelper.floor_double(z);
|
||||||
|
|
||||||
|
if(rand.nextInt(3) == 0) {
|
||||||
|
world.setBlock(ix, iy, iz, ModBlocks.toxic_block);
|
||||||
|
} else {
|
||||||
|
world.createExplosion(entity, x, y, z, 12.0F, true);
|
||||||
|
}
|
||||||
|
ExplosionNukeGeneric.waste(world, ix, iy, iz, 35);
|
||||||
|
|
||||||
|
for(int i = -5; i <= 5; i++) {
|
||||||
|
for(int j = -5; j <= 5; j++) {
|
||||||
|
for(int k = -5; k <= 5; k++) {
|
||||||
|
|
||||||
|
if(world.rand.nextInt(5) == 0 && world.getBlock(ix + i, iy + j, iz + k) == Blocks.air)
|
||||||
|
world.setBlock(ix + i, iy + j, iz + k, ModBlocks.gas_radon_dense);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ChunkRadiationManager.proxy.incrementRad(world, ix, iy, iz, 35);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package com.hbm.entity.item;
|
package com.hbm.entity.item;
|
||||||
|
|
||||||
import com.hbm.blocks.bomb.BlockTNTBase;
|
import api.hbm.block.IFuckingExplode;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@ -12,6 +11,7 @@ import net.minecraft.world.World;
|
|||||||
|
|
||||||
public class EntityTNTPrimedBase extends Entity {
|
public class EntityTNTPrimedBase extends Entity {
|
||||||
|
|
||||||
|
public boolean detonateOnCollision;
|
||||||
public int fuse;
|
public int fuse;
|
||||||
private EntityLivingBase tntPlacedBy;
|
private EntityLivingBase tntPlacedBy;
|
||||||
|
|
||||||
@ -21,9 +21,10 @@ public class EntityTNTPrimedBase extends Entity {
|
|||||||
this.setSize(0.98F, 0.98F);
|
this.setSize(0.98F, 0.98F);
|
||||||
this.yOffset = this.height / 2.0F;
|
this.yOffset = this.height / 2.0F;
|
||||||
this.fuse = 80;
|
this.fuse = 80;
|
||||||
|
this.detonateOnCollision = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityTNTPrimedBase(World world, double x, double y, double z, EntityLivingBase entity, BlockTNTBase bomb) {
|
public EntityTNTPrimedBase(World world, double x, double y, double z, EntityLivingBase entity, Block bomb) {
|
||||||
this(world);
|
this(world);
|
||||||
this.setPosition(x, y, z);
|
this.setPosition(x, y, z);
|
||||||
float f = (float) (Math.random() * Math.PI * 2.0D);
|
float f = (float) (Math.random() * Math.PI * 2.0D);
|
||||||
@ -70,7 +71,7 @@ public class EntityTNTPrimedBase extends Entity {
|
|||||||
this.motionY *= -0.5D;
|
this.motionY *= -0.5D;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.fuse-- <= 0) {
|
if(this.fuse-- <= 0 || (this.detonateOnCollision && this.isCollided)) {
|
||||||
this.setDead();
|
this.setDead();
|
||||||
|
|
||||||
if(!this.worldObj.isRemote) {
|
if(!this.worldObj.isRemote) {
|
||||||
@ -85,8 +86,12 @@ public class EntityTNTPrimedBase extends Entity {
|
|||||||
this.getBomb().explodeEntity(worldObj, posX, posY, posZ, this);
|
this.getBomb().explodeEntity(worldObj, posX, posY, posZ, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockTNTBase getBomb() {
|
public IFuckingExplode getBomb() {
|
||||||
return (BlockTNTBase) Block.getBlockById(this.dataWatcher.getWatchableObjectInt(12));
|
return (IFuckingExplode) getBlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Block getBlock() {
|
||||||
|
return Block.getBlockById(this.dataWatcher.getWatchableObjectInt(12));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -29,8 +29,7 @@ import net.minecraft.util.MovingObjectPosition;
|
|||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.bomb.BlockDetonatable;
|
||||||
import com.hbm.blocks.generic.RedBarrel;
|
|
||||||
import com.hbm.entity.grenade.EntityGrenadeTau;
|
import com.hbm.entity.grenade.EntityGrenadeTau;
|
||||||
import com.hbm.entity.mob.EntityCreeperNuclear;
|
import com.hbm.entity.mob.EntityCreeperNuclear;
|
||||||
import com.hbm.entity.particle.EntityBSmokeFX;
|
import com.hbm.entity.particle.EntityBSmokeFX;
|
||||||
@ -43,9 +42,9 @@ import cpw.mods.fml.relauncher.Side;
|
|||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class EntityBullet extends Entity implements IProjectile {
|
public class EntityBullet extends Entity implements IProjectile {
|
||||||
private int field_145791_d = -1;
|
private int tileX = -1;
|
||||||
private int field_145792_e = -1;
|
private int tileY = -1;
|
||||||
private int field_145789_f = -1;
|
private int tileZ = -1;
|
||||||
public double gravity = 0.0D;
|
public double gravity = 0.0D;
|
||||||
private Block field_145790_g;
|
private Block field_145790_g;
|
||||||
private int inData;
|
private int inData;
|
||||||
@ -340,13 +339,13 @@ public class EntityBullet extends Entity implements IProjectile {
|
|||||||
// (float)(Math.atan2(this.motionY, (double)f) * 180.0D / Math.PI);
|
// (float)(Math.atan2(this.motionY, (double)f) * 180.0D / Math.PI);
|
||||||
}
|
}
|
||||||
|
|
||||||
Block block = this.worldObj.getBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
Block block = this.worldObj.getBlock(this.tileX, this.tileY, this.tileZ);
|
||||||
|
|
||||||
if (block.getMaterial() != Material.air) {
|
if (block.getMaterial() != Material.air) {
|
||||||
block.setBlockBoundsBasedOnState(this.worldObj, this.field_145791_d, this.field_145792_e,
|
block.setBlockBoundsBasedOnState(this.worldObj, this.tileX, this.tileY,
|
||||||
this.field_145789_f);
|
this.tileZ);
|
||||||
AxisAlignedBB axisalignedbb = block.getCollisionBoundingBoxFromPool(this.worldObj, this.field_145791_d,
|
AxisAlignedBB axisalignedbb = block.getCollisionBoundingBoxFromPool(this.worldObj, this.tileX,
|
||||||
this.field_145792_e, this.field_145789_f);
|
this.tileY, this.tileZ);
|
||||||
|
|
||||||
if (axisalignedbb != null
|
if (axisalignedbb != null
|
||||||
&& axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))
|
&& axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))
|
||||||
@ -354,14 +353,14 @@ public class EntityBullet extends Entity implements IProjectile {
|
|||||||
this.inGround = true;
|
this.inGround = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block == ModBlocks.red_barrel) {
|
if(block instanceof BlockDetonatable) {
|
||||||
((RedBarrel) block).explode(worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
((BlockDetonatable) block).onShot(worldObj, this.tileX, this.tileY, this.tileZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block == Blocks.glass || block == Blocks.stained_glass || block == Blocks.glass_pane
|
if (block == Blocks.glass || block == Blocks.stained_glass || block == Blocks.glass_pane
|
||||||
|| block == Blocks.stained_glass_pane) {
|
|| block == Blocks.stained_glass_pane) {
|
||||||
this.worldObj.setBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f, Blocks.air);
|
this.worldObj.setBlock(this.tileX, this.tileY, this.tileZ, Blocks.air);
|
||||||
this.worldObj.playSound(this.field_145791_d, this.field_145792_e, this.field_145789_f, "dig.glass",
|
this.worldObj.playSound(this.tileX, this.tileY, this.tileZ, "dig.glass",
|
||||||
1.0F, 1.0F, true);
|
1.0F, 1.0F, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -609,13 +608,13 @@ public class EntityBullet extends Entity implements IProjectile {
|
|||||||
this.setDead();
|
this.setDead();
|
||||||
}
|
}
|
||||||
} else if (!this.getIsCritical()) {
|
} else if (!this.getIsCritical()) {
|
||||||
this.field_145791_d = movingobjectposition.blockX;
|
this.tileX = movingobjectposition.blockX;
|
||||||
this.field_145792_e = movingobjectposition.blockY;
|
this.tileY = movingobjectposition.blockY;
|
||||||
this.field_145789_f = movingobjectposition.blockZ;
|
this.tileZ = movingobjectposition.blockZ;
|
||||||
this.field_145790_g = this.worldObj.getBlock(this.field_145791_d, this.field_145792_e,
|
this.field_145790_g = this.worldObj.getBlock(this.tileX, this.tileY,
|
||||||
this.field_145789_f);
|
this.tileZ);
|
||||||
this.inData = this.worldObj.getBlockMetadata(this.field_145791_d, this.field_145792_e,
|
this.inData = this.worldObj.getBlockMetadata(this.tileX, this.tileY,
|
||||||
this.field_145789_f);
|
this.tileZ);
|
||||||
this.motionX = ((float) (movingobjectposition.hitVec.xCoord - this.posX));
|
this.motionX = ((float) (movingobjectposition.hitVec.xCoord - this.posX));
|
||||||
this.motionY = ((float) (movingobjectposition.hitVec.yCoord - this.posY));
|
this.motionY = ((float) (movingobjectposition.hitVec.yCoord - this.posY));
|
||||||
this.motionZ = ((float) (movingobjectposition.hitVec.zCoord - this.posZ));
|
this.motionZ = ((float) (movingobjectposition.hitVec.zCoord - this.posZ));
|
||||||
@ -628,8 +627,8 @@ public class EntityBullet extends Entity implements IProjectile {
|
|||||||
this.arrowShake = 7;
|
this.arrowShake = 7;
|
||||||
|
|
||||||
if (this.field_145790_g.getMaterial() != Material.air) {
|
if (this.field_145790_g.getMaterial() != Material.air) {
|
||||||
this.field_145790_g.onEntityCollidedWithBlock(this.worldObj, this.field_145791_d,
|
this.field_145790_g.onEntityCollidedWithBlock(this.worldObj, this.tileX,
|
||||||
this.field_145792_e, this.field_145789_f, this);
|
this.tileY, this.tileZ, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -712,9 +711,9 @@ public class EntityBullet extends Entity implements IProjectile {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void writeEntityToNBT(NBTTagCompound p_70014_1_) {
|
public void writeEntityToNBT(NBTTagCompound p_70014_1_) {
|
||||||
p_70014_1_.setShort("xTile", (short) this.field_145791_d);
|
p_70014_1_.setShort("xTile", (short) this.tileX);
|
||||||
p_70014_1_.setShort("yTile", (short) this.field_145792_e);
|
p_70014_1_.setShort("yTile", (short) this.tileY);
|
||||||
p_70014_1_.setShort("zTile", (short) this.field_145789_f);
|
p_70014_1_.setShort("zTile", (short) this.tileZ);
|
||||||
p_70014_1_.setShort("life", (short) this.ticksInGround);
|
p_70014_1_.setShort("life", (short) this.ticksInGround);
|
||||||
p_70014_1_.setByte("inTile", (byte) Block.getIdFromBlock(this.field_145790_g));
|
p_70014_1_.setByte("inTile", (byte) Block.getIdFromBlock(this.field_145790_g));
|
||||||
p_70014_1_.setByte("inData", (byte) this.inData);
|
p_70014_1_.setByte("inData", (byte) this.inData);
|
||||||
@ -729,9 +728,9 @@ public class EntityBullet extends Entity implements IProjectile {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void readEntityFromNBT(NBTTagCompound p_70037_1_) {
|
public void readEntityFromNBT(NBTTagCompound p_70037_1_) {
|
||||||
this.field_145791_d = p_70037_1_.getShort("xTile");
|
this.tileX = p_70037_1_.getShort("xTile");
|
||||||
this.field_145792_e = p_70037_1_.getShort("yTile");
|
this.tileY = p_70037_1_.getShort("yTile");
|
||||||
this.field_145789_f = p_70037_1_.getShort("zTile");
|
this.tileZ = p_70037_1_.getShort("zTile");
|
||||||
this.ticksInGround = p_70037_1_.getShort("life");
|
this.ticksInGround = p_70037_1_.getShort("life");
|
||||||
this.field_145790_g = Block.getBlockById(p_70037_1_.getByte("inTile") & 255);
|
this.field_145790_g = Block.getBlockById(p_70037_1_.getByte("inTile") & 255);
|
||||||
this.inData = p_70037_1_.getByte("inData") & 255;
|
this.inData = p_70037_1_.getByte("inData") & 255;
|
||||||
|
|||||||
@ -4,8 +4,7 @@ import java.lang.reflect.Field;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.bomb.BlockDetonatable;
|
||||||
import com.hbm.blocks.generic.RedBarrel;
|
|
||||||
import com.hbm.entity.effect.EntityCloudFleijaRainbow;
|
import com.hbm.entity.effect.EntityCloudFleijaRainbow;
|
||||||
import com.hbm.entity.effect.EntityEMPBlast;
|
import com.hbm.entity.effect.EntityEMPBlast;
|
||||||
import com.hbm.entity.logic.EntityNukeExplosionMK3;
|
import com.hbm.entity.logic.EntityNukeExplosionMK3;
|
||||||
@ -47,6 +46,7 @@ import net.minecraft.util.DamageSource;
|
|||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
|
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,7 +73,7 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
|||||||
public double prevRenderX;
|
public double prevRenderX;
|
||||||
public double prevRenderY;
|
public double prevRenderY;
|
||||||
public double prevRenderZ;
|
public double prevRenderZ;
|
||||||
public final List<Pair<Vec3, Double>> trailNodes = new ArrayList();
|
public final List<Pair<Vec3, Double>> trailNodes = new ArrayList<Pair<Vec3, Double>>();
|
||||||
|
|
||||||
public BulletConfiguration getConfig() {
|
public BulletConfiguration getConfig() {
|
||||||
return config;
|
return config;
|
||||||
@ -201,7 +201,7 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(worldObj.isRemote && config.style == config.STYLE_TAU) {
|
if(worldObj.isRemote && config.style == BulletConfiguration.STYLE_TAU) {
|
||||||
if(trailNodes.isEmpty()) {
|
if(trailNodes.isEmpty()) {
|
||||||
this.ignoreFrustumCheck = true;
|
this.ignoreFrustumCheck = true;
|
||||||
trailNodes.add(new Pair<Vec3, Double>(Vec3.createVectorHelper(-motionX * 2, -motionY * 2, -motionZ * 2), 0D));
|
trailNodes.add(new Pair<Vec3, Double>(Vec3.createVectorHelper(-motionX * 2, -motionY * 2, -motionZ * 2), 0D));
|
||||||
@ -265,7 +265,7 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
|||||||
@Override
|
@Override
|
||||||
protected void onImpact(MovingObjectPosition mop) {
|
protected void onImpact(MovingObjectPosition mop) {
|
||||||
|
|
||||||
if(mop.typeOfHit == mop.typeOfHit.BLOCK) {
|
if(mop.typeOfHit == MovingObjectType.BLOCK) {
|
||||||
|
|
||||||
boolean hRic = rand.nextInt(100) < config.HBRC;
|
boolean hRic = rand.nextInt(100) < config.HBRC;
|
||||||
boolean doesRic = config.doesRicochet && hRic;
|
boolean doesRic = config.doesRicochet && hRic;
|
||||||
@ -393,6 +393,7 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
|||||||
|
|
||||||
//for when a bullet dies by hitting a block
|
//for when a bullet dies by hitting a block
|
||||||
private void onBlockImpact(int bX, int bY, int bZ, int sideHit) {
|
private void onBlockImpact(int bX, int bY, int bZ, int sideHit) {
|
||||||
|
Block block = worldObj.getBlock(bX, bY, bZ);
|
||||||
|
|
||||||
if(config.bntImpact != null)
|
if(config.bntImpact != null)
|
||||||
config.bntImpact.behaveBlockHit(this, bX, bY, bZ, sideHit);
|
config.bntImpact.behaveBlockHit(this, bX, bY, bZ, sideHit);
|
||||||
@ -474,17 +475,15 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(config.destroysBlocks && !worldObj.isRemote) {
|
if(config.destroysBlocks && !worldObj.isRemote) {
|
||||||
if(worldObj.getBlock(bX, bY, bZ).getBlockHardness(worldObj, bX, bY, bZ) <= 120)
|
if(block.getBlockHardness(worldObj, bX, bY, bZ) <= 120)
|
||||||
worldObj.func_147480_a(bX, bY, bZ, false);
|
worldObj.func_147480_a(bX, bY, bZ, false);
|
||||||
} else if(config.doesBreakGlass && !worldObj.isRemote) {
|
} else if(config.doesBreakGlass && !worldObj.isRemote) {
|
||||||
if(worldObj.getBlock(bX, bY, bZ) == Blocks.glass ||
|
if(block == Blocks.glass || block == Blocks.glass_pane || block == Blocks.stained_glass || block == Blocks.stained_glass_pane)
|
||||||
worldObj.getBlock(bX, bY, bZ) == Blocks.glass_pane ||
|
|
||||||
worldObj.getBlock(bX, bY, bZ) == Blocks.stained_glass ||
|
|
||||||
worldObj.getBlock(bX, bY, bZ) == Blocks.stained_glass_pane)
|
|
||||||
worldObj.func_147480_a(bX, bY, bZ, false);
|
worldObj.func_147480_a(bX, bY, bZ, false);
|
||||||
|
|
||||||
if(worldObj.getBlock(bX, bY, bZ) == ModBlocks.red_barrel)
|
if(block instanceof BlockDetonatable) {
|
||||||
((RedBarrel) ModBlocks.red_barrel).explode(worldObj, bX, bY, bZ);
|
((BlockDetonatable) block).onShot(worldObj, bX, bY, bZ);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ package com.hbm.handler.guncfg;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import com.hbm.blocks.generic.RedBarrel;
|
import com.hbm.blocks.bomb.BlockDetonatable;
|
||||||
import com.hbm.handler.BulletConfigSyncingUtil;
|
import com.hbm.handler.BulletConfigSyncingUtil;
|
||||||
import com.hbm.handler.BulletConfiguration;
|
import com.hbm.handler.BulletConfiguration;
|
||||||
import com.hbm.handler.GunConfiguration;
|
import com.hbm.handler.GunConfiguration;
|
||||||
@ -122,16 +122,16 @@ public class GunOSIPRFactory {
|
|||||||
|
|
||||||
bullet.bntRicochet = (ball, x, y, z) -> {
|
bullet.bntRicochet = (ball, x, y, z) -> {
|
||||||
Block block = ball.worldObj.getBlock(x, y, z);
|
Block block = ball.worldObj.getBlock(x, y, z);
|
||||||
if(block instanceof RedBarrel)
|
if(block instanceof BlockDetonatable) {
|
||||||
((RedBarrel) block).explode(ball.worldObj, x, y, z);
|
((BlockDetonatable) block).onShot(ball.worldObj, x, y, z);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
bullet.bntImpact = (ball, x, y, z, sideHit) -> {
|
bullet.bntImpact = (ball, x, y, z, sideHit) -> {
|
||||||
final Block block = ball.worldObj.getBlock(x, y, z);
|
Block block = ball.worldObj.getBlock(x, y, z);
|
||||||
if(block instanceof RedBarrel)
|
if(block instanceof BlockDetonatable) {
|
||||||
((RedBarrel) block).explode(ball.worldObj, x, y, z);
|
((BlockDetonatable) block).onShot(ball.worldObj, x, y, z);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return bullet;
|
return bullet;
|
||||||
|
|||||||
@ -44,7 +44,7 @@ public class RenderTNTPrimedBase extends Render {
|
|||||||
|
|
||||||
f2 = (1.0F - ((float) tnt.fuse - f1 + 1.0F) / 100.0F) * 0.8F;
|
f2 = (1.0F - ((float) tnt.fuse - f1 + 1.0F) / 100.0F) * 0.8F;
|
||||||
this.bindEntityTexture(tnt);
|
this.bindEntityTexture(tnt);
|
||||||
this.blockRenderer.renderBlockAsItem(tnt.getBomb(), 0, tnt.getBrightness(f1));
|
this.blockRenderer.renderBlockAsItem(tnt.getBlock(), 0, tnt.getBrightness(f1));
|
||||||
|
|
||||||
if(tnt.fuse / 5 % 2 == 0) {
|
if(tnt.fuse / 5 % 2 == 0) {
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ public class RenderTNTPrimedBase extends Render {
|
|||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, f2);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, f2);
|
||||||
boolean prev = this.blockRenderer.useInventoryTint;
|
boolean prev = this.blockRenderer.useInventoryTint;
|
||||||
this.blockRenderer.useInventoryTint = false;
|
this.blockRenderer.useInventoryTint = false;
|
||||||
this.blockRenderer.renderBlockAsItem(tnt.getBomb(), 0, 1.0F);
|
this.blockRenderer.renderBlockAsItem(tnt.getBlock(), 0, 1.0F);
|
||||||
this.blockRenderer.useInventoryTint = prev;
|
this.blockRenderer.useInventoryTint = prev;
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
GL11.glDisable(GL11.GL_BLEND);
|
GL11.glDisable(GL11.GL_BLEND);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user