new rad system now for blocks, bomber sound loop

This commit is contained in:
HbmMods 2018-11-24 20:00:24 +01:00
parent 3ecc2ff135
commit 3d66c79ad1
22 changed files with 492 additions and 123 deletions

View File

@ -85,7 +85,7 @@
"weapon.ciwsFiringLoop": {"category": "player", "sounds": [{"name": "weapon/ciwsFiringLoop", "stream": false}]},
"weapon.ciwsSpinup": {"category": "player", "sounds": [{"name": "weapon/ciwsSpinup", "stream": false}]},
"weapon.ciwsSpindown": {"category": "player", "sounds": [{"name": "weapon/ciwsSpindown", "stream": false}]},
"weapon.laserBang": {"category": "player", "sounds": ["weapon/laserBang1", "weapon/laserBang2", "weapon/laserBang3"]},
"weapon.laserBang": {"category": "player", "sounds": ["weapon/laserBang1", "weapon/laserBang2", "weapon/laserBang3", "weapon/laserBang4"]},
"weapon.uziShoot": {"category": "player", "sounds": [{"name": "weapon/uziShoot", "stream": false}]},
"weapon.silencerShoot": {"category": "player", "sounds": [{"name": "weapon/silencerShoot", "stream": false}]},
"weapon.gBounce": {"category": "player", "sounds": ["weapon/gBounce1", "weapon/gBounce2", "weapon/gBounce3"]},
@ -105,6 +105,9 @@
"entity.rocketTakeoff": {"category": "player", "sounds": [{"name": "entity/rocketTakeoff", "stream": false}]},
"entity.bombDet": {"category": "player", "sounds": ["entity/bombDet1", "entity/bombDet2", "entity/bombDet3"]},
"entity.bombWhistle": {"category": "player", "sounds": [{"name": "entity/bombWhistle", "stream": false}]},
"entity.bomberLoop": {"category": "player", "sounds": [{"name": "entity/bomber1", "stream": false}]},
"entity.planeCrash": {"category": "player", "sounds": [{"name": "entity/planeCrash", "stream": false}]},
"entity.planeShotDown": {"category": "player", "sounds": [{"name": "entity/planeShotDown", "stream": false}]},
"potatos.random": {"category": "player", "sounds": ["potatos/randResponse0", "potatos/randResponse1", "potatos/randResponse2", "potatos/randResponse3", "potatos/randResponse4", "potatos/randResponse5", "potatos/randResponse6", "potatos/randResponse7"]},

Binary file not shown.

Binary file not shown.

View File

