Code Monkey home page Code Monkey logo

Comments (8)

madmaxoft avatar madmaxoft commented on May 5, 2024

Note that Player XP (#143) and Experience orbs (#141) should be implemented first

from cuberite.

NiLSPACE avatar NiLSPACE commented on May 5, 2024

This video says that the text in an enchantment table does not effect the result enchantments. That should make this issue a bit easier.

from cuberite.

madmaxoft avatar madmaxoft commented on May 5, 2024

I remember seeing that information in the official wiki already, quite a long time ago; also, there's nothing in the protocol to actually transmit the texts, only the XP levels are sent: http://wiki.vg/Protocol#Window_Property

from cuberite.

tigerw avatar tigerw commented on May 5, 2024

The text is generated by the client using letters from the Standard Galactic Alphabet (true). The server doesn't need to worry about it.

from cuberite.

madmaxoft avatar madmaxoft commented on May 5, 2024

I'm copying this text here from the forum, slightly updated and re-worded, 'cause I think it might come in handy.

When a player places an item in the enchantment slot, the server initializes a list of enchantments applicable to that specific item type by defaults. Then it asks plugins (by using a hook) to modify the list if they wish to do so.
When the player chooses the enchantment cost, find the (default) enchantments that the server would give the item out of that list, then fire a plugin hook saying user is about to enchant something at a specified cost, letting the plugins to modify the final enchantments.

HOOK_GET_APPLICABLE_ENCHANTMENTS: Called when the player places an item in the enchantment table's slot
Receives arguments:

  • the player
  • the item
  • array-table of cEnchantments, each containing a single allowed enchantment (represented as std::vector in the C++ code); the server initializes this to the default list of enchantments applicable for that item

Return values:

  • continue hook execution (bool) - when true, no more hooks in the chain are called (if not given, false if assumed)
  • array-table of cEnchantments, each containing a single allowed enchantment (if not given, the default list given in the parameter is assumed)
    After the hook returns, the server stores the list of applicable enchantments in the cPlayer object, so that it can retrieve it later, and displays the XP costs, if applicable.

HOOK_ENCHANTING_ITEM: Called when the player chooses the XP cost in the enchantment table's UI
Receives arguments:

  • the player
  • the item
  • the XP cost that the player has chosen
  • single cEnchantments class containing all the enchantments that the item will receive, initialized by the server from the list of applicable enchantments; plugins may directly modify this object

Return values:

  • continue hook execution (bool) - when true, no more hooks in the chain are called (if not given, false if assumed)

from cuberite.

daniel0916 avatar daniel0916 commented on May 5, 2024

I'm currently working on the enchanting table. I also created a thread in the forum.

from cuberite.

bennasar99 avatar bennasar99 commented on May 5, 2024

This needs to be closed,

from cuberite.

madmaxoft avatar madmaxoft commented on May 5, 2024

There's still the issue of hooks for plugins... It'd be a shame for my awesome description to go to waste :P

Daniel promised to refactor the enchanting code a bit more, so it'd be great to wait for him to finish it before doing anything plugin-wise.

from cuberite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.