Skip to content

Commit

Permalink
Fabric Carpet 1.4.25+ Protocol for rule structureBlockLimit
Browse files Browse the repository at this point in the history
  • Loading branch information
Fallen-Breath committed Feb 18, 2021
1 parent bcd8245 commit 14071f4
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,44 @@
this.mirror = buf.readEnumValue(Mirror.class);
this.rotation = buf.readEnumValue(Rotation.class);
this.field_210399_i = buf.readString(12);
@@ -70,6 +73,21 @@
this.field_210400_j = (i & 1) != 0;
this.field_210401_k = (i & 2) != 0;
this.field_210402_l = (i & 4) != 0;
+
+ // [CM] Fabric Carpet 1.4.25+ Protocol for rule structureBlockLimit
+ if (buf.readableBytes() == 6 * 4)
+ {
+ this.field_210395_e = new BlockPos(
+ MathHelper.clamp(buf.readInt(), -limit, limit),
+ MathHelper.clamp(buf.readInt(), -limit, limit),
+ MathHelper.clamp(buf.readInt(), -limit, limit)
+ );
+ this.size = new BlockPos(
+ MathHelper.clamp(buf.readInt(), 0, limit),
+ MathHelper.clamp(buf.readInt(), 0, limit),
+ MathHelper.clamp(buf.readInt(), 0, limit)
+ );
+ }
}

public void writePacketData(PacketBuffer buf) throws IOException
@@ -107,6 +125,18 @@
}

buf.writeByte(i);
+
+ // [CM] Fabric Carpet 1.4.25+ Protocol for rule structureBlockLimit
+ // client method, only applicable if with carpet is on the server, or running locally
+ if (CarpetSettings.structureBlockLimit >= 128)
+ {
+ buf.writeInt(this.field_210395_e.getX());
+ buf.writeInt(this.field_210395_e.getY());
+ buf.writeInt(this.field_210395_e.getZ());
+ buf.writeInt(this.size.getX());
+ buf.writeInt(this.size.getY());
+ buf.writeInt(this.size.getZ());
+ }
}

public void processPacket(INetHandlerPlayServer handler)
2 changes: 1 addition & 1 deletion src/main/java/carpet/settings/CarpetSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private static class ValidateStructureBlockLimit extends Validator<Integer>
@Override
public Integer validate(CommandSource source, ParsedRule<Integer> currentRule, Integer newValue, String string)
{
return (newValue > 0 && newValue <= 1000) ? newValue : null;
return (newValue > 0 && newValue <= 65536) ? newValue : null;
}
public String description()
{
Expand Down

0 comments on commit 14071f4

Please sign in to comment.