satoshinm / WebSandboxMC

Bukkit plugin providing a web-based interface with an interactive WebGL 3D preview or glimpse of your server 🕷⏳📦 ⛺
https://www.spigotmc.org/resources/websandboxmc.39415/
MIT License
19 stars 5 forks source link

Signs not saving with valid data (Glowstone bug) #91

Closed satoshinm closed 3 years ago

satoshinm commented 7 years ago

When typing a sign in the web client with backquote, then reconnecting, it doesn't appear. Existing signs seem to load ok, but not creating new signs.

Maybe a bug from https://github.com/satoshinm/WebSandboxMC/pull/86 or more likely https://github.com/satoshinm/WebSandboxMC/issues/66 https://github.com/satoshinm/WebSandboxMC/commit/d1a62a1a586977b8b1c4ba78136cb571955a2d4f - but I thought this works, perhaps not

satoshinm commented 7 years ago

Actually, maybe they do work but are popping off? I was testing by placing signs on glowstone, which is not allowed by physics.

satoshinm commented 7 years ago

Works on sandstone, this is a problem not informing the client that the sign "popped off". Listen for a physics event?

satoshinm commented 7 years ago

Not only glowstone, also having trouble setting signs on dirt on the server at spawn. No errors in logs.

satoshinm commented 7 years ago

This occurs in my local test world looking at (7, 85, -4), placing on web side 1 results in invalid signage data:

20:48:38 [INFO] [WebSandboxMC] New web client joined: webguest1 (anonymous) from 0:0:0:0:0:0:0:1:55504
20:48:55 [WARNING] [WebSandboxMC] Invalid sign face at Location{world=GlowWorld(name=world),x=8.0,y=85.0,z=-5.0,pitch=0.0,yaw=0.0}
20:49:05 [INFO] [dynmap] Loading default resource pack
20:49:42 [WARNING] [WebSandboxMC] Invalid sign face at Location{world=GlowWorld(name=world),x=8.0,y=85.0,z=-4.0,pitch=0.0,yaw=0.0}

This may be a Glowstone bug, occurs on 544, but ought to investigate


Occurs reliably writing on EAST side of block:

21:49:33 [INFO] [WebSandboxMC] new sign: 23,46,13 face=1, text=east 21:49:33 [INFO] [WebSandboxMC] setting sign at Location{world=GlowWorld(name=world),x=8.0,y=85.0,z=-3.0,pitch=0.0,yaw=0.0} blockFace=EAST 21:49:33 [INFO] [WebSandboxMC] set sign text=east, signDirection=SIGN_POST(12) facing EAST, blockFace=EAST, block=GlowBlock{chunk=GlowChunk{world=world,x=0,z=-1},x=8,y=85,z=-3,type=WALL_SIGN,data=12}, face=1 21:49:33 [INFO] clientNewSign about to call notifySignChange at Location{world=GlowWorld(name=world),x=8.0,y=85.0,z=-3.0,pitch=0.0,yaw=0.0} 21:49:33 [INFO] [WebSandboxMC] Invalid sign face at Location{world=GlowWorld(name=world),x=8.0,y=85.0,z=-3.0,pitch=0.0,yaw=0.0} 21:49:33 [INFO] [WebSandboxMC] sign change: Location{world=GlowWorld(name=world),x=8.0,y=85.0,z=-3.0,pitch=0.0,yaw=0.0}, blockFace=null

12 = 0xC = Glowkit-Patched/src/main/java/org/bukkit/material/Sign.java:

            case 0xC:
                return BlockFace.EAST;

this switch is in if (!isWallSign()), which is return getItemType() == Material.WALL_SIGN. Otherwise, getAttachedFace() is used and this may return null (or would previously NPE).


Adding logging, when the sign is first set, the material is SIGN_POST not WALL_SIGN:

22:00:30 [INFO] [WebSandboxMC] setting sign at Location{world=GlowWorld(name=world),x=1.0,y=80.0,z=0.0,pitch=0.0,yaw=0.0} blockFace=EAST
22:00:30 [INFO] getFacing with data=12
22:00:30 [INFO] isWallSign?
22:00:30 [INFO] getItemType = SIGN_POST
22:00:30 [INFO] isWallSign = false
22:00:30 [INFO] [WebSandboxMC] set sign text=east, signDirection=SIGN_POST(12) facing EAST, blockFace=EAST, block=GlowBlock{chunk=GlowChunk{world=world,x=0,z=0},x=1,y=80,z=0,type=WALL_SIGN,data=12}, face=1
22:00:30 [INFO] clientNewSign about to call notifySignChange at Location{world=GlowWorld(name=world),x=1.0,y=80.0,z=0.0,pitch=0.0,yaw=0.0}
22:00:30 [INFO] getFacing with data=12
22:00:30 [INFO] isWallSign?
22:00:30 [INFO] getItemType = WALL_SIGN
22:00:30 [INFO] isWallSign = true
22:00:30 [INFO] isWallSign?
22:00:30 [INFO] getItemType = WALL_SIGN
22:00:30 [INFO] isWallSign = true
22:00:30 [INFO] [WebSandboxMC] Invalid sign face at Location{world=GlowWorld(name=world),x=1.0,y=80.0,z=0.0,pitch=0.0,yaw=0.0}
22:00:30 [INFO] [WebSandboxMC] sign change: Location{world=GlowWorld(name=world),x=1.0,y=80.0,z=0.0,pitch=0.0,yaw=0.0}, blockFace=null

even though I call in BlockBridge clientNewSign:

        BlockState blockState = block.getState();
        blockState.setType(Material.WALL_SIGN); // not SIGN_POST!
        blockState.setData(signDirection);
        boolean force = true;
        boolean applyPhysics = false;
        blockState.update(force, applyPhysics);
        webSocketServerThread.log(Level.FINEST, "setting sign at "+location+" blockFace="+blockFace);

        // Set the sign text
        blockState = block.getState();
satoshinm commented 7 years ago

Testing on Spigot 1.12 it works fine, web clients placed signs have the correct data and show up. Wrote a test plugin and tracked it down to Glowstone: https://github.com/GlowstoneMC/Glowstone/issues/496

satoshinm commented 3 years ago

Closing per https://github.com/GlowstoneMC/Glowstone/issues/496#issuecomment-359223281