|
11 | 11 | import java.util.function.Predicate;
|
12 | 12 |
|
13 | 13 | public class DimensionFilter {
|
14 |
| - private static WildcardedRLMatcher dimensionMatcherB = null; |
15 |
| - private static WildcardedRLMatcher dimensionMatcherW = null; |
| 14 | + private static WildcardedRLMatcher rtpDimensionMatcherB = null; |
| 15 | + private static WildcardedRLMatcher rtpDimensionMatcherW = null; |
16 | 16 |
|
17 |
| - public static boolean isDimensionOK(ResourceKey<Level> levelKey) { |
| 17 | + private static WildcardedRLMatcher allDimensionMatcherBTo = null; |
| 18 | + private static WildcardedRLMatcher allDimensionMatcherBFrom = null; |
| 19 | + |
| 20 | + public static boolean isRtpDimensionOK(ResourceKey<Level> levelKey) { |
| 21 | + ResourceLocation name = levelKey.location(); |
| 22 | + return !getRtpDimensionBlacklist().test(name) && (getRtpDimensionWhitelist().isEmpty() || getRtpDimensionWhitelist().test(name)); |
| 23 | + } |
| 24 | + |
| 25 | + public static boolean isDimensionOKFrom(ResourceKey<Level> levelKey) { |
18 | 26 | ResourceLocation name = levelKey.location();
|
19 |
| - return !getDimensionBlacklist().test(name) && (getDimensionWhitelist().isEmpty() || getDimensionWhitelist().test(name)); |
| 27 | + return !getAllCommandDimensionBlacklistFrom().test(name); |
20 | 28 | }
|
21 | 29 |
|
22 |
| - private static WildcardedRLMatcher getDimensionWhitelist() { |
23 |
| - if (dimensionMatcherW == null) { |
24 |
| - dimensionMatcherW = new WildcardedRLMatcher(FTBEConfig.RTP_DIMENSION_WHITELIST.get()); |
25 |
| - } |
26 |
| - return dimensionMatcherW; |
| 30 | + public static boolean isDimensionOKTo(ResourceKey<Level> levelKey) { |
| 31 | + ResourceLocation name = levelKey.location(); |
| 32 | + return !getAllCommandDimensionBlacklistTo().test(name); |
27 | 33 | }
|
28 | 34 |
|
29 |
| - private static WildcardedRLMatcher getDimensionBlacklist() { |
30 |
| - if (dimensionMatcherB == null) { |
31 |
| - dimensionMatcherB = new WildcardedRLMatcher(FTBEConfig.RTP_DIMENSION_BLACKLIST.get()); |
| 35 | + private static WildcardedRLMatcher getRtpDimensionWhitelist() { |
| 36 | + if (rtpDimensionMatcherW == null) { |
| 37 | + rtpDimensionMatcherW = new WildcardedRLMatcher(FTBEConfig.RTP_DIMENSION_WHITELIST.get()); |
32 | 38 | }
|
33 |
| - return dimensionMatcherB; |
| 39 | + return rtpDimensionMatcherW; |
34 | 40 | }
|
35 | 41 |
|
| 42 | + private static WildcardedRLMatcher getRtpDimensionBlacklist() { |
| 43 | + if (rtpDimensionMatcherB == null) { |
| 44 | + rtpDimensionMatcherB = new WildcardedRLMatcher(FTBEConfig.RTP_DIMENSION_BLACKLIST.get()); |
| 45 | + } |
| 46 | + return rtpDimensionMatcherB; |
| 47 | + } |
| 48 | + |
| 49 | + private static WildcardedRLMatcher getAllCommandDimensionBlacklistFrom() { |
| 50 | + if (allDimensionMatcherBFrom == null) { |
| 51 | + allDimensionMatcherBFrom = new WildcardedRLMatcher(FTBEConfig.TELEPORTATION_BLACKLIST_FROM.get()); |
| 52 | + } |
| 53 | + return allDimensionMatcherBFrom; |
| 54 | + } |
| 55 | + |
| 56 | + private static WildcardedRLMatcher getAllCommandDimensionBlacklistTo() { |
| 57 | + if (allDimensionMatcherBTo == null) { |
| 58 | + allDimensionMatcherBTo = new WildcardedRLMatcher(FTBEConfig.TELEPORTATION_BLACKLIST_TO.get()); |
| 59 | + } |
| 60 | + return allDimensionMatcherBTo; |
| 61 | + } |
| 62 | + |
36 | 63 | public static void clearMatcherCaches() {
|
37 |
| - dimensionMatcherB = null; |
38 |
| - dimensionMatcherW = null; |
| 64 | + rtpDimensionMatcherB = null; |
| 65 | + rtpDimensionMatcherW = null; |
| 66 | + |
| 67 | + allDimensionMatcherBFrom = null; |
| 68 | + allDimensionMatcherBTo = null; |
39 | 69 | }
|
40 | 70 |
|
41 | 71 | private static class WildcardedRLMatcher implements Predicate<ResourceLocation> {
|
|
0 commit comments