From e938cdbda63de4e4098f8e2217f64844166bb750 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Tue, 14 May 2013 17:19:58 +1000 Subject: [PATCH] Work on dandelions. All that is left is for the particles to spawn properly at the player's face (Sometimes they spawn on the ground, and they don't go in the direction the player is facing). I think this calls for... Amnet! --- To-Do List.txt | 3 +- .../biomesoplenty/items/ItemBOPFlower.java | 46 ++++++++++++++++++- .../items/projectiles/EntityDart.java | 2 +- 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/To-Do List.txt b/To-Do List.txt index 475d84bd9..8d39e5f6b 100644 --- a/To-Do List.txt +++ b/To-Do List.txt @@ -4,4 +4,5 @@ - Add Acacia trees from BWG4. - Add cooked portobellos. - Give waterlilies a proper render method and hitbox. - - Add sunflowers. \ No newline at end of file + - Add sunflowers. + - Reduce excessive amounts of mobs in the Promised Lands. \ No newline at end of file diff --git a/src/minecraft/biomesoplenty/items/ItemBOPFlower.java b/src/minecraft/biomesoplenty/items/ItemBOPFlower.java index 639db6066..cd6f65514 100644 --- a/src/minecraft/biomesoplenty/items/ItemBOPFlower.java +++ b/src/minecraft/biomesoplenty/items/ItemBOPFlower.java @@ -1,8 +1,12 @@ package biomesoplenty.items; +import biomesoplenty.BiomesOPlenty; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; @@ -37,6 +41,46 @@ public class ItemBOPFlower extends ItemBlock return Block.blocksList[this.itemID].getIcon(0, meta); } + @SideOnly(Side.CLIENT) + public boolean isFull3D() + { + return true; + } + + @Override + public EnumAction getItemUseAction(ItemStack par1ItemStack) + { + if (par1ItemStack.getItemDamage() == 15) + return EnumAction.block; + else + return null; + } + + @Override + public int getMaxItemUseDuration(ItemStack par1ItemStack) + { + return 72000; + } + + @Override + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + if (par1ItemStack.getItemDamage() == 15) { + double x = par3EntityPlayer.posX; + double y = par3EntityPlayer.posY; + double z = par3EntityPlayer.posZ; + + for (int p = 0; p < 20; ++p) + { + BiomesOPlenty.proxy.spawnParticle("dandelion", x, y, z); + }; + + par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); + } + return par1ItemStack; + } + + @Override public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { @@ -64,7 +108,7 @@ public class ItemBOPFlower extends ItemBlock if (side == 5) ++x; } - + if (!player.canPlayerEdit(x, y, z, side, itemStack)) { return false; diff --git a/src/minecraft/biomesoplenty/items/projectiles/EntityDart.java b/src/minecraft/biomesoplenty/items/projectiles/EntityDart.java index 1639e0d94..d04257044 100644 --- a/src/minecraft/biomesoplenty/items/projectiles/EntityDart.java +++ b/src/minecraft/biomesoplenty/items/projectiles/EntityDart.java @@ -231,7 +231,7 @@ public class EntityDart extends EntityArrow for (int p = 0; i < 16; ++i) { - BiomesOPlenty.proxy.spawnParticle("dandelion", this.posX, this.posY, this.posZ); + BiomesOPlenty.proxy.spawnParticle("dart", this.posX, this.posY, this.posZ); } this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));