austinv11 / PeripheralsPlusPlus

A pseudo-port of miscperipherals, with other stuff as well!
GNU General Public License v2.0
25 stars 28 forks source link

No way to supply a chat label while keeping range at max #149

Closed juniorjunior closed 8 years ago

juniorjunior commented 8 years ago

In order to specify a label on a message (when enabled in the config) one must supply all the other arguments. There is no way to specify a range which maintains "max/unlimited". I propose changing the line in TileEntityChatBox.java checking if the range parameter exists:

if (arguments.length > 2)

with

if ((arguments.length > 2) && ((Double)arguments[2] != Config.sayRange))

or something similar.

darichey commented 8 years ago

I'm not positive and I can't test right now but you should be able to pass -1 for infinite range.

juniorjunior commented 8 years ago

It looks to me (in the source) that with these lines:

double range = Config.sayRange < 0 ? Double.MAX_VALUE : Config.sayRange; if (arguments.length > 2) range = (Double) arguments[2];

It happily sets whatever range you provide in the argument. In ChatUtil.java it seems as though (if unlimitedY is true) it checks to see if the target player's range is greater than the provided range and skips that iteration: if (playerPos.distanceTo(Vec3.createVectorHelper(te.xCoord, te.yCoord, te.zCoord)) > range) continue;

In theory, you could just put some ridiculously large number in there for range, but I tried that and even with a range of 100 billion it doesn't reach other dimensions.

On a side note, my fix doesn't work. Fail on my part. I instead tweaked ChatUtil.java and it works as expected.