1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Registering an existing item.

Discussion in 'Development' started by Teamblocket, Dec 26, 2017.

  1. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    Ok so am trying to register an item , the item I'm trying to register is Paper but it already exists so what i want todo is like register BankNote which is paper but with a different name etc.
    I've tried making a class which extends Paper and then using the static method from itemFactory , registerItem() but it doesn't work.
     
  2. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    Use second argument of register item function
     
  3. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    I don’t want to override paper though.
     
  4. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    Just give a renamed paper?
     
  5. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    I can rename the paper but with the BankNote I want to add value to the note and remove value that’s my goal
     
  6. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    And what makes NBT a bad contestant for that?
     
  7. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    I just want the BankNote to have its own class , btw I am using NBT for it.
     
  8. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    Why would you use NBT and a custom name and a custom class? If the item only has additional behaviour there's basically no need for it.
     
  9. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    I would use NBT to store the Banknote value($$$) and a custom name so it doesnt say Paper and a CustomClass because I want to.
     
  10. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    One item ID should only have one set of behaviour. It's not reasonable to register two classes for the same item ID. You might want to override the Paper class and optionally use the banknote value property.
     
  11. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    Well since one item id should only have one set of behavior , how can I correctly override the paper class?
     
  12. Ragnok123

    Ragnok123 Silverfish

    Messages:
    22
    GitHub:
    Ragnok123
    Ofc you can create your custom class extended Item, set values to this new item and them register in item factory.
    But I doesn't see why you should do it.
     
    Sandertv likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.