diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index 8889f2b7f..fc67ae3d3 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -287,6 +287,7 @@ public class ModBlocks { public static Block steel_roof; public static Block steel_beam; public static Block steel_scaffold; + public static Block steel_grate; public static Block broadcaster_pc; public static Block geiger; @@ -869,6 +870,7 @@ public class ModBlocks { public static final int guiID_rbmk_console = 17; public static Block pribris; public static Block pribris_burning; + public static Block pribris_radiating; public static Block book_guide; @@ -983,6 +985,19 @@ public class ModBlocks { public static Material materialGas = new MaterialGas(); + public static Block.SoundType soundTypeGrate = new ModSoundType("metalBlock", 0.5F, 1.0F) { + + @Override + public String func_150496_b() { + return Block.soundTypeMetal.func_150496_b(); + } + + @Override + public String getBreakSound() { + return "dig.stone"; + } + }; + private static void initializeBlock() { test_render = new TestRender(Material.rock).setBlockName("test_render").setCreativeTab(null); @@ -1229,20 +1244,21 @@ public class ModBlocks { brick_dungeon_tile = new BlockGeneric(Material.rock).setBlockName("brick_dungeon_tile").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F).setBlockTextureName(RefStrings.MODID + ":brick_dungeon_tile"); brick_dungeon_circle = new BlockGeneric(Material.rock).setBlockName("brick_dungeon_circle").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F).setBlockTextureName(RefStrings.MODID + ":brick_dungeon_circle"); - tape_recorder = new DecoTapeRecorder(Material.rock).setBlockName("tape_recorder").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":deco_tape_recorder"); - steel_poles = new DecoSteelPoles(Material.rock).setBlockName("steel_poles").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":steel_beam"); - pole_top = new DecoPoleTop(Material.rock).setBlockName("pole_top").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":deco_pole_top"); - pole_satellite_receiver = new DecoPoleSatelliteReceiver(Material.rock).setBlockName("pole_satellite_receiver").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":deco_satellite_receiver"); - steel_wall = new DecoBlock(Material.rock).setBlockName("steel_wall").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":steel_wall"); - steel_corner = new DecoBlock(Material.rock).setBlockName("steel_corner").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":steel_corner"); - steel_roof = new DecoBlock(Material.rock).setBlockName("steel_roof").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":steel_roof"); - steel_beam = new DecoBlock(Material.rock).setBlockName("steel_beam").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":steel_beam"); - steel_scaffold = new DecoBlock(Material.rock).setBlockName("steel_scaffold").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":deco_steel"); + tape_recorder = new DecoTapeRecorder(Material.iron).setBlockName("tape_recorder").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":deco_tape_recorder"); + steel_poles = new DecoSteelPoles(Material.iron).setBlockName("steel_poles").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":steel_beam"); + pole_top = new DecoPoleTop(Material.iron).setBlockName("pole_top").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":deco_pole_top"); + pole_satellite_receiver = new DecoPoleSatelliteReceiver(Material.iron).setBlockName("pole_satellite_receiver").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":deco_satellite_receiver"); + steel_wall = new DecoBlock(Material.iron).setBlockName("steel_wall").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":steel_wall"); + steel_corner = new DecoBlock(Material.iron).setBlockName("steel_corner").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":steel_corner"); + steel_roof = new DecoBlock(Material.iron).setBlockName("steel_roof").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":steel_roof"); + steel_beam = new DecoBlock(Material.iron).setBlockName("steel_beam").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":steel_beam"); + steel_scaffold = new DecoBlock(Material.iron).setBlockName("steel_scaffold").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":deco_steel"); + steel_grate = new BlockGrate(Material.iron).setBlockName("steel_grate").setStepSound(soundTypeGrate).setCreativeTab(MainRegistry.blockTab).setHardness(2.0F).setResistance(5.0F); - broadcaster_pc = new PinkCloudBroadcaster(Material.rock).setBlockName("broadcaster_pc").setCreativeTab(MainRegistry.machineTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":broadcaster_pc"); - geiger = new GeigerCounter(Material.rock).setBlockName("geiger").setCreativeTab(MainRegistry.machineTab).setHardness(15.0F).setResistance(0.25F).setBlockTextureName(RefStrings.MODID + ":geiger"); + broadcaster_pc = new PinkCloudBroadcaster(Material.iron).setBlockName("broadcaster_pc").setCreativeTab(MainRegistry.machineTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":broadcaster_pc"); + geiger = new GeigerCounter(Material.iron).setBlockName("geiger").setCreativeTab(MainRegistry.machineTab).setHardness(15.0F).setResistance(0.25F).setBlockTextureName(RefStrings.MODID + ":geiger"); - fence_metal = new BlockMetalFence(Material.rock).setBlockName("fence_metal").setCreativeTab(MainRegistry.machineTab).setHardness(15.0F).setResistance(0.25F).setBlockTextureName(RefStrings.MODID + ":fence_metal"); + fence_metal = new BlockMetalFence(Material.iron).setBlockName("fence_metal").setCreativeTab(MainRegistry.machineTab).setHardness(15.0F).setResistance(0.25F).setBlockTextureName(RefStrings.MODID + ":fence_metal"); sand_uranium = new BlockFalling(Material.sand).setBlockName("sand_uranium").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.machineTab).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":sand_uranium"); sand_polonium = new BlockFalling(Material.sand).setBlockName("sand_polonium").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.machineTab).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":sand_polonium"); @@ -1600,6 +1616,7 @@ public class ModBlocks { rbmk_console = new RBMKConsole().setBlockName("rbmk_console").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_console"); pribris = new RBMKDebris().setBlockName("pribris").setCreativeTab(MainRegistry.machineTab).setHardness(50.0F).setResistance(600.0F).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_debris"); pribris_burning = new RBMKDebrisBurning().setBlockName("pribris_burning").setCreativeTab(MainRegistry.machineTab).setHardness(50.0F).setResistance(600.0F).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_debris_burning"); + pribris_radiating = new RBMKDebrisRadiating().setBlockName("pribris_radiating").setCreativeTab(MainRegistry.machineTab).setHardness(50.0F).setResistance(600.0F).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_debris_radiating"); book_guide = new Guide(Material.iron).setBlockName("book_guide").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.nukeTab); @@ -2056,6 +2073,7 @@ public class ModBlocks { GameRegistry.registerBlock(steel_roof, steel_roof.getUnlocalizedName()); GameRegistry.registerBlock(steel_beam, steel_beam.getUnlocalizedName()); GameRegistry.registerBlock(steel_scaffold, steel_scaffold.getUnlocalizedName()); + GameRegistry.registerBlock(steel_grate, steel_grate.getUnlocalizedName()); GameRegistry.registerBlock(mush, mush.getUnlocalizedName()); GameRegistry.registerBlock(mush_block, mush_block.getUnlocalizedName()); GameRegistry.registerBlock(mush_block_stem, mush_block_stem.getUnlocalizedName()); @@ -2273,6 +2291,7 @@ public class ModBlocks { GameRegistry.registerBlock(rbmk_console, rbmk_console.getUnlocalizedName()); GameRegistry.registerBlock(pribris, pribris.getUnlocalizedName()); GameRegistry.registerBlock(pribris_burning, pribris_burning.getUnlocalizedName()); + GameRegistry.registerBlock(pribris_radiating, pribris_radiating.getUnlocalizedName()); GameRegistry.registerBlock(red_cable, red_cable.getUnlocalizedName()); GameRegistry.registerBlock(red_wire_coated, red_wire_coated.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/blocks/ModSoundType.java b/src/main/java/com/hbm/blocks/ModSoundType.java new file mode 100644 index 000000000..331a7e27a --- /dev/null +++ b/src/main/java/com/hbm/blocks/ModSoundType.java @@ -0,0 +1,19 @@ +package com.hbm.blocks; + +import net.minecraft.block.Block; + +public class ModSoundType extends Block.SoundType { + + public ModSoundType(String name, float volume, float pitch) { + super(name, volume, pitch); + } + + public String getBreakSound() { + return "hbm:" + super.getBreakSound(); + } + + public String getStepResourcePath() { + return "hbm:" + super.getStepResourcePath(); + } + +} diff --git a/src/main/java/com/hbm/blocks/generic/BlockGrate.java b/src/main/java/com/hbm/blocks/generic/BlockGrate.java new file mode 100644 index 000000000..304a0899f --- /dev/null +++ b/src/main/java/com/hbm/blocks/generic/BlockGrate.java @@ -0,0 +1,85 @@ +package com.hbm.blocks.generic; + +import com.hbm.lib.RefStrings; + +import cpw.mods.fml.client.registry.RenderingRegistry; +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.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public class BlockGrate extends Block { + + @SideOnly(Side.CLIENT) + private IIcon sideIcon; + + public BlockGrate(Material material) { + super(material); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconRegister) { + this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":grate_top"); + this.sideIcon = iconRegister.registerIcon(RefStrings.MODID + ":grate_side"); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int metadata) { + return side == 1 ? this.blockIcon : (side == 0 ? this.blockIcon : this.sideIcon); + } + + public static int renderID = RenderingRegistry.getNextAvailableRenderId(); + + @Override + public int getRenderType() { + return renderID; + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { + int meta = world.getBlockMetadata(x, y, z); + this.setBlockBounds(0F, meta * 0.125F, 0F, 1F, meta * 0.125F + 0.125F, 1F); + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { + int meta = world.getBlockMetadata(x, y, z); + this.setBlockBounds(0F, meta * 0.125F, 0F, 1F, meta * 0.125F + 0.125F, 1F); + return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ); + } + + @Override + public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) { + return side == ForgeDirection.UP; + } + + @Override + public int onBlockPlaced(World world, int x, int y, int z, int side, float hX, float hY, float hZ, int meta) { + + if(side == 0) + return 7; + + if(side == 1) + return 0; + + return (int)Math.floor(hY * 8D); + } +} diff --git a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKBase.java b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKBase.java index cf47054af..86a8cf119 100644 --- a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKBase.java +++ b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKBase.java @@ -1,7 +1,9 @@ package com.hbm.blocks.machine.rbmk; import com.hbm.blocks.BlockDummyable; +import com.hbm.handler.MultiblockHandlerXR; import com.hbm.main.MainRegistry; +import com.hbm.tileentity.machine.rbmk.RBMKDials; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKBase; import cpw.mods.fml.client.registry.RenderingRegistry; @@ -10,8 +12,8 @@ import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; -import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; public abstract class RBMKBase extends BlockDummyable { @@ -70,6 +72,20 @@ public abstract class RBMKBase extends BlockDummyable { return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY + height, z + this.maxZ); } + @Override + protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { + return MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, getDimensions(world), x, y, z, dir); + } + + @Override + protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { + MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, getDimensions(world), this, dir); + } + + public int[] getDimensions(World world) { + return new int[] {RBMKDials.getColumnHeight(world), 0, 0, 0, 0, 0}; + } + public static int renderIDRods = RenderingRegistry.getNextAvailableRenderId(); public static int renderIDPassive = RenderingRegistry.getNextAvailableRenderId(); public static int renderIDControl = RenderingRegistry.getNextAvailableRenderId(); diff --git a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKBoiler.java b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKBoiler.java index b53519bc4..788c35b32 100644 --- a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKBoiler.java +++ b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKBoiler.java @@ -2,6 +2,7 @@ package com.hbm.blocks.machine.rbmk; import com.hbm.blocks.ModBlocks; import com.hbm.tileentity.TileEntityProxyCombo; +import com.hbm.tileentity.machine.rbmk.RBMKDials; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKBoiler; import net.minecraft.entity.player.EntityPlayer; @@ -36,6 +37,6 @@ public class RBMKBoiler extends RBMKBase { @Override public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { super.fillSpace(world, x, y, z, dir, o); - this.makeExtra(world, x, y + 3, z); + this.makeExtra(world, x, y + RBMKDials.getColumnHeight(world), z); } } diff --git a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKDebrisBurning.java b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKDebrisBurning.java index f68c53732..ebb53e4c0 100644 --- a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKDebrisBurning.java +++ b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKDebrisBurning.java @@ -30,6 +30,7 @@ public class RBMKDebrisBurning extends RBMKDebris { data.setInteger("maxAge", 300); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x + 0.25 + rand.nextDouble() * 0.5, y + 1.75, z + 0.25 + rand.nextDouble() * 0.5), new TargetPoint(world.provider.dimensionId, x + 0.5, y + 1.75, z + 0.5, 75)); MainRegistry.proxy.effectNT(data); + world.playSoundEffect(x + 0.5F, y + 0.5, z + 0.5, "fire.fire", 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F); } if(rand.nextInt(100) == 0) { diff --git a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKDebrisRadiating.java b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKDebrisRadiating.java new file mode 100644 index 000000000..cab085852 --- /dev/null +++ b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKDebrisRadiating.java @@ -0,0 +1,106 @@ +package com.hbm.blocks.machine.rbmk; + +import java.util.List; +import java.util.Random; + +import com.hbm.blocks.ModBlocks; +import com.hbm.main.MainRegistry; +import com.hbm.packet.AuxParticlePacketNT; +import com.hbm.packet.PacketDispatcher; +import com.hbm.util.ContaminationUtil; +import com.hbm.util.ContaminationUtil.ContaminationType; +import com.hbm.util.ContaminationUtil.HazardType; + +import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class RBMKDebrisRadiating extends RBMKDebrisBurning { + + @Override + public int tickRate(World world) { + + return 20 + world.rand.nextInt(20); + } + + @Override + public void updateTick(World world, int x, int y, int z, Random rand) { + + if(!world.isRemote) { + + radiate(world, x, y, z); + + if(rand.nextInt(5) == 0) { + NBTTagCompound data = new NBTTagCompound(); + data.setString("type", "rbmkflame"); + data.setInteger("maxAge", 300); + PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x + rand.nextDouble(), y + 1.75, z + rand.nextDouble()), new TargetPoint(world.provider.dimensionId, x + 0.5, y + 1.75, z + 0.5, 75)); + MainRegistry.proxy.effectNT(data); + world.playSoundEffect(x + 0.5F, y + 0.5, z + 0.5, "fire.fire", 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F); + + } + + if(rand.nextInt(1000) == 0) { + + int meta = world.getBlockMetadata(x, y, z); + + if(meta < 15) { + world.setBlockMetadataWithNotify(x, y, z, meta + 1, 2); + world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world)); + } else { + world.setBlock(x, y, z, ModBlocks.pribris_burning); + } + + } else { + world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world)); + } + } + } + + private void radiate(World world, int x, int y, int z) { + + float rads = 1000000F; + double range = 100D; + + List entities = world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(x + 0.5, y + 0.5, z + 0.5, x + 0.5, y + 0.5, z + 0.5).expand(range, range, range)); + + for(EntityLivingBase e : entities) { + + Vec3 vec = Vec3.createVectorHelper(e.posX - (x + 0.5), (e.posY + e.getEyeHeight()) - (y + 0.5), e.posZ - (z + 0.5)); + double len = vec.lengthVector(); + vec = vec.normalize(); + + float res = 0; + + for(int i = 1; i < len; i++) { + + int ix = (int)Math.floor(x + 0.5 + vec.xCoord * i); + int iy = (int)Math.floor(y + 0.5 + vec.yCoord * i); + int iz = (int)Math.floor(z + 0.5 + vec.zCoord * i); + + res += world.getBlock(ix, iy, iz).getExplosionResistance(null); + } + + if(res < 1) + res = 1; + + float eRads = rads; + eRads /= (float)res; + eRads /= (float)(len * len); + + ContaminationUtil.contaminate(e, HazardType.RADIATION, ContaminationType.CREATIVE, eRads); + + if(len < 5) { + e.attackEntityFrom(DamageSource.inFire, 100); + } + + /*if(e instanceof EntityPlayer) { + ((EntityPlayer) e).addChatComponentMessage(new ChatComponentText("RAD/s: " + (int)eRads).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED))); + }*/ + } + } +} diff --git a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKRod.java b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKRod.java index aa46d7357..7cb340799 100644 --- a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKRod.java +++ b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKRod.java @@ -2,6 +2,7 @@ package com.hbm.blocks.machine.rbmk; import com.hbm.blocks.ModBlocks; import com.hbm.tileentity.TileEntityProxyInventory; +import com.hbm.tileentity.machine.rbmk.RBMKDials; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKRod; import net.minecraft.entity.player.EntityPlayer; @@ -36,6 +37,6 @@ public class RBMKRod extends RBMKBase { @Override public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { super.fillSpace(world, x, y, z, dir, o); - this.makeExtra(world, x, y + 3, z); + this.makeExtra(world, x, y + RBMKDials.getColumnHeight(world), z); } } diff --git a/src/main/java/com/hbm/entity/projectile/EntityRBMKDebris.java b/src/main/java/com/hbm/entity/projectile/EntityRBMKDebris.java index f1da894b5..81f4cf3e3 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityRBMKDebris.java +++ b/src/main/java/com/hbm/entity/projectile/EntityRBMKDebris.java @@ -1,13 +1,32 @@ package com.hbm.entity.projectile; +import java.util.List; + +import com.hbm.items.ModItems; +import com.hbm.potion.HbmPotion; +import com.hbm.tileentity.machine.rbmk.RBMKDials; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.ReportedException; +import net.minecraft.util.Vec3; import net.minecraft.world.World; public class EntityRBMKDebris extends Entity { public float rot; public float lastRot; + private boolean hasSizeSet = false; public EntityRBMKDebris(World world) { super(world); @@ -25,9 +44,48 @@ public class EntityRBMKDebris extends Entity { this.rot = this.lastRot = this.rand.nextFloat() * 360; } + @Override + public boolean canBeCollidedWith() { + return true; + } + + @Override + public boolean interactFirst(EntityPlayer player) { + + if(!worldObj.isRemote) { + + switch(this.getType()) { + case BLANK: if(player.inventory.addItemStackToInventory(new ItemStack(ModItems.debris_metal))) this.setDead(); break; + case ELEMENT: if(player.inventory.addItemStackToInventory(new ItemStack(ModItems.debris_metal))) this.setDead(); break; + case FUEL: if(player.inventory.addItemStackToInventory(new ItemStack(ModItems.debris_fuel))) this.setDead(); break; + case GRAPHITE: if(player.inventory.addItemStackToInventory(new ItemStack(ModItems.debris_graphite))) this.setDead(); break; + case LID: if(player.inventory.addItemStackToInventory(new ItemStack(ModItems.rbmk_lid))) this.setDead(); break; + case ROD: if(player.inventory.addItemStackToInventory(new ItemStack(ModItems.debris_metal))) this.setDead(); break; + } + + player.inventoryContainer.detectAndSendChanges(); + } + + return false; + } + @Override public void onUpdate() { + if(!hasSizeSet) { + + switch(this.getType()) { + case BLANK: this.setSize(0.5F, 0.5F); break; + case ELEMENT: this.setSize(1F, 1F); break; + case FUEL: this.setSize(0.25F, 0.25F); break; + case GRAPHITE: this.setSize(0.25F, 0.25F); break; + case LID: this.setSize(1F, 0.5F); break; + case ROD: this.setSize(0.75F, 0.5F); break; + } + + hasSizeSet = true; + } + this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; @@ -52,8 +110,59 @@ public class EntityRBMKDebris extends Entity { } } - if(this.ticksExisted > 1000) - this.setDead(); + if(!worldObj.isRemote) { + if(this.getType() == DebrisType.LID && motionY > 0) { + + Vec3 pos = Vec3.createVectorHelper(posX, posY, posZ); + Vec3 next = Vec3.createVectorHelper(posX + motionX * 2, posY + motionY * 2, posZ + motionZ * 2); + MovingObjectPosition mop = worldObj.func_147447_a(pos, next, false, false, false); + + if(mop != null && mop.typeOfHit == mop.typeOfHit.BLOCK) { + + int x = mop.blockX; + int y = mop.blockY; + int z = mop.blockZ; + + for(int i = -1; i <= 1; i++) { + for(int j = -1; j <= 1; j++) { + for(int k = -1; k <= 1; k++) { + + int rn = Math.abs(i) + Math.abs(j) + Math.abs(k); + + if(rn <= 1 || rand.nextInt(rn) == 0) + worldObj.setBlockToAir(x + i, y + j, z + k); + } + } + } + + this.setDead(); + } + } + + if(this.getType() == DebrisType.FUEL) { + List entities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, this.boundingBox.expand(10, 10, 10)); + + for(EntityLivingBase e : entities) { + e.addPotionEffect(new PotionEffect(HbmPotion.radiation.id, 60 * 20, 9)); + } + } + + if(!RBMKDials.getPermaScrap(worldObj) && this.ticksExisted > getLifetime() + this.getEntityId() % 50) + this.setDead(); + } + } + + private int getLifetime() { + + switch(this.getType()) { + case BLANK: return 3 * 60 * 20; + case ELEMENT: return 3 * 60 * 20; + case FUEL: return 10 * 60 * 20; + case GRAPHITE: return 15 * 60 * 20; + case LID: return 30 * 20; + case ROD: return 60 * 20; + default: return 0; + } } public void setType(DebrisType type) { @@ -73,6 +182,182 @@ public class EntityRBMKDebris extends Entity { protected void writeEntityToNBT(NBTTagCompound nbt) { nbt.setInteger("debtype", this.dataWatcher.getWatchableObjectInt(20)); } + + @Override + public void moveEntity(double moX, double moY, double moZ) { + + this.worldObj.theProfiler.startSection("move"); + this.ySize *= 0.4F; + + if(this.isInWeb) { + this.isInWeb = false; + } + + double initMoX = moX; + double initMoY = moY; + double initMoZ = moZ; + AxisAlignedBB axisalignedbb = this.boundingBox.copy(); + + List list = this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox.addCoord(moX, moY, moZ)); + + for(int i = 0; i < list.size(); ++i) { + moY = ((AxisAlignedBB) list.get(i)).calculateYOffset(this.boundingBox, moY); + } + + this.boundingBox.offset(0.0D, moY, 0.0D); + + if(!this.field_70135_K && initMoY != moY) { + moZ = 0.0D; + moY = 0.0D; + moX = 0.0D; + } + + boolean isGoingDown = this.onGround || initMoY != moY && initMoY < 0.0D; + int j; + + for(j = 0; j < list.size(); ++j) { + moX = ((AxisAlignedBB) list.get(j)).calculateXOffset(this.boundingBox, moX); + } + + this.boundingBox.offset(moX, 0.0D, 0.0D); + + if(!this.field_70135_K && initMoX != moX) { + moZ = 0.0D; + moY = 0.0D; + moX = 0.0D; + } + + for(j = 0; j < list.size(); ++j) { + moZ = ((AxisAlignedBB) list.get(j)).calculateZOffset(this.boundingBox, moZ); + } + + this.boundingBox.offset(0.0D, 0.0D, moZ); + + if(!this.field_70135_K && initMoZ != moZ) { + moZ = 0.0D; + moY = 0.0D; + moX = 0.0D; + } + + double d10; + double d11; + int k; + double d12; + + if(this.stepHeight > 0.0F && isGoingDown && this.ySize < 0.05F && (initMoX != moX || initMoZ != moZ)) { + d12 = moX; + d10 = moY; + d11 = moZ; + moX = initMoX; + moY = (double) this.stepHeight; + moZ = initMoZ; + AxisAlignedBB axisalignedbb1 = this.boundingBox.copy(); + this.boundingBox.setBB(axisalignedbb); + list = this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox.addCoord(initMoX, moY, initMoZ)); + + for(k = 0; k < list.size(); ++k) { + moY = ((AxisAlignedBB) list.get(k)).calculateYOffset(this.boundingBox, moY); + } + + this.boundingBox.offset(0.0D, moY, 0.0D); + + if(!this.field_70135_K && initMoY != moY) { + moZ = 0.0D; + moY = 0.0D; + moX = 0.0D; + } + + for(k = 0; k < list.size(); ++k) { + moX = ((AxisAlignedBB) list.get(k)).calculateXOffset(this.boundingBox, moX); + } + + this.boundingBox.offset(moX, 0.0D, 0.0D); + + if(!this.field_70135_K && initMoX != moX) { + moZ = 0.0D; + moY = 0.0D; + moX = 0.0D; + } + + for(k = 0; k < list.size(); ++k) { + moZ = ((AxisAlignedBB) list.get(k)).calculateZOffset(this.boundingBox, moZ); + } + + this.boundingBox.offset(0.0D, 0.0D, moZ); + + if(!this.field_70135_K && initMoZ != moZ) { + moZ = 0.0D; + moY = 0.0D; + moX = 0.0D; + } + + if(!this.field_70135_K && initMoY != moY) { + moZ = 0.0D; + moY = 0.0D; + moX = 0.0D; + } else { + moY = (double) (-this.stepHeight); + + for(k = 0; k < list.size(); ++k) { + moY = ((AxisAlignedBB) list.get(k)).calculateYOffset(this.boundingBox, moY); + } + + this.boundingBox.offset(0.0D, moY, 0.0D); + } + + if(d12 * d12 + d11 * d11 >= moX * moX + moZ * moZ) { + moX = d12; + moY = d10; + moZ = d11; + this.boundingBox.setBB(axisalignedbb1); + } + } + + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.startSection("rest"); + this.posX = (this.boundingBox.minX + this.boundingBox.maxX) / 2.0D; + this.posY = this.boundingBox.minY + (double) this.yOffset - (double) this.ySize; + this.posZ = (this.boundingBox.minZ + this.boundingBox.maxZ) / 2.0D; + this.isCollidedHorizontally = initMoX != moX || initMoZ != moZ; + this.isCollidedVertically = initMoY != moY; + this.onGround = initMoY != moY && initMoY < 0.0D; + this.isCollided = this.isCollidedHorizontally || this.isCollidedVertically; + this.updateFallState(moY, this.onGround); + + if(initMoX != moX) { + //this.motionX = 0.0D; + this.motionX *= -0.75D; + + } + + if(initMoY != moY) { + this.motionY = 0.0D; + } + + if(initMoZ != moZ) { + //this.motionZ = 0.0D; + this.motionZ *= -0.75D; + } + + try { + this.func_145775_I(); + } catch(Throwable throwable) { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Checking entity block collision"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Entity being checked for collision"); + this.addEntityCrashInfo(crashreportcategory); + throw new ReportedException(crashreport); + } + + this.worldObj.theProfiler.endSection(); + } + + @Override + @SideOnly(Side.CLIENT) + public boolean isInRangeToRenderDist(double dist) { + + int range = 128; + return dist < range * range; + } public static enum DebrisType { BLANK, //just a metal beam diff --git a/src/main/java/com/hbm/explosion/ExplosionNT.java b/src/main/java/com/hbm/explosion/ExplosionNT.java index 625b150dd..8b02b8e07 100644 --- a/src/main/java/com/hbm/explosion/ExplosionNT.java +++ b/src/main/java/com/hbm/explosion/ExplosionNT.java @@ -30,267 +30,242 @@ import net.minecraft.world.World; public class ExplosionNT extends Explosion { public Set atttributes = new HashSet(); - - private Random explosionRNG = new Random(); - private World worldObj; - protected int field_77289_h = 16; - protected Map affectedEntities = new HashMap(); - - public static final List nukeAttribs = Arrays.asList(new ExAttrib[] {ExAttrib.FIRE, ExAttrib.NOPARTICLE, ExAttrib.NOSOUND, ExAttrib.NODROP, ExAttrib.NOHURT}); + + private Random explosionRNG = new Random(); + private World worldObj; + protected int field_77289_h = 16; + protected Map affectedEntities = new HashMap(); + + public static final List nukeAttribs = Arrays.asList(new ExAttrib[] { ExAttrib.FIRE, ExAttrib.NOPARTICLE, ExAttrib.NOSOUND, ExAttrib.NODROP, ExAttrib.NOHURT }); public ExplosionNT(World world, Entity exploder, double x, double y, double z, float strength) { super(world, exploder, x, y, z, strength); this.worldObj = world; } - + public ExplosionNT addAttrib(ExAttrib attrib) { atttributes.add(attrib); return this; } - + public ExplosionNT addAllAttrib(List attrib) { atttributes.addAll(attrib); return this; } - + public ExplosionNT overrideResolution(int res) { field_77289_h = res; return this; } - - public void explode() { - doExplosionA(); - doExplosionB(false); - } - - public void doExplosionA() - { - float f = this.explosionSize; - HashSet hashset = new HashSet(); - int i; - int j; - int k; - double d5; - double d6; - double d7; - for (i = 0; i < this.field_77289_h; ++i) - { - for (j = 0; j < this.field_77289_h; ++j) - { - for (k = 0; k < this.field_77289_h; ++k) - { - if (i == 0 || i == this.field_77289_h - 1 || j == 0 || j == this.field_77289_h - 1 || k == 0 || k == this.field_77289_h - 1) - { - double d0 = (double)((float)i / ((float)this.field_77289_h - 1.0F) * 2.0F - 1.0F); - double d1 = (double)((float)j / ((float)this.field_77289_h - 1.0F) * 2.0F - 1.0F); - double d2 = (double)((float)k / ((float)this.field_77289_h - 1.0F) * 2.0F - 1.0F); - double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2); - d0 /= d3; - d1 /= d3; - d2 /= d3; - float f1 = this.explosionSize * (0.7F + this.worldObj.rand.nextFloat() * 0.6F); - d5 = this.explosionX; - d6 = this.explosionY; - d7 = this.explosionZ; + public void explode() { + doExplosionA(); + doExplosionB(false); + } - for (float f2 = 0.3F; f1 > 0.0F; f1 -= f2 * 0.75F) - { - int j1 = MathHelper.floor_double(d5); - int k1 = MathHelper.floor_double(d6); - int l1 = MathHelper.floor_double(d7); - Block block = this.worldObj.getBlock(j1, k1, l1); + public void doExplosionA() { + float f = this.explosionSize; + HashSet hashset = new HashSet(); + int i; + int j; + int k; + double d5; + double d6; + double d7; - if (block.getMaterial() != Material.air) - { - float f3 = this.exploder != null ? this.exploder.func_145772_a(this, this.worldObj, j1, k1, l1, block) : block.getExplosionResistance(this.exploder, worldObj, j1, k1, l1, explosionX, explosionY, explosionZ); - f1 -= (f3 + 0.3F) * f2; - } + for(i = 0; i < this.field_77289_h; ++i) { + for(j = 0; j < this.field_77289_h; ++j) { + for(k = 0; k < this.field_77289_h; ++k) { + if(i == 0 || i == this.field_77289_h - 1 || j == 0 || j == this.field_77289_h - 1 || k == 0 || k == this.field_77289_h - 1) { + double d0 = (double) ((float) i / ((float) this.field_77289_h - 1.0F) * 2.0F - 1.0F); + double d1 = (double) ((float) j / ((float) this.field_77289_h - 1.0F) * 2.0F - 1.0F); + double d2 = (double) ((float) k / ((float) this.field_77289_h - 1.0F) * 2.0F - 1.0F); + double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2); + d0 /= d3; + d1 /= d3; + d2 /= d3; + float f1 = this.explosionSize * (0.7F + this.worldObj.rand.nextFloat() * 0.6F); + d5 = this.explosionX; + d6 = this.explosionY; + d7 = this.explosionZ; - if (f1 > 0.0F && (this.exploder == null || this.exploder.func_145774_a(this, this.worldObj, j1, k1, l1, block, f1))) - { - hashset.add(new ChunkPosition(j1, k1, l1)); - } + for(float f2 = 0.3F; f1 > 0.0F; f1 -= f2 * 0.75F) { + int j1 = MathHelper.floor_double(d5); + int k1 = MathHelper.floor_double(d6); + int l1 = MathHelper.floor_double(d7); + Block block = this.worldObj.getBlock(j1, k1, l1); - d5 += d0 * (double)f2; - d6 += d1 * (double)f2; - d7 += d2 * (double)f2; - } - } - } - } - } + if(block.getMaterial() != Material.air) { + float f3 = this.exploder != null ? this.exploder.func_145772_a(this, this.worldObj, j1, k1, l1, block) : block.getExplosionResistance(this.exploder, worldObj, j1, k1, l1, explosionX, explosionY, explosionZ); + f1 -= (f3 + 0.3F) * f2; + } - this.affectedBlockPositions.addAll(hashset); - - if(!has(ExAttrib.NOHURT)) { - - this.explosionSize *= 2.0F; - i = MathHelper.floor_double(this.explosionX - (double)this.explosionSize - 1.0D); - j = MathHelper.floor_double(this.explosionX + (double)this.explosionSize + 1.0D); - k = MathHelper.floor_double(this.explosionY - (double)this.explosionSize - 1.0D); - int i2 = MathHelper.floor_double(this.explosionY + (double)this.explosionSize + 1.0D); - int l = MathHelper.floor_double(this.explosionZ - (double)this.explosionSize - 1.0D); - int j2 = MathHelper.floor_double(this.explosionZ + (double)this.explosionSize + 1.0D); - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, AxisAlignedBB.getBoundingBox((double)i, (double)k, (double)l, (double)j, (double)i2, (double)j2)); - net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.worldObj, this, list, this.explosionSize); - Vec3 vec3 = Vec3.createVectorHelper(this.explosionX, this.explosionY, this.explosionZ); - - for (int i1 = 0; i1 < list.size(); ++i1) - { - Entity entity = (Entity)list.get(i1); - double d4 = entity.getDistance(this.explosionX, this.explosionY, this.explosionZ) / (double)this.explosionSize; - - if (d4 <= 1.0D) - { - d5 = entity.posX - this.explosionX; - d6 = entity.posY + (double)entity.getEyeHeight() - this.explosionY; - d7 = entity.posZ - this.explosionZ; - double d9 = (double)MathHelper.sqrt_double(d5 * d5 + d6 * d6 + d7 * d7); - - if (d9 != 0.0D) - { - d5 /= d9; - d6 /= d9; - d7 /= d9; - double d10 = (double)this.worldObj.getBlockDensity(vec3, entity.boundingBox); - double d11 = (1.0D - d4) * d10; - entity.attackEntityFrom(DamageSource.setExplosionSource(this), (float)((int)((d11 * d11 + d11) / 2.0D * 8.0D * (double)this.explosionSize + 1.0D))); - double d8 = EnchantmentProtection.func_92092_a(entity, d11); - entity.motionX += d5 * d8; - entity.motionY += d6 * d8; - entity.motionZ += d7 * d8; - - if (entity instanceof EntityPlayer) - { - this.affectedEntities.put((EntityPlayer)entity, Vec3.createVectorHelper(d5 * d11, d6 * d11, d7 * d11)); - } - } - } - } - - this.explosionSize = f; - } - } - - public void doExplosionB(boolean p_77279_1_) { - - if(!has(ExAttrib.NOSOUND)) - this.worldObj.playSoundEffect(this.explosionX, this.explosionY, this.explosionZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F); + if(f1 > 0.0F && (this.exploder == null || this.exploder.func_145774_a(this, this.worldObj, j1, k1, l1, block, f1))) { + hashset.add(new ChunkPosition(j1, k1, l1)); + } - if (!has(ExAttrib.NOPARTICLE)) { - if (this.explosionSize >= 2.0F && this.isSmoking) - { - this.worldObj.spawnParticle("hugeexplosion", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D); - } - else - { - this.worldObj.spawnParticle("largeexplode", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D); - } - } + d5 += d0 * (double) f2; + d6 += d1 * (double) f2; + d7 += d2 * (double) f2; + } + } + } + } + } - Iterator iterator; - ChunkPosition chunkposition; - int i; - int j; - int k; - Block block; + this.affectedBlockPositions.addAll(hashset); - if (this.isSmoking) - { - iterator = this.affectedBlockPositions.iterator(); + if(!has(ExAttrib.NOHURT)) { - while (iterator.hasNext()) - { - chunkposition = (ChunkPosition)iterator.next(); - i = chunkposition.chunkPosX; - j = chunkposition.chunkPosY; - k = chunkposition.chunkPosZ; - block = this.worldObj.getBlock(i, j, k); + this.explosionSize *= 2.0F; + i = MathHelper.floor_double(this.explosionX - (double) this.explosionSize - 1.0D); + j = MathHelper.floor_double(this.explosionX + (double) this.explosionSize + 1.0D); + k = MathHelper.floor_double(this.explosionY - (double) this.explosionSize - 1.0D); + int i2 = MathHelper.floor_double(this.explosionY + (double) this.explosionSize + 1.0D); + int l = MathHelper.floor_double(this.explosionZ - (double) this.explosionSize - 1.0D); + int j2 = MathHelper.floor_double(this.explosionZ + (double) this.explosionSize + 1.0D); + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, AxisAlignedBB.getBoundingBox((double) i, (double) k, (double) l, (double) j, (double) i2, (double) j2)); + net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.worldObj, this, list, this.explosionSize); + Vec3 vec3 = Vec3.createVectorHelper(this.explosionX, this.explosionY, this.explosionZ); - if (!has(ExAttrib.NOPARTICLE)) - { - double d0 = (double)((float)i + this.worldObj.rand.nextFloat()); - double d1 = (double)((float)j + this.worldObj.rand.nextFloat()); - double d2 = (double)((float)k + this.worldObj.rand.nextFloat()); - double d3 = d0 - this.explosionX; - double d4 = d1 - this.explosionY; - double d5 = d2 - this.explosionZ; - double d6 = (double)MathHelper.sqrt_double(d3 * d3 + d4 * d4 + d5 * d5); - d3 /= d6; - d4 /= d6; - d5 /= d6; - double d7 = 0.5D / (d6 / (double)this.explosionSize + 0.1D); - d7 *= (double)(this.worldObj.rand.nextFloat() * this.worldObj.rand.nextFloat() + 0.3F); - d3 *= d7; - d4 *= d7; - d5 *= d7; - this.worldObj.spawnParticle("explode", (d0 + this.explosionX * 1.0D) / 2.0D, (d1 + this.explosionY * 1.0D) / 2.0D, (d2 + this.explosionZ * 1.0D) / 2.0D, d3, d4, d5); - this.worldObj.spawnParticle("smoke", d0, d1, d2, d3, d4, d5); - } + for(int i1 = 0; i1 < list.size(); ++i1) { + Entity entity = (Entity) list.get(i1); + double d4 = entity.getDistance(this.explosionX, this.explosionY, this.explosionZ) / (double) this.explosionSize; - if (block.getMaterial() != Material.air) - { - if (block.canDropFromExplosion(this) && !has(ExAttrib.NODROP)) - { - float chance = 1.0F; - - if(!has(ExAttrib.ALLDROP)) - chance = 1.0F / this.explosionSize; - - block.dropBlockAsItemWithChance(this.worldObj, i, j, k, this.worldObj.getBlockMetadata(i, j, k), chance, 0); - } + if(d4 <= 1.0D) { + d5 = entity.posX - this.explosionX; + d6 = entity.posY + (double) entity.getEyeHeight() - this.explosionY; + d7 = entity.posZ - this.explosionZ; + double d9 = (double) MathHelper.sqrt_double(d5 * d5 + d6 * d6 + d7 * d7); - block.onBlockExploded(this.worldObj, i, j, k, this); - } - } - } + if(d9 != 0.0D) { + d5 /= d9; + d6 /= d9; + d7 /= d9; + double d10 = (double) this.worldObj.getBlockDensity(vec3, entity.boundingBox); + double d11 = (1.0D - d4) * d10; + entity.attackEntityFrom(DamageSource.setExplosionSource(this), (float) ((int) ((d11 * d11 + d11) / 2.0D * 8.0D * (double) this.explosionSize + 1.0D))); + double d8 = EnchantmentProtection.func_92092_a(entity, d11); + entity.motionX += d5 * d8; + entity.motionY += d6 * d8; + entity.motionZ += d7 * d8; - if(has(ExAttrib.FIRE) || has(ExAttrib.BALEFIRE) || has(ExAttrib.LAVA)) - { - iterator = this.affectedBlockPositions.iterator(); + if(entity instanceof EntityPlayer) { + this.affectedEntities.put((EntityPlayer) entity, Vec3.createVectorHelper(d5 * d11, d6 * d11, d7 * d11)); + } + } + } + } - while (iterator.hasNext()) - { - chunkposition = (ChunkPosition)iterator.next(); - i = chunkposition.chunkPosX; - j = chunkposition.chunkPosY; - k = chunkposition.chunkPosZ; - block = this.worldObj.getBlock(i, j, k); - Block block1 = this.worldObj.getBlock(i, j - 1, k); + this.explosionSize = f; + } + } - boolean shouldReplace = true; - - if(!has(ExAttrib.ALLMOD)) - shouldReplace = this.explosionRNG.nextInt(3) == 0; - - if (block.getMaterial() == Material.air && block1.func_149730_j() && shouldReplace) - { - if(has(ExAttrib.FIRE)) - this.worldObj.setBlock(i, j, k, Blocks.fire); - else if(has(ExAttrib.BALEFIRE)) - this.worldObj.setBlock(i, j, k, ModBlocks.balefire); - else if(has(ExAttrib.LAVA)) - this.worldObj.setBlock(i, j, k, Blocks.flowing_lava); - } - } - } - } + public void doExplosionB(boolean p_77279_1_) { - public Map func_77277_b() - { - return this.affectedEntities; - } - - public EntityLivingBase getExplosivePlacedBy() - { - return this.exploder == null ? null : (this.exploder instanceof EntityTNTPrimed ? ((EntityTNTPrimed)this.exploder).getTntPlacedBy() : (this.exploder instanceof EntityLivingBase ? (EntityLivingBase)this.exploder : null)); - } - - //unconventional name, sure, but it's short - public boolean has(ExAttrib attrib) { - return this.atttributes.contains(attrib); - } + if(!has(ExAttrib.NOSOUND)) + this.worldObj.playSoundEffect(this.explosionX, this.explosionY, this.explosionZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F); + + if(!has(ExAttrib.NOPARTICLE)) { + if(this.explosionSize >= 2.0F && this.isSmoking) { + this.worldObj.spawnParticle("hugeexplosion", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D); + } else { + this.worldObj.spawnParticle("largeexplode", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D); + } + } + + Iterator iterator; + ChunkPosition chunkposition; + int i; + int j; + int k; + Block block; + + if(this.isSmoking) { + iterator = this.affectedBlockPositions.iterator(); + + while(iterator.hasNext()) { + chunkposition = (ChunkPosition) iterator.next(); + i = chunkposition.chunkPosX; + j = chunkposition.chunkPosY; + k = chunkposition.chunkPosZ; + block = this.worldObj.getBlock(i, j, k); + + if(!has(ExAttrib.NOPARTICLE)) { + double d0 = (double) ((float) i + this.worldObj.rand.nextFloat()); + double d1 = (double) ((float) j + this.worldObj.rand.nextFloat()); + double d2 = (double) ((float) k + this.worldObj.rand.nextFloat()); + double d3 = d0 - this.explosionX; + double d4 = d1 - this.explosionY; + double d5 = d2 - this.explosionZ; + double d6 = (double) MathHelper.sqrt_double(d3 * d3 + d4 * d4 + d5 * d5); + d3 /= d6; + d4 /= d6; + d5 /= d6; + double d7 = 0.5D / (d6 / (double) this.explosionSize + 0.1D); + d7 *= (double) (this.worldObj.rand.nextFloat() * this.worldObj.rand.nextFloat() + 0.3F); + d3 *= d7; + d4 *= d7; + d5 *= d7; + this.worldObj.spawnParticle("explode", (d0 + this.explosionX * 1.0D) / 2.0D, (d1 + this.explosionY * 1.0D) / 2.0D, (d2 + this.explosionZ * 1.0D) / 2.0D, d3, d4, d5); + this.worldObj.spawnParticle("smoke", d0, d1, d2, d3, d4, d5); + } + + if(block.getMaterial() != Material.air) { + if(block.canDropFromExplosion(this) && !has(ExAttrib.NODROP)) { + float chance = 1.0F; + + if(!has(ExAttrib.ALLDROP)) + chance = 1.0F / this.explosionSize; + + block.dropBlockAsItemWithChance(this.worldObj, i, j, k, this.worldObj.getBlockMetadata(i, j, k), chance, 0); + } + + block.onBlockExploded(this.worldObj, i, j, k, this); + } + } + } + + if(has(ExAttrib.FIRE) || has(ExAttrib.BALEFIRE) || has(ExAttrib.LAVA)) { + iterator = this.affectedBlockPositions.iterator(); + + while(iterator.hasNext()) { + chunkposition = (ChunkPosition) iterator.next(); + i = chunkposition.chunkPosX; + j = chunkposition.chunkPosY; + k = chunkposition.chunkPosZ; + block = this.worldObj.getBlock(i, j, k); + Block block1 = this.worldObj.getBlock(i, j - 1, k); + + boolean shouldReplace = true; + + if(!has(ExAttrib.ALLMOD)) + shouldReplace = this.explosionRNG.nextInt(3) == 0; + + if(block.getMaterial() == Material.air && block1.func_149730_j() && shouldReplace) { + if(has(ExAttrib.FIRE)) + this.worldObj.setBlock(i, j, k, Blocks.fire); + else if(has(ExAttrib.BALEFIRE)) + this.worldObj.setBlock(i, j, k, ModBlocks.balefire); + else if(has(ExAttrib.LAVA)) + this.worldObj.setBlock(i, j, k, Blocks.flowing_lava); + } + } + } + } + + public Map func_77277_b() { + return this.affectedEntities; + } + + public EntityLivingBase getExplosivePlacedBy() { + return this.exploder == null ? null : (this.exploder instanceof EntityTNTPrimed ? ((EntityTNTPrimed) this.exploder).getTntPlacedBy() : (this.exploder instanceof EntityLivingBase ? (EntityLivingBase) this.exploder : null)); + } + + // unconventional name, sure, but it's short + public boolean has(ExAttrib attrib) { + return this.atttributes.contains(attrib); + } //this solution is a bit hacky but in the end easier to work with public static enum ExAttrib { diff --git a/src/main/java/com/hbm/inventory/ShredderRecipes.java b/src/main/java/com/hbm/inventory/ShredderRecipes.java index 5f787fac5..9df6b02cf 100644 --- a/src/main/java/com/hbm/inventory/ShredderRecipes.java +++ b/src/main/java/com/hbm/inventory/ShredderRecipes.java @@ -200,6 +200,7 @@ public class ShredderRecipes { ShredderRecipes.setRecipe(ModBlocks.crate_tungsten, new ItemStack(ModItems.powder_tungsten, 36)); ShredderRecipes.setRecipe(Blocks.anvil, new ItemStack(ModItems.powder_iron, 31)); ShredderRecipes.setRecipe(ModBlocks.chain, new ItemStack(ModItems.powder_steel_tiny, 1)); + ShredderRecipes.setRecipe(ModBlocks.steel_grate, new ItemStack(ModItems.powder_steel_tiny, 3)); ShredderRecipes.setRecipe(ModBlocks.turret_light, new ItemStack(ModItems.powder_steel, 16)); ShredderRecipes.setRecipe(ModBlocks.turret_heavy, new ItemStack(ModItems.powder_steel, 16)); diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index 72a47bdb5..a617d8dd2 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -958,6 +958,10 @@ public class ModItems { public static Item waste_mox_hot; public static Item waste_schrabidium_hot; + public static Item debris_graphite; + public static Item debris_metal; + public static Item debris_fuel; + public static Item containment_box; public static Item recycled_ground; @@ -3224,6 +3228,10 @@ public class ModItems { rod_dual_waste = new ItemHazard(30F).setUnlocalizedName("rod_dual_waste").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.rod_dual_empty).setTextureName(RefStrings.MODID + ":rod_dual_waste"); rod_quad_waste = new ItemHazard(60F).setUnlocalizedName("rod_quad_waste").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.rod_quad_empty).setTextureName(RefStrings.MODID + ":rod_quad_waste"); + debris_graphite = new ItemHazard().addRadiation(70F).toItem().setUnlocalizedName("debris_graphite").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":debris_graphite"); + debris_metal = new ItemHazard().addRadiation(5F).toItem().setUnlocalizedName("debris_metal").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":debris_metal"); + debris_fuel = new ItemHazard().addRadiation(1500F).addFire(15).toItem().setUnlocalizedName("debris_fuel").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":debris_fuel"); + pellet_cluster = new ItemCustomLore().setUnlocalizedName("pellet_cluster").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":pellet_cluster"); powder_fire = new ItemCustomLore().setUnlocalizedName("powder_fire").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_red_phosphorus"); powder_ice = new ItemCustomLore().setUnlocalizedName("powder_ice").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_ice"); @@ -5836,6 +5844,10 @@ public class ModItems { GameRegistry.registerItem(rbmk_fuel_balefire, rbmk_fuel_balefire.getUnlocalizedName()); GameRegistry.registerItem(rbmk_fuel_drx, rbmk_fuel_drx.getUnlocalizedName()); + GameRegistry.registerItem(debris_graphite, debris_graphite.getUnlocalizedName()); + GameRegistry.registerItem(debris_metal, debris_metal.getUnlocalizedName()); + GameRegistry.registerItem(debris_fuel, debris_fuel.getUnlocalizedName()); + GameRegistry.registerItem(scrap, scrap.getUnlocalizedName()); GameRegistry.registerItem(waste_uranium_hot, waste_uranium_hot.getUnlocalizedName()); GameRegistry.registerItem(waste_thorium_hot, waste_thorium_hot.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/items/armor/ItemModMilk.java b/src/main/java/com/hbm/items/armor/ItemModMilk.java index 5fd25a75e..1985c6b17 100644 --- a/src/main/java/com/hbm/items/armor/ItemModMilk.java +++ b/src/main/java/com/hbm/items/armor/ItemModMilk.java @@ -6,6 +6,7 @@ import java.util.Iterator; import java.util.List; import com.hbm.handler.ArmorModHandler; +import com.hbm.potion.HbmPotion; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -44,7 +45,7 @@ public class ItemModMilk extends ItemArmorMod { PotionEffect eff = (PotionEffect) iterator.next(); - if(Potion.potionTypes[eff.getPotionID()].isBadEffect()) { + if(HbmPotion.getIsBadEffect(Potion.potionTypes[eff.getPotionID()])) { ints.add(eff.getPotionID()); } } diff --git a/src/main/java/com/hbm/items/machine/ItemRBMKRod.java b/src/main/java/com/hbm/items/machine/ItemRBMKRod.java index eaea22111..e0fcc6dbc 100644 --- a/src/main/java/com/hbm/items/machine/ItemRBMKRod.java +++ b/src/main/java/com/hbm/items/machine/ItemRBMKRod.java @@ -158,6 +158,17 @@ public class ItemRBMKRod extends ItemHazard { double hullHeat = this.getHullHeat(stack); + //metldown! the hull melts so the entire structure stops making sense + //hull and core heats are instantly equalized into 33% of their sum each, + //the rest is sent to the component which is always fatal + if(hullHeat > this.meltingPoint) { + double coreHeat = this.getCoreHeat(stack); + double avg = (heat + hullHeat + coreHeat) / 3D; + this.setCoreHeat(stack, avg); + this.setHullHeat(stack, avg); + return avg; + } + if(hullHeat <= heat) return 0; diff --git a/src/main/java/com/hbm/main/ClientProxy.java b/src/main/java/com/hbm/main/ClientProxy.java index 2477fdba3..a08fbce9e 100644 --- a/src/main/java/com/hbm/main/ClientProxy.java +++ b/src/main/java/com/hbm/main/ClientProxy.java @@ -541,6 +541,7 @@ public class ClientProxy extends ServerProxy { RenderingRegistry.registerBlockHandler(new RenderSpikeBlock()); RenderingRegistry.registerBlockHandler(new RenderChain()); RenderingRegistry.registerBlockHandler(new RenderMirror()); + RenderingRegistry.registerBlockHandler(new RenderGrate()); RenderingRegistry.registerBlockHandler(new RenderRBMKRod()); RenderingRegistry.registerBlockHandler(new RenderRBMKReflector()); diff --git a/src/main/java/com/hbm/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index 6bd3aaa0f..56c0359bb 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -380,6 +380,7 @@ public class CraftingManager { GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.steel_scaffold), 8), new Object[] { "SSS", " S ", "SSS", 'S', "ingotSteel" })); GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.steel_beam), 8), new Object[] { "S", "S", "S", 'S', ModBlocks.steel_scaffold }); GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.chain), 8), new Object[] { "S", "S", "S", 'S', ModBlocks.steel_beam }); + GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.steel_grate), 4), new Object[] { "SS", "SS", 'S', ModBlocks.steel_beam }); reg2(); } diff --git a/src/main/java/com/hbm/particle/ParticleRBMKFlame.java b/src/main/java/com/hbm/particle/ParticleRBMKFlame.java index 4e210f86b..696896552 100644 --- a/src/main/java/com/hbm/particle/ParticleRBMKFlame.java +++ b/src/main/java/com/hbm/particle/ParticleRBMKFlame.java @@ -91,6 +91,7 @@ public class ParticleRBMKFlame extends EntityFX { GL11.glPolygonOffset(0.0F, 0.0F); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glEnable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); } diff --git a/src/main/java/com/hbm/potion/HbmPotion.java b/src/main/java/com/hbm/potion/HbmPotion.java index abf6a4a6f..242c87530 100644 --- a/src/main/java/com/hbm/potion/HbmPotion.java +++ b/src/main/java/com/hbm/potion/HbmPotion.java @@ -156,24 +156,34 @@ public class HbmPotion extends Potion { public boolean isReady(int par1, int par2) { if(this == taint) { - - return par1 % 2 == 0; + return par1 % 2 == 0; } + if(this == radiation || this == radaway || this == telekinesis || this == phosphorus) { - return true; } + if(this == bang) { - return par1 <= 10; } + if(this == lead) { - int k = 60; - return k > 0 ? par1 % k == 0 : true; + return k > 0 ? par1 % k == 0 : true; } return false; } - + + public static boolean getIsBadEffect(Potion potion) { + + try { + Field isBadEffect = ReflectionHelper.findField(Potion.class, "isBadEffect", "field_76418_K"); + boolean ret = isBadEffect.getBoolean(potion); + return ret; + + } catch (Exception x) { + return false; + } + } } diff --git a/src/main/java/com/hbm/render/block/RenderGrate.java b/src/main/java/com/hbm/render/block/RenderGrate.java new file mode 100644 index 000000000..cf8eb161a --- /dev/null +++ b/src/main/java/com/hbm/render/block/RenderGrate.java @@ -0,0 +1,39 @@ +package com.hbm.render.block; + +import com.hbm.blocks.generic.BlockGrate; + +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.world.IBlockAccess; + +public class RenderGrate implements ISimpleBlockRenderingHandler { + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { } + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + + Tessellator tessellator = Tessellator.instance; + int meta = world.getBlockMetadata(x, y, z); + + tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z)); + tessellator.setColorOpaque_F(1, 1, 1); + + renderer.setRenderBounds(0.0D, meta * 0.125D, 0D, 1D, meta * 0.125D + 0.125D, 1D); + renderer.renderStandardBlock(block, x, y, z); + return true; + } + + @Override + public boolean shouldRender3DInInventory(int modelId) { + return false; + } + + @Override + public int getRenderId() { + return BlockGrate.renderID; + } +} diff --git a/src/main/java/com/hbm/render/tileentity/RenderRBMKControlRod.java b/src/main/java/com/hbm/render/tileentity/RenderRBMKControlRod.java index a279ef235..5984b1818 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderRBMKControlRod.java +++ b/src/main/java/com/hbm/render/tileentity/RenderRBMKControlRod.java @@ -22,13 +22,25 @@ public class RenderRBMKControlRod extends TileEntitySpecialRenderer { public void renderTileEntityAt(TileEntity te, double x, double y, double z, float i) { GL11.glPushMatrix(); - GL11.glTranslated(x + 0.5, y + 3, z + 0.5); + + TileEntityRBMKControl control = (TileEntityRBMKControl)te; + + int offset = 1; + + for(int o = 1; o < 16; o++) { + + if(te.getWorldObj().getBlock(te.xCoord, te.yCoord + o, te.zCoord) == te.getBlockType()) { + offset = o; + } else { + break; + } + } + + GL11.glTranslated(x + 0.5, y + offset, z + 0.5); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_CULL_FACE); - TileEntityRBMKControl control = (TileEntityRBMKControl)te; - bindTexture(texture); double level = control.lastLevel + (control.level - control.lastLevel) * i; diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/RBMKDials.java b/src/main/java/com/hbm/tileentity/machine/rbmk/RBMKDials.java index 67be69295..65012ab66 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/RBMKDials.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/RBMKDials.java @@ -10,6 +10,8 @@ public class RBMKDials { public static final String KEY_COLUMN_HEAT_FLOW = "dialColumnHeatFlow"; public static final String KEY_FUEL_DIFFUSION_MOD = "dialDiffusionMod"; public static final String KEY_HEAT_PROVISION = "dialHeatProvision"; + public static final String KEY_COLUMN_HEIGHT = "dialColumnHeight"; + public static final String KEY_PERMANENT_SCRAP = "dialEnablePermaScrap"; public static void createDials(World world) { GameRules rules = world.getGameRules(); @@ -18,6 +20,8 @@ public class RBMKDials { rules.setOrCreateGameRule(KEY_COLUMN_HEAT_FLOW, "0.2"); rules.setOrCreateGameRule(KEY_FUEL_DIFFUSION_MOD, "1.0"); rules.setOrCreateGameRule(KEY_HEAT_PROVISION, "0.2"); + rules.setOrCreateGameRule(KEY_COLUMN_HEIGHT, "4"); + rules.setOrCreateGameRule(KEY_PERMANENT_SCRAP, "false"); } public static double getPassiveCooling(World world) { @@ -39,6 +43,14 @@ public class RBMKDials { return MathHelper.clamp_double(shittyWorkaroundParseDouble(world.getGameRules().getGameRuleStringValue(KEY_HEAT_PROVISION), 0.2D), 0.0D, 1.0D); } + public static int getColumnHeight(World world) { + return MathHelper.clamp_int(shittyWorkaroundParseInt(world.getGameRules().getGameRuleStringValue(KEY_COLUMN_HEIGHT), 4), 1, 16) - 1; + } + + public static boolean getPermaScrap(World world) { + return world.getGameRules().getGameRuleBooleanValue(KEY_PERMANENT_SCRAP); + } + //why make the double representation accessible in a game rule when you can just force me to add a second pointless parsing operation? public static double shittyWorkaroundParseDouble(String s, double def) { @@ -46,6 +58,14 @@ public class RBMKDials { return Double.parseDouble(s); } catch(Exception ex) { } + return def; + } + public static int shittyWorkaroundParseInt(String s, int def) { + + try { + return Integer.parseInt(s); + } catch(Exception ex) { } + return def; } } diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBase.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBase.java index 69f9eed48..baa32f6cf 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBase.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBase.java @@ -22,13 +22,13 @@ import com.hbm.util.I18nUtil; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent; @@ -69,6 +69,10 @@ public abstract class TileEntityRBMKBase extends TileEntity implements INBTPacke return true; } + public int trackingRange() { + return 25; + } + @Override public void updateEntity() { @@ -82,10 +86,6 @@ public abstract class TileEntityRBMKBase extends TileEntity implements INBTPacke } } - public int trackingRange() { - return 25; - } - public static final ForgeDirection[] heatDirs = new ForgeDirection[] { ForgeDirection.NORTH, ForgeDirection.EAST, @@ -278,7 +278,14 @@ public abstract class TileEntityRBMKBase extends TileEntity implements INBTPacke EntityRBMKDebris debris = new EntityRBMKDebris(worldObj, xCoord + 0.5D, yCoord + 4D, zCoord + 0.5D, type); debris.motionX = worldObj.rand.nextGaussian() * 0.25D; debris.motionZ = worldObj.rand.nextGaussian() * 0.25D; - debris.motionY = 1D + worldObj.rand.nextDouble(); + debris.motionY = 0.25D + worldObj.rand.nextDouble() * 1.25D; + + if(type == DebrisType.LID) { + debris.motionX *= 0.5D; + debris.motionY += 0.5D; + debris.motionZ *= 0.5D; + } + worldObj.spawnEntityInWorld(debris); } @@ -320,6 +327,25 @@ public abstract class TileEntityRBMKBase extends TileEntity implements INBTPacke rbmk.onMelt(minDist + 1); } + for(TileEntityRBMKBase rbmk : columns) { + + if(rbmk instanceof TileEntityRBMKRod && worldObj.getBlock(rbmk.xCoord, rbmk.yCoord, rbmk.zCoord) == ModBlocks.corium_block) { + + for(int x = rbmk.xCoord - 1; x <= rbmk.xCoord + 1; x ++) { + for(int y = rbmk.yCoord - 1; y <= rbmk.yCoord + 1; y ++) { + for(int z = rbmk.zCoord - 1; z <= rbmk.zCoord + 1; z ++) { + + Block b = worldObj.getBlock(x, y, z); + + if(worldObj.rand.nextInt(3) == 0 && (b == ModBlocks.pribris || b == ModBlocks.pribris_burning)) { + worldObj.setBlock(x, y, z, ModBlocks.pribris_radiating); + } + } + } + } + } + } + int smallDim = Math.min(maxX - minX, maxZ - minZ); int avgX = minX + (maxX - minX) / 2; int avgZ = minZ + (maxZ - minZ) / 2; @@ -329,6 +355,8 @@ public abstract class TileEntityRBMKBase extends TileEntity implements INBTPacke data.setFloat("scale", smallDim); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, avgX + 0.5, yCoord + 1, avgZ + 0.5), new TargetPoint(worldObj.provider.dimensionId,avgX + 0.5, yCoord + 1, avgZ + 0.5, 250)); MainRegistry.proxy.effectNT(data); + + worldObj.playSoundEffect(avgX + 0.5, yCoord + 1, avgZ + 0.5, "hbm:block.rbmk_explosion", 50.0F, 1.0F); } private void getFF(int x, int y, int z) { diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRod.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRod.java index a79e01360..900024478 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRod.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRod.java @@ -54,6 +54,11 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM rod.updateHeat(worldObj, slots[0]); this.heat += rod.provideHeat(worldObj, slots[0], heat); + if(this.heat > this.maxHeat()) { + this.meltdown(); + return; + } + //for spreading, we want the buffered flux to be 0 because we want to know exactly how much gets reflected back this.fluxFast = 0; this.fluxSlow = 0; @@ -181,11 +186,14 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM if(worldObj.rand.nextInt(3) == 0) reduce++; + boolean corium = slots[0] != null && slots[0].getItem() instanceof ItemRBMKRod; + slots[0] = null; + for(int i = 3; i >= 0; i--) { if(i <= 4 - reduce) { - if(slots[0] != null && slots[0].getItem() instanceof ItemRBMKRod) { + if(corium) { worldObj.setBlock(xCoord, yCoord + i, zCoord, ModBlocks.corium_block); } else { @@ -203,7 +211,7 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM worldObj.markBlockForUpdate(xCoord, yCoord + i, zCoord); } - if(slots[0] != null && slots[0].getItem() instanceof ItemRBMKRod) { + if(corium) { int count = 1 + worldObj.rand.nextInt(3); for(int i = 0; i < count; i++) { diff --git a/src/main/resources/assets/hbm/lang/de_DE.lang b/src/main/resources/assets/hbm/lang/de_DE.lang index 451fbbe02..afe85734b 100644 --- a/src/main/resources/assets/hbm/lang/de_DE.lang +++ b/src/main/resources/assets/hbm/lang/de_DE.lang @@ -995,6 +995,9 @@ item.custom_nuke.name=AB - Nukleares Element item.custom_schrab.name=AB - Schrabidiumelement item.custom_tnt.name=AB - Sprengladung item.cyclotron_tower.name=Zyklotronenturm +item.debris_fuel.name=RBMK-Kernbrennstoffbrocken +item.debris_graphite.name=Heißer Graphitbrocken +item.debris_metal.name=Gebrochene Metallleiste item.definitelyfood.name=GarantiertKeinDreck-Marken Feldration item.defuser.name=High-Tech Bombenentschärfungsgerät item.demon_core_closed.name=Bedeckter Dämonenkern @@ -2818,6 +2821,8 @@ tile.plasma.name=Plasma tile.plasma_heater.name=Plasmaerhitzer tile.pole_satellite_receiver.name=Satellitenschüssel tile.pole_top.name=Antennenspitze +tile.pribris.name=RBMK-Schutt +tile.pribris_burning.name=Flammender RBMK-Schutt tile.radiobox.name=Rosenberg Ungeziefervernichter tile.radiorec.name=Kaputtes UKW Radio tile.rail_booster.name=Hochgeschwindigkeits-Boosterschienen @@ -2877,6 +2882,7 @@ tile.soyuz_launcher.name=Soyuz-Startplatform tile.spikes.name=Stacheln tile.steel_beam.name=Stahlträger tile.steel_corner.name=Stahlwand (Ecke) +tile.steel_grate.name=Stahlgitter tile.steel_poles.name=Stahlmasten tile.steel_roof.name=Flaches Stachldach tile.steel_scaffold.name=Stahlgerüst diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index dbccb105e..f63a41a00 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -995,6 +995,9 @@ item.custom_nuke.name=Custom Nuke Nuclear Rod item.custom_schrab.name=Custom Nuke Schrabidium Rod item.custom_tnt.name=Custom Nuke Explosive Charge item.cyclotron_tower.name=Cyclotron Tower +item.debris_fuel.name=RBMK Fuel Chunk +item.debris_graphite.name=Hot Graphite Chunk +item.debris_metal.name=Broken Metal Bar item.definitelyfood.name=TotallyNotDirt-Brand MRE item.defuser.name=High-Tech Bomb Defusing Device item.demon_core_closed.name=Closed Demon Core @@ -2818,6 +2821,8 @@ tile.plasma.name=Plasma tile.plasma_heater.name=Plasma Heater tile.pole_satellite_receiver.name=Satellite Dish tile.pole_top.name=Antenna Top +tile.pribris.name=RBMK Debris +tile.pribris_burning.name=Flaming RBMK Debris tile.radiobox.name=Rosenberg Pest Control Box tile.radiorec.name=Broken FM Radio tile.rail_booster.name=High Speed Booster Rail @@ -2877,6 +2882,7 @@ tile.soyuz_launcher.name=Soyuz Launch Platform tile.spikes.name=Spikes tile.steel_beam.name=Steel Beam tile.steel_corner.name=Steel Wall Corner +tile.steel_grate.name=Steel Grate tile.steel_poles.name=Steel Pole tile.steel_roof.name=Flat Steel Roof tile.steel_scaffold.name=Steel Scaffold diff --git a/src/main/resources/assets/hbm/sounds.json b/src/main/resources/assets/hbm/sounds.json index 54defb5f7..62406873e 100644 --- a/src/main/resources/assets/hbm/sounds.json +++ b/src/main/resources/assets/hbm/sounds.json @@ -34,7 +34,8 @@ "block.closeDoor": {"category": "block", "sounds": ["block/door_close_1", "block/door_close_2"]}, "block.soyuzReady": {"category": "block", "sounds": [{"name": "block/soyuzReady", "stream": true}]}, "block.screm": {"category": "block", "sounds": ["screm/scream1", "screm/scream01", "screm/scream2", "screm/scream02", "screm/scream3", "screm/scream03", "screm/scream4", "screm/scream04", "screm/scream5", "screm/scream05", "screm/scream6", "screm/scream06", "screm/scream7", "screm/scream07", "screm/scream08", "screm/scream09", "screm/scream10", "screm/scream11", "screm/scream12", "screm/scream13", "screm/scream14", "screm/scream15", "screm/scream16", "screm/scream17", "screm/scream18", "screm/scream19", "screm/scream20", "screm/scream21", "screm/scream22", "screm/scream23", "screm/scream24", "screm/scream25"]}, - + "block.rbmk_explosion": {"category": "block", "sounds": [{"name": "block/rbmk_explosion", "stream": false}]}, + "item.techBleep": {"category": "player", "sounds": [{"name": "tool/techBleep", "stream": false}]}, "item.techBoop": {"category": "player", "sounds": [{"name": "tool/techBoop", "stream": false}]}, "item.geiger1": {"category": "player", "sounds": [{"name": "tool/geiger1", "stream": false}]}, @@ -181,6 +182,7 @@ "step.iron_jump": {"category": "player", "sounds": [{"name": "footsteps/iron_jump", "stream": false}]}, "step.iron_land": {"category": "player", "sounds": [{"name": "footsteps/iron_land", "stream": false}]}, "step.iron": {"category": "player", "sounds": ["footsteps/iron1", "footsteps/iron2", "footsteps/iron3", "footsteps/iron4"]}, + "step.metalBlock": {"category": "block", "sounds": ["footsteps/metalStep1", "footsteps/metalStep2", "footsteps/metalStep3", "footsteps/metalStep4"]}, "potatos.random": {"category": "player", "sounds": ["potatos/randResponse0", "potatos/randResponse1", "potatos/randResponse2", "potatos/randResponse3", "potatos/randResponse4", "potatos/randResponse5", "potatos/randResponse6", "potatos/randResponse7"]}, diff --git a/src/main/resources/assets/hbm/sounds/block/rbmk_explosion.ogg b/src/main/resources/assets/hbm/sounds/block/rbmk_explosion.ogg new file mode 100644 index 000000000..ba5cc90c9 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/block/rbmk_explosion.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/footsteps/metalStep1.ogg b/src/main/resources/assets/hbm/sounds/footsteps/metalStep1.ogg new file mode 100644 index 000000000..faf8cee3d Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/footsteps/metalStep1.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/footsteps/metalStep2.ogg b/src/main/resources/assets/hbm/sounds/footsteps/metalStep2.ogg new file mode 100644 index 000000000..11b6917ec Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/footsteps/metalStep2.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/footsteps/metalStep3.ogg b/src/main/resources/assets/hbm/sounds/footsteps/metalStep3.ogg new file mode 100644 index 000000000..d778f8276 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/footsteps/metalStep3.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/footsteps/metalStep4.ogg b/src/main/resources/assets/hbm/sounds/footsteps/metalStep4.ogg new file mode 100644 index 000000000..191d338d0 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/footsteps/metalStep4.ogg differ diff --git a/src/main/resources/assets/hbm/textures/blocks/grate_side.png b/src/main/resources/assets/hbm/textures/blocks/grate_side.png new file mode 100644 index 000000000..b3cc7491b Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/grate_side.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/grate_top.png b/src/main/resources/assets/hbm/textures/blocks/grate_top.png new file mode 100644 index 000000000..0304b194a Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/grate_top.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_debris_radiating.png b/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_debris_radiating.png new file mode 100644 index 000000000..0bb923220 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_debris_radiating.png differ diff --git a/src/main/resources/assets/hbm/textures/items/debris_fuel.png b/src/main/resources/assets/hbm/textures/items/debris_fuel.png new file mode 100644 index 000000000..8728a7ba7 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/debris_fuel.png differ diff --git a/src/main/resources/assets/hbm/textures/items/debris_fuel_alt.png b/src/main/resources/assets/hbm/textures/items/debris_fuel_alt.png new file mode 100644 index 000000000..3b6ec3fb5 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/debris_fuel_alt.png differ diff --git a/src/main/resources/assets/hbm/textures/items/debris_fuel_base.png b/src/main/resources/assets/hbm/textures/items/debris_fuel_base.png new file mode 100644 index 000000000..839857d0b Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/debris_fuel_base.png differ diff --git a/src/main/resources/assets/hbm/textures/items/debris_metal.png b/src/main/resources/assets/hbm/textures/items/debris_metal.png new file mode 100644 index 000000000..4430c2ad5 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/debris_metal.png differ