@ -621,10 +621,10 @@ public class ModBlocks {
ore_aluminium = new BlockGeneric(Material.rock).setBlockName("ore_aluminium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_aluminium");
ore_fluorite = new BlockOre(Material.rock).setBlockName("ore_fluorite").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_fluorite");
ore_lead = new BlockGeneric(Material.rock).setBlockName("ore_lead").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_lead");
ore_schrabidium = new BlockGeneric(Material.rock).setBlockName("ore_schrabidium").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(600.0F).setBlockTextureName(RefStrings.MODID + ":ore_schrabidium");
ore_schrabidium = new BlockOre(Material.rock, 0.1F, 0.5F).setBlockName("ore_schrabidium").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(600.0F).setBlockTextureName(RefStrings.MODID + ":ore_schrabidium");
ore_beryllium = new BlockGeneric(Material.rock).setBlockName("ore_beryllium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":ore_beryllium");
ore_nether_uranium = new BlockGeneric(Material.rock).setBlockName("ore_nether_uranium").setCreativeTab(MainRegistry.blockTab).setHardness(0.4F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_nether_uranium");
ore_nether_uranium = new BlockOre(Material.rock).setBlockName("ore_nether_uranium").setCreativeTab(MainRegistry.blockTab).setHardness(0.4F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_nether_uranium");
ore_nether_plutonium = new BlockGeneric(Material.rock).setBlockName("ore_nether_plutonium").setCreativeTab(MainRegistry.blockTab).setHardness(0.4F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_nether_plutonium");
ore_nether_tungsten = new BlockGeneric(Material.rock).setBlockName("ore_nether_tungsten").setCreativeTab(MainRegistry.blockTab).setHardness(0.4F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_nether_tungsten");
ore_nether_sulfur = new BlockOre(Material.rock).setBlockName("ore_nether_sulfur").setCreativeTab(MainRegistry.blockTab).setHardness(0.4F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_nether_sulfur");
@ -645,7 +645,7 @@ public class ModBlocks {
ore_tikite = new BlockGeneric(Material.rock).setBlockName("ore_tikite").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_tikite_alt");
block_uranium = new BlockGeneric(Material.iron).setBlockName("block_uranium").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_uranium");
block_uranium = new BlockOre(Material.iron, 0.1F, 1.5F).setBlockName("block_uranium").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_uranium");
block_titanium = new BlockGeneric(Material.iron).setBlockName("block_titanium").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_titanium");
block_sulfur = new BlockGeneric(Material.iron).setBlockName("block_sulfur").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_sulfur");
block_niter = new BlockGeneric(Material.iron).setBlockName("block_niter").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_niter");
@ -656,18 +656,17 @@ public class ModBlocks {
block_fluorite = new BlockGeneric(Material.iron).setBlockName("block_fluorite").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_fluorite");
block_steel = new BlockGeneric(Material.iron).setBlockName("block_steel").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_steel");
block_lead = new BlockGeneric(Material.iron).setBlockName("block_lead").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_lead");
block_trinitite = new BlockOre(Material.iron).setBlockName("block_trinitite").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_trinitite");
block_waste = new BlockOre(Material.iron).setBlockName("block_waste").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_waste");
block_trinitite = new BlockOre(Material.iron, 3F, 35F).setBlockName("block_trinitite").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_trinitite");
block_waste = new BlockOre(Material.iron, 5F, 60F).setBlockName("block_waste").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_waste");
block_scrap = new BlockFalling(Material.sand).setBlockName("block_scrap").setCreativeTab(MainRegistry.blockTab).setHardness(2.5F).setResistance(5.0F).setStepSound(Block.soundTypeGravel).setBlockTextureName(RefStrings.MODID + ":block_scrap");
block_electrical_scrap = new BlockFalling(Material.iron).setBlockName("block_electrical_scrap").setCreativeTab(MainRegistry.blockTab).setHardness(2.5F).setResistance(5.0F).setStepSound(Block.soundTypeMetal).setBlockTextureName(RefStrings.MODID + ":electrical_scrap_alt2");
block_beryllium = new BlockGeneric(Material.iron).setBlockName("block_beryllium").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_beryllium");
block_schrabidium = new BlockGeneric(Material.iron).setBlockName("block_schrabidium").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(600.0F).setBlockTextureName(RefStrings.MODID + ":block_schrabidium");
block_schrabidium = new BlockGeneric(Material.iron).setBlockName("block_schrabidium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(600.0F).setBlockTextureName(RefStrings.MODID + ":block_schrabidium");
block_advanced_alloy = new BlockGeneric(Material.iron).setBlockName("block_advanced_alloy").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_advanced_alloy");
block_magnetized_tungsten = new BlockGeneric(Material.iron).setBlockName("block_magnetized_tungsten").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(35.0F).setBlockTextureName(RefStrings.MODID + ":block_magnetized_tungsten");
block_combine_steel = new BlockGeneric(Material.iron).setBlockName("block_combine_steel").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(600.0F).setBlockTextureName(RefStrings.MODID + ":block_combine_steel");
block_desh = new BlockGeneric(Material.iron).setBlockName("block_desh").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(600.0F).setBlockTextureName(RefStrings.MODID + ":block_desh");
block_yellowcake = new BlockFalling(Material.sand).setBlockName("block_yellowcake").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeSand).setHardness(5.0F).setResistance(600.0F).setBlockTextureName(RefStrings.MODID + ":block_yellowcake");
block_yellowcake = new BlockFallingRad(Material.sand, 0.5F, 3F).setBlockName("block_yellowcake").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeSand).setHardness(5.0F).setResistance(600.0F).setBlockTextureName(RefStrings.MODID + ":block_yellowcake");
block_australium = new BlockGeneric(Material.iron).setBlockName("block_australium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_australium");
block_weidanium = new BlockGeneric(Material.iron).setBlockName("block_weidanium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_weidanium");
@ -705,7 +704,7 @@ public class ModBlocks {
block_meteor = new BlockOre(Material.rock).setBlockName("block_meteor").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F).setBlockTextureName(RefStrings.MODID + ":block_meteor");
block_meteor_cobble = new BlockOre(Material.rock).setBlockName("block_meteor_cobble").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F).setBlockTextureName(RefStrings.MODID + ":block_meteor_cobble");
block_meteor_broken = new BlockOre(Material.rock).setBlockName("block_meteor_broken").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F).setBlockTextureName(RefStrings.MODID + ":block_meteor_broken");
block_meteor_molten = new BlockOre(Material.rock).setBlockName("block_meteor_molten").setLightLevel(0.75F).setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F).setBlockTextureName(RefStrings.MODID + ":block_meteor_molten");
block_meteor_molten = new BlockOre(Material.rock, true).setBlockName("block_meteor_molten").setLightLevel(0.75F).setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F).setBlockTextureName(RefStrings.MODID + ":block_meteor_molten");
block_meteor_treasure = new BlockOre(Material.rock).setBlockName("block_meteor_treasure").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F).setBlockTextureName(RefStrings.MODID + ":block_meteor_treasure");
tape_recorder = new DecoTapeRecorder(Material.rock).setBlockName("tape_recorder").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":deco_tape_recorder");
@ -724,10 +723,10 @@ public class ModBlocks {
mush_block = new BlockMushHuge(Material.plants).setBlockName("mush_block").setLightLevel(1.0F).setStepSound(Block.soundTypeGrass).setHardness(0.2F).setBlockTextureName(RefStrings.MODID + ":mush_block_skin");
mush_block_stem = new BlockMushHuge(Material.plants).setBlockName("mush_block_stem").setLightLevel(1.0F).setStepSound(Block.soundTypeGrass).setHardness(0.2F).setBlockTextureName(RefStrings.MODID + ":mush_block_stem");
waste_earth = new WasteEarth(Material.ground).setBlockName("waste_earth").setStepSound(Block.soundTypeGrass).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(1.0F).setBlockTextureName(RefStrings.MODID + ":waste_earth");
waste_mycelium = new WasteEarth(Material.ground).setBlockName("waste_mycelium").setStepSound(Block.soundTypeGrass).setLightLevel(1F).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(1.0F).setBlockTextureName(RefStrings.MODID + ":waste_mycelium_side");
waste_trinitite = new BlockOre(Material.sand).setBlockName("waste_trinitite").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":waste_trinitite");
waste_trinitite_red = new BlockOre(Material.sand).setBlockName("waste_trinitite_red").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":waste_trinitite_red");
waste_earth = new WasteEarth(Material.ground, 0.25F, 7.5F).setBlockName("waste_earth").setStepSound(Block.soundTypeGrass).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(1.0F).setBlockTextureName(RefStrings.MODID + ":waste_earth");
waste_mycelium = new WasteEarth(Material.ground, 1F, 25F).setBlockName("waste_mycelium").setStepSound(Block.soundTypeGrass).setLightLevel(1F).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(1.0F).setBlockTextureName(RefStrings.MODID + ":waste_mycelium_side");
waste_trinitite = new BlockOre(Material.sand, 0.5F, 10F).setBlockName("waste_trinitite").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":waste_trinitite");
waste_trinitite_red = new BlockOre(Material.sand, 0.5F,10F).setBlockName("waste_trinitite_red").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":waste_trinitite_red");
waste_log = new WasteLog(Material.wood).setBlockName("waste_log").setStepSound(Block.soundTypeWood).setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(2.5F);
waste_planks = new BlockOre(Material.wood).setBlockName("waste_planks").setStepSound(Block.soundTypeWood).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":waste_planks");
frozen_dirt = new BlockOre(Material.wood).setBlockName("frozen_dirt").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":frozen_dirt");
@ -736,12 +735,12 @@ public class ModBlocks {
frozen_planks = new BlockOre(Material.wood).setBlockName("frozen_planks").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":frozen_planks");
sellafield_slaked = new BlockGeneric(Material.rock).setBlockName("sellafield_slaked").setStepSound(Block.soundTypeStone).setHardness(5.0F).setBlockTextureName(RefStrings.MODID + ":sellafield_slaked");
sellafield_0 = new BlockOre(Material.rock).setBlockName("sellafield_0").setStepSound(Block.soundTypeStone).setHardness(5.0F).setBlockTextureName(RefStrings.MODID + ":sellafield_0");
sellafield_1 = new BlockOre(Material.rock).setBlockName("sellafield_1").setStepSound(Block.soundTypeStone).setHardness(5.0F).setBlockTextureName(RefStrings.MODID + ":sellafield_1");
sellafield_2 = new BlockOre(Material.rock).setBlockName("sellafield_2").setStepSound(Block.soundTypeStone).setHardness(5.0F).setBlockTextureName(RefStrings.MODID + ":sellafield_2");
sellafield_3 = new BlockOre(Material.rock).setBlockName("sellafield_3").setStepSound(Block.soundTypeStone).setHardness(5.0F).setBlockTextureName(RefStrings.MODID + ":sellafield_3");
sellafield_4 = new BlockOre(Material.rock).setBlockName("sellafield_4").setStepSound(Block.soundTypeStone).setHardness(5.0F).setBlockTextureName(RefStrings.MODID + ":sellafield_4");
sellafield_core = new Sellafield(Material.rock).setBlockName("sellafield_core").setStepSound(Block.soundTypeStone).setHardness(10.0F).setBlockTextureName(RefStrings.MODID + ":sellafield_core");
sellafield_0 = new BlockOre(Material.rock, 0.5F, 10F).setBlockName("sellafield_0").setStepSound(Block.soundTypeStone).setHardness(5.0F).setBlockTextureName(RefStrings.MODID + ":sellafield_0");
sellafield_1 = new BlockOre(Material.rock, 1F, 15F).setBlockName("sellafield_1").setStepSound(Block.soundTypeStone).setHardness(5.0F).setBlockTextureName(RefStrings.MODID + ":sellafield_1");
sellafield_2 = new BlockOre(Material.rock, 2.5F, 25F).setBlockName("sellafield_2").setStepSound(Block.soundTypeStone).setHardness(5.0F).setBlockTextureName(RefStrings.MODID + ":sellafield_2");
sellafield_3 = new BlockOre(Material.rock, 4F, 40F).setBlockName("sellafield_3").setStepSound(Block.soundTypeStone).setHardness(5.0F).setBlockTextureName(RefStrings.MODID + ":sellafield_3");
sellafield_4 = new BlockOre(Material.rock, 5, 50F).setBlockName("sellafield_4").setStepSound(Block.soundTypeStone).setHardness(5.0F).setBlockTextureName(RefStrings.MODID + ":sellafield_4");
sellafield_core = new BlockOre(Material.rock, 10F, 150F).setBlockName("sellafield_core").setStepSound(Block.soundTypeStone).setHardness(10.0F).setBlockTextureName(RefStrings.MODID + ":sellafield_core");
nuke_gadget = new NukeGadget(Material.iron).setBlockName("nuke_gadget").setCreativeTab(MainRegistry.nukeTab).setHardness(5.0F).setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":theGadget");
nuke_boy = new NukeBoy(Material.iron).setBlockName("nuke_boy").setCreativeTab(MainRegistry.nukeTab).setHardness(5.0F).setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":lilBoy");

