minecraft-data icon indicating copy to clipboard operation
minecraft-data copied to clipboard

Propose blocks extended data

Open zardoy opened this issue 7 months ago • 8 comments

I was trying to extract all interaction shapes I needed with a quick parse script on js and also decided to do the same for other blocks data from 1.20.2 code. I'll try to rewrite setup with burger for reliability & automatization for all versions, but the data will include:

  • name
  • noOcclusion=true on some blocks (essentials for p viewer)
  • lightLevel (actually can already be extracted with burger) (essentials for p viewer)
  • isAir=true
  • isLiquid=true
  • isReplacable=true (essential for flying squid)
  • color - RGB color of block (I want it most, to be honestly)
  • instrument for noteblock

These additional data may be large, should they be merged with blocks.json? Is this is good direction overall?

zardoy avatar Jan 09 '24 01:01 zardoy

im not really familiar with burger and honestly don't understand how it works Blocks.java code. I think the most reliable way would be to use https://github.com/PrismarineJS/minecraft-data-generator-server and then extract things like color map or interaction shape based on different block states

zardoy avatar Jan 09 '24 01:01 zardoy

This sounds like data that should be in Minecraft assets, not Minecraft-data

extremeheat avatar Jan 09 '24 01:01 extremeheat

https://github.com/PrismarineJS/minecraft-data-generator-server we are trying to use that in preference yeah

It should definitely be in the per version folder and be extracted for many versions

I think it might fit here since it's pretty small and sounds quite transformed?

Minecraft assets is mostly image files + a little bit of mapping data

rom1504 avatar Jan 09 '24 07:01 rom1504

Yeah, I meant that some of these options are specific to the block state/renderer (light level, no occlusion), so I think it could make sense just putting inside mcassets block_states.json where prismarine-viewer is already reading from.

The rest I agree could just be put into blocks.json.

extremeheat avatar Jan 09 '24 16:01 extremeheat

https://github.com/PrismarineJS/minecraft-data-generator-server we are trying to use that in preference yeah

It should definitely be in the per version folder and be extracted for many versions

I think it might fit here since it's pretty small and sounds quite transformed?

Minecraft assets is mostly image files + a little bit of mapping data

I can make a PR for the versions the extractor supports and see how it goes.

wgaylord avatar Jan 09 '24 19:01 wgaylord

I can make a PR for the versions the extractor supports and see how it goes.

I would highly appreciate it. I also had soundType field with another mapping and I forgot to add it, but it's also in block properties.

zardoy avatar Jan 09 '24 19:01 zardoy

  • name
  • noOcclusion=true on some blocks (essentials for p viewer)
  • lightLevel (actually can already be extracted with burger) (essentials for p viewer)
  • isAir=true
  • isLiquid=true
  • isReplacable=true (essential for flying squid)
  • color - RGB color of block (I want it most, to be honestly)
  • instrument for noteblock

