Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement BlockData for blocks [$140] #28

Closed
mastercoms opened this issue Sep 22, 2019 · 8 comments
Closed

Implement BlockData for blocks [$140] #28

mastercoms opened this issue Sep 22, 2019 · 8 comments
Labels
api API implementation for Bukkit bounty data A feature involving internal representations of blocks, items, properties, and more. essential A feature that must be implemented for 1.13 base support. server An internal technical feature.

Comments

@mastercoms
Copy link
Member

mastercoms commented Sep 22, 2019

This issue is part of the 1.13.x compatibility Epic.

All contributions are subject to the Glowstone CLA. In short, contributions must not contain any content (code or otherwise) copied from,
inspired by or based upon content from Mojang or third-party projects that are based on such content (CraftBukkit, Spigot, Forge, ...).


Description:

BlockData needs to be used in block functionality, and its properties/API must be implemented. This will require a registry for BlockData so that states are properly applied with the relevant BlockData properties.

Reference Documentation:

Related to:

#10


There is a $140 open bounty on this issue. Add to the bounty at Bountysource.

@mastercoms mastercoms added api API implementation for Bukkit data A feature involving internal representations of blocks, items, properties, and more. essential A feature that must be implemented for 1.13 base support. server An internal technical feature. labels Sep 22, 2019
@mastercoms mastercoms mentioned this issue Sep 22, 2019
4 tasks
@mastercoms mastercoms mentioned this issue Sep 22, 2019
8 tasks
@mastercoms mastercoms changed the title Implement BlockData for blocks Implement BlockData for blocks [$140] Sep 24, 2019
@Silver-Wulf
Copy link

For implementing the BlockData API, is it intended to use the interfaces present in Glowkit or should each of the interfaces be reimplemented in Glowstone?

@mastercoms
Copy link
Member Author

We should be implementing the Glowkit interfaces within Glowstone.

@smartboyathome
Copy link

I'm going to assume that we're going to replace net.glowstone.block.data.BlockData with org.bukkit.block.data.BlockData, and implement all relevant interaces?

@mastercoms
Copy link
Member Author

That class is just playing around with a way to store block data in Glowstone. The actual implementation is in net.glowstone.block.flattening.GlowBlockData.

@smartboyathome
Copy link

smartboyathome commented Jan 19, 2020

Should we rename that class then in order to avoid confusion? The Glowstone BlockData interface, I mean.

@mastercoms
Copy link
Member Author

Sure, that sounds good!

@smartboyathome
Copy link

So, here's what I've learned so far:

The block data are going to need to be fetched from the vanilla server using the tool implemented in #5. The data is going to be stored in ./generated/reports/blocks.json. The schema of this file is as follows (written in the JSON schema format):

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$id": "https://glowstone.net/schemas/generated-block-report.schema.json",
    "title": "Generated Block Report",
    "description": "The root of a generated block report generated by the vanilla server.",
    "type": "object",
    "patternProperties": {
        "^minecraft:[a-z_]+$": {
            "description": "An individual block entity's block data schema and block ID mappings.",
            "type": "object",
            "minProperties": 0,
            "properties": {
                "properties": {
                    "description": "Contains all valid block data state property names and values.",
                    "type": "object",
                    "minProperties": 1,
                    "patternProperties": {
                        "^[a-z]+$": {
                            "description": "A property name with all possible values.",
                            "type": "array",
                            "minItems": 1,
                            "uniqueItems": true,
                            "items": {
                                "description": "An individual value that is valid for this specific block entity's block data.",
                                "type": "string",
                                "minLength": 1
                            }
                        }
                    }
                },
                "states": {
                    "description": "Contains every possible valid permutation of the defined properties' values, mapped to a block ID.",
                    "type": "array",
                    "minItems": 1,
                    "uniqueItems": true,
                    "items": {
                        "description": "An individual permutation of the defined properties' values, mapped to a block ID.",
                        "type": "object",
                        "required": ["id"],
                        "properties": {
                            "properties": {
                                "description": "An individual permutation of the defined properties' values.",
                                "type": "object",
                                "minProperties": 0,
                                "patternProperties": {
                                    "^[a-z]+$": {
                                        "description": "A property name and one of its associated values.",
                                        "type": "string",
                                        "minLength": 1
                                    }
                                }
                            },
                            "id": {
                                "description": "The block ID of this specific permutation as it travels over the network between client and server.",
                                "type": "integer",
                                "minimum": 0
                            },
                            "default": {
                                "description": "Whether this is the default state for the minecraft block entity when none is specified.",
                                "type": "boolean"
                            }
                        }
                    }
                }
            }
        }
    }
}

In plain English, the file contains each vanilla block entity, along with each property and its associated values, and a unique permutation of all these properties' values for each value mapped to a unique block ID.

For now, as part of this work, I'm going to assume that the data has been retrieved and saved into ./generated. I'll read in this file and generate the appropriate mappings. All properties not defined within this mapping will be considered custom tags. All tags will be represented in NBT format when they are asked for as a string.

@smartboyathome
Copy link

This is done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api API implementation for Bukkit bounty data A feature involving internal representations of blocks, items, properties, and more. essential A feature that must be implemented for 1.13 base support. server An internal technical feature.
Projects
None yet
Development

No branches or pull requests

3 participants