Made burning blossoms, deathblooms, and thorns hurt you if you don't break them using shears

This commit is contained in:
Matt Caughey 2013-09-19 23:26:23 -04:00
parent f602c905b1
commit 9eed71de31
3 changed files with 92 additions and 0 deletions

View File

@ -10,6 +10,8 @@ import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
@ -285,6 +287,38 @@ public class BlockBOPFlower extends BlockFlower
}
}
@Override
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta)
{
super.harvestBlock(world, player, x, y, z, meta);
ItemStack equippedItem = player.getCurrentEquippedItem();
if (equippedItem != null)
{
if (equippedItem.itemID != Item.shears.itemID)
{
if (meta == 2)
{
if (!world.isRemote)
{
player.addPotionEffect(new PotionEffect(Potion.wither.id, 300));
}
}
}
}
else
{
if (meta == 2)
{
if (!world.isRemote)
{
player.addPotionEffect(new PotionEffect(Potion.wither.id, 300));
}
}
}
}
@Override
public boolean isBlockReplaceable(World world, int x, int y, int z)
{

View File

@ -8,6 +8,9 @@ import net.minecraft.block.BlockFlower;
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.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
@ -85,6 +88,40 @@ public class BlockBOPFlower2 extends BlockFlower
}
}
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
{
if (world.getBlockMetadata(x, y, z) == 2) {
entity.setFire(1);
}
}
@Override
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta)
{
super.harvestBlock(world, player, x, y, z, meta);
ItemStack equippedItem = player.getCurrentEquippedItem();
if (equippedItem != null)
{
if (equippedItem.itemID != Item.shears.itemID)
{
if (meta == 2)
{
player.setFire(5);
}
}
}
else
{
if (meta == 2)
{
player.setFire(5);
}
}
}
/**
* A randomly called display update to be able to add particles or other items for display
*/

View File

@ -12,6 +12,7 @@ import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
@ -348,6 +349,26 @@ public class BlockBOPPlant extends BlockFlower implements IShearable
{
player.addPotionEffect(new PotionEffect(Potion.wither.id, 250, 1));
}
ItemStack equippedItem = player.getCurrentEquippedItem();
if (equippedItem != null)
{
if (equippedItem.itemID != Item.shears.itemID)
{
if (meta == 5)
{
player.attackEntityFrom(DamageSource.cactus, 2);
}
}
}
else
{
if (meta == 5)
{
player.attackEntityFrom(DamageSource.cactus, 2);
}
}
}
@Override