File tree 1 file changed +10
-1
lines changed
common/src/main/java/dev/ftb/mods/ftbranks/impl/condition
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import dev .ftb .mods .ftblibrary .snbt .SNBTCompoundTag ;
4
4
import dev .ftb .mods .ftbranks .api .RankCondition ;
5
+ import net .minecraft .core .Registry ;
5
6
import net .minecraft .resources .ResourceLocation ;
6
7
import net .minecraft .server .level .ServerPlayer ;
7
8
import net .minecraft .stats .Stat ;
8
9
import net .minecraft .stats .Stats ;
9
10
11
+ import java .util .NoSuchElementException ;
12
+
10
13
/**
11
14
* @author LatvianModder
12
15
*/
@@ -25,7 +28,13 @@ public class StatCondition implements RankCondition {
25
28
26
29
public StatCondition (SNBTCompoundTag tag ) {
27
30
statId = new ResourceLocation (tag .getString ("stat" ));
28
- stat = Stats .CUSTOM .get (statId );
31
+ stat = Registry .CUSTOM_STAT .getOptional (statId )
32
+ .map (Stats .CUSTOM ::get )
33
+ .orElseThrow (
34
+ () -> new NoSuchElementException (
35
+ String .format ("%s does not match any known stat" , statId )
36
+ )
37
+ );
29
38
value = tag .getInt ("value" );
30
39
31
40
switch (tag .getString ("value_check" )) {
You can’t perform that action at this time.
0 commit comments