Okay, so we already have block name already noOcculsion depends on the world apparently (can't just check if a block has Occlusion or not without passing in world and position) lightlevel we have this labeled as emitLight isAir easy isLiquid easy although that function is deprecated. isReplaceable easy color Not sure what this is for? Since color would depend directly on what texture pack your using. instrument - Easy

wgaylord avatar Jan 09 '24 22:01 wgaylord

noOcculsion depends on the world apparently (can't just check if a block has Occlusion or not without passing in world and position)

probably I'm missing something about it. why do you need a position? It's just a block property:

public BlockBehaviour.Properties noOcclusion() {
     this.canOcclude = false;
     return this;
  }

lightlevel we have this labeled as emitLight

Indeed, sorry I forgot it

isLiquid easy although that function is deprecated

Hm, I don't remember how i was going to use (and even don't understand how the client uses it since bubbling columns is also liquid), probably useless, however I think that fluids similar to water can be added at some point so it can be useful in future.

color Not sure what this is for? Since color would depend directly on what texture pack your using

Yes I forgot to explain how to get it. Basically, it's just a mapColor which is the same whichever texturepack you use. I want to use it for maps without textures (like minimap) or any other cases where you can't use texture rendering. Map colors are defined in way like this:

public static final MapColor NONE = new MapColor(0, 0);
public static final MapColor GRASS = new MapColor(1, 8368696); // id, color

for example here is the map for all colors of 1.20.2:

Details
{
  "none": [
    0,
    0
  ],
  "grass": [
    1,
    8368696,
    "rgb(127, 178, 56)"
  ],
  "sand": [
    2,
    16247203,
    "rgb(247, 233, 163)"
  ],
  "wool": [
    3,
    13092807,
    "rgb(199, 199, 199)"
  ],
  "fire": [
    4,
    16711680,
    "rgb(255, 0, 0)"
  ],
  "ice": [
    5,
    10526975,
    "rgb(160, 160, 255)"
  ],
  "metal": [
    6,
    10987431,
    "rgb(167, 167, 167)"
  ],
  "plant": [
    7,
    31744,
    "rgb(0, 124, 0)"
  ],
  "snow": [
    8,
    16777215,
    "rgb(255, 255, 255)"
  ],
  "clay": [
    9,
    10791096,
    "rgb(164, 168, 184)"
  ],
  "dirt": [
    10,
    9923917,
    "rgb(151, 109, 77)"
  ],
  "stone": [
    11,
    7368816,
    "rgb(112, 112, 112)"
  ],
  "water": [
    12,
    4210943,
    "rgb(64, 64, 255)"
  ],
  "wood": [
    13,
    9402184,
    "rgb(143, 119, 72)"
  ],
  "quartz": [
    14,
    16776437,
    "rgb(255, 252, 245)"
  ],
  "color_orange": [
    15,
    14188339,
    "rgb(216, 127, 51)"
  ],
  "color_magenta": [
    16,
    11685080,
    "rgb(178, 76, 216)"
  ],
  "color_light_blue": [
    17,
    6724056,
    "rgb(102, 153, 216)"
  ],
  "color_yellow": [
    18,
    15066419,
    "rgb(229, 229, 51)"
  ],
  "color_light_green": [
    19,
    8375321,
    "rgb(127, 204, 25)"
  ],
  "color_pink": [
    20,
    15892389,
    "rgb(242, 127, 165)"
  ],
  "color_gray": [
    21,
    5000268,
    "rgb(76, 76, 76)"
  ],
  "color_light_gray": [
    22,
    10066329,
    "rgb(153, 153, 153)"
  ],
  "color_cyan": [
    23,
    5013401,
    "rgb(76, 127, 153)"
  ],
  "color_purple": [
    24,
    8339378,
    "rgb(127, 63, 178)"
  ],
  "color_blue": [
    25,
    3361970,
    "rgb(51, 76, 178)"
  ],
  "color_brown": [
    26,
    6704179,
    "rgb(102, 76, 51)"
  ],
  "color_green": [
    27,
    6717235,
    "rgb(102, 127, 51)"
  ],
  "color_red": [
    28,
    10040115,
    "rgb(153, 51, 51)"
  ],
  "color_black": [
    29,
    1644825,
    "rgb(25, 25, 25)"
  ],
  "gold": [
    30,
    16445005,
    "rgb(250, 238, 77)"
  ],
  "diamond": [
    31,
    6085589,
    "rgb(92, 219, 213)"
  ],
  "lapis": [
    32,
    4882687,
    "rgb(74, 128, 255)"
  ],
  "emerald": [
    33,
    55610,
    "rgb(0, 217, 58)"
  ],
  "podzol": [
    34,
    8476209,
    "rgb(129, 86, 49)"
  ],
  "nether": [
    35,
    7340544,
    "rgb(112, 2, 0)"
  ],
  "terracotta_white": [
    36,
    13742497,
    "rgb(209, 177, 161)"
  ],
  "terracotta_orange": [
    37,
    10441252,
    "rgb(159, 82, 36)"
  ],
  "terracotta_magenta": [
    38,
    9787244,
    "rgb(149, 87, 108)"
  ],
  "terracotta_light_blue": [
    39,
    7367818,
    "rgb(112, 108, 138)"
  ],
  "terracotta_yellow": [
    40,
    12223780,
    "rgb(186, 133, 36)"
  ],
  "terracotta_light_green": [
    41,
    6780213,
    "rgb(103, 117, 53)"
  ],
  "terracotta_pink": [
    42,
    10505550,
    "rgb(160, 77, 78)"
  ],
  "terracotta_gray": [
    43,
    3746083,
    "rgb(57, 41, 35)"
  ],
  "terracotta_light_gray": [
    44,
    8874850,
    "rgb(135, 107, 98)"
  ],
  "terracotta_cyan": [
    45,
    5725276,
    "rgb(87, 92, 92)"
  ],
  "terracotta_purple": [
    46,
    8014168,
    "rgb(122, 73, 88)"
  ],
  "terracotta_blue": [
    47,
    4996700,
    "rgb(76, 62, 92)"
  ],
  "terracotta_brown": [
    48,
    4993571,
    "rgb(76, 50, 35)"
  ],
  "terracotta_green": [
    49,
    5001770,
    "rgb(76, 82, 42)"
  ],
  "terracotta_red": [
    50,
    9321518,
    "rgb(142, 60, 46)"
  ],
  "terracotta_black": [
    51,
    2430480,
    "rgb(37, 22, 16)"
  ],
  "crimson_nylium": [
    52,
    12398641,
    "rgb(189, 48, 49)"
  ],
  "crimson_stem": [
    53,
    9715553,
    "rgb(148, 63, 97)"
  ],
  "crimson_hyphae": [
    54,
    6035741,
    "rgb(92, 25, 29)"
  ],
  "warped_nylium": [
    55,
    1474182,
    "rgb(22, 126, 134)"
  ],
  "warped_stem": [
    56,
    3837580,
    "rgb(58, 142, 140)"
  ],
  "warped_hyphae": [
    57,
    5647422,
    "rgb(86, 44, 62)"
  ],
  "warped_wart_block": [
    58,
    1356933,
    "rgb(20, 180, 133)"
  ],
  "deepslate": [
    59,
    6579300,
    "rgb(100, 100, 100)"
  ],
  "raw_iron": [
    60,
    14200723,
    "rgb(216, 175, 147)"
  ],
  "glow_lichen": [
    61,
    8365974,
    "rgb(127, 167, 150)"
  ]
}

Also, I'm looking at whether it is possible to add more fields from block properties. Things like pushReaction and isRedstoneConductor would be useful for flying squid at some point:

this.lightEmission = var4.lightEmission.applyAsInt(this.asState());
this.useShapeForLightOcclusion = var1.useShapeForLightOcclusion(this.asState());
this.isAir = var4.isAir;
this.ignitedByLava = var4.ignitedByLava;
this.liquid = var4.liquid;
this.pushReaction = var4.pushReaction;
this.mapColor = var4.mapColor.apply(this.asState());
this.destroySpeed = var4.destroyTime;
this.requiresCorrectToolForDrops = var4.requiresCorrectToolForDrops;
this.canOcclude = var4.canOcclude;
this.isRedstoneConductor = var4.isRedstoneConductor;
this.isSuffocating = var4.isSuffocating;
this.isViewBlocking = var4.isViewBlocking;
this.hasPostProcess = var4.hasPostProcess;
this.emissiveRendering = var4.emissiveRendering;
this.offsetFunction = var4.offsetFunction;
this.spawnTerrainParticles = var4.spawnTerrainParticles;
this.instrument = var4.instrument;
this.replaceable = var4.replaceable;

zardoy avatar Jan 09 '24 23:01 zardoy