From dadbb815bce113502cd97cefbf70440651ab5f23 Mon Sep 17 00:00:00 2001 From: Amnet Date: Sun, 19 May 2013 14:52:55 +0200 Subject: [PATCH] Tweaked the particles for dandelions. Right clicking on apple leaves now just spawns an apple on the leaves, not on the player. --- .../blocks/BlockBOPAppleLeaves.java | 4 +- .../biomesoplenty/items/ItemBOPFlower.java | 42 +++++++++++++++---- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/src/minecraft/biomesoplenty/blocks/BlockBOPAppleLeaves.java b/src/minecraft/biomesoplenty/blocks/BlockBOPAppleLeaves.java index ef9830dfc..1521f3229 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockBOPAppleLeaves.java +++ b/src/minecraft/biomesoplenty/blocks/BlockBOPAppleLeaves.java @@ -229,10 +229,10 @@ public class BlockBOPAppleLeaves extends BlockLeavesBase implements IShearable if ((meta & 3) == 3) { world.setBlock(x, y, z, blockID, meta - 3, 3); - EntityItem entityitem = new EntityItem(world, player.posX, player.posY - 1.0D, player.posZ, new ItemStack(Item.appleRed, 1, 0)); + EntityItem entityitem = new EntityItem(world, x, y, z, new ItemStack(Item.appleRed, 1, 0)); if (!world.isRemote) { world.spawnEntityInWorld(entityitem); - entityitem.onCollideWithPlayer(player); + //entityitem.onCollideWithPlayer(player); } return true; } diff --git a/src/minecraft/biomesoplenty/items/ItemBOPFlower.java b/src/minecraft/biomesoplenty/items/ItemBOPFlower.java index 89b38b2fa..4cd78c0bd 100644 --- a/src/minecraft/biomesoplenty/items/ItemBOPFlower.java +++ b/src/minecraft/biomesoplenty/items/ItemBOPFlower.java @@ -1,5 +1,7 @@ package biomesoplenty.items; +import java.util.Random; + import biomesoplenty.BiomesOPlenty; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -79,28 +81,50 @@ public class ItemBOPFlower extends ItemBlock @Override public int getMaxItemUseDuration(ItemStack par1ItemStack) { - return 72000; + return 20; } @Override public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if (par1ItemStack.getItemDamage() == 15) { - Vec3 vec = par3EntityPlayer.getLookVec(); - - for (int p = 0; p < 32; ++p) - { - BiomesOPlenty.proxy.spawnParticle("dandelion", par3EntityPlayer.posX + (vec.xCoord / 2), par3EntityPlayer.posY + (vec.yCoord / 2) + par3EntityPlayer.getEyeHeight(), par3EntityPlayer.posZ + (vec.zCoord / 2)); - }; +// Vec3 vec = par3EntityPlayer.getLookVec(); +// +// for (int p = 0; p < 32; ++p) +// { +// BiomesOPlenty.proxy.spawnParticle("dandelion", par3EntityPlayer.posX + (vec.xCoord / 2), par3EntityPlayer.posY + (vec.yCoord / 2) + par3EntityPlayer.getEyeHeight(), par3EntityPlayer.posZ + (vec.zCoord / 2)); +// }; par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); - if (!par3EntityPlayer.capabilities.isCreativeMode && !par2World.isRemote) - --par1ItemStack.stackSize; +// if (!par3EntityPlayer.capabilities.isCreativeMode && !par2World.isRemote) +// --par1ItemStack.stackSize; } return par1ItemStack; } + + @Override + public void onUsingItemTick(ItemStack stack, EntityPlayer player, int count) + { + Vec3 vec = player.getLook(0.5F); + Random rnd = player.getRNG(); + + for (int p = 0; p < 4; ++p) + { + float pos = (rnd.nextFloat() - 0.5F) / 8; + BiomesOPlenty.proxy.spawnParticle("dandelion", player.posX + vec.xCoord + pos, player.posY + vec.yCoord + player.getEyeHeight() + pos, player.posZ + vec.zCoord + pos); + } + if (count < 10) + player.stopUsingItem(); + } + + @Override + public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4) + { + if (!par3EntityPlayer.capabilities.isCreativeMode && !par2World.isRemote) + --par1ItemStack.stackSize; + } @Override public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)