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

1.14-1.16.4: tall grass is fire, need per-version block states #467

Closed
iceiix opened this issue Jan 10, 2021 · 2 comments · Fixed by #468
Closed

1.14-1.16.4: tall grass is fire, need per-version block states #467

iceiix opened this issue Jan 10, 2021 · 2 comments · Fixed by #468
Labels
bug Something isn't working

Comments

@iceiix
Copy link
Owner

iceiix commented Jan 10, 2021

Connecting to a 1.14 or later server (tested on 1.16.4), the tall grass (as opposed to the grass block) is shown as fire:

Screen Shot 2021-01-10 at 3 03 32 PM

Here's how it looks officially:

Screen Shot 2021-01-10 at 3 04 32 PM

with the "targeted block" = minecraft:grass. This is misinterpreted as fire, due to block state shifts in the 1.14 updates after the 1.13 Flattening.

Noted in #453

in blocks/src/lib.rs:

    TallGrass {
        props {
            variant: TallGrassVariant = [
                TallGrassVariant::DeadBush,
                TallGrassVariant::TallGrass,
                TallGrassVariant::Fern
            ],
        },
        data Some(variant.data()),
        material material::NON_SOLID,
        model { ("minecraft", variant.as_string() ) },
        tint TintType::Grass,
        collision vec![],
    }

https://minecraft.gamepedia.com/Grass
https://wiki.vg/Chunk_Format#Full_chunk

Block states:
https://wiki.vg/Data_Generators#Blocks_report
https://github.com/PrismarineJS/minecraft-data/blob/master/data/pc/1.13/blocks.json#L2936

  {
    "id": 94,
    "displayName": "Grass",
    "name": "grass",
    "hardness": 0,
    "minStateId": 1041,
    "maxStateId": 1041,
    "states": [],
    "drops": [
      76
    ],
    "diggable": true,
    "transparent": false,
    "filterLight": 15,
    "emitLight": 0,
    "boundingBox": "empty",
    "stackSize": 64,
    "material": "plant",
    "defaultState": 1041
  },
@iceiix iceiix added the bug Something isn't working label Jan 10, 2021
@iceiix
Copy link
Owner Author

iceiix commented Jan 10, 2021

1041 block state = TallGrass { variant: DeadBush } hierarchical 31:0 offset=0
1042 block state = TallGrass { variant: TallGrass } hierarchical 31:1 offset=1
1043 block state = TallGrass { variant: Fern } hierarchical 31:2 offset=2

vs https://github.com/PrismarineJS/minecraft-data/blob/master/data/pc/1.13/blocks.json#L2936

  • "displayName": "Grass", "minStateId": 1041,
  • "displayName": "Fern", "minStateId": 1042,
  • "displayName": "Dead Bush", "minStateId": 1043,

all these block states need to be double-checked...

From #468 (comment):

The block states are not stable between versions. Consider the "fern":

1.13: 1042 https://github.com/PrismarineJS/minecraft-data/blob/master/data/pc/1.13/blocks.json#L2961
1.14.4: 1342 https://github.com/PrismarineJS/minecraft-data/blob/master/data/pc/1.14.4/blocks.json#L2993
1.15.2: 1342 https://github.com/PrismarineJS/minecraft-data/blob/master/data/pc/1.15.2/blocks.json#L2993
1.16.2: 1343 https://github.com/PrismarineJS/minecraft-data/blob/master/data/pc/1.16.2/blocks.json#L2993

blocks/src/lib.rs does not hardcode the block state IDs, but generates them sequentially based on the offset function. If new states are added, they will shift other states forward. This will needed to be accounted for on a per-version basis, such maybe by adding a tag for "minimum supported protocol version" for each block and/or block state, and generating the states when connecting to a server of a given version.

so the fire issue was introduced with the 1042 -> 1342 block state shift

