ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemShovelAA.java

63 lines
2.4 KiB
Java
Raw Normal View History

2016-03-19 11:36:17 +01:00
/*
2016-05-16 22:52:27 +02:00
* This file ("ItemShovelAA.java") is part of the Actually Additions mod for Minecraft.
2016-03-19 11:36:17 +01:00
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
2016-05-16 22:52:27 +02:00
* http://ellpeck.de/actaddlicense
2016-03-19 11:36:17 +01:00
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
2016-05-16 22:54:42 +02:00
* © 2015-2016 Ellpeck
2016-03-19 11:36:17 +01:00
*/
package de.ellpeck.actuallyadditions.mod.items;
import com.google.common.collect.Sets;
import de.ellpeck.actuallyadditions.mod.items.base.ItemToolAA;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
2016-04-20 21:39:03 +02:00
import net.minecraft.init.Items;
2016-03-19 11:36:17 +01:00
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import java.util.Collections;
2016-03-19 11:36:17 +01:00
import java.util.Set;
public class ItemShovelAA extends ItemToolAA{
2016-04-20 21:39:03 +02:00
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(Blocks.CLAY, Blocks.DIRT, Blocks.FARMLAND, Blocks.GRASS, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.SNOW, Blocks.SNOW_LAYER, Blocks.SOUL_SAND, Blocks.GRASS_PATH);
2016-03-19 11:36:17 +01:00
public ItemShovelAA(Item.ToolMaterial material, String repairItem, String unlocalizedName, EnumRarity rarity){
super(1.5F, -3.0F, material, repairItem, unlocalizedName, rarity, EFFECTIVE_ON);
this.setHarvestLevel("shovel", material.getHarvestLevel());
2016-03-19 11:36:17 +01:00
}
public ItemShovelAA(Item.ToolMaterial material, ItemStack repairItem, String unlocalizedName, EnumRarity rarity){
super(1.5F, -3.0F, material, repairItem, unlocalizedName, rarity, EFFECTIVE_ON);
this.setHarvestLevel("shovel", material.getHarvestLevel());
2016-03-19 11:36:17 +01:00
}
2016-05-02 17:09:23 +02:00
@Override
2016-03-19 11:36:17 +01:00
public boolean canHarvestBlock(IBlockState blockIn){
Block block = blockIn.getBlock();
2016-04-20 21:39:03 +02:00
return block == Blocks.SNOW_LAYER || block == Blocks.SNOW;
2016-03-19 11:36:17 +01:00
}
2016-05-02 17:09:23 +02:00
@Override
2016-11-19 21:11:17 +01:00
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ){
return Items.IRON_SHOVEL.onItemUse(playerIn, worldIn, pos, hand, facing, hitX, hitY, hitZ);
2016-03-19 11:36:17 +01:00
}
@Override
public Set<String> getToolClasses(ItemStack stack){
return Collections.singleton("shovel");
}
2016-03-19 11:36:17 +01:00
}