- Building Minecraft Server Modifications
- Cody M. Sommer
- 306字
- 2021-08-04 10:09:51
Introduction to APIs
API is an acronym for Application Programming Interface. An API helps to control how various software components are used. As mentioned in the previous chapter, CraftBukkit includes the Minecraft code in a form that is easier for developers to utilize in creating plugins. CraftBukkit has a lot of code that we do not need to access for creating plugins. It also includes code that we should not use as it could cause the server to become unstable. Bukkit provides us with the classes that we can use to properly modify the game. Basically, Bukkit acts as a bridge between our plugin and the CraftBukkit server. The Bukkit team adds new classes, methods, and so on, to the API as new features develop in Minecraft, but the preexisting code rarely changes. This ensures that our Bukkit plugins will still function correctly months or even years from now. Even though new versions of Minecraft/CraftBukkit are being released. For example, if Minecraft were to change how an entity's health is handled, we would notice no difference.
The CraftBukkit jar would account for this change and when our plugin calls the getHealth()
method it would function exactly as it had before the update. Another example of how great the Bukkit API is would be the addition of new Minecraft features, such as new items. Let's say that we've created a plugin that gives food an expiration date. To see if an item is food we'd use the isEdible()
method. Minecraft continues to create new items. If one of these new items was Pumpkin Bread, CraftBukkit would flag that type of item as edible and would therefore be given an expiration date by our plugin. A year from now, any new food items would still be given expiration dates without us needing to change any of our code.
- Google Flutter Mobile Development Quick Start Guide
- 國際大學(xué)生程序設(shè)計(jì)競賽中山大學(xué)內(nèi)部選拔真題解(二)
- 名師講壇:Java微服務(wù)架構(gòu)實(shí)戰(zhàn)(SpringBoot+SpringCloud+Docker+RabbitMQ)
- 量化金融R語言高級教程
- Go并發(fā)編程實(shí)戰(zhàn)
- 網(wǎng)站構(gòu)建技術(shù)
- 精通Linux(第2版)
- MATLAB 2020從入門到精通
- Hands-On Robotics Programming with C++
- Visual C++從入門到精通(第2版)
- Node.js實(shí)戰(zhàn):分布式系統(tǒng)中的后端服務(wù)開發(fā)
- Visual C#(學(xué)習(xí)筆記)
- 循序漸進(jìn)Vue.js 3前端開發(fā)實(shí)戰(zhàn)
- Go語言編程之旅:一起用Go做項(xiàng)目
- Python深度學(xué)習(xí):基于PyTorch