本文整理汇总了Java中net.minecraft.block.IGrowable.canUseBonemeal方法的典型用法代码示例。如果您正苦于以下问题:Java IGrowable.canUseBonemeal方法的具体用法?Java IGrowable.canUseBonemeal怎么用?Java IGrowable.canUseBonemeal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.block.IGrowable
的用法示例。
在下文中一共展示了IGrowable.canUseBonemeal方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyBonemeal
import net.minecraft.block.IGrowable; //导入方法依赖的package包/类
public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target)
{
IBlockState iblockstate = worldIn.getBlockState(target);
if (iblockstate.getBlock() instanceof IGrowable)
{
IGrowable igrowable = (IGrowable)iblockstate.getBlock();
if (igrowable.canGrow(worldIn, target, iblockstate, worldIn.isRemote))
{
if (!worldIn.isRemote)
{
if (igrowable.canUseBonemeal(worldIn, worldIn.rand, target, iblockstate))
{
igrowable.grow(worldIn, worldIn.rand, target, iblockstate);
}
--stack.stackSize;
}
return true;
}
}
return false;
}
示例2: applyBonemeal
import net.minecraft.block.IGrowable; //导入方法依赖的package包/类
public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target)
{
IBlockState iblockstate = worldIn.getBlockState(target);
if (iblockstate.getBlock() instanceof IGrowable)
{
IGrowable igrowable = (IGrowable)iblockstate.getBlock();
if (igrowable.canGrow(worldIn, target, iblockstate, worldIn.isRemote))
{
if (!worldIn.isRemote)
{
if (igrowable.canUseBonemeal(worldIn, worldIn.rand, target, iblockstate))
{
igrowable.grow(worldIn, worldIn.rand, target, iblockstate);
}
stack.func_190918_g(1);
}
return true;
}
}
return false;
}
示例3: applyBonemeal
import net.minecraft.block.IGrowable; //导入方法依赖的package包/类
public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos pos, IBlockState state, EntityPlayer player, @javax.annotation.Nullable EnumHand hand) {
if (!(state.getBlock() instanceof BlockGrass) || player.isSneaking()) {
int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, worldIn, pos, state, stack, hand);
if (hook != 0) return hook > 0;
IGrowable igrowable = (IGrowable) state.getBlock();
if (igrowable.canGrow(worldIn, pos, state, worldIn.isRemote)) {
if (!worldIn.isRemote) {
if (igrowable.canUseBonemeal(worldIn, worldIn.rand, pos, state)) {
igrowable.grow(worldIn, worldIn.rand, pos, state);
}
stack.damageItem(1, player);
}
return true;
}
}
return false;
}
示例4: applyUnko
import net.minecraft.block.IGrowable; //导入方法依赖的package包/类
private boolean applyUnko(ItemStack stack, World worldIn, BlockPos pos, EntityPlayer player) {
IBlockState iblockstate = worldIn.getBlockState(pos);
Block block = iblockstate.getBlock();
if (block instanceof IGrowable)
{
IGrowable igrowable = (IGrowable)block;
if (igrowable.isStillGrowing(worldIn, pos, iblockstate, worldIn.isRemote))
{
if (!worldIn.isRemote)
{
if (igrowable.canUseBonemeal(worldIn, worldIn.rand, pos, iblockstate))
{
igrowable.grow(worldIn, worldIn.rand, pos, iblockstate);
}
--stack.stackSize;
}
return true;
}
}
return false;
}
示例5: applyBonemeal
import net.minecraft.block.IGrowable; //导入方法依赖的package包/类
public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target, EntityPlayer player)
{
IBlockState iblockstate = worldIn.getBlockState(target);
int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, worldIn, target, iblockstate, stack);
if (hook != 0) return hook > 0;
if (iblockstate.getBlock() instanceof IGrowable)
{
IGrowable igrowable = (IGrowable)iblockstate.getBlock();
if (igrowable.canGrow(worldIn, target, iblockstate, worldIn.isRemote))
{
if (!worldIn.isRemote)
{
if (igrowable.canUseBonemeal(worldIn, worldIn.rand, target, iblockstate))
{
igrowable.grow(worldIn, worldIn.rand, target, iblockstate);
}
--stack.stackSize;
}
return true;
}
}
return false;
}
示例6: onItemUse
import net.minecraft.block.IGrowable; //导入方法依赖的package包/类
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
super.onItemUse(stack, playerIn, worldIn, pos, hand, facing, hitX, hitY, hitZ);
if (this.getMaterialName() == zivicioToolMaterial.toString() && PrimordialConfig.enableZivicioHoeSpeedup) {
IBlockState iblockstate = worldIn.getBlockState(pos);
Block block = iblockstate.getBlock();
if (block != null && block instanceof IGrowable) {
IGrowable igrowable = (IGrowable) block;
if (igrowable.canGrow(worldIn, pos, iblockstate, worldIn.isRemote)) {
if (!worldIn.isRemote) {
if (igrowable.canUseBonemeal(worldIn, worldIn.rand, pos, iblockstate)) {
//igrowable.grow(worldIn, worldIn.rand, pos, iblockstate); // no client side update
//iblockstate.getBlock().updateTick(worldIn, pos, iblockstate, worldIn.rand); // no client side update
//LogHelper.info("update");
worldIn.scheduleUpdate(pos, block, 1);
}
} else {
//LogHelper.info("spawn" + igrowable.toString());
spawnBonemealParticles(worldIn, pos, 5);
}
}
}
}
return EnumActionResult.PASS;
}
示例7: applyBonemeal
import net.minecraft.block.IGrowable; //导入方法依赖的package包/类
public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target, EntityPlayer player)
{
IBlockState iblockstate = worldIn.getBlockState(target);
int hook = net.minecraftforge.event.ForgeEventFactory
.onApplyBonemeal(player, worldIn, target, iblockstate, stack);
if (hook != 0)
return hook > 0;
if (iblockstate.getBlock() instanceof IGrowable)
{
IGrowable igrowable = (IGrowable) iblockstate.getBlock();
if (igrowable.canGrow(worldIn, target, iblockstate, worldIn.isRemote))
{
if (!worldIn.isRemote)
{
if (igrowable.canUseBonemeal(worldIn, worldIn.rand, target, iblockstate))
{
igrowable.grow(worldIn, worldIn.rand, target, iblockstate);
}
stack.damageItem(10, player);
}
return true;
}
}
return false;
}
示例8: applyBonemeal
import net.minecraft.block.IGrowable; //导入方法依赖的package包/类
public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target, EntityPlayer player)
{
IBlockState iblockstate = worldIn.getBlockState(target);
int hook = net.minecraftforge.event.ForgeEventFactory
.onApplyBonemeal(player, worldIn, target, iblockstate, stack);
if (hook != 0)
return hook > 0;
if (iblockstate.getBlock() instanceof IGrowable)
{
IGrowable igrowable = (IGrowable) iblockstate.getBlock();
if (igrowable.canGrow(worldIn, target, iblockstate, worldIn.isRemote))
{
if (!worldIn.isRemote)
{
if (igrowable.canUseBonemeal(worldIn, worldIn.rand, target, iblockstate))
{
igrowable.grow(worldIn, worldIn.rand, target, iblockstate);
}
--stack.stackSize;
}
return true;
}
}
return false;
}