Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.17]Creating Custom Rarity


ocome
 Share

Recommended Posts

Based on this Minecraft rarity, I'm going to create my own rarity.

 

Rarity.java

package net.minecraft.world.item;

import net.minecraft.ChatFormatting;

public enum Rarity implements net.minecraftforge.common.IExtensibleEnum {
   COMMON(ChatFormatting.WHITE),
   UNCOMMON(ChatFormatting.YELLOW),
   RARE(ChatFormatting.AQUA),
   EPIC(ChatFormatting.LIGHT_PURPLE);

   public final ChatFormatting color;

   private Rarity(ChatFormatting p_43028_) {
      this.color = p_43028_;
   }

   public static Rarity create(String name, ChatFormatting p_43028_) {
      throw new IllegalStateException("Enum not extended");
   }
}

 

However, after creating it, when I tried to give it to the item, it came up with a problem

NijiRarity.java

package com.ocome.nijisanjiworld.item.tool;

import net.minecraft.ChatFormatting;
import net.minecraftforge.common.IExtensibleEnum;

public enum NijiRarity implements IExtensibleEnum {
    COMMON(ChatFormatting.AQUA),
    UNCOMMON(ChatFormatting.YELLOW),
    RARE(ChatFormatting.AQUA),
    EPIC(ChatFormatting.LIGHT_PURPLE);

    public final ChatFormatting color;

    private NijiRarity(ChatFormatting p_43028_) {
        this.color = p_43028_;
    }

    public static NijiRarity create(String name, ChatFormatting p_43028_) {
        throw new IllegalStateException("Enum not extended");
    }
}

 

The problem is.

Error: Incompatible type: Cannot convert NijiRarity to Rarity:

This is it.

Why is it not applicable?

 

public class Item_Custom_Pickaxe extends PickaxeItem {
    public Item_Custom_Pickaxe() {
        super(NijiTiers.OCOME, 1, -2.4F, new Properties().tab(OcomeNiji.OCOMEMOD_TAB).rarity(NijiRarity.EPIC));
      											  =======Error======
    }
}

I added it this way with a pickaxe.

please help me :(

 

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
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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.