ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPickaxeAA.java
2021-11-21 14:18:00 -06:00

94 lines
4 KiB
Java

/*
* This file ("ItemPickaxeAA.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
import com.google.common.collect.ImmutableSet;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import net.minecraft.item.IItemTier;
import net.minecraft.item.ToolItem;
import net.minecraftforge.common.ToolType;
public class ItemPickaxeAA extends ToolItem {
private final IItemTier tier;
public ItemPickaxeAA(IItemTier tier) {
super(
4.0f,
-2f,
tier,
ImmutableSet.of(),
new Properties()
.addToolType(ToolType.AXE, tier.getLevel())
.addToolType(ToolType.HOE, tier.getLevel())
.addToolType(ToolType.SHOVEL, tier.getLevel())
.addToolType(ToolType.PICKAXE, tier.getLevel())
.durability(tier.getUses() * 4)
.tab(ActuallyAdditions.GROUP)
);
this.tier = tier;
}
/*
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.DOUBLE_STONE_SLAB, Blocks.GOLDEN_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.ICE, Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.LIT_REDSTONE_ORE, Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, Blocks.SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.STONE_SLAB, Blocks.STONE_BUTTON, Blocks.STONE_PRESSURE_PLATE);
public ItemPickaxeAA(IItemTier material) {
super(1.0F, -2.8F, material, this.repairItem, unlocalizedName, this.rarity, EFFECTIVE_ON);
this.setHarvestLevel("pickaxe", material.getLevel());
}
@Override
public boolean isCorrectToolForDrops(BlockState blockIn) {
Block block = blockIn.getBlock();
if (block == Blocks.OBSIDIAN) {
return this.toolMaterial.getHarvestLevel() == 3;
} else if (block != Blocks.DIAMOND_BLOCK && block != Blocks.DIAMOND_ORE) {
if (block != Blocks.EMERALD_ORE && block != Blocks.EMERALD_BLOCK) {
if (block != Blocks.GOLD_BLOCK && block != Blocks.GOLD_ORE) {
if (block != Blocks.IRON_BLOCK && block != Blocks.IRON_ORE) {
if (block != Blocks.LAPIS_BLOCK && block != Blocks.LAPIS_ORE) {
if (block != Blocks.REDSTONE_ORE) {
Material material = blockIn.getMaterial();
return material == Material.STONE || material == Material.METAL || material == Material.HEAVY_METAL;
} else {
return this.toolMaterial.getHarvestLevel() >= 2;
}
} else {
return this.toolMaterial.getHarvestLevel() >= 1;
}
} else {
return this.toolMaterial.getHarvestLevel() >= 1;
}
} else {
return this.toolMaterial.getHarvestLevel() >= 2;
}
} else {
return this.toolMaterial.getHarvestLevel() >= 2;
}
} else {
return this.toolMaterial.getHarvestLevel() >= 2;
}
}
@Override
public float getDestroySpeed(ItemStack stack, BlockState state) {
Material material = state.getMaterial();
return material != Material.METAL && material != Material.HEAVY_METAL && material != Material.STONE
? super.getDestroySpeed(stack, state)
: this.speed;
}
@Override
public Set<String> getToolClasses(ItemStack stack) {
return Collections.singleton("pickaxe");
}*/
}