View File

@ -0,0 +1,46 @@
package com.hbm.blocks.generic;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.saveddata.RadiationSavedData;
import net.minecraft.block.BlockFalling;
import net.minecraft.block.material.Material;
import net.minecraft.world.World;
public class BlockFallingRad extends BlockFalling {
private float radIn = 0.0F;
private float radMax = 0.0F;
public BlockFallingRad(Material mat, float rad, float max) {
super(mat);
this.setTickRandomly(true);
radIn = rad;
radMax = max;
}
@Override
public void updateTick(World world, int x, int y, int z, Random rand)
{
super.updateTick(world, x, y, z, rand);
RadiationSavedData.incrementRad(world, x, z, radIn, radMax);
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
}
@Override
public int tickRate(World world) {
return 20;
}
public void onBlockAdded(World world, int x, int y, int z)
{
super.onBlockAdded(world, x, y, z);
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
}
}

View File

@ -32,10 +32,23 @@ import net.minecraft.world.World;
public class BlockOre extends Block {
public BlockOre(Material p_i45394_1_) {
super(p_i45394_1_);
//if(this == ModBlocks.block_meteor_molten)
private float radIn = 0.0F;
private float radMax = 0.0F;
public BlockOre(Material mat) {
super(mat);
}
public BlockOre(Material mat, boolean tick) {
super(mat);
this.setTickRandomly(tick);
}
public BlockOre(Material mat, float rad, float max) {
super(mat);
this.setTickRandomly(true);
radIn = rad;
radMax = max;
}
@Override
@ -217,7 +230,7 @@ public class BlockOre extends Block {
{
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 2 * 60 * 20, 2));
}
if (entity instanceof EntityLivingBase && this == ModBlocks.block_trinitite)
/*if (entity instanceof EntityLivingBase && this == ModBlocks.block_trinitite)
{
Library.applyRadiation((EntityLivingBase)entity, 45, 19, 30, 14);
}
@ -248,7 +261,7 @@ public class BlockOre extends Block {
if (entity instanceof EntityLivingBase && this == ModBlocks.sellafield_4)
{
Library.applyRadiation((EntityLivingBase)entity, 4 * 60, 80, 2 * 90, 60);
}
}*/
if(this == ModBlocks.block_meteor_molten)
entity.setFire(5);
@ -283,22 +296,12 @@ public class BlockOre extends Block {
if(!world.isRemote)
world.setBlock(x, y, z, ModBlocks.block_meteor_cobble);
world.playSoundEffect((double)((float)x + 0.5F), (double)((float)y + 0.5F), (double)((float)z + 0.5F), "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
return;
}
if(this == ModBlocks.waste_trinitite || this == ModBlocks.waste_trinitite_red) {
RadiationSavedData.incrementRad(world, x, z, 2, 20);
if(this.radIn > 0) {
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
}
if(this == ModBlocks.block_waste) {
RadiationSavedData.incrementRad(world, x, z, 5, 50);
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
}
if(this == ModBlocks.block_trinitite) {
RadiationSavedData.incrementRad(world, x, z, 3, 35);
RadiationSavedData.incrementRad(world, x, z, radIn, radMax);
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
}
@ -307,13 +310,7 @@ public class BlockOre extends Block {
@Override
public int tickRate(World world) {
if(this == ModBlocks.block_meteor_molten)
return 30;
if(this == ModBlocks.waste_trinitite
|| this == ModBlocks.waste_trinitite_red
|| this == ModBlocks.block_waste
|| this == ModBlocks.block_trinitite)
if(this.radIn > 0)
return 20;
return 100;
@ -323,10 +320,7 @@ public class BlockOre extends Block {
{
super.onBlockAdded(world, x, y, z);
if(this == ModBlocks.waste_trinitite
|| this == ModBlocks.waste_trinitite_red
|| this == ModBlocks.block_waste
|| this == ModBlocks.block_trinitite)
if(this.radIn > 0)
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
}

View File

@ -7,6 +7,7 @@ import com.hbm.entity.mob.EntityNuclearCreeper;
import com.hbm.lib.Library;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import com.hbm.saveddata.RadiationSavedData;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -32,13 +33,23 @@ import net.minecraft.world.World;
public class WasteEarth extends Block {
private float radIn = 0.0F;
private float radMax = 0.0F;
@SideOnly(Side.CLIENT)
private IIcon iconTop;
@SideOnly(Side.CLIENT)
private IIcon iconBottom;
public WasteEarth(Material p_i45394_1_) {
super(p_i45394_1_);
this.setTickRandomly(true);
public WasteEarth(Material mat) {
super(mat);
}
public WasteEarth(Material mat, float rad, float max) {
super(mat);
this.setTickRandomly(true);
radIn = rad;
radMax = max;
}
@Override
@ -80,19 +91,19 @@ public class WasteEarth extends Block {
@Override
public void onEntityWalking(World p_149724_1_, int p_149724_2_, int p_149724_3_, int p_149724_4_, Entity entity)
{
if (entity instanceof EntityLivingBase && this == ModBlocks.waste_earth)
/*if (entity instanceof EntityLivingBase && this == ModBlocks.waste_earth)
{
Library.applyRadiation((EntityLivingBase)entity, 4, 10, 0, 0);
}
}*/
if (entity instanceof EntityLivingBase && this == ModBlocks.frozen_grass)
{
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 2 * 60 * 20, 2));
}
if (entity instanceof EntityLivingBase && this == ModBlocks.waste_mycelium)
/*if (entity instanceof EntityLivingBase && this == ModBlocks.waste_mycelium)
{
Library.applyRadiation((EntityLivingBase)entity, 30, 14, 15, 9);
}
}*/
}
@Override
@ -114,6 +125,13 @@ public class WasteEarth extends Block {
@Override
public void updateTick(World world, int x, int y, int z, Random rand)
{
if(this.radIn > 0) {
RadiationSavedData.incrementRad(world, x, z, radIn, radMax);
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
}
if((this == ModBlocks.waste_earth || this == ModBlocks.waste_mycelium) && world.getBlock(x, y + 1, z) == Blocks.air && rand.nextInt(10) == 0 && MainRegistry.enableMycelium)
{
Block b0;
@ -183,4 +201,21 @@ public class WasteEarth extends Block {
world.setBlock(x, y, z, Blocks.dirt);
}
@Override
public int tickRate(World world) {
if(this.radIn > 0)
return 20;
return 100;
}
public void onBlockAdded(World world, int x, int y, int z)
{
super.onBlockAdded(world, x, y, z);
if(this.radIn > 0)
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
}
}

View File

@ -5,6 +5,7 @@ import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.explosion.ExplosionNukeGeneric;
import com.hbm.lib.RefStrings;
import com.hbm.saveddata.RadiationSavedData;
import com.hbm.tileentity.deco.TileEntityYellowBarrel;
import cpw.mods.fml.relauncher.Side;
@ -41,12 +42,14 @@ public class YellowBarrel extends BlockContainer {
}
public void explode(World p_149695_1_, int x, int y, int z) {
if(rand.nextInt(5) == 0) {
if(rand.nextInt(3) == 0) {
p_149695_1_.setBlock(x, y, z, ModBlocks.toxic_block);
} else {
p_149695_1_.createExplosion(null, x, y, z, 18.0F, true);
}
ExplosionNukeGeneric.waste(p_149695_1_, x, y, z, 35);
RadiationSavedData.incrementRad(p_149695_1_, x, z, 35, 1500);
}
@Override
@ -99,4 +102,26 @@ public class YellowBarrel extends BlockContainer {
p_149734_1_.spawnParticle("townaura", p_149734_2_ + p_149734_5_.nextFloat(), p_149734_3_ + 1.1F, p_149734_4_ + p_149734_5_.nextFloat(), 0.0D, 0.0D, 0.0D);
}
@Override
public void updateTick(World world, int x, int y, int z, Random rand)
{
super.updateTick(world, x, y, z, rand);
RadiationSavedData.incrementRad(world, x, z, 5, 75);
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
}
@Override
public int tickRate(World world) {
return 20;
}
public void onBlockAdded(World world, int x, int y, int z)
{
super.onBlockAdded(world, x, y, z);
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
}
}

View File

@ -10,6 +10,8 @@ import com.hbm.explosion.ExplosionChaos;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.lib.ModDamageSource;
import com.hbm.main.MainRegistry;
import com.hbm.packet.LoopedEntitySoundPacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.tileentity.deco.TileEntityBomber;
import com.hbm.tileentity.machine.TileEntityMachineRadar;
@ -74,6 +76,7 @@ public class EntityBomber extends Entity implements IChunkLoader {
private void killBomber() {
ExplosionLarge.explode(worldObj, posX, posY, posZ, 5, true, false, true);
worldObj.playSoundEffect((double)(posX + 0.5F), (double)(posY + 0.5F), (double)(posZ + 0.5F), "hbm:entity.planeShotDown", 25.0F, 1.0F);
}
@Override
@ -87,6 +90,16 @@ public class EntityBomber extends Entity implements IChunkLoader {
this.setPosition(posX + motionX, posY + motionY, posZ + motionZ);
if(!worldObj.isRemote) {
this.dataWatcher.updateObject(17, health);
if(health > 0)
PacketDispatcher.wrapper.sendToAll(new LoopedEntitySoundPacket(this.getEntityId()));
} else {
health = this.dataWatcher.getWatchableObjectInt(17);
}
this.rotation();
if(this.health <= 0) {
@ -109,6 +122,7 @@ public class EntityBomber extends Entity implements IChunkLoader {
}*/
ExplosionLarge.explodeFire(worldObj, posX, posY, posZ, 25, true, false, true);
worldObj.playSoundEffect((double)(posX + 0.5F), (double)(posY + 0.5F), (double)(posZ + 0.5F), "hbm:entity.planeCrash", 10.0F, 1.0F);
return;
}
@ -298,6 +312,7 @@ public class EntityBomber extends Entity implements IChunkLoader {
public void entityInit() {
init(ForgeChunkManager.requestTicket(MainRegistry.instance, worldObj, Type.ENTITY));
this.dataWatcher.addObject(16, Byte.valueOf((byte)0));
this.dataWatcher.addObject(17, Integer.valueOf((int)50));
}
@Override
@ -309,6 +324,7 @@ public class EntityBomber extends Entity implements IChunkLoader {
type = nbt.getInteger("type");
this.getDataWatcher().updateObject(16, nbt.getByte("style"));
this.getDataWatcher().updateObject(17, nbt.getInteger("health"));
this.setSize(8.0F, 4.0F);
}
@ -320,6 +336,7 @@ public class EntityBomber extends Entity implements IChunkLoader {
nbt.setInteger("bombRate", bombRate);
nbt.setInteger("type", type);
nbt.setByte("style", this.getDataWatcher().getWatchableObjectByte(16));
nbt.setInteger("health", this.getDataWatcher().getWatchableObjectInt(17));
}
protected void rotation() {

View File

@ -46,9 +46,9 @@ public class EntitySSmokeFX extends EntityModFX
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if(maxAge < 100)
if(maxAge < 25)
{
maxAge = rand.nextInt(21) + 65;
maxAge = rand.nextInt(6) + 25;
}
this.particleAge++;
@ -58,15 +58,19 @@ public class EntitySSmokeFX extends EntityModFX
this.setDead();
}
this.motionX *= 0.9599999785423279D;
this.motionY *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D;
this.motionX *= 0.7599999785423279D;
this.motionY *= 0.7599999785423279D;
this.motionZ *= 0.7599999785423279D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
this.posX += this.motionX;
this.posY += this.motionY;
this.posZ += this.motionZ;
}
@Override

View File

@ -4,9 +4,6 @@ import net.minecraft.world.World;
public class EntityTSmokeFX extends EntityModFX
{
float smokeParticleScale;
public int particleAge;
public int maxAge;
private static final String __OBFID = "CL_00000924";
public EntityTSmokeFX(World world) {
@ -47,9 +44,9 @@ public class EntityTSmokeFX extends EntityModFX
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if(maxAge < 100)
if(maxAge < 25)
{
maxAge = rand.nextInt(21) + 65;
maxAge = rand.nextInt(6) + 25;
}
this.particleAge++;

View File

@ -412,6 +412,7 @@ public class ItemStarterKit extends Item {
player.inventory.addItemStackToInventory(new ItemStack(ModItems.custom_dirty, 1));
player.inventory.addItemStackToInventory(new ItemStack(ModItems.custom_dirty, 1));
player.inventory.addItemStackToInventory(new ItemStack(ModItems.custom_schrab, 1));
player.inventory.addItemStackToInventory(new ItemStack(ModItems.custom_fall, 1));
}
if(this == ModItems.grenade_kit)

View File

@ -6,6 +6,7 @@ import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.items.ModItems;
import com.hbm.saveddata.RadEntitySavedData;
import com.hbm.saveddata.RadiationSavedData;
import net.minecraft.block.Block;
@ -14,6 +15,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import scala.Int;
@ -37,6 +39,10 @@ public class ItemGeigerCounter extends Item {
if(x > 0) {
List<Integer> list = new ArrayList<Integer>();
if(x < 1)
list.add(0);
if(x < 5)
list.add(0);
if(x < 10)
list.add(1);
if(x > 5 && x < 15)
@ -50,7 +56,10 @@ public class ItemGeigerCounter extends Item {
if(x > 25)
list.add(6);
world.playSoundAtEntity(entity, "hbm:item.geiger" + list.get(rand.nextInt(list.size())), 1.0F, 1.0F);
int r = list.get(rand.nextInt(list.size()));
if(r > 0)
world.playSoundAtEntity(entity, "hbm:item.geiger" + r, 1.0F, 1.0F);
} else if(rand.nextInt(50) == 0) {
world.playSoundAtEntity(entity, "hbm:item.geiger"+ (1 + rand.nextInt(1)), 1.0F, 1.0F);
}
@ -93,4 +102,24 @@ public class ItemGeigerCounter extends Item {
return false;
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
if(!world.isRemote) {
world.playSoundAtEntity(player, "hbm:item.techBoop", 1.0F, 1.0F);
RadEntitySavedData eData = RadEntitySavedData.getData(player.worldObj);
int eRad = (int)eData.getRadFromEntity(player);
RadiationSavedData data = RadiationSavedData.getData(player.worldObj);
Chunk chunk = world.getChunkFromBlockCoords((int)player.posX, (int)player.posZ);
int rads = (int)Math.ceil(data.getRadNumFromCoord(chunk.xPosition, chunk.zPosition));
player.addChatMessage(new ChatComponentText("Current chunk radiation: " + rads + " RAD/s"));
player.addChatMessage(new ChatComponentText("Player contamination: " + eRad + " RAD"));
}
return stack;
}
}

View File

@ -1319,6 +1319,7 @@ public class CraftingManager {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.gun_calamity_dual, 1), new Object[] { "BBM", " PI", "BBM", 'P', "plateIron", 'B', ModItems.pipes_steel, 'M', ModItems.mechanism_rifle_1, 'I', "ingotSteel" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.gun_calamity_ammo, 8), new Object[] { "S", "C", "G", 'S', "plateSteel", 'C', "plateCopper", 'G', Items.gunpowder }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.analyzer, 1), new Object[] { " S ", "SGS", " S ", 'S', "plateSteel", 'G', "paneGlassColorless" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.custom_fall, 1), new Object[] { "IIP", "CHW", "IIP", 'I', ModItems.plate_polymer, 'P', "plateSaturnite", 'C', ModItems.circuit_red_copper, 'H', ModItems.hull_small_steel, 'W', ModItems.coil_copper }));
GameRegistry.addShapelessRecipe(new ItemStack(Items.paper, 1), new Object[] { new ItemStack(ModItems.assembly_template, 1, OreDictionary.WILDCARD_VALUE) });
GameRegistry.addShapelessRecipe(new ItemStack(Items.paper, 1), new Object[] { new ItemStack(ModItems.chemistry_template, 1, OreDictionary.WILDCARD_VALUE) });

View File

@ -100,24 +100,6 @@ public class ModEventHandler
//try {
/////
if(event.world != null && !event.world.isRemote) {
if(!event.world.playerEntities.isEmpty()) {
RadiationSavedData data = RadiationSavedData.getData(event.world);
RadEntitySavedData eData = RadEntitySavedData.getData(event.world);
for(Object o : event.world.playerEntities) {
EntityPlayer player = (EntityPlayer)o;
PacketDispatcher.wrapper.sendTo(new RadSurveyPacket(eData.getRadFromEntity(player)), (EntityPlayerMP) player);
}
if(event.world.getTotalWorldTime() % 20 == 0) {
data.updateSystem();
}
}
}
if(event.world != null && !event.world.isRemote && event.world.provider.isSurfaceWorld() && MainRegistry.enableMeteorStrikes) {
if(event.world.rand.nextInt(meteorShower > 0 ? MainRegistry.meteorShowerChance : MainRegistry.meteorStrikeChance) == 0) {
if(!event.world.playerEntities.isEmpty()) {
@ -153,6 +135,19 @@ public class ModEventHandler
if(event.world != null && !event.world.isRemote) {
if(!event.world.loadedEntityList.isEmpty()) {
RadiationSavedData data = RadiationSavedData.getData(event.world);
RadEntitySavedData eData = RadEntitySavedData.getData(event.world);
for(Object o : event.world.playerEntities) {
EntityPlayer player = (EntityPlayer)o;
PacketDispatcher.wrapper.sendTo(new RadSurveyPacket(eData.getRadFromEntity(player)), (EntityPlayerMP) player);
}
if(event.world.getTotalWorldTime() % 20 == 0) {
data.updateSystem();
}
List<Object> oList = new ArrayList<Object>();
oList.addAll(event.world.loadedEntityList);
@ -161,7 +156,70 @@ public class ModEventHandler
//effect for radiation
EntityLivingBase entity = (EntityLivingBase) e;
PotionEffect effect = entity.getActivePotionEffect(HbmPotion.radiation);
if(event.world.getTotalWorldTime() % 20 == 0) {
Chunk chunk = entity.worldObj.getChunkFromBlockCoords((int)entity.posX, (int)entity.posZ);
float rad = data.getRadNumFromCoord(chunk.xPosition, chunk.zPosition);
if(rad > 0) {
eData.setRadForEntity(entity, eData.getRadFromEntity(entity) + rad * 0.5F);
}
}
float eRad = eData.getRadFromEntity(entity);
if(eRad < 200)
continue;
if(eRad >= 1000) {
entity.attackEntityFrom(ModDamageSource.radiation, 1000);
} else if(eRad >= 800) {
if(event.world.rand.nextInt(300) == 0)
entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 5 * 30, 0));
if(event.world.rand.nextInt(300) == 0)
entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 10 * 20, 2));
if(event.world.rand.nextInt(300) == 0)
entity.addPotionEffect(new PotionEffect(Potion.weakness.id, 10 * 20, 2));
if(event.world.rand.nextInt(500) == 0)
entity.addPotionEffect(new PotionEffect(Potion.poison.id, 3 * 20, 2));
if(event.world.rand.nextInt(700) == 0)
entity.addPotionEffect(new PotionEffect(Potion.wither.id, 3 * 20, 1));
if(event.world.rand.nextInt(300) == 0)
entity.addPotionEffect(new PotionEffect(Potion.hunger.id, 5 * 20, 3));
} else if(eRad >= 600) {
if(event.world.rand.nextInt(300) == 0)
entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 5 * 30, 0));
if(event.world.rand.nextInt(300) == 0)
entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 10 * 20, 2));
if(event.world.rand.nextInt(300) == 0)
entity.addPotionEffect(new PotionEffect(Potion.weakness.id, 10 * 20, 2));
if(event.world.rand.nextInt(500) == 0)
entity.addPotionEffect(new PotionEffect(Potion.poison.id, 3 * 20, 1));
if(event.world.rand.nextInt(300) == 0)
entity.addPotionEffect(new PotionEffect(Potion.hunger.id, 3 * 20, 3));
} else if(eRad >= 400) {
if(event.world.rand.nextInt(300) == 0)
entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 5 * 30, 0));
if(event.world.rand.nextInt(500) == 0)
entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 5 * 20, 0));
if(event.world.rand.nextInt(300) == 0)
entity.addPotionEffect(new PotionEffect(Potion.weakness.id, 5 * 20, 1));
if(event.world.rand.nextInt(500) == 0)
entity.addPotionEffect(new PotionEffect(Potion.hunger.id, 3 * 20, 2));
} else if(eRad >= 200) {
if(event.world.rand.nextInt(300) == 0)
entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 5 * 20, 0));
if(event.world.rand.nextInt(500) == 0)
entity.addPotionEffect(new PotionEffect(Potion.weakness.id, 5 * 20, 0));
if(event.world.rand.nextInt(700) == 0)
entity.addPotionEffect(new PotionEffect(Potion.hunger.id, 3 * 20, 2));
}
/*PotionEffect effect = entity.getActivePotionEffect(HbmPotion.radiation);
if(effect != null && !entity.isDead && entity.getHealth() > 0) {
@ -266,23 +324,10 @@ public class ModEventHandler
entity.removePotionEffect(Potion.digSlowdown.id);
if(entity.isPotionActive(Potion.moveSlowdown))
entity.removePotionEffect(Potion.moveSlowdown.id);
}
}*/
//effect end
//apply radiation
if(event.world.getTotalWorldTime() % 20 == 0) {
RadiationSavedData chunkData = RadiationSavedData.getData(event.world);
RadEntitySavedData entityData = RadEntitySavedData.getData(event.world);
Chunk chunk = entity.worldObj.getChunkFromBlockCoords((int)entity.posX, (int)entity.posZ);
float rad = chunkData.getRadNumFromCoord(chunk.xPosition, chunk.zPosition);
if(rad > 0) {
entityData.setRadForEntity(entity, entityData.getRadFromEntity(entity) + rad * 0.5F);
}
}
}
}
}

