From a47e8012df7d0aa5622a1c4d918049b571fa6e07 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Tue, 2 Apr 2013 17:49:16 +1100 Subject: [PATCH] Fixed tool effectiveness on various blocks, gave smoldering grass and ash their expected behaviours; burn on contact (smoldering grass) and slowness (ash) --- .../tdwp_ftw/biomesop/blocks/BlockAsh.java | 10 +++++++++ .../biomesop/blocks/BlockSmolderingGrass.java | 22 ++++++++++++++++++- .../tdwp_ftw/biomesop/mod_BiomesOPlenty.java | 21 ++++++++++++++++-- 3 files changed, 50 insertions(+), 3 deletions(-) diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAsh.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAsh.java index c4a743b2f..009b3d67b 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAsh.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAsh.java @@ -8,6 +8,7 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -48,6 +49,15 @@ public class BlockAsh extends Block par1World.spawnParticle("smoke", (double)((float)par2 + par5Random.nextFloat()), (double)((float)par3 + 1.1F), (double)((float)par4 + par5Random.nextFloat()), 0.0D, 0.0D, 0.0D); } } + + /** + * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity + */ + public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) + { + par5Entity.motionX *= 0.4D; + par5Entity.motionZ *= 0.4D; + } /** * Returns the ID of the items to drop on destruction. diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockSmolderingGrass.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockSmolderingGrass.java index 930763d05..272130ac3 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockSmolderingGrass.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockSmolderingGrass.java @@ -8,6 +8,8 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.Icon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -83,12 +85,30 @@ public class BlockSmolderingGrass extends Block par1World.spawnParticle("flame", (double)((float)par2 + par5Random.nextFloat()), (double)((float)par3 + 1.1F), (double)((float)par4 + par5Random.nextFloat()), 0.0D, 0.0D, 0.0D); } } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + float f = 0.02F; + return AxisAlignedBB.getAABBPool().getAABB((double)par2, (double)par3, (double)par4, (double)(par2 + 1), (double)((float)(par3 + 1) - f), (double)(par4 + 1)); + } + + /** + * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity + */ + public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) + { + par5Entity.setFire(2); + } /** * Returns the ID of the items to drop on destruction. */ public int idDropped(int par1, Random par2Random, int par3) { - return 0; + return Block.dirt.blockID; } } diff --git a/src/minecraft/tdwp_ftw/biomesop/mod_BiomesOPlenty.java b/src/minecraft/tdwp_ftw/biomesop/mod_BiomesOPlenty.java index 5f14e3f4e..28cbc6cab 100644 --- a/src/minecraft/tdwp_ftw/biomesop/mod_BiomesOPlenty.java +++ b/src/minecraft/tdwp_ftw/biomesop/mod_BiomesOPlenty.java @@ -661,6 +661,25 @@ public class mod_BiomesOPlenty leggingsAmethyst = (new ArmorAmethyst(leggingsAmethystID, EnumArmorMaterialAmethyst, proxy.addArmor("amethyst"), 2)).setCreativeTab(tabBiomesOPlenty).setUnlocalizedName("leggingsAmethyst"); bootsAmethyst = (new ArmorAmethyst(bootsAmethystID, EnumArmorMaterialAmethyst, proxy.addArmor("amethyst"), 3)).setCreativeTab(tabBiomesOPlenty).setUnlocalizedName("bootsAmethyst"); + //Block tool strength, 0 is Wood and Gold, 1 is Stone, 2 is Iron and 3 is Diamond + //Leaves can be obtained from using shears, however they arn't instantly broken by them (unsure how to do this) + + MinecraftForge.setBlockHarvestLevel(smolderingGrass, "shovel", 0); + MinecraftForge.setBlockHarvestLevel(mud, "shovel", 0); + MinecraftForge.setBlockHarvestLevel(ash, "shovel", 0); + MinecraftForge.setBlockHarvestLevel(originGrass, "shovel", 0); + MinecraftForge.setBlockHarvestLevel(hardSand, "shovel", 0); + MinecraftForge.setBlockHarvestLevel(holyGrass, "shovel", 0); + MinecraftForge.setBlockHarvestLevel(quicksand, "shovel", 0); + + MinecraftForge.setBlockHarvestLevel(driedDirt, "pickaxe", 0); + MinecraftForge.setBlockHarvestLevel(amethystOre, "pickaxe", 3); + MinecraftForge.setBlockHarvestLevel(amethystBlock, "pickaxe", 3); + + MinecraftForge.setToolClass(shovelAmethyst, "shovel", 3); + MinecraftForge.setToolClass(pickaxeAmethyst, "pickaxe", 3); + MinecraftForge.setToolClass(axeAmethyst, "axe", 3); + // Achievement declaration if (achievements == true) { @@ -1036,8 +1055,6 @@ public class mod_BiomesOPlenty GameRegistry.registerBlock(holyDoubleSlab, "holyDoubleSlab"); GameRegistry.registerBlock(holySingleSlab, "holySingleSlab"); GameRegistry.registerBlock(holyStairs, "holyStairs"); - - MinecraftForge.setBlockHarvestLevel(amethystOre, "pickaxe", 3); // Add crafting recipes.