PrismarineJS / prismarine-viewer

Web based viewer for servers and bots
https://prismarinejs.github.io/prismarine-viewer/
MIT License
273 stars 75 forks source link

Stairs not rendering #427

Open mkmark opened 9 months ago

mkmark commented 9 months ago

minimal reproduction sample:

const standaloneViewer = require('prismarine-viewer').standalone;
const { Vec3 } = require('vec3');

(async () => {
  const version = "1.13";
  const World = require('prismarine-world')(version);
  const Chunk = require('prismarine-chunk')(version);

  const world = new World(() => new Chunk())
  const viewer = standaloneViewer({
    version,
    world,
    center: new Vec3(0,0,0),
    port: 3002,
  });
  await world.setBlockStateId(new Vec3(0, 0, 0), 1)
  await world.setBlockStateId(new Vec3(0, 0, 1), 4423)
  await world.setBlockStateId(new Vec3(0, 0, 2), 4424)
  // for (let i=0; i<6000; ++i){
  //   await world.setBlockStateId(new Vec3(Math.floor(i/100), 0, i%100), i);
  // }
  viewer.update();
})()

Only the stone (state id 1) is drawn when running the code. The stairs (4423, 4424) are invisible. This happens to all stairs. Happens to different versions (1.13, 1.19 tested)

4423 should be the state of stone_brick_stairs

Actually, there are more empty textures to be seen if you uncomment the for loop lines (not sure if the state id is continuous though, but they seems so for 1.13).


I am not entirely sure if this is the correct way of drawing stairs. My actual problem is that prismarine-viewer can not render schematics properly, where all stairs are not drawn. This is an attempt to trace the issue. Please help.

zardoy commented 9 months ago

https://github.com/zardoy/prismarine-web-client/commit/6090493bf08310ece0cc861d773a5afc24f008e1

the breakage wasn't intentional. also IMO isAir block property should be used here instead (example: https://github.com/PrismarineJS/minecraft-data/pull/829/files#diff-0d255e355947920697ca68432e2877c7814032af84c682c8281e725b232226fa)

rom1504 commented 9 months ago

please send a PR

also I don't think the ends_with is right either. Just enumerate all the relevant blocks

zardoy commented 9 months ago

This is what i meant by the sentence above. @rom1504 BTW your idea of grouped block fits well here (air blocks) but still has nothing in common with https://github.com/PrismarineJS/node-minecraft-data/pull/335

vniversvs-cw commented 3 months ago

same here.

vniversvs-cw commented 3 months ago

has this been solved?