View File

@ -18,12 +18,14 @@ import com.hbm.sound.MovingSoundPlayerLoop.EnumHbmSound;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.client.event.sound.PlaySoundEvent17;
public class ModEventHandlerClient {
@ -48,6 +50,16 @@ public class ModEventHandlerClient {
}
}
/*@SubscribeEvent
public void renderGunPull(RenderPlayerEvent.Specials.Post event) {
RenderPlayer renderer = event.renderer;
//TESTING
renderer.modelBipedMain.bipedLeftArm.rotateAngleX += 90;
}*/
@SubscribeEvent
public void onPlaySound(PlaySoundEvent17 e) {
ResourceLocation r = e.sound.getPositionedSoundLocation();

View File

@ -0,0 +1,81 @@
package com.hbm.packet;
import com.hbm.entity.logic.EntityBomber;
import com.hbm.sound.MovingSoundBomber;
import com.hbm.sound.SoundLoopAssembler;
import com.hbm.sound.SoundLoopBroadcaster;
import com.hbm.sound.SoundLoopCentrifuge;
import com.hbm.sound.SoundLoopChemplant;
import com.hbm.sound.SoundLoopIGen;
import com.hbm.sound.SoundLoopMiner;
import com.hbm.sound.SoundLoopTurbofan;
import com.hbm.tileentity.machine.TileEntityBroadcaster;
import com.hbm.tileentity.machine.TileEntityMachineAssembler;
import com.hbm.tileentity.machine.TileEntityMachineCentrifuge;
import com.hbm.tileentity.machine.TileEntityMachineChemplant;
import com.hbm.tileentity.machine.TileEntityMachineGasCent;
import com.hbm.tileentity.machine.TileEntityMachineIGenerator;
import com.hbm.tileentity.machine.TileEntityMachineMiningDrill;
import com.hbm.tileentity.machine.TileEntityMachineTurbofan;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
public class LoopedEntitySoundPacket implements IMessage {
int entityID;
public LoopedEntitySoundPacket()
{
}
public LoopedEntitySoundPacket(int entityID)
{
this.entityID = entityID;
}
@Override
public void fromBytes(ByteBuf buf) {
entityID = buf.readInt();
}
@Override
public void toBytes(ByteBuf buf) {
buf.writeInt(entityID);
}
public static class Handler implements IMessageHandler<LoopedEntitySoundPacket, IMessage> {
@Override
//Tamaized, I love you!
@SideOnly(Side.CLIENT)
public IMessage onMessage(LoopedEntitySoundPacket m, MessageContext ctx) {
Entity e = Minecraft.getMinecraft().theWorld.getEntityByID(m.entityID);
if(e instanceof EntityBomber) {
boolean flag = true;
for(int i = 0; i < MovingSoundBomber.globalSoundList.size(); i++) {
if(MovingSoundBomber.globalSoundList.get(i).bomber == e && !MovingSoundBomber.globalSoundList.get(i).isDonePlaying())
flag = false;
}
if(flag) {
Minecraft.getMinecraft().getSoundHandler().playSound(new MovingSoundBomber(new ResourceLocation("hbm:entity.bomberLoop"), (EntityBomber)e));
}
}
return null;
}
}
}

View File

@ -73,6 +73,8 @@ public class PacketDispatcher {
wrapper.registerMessage(ParticleBurstPacket.Handler.class, ParticleBurstPacket.class, i++, Side.CLIENT);
//Packet to send chunk radiation info to individual players
wrapper.registerMessage(RadSurveyPacket.Handler.class, RadSurveyPacket.class, i++, Side.CLIENT);
//Entity sound packet that keeps client and server separated
wrapper.registerMessage(LoopedEntitySoundPacket.Handler.class, LoopedEntitySoundPacket.class, i++, Side.CLIENT);
}
}

