amadornes / MCMultiPart

A universal multipart API for Modern Minecraft
Other
67 stars 23 forks source link

Multipart rotation and recoloring hooks #117

Open asiekierka opened 6 years ago

asiekierka commented 6 years ago

Essentially, IMultipart wrappers for rotateBlock and recolorBlock. (The recolor one could use a built-in way to say "no color", that is remove any color it has; this feels missing in Forge's hook.)

The rotation part is, interestingly, a regression from MCMP1 which allowed for such functionality.

2xsaiko commented 6 years ago

Interesting. I'll work on this after #116 is merged.

2xsaiko commented 6 years ago

There's a problem: I've got no idea how to implement both of them, since those methods don't provide the player as a parameter which is needed for raytracing, so I can get the part that I need to rotate/color.

EDIT: Hmm, I could make a custom packet that gets sent when the client clicks on the multipart block for each of those actions, that could work

asiekierka commented 6 years ago

Well, in Charset I solved it by writing a wrench which explicitly handled multiparts.

Not forwarding rotateBlock might actually be wise, as doing this could sometimes change the IPartSlot which would probably require a far deeper refactor? Not sure. It's almost 1AM here.

2xsaiko commented 6 years ago

I don't think it would be that hard to change the IPartSlot. Now what I would need to test it is a mod where that is actually the case. Otherwise I guess I'll have to make a small mod myself that adds such blocks

EDIT: Actually, I forgot that rotateBlock rotates the block without checking anything (for example collision), so you're right that it will require a lot of changes. I'll see what I can come up with

EDIT: There is actually already a way to rotate parts, I think: TileMultipartContainer.java#438 Not sure how useful it is, though

asiekierka commented 6 years ago

Not sure how useful it is, though

It assumes the Y axis.