1818import net .minecraft .client .multiplayer .ClientSuggestionProvider ;
1919import net .minecraft .client .player .LocalPlayer ;
2020import net .minecraft .network .chat .Component ;
21+ import net .minecraft .server .permissions .PermissionSet ;
2122import net .minecraft .world .entity .Entity ;
2223import net .minecraft .world .phys .Vec2 ;
2324import net .minecraft .world .phys .Vec3 ;
25+ import org .jspecify .annotations .Nullable ;
2426
2527import java .util .HashMap ;
2628import java .util .Map ;
@@ -36,8 +38,8 @@ public class CustomClientCommandSource extends ClientSuggestionProvider implemen
3638 private final ClientLevel world ;
3739 private final Map <String , Object > meta ;
3840
39- public CustomClientCommandSource (ClientPacketListener listener , Minecraft minecraft , Entity entity , Vec3 position , Vec2 rotation , ClientLevel world , Map <String , Object > meta ) {
40- super (listener , minecraft , true );
41+ public CustomClientCommandSource (ClientPacketListener listener , Minecraft minecraft , Entity entity , Vec3 position , Vec2 rotation , ClientLevel world , PermissionSet permissionSet , Map <String , Object > meta ) {
42+ super (listener , minecraft , permissionSet );
4143
4244 this .client = minecraft ;
4345 this .entity = entity ;
@@ -51,7 +53,7 @@ public static CustomClientCommandSource of(FabricClientCommandSource source) {
5153 if (source instanceof CustomClientCommandSource custom ) {
5254 return custom ;
5355 }
54- return new CustomClientCommandSource (source .getClient ().getConnection (), source .getClient (), source .getEntity (), source .getPosition (), source .getRotation (), source .getWorld (), new HashMap <>());
56+ return new CustomClientCommandSource (source .getClient ().getConnection (), source .getClient (), source .getEntity (), source .getPosition (), source .getRotation (), source .getWorld (), source . permissions (), new HashMap <>());
5557 }
5658
5759 @ Override
@@ -96,24 +98,24 @@ public ClientLevel getWorld() {
9698 }
9799
98100 @ Override
99- public Object getMeta (String key ) {
101+ public @ Nullable Object getMeta (String key ) {
100102 return this .meta .get (key );
101103 }
102104
103105 public CustomClientCommandSource withEntity (Entity entity ) {
104- return new CustomClientCommandSource (this .client .getConnection (), this .client , entity , this .position , this .rotation , this .world , this .meta );
106+ return new CustomClientCommandSource (this .client .getConnection (), this .client , entity , this .position , this .rotation , this .world , this .permissions (), this . meta );
105107 }
106108
107109 public CustomClientCommandSource withPosition (Vec3 position ) {
108- return new CustomClientCommandSource (this .client .getConnection (), this .client , this .entity , position , this .rotation , this .world , this .meta );
110+ return new CustomClientCommandSource (this .client .getConnection (), this .client , this .entity , position , this .rotation , this .world , this .permissions (), this . meta );
109111 }
110112
111113 public CustomClientCommandSource withRotation (Vec2 rotation ) {
112- return new CustomClientCommandSource (this .client .getConnection (), this .client , this .entity , this .position , rotation , this .world , this .meta );
114+ return new CustomClientCommandSource (this .client .getConnection (), this .client , this .entity , this .position , rotation , this .world , this .permissions (), this . meta );
113115 }
114116
115117 public CustomClientCommandSource withWorld (ClientLevel world ) {
116- return new CustomClientCommandSource (this .client .getConnection (), this .client , this .entity , this .position , this .rotation , world , this .meta );
118+ return new CustomClientCommandSource (this .client .getConnection (), this .client , this .entity , this .position , this .rotation , world , this .permissions (), this . meta );
117119 }
118120
119121 public CustomClientCommandSource withMeta (String key , Object value ) {
@@ -148,7 +150,7 @@ public int getDimension() throws CommandSyntaxException {
148150 if (dimensionMeta != null ) {
149151 return (int ) dimensionMeta ;
150152 }
151- return DimensionArgument .dimension ().parse (new StringReader (this .getWorld ().dimension ().location ().getPath ()));
153+ return DimensionArgument .dimension ().parse (new StringReader (this .getWorld ().dimension ().identifier ().getPath ()));
152154 }
153155
154156 public int getVersion () throws CommandSyntaxException {
0 commit comments