View File

@ -0,0 +1,76 @@
package com.hbm.sound;
import java.util.ArrayList;
import java.util.List;
import com.hbm.entity.logic.EntityBomber;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.ISound;
import net.minecraft.client.audio.MovingSound;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
public class MovingSoundBomber extends MovingSound {
public static List<MovingSoundBomber> globalSoundList = new ArrayList<MovingSoundBomber>();
public EntityBomber bomber;
public MovingSoundBomber(ResourceLocation loc, EntityBomber bomber) {
super(loc);
this.bomber = bomber;
globalSoundList.add(this);
this.repeat = true;
this.field_147666_i = ISound.AttenuationType.NONE;
}
@Override
public void update() {
float iVolume = 150;
if(this.bomber == null || this.bomber.isDead || this.bomber.health <= 0) {
this.stop();
} else {
this.xPosF = (float)bomber.posX;
this.yPosF = (float)bomber.posY;
this.zPosF = (float)bomber.posZ;
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
float f = 0;
if(player != null) {
f = (float)Math.sqrt(Math.pow(xPosF - player.posX, 2) + Math.pow(yPosF - player.posY, 2) + Math.pow(zPosF - player.posZ, 2));
volume = (f / iVolume) * -2 + 2;
} else {
volume = iVolume;
}
}
if(!Minecraft.getMinecraft().getSoundHandler().isSoundPlaying(this)) {
stop();
}
}
public void stop() {
this.donePlaying = true;
this.repeat = false;
globalSoundList.remove(this);
}
public void setPitch(float f) {
this.field_147663_c = f;
}
public void setVolume(float f) {
this.volume = f;
}
public void setDone(boolean b) {
this.donePlaying = b;
}
}

