Made burning blossoms, deathblooms, and thorns hurt you if you don't break them using shears
This commit is contained in:
parent
f602c905b1
commit
9eed71de31
3 changed files with 92 additions and 0 deletions
|
@ -10,6 +10,8 @@ import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.potion.Potion;
|
import net.minecraft.potion.Potion;
|
||||||
import net.minecraft.potion.PotionEffect;
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
@ -284,6 +286,38 @@ public class BlockBOPFlower extends BlockFlower
|
||||||
return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) && this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y - 1, z), world.getBlockMetadata(x, y, z));
|
return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) && this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y - 1, z), world.getBlockMetadata(x, y, z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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
|
@Override
|
||||||
public boolean isBlockReplaceable(World world, int x, int y, int z)
|
public boolean isBlockReplaceable(World world, int x, int y, int z)
|
||||||
|
|
|
@ -8,6 +8,9 @@ import net.minecraft.block.BlockFlower;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
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.item.ItemStack;
|
||||||
import net.minecraft.util.Icon;
|
import net.minecraft.util.Icon;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
@ -84,6 +87,40 @@ public class BlockBOPFlower2 extends BlockFlower
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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
|
* A randomly called display update to be able to add particles or other items for display
|
||||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.potion.Potion;
|
import net.minecraft.potion.Potion;
|
||||||
import net.minecraft.potion.PotionEffect;
|
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));
|
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
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue