Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
05-24-2013, 05:34 PM
(This post was last modified: 05-24-2013, 05:35 PM by xoft.)
Big change!
I have refactored the cInventory code, it now uses three cItemGrids for the armor, the inventory and the hotbar, respectively. This brings a whole set of API changes, I believe they're for the better, since now the API is more balanced, more orthogonal. And there's a lot of helper functions to make your life easier.
I have changed the internal plugins (Core, Debuggers), but if you have written a plugin that does anything with the inventory, you need to have a look at your code and change it.
I'll be updating the API in the wiki momentarily.
Btw, check out the Debuggers plugin, it has a "/wool" command that sets all your armor to blue wool. And all the other players can see that armor. Coooool!
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
cInventory and cItemGrid API documentation in the wiki is now up to date.
Posts: 1,162
Threads: 68
Joined: Mar 2013
Thanks: 245
Given 125 thank(s) in 100 post(s)
Could you add some class to the API to save inventory on server and then recover it?
It would be useful to make a multi-inventories plugin.
Posts: 4,628
Threads: 115
Joined: Dec 2011
Thanks: 693
Given 494 thank(s) in 423 post(s)
You could use a for loop to save every slot of a player.
Posts: 4,628
Threads: 115
Joined: Dec 2011
Thanks: 693
Given 494 thank(s) in 423 post(s)
isn't this flyspray thread done?
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
05-25-2013, 10:05 PM
(This post was last modified: 05-25-2013, 10:07 PM by xoft.)
Not exactly - it's missing some of the composition components, such as mushroom islands.
I've revisited some of the APIs for block entities, so now it's possible to interact with chests and dispensers by plugins. Have a look at the Debuggers plugin, rclk a dispenser with a redstone torch
Posts: 4,628
Threads: 115
Joined: Dec 2011
Thanks: 693
Given 494 thank(s) in 423 post(s)
05-26-2013, 07:15 AM
(This post was last modified: 05-26-2013, 07:15 AM by NiLSPACE.)
MCServer is so usefull. I now used to rename all the episodes of an anime i am watching I was just too lazy to rename all 500 episodes by myself so i wrote a plugin for it
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
05-26-2013, 06:06 PM
(This post was last modified: 05-26-2013, 06:12 PM by xoft.)
:D
You're becoming a real programmer
You could've used TotalCommander for it, it's the ultimate file manager and mass-renaming is one of its strongpoints.
Posts: 4,628
Threads: 115
Joined: Dec 2011
Thanks: 693
Given 494 thank(s) in 423 post(s)
(05-26-2013, 06:06 PM)xoft Wrote: You could've used TotalCommander for it, it's the ultimate file manager and mass-renaming is one of its strongpoints.
That would have taken the fun out of it
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
05-27-2013, 12:44 AM
(This post was last modified: 05-27-2013, 01:30 AM by xoft.)
I have implemented droppers in rev 1514. They are now fully functional and Lua-accessible. Also, since they share lots of their code with dispensers, I have created a common ancestor class for them, cDropSpenser; which is also Lua-accessible (so Lua plugins may use the same code for dispensers and droppers, if they wish).
The only thing they're missing is that when you put something in them, the chunk is not marked dirty, so it is not saved to disk (unless you modify the chunk otherwise). I'll be doing a more thorough solution for this issue, because I think it's the same with chests.
Chests, dispensers and droppers now correctly mark their chunk as unsaved.
|