View File

@ -8,6 +8,7 @@ import com.hbm.tileentity.machine.TileEntityMachineChemplant;
import com.hbm.tileentity.machine.TileEntityMachineGasCent;
import com.hbm.tileentity.machine.TileEntityMachineMiningDrill;
import net.minecraft.client.Minecraft;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
@ -43,6 +44,10 @@ public class SoundLoopCentrifuge extends SoundLoopMachine {
if(!plant.isProgressing)
this.donePlaying = true;
}
if(!Minecraft.getMinecraft().getSoundHandler().isSoundPlaying(this)) {
stop();
}
}
public TileEntity getTE() {

View File

@ -26,7 +26,7 @@ import net.minecraft.util.Vec3;
public class TileEntityYellowBarrel extends TileEntity {
@Override
/*@Override
public void updateEntity() {
int strength = 4;
float f = strength;
@ -71,7 +71,7 @@ public class TileEntityYellowBarrel extends TileEntity {
}
strength = (int)f;
}
}*/
@Override
@SideOnly(Side.CLIENT)

View File

@ -7,6 +7,7 @@ import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.entity.particle.EntityDSmokeFX;
import com.hbm.entity.particle.EntityGasFlameFX;
import com.hbm.entity.particle.EntitySSmokeFX;
import com.hbm.entity.particle.EntityTSmokeFX;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.interfaces.IConsumer;
@ -280,14 +281,13 @@ public class TileEntityMachineTurbofan extends TileEntity implements ISidedInven
for(int i = 0; i < afterburner * 5; i++)
if(afterburner > 0 && rand.nextInt(2) == 0) {
EntityGasFlameFX smoke = new EntityGasFlameFX(worldObj);
EntitySSmokeFX smoke = new EntitySSmokeFX(worldObj);
smoke.posX = xCoord + 0.5 + (rand.nextGaussian() * 0.5);
smoke.posY = yCoord + 1.5 + (rand.nextGaussian() * 0.5);
smoke.posZ = zCoord + 4.25;
//smoke.motionX = rand.nextGaussian() * 0.3;
//smoke.motionY = rand.nextGaussian() * 0.3;
smoke.motionX = rand.nextGaussian() * 0.3;
smoke.motionY = rand.nextGaussian() * 0.3;
smoke.motionZ = 2.5 + (rand.nextFloat() * 3.5);
//smoke.isBurn = true;
if(!worldObj.isRemote)
worldObj.spawnEntityInWorld(smoke);
}
@ -333,14 +333,13 @@ public class TileEntityMachineTurbofan extends TileEntity implements ISidedInven
for(int i = 0; i < afterburner * 5; i++)
if(afterburner > 0 && rand.nextInt(2) == 0) {
EntityGasFlameFX smoke = new EntityGasFlameFX(worldObj);
EntitySSmokeFX smoke = new EntitySSmokeFX(worldObj);
smoke.posX = xCoord + 0.5 + (rand.nextGaussian() * 0.5);
smoke.posY = yCoord + 1.5 + (rand.nextGaussian() * 0.5);
smoke.posZ = zCoord - 4.25;
//smoke.motionX = rand.nextGaussian() * 0.3;
//smoke.motionY = rand.nextGaussian() * 0.3;
smoke.motionX = rand.nextGaussian() * 0.3;
smoke.motionY = rand.nextGaussian() * 0.3;
smoke.motionZ = -2.5 - (rand.nextFloat() * 3.5);
//smoke.isBurn = true;
if(!worldObj.isRemote)
worldObj.spawnEntityInWorld(smoke);
}
@ -378,22 +377,21 @@ public class TileEntityMachineTurbofan extends TileEntity implements ISidedInven
smoke.posY = yCoord + 1.5 + (rand.nextGaussian() * 0.5);
smoke.posZ = zCoord + 0.5 + (rand.nextGaussian() * 0.5);
smoke.motionX = 2.5 + (rand.nextFloat() * 3.5);
//smoke.motionY = rand.nextGaussian() * 0.3;
//smoke.motionZ = rand.nextGaussian() * 0.3;
smoke.motionY = rand.nextGaussian() * 0.3;
smoke.motionZ = rand.nextGaussian() * 0.3;
if(!worldObj.isRemote)
worldObj.spawnEntityInWorld(smoke);
}
for(int i = 0; i < afterburner * 5; i++)
if(afterburner > 0 && rand.nextInt(2) == 0) {
EntityGasFlameFX smoke = new EntityGasFlameFX(worldObj);
EntitySSmokeFX smoke = new EntitySSmokeFX(worldObj);
smoke.posX = xCoord + 4.25;
smoke.posY = yCoord + 1.5 + (rand.nextGaussian() * 0.5);
smoke.posZ = zCoord + 0.5 + (rand.nextGaussian() * 0.5);
smoke.motionX = 2.5 + (rand.nextFloat() * 3.5);
//smoke.motionY = rand.nextGaussian() * 0.3;
//smoke.motionZ = rand.nextGaussian() * 0.3;
//smoke.isBurn = true;
smoke.motionY = rand.nextGaussian() * 0.3;
smoke.motionZ = rand.nextGaussian() * 0.3;
if(!worldObj.isRemote)
worldObj.spawnEntityInWorld(smoke);
}
@ -439,14 +437,13 @@ public class TileEntityMachineTurbofan extends TileEntity implements ISidedInven
for(int i = 0; i < afterburner * 5; i++)
if(afterburner > 0 && rand.nextInt(2) == 0) {
EntityGasFlameFX smoke = new EntityGasFlameFX(worldObj);
EntitySSmokeFX smoke = new EntitySSmokeFX(worldObj);
smoke.posX = xCoord - 4.25;
smoke.posY = yCoord + 1.5 + (rand.nextGaussian() * 0.5);
smoke.posZ = zCoord + 0.5 + (rand.nextGaussian() * 0.5);
smoke.motionX = -2.5 - (rand.nextFloat() * 3.5);
//smoke.motionY = rand.nextGaussian() * 0.3;
//smoke.motionZ = rand.nextGaussian() * 0.3;
//smoke.isBurn = true;
smoke.motionY = rand.nextGaussian() * 0.3;
smoke.motionZ = rand.nextGaussian() * 0.3;
if(!worldObj.isRemote)
worldObj.spawnEntityInWorld(smoke);
}