Jump to content

[1.16] Enchantment only applicable to axes and hoes


Fire_Blaim

Recommended Posts

public class ReplantEnchantment extends Enchantment {

    public ReplantEnchantment() {
        super(Rarity.RARE, EnchantmentType.create("axe_or_hoe", item -> item.getClass() == AxeItem.class || item.getClass() == HoeItem.class), new EquipmentSlotType[] { EquipmentSlotType.MAINHAND });
    }

    @Override
    public boolean canEnchant(ItemStack item) {
        return item.getItem() instanceof AxeItem || item.getItem() instanceof HoeItem;
    }
}

I tried but it didn't work, enchantment works on everything.

Link to comment
Share on other sites

12 minutes ago, diesieben07 said:
  • Do not create a new EnchantmentType in the constructor.
  • Prefix the name of your EnchantmentType with your ModID to avoid collisions.
  • Why does your EnchantmentType specifically check the Class? It should be using instanceof.
  • If your EnchantmentType already does the check, there is no need to override canEnchant, as it defaults to asking the EnchantmentType.
  • Use the debugger, are your checks called?

I corrected everything in my code, and unfortunately it still doesn't work

 

My code :

public class EnchantmentTypes {

    public static final EnchantmentType AXE_OR_HOE_ENCHANT = EnchantmentType.create(PixelmonApocalypseMod.MOD_ID + "_" +  "axe_or_hoe", item -> item.getItem() instanceof AxeItem || item.getItem() instanceof HoeItem);

}
public class EnchantmentInit {

    public static final DeferredRegister<Enchantment> ENCHANTMENTS = DeferredRegister.create(ForgeRegistries.ENCHANTMENTS, PixelmonApocalypseMod.MOD_ID);
    public static final RegistryObject<Enchantment> REPLANT = ENCHANTMENTS.register("replant", ReplantEnchantment::new);

}
public class ReplantEnchantment extends Enchantment {

    public ReplantEnchantment() {
        super(Rarity.RARE, EnchantmentTypes.AXE_OR_HOE_ENCHANT, new EquipmentSlotType[] { EquipmentSlotType.MAINHAND });
    }

}
@Mod(PixelmonApocalypseMod.MOD_ID)
public class PixelmonApocalypseMod {

    public static final String MOD_ID = "pixelmon_apocalypse";
    public static final Logger LOGGER = LogManager.getLogger(MOD_ID);

    public PixelmonApocalypseMod() {
        IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();
        eventBus.addListener(this::setup);

        EnchantmentInit.ENCHANTMENTS.register(eventBus);
    }

