Skip to content

Commit

Permalink
fix: miners are not enchantable
Browse files Browse the repository at this point in the history
Closes #1152
  • Loading branch information
klikli-dev committed Jul 15, 2024
1 parent ee046a1 commit 0eae915
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"#occultism:miners"
]
}
8 changes: 8 additions & 0 deletions src/generated/resources/data/occultism/tags/item/miners.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"values": [
"#occultism:miners/basic_resources",
"#occultism:miners/deeps",
"#occultism:miners/master",
"#occultism:miners/ores"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@
import com.klikli_dev.occultism.registry.OccultismDataComponents;
import com.klikli_dev.occultism.util.ItemNBTUtil;
import com.klikli_dev.occultism.util.TextUtil;
import net.minecraft.core.component.DataComponents;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.enchantment.ItemEnchantments;
import net.minecraft.world.level.Level;
import net.neoforged.neoforge.capabilities.ICapabilityProvider;
import org.jetbrains.annotations.Nullable;
Expand All @@ -46,7 +48,7 @@ public class MinerSpiritItem extends Item {
private final Supplier<Integer> maxDamage;

public MinerSpiritItem(Properties properties, Supplier<Integer> maxMiningTime, Supplier<Integer> rollsPerOperation, Supplier<Integer> maxDamage) {
super(properties);
super(properties.component(DataComponents.ENCHANTMENTS, ItemEnchantments.EMPTY));
this.maxMiningTime = maxMiningTime;
this.rollsPerOperation = rollsPerOperation;
this.maxDamage = maxDamage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ private void addOccultismTags(HolderLookup.Provider provider) {
this.tag(OccultismTags.Items.Miners.MASTER).add(OccultismItems.MINER_MARID_MASTER.get()).replace(false);
this.tag(OccultismTags.Items.Miners.ORES).add(OccultismItems.MINER_FOLIOT_UNSPECIALIZED.get(),
OccultismItems.MINER_DEBUG_UNSPECIALIZED.get(), OccultismItems.MINER_AFRIT_DEEPS.get(), OccultismItems.MINER_MARID_MASTER.get(), OccultismItems.MINER_DJINNI_ORES.get()).replace(false);

this.tag(OccultismTags.Items.Miners.MINERS)
.addTag(OccultismTags.Items.Miners.BASIC_RESOURCES)
.addTag(OccultismTags.Items.Miners.DEEPS)
.addTag(OccultismTags.Items.Miners.MASTER)
.addTag(OccultismTags.Items.Miners.ORES).replace(false);

this.copy(OccultismTags.Blocks.OTHERWORLD_SAPLINGS, OccultismTags.Items.OTHERWORLD_SAPLINGS);
this.tag(OccultismTags.Items.TOOL_KNIVES).add(OccultismItems.BUTCHER_KNIFE.get()).replace(false);
this.tag(OccultismTags.Items.ELYTRA).add(Items.ELYTRA).addOptional(ResourceLocation.fromNamespaceAndPath("mana-and-artifice", "spectral_elytra")).replace(false);
Expand All @@ -78,6 +85,8 @@ private void addMinecraftTags(HolderLookup.Provider provider) {
this.tag(ItemTags.BOOKSHELF_BOOKS).add(OccultismItems.BOOK_OF_CALLING_FOLIOT_TRANSPORT_ITEMS.get());
this.tag(ItemTags.BOOKSHELF_BOOKS).add(OccultismItems.BOOK_OF_BINDING_EMPTY.get());

this.tag(ItemTags.DURABILITY_ENCHANTABLE).addTag(OccultismTags.Items.Miners.MINERS);

this.tag(ItemTags.CLUSTER_MAX_HARVESTABLES).add(OccultismItems.INFUSED_PICKAXE.get(),OccultismItems.IESNIUM_PICKAXE.get()).replace(false);
this.copy(BlockTags.LEAVES,ItemTags.LEAVES);
this.copy(BlockTags.LOGS,ItemTags.LOGS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.*;
import net.minecraft.world.item.component.ItemContainerContents;
import net.minecraft.world.item.enchantment.ItemEnchantments;
import net.neoforged.neoforge.common.DeferredSpawnEggItem;
import net.neoforged.neoforge.registries.DeferredItem;
import net.neoforged.neoforge.registries.DeferredRegister;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ public static class Items {
public static final TagKey<Item> OTHERWORLD_SAPLINGS = makeItemTag(ResourceLocation.fromNamespaceAndPath(Occultism.MODID, "saplings/otherworld"));

public static class Miners {
public static final TagKey<Item> MINERS = makeItemTag(ResourceLocation.fromNamespaceAndPath(Occultism.MODID, "miners"));

public static final TagKey<Item> BASIC_RESOURCES = makeItemTag(ResourceLocation.fromNamespaceAndPath(Occultism.MODID, "miners/basic_resources"));
public static final TagKey<Item> DEEPS = makeItemTag(ResourceLocation.fromNamespaceAndPath(Occultism.MODID, "miners/deeps"));
public static final TagKey<Item> MASTER = makeItemTag(ResourceLocation.fromNamespaceAndPath(Occultism.MODID, "miners/master"));
Expand Down

0 comments on commit 0eae915

Please sign in to comment.