Holy Tall grass no longer drops itself without using shears

Fixed things wrongly having wooden footstep sounds
Saplings now use the new bonemeal system added by Minecraft 1.5
Bonemeal now creates Holy Tall Grass when used on Holy Grass
Fixed slabs not stacking
Fixed leaf decay (Except for apple trees, don't know what is going on with them)
This commit is contained in:
Adubbz 2013-04-02 15:08:57 +11:00
parent ca668f6ed1
commit b35b71b020
34 changed files with 737 additions and 26 deletions

View file

@ -247,7 +247,7 @@ public class BlockAcaciaLeaves extends BlockLeavesBase
private void removeLeaves(World par1World, int par2, int par3, int par4) private void removeLeaves(World par1World, int par2, int par3, int par4)
{ {
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlock(par2, par3, par4, this.blockID, 0, 2); par1World.setBlockToAir(par2, par3, par4);
} }
/** /**

View file

@ -10,6 +10,7 @@ import net.minecraft.block.BlockHalfSlab;
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.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -79,6 +80,49 @@ public class BlockAcaciaSlab extends BlockHalfSlab
{ {
return new ItemStack(mod_BiomesOPlenty.acaciaSingleSlab.blockID, 2, par1 & 7); return new ItemStack(mod_BiomesOPlenty.acaciaSingleSlab.blockID, 2, par1 & 7);
} }
/**
* Called upon block activation (right click on the block.)
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.acaciaDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.acaciaDoubleSlab.blockID);
return true;
}
}
}
return false;
}
/** /**
* Returns the slab block name with step type. * Returns the slab block name with step type.

View file

@ -1,5 +1,6 @@
package tdwp_ftw.biomesop.blocks; package tdwp_ftw.biomesop.blocks;
import java.util.ArrayList;
import java.util.Random; import java.util.Random;
import tdwp_ftw.biomesop.mod_BiomesOPlenty; import tdwp_ftw.biomesop.mod_BiomesOPlenty;
@ -16,6 +17,7 @@ import net.minecraft.stats.StatList;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.IShearable;
public class BlockAppleLeaves extends BlockLeavesBase public class BlockAppleLeaves extends BlockLeavesBase
{ {
@ -207,7 +209,7 @@ public class BlockAppleLeaves extends BlockLeavesBase
private void removeLeaves(World par1World, int par2, int par3, int par4) private void removeLeaves(World par1World, int par2, int par3, int par4)
{ {
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlock(par2, par3, par4, this.blockID, 0, 2); par1World.setBlockToAir(par2, par3, par4);
} }
/** /**

View file

@ -207,7 +207,7 @@ public class BlockAppleLeavesFruitless extends BlockLeavesBase
private void removeLeaves(World par1World, int par2, int par3, int par4) private void removeLeaves(World par1World, int par2, int par3, int par4)
{ {
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlock(par2, par3, par4, this.blockID, 0, 2); par1World.setBlockToAir(par2, par3, par4);
} }
/** /**

View file

@ -209,7 +209,7 @@ public class BlockAutumnLeaves extends BlockLeavesBase
private void removeLeaves(World par1World, int par2, int par3, int par4) private void removeLeaves(World par1World, int par2, int par3, int par4)
{ {
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlock(par2, par3, par4, this.blockID, 0, 2); par1World.setBlockToAir(par2, par3, par4);
} }
/** /**

View file

@ -210,7 +210,7 @@ public class BlockBambooLeaves extends BlockLeavesBase
private void removeLeaves(World par1World, int par2, int par3, int par4) private void removeLeaves(World par1World, int par2, int par3, int par4)
{ {
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlock(par2, par3, par4, 0); par1World.setBlockToAir(par2, par3, par4);
} }
/** /**

View file

@ -205,7 +205,7 @@ public class BlockBlueLeaves extends BlockLeavesBase
private void removeLeaves(World par1World, int par2, int par3, int par4) private void removeLeaves(World par1World, int par2, int par3, int par4)
{ {
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlock(par2, par3, par4, this.blockID, 0, 2); par1World.setBlockToAir(par2, par3, par4);
} }
/** /**

View file

@ -9,6 +9,7 @@ import net.minecraft.block.BlockHalfSlab;
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.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -77,6 +78,49 @@ public class BlockCherrySlab extends BlockHalfSlab
{ {
return new ItemStack(mod_BiomesOPlenty.cherrySingleSlab.blockID, 2, par1 & 7); return new ItemStack(mod_BiomesOPlenty.cherrySingleSlab.blockID, 2, par1 & 7);
} }
/**
* Called upon block activation (right click on the block.)
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.cherryDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.cherryDoubleSlab.blockID);
return true;
}
}
}
return false;
}
/** /**
* Returns the slab block name with step type. * Returns the slab block name with step type.

View file

@ -208,7 +208,7 @@ public class BlockDarkLeaves extends BlockLeavesBase
private void removeLeaves(World par1World, int par2, int par3, int par4) private void removeLeaves(World par1World, int par2, int par3, int par4)
{ {
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlock(par2, par3, par4, this.blockID, 0, 2); par1World.setBlockToAir(par2, par3, par4);
} }
/** /**

View file

@ -9,6 +9,7 @@ import net.minecraft.block.BlockHalfSlab;
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.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -77,6 +78,49 @@ public class BlockDarkSlab extends BlockHalfSlab
{ {
return new ItemStack(mod_BiomesOPlenty.darkSingleSlab.blockID, 2, par1 & 7); return new ItemStack(mod_BiomesOPlenty.darkSingleSlab.blockID, 2, par1 & 7);
} }
/**
* Called upon block activation (right click on the block.)
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.darkDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.darkDoubleSlab.blockID);
return true;
}
}
}
return false;
}
/** /**
* Returns the slab block name with step type. * Returns the slab block name with step type.

View file

@ -208,7 +208,7 @@ public class BlockDeadLeaves extends BlockLeavesBase
private void removeLeaves(World par1World, int par2, int par3, int par4) private void removeLeaves(World par1World, int par2, int par3, int par4)
{ {
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlock(par2, par3, par4, this.blockID); par1World.setBlockToAir(par2, par3, par4);
} }
/** /**

View file

@ -208,7 +208,7 @@ public class BlockFirLeaves extends BlockLeavesBase
private void removeLeaves(World par1World, int par2, int par3, int par4) private void removeLeaves(World par1World, int par2, int par3, int par4)
{ {
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlock(par2, par3, par4, 0); par1World.setBlockToAir(par2, par3, par4);
} }
/** /**

View file

@ -9,6 +9,7 @@ import net.minecraft.block.BlockHalfSlab;
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.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -79,6 +80,49 @@ public class BlockFirSlab extends BlockHalfSlab
{ {
return new ItemStack(mod_BiomesOPlenty.firSingleSlab.blockID, 2, par1 & 7); return new ItemStack(mod_BiomesOPlenty.firSingleSlab.blockID, 2, par1 & 7);
} }
/**
* Called upon block activation (right click on the block.)
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.firDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.firDoubleSlab.blockID);
return true;
}
}
}
return false;
}
/** /**
* Returns the slab block name with step type. * Returns the slab block name with step type.

View file

@ -208,7 +208,7 @@ public class BlockHolyLeaves extends BlockLeavesBase
private void removeLeaves(World par1World, int par2, int par3, int par4) private void removeLeaves(World par1World, int par2, int par3, int par4)
{ {
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlock(par2, par3, par4, 0); par1World.setBlockToAir(par2, par3, par4);
} }
/** /**

View file

@ -9,6 +9,7 @@ import net.minecraft.block.BlockHalfSlab;
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.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -77,6 +78,49 @@ public class BlockHolySlab extends BlockHalfSlab
{ {
return new ItemStack(mod_BiomesOPlenty.holySingleSlab.blockID, 2, par1 & 7); return new ItemStack(mod_BiomesOPlenty.holySingleSlab.blockID, 2, par1 & 7);
} }
/**
* Called upon block activation (right click on the block.)
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.holyDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.holyDoubleSlab.blockID);
return true;
}
}
}
return false;
}
/** /**
* Returns the slab block name with step type. * Returns the slab block name with step type.

View file

@ -1,5 +1,6 @@
package tdwp_ftw.biomesop.blocks; package tdwp_ftw.biomesop.blocks;
import java.util.ArrayList;
import java.util.Random; import java.util.Random;
import tdwp_ftw.biomesop.mod_BiomesOPlenty; import tdwp_ftw.biomesop.mod_BiomesOPlenty;
@ -7,10 +8,12 @@ import net.minecraft.block.Block;
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.item.ItemStack;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.IShearable;
public class BlockHolyTallGrass extends Block public class BlockHolyTallGrass extends Block implements IShearable
{ {
protected BlockHolyTallGrass(int par1, Material par3Material) protected BlockHolyTallGrass(int par1, Material par3Material)
{ {
@ -32,6 +35,14 @@ public class BlockHolyTallGrass extends Block
{ {
this(par1, Material.plants); this(par1, Material.plants);
} }
/**
* Returns the ID of the items to drop on destruction.
*/
public int idDropped(int par1, Random par2Random, int par3)
{
return -1;
}
/** /**
* Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z
@ -118,4 +129,16 @@ public class BlockHolyTallGrass extends Block
{ {
return 1; return 1;
} }
public boolean isShearable(ItemStack item, World world, int x, int y, int z)
{
return true;
}
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z)));
return ret;
}
} }

View file

@ -9,6 +9,7 @@ import net.minecraft.block.BlockHalfSlab;
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.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -76,6 +77,49 @@ public class BlockMagicSlab extends BlockHalfSlab
{ {
return new ItemStack(mod_BiomesOPlenty.magicSingleSlab.blockID, 2, par1 & 7); return new ItemStack(mod_BiomesOPlenty.magicSingleSlab.blockID, 2, par1 & 7);
} }
/**
* Called upon block activation (right click on the block.)
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.magicDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.magicDoubleSlab.blockID);
return true;
}
}
}
return false;
}
/** /**
* Returns the slab block name with step type. * Returns the slab block name with step type.

View file

@ -248,7 +248,7 @@ public class BlockMangroveLeaves extends BlockLeavesBase
private void removeLeaves(World par1World, int par2, int par3, int par4) private void removeLeaves(World par1World, int par2, int par3, int par4)
{ {
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlock(par2, par3, par4, 0); par1World.setBlockToAir(par2, par3, par4);
} }
/** /**

View file

@ -9,6 +9,7 @@ import net.minecraft.block.BlockHalfSlab;
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.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -77,6 +78,49 @@ public class BlockMangroveSlab extends BlockHalfSlab
{ {
return new ItemStack(mod_BiomesOPlenty.mangroveSingleSlab.blockID, 2, par1 & 7); return new ItemStack(mod_BiomesOPlenty.mangroveSingleSlab.blockID, 2, par1 & 7);
} }
/**
* Called upon block activation (right click on the block.)
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.mangroveDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.mangroveDoubleSlab.blockID);
return true;
}
}
}
return false;
}
/** /**
* Returns the slab block name with step type. * Returns the slab block name with step type.

View file

@ -9,6 +9,7 @@ import net.minecraft.block.BlockHalfSlab;
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.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -76,6 +77,49 @@ public class BlockMudBrickSlab extends BlockHalfSlab
{ {
return new ItemStack(mod_BiomesOPlenty.mudBrickSingleSlab.blockID, 2, par1 & 7); return new ItemStack(mod_BiomesOPlenty.mudBrickSingleSlab.blockID, 2, par1 & 7);
} }
/**
* Called upon block activation (right click on the block.)
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.mudBrickDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.mudBrickDoubleSlab.blockID);
return true;
}
}
}
return false;
}
/** /**
* Returns the slab block name with step type. * Returns the slab block name with step type.

View file

@ -208,7 +208,7 @@ public class BlockOrangeLeaves extends BlockLeavesBase
private void removeLeaves(World par1World, int par2, int par3, int par4) private void removeLeaves(World par1World, int par2, int par3, int par4)
{ {
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlock(par2, par3, par4, 0); par1World.setBlockToAir(par2, par3, par4);
} }
/** /**

View file

@ -248,7 +248,7 @@ public class BlockPalmLeaves extends BlockLeavesBase
private void removeLeaves(World par1World, int par2, int par3, int par4) private void removeLeaves(World par1World, int par2, int par3, int par4)
{ {
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlock(par2, par3, par4, 0); par1World.setBlockToAir(par2, par3, par4);
} }
/** /**

View file

@ -9,6 +9,7 @@ import net.minecraft.block.BlockHalfSlab;
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.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -77,6 +78,49 @@ public class BlockPalmSlab extends BlockHalfSlab
{ {
return new ItemStack(mod_BiomesOPlenty.palmSingleSlab.blockID, 2, par1 & 7); return new ItemStack(mod_BiomesOPlenty.palmSingleSlab.blockID, 2, par1 & 7);
} }
/**
* Called upon block activation (right click on the block.)
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.palmDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.palmDoubleSlab.blockID);
return true;
}
}
}
return false;
}
/** /**
* Returns the slab block name with step type. * Returns the slab block name with step type.

View file

@ -208,7 +208,7 @@ public class BlockPinkLeaves extends BlockLeavesBase
private void removeLeaves(World par1World, int par2, int par3, int par4) private void removeLeaves(World par1World, int par2, int par3, int par4)
{ {
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlock(par2, par3, par4, 0); par1World.setBlockToAir(par2, par3, par4);
} }
/** /**

View file

@ -208,7 +208,7 @@ public class BlockRedLeaves extends BlockLeavesBase
private void removeLeaves(World par1World, int par2, int par3, int par4) private void removeLeaves(World par1World, int par2, int par3, int par4)
{ {
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlock(par2, par3, par4, 0); par1World.setBlockToAir(par2, par3, par4);
} }
/** /**

View file

@ -9,6 +9,7 @@ import net.minecraft.block.BlockHalfSlab;
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.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -76,6 +77,49 @@ public class BlockRedRockBrickSlab extends BlockHalfSlab
{ {
return new ItemStack(mod_BiomesOPlenty.redRockBrickSingleSlab.blockID, 2, par1 & 7); return new ItemStack(mod_BiomesOPlenty.redRockBrickSingleSlab.blockID, 2, par1 & 7);
} }
/**
* Called upon block activation (right click on the block.)
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.redRockBrickDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.redRockBrickDoubleSlab.blockID);
return true;
}
}
}
return false;
}
/** /**
* Returns the slab block name with step type. * Returns the slab block name with step type.

View file

@ -9,6 +9,7 @@ import net.minecraft.block.BlockHalfSlab;
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.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -76,6 +77,49 @@ public class BlockRedRockCobbleSlab extends BlockHalfSlab
{ {
return new ItemStack(mod_BiomesOPlenty.redRockCobbleSingleSlab.blockID, 2, par1 & 7); return new ItemStack(mod_BiomesOPlenty.redRockCobbleSingleSlab.blockID, 2, par1 & 7);
} }
/**
* Called upon block activation (right click on the block.)
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.redRockCobbleDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.redRockCobbleDoubleSlab.blockID);
return true;
}
}
}
return false;
}
/** /**
* Returns the slab block name with step type. * Returns the slab block name with step type.

View file

@ -248,7 +248,7 @@ public class BlockRedwoodLeaves extends BlockLeavesBase
private void removeLeaves(World par1World, int par2, int par3, int par4) private void removeLeaves(World par1World, int par2, int par3, int par4)
{ {
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlock(par2, par3, par4, 0); par1World.setBlockToAir(par2, par3, par4);
} }
/** /**

View file

@ -9,6 +9,7 @@ import net.minecraft.block.BlockHalfSlab;
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.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -77,6 +78,49 @@ public class BlockRedwoodSlab extends BlockHalfSlab
{ {
return new ItemStack(mod_BiomesOPlenty.redwoodSingleSlab.blockID, 2, par1 & 7); return new ItemStack(mod_BiomesOPlenty.redwoodSingleSlab.blockID, 2, par1 & 7);
} }
/**
* Called upon block activation (right click on the block.)
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.redwoodDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.redwoodDoubleSlab.blockID);
return true;
}
}
}
return false;
}
/** /**
* Returns the slab block name with step type. * Returns the slab block name with step type.

View file

@ -208,7 +208,7 @@ public class BlockWhiteLeaves extends BlockLeavesBase
private void removeLeaves(World par1World, int par2, int par3, int par4) private void removeLeaves(World par1World, int par2, int par3, int par4)
{ {
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlock(par2, par3, par4, 0); par1World.setBlockToAir(par2, par3, par4);
} }
/** /**

View file

@ -248,7 +248,7 @@ public class BlockWillowLeaves extends BlockLeavesBase
private void removeLeaves(World par1World, int par2, int par3, int par4) private void removeLeaves(World par1World, int par2, int par3, int par4)
{ {
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlock(par2, par3, par4, 0); par1World.setBlockToAir(par2, par3, par4);
} }
/** /**

View file

@ -9,6 +9,7 @@ import net.minecraft.block.BlockHalfSlab;
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.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -78,6 +79,49 @@ public class BlockWillowSlab extends BlockHalfSlab
{ {
return new ItemStack(mod_BiomesOPlenty.willowSingleSlab.blockID, 2, par1 & 7); return new ItemStack(mod_BiomesOPlenty.willowSingleSlab.blockID, 2, par1 & 7);
} }
/**
* Called upon block activation (right click on the block.)
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.willowDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, mod_BiomesOPlenty.willowDoubleSlab.blockID);
return true;
}
}
}
return false;
}
/** /**
* Returns the slab block name with step type. * Returns the slab block name with step type.

View file

@ -17,9 +17,13 @@ import tdwp_ftw.biomesop.blocks.BlockDarkSapling;
import tdwp_ftw.biomesop.blocks.BlockMagicSapling; import tdwp_ftw.biomesop.blocks.BlockMagicSapling;
import tdwp_ftw.biomesop.blocks.BlockMangroveSapling; import tdwp_ftw.biomesop.blocks.BlockMangroveSapling;
import tdwp_ftw.biomesop.blocks.BlockAcaciaSapling; import tdwp_ftw.biomesop.blocks.BlockAcaciaSapling;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSapling;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.entity.player.BonemealEvent; import net.minecraftforge.event.entity.player.BonemealEvent;
public class BonemealUse public class BonemealUse
@ -28,75 +32,120 @@ public class BonemealUse
@ForgeSubscribe @ForgeSubscribe
public void onUseBonemeal(BonemealEvent event) public void onUseBonemeal(BonemealEvent event)
{ {
event.setResult(Result.ALLOW);
if (event.ID == mod_BiomesOPlenty.firSapling.blockID) if (event.ID == mod_BiomesOPlenty.firSapling.blockID)
{ {
if (!event.world.isRemote) if (!event.world.isRemote)
{ {
if ((double)event.world.rand.nextFloat() < 0.45D)
{
((BlockFirSapling)mod_BiomesOPlenty.firSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); ((BlockFirSapling)mod_BiomesOPlenty.firSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
}
} }
} }
if (event.ID == mod_BiomesOPlenty.redwoodSapling.blockID) if (event.ID == mod_BiomesOPlenty.redwoodSapling.blockID)
{ {
event.setResult(Result.ALLOW);
if (!event.world.isRemote) if (!event.world.isRemote)
{ {
if ((double)event.world.rand.nextFloat() < 0.45D)
{
((BlockRedwoodSapling)mod_BiomesOPlenty.redwoodSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); ((BlockRedwoodSapling)mod_BiomesOPlenty.redwoodSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
}
} }
} }
if (event.ID == mod_BiomesOPlenty.palmSapling.blockID) if (event.ID == mod_BiomesOPlenty.palmSapling.blockID)
{ {
event.setResult(Result.ALLOW);
if (!event.world.isRemote) if (!event.world.isRemote)
{ {
if ((double)event.world.rand.nextFloat() < 0.45D)
{
((BlockPalmSapling)mod_BiomesOPlenty.palmSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); ((BlockPalmSapling)mod_BiomesOPlenty.palmSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
}
} }
} }
if (event.ID == mod_BiomesOPlenty.redSapling.blockID) if (event.ID == mod_BiomesOPlenty.redSapling.blockID)
{ {
event.setResult(Result.ALLOW);
if (!event.world.isRemote) if (!event.world.isRemote)
{ {
if ((double)event.world.rand.nextFloat() < 0.45D)
{
((BlockRedSapling)mod_BiomesOPlenty.redSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); ((BlockRedSapling)mod_BiomesOPlenty.redSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
}
} }
} }
if (event.ID == mod_BiomesOPlenty.orangeSapling.blockID) if (event.ID == mod_BiomesOPlenty.orangeSapling.blockID)
{ {
event.setResult(Result.ALLOW);
if (!event.world.isRemote) if (!event.world.isRemote)
{ {
if ((double)event.world.rand.nextFloat() < 0.45D)
{
((BlockOrangeSapling)mod_BiomesOPlenty.orangeSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); ((BlockOrangeSapling)mod_BiomesOPlenty.orangeSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
}
} }
} }
if (event.ID == mod_BiomesOPlenty.yellowSapling.blockID) if (event.ID == mod_BiomesOPlenty.yellowSapling.blockID)
{ {
event.setResult(Result.ALLOW);
if (!event.world.isRemote) if (!event.world.isRemote)
{ {
if ((double)event.world.rand.nextFloat() < 0.45D)
{
((BlockYellowSapling)mod_BiomesOPlenty.yellowSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); ((BlockYellowSapling)mod_BiomesOPlenty.yellowSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
}
} }
} }
if (event.ID == mod_BiomesOPlenty.brownSapling.blockID) if (event.ID == mod_BiomesOPlenty.brownSapling.blockID)
{ {
event.setResult(Result.ALLOW);
if (!event.world.isRemote) if (!event.world.isRemote)
{ {
if ((double)event.world.rand.nextFloat() < 0.45D)
{
((BlockBrownSapling)mod_BiomesOPlenty.brownSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); ((BlockBrownSapling)mod_BiomesOPlenty.brownSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
}
} }
} }
if (event.ID == mod_BiomesOPlenty.willowSapling.blockID) if (event.ID == mod_BiomesOPlenty.willowSapling.blockID)
{ {
event.setResult(Result.ALLOW);
if (!event.world.isRemote) if (!event.world.isRemote)
{ {
if ((double)event.world.rand.nextFloat() < 0.45D)
{
((BlockWillowSapling)mod_BiomesOPlenty.willowSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); ((BlockWillowSapling)mod_BiomesOPlenty.willowSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
}
} }
} }
if (event.ID == mod_BiomesOPlenty.appleSapling.blockID) if (event.ID == mod_BiomesOPlenty.appleSapling.blockID)
{ {
event.setResult(Result.ALLOW);
if (!event.world.isRemote) if (!event.world.isRemote)
{ {
if ((double)event.world.rand.nextFloat() < 0.45D)
{
((BlockAppleSapling)mod_BiomesOPlenty.appleSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); ((BlockAppleSapling)mod_BiomesOPlenty.appleSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
}
} }
} }
@ -104,55 +153,119 @@ public class BonemealUse
{ {
if (!event.world.isRemote) if (!event.world.isRemote)
{ {
if ((double)event.world.rand.nextFloat() < 0.45D)
{
((BlockOriginSapling)mod_BiomesOPlenty.originSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); ((BlockOriginSapling)mod_BiomesOPlenty.originSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
}
} }
} }
if (event.ID == mod_BiomesOPlenty.pinkSapling.blockID) if (event.ID == mod_BiomesOPlenty.pinkSapling.blockID)
{ {
event.setResult(Result.ALLOW);
if (!event.world.isRemote) if (!event.world.isRemote)
{ {
if ((double)event.world.rand.nextFloat() < 0.45D)
{
((BlockPinkSapling)mod_BiomesOPlenty.pinkSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); ((BlockPinkSapling)mod_BiomesOPlenty.pinkSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
}
} }
} }
if (event.ID == mod_BiomesOPlenty.whiteSapling.blockID) if (event.ID == mod_BiomesOPlenty.whiteSapling.blockID)
{ {
event.setResult(Result.ALLOW);
if (!event.world.isRemote) if (!event.world.isRemote)
{ {
if ((double)event.world.rand.nextFloat() < 0.45D)
{
((BlockWhiteSapling)mod_BiomesOPlenty.whiteSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); ((BlockWhiteSapling)mod_BiomesOPlenty.whiteSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
}
} }
} }
if (event.ID == mod_BiomesOPlenty.darkSapling.blockID) if (event.ID == mod_BiomesOPlenty.darkSapling.blockID)
{ {
event.setResult(Result.ALLOW);
if (!event.world.isRemote) if (!event.world.isRemote)
{ {
if ((double)event.world.rand.nextFloat() < 0.45D)
{
((BlockDarkSapling)mod_BiomesOPlenty.darkSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); ((BlockDarkSapling)mod_BiomesOPlenty.darkSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
}
} }
} }
if (event.ID == mod_BiomesOPlenty.magicSapling.blockID) if (event.ID == mod_BiomesOPlenty.magicSapling.blockID)
{ {
event.setResult(Result.ALLOW);
if (!event.world.isRemote) if (!event.world.isRemote)
{ {
((BlockMagicSapling)mod_BiomesOPlenty.magicSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); if ((double)event.world.rand.nextFloat() < 0.45D)
{
((BlockMagicSapling)mod_BiomesOPlenty.magicSapling).func_96477_c(event.world, event.X, event.Y, event.Z, event.world.rand);
}
} }
} }
if (event.ID == mod_BiomesOPlenty.mangroveSapling.blockID) if (event.ID == mod_BiomesOPlenty.mangroveSapling.blockID)
{ {
event.setResult(Result.ALLOW);
if (!event.world.isRemote) if (!event.world.isRemote)
{ {
if ((double)event.world.rand.nextFloat() < 0.45D)
{
((BlockMangroveSapling)mod_BiomesOPlenty.mangroveSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); ((BlockMangroveSapling)mod_BiomesOPlenty.mangroveSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
}
} }
} }
if (event.ID == mod_BiomesOPlenty.acaciaSapling.blockID) if (event.ID == mod_BiomesOPlenty.acaciaSapling.blockID)
{ {
event.setResult(Result.ALLOW);
if (!event.world.isRemote) if (!event.world.isRemote)
{ {
if ((double)event.world.rand.nextFloat() < 0.45D)
{
((BlockAcaciaSapling)mod_BiomesOPlenty.acaciaSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); ((BlockAcaciaSapling)mod_BiomesOPlenty.acaciaSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
}
}
}
if (event.ID == mod_BiomesOPlenty.holyGrass.blockID)
{
int var13 = event.X;
int var14 = event.Y + 1;
int var15 = event.Z;
for (int i1 = 0; i1 < 128; ++i1)
{
for (int i2 = 0; i2 < i1 / 16; ++i2)
{
var13 += event.world.rand.nextInt(3) - 1;
var14 += (event.world.rand.nextInt(3) - 1) * event.world.rand.nextInt(3) / 2;
var15 += event.world.rand.nextInt(3) - 1;
}
if (event.world.getBlockId(var13, var14, var15) == 0)
{
if (mod_BiomesOPlenty.holyTallGrass.canBlockStay(event.world, var13, var14, var15))
{
event.setResult(Result.ALLOW);
if (!event.world.isRemote)
{
event.world.setBlock(var13, var14, var15, mod_BiomesOPlenty.holyTallGrass.blockID, 0, 0x02);
}
}
}
} }
} }
} }

View file

@ -11,6 +11,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemSlab;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion; import net.minecraft.potion.Potion;
import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.util.WeightedRandomChestContent;
@ -508,14 +509,14 @@ public class mod_BiomesOPlenty
mediumGrass = (BlockMediumGrass)(new BlockMediumGrass(mediumGrassID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("mediumGrass"); mediumGrass = (BlockMediumGrass)(new BlockMediumGrass(mediumGrassID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("mediumGrass");
duneGrass = (new BlockDuneGrass(duneGrassID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("duneGrass"); duneGrass = (new BlockDuneGrass(duneGrassID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("duneGrass");
desertSprouts = (new BlockDesertSprouts(desertSproutsID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("desertSprouts"); desertSprouts = (new BlockDesertSprouts(desertSproutsID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("desertSprouts");
redRockCobbleDoubleSlab = (BlockHalfSlab)(new BlockRedRockCobbleSlab(redRockCobbleDoubleSlabID, true)).setHardness(1.6F).setResistance(7.5F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("redRockCobbleSlab"); redRockCobbleDoubleSlab = (BlockHalfSlab)(new BlockRedRockCobbleSlab(redRockCobbleDoubleSlabID, true)).setHardness(1.6F).setResistance(7.5F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("redRockCobbleSlab");
redRockCobbleSingleSlab = (BlockHalfSlab)(new BlockRedRockCobbleSlab(redRockCobbleSingleSlabID, false)).setHardness(1.6F).setResistance(7.5F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("redRockCobbleSlab"); redRockCobbleSingleSlab = (BlockHalfSlab)(new BlockRedRockCobbleSlab(redRockCobbleSingleSlabID, false)).setHardness(1.6F).setResistance(7.5F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("redRockCobbleSlab");
redRockCobbleStairs = (new BlockRedRockCobbleStairs(redRockCobbleStairsID, redRockCobble)).setUnlocalizedName("redRockCobbleStairs"); redRockCobbleStairs = (new BlockRedRockCobbleStairs(redRockCobbleStairsID, redRockCobble)).setUnlocalizedName("redRockCobbleStairs");
redRockBrickDoubleSlab = (BlockHalfSlab)(new BlockRedRockBrickSlab(redRockBrickDoubleSlabID, true)).setHardness(1.1F).setResistance(7.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("redRockBrickSlab"); redRockBrickDoubleSlab = (BlockHalfSlab)(new BlockRedRockBrickSlab(redRockBrickDoubleSlabID, true)).setHardness(1.1F).setResistance(7.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("redRockBrickSlab");
redRockBrickSingleSlab = (BlockHalfSlab)(new BlockRedRockBrickSlab(redRockBrickSingleSlabID, false)).setHardness(1.1F).setResistance(7.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("redRockBrickSlab"); redRockBrickSingleSlab = (BlockHalfSlab)(new BlockRedRockBrickSlab(redRockBrickSingleSlabID, false)).setHardness(1.1F).setResistance(7.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("redRockBrickSlab");
redRockBrickStairs = (new BlockRedRockBrickStairs(redRockBrickStairsID, redRockBrick)).setUnlocalizedName("redRockBrickStairs"); redRockBrickStairs = (new BlockRedRockBrickStairs(redRockBrickStairsID, redRockBrick)).setUnlocalizedName("redRockBrickStairs");
mudBrickDoubleSlab = (BlockHalfSlab)(new BlockMudBrickSlab(mudBrickDoubleSlabID, true)).setHardness(1.0F).setResistance(2.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("mudBrickSlab"); mudBrickDoubleSlab = (BlockHalfSlab)(new BlockMudBrickSlab(mudBrickDoubleSlabID, true)).setHardness(1.0F).setResistance(2.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("mudBrickSlab");
mudBrickSingleSlab = (BlockHalfSlab)(new BlockMudBrickSlab(mudBrickSingleSlabID, false)).setHardness(1.0F).setResistance(2.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("mudBrickSlab"); mudBrickSingleSlab = (BlockHalfSlab)(new BlockMudBrickSlab(mudBrickSingleSlabID, false)).setHardness(1.0F).setResistance(2.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("mudBrickSlab");
mudBrickStairs = (new BlockMudBrickStairs(mudBrickStairsID, mudBrickBlock)).setUnlocalizedName("mudBrickStairs"); mudBrickStairs = (new BlockMudBrickStairs(mudBrickStairsID, mudBrickBlock)).setUnlocalizedName("mudBrickStairs");
mangroveSapling = (new BlockMangroveSapling(mangroveSaplingID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("mangroveSapling"); mangroveSapling = (new BlockMangroveSapling(mangroveSaplingID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("mangroveSapling");
hardSand = (new BlockHardSand(hardSandID)).setHardness(0.7F).setStepSound(Block.soundSandFootstep).setUnlocalizedName("hardSand"); hardSand = (new BlockHardSand(hardSandID)).setHardness(0.7F).setStepSound(Block.soundSandFootstep).setUnlocalizedName("hardSand");