Fixed MsgNewSpellPatternAck trying to read non-existent data from buffer, and CastingEnvironment assertVecInRange/EntityInRange having conditions inverted.

This commit is contained in:
Talia-12 2023-04-02 14:47:27 +10:00
parent fa8d109403
commit 9d0c828b4f
2 changed files with 2 additions and 5 deletions

View file

@ -122,7 +122,7 @@ public abstract class CastingEnvironment {
*/
public final void assertVecInRange(Vec3 vec) throws MishapLocationTooFarAway {
this.assertVecInWorld(vec);
if (this.isVecInRange(vec)) {
if (!this.isVecInRange(vec)) {
throw new MishapLocationTooFarAway(vec, "too_far");
}
}
@ -143,7 +143,7 @@ public abstract class CastingEnvironment {
if (!this.isVecInWorld(e.position())) {
throw new MishapEntityTooFarAway(e);
}
if (this.isVecInRange(e.position())) {
if (!this.isVecInRange(e.position())) {
throw new MishapEntityTooFarAway(e);
}
}

View file

@ -32,11 +32,8 @@ public record MsgNewSpellPatternAck(ExecutionClientView info, int index) impleme
var index = buf.readInt();
var stack = buf.readList(FriendlyByteBuf::readNbt);
var parens = buf.readList(FriendlyByteBuf::readNbt);
var raven = buf.readOptional(FriendlyByteBuf::readNbt).orElse(null);
var parenCount = buf.readVarInt();
return new MsgNewSpellPatternAck(
new ExecutionClientView(isStackEmpty, resolutionType, stack, raven), index
);