Skip to content

Commit 14071f4

Browse files
committed
Fabric Carpet 1.4.25+ Protocol for rule structureBlockLimit
1 parent bcd8245 commit 14071f4

2 files changed

Lines changed: 42 additions & 1 deletion

File tree

patches/net/minecraft/network/play/client/CPacketUpdateStructureBlock.java.patch

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,44 @@
2121
this.mirror = buf.readEnumValue(Mirror.class);
2222
this.rotation = buf.readEnumValue(Rotation.class);
2323
this.field_210399_i = buf.readString(12);
24+
@@ -70,6 +73,21 @@
25+
this.field_210400_j = (i & 1) != 0;
26+
this.field_210401_k = (i & 2) != 0;
27+
this.field_210402_l = (i & 4) != 0;
28+
+
29+
+ // [CM] Fabric Carpet 1.4.25+ Protocol for rule structureBlockLimit
30+
+ if (buf.readableBytes() == 6 * 4)
31+
+ {
32+
+ this.field_210395_e = new BlockPos(
33+
+ MathHelper.clamp(buf.readInt(), -limit, limit),
34+
+ MathHelper.clamp(buf.readInt(), -limit, limit),
35+
+ MathHelper.clamp(buf.readInt(), -limit, limit)
36+
+ );
37+
+ this.size = new BlockPos(
38+
+ MathHelper.clamp(buf.readInt(), 0, limit),
39+
+ MathHelper.clamp(buf.readInt(), 0, limit),
40+
+ MathHelper.clamp(buf.readInt(), 0, limit)
41+
+ );
42+
+ }
43+
}
44+
45+
public void writePacketData(PacketBuffer buf) throws IOException
46+
@@ -107,6 +125,18 @@
47+
}
48+
49+
buf.writeByte(i);
50+
+
51+
+ // [CM] Fabric Carpet 1.4.25+ Protocol for rule structureBlockLimit
52+
+ // client method, only applicable if with carpet is on the server, or running locally
53+
+ if (CarpetSettings.structureBlockLimit >= 128)
54+
+ {
55+
+ buf.writeInt(this.field_210395_e.getX());
56+
+ buf.writeInt(this.field_210395_e.getY());
57+
+ buf.writeInt(this.field_210395_e.getZ());
58+
+ buf.writeInt(this.size.getX());
59+
+ buf.writeInt(this.size.getY());
60+
+ buf.writeInt(this.size.getZ());
61+
+ }
62+
}
63+
64+
public void processPacket(INetHandlerPlayServer handler)

src/main/java/carpet/settings/CarpetSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ private static class ValidateStructureBlockLimit extends Validator<Integer>
177177
@Override
178178
public Integer validate(CommandSource source, ParsedRule<Integer> currentRule, Integer newValue, String string)
179179
{
180-
return (newValue > 0 && newValue <= 1000) ? newValue : null;
180+
return (newValue > 0 && newValue <= 65536) ? newValue : null;
181181
}
182182
public String description()
183183
{

0 commit comments

Comments
 (0)