falkreon / Scarves

Comfortable dynamic simulated cloth trinkets
MIT License
9 stars 0 forks source link

Bookbanning With Scarves #6

Open sylv256 opened 1 year ago

sylv256 commented 1 year ago

Description

Unfortunately, it is currently possible to bookban someone via scarves. Is there some way to counteract this?

sylv256 commented 1 year ago

We could probably do this by simplifying repetitive scarf patterns in the NBT, both for new and existing scarves.

falkreon commented 1 year ago

While bookbanning itself wouldn't normally get classified as a bug, this issue hilights the fact that there must be a bug in the source.

https://github.com/falkreon/Scarves/blob/1.19/src/main/java/blue/endless/scarves/ScarfStaplerBlockEntity.java#L94-L103

This is the indicated code. It shouldn't really be possible to get into bookban territory given that scarves have a maximum length, and the id strings in question aren't really complex enough to shove us into bookban territory either. Something is going wrong with this length restriction and it does not always work. But I have yet to figure out how or why this code is failing to limit things properly within a margin of error of 1 square.

In the future, I can see the possibility of a scarf being a "series of runs of squares" instead of a "series of squares". So instead of NBT like

FabricSquares: [{square}, {square}, {square}, {square}]

(encoding a scarf of length 4)

we'd see NBT like

FabricSquares: [ { Run: [ {square}, {square}, {square}], Count: 12} ]

(encoding a scarf of length of 36)

with concatenated scarves simply adding their runs to the end of the list of runs, folding into an added Count if possible. This would work extremely well with the upcoming Serger too.

But these are two different issues, and the issue at hand, right now, is the length limit bug.

sylv256 commented 1 year ago

i used commands to get custom colors and the scarf was too long

sylv256 commented 1 year ago

I'll do some testing to make sure I'm not just a crazed sylveon.

sylv256 commented 1 year ago

I'll do some testing to make sure I'm not just a crazed sylveon.

i think I already am, but that's getting off-topic