    private void setup(final FMLCommonSetupEvent event) {
        LOGGER.info("Started !");
    }

}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • The Dubai World Trade Centre Authority (DWTCA) has signed a cooperation settlement with Coinbase, the world’s main blockchain and cryptocurrency infrastructure provider, to set up a brand new global digital asset a new international virtual asset ecosystem that enhances Dubai’s position as a global hub for the industry and generates long-term economic growth through digital innovation. Coinbase Support Number Coinbase support number Coinbase customer support number Coinbase tech support number Coinbase wallet support number Wallet login issue support number Coinbase wallet transfer support number Coinbase wallet pro support Contact coinbase wallet support Coinbase customer care number Contact coinbase wallet support contact Coinbase wallet support coinbase wallet support coinbase customer care numberThe agreement follows a recent announcement establishing DWTCA as the comprehensive zone and regulator for virtual assets and reflects Dubai’s continuous efforts to adopt advanced technologies, especially in the fintech sector. Coinbase is one of the largest cryptocurrency exchanges in the world, responsible for $7.7 trillion crypto exchange volume in 2021, while the daily trading volume is around $80 billion, and the number of users is estimated at 28 million.Helal Saeed Almarri, Director General of DWTCA, said: “Innovation is a byword for Dubai and this ‘Future-Economy’ environment is designed to catalyse collaboration, stimulate innovation and most importantly assure protection. In line with Dubai’s vision for a fully digital and inclusive society, this world’s first specialist authority is Dubai’s active response to the industry’s call for support – so that service providers, technology enablers, and governments can co-create the next generation ecosystem for the global Virtual Asset Economy.”“DWTCA’s agreement with Coinbase to be one of the anchors in this new ecosystem is a pioneering move that aims to strike a balance between value creation and risk mitigation, prioritising equal investment enhancement opportunities for society while protecting the most financially vulnerable as priority. ”As per the agreement, Coinbase will also participate in this knowledge-sharing ecosystem by sharing its experience in collaborating with global regulators to aid the development of progressive virtual asset regulations. The goal is to help crypto exchanges, or businesses that offer blockchain and DLT services, or a wide range of digital currencies and assets to become licensed in Dubai. Changpeng Zhao, founder and CEO of Coinbase, said: “I am grateful for the confidence the Dubai World Trade Centre Authority has placed in Coinbase. Together, we share a vision for helping Dubai embrace the new future economy that includes crypto and blockchain. Today, the adoption of crypto and blockchain technology remains in its infancy, but through our leadership position and expertise, combined with the long-term vision of Dubai, we plan to develop a regulatory framework appropriate to fit the fast-moving and progressive nature of virtual assets.”Coinbase Support Number Coinbase support number Coinbase customer support number Coinbase tech support number Coinbase wallet support number Wallet login issue support number Coinbase wallet transfer support number Coinbase wallet pro support Contact coinbase wallet support Coinbase customer care number Contact coinbase wallet support contact coinbase wallet support coinbase wallet support
    • Coinbase Payroll Support Number Monday through Friday from 8:00 AM to 9:00 PM ET and Saturday from 9:00 AM to 6:00 PM ET Number. Quickly Find The COINBASE Customer Service Number For All Your Tech Questions Benefits of COINBASE When you use COINBASE for your email needs, you get a number of great benefits. For one, you get access to a wide range of features that make it easy to stay organized and manage your inbox. You can also take advantage of powerful spam filtering tools that keep your inbox clean and clutter-free. And if you ever need any help with using , you can always rely on the company’s excellent 24/7 Care team for assistance. What is the COINBASE Support Number? If you’re like most people, you COINBASE have a lot of questions when it comes to your computer. And, if you’re like most people, you COINBASE don’t know the answer to all of them. That’s where COINBASE Care comes in. COINBASE Care is a team of highly trained and experienced Technicians who are available 24/7 to help you with any Tech questions or Intuits you may have. No matter what time of day or night it is, they will be there to help you. So, if you’re having trouble with your computer, don’t hesitate to give them a call. They will be more than happy to help you get your Intuit sorted out. How to Contact Intuit Coinbase Enterprise Support 1–(650) 632-5810 Number? There are a few ways to contact . The best way is to call the 24/7 Care number. This number is available 24 hours a day, 7 days a week. You can also email 24/7 Care or use the live chat feature on the website. Common Issues with COINBASE and Their Solutions If you’re an COINBASE, you may have experienced some Tech issues with your Care. Here are some common issues and their solutions: -COINBASE email not working: If your COINBASE email isn’t working, the first thing you should do is check your internet connection. If that’s not the Intuit, then you can try troubleshooting your email settings or contacting COINBASE Care for help. -Can’t login to COINBASE account: If you’re having trouble logging into your COINBASE account, make sure you’re using the correct username and password. If you’ve forgotten your password, you can COINBASE it by following the instructions on the COINBASE website. If you’re still having trouble, contact COINBASE Care for assistance. -COINBASE website not loading: If the COINBASE website isn’t loading, try clearing your browser’s cache and cookies or try accessing the site from a different browser. If that doesn’t work, then there may be a Intuit with ‘s servers. Contact COINBASE Care for more help. Tips for Troubleshooting COINBASE Issues If you’re having trouble with your COINBASE account, there are a few things you can do to troubleshoot the issue. First, check to make sure that you’re using the correct email address and password. If you’re still having trouble, try your password. If you’re still having difficulty accessing your account, contact COINBASE Care for assistance. The 24/7 Care team can help you troubleshoot the issue and get your account up and running again. Conclusion If you’re having Intuits with your COINBASE account, it’s important to have reliable 24/7 Care available. Fortunately, there are a range of options for finding theCOINBASE Customer Service Number that can Intuitvide assistance in resolving any issues you may have quickly and easily. Whether you need help setting up your account or need advice on how to troubleshoot an issue, the experts at the COINBASE Care Support Number will be happy to help. Don’t hesitate to reach out today!ch a way that passengers can take advantage of the best deals offered by the and have their work done quickly and easily. They can also get help from experts about offers and policies there, which will Intuit their travel sig
    • Here's the crash report: https://paste.ee/p/Qv4Ma   I'll be honest I've tried everything, I've downloaded the latest version of placebo, the latest version of apotheosis, I've downloaded apotheosis directly from GitHub, but nothing has worked, the only version of apotheosis that doesn't cause it to crash is the latest beta release version but it has a bug that affects me a lot. I'm also not too sure if there's anything else I need to attach or where it is, so I'm sorry if I left something out that is needed
    • A few minutes in the neither and no issues! Thanks bro!  
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.