diff --git a/assets/hbm/textures/blocks/mush.png b/assets/hbm/textures/blocks/mush.png new file mode 100644 index 000000000..4fb662fab Binary files /dev/null and b/assets/hbm/textures/blocks/mush.png differ diff --git a/assets/hbm/textures/blocks/mush_block_inside.png b/assets/hbm/textures/blocks/mush_block_inside.png new file mode 100644 index 000000000..571913ea4 Binary files /dev/null and b/assets/hbm/textures/blocks/mush_block_inside.png differ diff --git a/assets/hbm/textures/blocks/mush_block_skin.png b/assets/hbm/textures/blocks/mush_block_skin.png new file mode 100644 index 000000000..2f2f0e5ff Binary files /dev/null and b/assets/hbm/textures/blocks/mush_block_skin.png differ diff --git a/assets/hbm/textures/blocks/mush_block_stem.png b/assets/hbm/textures/blocks/mush_block_stem.png new file mode 100644 index 000000000..f0c556cc1 Binary files /dev/null and b/assets/hbm/textures/blocks/mush_block_stem.png differ diff --git a/assets/hbm/textures/blocks/waste_mycelium_side.png b/assets/hbm/textures/blocks/waste_mycelium_side.png new file mode 100644 index 000000000..8cf285915 Binary files /dev/null and b/assets/hbm/textures/blocks/waste_mycelium_side.png differ diff --git a/assets/hbm/textures/blocks/waste_mycelium_top.png b/assets/hbm/textures/blocks/waste_mycelium_top.png new file mode 100644 index 000000000..ef49ecb6e Binary files /dev/null and b/assets/hbm/textures/blocks/waste_mycelium_top.png differ diff --git a/com/hbm/blocks/BlockMush.java b/com/hbm/blocks/BlockMush.java new file mode 100644 index 000000000..5f884366d --- /dev/null +++ b/com/hbm/blocks/BlockMush.java @@ -0,0 +1,135 @@ +package com.hbm.blocks; + +import java.util.Random; + +import com.hbm.main.MainRegistry; +import com.hbm.world.HugeMush; + +import cpw.mods.fml.common.network.internal.FMLNetworkHandler; +import net.minecraft.block.Block; +import net.minecraft.block.BlockMushroom; +import net.minecraft.block.IGrowable; +import net.minecraft.block.material.Material; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenBigMushroom; +import net.minecraftforge.common.util.ForgeDirection; + +public class BlockMush extends Block implements IGrowable { + + protected BlockMush(Material p_i45394_1_) { + super(p_i45394_1_); + float f = 0.2F; + this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f); + this.setTickRandomly(true); + } + + protected boolean canPlaceBlockOn(Block p_149854_1_) + { + return p_149854_1_.func_149730_j(); + } + + public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) + { + return super.canPlaceBlockAt(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && this.canBlockStay(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_); + } + + public boolean canBlockStay(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_) + { + if (p_149718_3_ >= 0 && p_149718_3_ < 256) + { + Block block = p_149718_1_.getBlock(p_149718_2_, p_149718_3_ - 1, p_149718_4_); + return block == ModBlocks.waste_earth || block == ModBlocks.waste_mycelium; + } + else + { + return false; + } + } + + public boolean func_149884_c(World p_149884_1_, int p_149884_2_, int p_149884_3_, int p_149884_4_, Random p_149884_5_) + { + int l = p_149884_1_.getBlockMetadata(p_149884_2_, p_149884_3_, p_149884_4_); + p_149884_1_.setBlockToAir(p_149884_2_, p_149884_3_, p_149884_4_); + HugeMush worldgenbigmushroom = null; + + worldgenbigmushroom = new HugeMush(); + worldgenbigmushroom.generate(p_149884_1_, p_149884_5_, p_149884_2_, p_149884_3_, p_149884_4_); + + return true; + } + + public boolean func_149851_a(World p_149851_1_, int p_149851_2_, int p_149851_3_, int p_149851_4_, boolean p_149851_5_) + { + return true; + } + + public boolean func_149852_a(World p_149852_1_, Random p_149852_2_, int p_149852_3_, int p_149852_4_, int p_149852_5_) + { + return (double)p_149852_2_.nextFloat() < 0.4D; + } + public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) + { + return null; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 1; + } + public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_) + { + super.onNeighborBlockChange(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, p_149695_5_); + this.checkAndDropBlock(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_); + } + + /** + * checks if the block can stay, if not drop as item + */ + protected void checkAndDropBlock(World p_149855_1_, int p_149855_2_, int p_149855_3_, int p_149855_4_) + { + if (!this.canBlockStay(p_149855_1_, p_149855_2_, p_149855_3_, p_149855_4_)) + { + this.dropBlockAsItem(p_149855_1_, p_149855_2_, p_149855_3_, p_149855_4_, p_149855_1_.getBlockMetadata(p_149855_2_, p_149855_3_, p_149855_4_), 0); + p_149855_1_.setBlock(p_149855_2_, p_149855_3_, p_149855_4_, getBlockById(0), 0, 2); + } + } + + @Override + public void updateTick(World world, int x, int y, int z, Random rand) + { + this.checkAndDropBlock(world, x, y, z); + if(world.getBlock(x, y - 1, z) == ModBlocks.waste_earth && rand.nextInt(5) == 0) + { + world.setBlock(x, y - 1, z, ModBlocks.waste_mycelium); + } + } + + public void func_149853_b(World p_149853_1_, Random p_149853_2_, int p_149853_3_, int p_149853_4_, int p_149853_5_) + { + this.func_149884_c(p_149853_1_, p_149853_3_, p_149853_4_, p_149853_5_, p_149853_2_); + } + +} diff --git a/com/hbm/blocks/BlockMushHuge.java b/com/hbm/blocks/BlockMushHuge.java new file mode 100644 index 000000000..d181bf7b6 --- /dev/null +++ b/com/hbm/blocks/BlockMushHuge.java @@ -0,0 +1,60 @@ +package com.hbm.blocks; + +import java.util.Random; + +import com.hbm.lib.RefStrings; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +public class BlockMushHuge extends Block { + + @SideOnly(Side.CLIENT) + private IIcon iconTop; + + protected BlockMushHuge(Material p_i45394_1_) { + super(p_i45394_1_); + } + + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconRegister) { + this.iconTop = iconRegister.registerIcon(RefStrings.MODID + (this == ModBlocks.mush_block ? ":mush_block_skin" : ":mush_block_inside")); + this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + (this == ModBlocks.mush_block ? ":mush_block_skin" : ":mush_block_stem")); + } + + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int metadata) { + return side == 1 ? this.iconTop : (side == 0 ? this.iconTop : this.blockIcon); + } + + public int quantityDropped(Random p_149745_1_) + { + int i = p_149745_1_.nextInt(10) - 7; + + if (i < 0) + { + i = 0; + } + + return i; + } + + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) + { + return Item.getItemFromBlock(ModBlocks.mush); + } + + @SideOnly(Side.CLIENT) + public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) + { + return Item.getItemFromBlock(ModBlocks.mush); + } + +} diff --git a/com/hbm/blocks/ModBlocks.java b/com/hbm/blocks/ModBlocks.java index 51e0d3bdc..e02a25fc3 100644 --- a/com/hbm/blocks/ModBlocks.java +++ b/com/hbm/blocks/ModBlocks.java @@ -8,6 +8,7 @@ import com.hbm.main.MainRegistry; import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; import net.minecraft.block.BlockGlass; +import net.minecraft.block.BlockMushroom; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; @@ -83,7 +84,12 @@ public class ModBlocks { public static Block steel_beam; public static Block steel_scaffold; + public static Block mush; + public static Block mush_block; + public static Block mush_block_stem; + public static Block waste_earth; + public static Block waste_mycelium; public static Block waste_trinitite; public static Block waste_trinitite_red; public static Block waste_log; @@ -264,7 +270,12 @@ public class ModBlocks { steel_beam = new DecoBlock(Material.rock).setBlockName("steel_beam").setCreativeTab(MainRegistry.tabBlock).setHardness(15.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":steel_beam"); steel_scaffold = new DecoBlock(Material.rock).setBlockName("steel_scaffold").setCreativeTab(MainRegistry.tabBlock).setHardness(15.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":steel_scaffold"); + mush = new BlockMush(Material.plants).setBlockName("mush").setCreativeTab(MainRegistry.tabBlock).setLightLevel(0.5F).setStepSound(Block.soundTypeGrass).setBlockTextureName(RefStrings.MODID + ":mush"); + mush_block = new BlockMushHuge(Material.plants).setBlockName("mush_block").setCreativeTab(MainRegistry.tabBlock).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").setCreativeTab(MainRegistry.tabBlock).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.tabBlock).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.tabBlock).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.tabBlock).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.tabBlock).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.tabBlock).setHardness(5.0F).setResistance(0.5F); @@ -418,9 +429,13 @@ public class ModBlocks { GameRegistry.registerBlock(steel_roof, steel_roof.getUnlocalizedName()); GameRegistry.registerBlock(steel_beam, steel_beam.getUnlocalizedName()); GameRegistry.registerBlock(steel_scaffold, steel_scaffold.getUnlocalizedName()); + GameRegistry.registerBlock(mush, mush.getUnlocalizedName()); + GameRegistry.registerBlock(mush_block, mush_block.getUnlocalizedName()); + GameRegistry.registerBlock(mush_block_stem, mush_block_stem.getUnlocalizedName()); //Nuclear Waste GameRegistry.registerBlock(waste_earth, waste_earth.getUnlocalizedName()); + GameRegistry.registerBlock(waste_mycelium, waste_mycelium.getUnlocalizedName()); GameRegistry.registerBlock(waste_trinitite, waste_trinitite.getUnlocalizedName()); GameRegistry.registerBlock(waste_trinitite_red, waste_trinitite_red.getUnlocalizedName()); GameRegistry.registerBlock(waste_log, waste_log.getUnlocalizedName()); diff --git a/com/hbm/blocks/WasteEarth.java b/com/hbm/blocks/WasteEarth.java index 10b2f7f07..a3398ff20 100644 --- a/com/hbm/blocks/WasteEarth.java +++ b/com/hbm/blocks/WasteEarth.java @@ -10,6 +10,7 @@ import com.hbm.lib.RefStrings; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; +import net.minecraft.block.BlockMushroom; import net.minecraft.block.material.Material; import net.minecraft.client.entity.EntityClientPlayerMP; import net.minecraft.client.renderer.texture.IIconRegister; @@ -34,13 +35,14 @@ public class WasteEarth extends Block { protected WasteEarth(Material p_i45394_1_) { super(p_i45394_1_); + this.setTickRandomly(true); } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { - this.iconTop = iconRegister.registerIcon(RefStrings.MODID + (this == ModBlocks.waste_earth ? ":waste_earth_top" : ":frozen_grass_top")); - this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + (this == ModBlocks.waste_earth ? ":waste_earth_bottom" : ":frozen_dirt")); - this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + (this == ModBlocks.waste_earth ? ":waste_earth_side" : ":frozen_grass_side")); + this.iconTop = iconRegister.registerIcon(RefStrings.MODID + (this == ModBlocks.waste_earth ? ":waste_earth_top" : (this == ModBlocks.waste_mycelium ? ":waste_mycelium_top" : ":frozen_grass_top"))); + this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + (this == ModBlocks.waste_earth ? ":waste_earth_bottom" : (this == ModBlocks.waste_mycelium ? ":waste_earth_bottom" : ":frozen_dirt"))); + this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + (this == ModBlocks.waste_earth ? ":waste_earth_side" : (this == ModBlocks.waste_mycelium ? ":waste_mycelium_side" : ":frozen_grass_side"))); } @SideOnly(Side.CLIENT) @@ -50,7 +52,7 @@ public class WasteEarth extends Block { public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { - if(this == ModBlocks.waste_earth) + if(this == ModBlocks.waste_earth || this == ModBlocks.waste_earth) { return Item.getItemFromBlock(Blocks.dirt); } @@ -96,6 +98,30 @@ public class WasteEarth extends Block { { ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 2 * 60 * 20, 2)); } + if (entity instanceof EntityLivingBase && this == ModBlocks.waste_mycelium) + { + if(entity instanceof EntityPlayer && Library.checkForHazmat((EntityPlayer)entity)) + { + Library.damageSuit(((EntityPlayer)entity), 0); + Library.damageSuit(((EntityPlayer)entity), 1); + Library.damageSuit(((EntityPlayer)entity), 2); + Library.damageSuit(((EntityPlayer)entity), 3); + + } else if(entity instanceof EntityCreeper) { + EntityNuclearCreeper creep = new EntityNuclearCreeper(p_149724_1_); + creep.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch); + creep.setRotationYawHead(((EntityCreeper)entity).rotationYawHead); + if(!entity.isDead) + if(!p_149724_1_.isRemote) + p_149724_1_.spawnEntityInWorld(creep); + entity.setDead(); + } else if(!(entity instanceof EntityNuclearCreeper)) { + ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.poison.id, 3 * 60 * 20, 4)); + ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.wither.id, 1 * 60 * 20, 2)); + ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 2 * 60 * 20, 2)); + ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 3 * 60 * 20, 2)); + } + } } @SideOnly(Side.CLIENT) @@ -107,6 +133,49 @@ public class WasteEarth extends Block { { p_149734_1_.spawnParticle("townaura", (double)((float)p_149734_2_ + p_149734_5_.nextFloat()), (double)((float)p_149734_3_ + 1.1F), (double)((float)p_149734_4_ + p_149734_5_.nextFloat()), 0.0D, 0.0D, 0.0D); } + if (this == ModBlocks.waste_mycelium) + { + p_149734_1_.spawnParticle("townaura", (double)((float)p_149734_2_ + p_149734_5_.nextFloat()), (double)((float)p_149734_3_ + 1.1F), (double)((float)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) + { + if((this == ModBlocks.waste_earth || this == ModBlocks.waste_mycelium) && world.getBlock(x, y + 1, z) == Blocks.air && rand.nextInt(10) == 0) + { + Block b0; + int count = 0; + for(int i = -5; i < 5; i++) { + for(int j = -5; j < 6; j++) { + for(int k = -5; k < 5; k++) { + b0 = world.getBlock(x + i, y + j, z + k); + if((b0 instanceof BlockMushroom) || b0 == ModBlocks.mush) + { + count++; + } + } + } + } + if(count > 0 && count < 5) + world.setBlock(x, y + 1, z, ModBlocks.mush); + } + + if(this == ModBlocks.waste_mycelium) + { + for(int i = -1; i < 2; i++) { + for(int j = -1; j < 2; j++) { + for(int k = -1; k < 2; k++) { + Block b0 = world.getBlock(x + i, y + j, z + k); + Block b1 = world.getBlock(x + i, y + j + 1, z + k); + if(!b1.isOpaqueCube() && (b0 == Blocks.dirt || b0 == Blocks.grass || b0 == Blocks.mycelium || b0 == ModBlocks.waste_earth)) + { + world.setBlock(x + i, y + j, z + k, ModBlocks.waste_mycelium); + } + } + } + } + } } } diff --git a/com/hbm/explosion/ExplosionNukeGeneric.java b/com/hbm/explosion/ExplosionNukeGeneric.java index 6f756b9b7..fbffe2d41 100644 --- a/com/hbm/explosion/ExplosionNukeGeneric.java +++ b/com/hbm/explosion/ExplosionNukeGeneric.java @@ -287,6 +287,11 @@ public class ExplosionNukeGeneric { world.setBlock(x, y, z, ModBlocks.waste_earth); } + else if(world.getBlock(x, y, z) == Blocks.mycelium) + { + world.setBlock(x, y, z, ModBlocks.waste_mycelium); + } + else if(world.getBlock(x, y, z) == Blocks.sand) { rand = field_149933_a.nextInt(20); diff --git a/com/hbm/world/HugeMush.java b/com/hbm/world/HugeMush.java new file mode 100644 index 000000000..3dc0dff75 --- /dev/null +++ b/com/hbm/world/HugeMush.java @@ -0,0 +1,75 @@ +package com.hbm.world; + +import java.util.Random; + +import com.hbm.blocks.ModBlocks; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenerator; + +public class HugeMush extends WorldGenerator +{ + Block Block0 = ModBlocks.mush_block; + Block Block1 = ModBlocks.mush_block_stem; + + public HugeMush() + { + super(false); + } + + public boolean generate(World world, Random rand, int x, int y, int z) + { + for(int i = -1; i < 2; i++) + { + for(int j = -1; j < 2; j++) + { + world.setBlock(x + i, y, z + j, Block0); + } + } + for(int i = -1; i < 2; i++) + { + for(int j = -1; j < 2; j++) + { + world.setBlock(x + i, y + 3, z + j, Block0); + } + } + for(int i = -2; i < 3; i++) + { + for(int j = -2; j < 3; j++) + { + world.setBlock(x + i, y + 5, z + j, Block0); + } + } + for(int i = -4; i < 5; i++) + { + for(int j = -4; j < 5; j++) + { + for(int k = 0; k < 3; k++) + { + world.setBlock(x + i, y + 6 + k, z + j, Block0); + } + } + } + for(int i = -3; i < 4; i++) + { + for(int j = -3; j < 4; j++) + { + world.setBlock(x + i, y + 9, z + j, Block0); + } + } + for(int i = -1; i < 2; i++) + { + for(int j = -1; j < 2; j++) + { + world.setBlock(x + i, y + 10, z + j, Block0); + } + } + for(int i = 0; i < 8; i++) + { + world.setBlock(x, y + i, z, Block1); + } + return true; + } +}