@@ -66,11 +66,11 @@ public static void setAttributeBase(MCFloat value, String attribute, EntityVar c
66
66
);
67
67
}
68
68
ArrayList <Command > commandList = new ArrayList <>(Arrays .asList (commands ));
69
- var last = commandList .get ( commandList . size () - 1 );
69
+ var last = commandList .getLast ( );
70
70
if (last .isMacro ()){
71
- commandList .remove ( commandList . size () - 1 );
71
+ commandList .removeLast ( );
72
72
commandList .addAll (Arrays .asList (last .buildMacroFunction ()));
73
- returnValue .setValue (new CommandReturn (commandList .get ( commandList . size () - 1 ), "return" ));
73
+ returnValue .setValue (new CommandReturn (commandList .getLast ( ), "return" ));
74
74
}else {
75
75
returnValue .setValue (new CommandReturn (last , "return" ));
76
76
}
@@ -85,11 +85,11 @@ public static void getAttributeBase(String attribute, EntityVar caller, MCFloat
85
85
buildingCommand = buildingCommand .buildMacro (scale , true );
86
86
}
87
87
ArrayList <Command > commands = new ArrayList <>(Arrays .stream (Commands .INSTANCE .runAsEntity (caller , buildingCommand )).toList ());
88
- var last = commands .get ( commands . size () - 1 );
88
+ var last = commands .getLast ( );
89
89
if (last .isMacro ()){
90
- commands .remove ( commands . size () - 1 );
90
+ commands .removeLast ( );
91
91
commands .addAll (Arrays .stream (last .buildMacroFunction ()).toList ());
92
- returnValue .setValue (new CommandReturn (commands .get ( commands . size () - 1 ), "return" ));
92
+ returnValue .setValue (new CommandReturn (commands .getLast ( ), "return" ));
93
93
}else {
94
94
returnValue .setValue (new CommandReturn (last , "return" ));
95
95
}
@@ -104,11 +104,11 @@ public static void getAttribute(String attribute, EntityVar caller, MCFloat scal
104
104
buildingCommand = buildingCommand .buildMacro (scale , true );
105
105
}
106
106
ArrayList <Command > commands = new ArrayList <>(Arrays .stream (Commands .INSTANCE .runAsEntity (caller , buildingCommand )).toList ());
107
- var last = commands .get ( commands . size () - 1 );
107
+ var last = commands .getLast ( );
108
108
if (last .isMacro ()){
109
- commands .remove ( commands . size () - 1 );
109
+ commands .removeLast ( );
110
110
commands .addAll (Arrays .stream (last .buildMacroFunction ()).toList ());
111
- returnValue .setValue (new CommandReturn (commands .get ( commands . size () - 1 ), "return" ));
111
+ returnValue .setValue (new CommandReturn (commands .getLast ( ), "return" ));
112
112
}else {
113
113
returnValue .setValue (new CommandReturn (last , "return" ));
114
114
}
@@ -121,9 +121,8 @@ public static void addAttributeModifier(String attribute, EntityVar caller, Data
121
121
commands = Commands .INSTANCE .runAsEntity (caller ,
122
122
new Command ("return run attribute @s " + AttributeData .attributeMap .get (attribute ) + " modifier add "
123
123
+ modifierC .getValue ().get ("id" , StringTag .class ).getValue () + " "
124
- + modifierC .getValue ().get ("value" , DoubleTag .class ).asDouble () + " "
125
- + modifierC .getValue ().get ("operation" , StringTag .class ).getValue () + " "
126
- + modifierC .getValue ().get ("mode" , StringTag .class ).getValue ())
124
+ + modifierC .getValue ().get ("amount" , DoubleTag .class ).asDouble () + " "
125
+ + modifierC .getValue ().get ("operation" , StringTag .class ).getValue ())
127
126
);
128
127
} else {
129
128
var buildingCommand = new Command ("return run attribute @s " + AttributeData .attributeMap .get (attribute ) + " modifier add" );
@@ -133,7 +132,7 @@ public static void addAttributeModifier(String attribute, EntityVar caller, Data
133
132
}else {
134
133
buildingCommand = buildingCommand .buildMacro (id , true );
135
134
}
136
- var value = modifier .getMemberVar ("value " , Member .AccessModifier .PUBLIC ).getFirst ();
135
+ var value = modifier .getMemberVar ("amount " , Member .AccessModifier .PUBLIC ).getFirst ();
137
136
if (value instanceof MCFloatConcrete valueC ){
138
137
buildingCommand = buildingCommand .build (valueC .getValue ().toString (), true );
139
138
}else {
@@ -145,18 +144,12 @@ public static void addAttributeModifier(String attribute, EntityVar caller, Data
145
144
}else {
146
145
buildingCommand = buildingCommand .buildMacro (operation , true );
147
146
}
148
- var mode = modifier .getMemberVar ("mode" , Member .AccessModifier .PUBLIC ).getFirst ();
149
- if (mode instanceof MCStringConcrete modeC ){
150
- buildingCommand = buildingCommand .build (modeC .getValue ().getValue (), true );
151
- }else {
152
- buildingCommand = buildingCommand .buildMacro (mode , true );
153
- }
154
147
ArrayList <Command > commandArrayList = new ArrayList <>(Arrays .stream (Commands .INSTANCE .runAsEntity (caller , buildingCommand )).toList ());
155
- var last = commandArrayList .get ( commandArrayList . size () - 1 );
148
+ var last = commandArrayList .getLast ( );
156
149
if (last .isMacro ()){
157
- commandArrayList .remove ( commandArrayList . size () - 1 );
150
+ commandArrayList .removeLast ( );
158
151
commandArrayList .addAll (Arrays .stream (last .buildMacroFunction ()).toList ());
159
- returnValue .setValue (new CommandReturn (commandArrayList .get ( commandArrayList . size () - 1 ), "return" ));
152
+ returnValue .setValue (new CommandReturn (commandArrayList .getLast ( ), "return" ));
160
153
}else {
161
154
returnValue .setValue (new CommandReturn (last , "return" ));
162
155
}
@@ -182,11 +175,11 @@ public static void removeAttributeModifier(String attribute, EntityVar caller, D
182
175
buildingCommand = buildingCommand .buildMacro (id , true );
183
176
}
184
177
ArrayList <Command > commandArrayList = new ArrayList <>(Arrays .stream (Commands .INSTANCE .runAsEntity (caller , buildingCommand )).toList ());
185
- var last = commandArrayList .get ( commandArrayList . size () - 1 );
178
+ var last = commandArrayList .getLast ( );
186
179
if (last .isMacro ()){
187
- commandArrayList .remove ( commandArrayList . size () - 1 );
180
+ commandArrayList .removeLast ( );
188
181
commandArrayList .addAll (Arrays .stream (last .buildMacroFunction ()).toList ());
189
- returnValue .setValue (new CommandReturn (commandArrayList .get ( commandArrayList . size () - 1 ), "return" ));
182
+ returnValue .setValue (new CommandReturn (commandArrayList .getLast ( ), "return" ));
190
183
}else {
191
184
returnValue .setValue (new CommandReturn (last , "return" ));
192
185
}
@@ -197,7 +190,6 @@ public static void removeAttributeModifier(String attribute, EntityVar caller, D
197
190
}
198
191
199
192
public static void getAttributeModifier (String attribute , EntityVar caller , DataTemplateObject modifier , MCFloat scale , ValueWrapper <CommandReturn > returnValue ){
200
- Command [] commands ;
201
193
var buildingCommand = new Command ("attribute @s " + AttributeData .attributeMap .get (attribute ) + " modifier value get" );
202
194
var id = modifier .getMemberVar ("id" , Member .AccessModifier .PUBLIC ).getFirst ();
203
195
@@ -218,12 +210,12 @@ public static void getAttributeModifier(String attribute, EntityVar caller, Data
218
210
buildingCommand .prepend ("return run" , true );
219
211
}
220
212
var commandArrayList = new ArrayList <>(Arrays .asList (Commands .INSTANCE .runAsEntity (caller , buildingCommand )));
221
- var last = commandArrayList .get ( commandArrayList . size () - 1 );
213
+ var last = commandArrayList .getLast ( );
222
214
if (last .isMacro ()){
223
- commandArrayList .remove ( commandArrayList . size () - 1 );
215
+ commandArrayList .removeLast ( );
224
216
commandArrayList .addAll (Arrays .stream (last .buildMacroFunction ()).toList ());
225
217
}
226
- returnValue .setValue (new CommandReturn (commandArrayList .get ( commandArrayList . size () - 1 ), "return" ));
218
+ returnValue .setValue (new CommandReturn (commandArrayList .getLast ( ), "return" ));
227
219
Function .Companion .addCommands (commandArrayList .toArray (new Command [0 ]));
228
220
}
229
221
}
0 commit comments