Added blockstate data support for furnaces.#479
Added blockstate data support for furnaces.#479PseudoKnight merged 5 commits intoEngineHub:masterfrom
Conversation
Furnaces will now have a "burntime", "cooktime" and "inventory" metadata tag. "inventory" is an array with 3 possible keys: "result", "fuel" and "smelting". This commit prevents set_pinv(pinv()) to erase furnace metadata and adds the ability to get/modify it.
|
If we add this, we might as well add all inventory blocks. Furnace seems an odd first choice. I never once pick-blocked a furnace. https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/Container.html |
|
On my redstone server, furnaces are used as variable signal strength input to comparators. As soon as they are moved in a players inventory using CommandHelper, they lose their data. |
The now supported containers are: BrewingStand, Chest, Dispenser, Dropper and Hopper.
|
Added support for other containers as well, tested this for chests, hoppers and droppers. |
Fixup for the previous 2 commits.
Brewing stands only had support for fuel and ingredient meta, this adds support for the 3 remaining bottle slots.
Due to these objects being wrapped into a BukkitMCItemStack, they are never null. So check for empty item stacks instead.
|
I tested it on some local servers and everything seems to be working as one would expect on 1.12.2 and 1.8.8. BlockStateMeta didn't exist in 1.7.10 and Brewing Stands BlockStateMeta was fixed in 1.11 but doesn't seem to cause any problems prior to that. I did notice that you followed my pattern of only including slots that existed in shulker boxes. However, with named keys I wonder if this is still appropriate. (eg. furnaces and brewing stands) I think it might make more sense to include the keys but set them to null in those cases. I could even be convinced to have all keys in containers be set to null too. I think I was concerned with rapidly ballooning inventory arrays with the introduction of shulker boxes. See, normally in the meta we include the key if it exists for that item meta. (eg. "display" always exists because all item meta supports it... book "title" always exists but only for books even if a title doesn't exist) What do you think? |
|
@PseudoKnight Good to hear that it works on previous versions too. Regarding always creating indices, I actually prefer an Since we're talking about metadata anyways, I would very much prefer method |
|
I've seen people use unused keys before, so I'm not sure how I feel about that. It'll also have an overhead. In any case, I think this is good to go. |
Furnaces will now have a "burntime", "cooktime" and "inventory" metadata tag. "inventory" is an array with 3 possible keys: "result", "fuel" and "smelting".
This PR prevents set_pinv(pinv()) to erase furnace metadata and adds the ability to get/modify it.