1616import net .minecraft .client .multiplayer .ClientSuggestionProvider ;
1717import net .minecraft .client .player .LocalPlayer ;
1818import net .minecraft .network .chat .Component ;
19+ import net .minecraft .server .permissions .PermissionSet ;
1920import net .minecraft .world .entity .Entity ;
2021import net .minecraft .world .phys .Vec2 ;
2122import net .minecraft .world .phys .Vec3 ;
23+ import org .jspecify .annotations .Nullable ;
2224
2325import java .util .HashMap ;
2426import java .util .Map ;
@@ -34,8 +36,8 @@ public class CustomClientCommandSource extends ClientSuggestionProvider implemen
3436 private final ClientLevel world ;
3537 private final Map <String , Object > meta ;
3638
37- public CustomClientCommandSource (ClientPacketListener listener , Minecraft minecraft , Entity entity , Vec3 position , Vec2 rotation , ClientLevel world , Map <String , Object > meta ) {
38- super (listener , minecraft , true );
39+ public CustomClientCommandSource (ClientPacketListener listener , Minecraft minecraft , Entity entity , Vec3 position , Vec2 rotation , ClientLevel world , PermissionSet permissionSet , Map <String , Object > meta ) {
40+ super (listener , minecraft , permissionSet );
3941
4042 this .client = minecraft ;
4143 this .entity = entity ;
@@ -49,7 +51,7 @@ public static CustomClientCommandSource of(FabricClientCommandSource source) {
4951 if (source instanceof CustomClientCommandSource custom ) {
5052 return custom ;
5153 }
52- return new CustomClientCommandSource (source .getClient ().getConnection (), source .getClient (), source .getEntity (), source .getPosition (), source .getRotation (), source .getWorld (), new HashMap <>());
54+ return new CustomClientCommandSource (source .getClient ().getConnection (), source .getClient (), source .getEntity (), source .getPosition (), source .getRotation (), source .getWorld (), source . permissions (), new HashMap <>());
5355 }
5456
5557 @ Override
@@ -94,24 +96,24 @@ public ClientLevel getWorld() {
9496 }
9597
9698 @ Override
97- public Object getMeta (String key ) {
99+ public @ Nullable Object getMeta (String key ) {
98100 return this .meta .get (key );
99101 }
100102
101103 public CustomClientCommandSource withEntity (Entity entity ) {
102- return new CustomClientCommandSource (this .client .getConnection (), this .client , entity , this .position , this .rotation , this .world , this .meta );
104+ return new CustomClientCommandSource (this .client .getConnection (), this .client , entity , this .position , this .rotation , this .world , this .permissions (), this . meta );
103105 }
104106
105107 public CustomClientCommandSource withPosition (Vec3 position ) {
106- return new CustomClientCommandSource (this .client .getConnection (), this .client , this .entity , position , this .rotation , this .world , this .meta );
108+ return new CustomClientCommandSource (this .client .getConnection (), this .client , this .entity , position , this .rotation , this .world , this .permissions (), this . meta );
107109 }
108110
109111 public CustomClientCommandSource withRotation (Vec2 rotation ) {
110- return new CustomClientCommandSource (this .client .getConnection (), this .client , this .entity , this .position , rotation , this .world , this .meta );
112+ return new CustomClientCommandSource (this .client .getConnection (), this .client , this .entity , this .position , rotation , this .world , this .permissions (), this . meta );
111113 }
112114
113115 public CustomClientCommandSource withWorld (ClientLevel world ) {
114- return new CustomClientCommandSource (this .client .getConnection (), this .client , this .entity , this .position , this .rotation , world , this .meta );
116+ return new CustomClientCommandSource (this .client .getConnection (), this .client , this .entity , this .position , this .rotation , world , this .permissions (), this . meta );
115117 }
116118
117119 public CustomClientCommandSource withMeta (String key , Object value ) {
@@ -146,7 +148,7 @@ public int getDimension() throws CommandSyntaxException {
146148 if (dimensionMeta != null ) {
147149 return (int ) dimensionMeta ;
148150 }
149- return DimensionArgument .dimension ().parse (new StringReader (this .getWorld ().dimension ().location ().getPath ()));
151+ return DimensionArgument .dimension ().parse (new StringReader (this .getWorld ().dimension ().identifier ().getPath ()));
150152 }
151153
152154 public int getVersion () throws CommandSyntaxException {
0 commit comments