Remove dead ForgeHooks.canToolHarvestBlock function. (#7262)

This commit is contained in:
sciwhiz12 2020-09-09 04:01:26 +08:00 committed by GitHub
parent 05480843cd
commit 47ba5b7a89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 14 deletions

View File

@ -173,22 +173,13 @@ public class ForgeHooks
if (stack.isEmpty() || tool == null)
return player.func_234569_d_(state);
int toolLevel = stack.getItem().getHarvestLevel(stack, tool, player, state);
int toolLevel = stack.getHarvestLevel(tool, player, state);
if (toolLevel < 0)
return player.func_234569_d_(state);
return ForgeEventFactory.doPlayerHarvestCheck(player, state, toolLevel >= state.getHarvestLevel());
}
public static boolean canToolHarvestBlock(IWorldReader world, BlockPos pos, @Nonnull ItemStack stack)
{
BlockState state = world.getBlockState(pos);
//state = state.getActualState(world, pos);
ToolType tool = state.getHarvestTool();
if (stack.isEmpty() || tool == null) return false;
return stack.getHarvestLevel(tool, null, null) >= state.getHarvestLevel();
}
public static boolean isToolEffective(IWorldReader world, BlockPos pos, @Nonnull ItemStack stack)
{
BlockState state = world.getBlockState(pos);

View File

@ -94,10 +94,9 @@ public interface IForgeItemStack extends ICapabilitySerializable<CompoundNBT>
* Queries the harvest level of this item stack for the specified tool class,
* Returns -1 if this tool is not of the specified type
*
* @param stack This item stack instance
* @param toolClass Tool Class
* @param player The player trying to harvest the given blockstate
* @param state The block to harvest
* @param tool the tool type of the item
* @param player The player trying to harvest the given blockstate
* @param state The block to harvest
* @return Harvest level, or -1 if not the specified tool type.
*/
default int getHarvestLevel(ToolType tool, @Nullable PlayerEntity player, @Nullable BlockState state)