diff --git a/assets/hbm/lang/de_DE.lang b/assets/hbm/lang/de_DE.lang index 7ebf12c54..271efacb3 100644 --- a/assets/hbm/lang/de_DE.lang +++ b/assets/hbm/lang/de_DE.lang @@ -280,6 +280,8 @@ tile.crate_steel.name=Stahlkiste container.crateSteel=Stahlkiste tile.machine_press.name=Dampfpresse container.press=Dampfpresse +tile.machine_siren.name=Sirene +container.siren=Sirene tile.red_pylon.name=Strommasten item.wiring_red_copper.name=Kabeltrommel @@ -349,6 +351,7 @@ item.template_folder.name=Produktionsvorlagen-Zeichenmappe item.fluid_identifier.name=Flüssigkeits-Kennzeichnung item.assembly_template.name=Fertigungsvorlage: item.chemistry_template.name=Chemievorlage: +item.siren_track.name=Sirenentrack item.fuse.name=Sicherung @@ -949,6 +952,7 @@ item.gun_spark.name=Die Zündkerze item.gun_hp.name=HPP Lazerjet item.gun_euthanasia.name=Euthanasia item.gun_defabricator.name=Defabrikator +item.gun_dampfmaschine.name=Garantiert keine Scherzwaffe item.gun_revolver_iron_ammo.name=Patrone item.gun_revolver_ammo.name=Bleipatrone diff --git a/assets/hbm/lang/en_US.lang b/assets/hbm/lang/en_US.lang index bd31915f4..007bbdf72 100644 --- a/assets/hbm/lang/en_US.lang +++ b/assets/hbm/lang/en_US.lang @@ -280,6 +280,8 @@ tile.crate_steel.name=Steel Crate container.crateSteel=Steel Crate tile.machine_press.name=Steam Press container.press=Steam Press +tile.machine_siren.name=Siren +container.siren=Siren tile.red_pylon.name=Electricity Pole item.wiring_red_copper.name=Cable Drum @@ -349,6 +351,7 @@ item.template_folder.name=Machine Template Folder item.fluid_identifier.name=Fluid Identifier item.assembly_template.name=Assembly Template: item.chemistry_template.name=Chemistry Template: +item.siren_track.name=Siren Track item.fuse.name=Fuse @@ -952,6 +955,7 @@ item.gun_spark.name=Spark Plug item.gun_hp.name=HPP Lazerjet item.gun_euthanasia.name=Euthanasia item.gun_defabricator.name=Defabricator +item.gun_dampfmaschine.name=Totally Not a Joke Weapon item.gun_revolver_iron_ammo.name=Bullet item.gun_revolver_ammo.name=Lead Bullet diff --git a/assets/hbm/sounds.json b/assets/hbm/sounds.json index 214062f07..5637732b1 100644 --- a/assets/hbm/sounds.json +++ b/assets/hbm/sounds.json @@ -65,6 +65,15 @@ "entity.chopperCrashingLoop": {"category": "hostile", "sounds": [{"name": "entity/chopperCrashingLoop", "stream": true}]}, "entity.oldExplosion": {"category": "ambient", "sounds": [{"name": "entity/oldExplosion", "stream": false}]}, - "alarm.trainHorn": {"category": "record", "sounds": [{"name": "alarm/trainHorn", "stream": false}]}, - "alarm.razortrainHorn": {"category": "record", "sounds": [{"name": "alarm/razortrainHorn", "stream": false}]} + "alarm.amsSiren": {"category": "record", "sounds": [{"name": "alarm/amsSiren", "stream": false}]}, + "alarm.apcLoop": {"category": "record", "sounds": [{"name": "alarm/apcLoop", "stream": false}]}, + "alarm.apcPass": {"category": "record", "sounds": [{"name": "alarm/apcPass", "stream": false}]}, + "alarm.bankAlarm": {"category": "record", "sounds": [{"name": "alarm/bankAlarm", "stream": false}]}, + "alarm.beepSiren": {"category": "record", "sounds": [{"name": "alarm/beepSiren", "stream": false}]}, + "alarm.autopilot": {"category": "record", "sounds": [{"name": "alarm/boeing707AutopilotDisconnected", "stream": false}]}, + "alarm.containerAlarm": {"category": "record", "sounds": [{"name": "alarm/containerAlarm", "stream": false}]}, + "alarm.hatch": {"category": "record", "sounds": [{"name": "alarm/lpfhaiwg", "stream": false}]}, + "alarm.razortrainHorn": {"category": "record", "sounds": [{"name": "alarm/razortrainHorn", "stream": false}]}, + "alarm.sweepSiren": {"category": "record", "sounds": [{"name": "alarm/sweepSiren", "stream": false}]}, + "alarm.trainHorn": {"category": "record", "sounds": [{"name": "alarm/trainHorn", "stream": false}]} } diff --git a/assets/hbm/sounds/alarm/amsSiren.ogg b/assets/hbm/sounds/alarm/amsSiren.ogg new file mode 100644 index 000000000..1f0ec54ea Binary files /dev/null and b/assets/hbm/sounds/alarm/amsSiren.ogg differ diff --git a/assets/hbm/sounds/alarm/apcLoop.ogg b/assets/hbm/sounds/alarm/apcLoop.ogg new file mode 100644 index 000000000..7406d0e10 Binary files /dev/null and b/assets/hbm/sounds/alarm/apcLoop.ogg differ diff --git a/assets/hbm/sounds/alarm/apcPass.ogg b/assets/hbm/sounds/alarm/apcPass.ogg new file mode 100644 index 000000000..549efc2b6 Binary files /dev/null and b/assets/hbm/sounds/alarm/apcPass.ogg differ diff --git a/assets/hbm/sounds/alarm/bankAlarm.ogg b/assets/hbm/sounds/alarm/bankAlarm.ogg new file mode 100644 index 000000000..cb1de9ebd Binary files /dev/null and b/assets/hbm/sounds/alarm/bankAlarm.ogg differ diff --git a/assets/hbm/sounds/alarm/beepSiren.ogg b/assets/hbm/sounds/alarm/beepSiren.ogg new file mode 100644 index 000000000..01bfcb81e Binary files /dev/null and b/assets/hbm/sounds/alarm/beepSiren.ogg differ diff --git a/assets/hbm/sounds/alarm/containerAlarm.ogg b/assets/hbm/sounds/alarm/containerAlarm.ogg new file mode 100644 index 000000000..6383caecf Binary files /dev/null and b/assets/hbm/sounds/alarm/containerAlarm.ogg differ diff --git a/assets/hbm/sounds/alarm/lpfhaiwg.ogg b/assets/hbm/sounds/alarm/lpfhaiwg.ogg new file mode 100644 index 000000000..94b889ebf Binary files /dev/null and b/assets/hbm/sounds/alarm/lpfhaiwg.ogg differ diff --git a/assets/hbm/sounds/alarm/sweepSiren.ogg b/assets/hbm/sounds/alarm/sweepSiren.ogg new file mode 100644 index 000000000..76d03ab55 Binary files /dev/null and b/assets/hbm/sounds/alarm/sweepSiren.ogg differ diff --git a/assets/hbm/textures/blocks/machine_siren.png b/assets/hbm/textures/blocks/machine_siren.png new file mode 100644 index 000000000..d5ca4bee3 Binary files /dev/null and b/assets/hbm/textures/blocks/machine_siren.png differ diff --git a/assets/hbm/textures/blocks/sound_block.png b/assets/hbm/textures/blocks/sound_block.png deleted file mode 100644 index 05f4a4a16..000000000 Binary files a/assets/hbm/textures/blocks/sound_block.png and /dev/null differ diff --git a/assets/hbm/textures/blocks/taint_0.png b/assets/hbm/textures/blocks/taint_0.png new file mode 100644 index 000000000..0bbd12634 Binary files /dev/null and b/assets/hbm/textures/blocks/taint_0.png differ diff --git a/assets/hbm/textures/blocks/taint_1.png b/assets/hbm/textures/blocks/taint_1.png new file mode 100644 index 000000000..d6dd11a89 Binary files /dev/null and b/assets/hbm/textures/blocks/taint_1.png differ diff --git a/assets/hbm/textures/blocks/taint_10.png b/assets/hbm/textures/blocks/taint_10.png new file mode 100644 index 000000000..cd84e8bd2 Binary files /dev/null and b/assets/hbm/textures/blocks/taint_10.png differ diff --git a/assets/hbm/textures/blocks/taint_11.png b/assets/hbm/textures/blocks/taint_11.png new file mode 100644 index 000000000..cf57f7048 Binary files /dev/null and b/assets/hbm/textures/blocks/taint_11.png differ diff --git a/assets/hbm/textures/blocks/taint_12.png b/assets/hbm/textures/blocks/taint_12.png new file mode 100644 index 000000000..7be919a34 Binary files /dev/null and b/assets/hbm/textures/blocks/taint_12.png differ diff --git a/assets/hbm/textures/blocks/taint_13.png b/assets/hbm/textures/blocks/taint_13.png new file mode 100644 index 000000000..6e0ba09d3 Binary files /dev/null and b/assets/hbm/textures/blocks/taint_13.png differ diff --git a/assets/hbm/textures/blocks/taint_14.png b/assets/hbm/textures/blocks/taint_14.png new file mode 100644 index 000000000..fe299aaa0 Binary files /dev/null and b/assets/hbm/textures/blocks/taint_14.png differ diff --git a/assets/hbm/textures/blocks/taint_15.png b/assets/hbm/textures/blocks/taint_15.png new file mode 100644 index 000000000..9dd944165 Binary files /dev/null and b/assets/hbm/textures/blocks/taint_15.png differ diff --git a/assets/hbm/textures/blocks/taint_2.png b/assets/hbm/textures/blocks/taint_2.png new file mode 100644 index 000000000..cd64d383f Binary files /dev/null and b/assets/hbm/textures/blocks/taint_2.png differ diff --git a/assets/hbm/textures/blocks/taint_3.png b/assets/hbm/textures/blocks/taint_3.png new file mode 100644 index 000000000..b76629017 Binary files /dev/null and b/assets/hbm/textures/blocks/taint_3.png differ diff --git a/assets/hbm/textures/blocks/taint_4.png b/assets/hbm/textures/blocks/taint_4.png new file mode 100644 index 000000000..dd66e6245 Binary files /dev/null and b/assets/hbm/textures/blocks/taint_4.png differ diff --git a/assets/hbm/textures/blocks/taint_5.png b/assets/hbm/textures/blocks/taint_5.png new file mode 100644 index 000000000..90ba3f39c Binary files /dev/null and b/assets/hbm/textures/blocks/taint_5.png differ diff --git a/assets/hbm/textures/blocks/taint_6.png b/assets/hbm/textures/blocks/taint_6.png new file mode 100644 index 000000000..2146fb19c Binary files /dev/null and b/assets/hbm/textures/blocks/taint_6.png differ diff --git a/assets/hbm/textures/blocks/taint_7.png b/assets/hbm/textures/blocks/taint_7.png new file mode 100644 index 000000000..614bee225 Binary files /dev/null and b/assets/hbm/textures/blocks/taint_7.png differ diff --git a/assets/hbm/textures/blocks/taint_8.png b/assets/hbm/textures/blocks/taint_8.png new file mode 100644 index 000000000..aba944663 Binary files /dev/null and b/assets/hbm/textures/blocks/taint_8.png differ diff --git a/assets/hbm/textures/blocks/taint_9.png b/assets/hbm/textures/blocks/taint_9.png new file mode 100644 index 000000000..5a4ed0e18 Binary files /dev/null and b/assets/hbm/textures/blocks/taint_9.png differ diff --git a/assets/hbm/textures/blocks/taint_full.png b/assets/hbm/textures/blocks/taint_full.png new file mode 100644 index 000000000..fce2c72d0 Binary files /dev/null and b/assets/hbm/textures/blocks/taint_full.png differ diff --git a/assets/hbm/textures/blocks/taint_low.png b/assets/hbm/textures/blocks/taint_low.png new file mode 100644 index 000000000..48ee86242 Binary files /dev/null and b/assets/hbm/textures/blocks/taint_low.png differ diff --git a/assets/hbm/textures/gui/gui_siren.png b/assets/hbm/textures/gui/gui_siren.png index c84cc3dc3..2c4479905 100644 Binary files a/assets/hbm/textures/gui/gui_siren.png and b/assets/hbm/textures/gui/gui_siren.png differ diff --git a/assets/hbm/textures/gui/potions.png b/assets/hbm/textures/gui/potions.png new file mode 100644 index 000000000..8f076b78b Binary files /dev/null and b/assets/hbm/textures/gui/potions.png differ diff --git a/assets/hbm/textures/items/cap_sparkle.png b/assets/hbm/textures/items/cap_sparkle.png index 796b007f4..d0f2340e8 100644 Binary files a/assets/hbm/textures/items/cap_sparkle.png and b/assets/hbm/textures/items/cap_sparkle.png differ diff --git a/assets/hbm/textures/items/cassette.png b/assets/hbm/textures/items/cassette.png index 8c306962f..94f33fe1f 100644 Binary files a/assets/hbm/textures/items/cassette.png and b/assets/hbm/textures/items/cassette.png differ diff --git a/assets/hbm/textures/items/cassette_overlay.png b/assets/hbm/textures/items/cassette_overlay.png new file mode 100644 index 000000000..f714f1d19 Binary files /dev/null and b/assets/hbm/textures/items/cassette_overlay.png differ diff --git a/assets/hbm/textures/items/dynosphere_base.png b/assets/hbm/textures/items/dynosphere_base.png new file mode 100644 index 000000000..8bc3b3769 Binary files /dev/null and b/assets/hbm/textures/items/dynosphere_base.png differ diff --git a/assets/hbm/textures/items/dynosphere_desh.png b/assets/hbm/textures/items/dynosphere_desh.png new file mode 100644 index 000000000..85cc2adfd Binary files /dev/null and b/assets/hbm/textures/items/dynosphere_desh.png differ diff --git a/assets/hbm/textures/items/dynosphere_desh_charged.png b/assets/hbm/textures/items/dynosphere_desh_charged.png new file mode 100644 index 000000000..a30297674 Binary files /dev/null and b/assets/hbm/textures/items/dynosphere_desh_charged.png differ diff --git a/assets/hbm/textures/items/dynosphere_dineutronium.png b/assets/hbm/textures/items/dynosphere_dineutronium.png new file mode 100644 index 000000000..c88a935db Binary files /dev/null and b/assets/hbm/textures/items/dynosphere_dineutronium.png differ diff --git a/assets/hbm/textures/items/dynosphere_dineutronium_charged.png b/assets/hbm/textures/items/dynosphere_dineutronium_charged.png new file mode 100644 index 000000000..100579006 Binary files /dev/null and b/assets/hbm/textures/items/dynosphere_dineutronium_charged.png differ diff --git a/assets/hbm/textures/items/dynosphere_euphemium.png b/assets/hbm/textures/items/dynosphere_euphemium.png new file mode 100644 index 000000000..e5995b218 Binary files /dev/null and b/assets/hbm/textures/items/dynosphere_euphemium.png differ diff --git a/assets/hbm/textures/items/dynosphere_euphemium_charged.png b/assets/hbm/textures/items/dynosphere_euphemium_charged.png new file mode 100644 index 000000000..f326217a4 Binary files /dev/null and b/assets/hbm/textures/items/dynosphere_euphemium_charged.png differ diff --git a/assets/hbm/textures/items/dynosphere_schrabidium.png b/assets/hbm/textures/items/dynosphere_schrabidium.png new file mode 100644 index 000000000..feabea1b8 Binary files /dev/null and b/assets/hbm/textures/items/dynosphere_schrabidium.png differ diff --git a/assets/hbm/textures/items/dynosphere_schrabidium_charged.png b/assets/hbm/textures/items/dynosphere_schrabidium_charged.png new file mode 100644 index 000000000..d92220b32 Binary files /dev/null and b/assets/hbm/textures/items/dynosphere_schrabidium_charged.png differ diff --git a/com/hbm/blocks/ModBlocks.java b/com/hbm/blocks/ModBlocks.java index 35a68fec7..e6252fba0 100644 --- a/com/hbm/blocks/ModBlocks.java +++ b/com/hbm/blocks/ModBlocks.java @@ -9,6 +9,7 @@ import com.hbm.items.bomb.ItemPrototypeBlock; import com.hbm.items.special.ItemOreBlock; import com.hbm.items.special.ItemPlasmaBlock; import com.hbm.items.special.ItemSchrabidiumBlock; +import com.hbm.items.special.ItemTaintBlock; import com.hbm.lib.ModDamageSource; import com.hbm.lib.RefStrings; import com.hbm.main.MainRegistry; @@ -389,6 +390,9 @@ public class ModBlocks { public static Block machine_press; public static final int guiID_machine_press = 53; + public static Block machine_siren; + public static final int guiID_siren = 57; + public static Block turret_light; public static Block turret_heavy; public static Block turret_rocket; @@ -410,6 +414,7 @@ public class ModBlocks { public static Block crystal_virus; public static Block crystal_hardened; public static Block crystal_pulsar; + public static Block taint; public static Block mud_block; public static Fluid mud_fluid; @@ -748,12 +753,15 @@ public class ModBlocks { machine_schrabidium_transmutator = new MachineSchrabidiumTransmutator(Material.iron).setBlockName("machine_schrabidium_transmutator").setHardness(5.0F).setResistance(100.0F).setCreativeTab(MainRegistry.tabBlock); machine_reix_mainframe = new MachineReiXMainframe(Material.iron).setBlockName("machine_reix_mainframe").setHardness(5.0F).setResistance(100.0F).setCreativeTab(MainRegistry.tabBlock); + + machine_siren = new MachineSiren(Material.iron).setBlockName("machine_siren").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabNuke).setBlockTextureName(RefStrings.MODID + ":machine_siren"); cheater_virus = new CheaterVirus(Material.iron).setBlockName("cheater_virus").setHardness(Float.POSITIVE_INFINITY).setResistance(Float.POSITIVE_INFINITY).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":cheater_virus"); cheater_virus_seed = new CheaterVirusSeed(Material.iron).setBlockName("cheater_virus_seed").setHardness(Float.POSITIVE_INFINITY).setResistance(Float.POSITIVE_INFINITY).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":cheater_virus_seed"); crystal_virus = new CrystalVirus(Material.iron).setBlockName("crystal_virus").setHardness(15.0F).setResistance(Float.POSITIVE_INFINITY).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":crystal_virus"); crystal_hardened = new BlockGeneric(Material.iron).setBlockName("crystal_hardened").setHardness(15.0F).setResistance(Float.POSITIVE_INFINITY).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":crystal_hardened"); crystal_pulsar = new CrystalPulsar(Material.iron).setBlockName("crystal_pulsar").setHardness(15.0F).setResistance(Float.POSITIVE_INFINITY).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":crystal_pulsar"); + taint = new BlockTaint(Material.iron).setBlockName("taint").setHardness(15.0F).setResistance(10.0F).setCreativeTab(null); statue_elb = new DecoBlockAlt(Material.iron).setBlockName("#null").setHardness(Float.POSITIVE_INFINITY).setResistance(Float.POSITIVE_INFINITY); statue_elb_g = new DecoBlockAlt(Material.iron).setBlockName("#void").setHardness(Float.POSITIVE_INFINITY).setResistance(Float.POSITIVE_INFINITY); @@ -967,6 +975,9 @@ public class ModBlocks { GameRegistry.registerBlock(red_barrel, red_barrel.getUnlocalizedName()); GameRegistry.registerBlock(yellow_barrel, yellow_barrel.getUnlocalizedName()); + //Siren + GameRegistry.registerBlock(machine_siren, machine_siren.getUnlocalizedName()); + //Silo Hatch GameRegistry.registerBlock(seal_frame, seal_frame.getUnlocalizedName()); GameRegistry.registerBlock(seal_controller, seal_controller.getUnlocalizedName()); @@ -1152,6 +1163,7 @@ public class ModBlocks { GameRegistry.registerBlock(crystal_virus, crystal_virus.getUnlocalizedName()); GameRegistry.registerBlock(crystal_hardened, crystal_hardened.getUnlocalizedName()); GameRegistry.registerBlock(crystal_pulsar, crystal_pulsar.getUnlocalizedName()); + GameRegistry.registerBlock(taint, ItemTaintBlock.class, taint.getUnlocalizedName()); GameRegistry.registerBlock(cheater_virus, cheater_virus.getUnlocalizedName()); GameRegistry.registerBlock(cheater_virus_seed, cheater_virus_seed.getUnlocalizedName()); } diff --git a/com/hbm/blocks/bomb/BlockTaint.java b/com/hbm/blocks/bomb/BlockTaint.java new file mode 100644 index 000000000..f52e41aea --- /dev/null +++ b/com/hbm/blocks/bomb/BlockTaint.java @@ -0,0 +1,175 @@ +package com.hbm.blocks.bomb; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +import com.hbm.blocks.ModBlocks; +import com.hbm.lib.ModDamageSource; +import com.hbm.main.MainRegistry; +import com.hbm.potion.PotionEffectTaint; +import com.hbm.tileentity.deco.TileEntityTaint; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemDye; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.PotionEffect; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +public class BlockTaint extends BlockContainer { + + @SideOnly(Side.CLIENT) + private IIcon[] icons; + + public BlockTaint(Material p_i45386_1_) { + super(p_i45386_1_); + this.setTickRandomly(true); + } + + @Override + public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { + return new TileEntityTaint(); + } + + @SideOnly(Side.CLIENT) + public IIcon getIcon(int p_149691_1_, int meta) + { + return this.icons[meta % this.icons.length]; + } + + public int damageDropped(int meta) + { + return 0; + } + + public static int func_150032_b(int p_150032_0_) + { + return func_150031_c(p_150032_0_); + } + + public static int func_150031_c(int p_150031_0_) + { + return p_150031_0_ & 15; + } + + @SideOnly(Side.CLIENT) + public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_) + { + for (int i = 0; i < 16; ++i) + { + p_149666_3_.add(new ItemStack(p_149666_1_, 1, i)); + } + } + + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister p_149651_1_) + { + this.icons = new IIcon[16]; + + for (int i = 0; i < this.icons.length; ++i) + { + this.icons[i] = p_149651_1_.registerIcon("hbm:taint_" + i); + } + } + + public MapColor getMapColor(int p_149728_1_) + { + return MapColor.purpleColor; + } + + @Override + public int getRenderType(){ + return -1; + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + public void onNeighborBlockChange(World world, int x, int y, int z, Block b) + { + if(!hasPosNeightbour(world, x, y, z) && !world.isRemote) + world.setBlockToAir(x, y, z); + } + + public void updateTick(World world, int x, int y, int z, Random rand) + { + int meta = world.getBlockMetadata(x, y, z); + if(!world.isRemote && meta < 15) { + + for(int i = 0; i < 15; i++) { + int a = rand.nextInt(11) + x - 5; + int b = rand.nextInt(11) + y - 5; + int c = rand.nextInt(11) + z - 5; + if(world.getBlock(a, b, c).isReplaceable(world, a, b, c) && hasPosNeightbour(world, a, b, c)) + world.setBlock(a, b, c, ModBlocks.taint, meta + 1, 2); + } + + for(int i = 0; i < 85; i++) { + int a = rand.nextInt(7) + x - 3; + int b = rand.nextInt(7) + y - 3; + int c = rand.nextInt(7) + z - 3; + if(world.getBlock(a, b, c).isReplaceable(world, a, b, c) && hasPosNeightbour(world, a, b, c)) + world.setBlock(a, b, c, ModBlocks.taint, meta + 1, 2); + } + } + } + + public static boolean hasPosNeightbour(World world, int x, int y, int z) { + Block b0 = world.getBlock(x + 1, y, z); + Block b1 = world.getBlock(x, y + 1, z); + Block b2 = world.getBlock(x, y, z + 1); + Block b3 = world.getBlock(x - 1, y, z); + Block b4 = world.getBlock(x, y - 1, z); + Block b5 = world.getBlock(x, y, z - 1); + boolean b = (b0.renderAsNormalBlock() && b0.getMaterial().isOpaque()) || + (b1.renderAsNormalBlock() && b1.getMaterial().isOpaque()) || + (b2.renderAsNormalBlock() && b2.getMaterial().isOpaque()) || + (b3.renderAsNormalBlock() && b3.getMaterial().isOpaque()) || + (b4.renderAsNormalBlock() && b4.getMaterial().isOpaque()) || + (b5.renderAsNormalBlock() && b5.getMaterial().isOpaque()); + return b; + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return null; + } + + @Override + public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return AxisAlignedBB.getBoundingBox(par2, par3, par4, par2, par3, par4); + } + + @Override + public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { + List list = new ArrayList(); + PotionEffect effect = new PotionEffect(PotionEffectTaint.instance.id, 15 * 20, 0); + effect.setCurativeItems(list); + if(entity instanceof EntityLivingBase) + ((EntityLivingBase)entity).addPotionEffect(effect); + } + +} diff --git a/com/hbm/blocks/generic/WasteEarth.java b/com/hbm/blocks/generic/WasteEarth.java index d1ff7e5cd..1513a5e46 100644 --- a/com/hbm/blocks/generic/WasteEarth.java +++ b/com/hbm/blocks/generic/WasteEarth.java @@ -58,7 +58,7 @@ public class WasteEarth extends Block { @Override public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { - if(this == ModBlocks.waste_earth || this == ModBlocks.waste_earth) + if(this == ModBlocks.waste_earth || this == ModBlocks.waste_mycelium) { return Item.getItemFromBlock(Blocks.dirt); } @@ -68,7 +68,7 @@ public class WasteEarth extends Block { return Items.snowball; } - return null; + return Item.getItemFromBlock(this); } @Override diff --git a/com/hbm/blocks/machine/MachineSiren.java b/com/hbm/blocks/machine/MachineSiren.java new file mode 100644 index 000000000..4a5226239 --- /dev/null +++ b/com/hbm/blocks/machine/MachineSiren.java @@ -0,0 +1,66 @@ +package com.hbm.blocks.machine; + +import com.hbm.blocks.ModBlocks; +import com.hbm.lib.RefStrings; +import com.hbm.main.MainRegistry; +import com.hbm.tileentity.machine.TileEntityConverterHeRf; +import com.hbm.tileentity.machine.TileEntityMachineSiren; + +import cpw.mods.fml.common.network.internal.FMLNetworkHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +public class MachineSiren extends BlockContainer { + + @SideOnly(Side.CLIENT) + private IIcon iconTop; + + public MachineSiren(Material p_i45386_1_) { + super(p_i45386_1_); + } + + @Override + public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { + return new TileEntityMachineSiren(); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconRegister) { + + this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":block_steel"); + this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_siren"); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int metadata) { + return side == 1 ? this.iconTop : (side == 0 ? this.iconTop : this.blockIcon); + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { + if(world.isRemote) + { + return true; + } else if(!player.isSneaking()) + { + TileEntityMachineSiren entity = (TileEntityMachineSiren) world.getTileEntity(x, y, z); + if(entity != null) + { + FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_siren, world, x, y, z); + } + return true; + } else { + return false; + } + } + +} diff --git a/com/hbm/blocks/test/TestEventTester.java b/com/hbm/blocks/test/TestEventTester.java index 11eb2f5c1..84d54aa33 100644 --- a/com/hbm/blocks/test/TestEventTester.java +++ b/com/hbm/blocks/test/TestEventTester.java @@ -12,6 +12,7 @@ import com.hbm.entity.effect.EntityBlackHole; import com.hbm.entity.projectile.EntityMeteor; import com.hbm.main.MainRegistry; import com.hbm.main.ModEventHandler; +import com.hbm.potion.PotionEffectTaint; import com.hbm.world.Meteorite; import net.minecraft.block.Block; @@ -20,6 +21,7 @@ import net.minecraft.enchantment.EnchantmentProtection; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.potion.PotionEffect; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MathHelper; @@ -212,8 +214,12 @@ public class TestEventTester extends Block { //ExplosionChaos.anvil(par1World, par2, par3 + 2, par4, 1); //return true; - System.out.println(par5EntityPlayer.getCommandSenderName()); - System.out.println(par5EntityPlayer.getUniqueID()); + //System.out.println(par5EntityPlayer.getCommandSenderName()); + //System.out.println(par5EntityPlayer.getUniqueID()); + List list = new ArrayList(); + PotionEffect effect = new PotionEffect(PotionEffectTaint.instance.id, 300, 0); + effect.setCurativeItems(list); + par5EntityPlayer.addPotionEffect(effect); return true; } diff --git a/com/hbm/handler/GUIHandler.java b/com/hbm/handler/GUIHandler.java index 9e7f93239..fc993c6b2 100644 --- a/com/hbm/handler/GUIHandler.java +++ b/com/hbm/handler/GUIHandler.java @@ -53,6 +53,7 @@ import com.hbm.tileentity.machine.TileEntityMachineReactor; import com.hbm.tileentity.machine.TileEntityMachineRefinery; import com.hbm.tileentity.machine.TileEntityMachineSchrabidiumTransmutator; import com.hbm.tileentity.machine.TileEntityMachineShredder; +import com.hbm.tileentity.machine.TileEntityMachineSiren; import com.hbm.tileentity.machine.TileEntityMachineTeleporter; import com.hbm.tileentity.machine.TileEntityMachineTurbofan; import com.hbm.tileentity.machine.TileEntityMachineUF6Tank; @@ -568,6 +569,15 @@ public class GUIHandler implements IGuiHandler { } return null; } + + case ModBlocks.guiID_siren: + { + if(entity instanceof TileEntityMachineSiren) + { + return new ContainerMachineSiren(player.inventory, (TileEntityMachineSiren) entity); + } + return null; + } } return null; } @@ -1073,6 +1083,15 @@ public class GUIHandler implements IGuiHandler { } return null; } + + case ModBlocks.guiID_siren: + { + if(entity instanceof TileEntityMachineSiren) + { + return new GUIMachineSiren(player.inventory, (TileEntityMachineSiren) entity); + } + return null; + } } } else { //CLIENTONLY GUIS diff --git a/com/hbm/inventory/container/ContainerMachineSiren.java b/com/hbm/inventory/container/ContainerMachineSiren.java new file mode 100644 index 000000000..022795523 --- /dev/null +++ b/com/hbm/inventory/container/ContainerMachineSiren.java @@ -0,0 +1,84 @@ +package com.hbm.inventory.container; + +import com.hbm.inventory.SlotMachineOutput; +import com.hbm.tileentity.machine.TileEntityMachineSiren; +import com.hbm.tileentity.machine.TileEntityMachineTurbofan; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class ContainerMachineSiren extends Container { + + private TileEntityMachineSiren diFurnace; + private int afterburner; + + public ContainerMachineSiren(InventoryPlayer invPlayer, TileEntityMachineSiren tedf) { + afterburner = 0; + + diFurnace = tedf; + + this.addSlotToContainer(new Slot(tedf, 0, 8, 35)); + + for(int i = 0; i < 3; i++) + { + for(int j = 0; j < 9; j++) + { + this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); + } + } + + for(int i = 0; i < 9; i++) + { + this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142)); + } + } + + @Override + public void addCraftingToCrafters(ICrafting crafting) { + super.addCraftingToCrafters(crafting); + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) + { + ItemStack var3 = null; + Slot var4 = (Slot) this.inventorySlots.get(par2); + + if (var4 != null && var4.getHasStack()) + { + ItemStack var5 = var4.getStack(); + var3 = var5.copy(); + + if (par2 <= 0) { + if (!this.mergeItemStack(var5, 1, this.inventorySlots.size(), true)) + { + return null; + } + } + else if (!this.mergeItemStack(var5, 0, 1, false)) + { + return null; + } + + if (var5.stackSize == 0) + { + var4.putStack((ItemStack) null); + } + else + { + var4.onSlotChanged(); + } + } + + return var3; + } + + @Override + public boolean canInteractWith(EntityPlayer player) { + return diFurnace.isUseableByPlayer(player); + } +} diff --git a/com/hbm/inventory/gui/GUIMachineSiren.java b/com/hbm/inventory/gui/GUIMachineSiren.java new file mode 100644 index 000000000..1d2f6425a --- /dev/null +++ b/com/hbm/inventory/gui/GUIMachineSiren.java @@ -0,0 +1,52 @@ +package com.hbm.inventory.gui; + +import org.lwjgl.opengl.GL11; + +import com.hbm.inventory.container.ContainerMachineBattery; +import com.hbm.inventory.container.ContainerMachineSiren; +import com.hbm.items.tool.ItemCassette.TrackType; +import com.hbm.lib.RefStrings; +import com.hbm.tileentity.machine.TileEntityMachineBattery; +import com.hbm.tileentity.machine.TileEntityMachineSiren; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; + +public class GUIMachineSiren extends GuiContainer { + + private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_siren.png"); + private TileEntityMachineSiren siren; + + public GUIMachineSiren(InventoryPlayer invPlayer, TileEntityMachineSiren tedf) { + super(new ContainerMachineSiren(invPlayer, tedf)); + siren = tedf; + + this.xSize = 176; + this.ySize = 166; + } + + @Override + protected void drawGuiContainerForegroundLayer(int i, int j) { + String name = this.siren.hasCustomInventoryName() ? this.siren.getInventoryName() : I18n.format(this.siren.getInventoryName()); + this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); + this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + + //Draw record meta here// + if(!siren.getCurrentType().name().equals(TrackType.NULL.name())) { + int color = siren.getCurrentType().getColor(); + this.fontRendererObj.drawString(siren.getCurrentType().getTrackTitle(), 46, 28, color); + this.fontRendererObj.drawString("Type: " + siren.getCurrentType().getType().name(), 46, 40, color); + this.fontRendererObj.drawString("Volume: " + siren.getCurrentType().getVolume(), 46, 52, color); + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + Minecraft.getMinecraft().getTextureManager().bindTexture(texture); + drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); + } +} diff --git a/com/hbm/inventory/gui/GUIScreenTemplateFolder.java b/com/hbm/inventory/gui/GUIScreenTemplateFolder.java index b314b44c5..e048e9a00 100644 --- a/com/hbm/inventory/gui/GUIScreenTemplateFolder.java +++ b/com/hbm/inventory/gui/GUIScreenTemplateFolder.java @@ -10,6 +10,8 @@ import com.hbm.handler.FluidTypeHandler.FluidType; import com.hbm.inventory.MachineRecipes; import com.hbm.items.ModItems; import com.hbm.items.tool.ItemAssemblyTemplate.EnumAssemblyTemplate; +import com.hbm.items.tool.ItemCassette; +import com.hbm.items.tool.ItemCassette.TrackType; import com.hbm.items.tool.ItemChemistryTemplate; import com.hbm.items.tool.ItemFluidIdentifier; import com.hbm.lib.RefStrings; @@ -51,6 +53,9 @@ public class GUIScreenTemplateFolder extends GuiScreen { stacks.add(new ItemStack(i)); for(Item i : MachineRecipes.stamps_circuit) stacks.add(new ItemStack(i)); + //Tracks + for(int i = 1; i < ItemCassette.TrackType.values().length; i++) + stacks.add(new ItemStack(ModItems.siren_track, 1, i)); //Fluid IDs for(int i = 1; i < FluidType.values().length; i++) stacks.add(new ItemStack(ModItems.fluid_identifier, 1, i)); @@ -202,9 +207,12 @@ public class GUIScreenTemplateFolder extends GuiScreen { return; String s = info; - if(stack != null) + if(stack != null) { if(stack.getItem() instanceof ItemFluidIdentifier) s += (": " + I18n.format(FluidType.getEnum(stack.getItemDamage()).getUnlocalizedName())); + else if(stack.getItem() instanceof ItemCassette) + s = TrackType.getEnum(stack.getItemDamage()).getTrackTitle(); + } func_146283_a(Arrays.asList(new String[] { s }), x, y); } diff --git a/com/hbm/items/ModItems.java b/com/hbm/items/ModItems.java index f6d6a0313..d987fe14e 100644 --- a/com/hbm/items/ModItems.java +++ b/com/hbm/items/ModItems.java @@ -607,6 +607,7 @@ public class ModItems { public static Item chemistry_icon; public static Item fluid_identifier; public static Item fluid_icon; + public static Item siren_track; public static Item missile_generic; public static Item missile_anti_ballistic; @@ -688,6 +689,7 @@ public class ModItems { public static Item gun_twigun_ammo; public static Item gun_defabricator; public static Item gun_defabricator_ammo; + public static Item gun_dampfmaschine; public static Item gun_waluigi; public static Item grenade_generic; @@ -1733,6 +1735,7 @@ public class ModItems { gun_defabricator = new GunDefabricator().setUnlocalizedName("gun_defabricator").setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":gun_defabricator"); gun_super_shotgun = new ItemCustomLore().setUnlocalizedName("gun_super_shotgun").setMaxStackSize(1).setFull3D().setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":gun_super_shotgun"); gun_moist_nugget = new ItemNugget(3, false).setUnlocalizedName("gun_moist_nugget").setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":gun_moist_nugget"); + gun_dampfmaschine = new GunDampfmaschine().setUnlocalizedName("gun_dampfmaschine").setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":gun_dampfmaschine"); grenade_generic = new ItemGrenade().setUnlocalizedName("grenade_generic").setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":grenade_generic"); grenade_strong = new ItemGrenade().setUnlocalizedName("grenade_strong").setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":grenade_strong"); @@ -1932,6 +1935,7 @@ public class ModItems { fluid_barrel_full = new ItemFluidTank().setUnlocalizedName("fluid_barrel_full").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":fluid_barrel"); fluid_barrel_empty = new Item().setUnlocalizedName("fluid_barrel_empty").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":fluid_barrel"); fluid_barrel_infinite = new Item().setUnlocalizedName("fluid_barrel_infinite").setMaxStackSize(1).setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":fluid_barrel_infinite"); + siren_track = new ItemCassette().setUnlocalizedName("siren_track").setMaxStackSize(1).setCreativeTab(MainRegistry.tabMachine).setTextureName(RefStrings.MODID + ":cassette"); euphemium_helmet = new ArmorEuphemium(MainRegistry.enumArmorMaterialEuphemium, 6, 0).setUnlocalizedName("astatine_helmet").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":euphemium_helmet"); euphemium_plate = new ArmorEuphemium(MainRegistry.enumArmorMaterialEuphemium, 6, 1).setUnlocalizedName("astatine_plate").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":euphemium_plate"); @@ -2638,6 +2642,7 @@ public class ModItems { GameRegistry.registerItem(upgrade_afterburn_3, upgrade_afterburn_3.getUnlocalizedName()); //Machine Templates + GameRegistry.registerItem(siren_track, siren_track.getUnlocalizedName()); GameRegistry.registerItem(fluid_identifier, fluid_identifier.getUnlocalizedName()); GameRegistry.registerItem(fluid_icon, fluid_icon.getUnlocalizedName()); GameRegistry.registerItem(assembly_template, assembly_template.getUnlocalizedName()); @@ -2881,6 +2886,7 @@ public class ModItems { GameRegistry.registerItem(gun_defabricator, gun_defabricator.getUnlocalizedName()); GameRegistry.registerItem(gun_super_shotgun, gun_super_shotgun.getUnlocalizedName()); GameRegistry.registerItem(gun_moist_nugget, gun_moist_nugget.getUnlocalizedName()); + GameRegistry.registerItem(gun_dampfmaschine, gun_dampfmaschine.getUnlocalizedName()); //Ammo GameRegistry.registerItem(gun_revolver_iron_ammo, gun_revolver_iron_ammo.getUnlocalizedName()); diff --git a/com/hbm/items/special/ItemTaintBlock.java b/com/hbm/items/special/ItemTaintBlock.java new file mode 100644 index 000000000..8a68ad6f7 --- /dev/null +++ b/com/hbm/items/special/ItemTaintBlock.java @@ -0,0 +1,42 @@ +package com.hbm.items.special; + +import com.hbm.blocks.ModBlocks; +import com.hbm.blocks.bomb.BlockTaint; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.block.BlockColored; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemDye; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +public class ItemTaintBlock extends ItemBlock +{ + private static final String __OBFID = "CL_00000075"; + + public ItemTaintBlock(Block p_i45358_1_) + { + super(p_i45358_1_); + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + /** + * Gets an icon index based on an item's damage value + */ + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int p_77617_1_) + { + return this.field_150939_a.func_149735_b(2, BlockTaint.func_150032_b(p_77617_1_)); + } + + /** + * Returns the metadata of the block which this Item (ItemBlock) can place + */ + public int getMetadata(int p_77647_1_) + { + return p_77647_1_; + } +} diff --git a/com/hbm/items/tool/ItemCassette.java b/com/hbm/items/tool/ItemCassette.java new file mode 100644 index 000000000..a43deef2c --- /dev/null +++ b/com/hbm/items/tool/ItemCassette.java @@ -0,0 +1,171 @@ +package com.hbm.items.tool; + +import java.util.List; + +import com.hbm.handler.FluidTypeHandler.FluidType; +import com.hbm.tileentity.conductor.TileEntityFluidDuct; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.client.resources.I18n; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; + +public class ItemCassette extends Item { + + IIcon overlayIcon; + + public enum TrackType { + + NULL( " ", null, SoundType.SOUND, 0, 0), + HATCH( "Hatch Siren", new ResourceLocation("hbm:alarm.hatch"), SoundType.LOOP, 3358839, 250), + ATUOPILOT( "Autopilot Disconnected", new ResourceLocation("hbm:alarm.autopilot"), SoundType.LOOP, 11908533, 50), + AMS_SIREN( "AMS Siren", new ResourceLocation("hbm:alarm.amsSiren"), SoundType.LOOP, 15055698, 50), + APC_LOOP( "APC Siren", new ResourceLocation("hbm:alarm.apcLoop"), SoundType.LOOP, 3565216, 50), + BANK_ALARM( "Bank Alarm", new ResourceLocation("hbm:alarm.bankAlarm"), SoundType.LOOP, 3572962, 100), + BEEP_SIREN( "Beep Siren", new ResourceLocation("hbm:alarm.beepSiren"), SoundType.LOOP, 13882323, 100), + CONTAINER_ALARM( "Container Alarm", new ResourceLocation("hbm:alarm.containerAlarm"), SoundType.LOOP, 14727839, 100), + SWEEP_SIREN( "Sweep Siren", new ResourceLocation("hbm:alarm.sweepSiren"), SoundType.LOOP, 15592026, 500), + APC_PASS( "APC Pass", new ResourceLocation("hbm:alarm.apcPass"), SoundType.PASS, 3422163, 50), + RAZORTRAIN( "Razortrain Horn", new ResourceLocation("hbm:alarm.razortrainHorn"), SoundType.SOUND, 7819501, 250); + + //Name of the track shown in GUI + private String title; + //Location of the sound + private ResourceLocation location; + //Sound type, whether the sound should be repeated or not + private SoundType type; + //Color of the cassette + private int color; + //Range where the sound can be heard + private int volume; + + private TrackType(String name, ResourceLocation loc, SoundType sound, int msa, int intensity) { + title = name; + location = loc; + type = sound; + color = msa; + volume = intensity; + } + + public String getTrackTitle() { + return title; + } + + public ResourceLocation getSoundLocation() { + return location; + } + + public SoundType getType() { + return type; + } + + public int getColor() { + return color; + } + + public int getVolume() { + return volume; + } + + public static TrackType getEnum(int i) { + if(i < TrackType.values().length) + return TrackType.values()[i]; + else + return TrackType.NULL; + } + }; + + public enum SoundType { + LOOP, + PASS, + SOUND; + }; + + public ItemCassette() + { + this.setHasSubtypes(true); + this.setMaxDamage(0); + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item item, CreativeTabs tabs, List list) + { + for (int i = 1; i < TrackType.values().length; ++i) + { + list.add(new ItemStack(item, 1, i)); + } + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) + { + + if(!(stack.getItem() instanceof ItemCassette)) + return; + + list.add("Siren sound cassette:"); + list.add(" Name: " + TrackType.getEnum(stack.getItemDamage()).getTrackTitle()); + list.add(" Type: " + TrackType.getEnum(stack.getItemDamage()).getType().name()); + list.add(" Volume: " + TrackType.getEnum(stack.getItemDamage()).getVolume()); + } + + public static TrackType getType(ItemStack stack) { + if(stack != null && stack.getItem() instanceof ItemCassette) + return TrackType.getEnum(stack.getItemDamage()); + else + return TrackType.NULL; + } + + @Override + @SideOnly(Side.CLIENT) + public boolean requiresMultipleRenderPasses() + { + return true; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister p_94581_1_) + { + super.registerIcons(p_94581_1_); + + this.overlayIcon = p_94581_1_.registerIcon("hbm:cassette_overlay"); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamageForRenderPass(int p_77618_1_, int p_77618_2_) + { + return p_77618_2_ == 1 ? this.overlayIcon : super.getIconFromDamageForRenderPass(p_77618_1_, p_77618_2_); + } + + @Override + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(ItemStack stack, int p_82790_2_) + { + if (p_82790_2_ == 0) + { + return 16777215; + } + else + { + int j = TrackType.getEnum(stack.getItemDamage()).getColor(); + + if (j < 0) + { + j = 16777215; + } + + return j; + } + } +} diff --git a/com/hbm/items/tool/ItemTemplateFolder.java b/com/hbm/items/tool/ItemTemplateFolder.java index 838a9240c..8e422547e 100644 --- a/com/hbm/items/tool/ItemTemplateFolder.java +++ b/com/hbm/items/tool/ItemTemplateFolder.java @@ -29,6 +29,7 @@ public class ItemTemplateFolder extends Item { list.add("Machine Templates: Paper + Dye"); list.add("Fluid IDs: Iron Plate + Dye"); list.add("Press Stamps: Flat Stamp"); + list.add("Siren Tracks: Insulator + Steel Plate"); } } diff --git a/com/hbm/items/weapon/GunDampfmaschine.java b/com/hbm/items/weapon/GunDampfmaschine.java new file mode 100644 index 000000000..102ebd217 --- /dev/null +++ b/com/hbm/items/weapon/GunDampfmaschine.java @@ -0,0 +1,118 @@ +package com.hbm.items.weapon; + +import java.util.List; +import java.util.Random; + +import com.google.common.collect.Multimap; +import com.hbm.entity.missile.EntityBombletSelena; +import com.hbm.entity.missile.EntityBombletTheta; +import com.hbm.entity.projectile.EntityBullet; +import com.hbm.entity.projectile.EntityRocket; +import com.hbm.items.ModItems; + +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraftforge.event.entity.player.ArrowNockEvent; + +public class GunDampfmaschine extends Item { + + Random rand = new Random(); + + public GunDampfmaschine() + { + this.maxStackSize = 1; + } + + @Override + public EnumAction getItemUseAction(ItemStack par1ItemStack) { + return EnumAction.bow; + } + + @Override + public int getMaxItemUseDuration(ItemStack p_77626_1_) { + return 72000; + } + + @Override + public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) { + ArrowNockEvent event = new ArrowNockEvent(p_77659_3_, p_77659_1_); + { + p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_)); + } + + return p_77659_1_; + } + + @Override + public void onUsingTick(ItemStack stack, EntityPlayer player, int count) + { + World world = player.worldObj; + + if (true) { + + if(!player.isSneaking()) { + EntityRocket entitybullet = new EntityRocket(world, player, 3.0F); + + world.playSoundAtEntity(player, "hbm:block.crateBreak", 10.0F, 0.9F + (rand.nextFloat() * 0.2F)); + if(count == this.getMaxItemUseDuration(stack)) + world.playSoundAtEntity(player, "hbm:alarm.autopilot", 100.0F, 1.0F); + + if (!world.isRemote) { + world.spawnEntityInWorld(entitybullet); + } + } else { + + world.playSoundAtEntity(player, "mob.pig.say", 10.0F, 0.9F + (rand.nextFloat() * 0.2F)); + + if(count % 10 == 0) { + EntityBombletSelena bomb = new EntityBombletSelena(world); + bomb.posX = player.posX; + bomb.posY = player.posY + player.eyeHeight; + bomb.posZ = player.posZ; + bomb.motionX = player.getLookVec().xCoord * 5; + bomb.motionY = player.getLookVec().yCoord * 5; + bomb.motionZ = player.getLookVec().zCoord * 5; + if(count == this.getMaxItemUseDuration(stack)) + world.playSoundAtEntity(player, "hbm:alarm.razortrainHorn", 10.0F, 1.0F); + + if (!world.isRemote) { + world.spawnEntityInWorld(bomb); + } + } + } + } + } + + @Override + public int getItemEnchantability() { + return 0; + } + + @Override + public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) { + + list.add("Sometimes, to do the right thing,"); + list.add("you need to be the villain of"); + list.add("the pl-I mean me too, thanks."); + list.add(""); + list.add("oh sorry how did this get here i'm not good with computer can somebody tell me how i can get out of here oh fiddlesticks this is not good oh no please can anybody hear me i am afraid please for the love of god somebody get me out of here"); + list.add(""); + list.add("Ammo: orang"); + list.add("Damage: aaaaaaaaa"); + } + + @Override + public Multimap getItemAttributeModifiers() { + Multimap multimap = super.getItemAttributeModifiers(); + multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(field_111210_e, "Weapon modifier", -2, 0)); + return multimap; + } +} diff --git a/com/hbm/lib/Library.java b/com/hbm/lib/Library.java index df335fec8..172e01859 100644 --- a/com/hbm/lib/Library.java +++ b/com/hbm/lib/Library.java @@ -1345,4 +1345,12 @@ public class Library { return false; } + + public static int getFirstNullIndex(int start, Object[] array) { + for(int i = start; i < array.length; i++) { + if(array[i] == null) + return i; + } + return -1; + } } diff --git a/com/hbm/lib/ModDamageSource.java b/com/hbm/lib/ModDamageSource.java index d32c1d10e..007aad44b 100644 --- a/com/hbm/lib/ModDamageSource.java +++ b/com/hbm/lib/ModDamageSource.java @@ -32,6 +32,7 @@ public class ModDamageSource extends DamageSource { public static DamageSource turbofan = (new DamageSource("blender")).setDamageIsAbsolute().setDamageBypassesArmor(); public static DamageSource meteorite = (new DamageSource("meteorite")).setDamageIsAbsolute().setDamageBypassesArmor(); public static DamageSource boxcar = (new DamageSource("boxcar")).setDamageIsAbsolute().setDamageBypassesArmor(); + public static DamageSource taint = (new DamageSource("taint")).setDamageIsAbsolute().setDamageBypassesArmor(); public ModDamageSource(String p_i1566_1_) { super(p_i1566_1_); diff --git a/com/hbm/main/ClientProxy.java b/com/hbm/main/ClientProxy.java index 73ccb4e06..f057d439a 100644 --- a/com/hbm/main/ClientProxy.java +++ b/com/hbm/main/ClientProxy.java @@ -133,6 +133,8 @@ public class ClientProxy extends ServerProxy MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.pole_top), new ItemRenderPoleTop()); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.pole_satellite_receiver), new ItemRenderSatelliteReceiver()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTaint.class, new RenderTaint()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_revolver, new ItemRenderRevolver()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_revolver_iron, new ItemRenderRevolverIron()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_revolver_gold, new ItemRenderRevolverGold()); @@ -162,6 +164,7 @@ public class ClientProxy extends ServerProxy MinecraftForgeClient.registerItemRenderer(ModItems.gun_dash, new ItemRenderOverkill()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_twigun, new ItemRenderOverkill()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_revolver_pip, new ItemRenderOverkill()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_dampfmaschine, new ItemRenderBullshit()); MinecraftForgeClient.registerItemRenderer(ModItems.multitool_dig, new ItemRenderMultitool()); MinecraftForgeClient.registerItemRenderer(ModItems.multitool_silk, new ItemRenderMultitool()); diff --git a/com/hbm/main/MainRegistry.java b/com/hbm/main/MainRegistry.java index 13f5a510c..73a6e346b 100644 --- a/com/hbm/main/MainRegistry.java +++ b/com/hbm/main/MainRegistry.java @@ -8,6 +8,7 @@ import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; import net.minecraft.stats.Achievement; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; @@ -139,6 +140,7 @@ import com.hbm.lib.HbmWorld; import com.hbm.lib.Library; import com.hbm.lib.RefStrings; import com.hbm.packet.PacketDispatcher; +import com.hbm.potion.PotionEffectTaint; import com.hbm.tileentity.bomb.TileEntityBombMulti; import com.hbm.tileentity.bomb.TileEntityCrashedBomb; import com.hbm.tileentity.bomb.TileEntityLaunchPad; @@ -173,6 +175,7 @@ import com.hbm.tileentity.deco.TileEntityDecoSteelPoles; import com.hbm.tileentity.deco.TileEntityDecoTapeRecorder; import com.hbm.tileentity.deco.TileEntityObjTester; import com.hbm.tileentity.deco.TileEntityRotationTester; +import com.hbm.tileentity.deco.TileEntityTaint; import com.hbm.tileentity.deco.TileEntityTestContainer; import com.hbm.tileentity.deco.TileEntityTestRender; import com.hbm.tileentity.deco.TileEntityYellowBarrel; @@ -215,6 +218,7 @@ import com.hbm.tileentity.machine.TileEntityMachineReactor; import com.hbm.tileentity.machine.TileEntityMachineRefinery; import com.hbm.tileentity.machine.TileEntityMachineSchrabidiumTransmutator; import com.hbm.tileentity.machine.TileEntityMachineShredder; +import com.hbm.tileentity.machine.TileEntityMachineSiren; import com.hbm.tileentity.machine.TileEntityMachineTeleporter; import com.hbm.tileentity.machine.TileEntityMachineTurbofan; import com.hbm.tileentity.machine.TileEntityMachineUF6Tank; @@ -529,6 +533,8 @@ public class MainRegistry GameRegistry.registerTileEntity(TileEntityAMSBase.class, "tileentity_ams_base"); GameRegistry.registerTileEntity(TileEntityAMSEmitter.class, "tileentity_ams_emitter"); GameRegistry.registerTileEntity(TileEntityAMSLimiter.class, "tileentity_ams_limiter"); + GameRegistry.registerTileEntity(TileEntityMachineSiren.class, "tileentity_siren"); + GameRegistry.registerTileEntity(TileEntityTaint.class, "tileentity_taint"); EntityRegistry.registerModEntity(EntityRocket.class, "entity_rocket", 0, this, 250, 1, true); EntityRegistry.registerModEntity(EntityNukeExplosion.class, "entity_nuke_explosion", 1, this, 250, 1, true); diff --git a/com/hbm/packet/ItemFolderPacket.java b/com/hbm/packet/ItemFolderPacket.java index ec9b41680..54fa7e4f5 100644 --- a/com/hbm/packet/ItemFolderPacket.java +++ b/com/hbm/packet/ItemFolderPacket.java @@ -4,6 +4,7 @@ import java.util.List; import com.hbm.items.ModItems; import com.hbm.items.tool.ItemAssemblyTemplate; +import com.hbm.items.tool.ItemCassette; import com.hbm.items.tool.ItemChemistryTemplate; import com.hbm.items.tool.ItemFluidIdentifier; import com.hbm.tileentity.machine.TileEntityMachineAssembler; @@ -85,6 +86,14 @@ public class ItemFolderPacket implements IMessage { p.dropPlayerItemWithRandomChoice(stack, true); } } + if(stack.getItem() instanceof ItemCassette) { + if(p.inventory.hasItem(ModItems.plate_polymer) && p.inventory.hasItem(ModItems.plate_steel)) { + p.inventory.consumeInventoryItem(ModItems.plate_polymer); + p.inventory.consumeInventoryItem(ModItems.plate_steel); + if(!p.inventory.addItemStackToInventory(stack.copy())) + p.dropPlayerItemWithRandomChoice(stack, true); + } + } if(stack.getItem() == ModItems.stamp_stone_plate || stack.getItem() == ModItems.stamp_stone_wire || stack.getItem() == ModItems.stamp_stone_circuit) { diff --git a/com/hbm/packet/PacketDispatcher.java b/com/hbm/packet/PacketDispatcher.java index f89cf6b54..4ceed2698 100644 --- a/com/hbm/packet/PacketDispatcher.java +++ b/com/hbm/packet/PacketDispatcher.java @@ -53,6 +53,8 @@ public class PacketDispatcher { wrapper.registerMessage(AuxElectricityPacket.Handler.class, AuxElectricityPacket.class, i++, Side.CLIENT); //Electricity gauge for GUI rendering wrapper.registerMessage(AuxGaugePacket.Handler.class, AuxGaugePacket.class, i++, Side.CLIENT); + //Siren packet for looped sounds + wrapper.registerMessage(TESirenPacket.Handler.class, TESirenPacket.class, i++, Side.CLIENT); } } diff --git a/com/hbm/packet/TESirenPacket.java b/com/hbm/packet/TESirenPacket.java new file mode 100644 index 000000000..7e203ddf4 --- /dev/null +++ b/com/hbm/packet/TESirenPacket.java @@ -0,0 +1,123 @@ +package com.hbm.packet; + +import com.hbm.items.tool.ItemCassette.SoundType; +import com.hbm.items.tool.ItemCassette.TrackType; +import com.hbm.sound.SoundLoopAssembler; +import com.hbm.sound.SoundLoopChemplant; +import com.hbm.sound.SoundLoopIGen; +import com.hbm.sound.SoundLoopMiner; +import com.hbm.sound.SoundLoopSiren; +import com.hbm.sound.SoundLoopTurbofan; +import com.hbm.tileentity.machine.TileEntityMachineAssembler; +import com.hbm.tileentity.machine.TileEntityMachineChemplant; +import com.hbm.tileentity.machine.TileEntityMachineIGenerator; +import com.hbm.tileentity.machine.TileEntityMachineMiningDrill; +import com.hbm.tileentity.machine.TileEntityMachineSiren; +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.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; + +public class TESirenPacket implements IMessage { + + int x; + int y; + int z; + int id; + boolean active; + + public TESirenPacket() + { + + } + + public TESirenPacket(int x, int y, int z, int id, boolean active) + { + this.x = x; + this.y = y; + this.z = z; + this.id = id; + this.active = active; + } + + @Override + public void fromBytes(ByteBuf buf) { + x = buf.readInt(); + y = buf.readInt(); + z = buf.readInt(); + id = buf.readInt(); + active = buf.readBoolean(); + } + + @Override + public void toBytes(ByteBuf buf) { + buf.writeInt(x); + buf.writeInt(y); + buf.writeInt(z); + buf.writeInt(id); + buf.writeBoolean(active); + } + + public static class Handler implements IMessageHandler { + + @Override + @SideOnly(Side.CLIENT) + public IMessage onMessage(TESirenPacket m, MessageContext ctx) { + TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(m.x, m.y, m.z); + + if (te != null && te instanceof TileEntityMachineSiren) { + + SoundLoopSiren sound = null; + for(int i = 0; i < SoundLoopSiren.list.size(); i++) { + if(SoundLoopSiren.list.get(i).getTE() == te) + sound = SoundLoopSiren.list.get(i); + } + + if(m.active) { + + if(sound == null) { + //Start sound + if(m.id > 0) { + boolean b = TrackType.getEnum(m.id).getType().name().equals(SoundType.LOOP.name()); + SoundLoopSiren s = new SoundLoopSiren(TrackType.getEnum(m.id).getSoundLocation(), te, TrackType.getEnum(m.id).getType()); + s.setRepeat(b); + s.intendedVolume = TrackType.getEnum(m.id).getVolume(); + Minecraft.getMinecraft().getSoundHandler().playSound(s); + } + } else { + ResourceLocation loc = TrackType.getEnum(m.id).getSoundLocation(); + + if(loc != null) { + String path = loc.getResourceDomain() + ":" + loc.getResourcePath(); + + if(!sound.getPath().equals(path)) { + //Track switched, stop and restart + sound.endSound(); + if(m.id > 0) + Minecraft.getMinecraft().getSoundHandler().playSound(new SoundLoopSiren(TrackType.getEnum(m.id).getSoundLocation(), te, TrackType.getEnum(m.id).getType())); + } + } + + sound.intendedVolume = TrackType.getEnum(m.id).getVolume(); + } + + } else { + + if(sound != null) { + //Stop sound + sound.endSound(); + SoundLoopSiren.list.remove(sound); + } + } + } + return null; + } + } +} diff --git a/com/hbm/potion/PotionEffectTaint.java b/com/hbm/potion/PotionEffectTaint.java new file mode 100644 index 000000000..d51454941 --- /dev/null +++ b/com/hbm/potion/PotionEffectTaint.java @@ -0,0 +1,61 @@ +package com.hbm.potion; + +import java.util.Random; + +import com.hbm.blocks.ModBlocks; +import com.hbm.blocks.bomb.BlockTaint; +import com.hbm.lib.Library; +import com.hbm.lib.ModDamageSource; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.DamageSource; +import net.minecraft.util.ResourceLocation; + +public class PotionEffectTaint extends Potion { + + public static PotionEffectTaint instance = new PotionEffectTaint(Library.getFirstNullIndex(1, Potion.potionTypes), true, 8388736); + Random rand = new Random(); + + public PotionEffectTaint(int p_i1573_1_, boolean p_i1573_2_, int p_i1573_3_) { + super(p_i1573_1_, p_i1573_2_, p_i1573_3_); + this.setPotionName("potion.hbm_taint"); + this.setIconIndex(0, 0); + } + + @Override + @SideOnly(Side.CLIENT) + public int getStatusIconIndex() { + ResourceLocation loc = new ResourceLocation("hbm","textures/gui/potions.png"); + Minecraft.getMinecraft().renderEngine.bindTexture(loc); + return super.getStatusIconIndex(); + } + + + public void performEffect(EntityLivingBase entity, int level) + { + entity.attackEntityFrom(ModDamageSource.taint, (level + 1) * 2.5F); + + if(!entity.worldObj.isRemote) { + + for(int i = 0; i < 15; i++) { + int a = rand.nextInt(5) + (int)entity.posX - 2; + int b = rand.nextInt(5) + (int)entity.posY - 2; + int c = rand.nextInt(5) + (int)entity.posZ - 2; + if(entity.worldObj.getBlock(a, b, c).isReplaceable(entity.worldObj, a, b, c) && BlockTaint.hasPosNeightbour(entity.worldObj, a, b, c)) + entity.worldObj.setBlock(a, b, c, ModBlocks.taint, rand.nextInt(16), 2); + } + } + } + + public boolean isReady(int par1, int par2) + { + int k = 40 >> par2; + return k > 0 ? par1 % k == 0 : true; + } + +} diff --git a/com/hbm/render/item/ItemRenderBullshit.java b/com/hbm/render/item/ItemRenderBullshit.java new file mode 100644 index 000000000..00e08f88a --- /dev/null +++ b/com/hbm/render/item/ItemRenderBullshit.java @@ -0,0 +1,111 @@ +package com.hbm.render.item; + +import org.lwjgl.opengl.GL11; + +import com.hbm.items.ModItems; +import com.hbm.lib.RefStrings; +import com.hbm.render.model.ModelBaleflare; +import com.hbm.render.model.ModelDash; +import com.hbm.render.model.ModelDefabricator; +import com.hbm.render.model.ModelEuthanasia; +import com.hbm.render.model.ModelHP; +import com.hbm.render.model.ModelJack; +import com.hbm.render.model.ModelMP40; +import com.hbm.render.model.ModelPip; +import com.hbm.render.model.ModelSpark; +import com.hbm.render.model.ModelTwiGun; + +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.IItemRenderer; +import net.minecraftforge.client.IItemRenderer.ItemRenderType; +import net.minecraftforge.client.IItemRenderer.ItemRendererHelper; + +public class ItemRenderBullshit implements IItemRenderer { + + protected ModelSpark sparkPlug; + protected ModelPip pip; + protected ModelMP40 mp40; + protected ModelBaleflare bomb; + + public ItemRenderBullshit() { + sparkPlug = new ModelSpark(); + pip = new ModelPip(); + mp40 = new ModelMP40(); + bomb = new ModelBaleflare(); + } + + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + switch(type) { + case EQUIPPED: + case EQUIPPED_FIRST_PERSON: + case ENTITY: + return true; + default: return false; + } + } + + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return false; + } + + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + switch(type) { + case EQUIPPED_FIRST_PERSON: + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_CULL_FACE); + + GL11.glRotatef(-135.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(-0.5F, 0.0F, -0.2F); + GL11.glScalef(0.5F, 0.5F, 0.5F); + GL11.glTranslatef(-0.2F, -0.1F, -0.1F); + + renderWhatever(type, item, data); + + GL11.glPopMatrix(); + break; + case EQUIPPED: + case ENTITY: + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_CULL_FACE); + + GL11.glRotatef(-200.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(75.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F); + GL11.glTranslatef(0.0F, -0.2F, -0.5F); + GL11.glRotatef(-5.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(0.5F, -0.2F, 0.0F); + //GL11.glScalef(0.75F, 0.75F, 0.75F); + GL11.glTranslatef(-1.4F, 0.0F, 0.0F); + + renderWhatever(type, item, data); + + GL11.glPopMatrix(); + default: break; + } + } + + private void renderWhatever(ItemRenderType type, ItemStack item, Object... data) { + Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(RefStrings.MODID +":textures/models/ModelMP40.png")); + GL11.glScalef(0.75F, 0.75F, 0.75F); + mp40.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); + Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(RefStrings.MODID +":textures/models/ModelSpark.png")); + GL11.glScalef(4/3F, 4/3F, 4/3F); + GL11.glTranslatef(-0.5F, 0.0F, 0.0F); + sparkPlug.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); + Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(RefStrings.MODID +":textures/models/ModelPip.png")); + GL11.glTranslatef(0.0F, 0.2F, 0.0F); + GL11.glTranslatef(0.5F, 0.0F, 0.0F); + GL11.glScalef(0.75F, 0.75F, 0.75F); + pip.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); + Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(RefStrings.MODID +":textures/models/BaleFlare.png")); + GL11.glScalef(4/3F, 4/3F, 4/3F); + GL11.glTranslatef(-1.5F, 0.0F, 0.0F); + bomb.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); + } +} diff --git a/com/hbm/render/tileentity/RenderTaint.java b/com/hbm/render/tileentity/RenderTaint.java new file mode 100644 index 000000000..ff3a3628a --- /dev/null +++ b/com/hbm/render/tileentity/RenderTaint.java @@ -0,0 +1,126 @@ +package com.hbm.render.tileentity; + +import org.lwjgl.opengl.GL11; + +import com.hbm.render.util.RUVertice; +import com.hbm.tileentity.deco.TileEntityTaint; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; + + +public class RenderTaint extends TileEntitySpecialRenderer +{ + float s = 0.5F; + + RUVertice v1 = new RUVertice(s, s, s); + RUVertice v2 = new RUVertice(s, s, -s); + RUVertice v3 = new RUVertice(-s, s, -s); + RUVertice v4 = new RUVertice(-s, s, s); + + RUVertice v5 = new RUVertice(s, -s, s); + RUVertice v6 = new RUVertice(s, -s, -s); + RUVertice v7 = new RUVertice(-s, -s, -s); + RUVertice v8 = new RUVertice(-s, -s, s); + + public void renderAModelAt(TileEntityTaint tile, double x, double y, double z, float f) + { + World world = tile.getWorldObj(); + + boolean ceil = world.isBlockNormalCubeDefault(tile.xCoord, tile.yCoord + 1, tile.zCoord, false); + boolean floor = world.isBlockNormalCubeDefault(tile.xCoord, tile.yCoord - 1, tile.zCoord, false); + boolean side1 = world.isBlockNormalCubeDefault(tile.xCoord, tile.yCoord, tile.zCoord + 1, false); + boolean side2 = world.isBlockNormalCubeDefault(tile.xCoord - 1, tile.yCoord, tile.zCoord, false); + boolean side3 = world.isBlockNormalCubeDefault(tile.xCoord, tile.yCoord, tile.zCoord - 1, false); + boolean side4 = world.isBlockNormalCubeDefault(tile.xCoord + 1, tile.yCoord, tile.zCoord, false); + + int meta = tile.getBlockMetadata(); + + GL11.glPushMatrix(); + GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F); + + + Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("hbm:textures/blocks/taint_" + meta + ".png")); + + GL11.glDisable(GL11.GL_LIGHTING); + Tessellator tessellator = Tessellator.instance; + + if (side1) + { + tessellator.startDrawingQuads(); + addVertex(v1, 0, 0, true); + addVertex(v5, 1, 0, true); + addVertex(v8, 1, 1, true); + addVertex(v4, 0, 1, true); + tessellator.draw(); + } + + if (side2) + { + tessellator.startDrawingQuads(); + addVertex(v4, 0, 0, true); + addVertex(v8, 1, 0, true); + addVertex(v7, 1, 1, true); + addVertex(v3, 0, 1, true); + tessellator.draw(); + } + + if (side3) + { + tessellator.startDrawingQuads(); + addVertex(v3, 0, 0, true); + addVertex(v7, 1, 0, true); + addVertex(v6, 1, 1, true); + addVertex(v2, 0, 1, true); + tessellator.draw(); + } + + if (side4) + { + tessellator.startDrawingQuads(); + addVertex(v2, 0, 0, true); + addVertex(v6, 1, 0, true); + addVertex(v5, 1, 1, true); + addVertex(v1, 0, 1, true); + tessellator.draw(); + } + + if (ceil) + { + tessellator.startDrawingQuads(); + addVertex(v4, 0, 0, true); + addVertex(v3, 1, 0, true); + addVertex(v2, 1, 1, true); + addVertex(v1, 0, 1, true); + tessellator.draw(); + } + + if (floor) + { + tessellator.startDrawingQuads(); + addVertex(v5, 0, 0, true); + addVertex(v6, 1, 0, true); + addVertex(v7, 1, 1, true); + addVertex(v8, 0, 1, true); + tessellator.draw(); + } + + GL11.glPopMatrix(); + } + + @Override + public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) + { + renderAModelAt((TileEntityTaint) tileentity, d, d1, d2, f); + } + + private void addVertex(RUVertice v, double t, double t2, boolean offset) + { + Tessellator tessellator = Tessellator.instance; + tessellator.addVertexWithUV(v.x * 0.99, v.y * 0.99, v.z * 0.99, t, t2); + } +} diff --git a/com/hbm/render/util/RUVertice.java b/com/hbm/render/util/RUVertice.java new file mode 100644 index 000000000..7252eb450 --- /dev/null +++ b/com/hbm/render/util/RUVertice.java @@ -0,0 +1,22 @@ +package com.hbm.render.util; + +public class RUVertice { + + public float x; + public float y; + public float z; + + public RUVertice(float X, float Y, float Z) { + x = X; + y = Y; + z = Z; + } + + public RUVertice normalize() { + float l = (float) Math.sqrt(x * x + y * y + z * z); + x /= l; + y /= l; + z /= l; + return this; + } +} diff --git a/com/hbm/sound/SoundLoopSiren.java b/com/hbm/sound/SoundLoopSiren.java new file mode 100644 index 000000000..c1eb9d555 --- /dev/null +++ b/com/hbm/sound/SoundLoopSiren.java @@ -0,0 +1,78 @@ +package com.hbm.sound; + +import java.util.ArrayList; +import java.util.List; + +import com.hbm.items.tool.ItemCassette.SoundType; +import com.hbm.items.tool.ItemCassette.TrackType; +import com.hbm.tileentity.machine.TileEntityMachineChemplant; +import com.hbm.tileentity.machine.TileEntityMachineMiningDrill; +import com.hbm.tileentity.machine.TileEntityMachineSiren; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.ISound; +import net.minecraft.client.entity.EntityClientPlayerMP; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; + +public class SoundLoopSiren extends SoundLoopMachine { + + public static List list = new ArrayList(); + public float intendedVolume; + public SoundType type; + + public SoundLoopSiren(ResourceLocation path, TileEntity te, SoundType type) { + super(path, te); + list.add(this); + intendedVolume = 10.0F; + this.field_147666_i = ISound.AttenuationType.NONE; + this.type = type; + } + + @Override + public void update() { + super.update(); + + 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 = func(f, intendedVolume); + } else { + volume = intendedVolume; + } + + if(te instanceof TileEntityMachineSiren) { + this.setRepeat(type.name().equals(SoundType.LOOP.name())); + } else { + this.donePlaying = true; + } + } + + public TileEntity getTE() { + return te; + } + + public void endSound() { + this.donePlaying = true; + } + + public String getPath() { + return this.field_147664_a.getResourceDomain() + ":" + this.field_147664_a.getResourcePath(); + } + + public void setRepeat(boolean b) { + this.repeat = b; + } + + public void setRepeatDelay(int i) { + this.field_147665_h = i; + } + + public float func(float f, float v) { + return (f / v) * -2 + 2; + } + +} diff --git a/com/hbm/tileentity/deco/TileEntityTaint.java b/com/hbm/tileentity/deco/TileEntityTaint.java new file mode 100644 index 000000000..a8bdfe11d --- /dev/null +++ b/com/hbm/tileentity/deco/TileEntityTaint.java @@ -0,0 +1,16 @@ +package com.hbm.tileentity.deco; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; + +public class TileEntityTaint extends TileEntity { + + @Override + @SideOnly(Side.CLIENT) + public double getMaxRenderDistanceSquared() + { + return 65536.0D; + } +} diff --git a/com/hbm/tileentity/machine/TileEntityMachineSiren.java b/com/hbm/tileentity/machine/TileEntityMachineSiren.java new file mode 100644 index 000000000..7c56a5914 --- /dev/null +++ b/com/hbm/tileentity/machine/TileEntityMachineSiren.java @@ -0,0 +1,224 @@ +package com.hbm.tileentity.machine; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.hbm.interfaces.IConsumer; +import com.hbm.items.ModItems; +import com.hbm.items.tool.ItemCassette; +import com.hbm.items.tool.ItemCassette.SoundType; +import com.hbm.items.tool.ItemCassette.TrackType; +import com.hbm.packet.AuxElectricityPacket; +import com.hbm.packet.PacketDispatcher; +import com.hbm.packet.TESirenPacket; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; + +public class TileEntityMachineSiren extends TileEntity implements ISidedInventory { + + private ItemStack slots[]; + + private static final int[] slots_top = new int[] { 0 }; + private static final int[] slots_bottom = new int[] { 0 }; + private static final int[] slots_side = new int[] { 0 }; + + public boolean lock = false; + + private String customName; + + public TileEntityMachineSiren() { + slots = new ItemStack[1]; + } + + @Override + public int getSizeInventory() { + return slots.length; + } + + @Override + public ItemStack getStackInSlot(int i) { + return slots[i]; + } + + @Override + public ItemStack getStackInSlotOnClosing(int i) { + if(slots[i] != null) + { + ItemStack itemStack = slots[i]; + slots[i] = null; + return itemStack; + } else { + return null; + } + } + + @Override + public void setInventorySlotContents(int i, ItemStack itemStack) { + slots[i] = itemStack; + if(itemStack != null && itemStack.stackSize > getInventoryStackLimit()) + { + itemStack.stackSize = getInventoryStackLimit(); + } + } + + @Override + public String getInventoryName() { + return this.hasCustomInventoryName() ? this.customName : "container.siren"; + } + + @Override + public boolean hasCustomInventoryName() { + return this.customName != null && this.customName.length() > 0; + } + + public void setCustomName(String name) { + this.customName = name; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer player) { + if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) + { + return false; + }else{ + return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=64; + } + } + + //You scrubs aren't needed for anything (right now) + @Override + public void openInventory() {} + @Override + public void closeInventory() {} + + @Override + public boolean isItemValidForSlot(int i, ItemStack itemStack) { + + return false; + } + + @Override + public ItemStack decrStackSize(int i, int j) { + if(slots[i] != null) + { + if(slots[i].stackSize <= j) + { + ItemStack itemStack = slots[i]; + slots[i] = null; + return itemStack; + } + ItemStack itemStack1 = slots[i].splitStack(j); + if (slots[i].stackSize == 0) + { + slots[i] = null; + } + + return itemStack1; + } else { + return null; + } + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + NBTTagList list = nbt.getTagList("items", 10); + + slots = new ItemStack[getSizeInventory()]; + + for(int i = 0; i < list.tagCount(); i++) + { + NBTTagCompound nbt1 = list.getCompoundTagAt(i); + byte b0 = nbt1.getByte("slot"); + if(b0 >= 0 && b0 < slots.length) + { + slots[b0] = ItemStack.loadItemStackFromNBT(nbt1); + } + } + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + NBTTagList list = new NBTTagList(); + + for(int i = 0; i < slots.length; i++) + { + if(slots[i] != null) + { + NBTTagCompound nbt1 = new NBTTagCompound(); + nbt1.setByte("slot", (byte)i); + slots[i].writeToNBT(nbt1); + list.appendTag(nbt1); + } + } + nbt.setTag("items", list); + } + + @Override + public int[] getAccessibleSlotsFromSide(int p_94128_1_) + { + return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side); + } + + @Override + public boolean canInsertItem(int i, ItemStack itemStack, int j) { + return this.isItemValidForSlot(i, itemStack); + } + + @Override + public boolean canExtractItem(int i, ItemStack itemStack, int j) { + return false; + } + + @Override + public void updateEntity() { + + if(!worldObj.isRemote) { + int id = Arrays.asList(TrackType.values()).indexOf(getCurrentType()); + + if(getCurrentType().name().equals(TrackType.NULL.name())) { + PacketDispatcher.wrapper.sendToAll(new TESirenPacket(xCoord, yCoord, zCoord, id, false)); + return; + } + + boolean active = worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord); + + if(getCurrentType().getType().name().equals(SoundType.LOOP.name())) { + + PacketDispatcher.wrapper.sendToAll(new TESirenPacket(xCoord, yCoord, zCoord, id, active)); + } else { + + if(!lock && active) { + lock = true; + PacketDispatcher.wrapper.sendToAll(new TESirenPacket(xCoord, yCoord, zCoord, id, false)); + PacketDispatcher.wrapper.sendToAll(new TESirenPacket(xCoord, yCoord, zCoord, id, true)); + } + + if(lock && !active) { + lock = false; + } + } + } + } + + public TrackType getCurrentType() { + if(slots[0] != null && slots[0].getItem() instanceof ItemCassette) { + return TrackType.getEnum(slots[0].getItemDamage()); + } + + return TrackType.NULL; + } +}