|
3 | 3 | import com.almostreliable.ponderjs.PonderJS; |
4 | 4 | import dev.latvian.mods.kubejs.block.predicate.BlockIDPredicate; |
5 | 5 | import dev.latvian.mods.kubejs.script.ConsoleJS; |
6 | | -import dev.latvian.mods.kubejs.util.UtilsJS; |
7 | 6 | import dev.latvian.mods.rhino.Context; |
8 | 7 | import dev.latvian.mods.rhino.type.TypeInfo; |
9 | 8 | import net.createmod.ponder.api.scene.Selection; |
10 | 9 | import net.createmod.ponder.foundation.PonderTag; |
11 | 10 | import net.createmod.ponder.foundation.SelectionImpl; |
12 | 11 | import net.minecraft.core.BlockPos; |
13 | 12 | import net.minecraft.core.registries.BuiltInRegistries; |
14 | | -import net.minecraft.resources.ResourceLocation; |
15 | | -import net.minecraft.world.level.block.Block; |
16 | | -import net.minecraft.world.level.block.Blocks; |
17 | 13 | import net.minecraft.world.level.block.state.BlockState; |
18 | 14 | import net.minecraft.world.level.levelgen.structure.BoundingBox; |
19 | 15 | import net.minecraft.world.phys.Vec3; |
@@ -53,7 +49,14 @@ public static Selection selectionOf(Context ctx, @Nullable Object o) { |
53 | 49 | (int) to.z)); |
54 | 50 | } |
55 | 51 |
|
56 | | - Integer[] values = l.stream().map(entry -> UtilsJS.parseInt(entry, 0)).toArray(Integer[]::new); |
| 52 | + Integer[] values = l.stream().map(entry -> { |
| 53 | + try { |
| 54 | + return (int) Double.parseDouble(entry.toString()); |
| 55 | + } catch (Exception e) { |
| 56 | + ConsoleJS.CLIENT.error("Selection was provided as list with invalid values.", e); |
| 57 | + return 0; |
| 58 | + } |
| 59 | + }).toArray(Integer[]::new); |
57 | 60 | if (values.length == 6) { |
58 | 61 | return SelectionImpl.of(new BoundingBox(values[0], |
59 | 62 | values[1], |
|
0 commit comments