本文整理汇总了Java中net.minecraftforge.common.ForgeHooks.isToolEffective方法的典型用法代码示例。如果您正苦于以下问题:Java ForgeHooks.isToolEffective方法的具体用法?Java ForgeHooks.isToolEffective怎么用?Java ForgeHooks.isToolEffective使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.common.ForgeHooks
的用法示例。
在下文中一共展示了ForgeHooks.isToolEffective方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onItemUse
import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
@Override
@SuppressWarnings("deprecation")
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
if ((this.getStrVsBlock(stack, world.getBlockState(pos)) == this.efficiencyOnProperMaterial || ForgeHooks.isToolEffective(world, pos, stack)) && world.isAirBlock(pos.up()))
{
if (world.getTileEntity(pos) != null || world.getBlockState(pos).getBlock().getBlockHardness(world.getBlockState(pos), world, pos) == -1.0F)
{
return EnumActionResult.FAIL;
}
if (!world.isRemote)
{
EntityFloatingBlock entity = new EntityFloatingBlock(world, pos, world.getBlockState(pos));
world.spawnEntityInWorld(entity);
world.setBlockToAir(pos);
}
stack.damageItem(4, player);
}
return EnumActionResult.SUCCESS;
}
示例2: func_150893_a
import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
public float func_150893_a(final ItemStack stack, final Block block) {
for (final ItemStack tool : ItemPrecisionShears.toolStacks) {
if (ForgeHooks.isToolEffective(tool, block, 0)) {
return 4.0f;
}
}
return super.func_150893_a(stack, block);
}
示例3: onBlockHarvested
import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
@Override
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player)
{
if(state.getValue(FILL) > 0 && state.getValue(FILLTYPE) == FillType.Charcoal &&
ForgeHooks.isToolEffective(worldIn, pos, player.getHeldItemMainhand()))
{
Core.giveItem(worldIn, player, pos, new ItemStack(Items.COAL, 1, 1));
worldIn.setBlockState(pos, state.withProperty(FILL, state.getValue(FILL)-1));
}
}
示例4: getDigSpeed
import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
@Override
public float getDigSpeed(ItemStack stack, Block block, int meta) {
if (ForgeHooks.isToolEffective(stack, block, meta)) {
return getDigSpeed(stack);
}
return super.getDigSpeed(stack, block, meta);
}
示例5: getDigSpeed
import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
/**
* Metadata-sensitive version of getStrVsBlock
* @param itemstack The Item Stack
* @param block The block the item is trying to break
* @param metadata The items current metadata
* @return The damage strength
*/
@Override
public float getDigSpeed(ItemStack itemstack, Block block, int metadata)
{
if(!this.hasEnoughEnergy(itemstack, energyCostUseSmall)) {
return 1.0F;
}
if (ForgeHooks.isToolEffective(itemstack, block, metadata) || this.isEffectiveAgainst(this.getMode(itemstack), block))
{
return efficiencyOnProperMaterial;
}
return super.getDigSpeed(itemstack, block, metadata);
//return func_150893_a(itemstack, block);
}
示例6: getDigSpeed
import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
@Override
public float getDigSpeed(ItemStack stack, Block block, int meta)
{
if(ForgeHooks.isToolEffective(stack, block, meta))
{
int tension = NBTHelper.getInt(stack, NBTTags.TENSION_ENERGY); if(tension <= 0) { return 1.0F; }
int speed = NBTHelper.getInt(stack, NBTTags.SPEED); if(speed <= 0) { return 1.0F; }
return super.getDigSpeed(stack, block, meta) * 3.0F;
}
return func_150893_a(stack, block);
}
示例7: getDigSpeed
import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
@Override
public float getDigSpeed(ItemStack stack, Block block, int meta)
{
if(ForgeHooks.isToolEffective(stack, block, meta))
{
int tension = NBTHelper.getInt(stack, NBTTags.TENSION_ENERGY); if(tension <= 0) { return 1.0F; }
int speed = NBTHelper.getInt(stack, NBTTags.SPEED); if(speed <= 0) { return 1.0F; }
return (float)speed / 20;
}
return func_150893_a(stack, block);
}
示例8: canHarvestBlock
import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
@Override
/**
* Returns if the item (tool) can harvest results from the block type.
*/
public boolean canHarvestBlock(Block block, ItemStack stack)
{
return ForgeHooks.isToolEffective(stack, block, material.getHarvestLevel());
}
示例9: canDig
import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
public boolean canDig(ITurtleAccess turtle, int x, int y, int z, int side) {
ItemStack item = getCraftingItem();
if (item != null) {
int id = turtle.getWorld().getBlockId(x, y, z);
if (Block.blocksList[id] != null) return ForgeHooks.isToolEffective(item, Block.blocksList[id], turtle.getWorld().getBlockMetadata(x, y, z));
}
return false;
}
示例10: getBlockDrops
import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
public Iterable<ItemStack> getBlockDrops(ITurtleAccess turtle, int x, int y, int z, int side) {
World world = turtle.getWorld();
int id = world.getBlockId(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
if (Block.blocksList[id] == null || !ForgeHooks.isToolEffective(getCraftingItem(), Block.blocksList[id], meta)) return new ArrayList<ItemStack>(0);
return Block.blocksList[id].getBlockDropped(world, x, y, z, meta, 0);
}
示例11: getDigSpeed
import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
@Override
public float getDigSpeed(ItemStack stack, Block block, int meta)
{
if (ForgeHooks.isToolEffective(stack, block, meta))
{
return efficiencyOnProperMaterial;
}
return super.getDigSpeed(stack, block, meta);
}
示例12: onBlockDestroyed
import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase player) {
if(EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.impact.effectId, stack) <= 0)
return super.onBlockDestroyed(stack, world, block, x, y, z, player);
if(!player.worldObj.isRemote) {
int meta = world.getBlockMetadata(x, y, z);
if(ForgeHooks.isToolEffective(stack, block, meta)) {
for(int aa = -1; aa <= 1; ++aa) {
for(int bb = -1; bb <= 1; ++bb) {
int xx = 0;
int yy = 0;
int zz = 0;
if(this.side <= 1) {
xx = aa;
zz = bb;
} else if(this.side <= 3) {
xx = aa;
yy = bb;
} else {
zz = aa;
yy = bb;
}
if(!(player instanceof EntityPlayer) || world.canMineBlock((EntityPlayer)player, x + xx, y + yy, z + zz)) {
Block bl = world.getBlock(x + xx, y + yy, z + zz);
meta = world.getBlockMetadata(x + xx, y + yy, z + zz);
if(bl.getBlockHardness(world, x + xx, y + yy, z + zz) >= 0.0F && ForgeHooks.isToolEffective(stack, bl, meta)) {
stack.damageItem(1, player);
BlockUtils.harvestBlock(world, (EntityPlayer)player, x + xx, y + yy, z + zz, true, 2);
}
}
}
}
}
else
return super.onBlockDestroyed(stack, world, block, x, y, z, player);
}
return super.onBlockDestroyed(stack, world, block, x, y, z, player);
}
示例13: getStrVsBlock
import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
/** FORGE: Overridden to allow custom tool effectiveness */
@Override
public float getStrVsBlock(ItemStack stack, Block block, int meta)
{
if (ForgeHooks.isToolEffective(stack, block, meta))
{
return efficiencyOnProperMaterial;
}
return getStrVsBlock(stack, block);
}
示例14: getStrVsBlock
import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
@Override
public float getStrVsBlock(ItemStack itemstack, Block block, int md) {
if (ForgeHooks.isToolEffective(itemstack, block, md))
return efficiencyOnProperMaterial;
return getStrVsBlock(itemstack, block);
}
示例15: getDigSpeed
import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
@Override
public float getDigSpeed(ItemStack itemStack, Block block, int metadata)
{
return ForgeHooks.isToolEffective(itemStack, block, metadata) ? 4.8f : func_150893_a(itemStack, block);
}