Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2001' into 2004
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxNeedsSnacks committed Jun 21, 2024
2 parents 7219f93 + b4ae0ec commit 7389227
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ static BlockStatePredicate of(Object o) {
return new AndMatch(predicates);
}

return ofSingle(o);
return ofSingle(list.get(0));
}

static RuleTest ruleTestOf(Object o) {
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/dev/latvian/mods/kubejs/util/UtilsJS.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public class UtilsJS {
public static RegistryAccess staticRegistryAccess = RegistryAccess.EMPTY; // FIXME
public static final ResourceLocation UNKNOWN_ID = new ResourceLocation("unknown", "unknown");
public static final Predicate<Object> ALWAYS_TRUE = o -> true;
public static final Pattern TEMPORAL_AMOUNT_PATTERN = Pattern.compile("(\\d+)\\s*(y|M|d|w|h|m|s|ms|ns|t)\\b");
public static final Pattern TEMPORAL_AMOUNT_PATTERN = Pattern.compile("(\\d+)\\s*(y|M|d|w|h|m|s|ms|ns|t)\\b?");

private static Collection<BlockState> ALL_STATE_CACHE = null;
private static final Map<String, EntitySelector> ENTITY_SELECTOR_CACHE = new HashMap<>();
Expand Down Expand Up @@ -921,18 +921,18 @@ public static TemporalAmount getTemporalAmount(Object o) {
ticks = 0L;
}

ticks += amount;
ticks += (long) amount;
}

case "ns" -> nanos += (long) amount;
case "ms" -> millis += (long) amount;
case "s" -> millis = (long) (amount * 1000D);
case "m" -> millis = (long) (amount * 60000D);
case "h" -> millis = (long) (amount * 60000D) * 60L;
case "d" -> millis = (long) (amount * 24D * 86400L) * 1000L;
case "w" -> millis = (long) (amount * 24D * 86400L) * 7000L;
case "M" -> millis = (long) (amount * 31556952D / 12D) * 1000L;
case "y" -> millis = (long) (amount * 31556952D) * 1000L;
case "s" -> millis += (long) (amount * 1000D);
case "m" -> millis += (long) (amount * 60000D);
case "h" -> millis += (long) (amount * 60000D) * 60L;
case "d" -> millis += (long) (amount * 86400L) * 1000L;
case "w" -> millis += (long) (amount * 86400L) * 7000L;
case "M" -> millis += (long) (amount * 31556952D / 12D) * 1000L;
case "y" -> millis += (long) (amount * 31556952D) * 1000L;
default -> throw new IllegalArgumentException("Invalid temporal unit: " + matcher.group(2));
}
}
Expand Down

0 comments on commit 7389227

Please sign in to comment.