Asleeepp / skript-itemsadder

GNU General Public License v3.0
7 stars 1 forks source link

Replacing furniture that is more than 1x1x1 size results in buggy behaviour. #4

Closed MaliWhiteTea closed 5 months ago

MaliWhiteTea commented 6 months ago

hi,

how can i use the "replace ia furniture" effect? what should i use for location? i want to change the furniture at the same location image

and dou you have a discord account?

MaliWhiteTea commented 6 months ago

i tried this: image it was weird if you try to replace a furniture bigger than 1x1x1 hitbox like this: image and its rotation is changing

Asleeepp commented 6 months ago

hi,

how can i use the "replace ia furniture" effect? what should i use for location? i want to change the furniture at the same location

The location should be at where the invisible armor stand is (iirc). I didn't make this effect, someone opened a pull request and requested to add it. In their video, but it seemed like the effect worked fine for them. For why it rotates, I have no idea. You may need to specify yaw and pitch.

and dou you have a discord account?

Yes, my username on discord is Asleepp

(sorry for the late response, for some reason github didn't notify me.)

Fusezion commented 5 months ago

Sorry if this seems weird, but from what I understand from the CustomFurniture#replaceFurniture method it's not intended to be treated like "replace existing furniture" it's meant to be used to replace/change an existing furniture to another furniture the fact the rotation isn't the same makes sense as you likely aren't using the same yaw/pitch the previous furniture was using. In addition to the original place point of it

Hopefully this helps a bit in "solving" the month long issue of yours

Asleeepp commented 5 months ago

The thing is, is that in the code that he uses, wherever he clicks, the furniture moves there. So if he clicks in the middle, it replaces in the middle, but if he clicks a barrier in the bottom right, the furniture moves to the bottom right. This is the part i'm trying to figure out how to prevent really.

if theres a really easy way to prevent this, then uh. I haven't thought of it lmao.

Fusezion commented 5 months ago

So as I said it's directly controlled by yaw/pitch along side the click location, if he didn't originally click in either of those locations it makes sense as to why it's not placing in the same location. You personally have no method or way to change this behavior unless you can store the origin location onto the armor stand and update the placement from there.

While there is a method like CustomFurnature#getArmorStand() and CustomFurnature#getEntity() I can't tell if any of them represent the origin location