Comments (8)
Note that Player XP (#143) and Experience orbs (#141) should be implemented first
from cuberite.
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.
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.
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.
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.
I'm currently working on the enchanting table. I also created a thread in the forum.
from cuberite.
This needs to be closed,
from cuberite.
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)
- 内存回收的问题
- 是否有计划的添加基岩版协议的支持?【Are there plans to add support for the Bedrock Edition protocol?】 HOT 4
- Shift-clicking within a cLuaWindow does not resend player inventory if the OnClicked callback calls CloseWindow HOT 1
- If the player picks up armor while within a chest GUI, the armor won't be rendered
- Feature request: Lua hooks for clicks in the player inventory
- Can't craft a boat in client 1.8.9
- 无法下载服务端 HOT 1
- Players Become Invisible after Teleportation
- Add ARMel builds
- [Building] What's the first GCC version which supports C++17? HOT 1
- Mining bedrock with packetmine drops bedrock. HOT 4
- How offline players join the server HOT 1
- cRoot:ForEachPlayer does not report players that haven't been spawned yet HOT 2
- tnt无法设置为none
- Crash on startup (Segmentation fault) on OpenWRT mips HOT 7
- PPC64 server seems to be unable to handle player XYZ? HOT 2
- Website download page windows does not work HOT 2
- Taking damage on TP HOT 4
- Download Is Unavailable
- One question
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cuberite.