@iceiix iceiix mentioned this issue Jan 10, 2021
@iceiix iceiix changed the title 1.13-1.16.4: tall grass is fire 1.14-1.16.4: tall grass is fire Jan 10, 2021
@iceiix iceiix changed the title 1.14-1.16.4: tall grass is fire 1.14-1.16.4: tall grass is fire, need per-version block states Jan 11, 2021
@iceiix iceiix reopened this Jan 11, 2021
@iceiix
Copy link
Owner Author

iceiix commented Jan 11, 2021

Block changes according to https://github.com/PrismarineJS/minecraft-data:

./0.30c/blocks.json
./1.7/blocks.json
./1.8/blocks.json
./1.9/blocks.json
./1.10/blocks.json
./1.11/blocks.json
./1.12/blocks.json

./1.13/blocks.json
./1.13.2/blocks.json
./1.14.4/blocks.json
./1.15.2/blocks.json
./1.16.1/blocks.json
./1.16.2/blocks.json

a quick and dirty script to compare block state ranges:

#!/usr/local/bin/python3
import json

versions=('1.13','1.13.2','1.14.4','1.15.2','1.16.1','1.16.2')
block2versions={}
for v in versions:
    blocks=json.load(open('data/pc/'+v+'/blocks.json'))
    for block in blocks:
        #block['id']
        #print(v,block['displayName'], block['minStateId'], block['maxStateId'])
        name=block['displayName']
        if name not in block2versions: block2versions[name] = {}
        block2versions[name][v] = range(block['minStateId'], block['maxStateId'])

print('\t'.join(['name']+list(versions)))
for name in sorted(block2versions.keys()):
    s=name+'\t'
    prev_range=None
    for v in versions:
        if v in block2versions[name]:
            #s+=str(block2versions[name][v])
            r=block2versions[name][v]
            s+='%d-%d'%(r.start,r.stop)
            if r!=prev_range and prev_range is not None:s+='**'
            prev_range=block2versions[name][v]
        else:
            s+='(N/A)'
        s+='\t'
    print(s)

output: https://gist.github.com/iceiix/784c0a4b129a5a4494829c81c707705c
769 lines total
only including changed ranges compared to previous versions: 458

name	1.13	1.13.2	1.14.4	1.15.2	1.16.1	1.16.2
Acacia Door     7869-7932       7870-7933**     8394-8457**     8394-8457       8930-8993**     8934-8997**     
Acacia Fence    7613-7644       7614-7645**     8138-8169**     8138-8169       8674-8705**     8678-8709**     
Acacia Fence Gate       7453-7484       7454-7485**     7978-8009**     7978-8009       8514-8545**     8518-8549**     
Acacia Leaves   200-213 200-213 200-213 200-213 201-214**       201-214 
Acacia Log      84-86   84-86   84-86   84-86   85-87** 85-87   
Acacia Pressure Plate   3375-3376       3376-3377**     3879-3880**     3879-3880       3881-3882**     3881-3882       
Acacia Sign     (N/A)   (N/A)   (N/A)   3475-3506       3477-3508**     3477-3508       
Acacia Slab     7281-7286       7282-7287**     7788-7793**     7788-7793       8324-8329**     8328-8333**     
Acacia Stairs   6332-6411       6333-6412**     6839-6918**     6839-6918       7375-7454**     7379-7458**     
Acacia Trapdoor 3849-3912       3850-3913**     4353-4416**     4353-4416       4367-4430**     4367-4430       
Acacia Wall Sign        (N/A)   (N/A)   (N/A)   3757-3764       3759-3766**     3759-3766       
Acacia Wood     120-122 120-122 120-122 120-122 121-123**       121-123 

and that's only the beginning, full changed list: https://gist.github.com/iceiix/69e39eefebbdc8968ac8a1a555fd0cac, many frequent changes

First step to get this right, verify all of 1.13, programmatically
CLI option to dump all steven_blocks block states, for easy comparison?

@iceiix iceiix closed this as completed in 8ca12a6 Jan 14, 2021
iceiix added a commit that referenced this issue Jan 21, 2021
iceiix added a commit that referenced this issue Jan 21, 2021
* blocks: fix soul fire/soil, exclude from <1.13, fixing #489 

* blocks: add unit tests for #467 #469 #474
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant