66import net .minecraft .ChatFormatting ;
77import net .minecraft .core .BlockPos ;
88import net .minecraft .core .Direction ;
9- import net .minecraft .core .Holder ;
10- import net .minecraft .core .Registry ;
119import net .minecraft .core .component .DataComponents ;
12- import net .minecraft .core .registries .BuiltInRegistries ;
13- import net .minecraft .core .registries .Registries ;
1410import net .minecraft .network .chat .Component ;
1511import net .minecraft .server .level .ServerLevel ;
1612import net .minecraft .server .level .ServerPlayer ;
1713import net .minecraft .tags .BlockTags ;
18- import net .minecraft .tags .TagKey ;
1914import net .minecraft .world .entity .EquipmentSlot ;
2015import net .minecraft .world .entity .ExperienceOrb ;
2116import net .minecraft .world .entity .LivingEntity ;
2217import net .minecraft .world .entity .item .ItemEntity ;
2318import net .minecraft .world .item .*;
24- import net .minecraft .world .item .crafting .Ingredient ;
25- import net .minecraft .world .item .enchantment .Enchantment ;
26- import net .minecraft .world .item .enchantment .EnchantmentHelper ;
27- import net .minecraft .world .item .enchantment .Enchantments ;
2819import net .minecraft .world .level .GameRules ;
2920import net .minecraft .world .level .Level ;
3021import net .minecraft .world .level .block .Block ;
3425import net .minecraft .world .level .levelgen .structure .BoundingBox ;
3526import net .minecraft .world .phys .BlockHitResult ;
3627import net .minecraft .world .phys .HitResult ;
37- import org .jetbrains .annotations .NotNull ;
3828import pro .mikey .justhammers .config .SimpleJsonConfig ;
3929import net .minecraft .world .phys .Vec3 ;
4030import java .util .HashSet ;
@@ -48,24 +38,19 @@ public class HammerItem extends PickaxeItem {
4838 private final int depth ;
4939 private final int radius ;
5040
51- public HammerItem (Tier tier , int radius , int depth , int level ) {
52- super (new WrappedTier (tier , computeDurability (tier , level )), computeProperties (tier , level ));
41+ public HammerItem (Item . Properties rootProperties , ToolMaterial tier , int radius , int depth , int level ) {
42+ super (wrapMaterial (tier , computeDurability (tier , level )), 1 , - 2.8f , computeProperties (tier , rootProperties ));
5343
5444 this .depth = depth ;
5545 this .radius = radius ;
5646 }
5747
58- private static Item .Properties computeProperties (Tier tier , int level ) {
59- Properties itemProperties = new Properties ().arch$tab (Hammers .TAB )
60- .durability (computeDurability (tier , level ))
61- .attributes (PickaxeItem .createAttributes (tier , 1 , -2.8f ))
62- .component (DataComponents .TOOL , tier .createToolProperties (BlockTags .MINEABLE_WITH_PICKAXE ));
63-
64- if (tier == Tiers .NETHERITE ) {
65- itemProperties .fireResistant ();
48+ private static Item .Properties computeProperties (ToolMaterial tier , Item .Properties properties ) {
49+ if (tier == ToolMaterial .NETHERITE ) {
50+ properties .fireResistant ();
6651 }
6752
68- return itemProperties ;
53+ return properties ;
6954 }
7055
7156 @ Override
@@ -240,7 +225,7 @@ public int getAsInt() {
240225 drops .forEach (e -> Block .popResourceFromFace (level , pos , pick .getDirection (), e ));
241226 }
242227
243- if (outputXpLevel != -1 && level .getGameRules ().getBoolean (GameRules .RULE_DOBLOCKDROPS )) {
228+ if (outputXpLevel != -1 && (( ServerLevel ) level ) .getGameRules ().getBoolean (GameRules .RULE_DOBLOCKDROPS )) {
244229 ExperienceOrb .award ((ServerLevel ) level , Vec3 .atCenterOf (blockPos ), outputXpLevel );
245230 }
246231 }
0 commit comments