Double Slabs

Double Slabs

5M Downloads

Crafting Station Compat Error

WenXin20 opened this issue ยท 10 comments

commented

Minecraft v1.15.2
Forge v31.2.5
Double Slabs v2.4.3
Crafting Station v3.1.0

If I right-click a crafting station double slab, my log prints the following error.
Log

commented

Hi, thanks for the issue! I am aware of this as an error and will try my best to fix this. Did the game crash?

commented

No crash, it just didn't open the GUI thankfully.

commented

From looking into this a bit more I'm not too sure how I can fix this on my side. It's not intrinsically due to my mod or the crafting station mod but to how GUIs are handled itself.
Basically to explain what is happening here I'm going to briefly explain how the double / vertical slabs work within my mod to hopefully help explain what the issue is.

When you create a vertical slab or double slab from my mod, it stores the original slabs inside of the block along side any tile entity that the slab may have. To trick the slabs into thinking that they are the only block in the space where the double / vertical slab is (so the tile can get and set the state which will only affect the appropriate half) is by having them inside of a fake world which has all of the regular features of a world, except at the position where the double / vertical slab is, will give the appropriate state and tile entity for that half.

Now, when you right click on one of the double / vertical slabs, it right clicks the appropriate slab, giving that slab the world it thinks it is in (the fake world). This works great for the server side as it can get the tile entity correctly, but to open a GUI, a container and GUI is required. This means a GUI for a tile entity is opened server side which means the client has to know to open the GUI. When the client receives this message, the client uses the world which the player is in, and so when the GUI attempts to get the tile entity at the position it is in, it will give it my tile entity which contains both of the slabs and hence cause the error you experienced. This isn't an issue just for 1.14/1.15. This also happens in the 1.12 dev I'm working on at the moment.

Hopefully that clarifies what the issue is / where it comes from.

Now to the solution:
There is no apparent way to give the slab the correct tile for that half without it knowing that it is part of one of my double / vertical slabs without the client being given more information. Back in 1.12, MCMultiPart experiences the same issue. One solution was for each and every mod that has a tile for a slab, to check whether it is a double / vertical slab from my mod and to try and figure out which half it is on the client which will add a tad bit of complexity. At the moment, all the slabs are unaware of the fact they are not actually physically in the world but inside of my tile entity, which allows me to use them independently.

This is the conundrum I have and I'm not too certain what is the best route to go down, I just wanted to put you in the picture.
Hope that made sense :D

commented

Yeah, that sounds complicated! I was on my server, but that probably doesn't make too much of a difference.

commented

This should hopefully be fixed / improved in the latest update. I have added some support for Crafting Station and Improved Stations to enable their GUIs to open. I do believe there is an issue with Crafting Station at the moment and I'll create a simple PR over there to fix the issue related to my mod (I think it's an easy fix - famous last words) but please let me know if this works for you!

commented

Thanks, I'll check it out!

commented

Welp, my server crashed after right-clicking a vertical double slab block that contained the Crafting Station. :D
Crash Report

commented

I have created a pull request for both Crafting Station and Improved Stations which both have this issue. The issue you faced before should be fixed and now we just have to wait for the other mods to accept the PR and everything should be working. From what I've tested it should work fully now once the PR is approved :)

commented

Nice!

commented

From what I've seen, both PRs have been accepted so I'm going to close this issue now :)