-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7256a54
commit 0e0c559
Showing
5 changed files
with
45 additions
and
28 deletions.
There are no files selected for viewing
15 changes: 8 additions & 7 deletions
15
src/main/java/dev/dubhe/anvilcraft/item/AmethystAxeItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
package dev.dubhe.anvilcraft.item; | ||
|
||
import dev.dubhe.anvilcraft.init.ModEnchantments; | ||
import net.minecraft.core.component.DataComponents; | ||
import net.minecraft.world.item.AxeItem; | ||
import net.minecraft.world.item.ItemStack; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import net.minecraft.world.item.enchantment.ItemEnchantments; | ||
import net.minecraft.world.level.Level; | ||
|
||
public class AmethystAxeItem extends AxeItem { | ||
/** | ||
* | ||
*/ | ||
public AmethystAxeItem(Properties properties) { | ||
super(ModTiers.AMETHYST, properties.attributes(AxeItem.createAttributes(ModTiers.AMETHYST, 7, -3.2f))); | ||
} | ||
|
||
@Override | ||
public @NotNull ItemStack getDefaultInstance() { | ||
ItemStack stack = super.getDefaultInstance(); | ||
return stack; | ||
public void onCraftedPostProcess(ItemStack stack, Level level) { | ||
ItemEnchantments.Mutable enchantments = new ItemEnchantments.Mutable(ItemEnchantments.EMPTY); | ||
enchantments.set(level.registryAccess().holderOrThrow(ModEnchantments.FELLING_KEY), 1); | ||
stack.set(DataComponents.ENCHANTMENTS, enchantments.toImmutable()); | ||
} | ||
} |
14 changes: 8 additions & 6 deletions
14
src/main/java/dev/dubhe/anvilcraft/item/AmethystHoeItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
package dev.dubhe.anvilcraft.item; | ||
|
||
import dev.dubhe.anvilcraft.init.ModEnchantments; | ||
import net.minecraft.core.component.DataComponents; | ||
import net.minecraft.world.item.AxeItem; | ||
import net.minecraft.world.item.HoeItem; | ||
import net.minecraft.world.item.ItemStack; | ||
|
||
import net.minecraft.world.item.enchantment.ItemEnchantments; | ||
import net.minecraft.world.level.Level; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class AmethystHoeItem extends HoeItem { | ||
/** | ||
* | ||
*/ | ||
public AmethystHoeItem(Properties properties) { | ||
super(ModTiers.AMETHYST, properties.attributes(AxeItem.createAttributes(ModTiers.AMETHYST, -1, -2.0f))); | ||
} | ||
|
||
@Override | ||
public @NotNull ItemStack getDefaultInstance() { | ||
ItemStack stack = super.getDefaultInstance(); | ||
return stack; | ||
public void onCraftedPostProcess(ItemStack stack, Level level) { | ||
ItemEnchantments.Mutable enchantments = new ItemEnchantments.Mutable(ItemEnchantments.EMPTY); | ||
enchantments.set(level.registryAccess().holderOrThrow(ModEnchantments.HARVEST_KEY), 1); | ||
stack.set(DataComponents.ENCHANTMENTS, enchantments.toImmutable()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 9 additions & 6 deletions
15
src/main/java/dev/dubhe/anvilcraft/item/AmethystShovelItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,25 @@ | ||
package dev.dubhe.anvilcraft.item; | ||
|
||
import dev.dubhe.anvilcraft.init.ModEnchantments; | ||
import net.minecraft.core.component.DataComponents; | ||
import net.minecraft.world.item.AxeItem; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.ShovelItem; | ||
|
||
import net.minecraft.world.item.enchantment.Enchantments; | ||
import net.minecraft.world.item.enchantment.ItemEnchantments; | ||
import net.minecraft.world.level.Level; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class AmethystShovelItem extends ShovelItem { | ||
/** | ||
* | ||
*/ | ||
public AmethystShovelItem(Properties properties) { | ||
super(ModTiers.AMETHYST, properties.attributes(AxeItem.createAttributes(ModTiers.AMETHYST, 1.5f, -3.0f))); | ||
} | ||
|
||
@Override | ||
public @NotNull ItemStack getDefaultInstance() { | ||
ItemStack stack = super.getDefaultInstance(); | ||
return stack; | ||
public void onCraftedPostProcess(ItemStack stack, Level level) { | ||
ItemEnchantments.Mutable enchantments = new ItemEnchantments.Mutable(ItemEnchantments.EMPTY); | ||
enchantments.set(level.registryAccess().holderOrThrow(Enchantments.EFFICIENCY), 3); | ||
stack.set(DataComponents.ENCHANTMENTS, enchantments.toImmutable()); | ||
} | ||
} |
14 changes: 8 additions & 6 deletions
14
src/main/java/dev/dubhe/anvilcraft/item/AmethystSwordItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
package dev.dubhe.anvilcraft.item; | ||
|
||
import dev.dubhe.anvilcraft.init.ModEnchantments; | ||
import net.minecraft.core.component.DataComponents; | ||
import net.minecraft.world.item.AxeItem; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.SwordItem; | ||
|
||
import net.minecraft.world.item.enchantment.ItemEnchantments; | ||
import net.minecraft.world.level.Level; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class AmethystSwordItem extends SwordItem { | ||
/** | ||
* | ||
*/ | ||
public AmethystSwordItem(Properties properties) { | ||
super(ModTiers.AMETHYST, properties.attributes(AxeItem.createAttributes(ModTiers.AMETHYST, 3, -2.4f))); | ||
} | ||
|
||
@Override | ||
public @NotNull ItemStack getDefaultInstance() { | ||
ItemStack stack = super.getDefaultInstance(); | ||
return stack; | ||
public void onCraftedPostProcess(ItemStack stack, Level level) { | ||
ItemEnchantments.Mutable enchantments = new ItemEnchantments.Mutable(ItemEnchantments.EMPTY); | ||
enchantments.set(level.registryAccess().holderOrThrow(ModEnchantments.BEHEADING_KEY), 1); | ||
stack.set(DataComponents.ENCHANTMENTS, enchantments.toImmutable()); | ||
} | ||
} |