From b51dccc73736e6c72b1386917ca129e194c8ec13 Mon Sep 17 00:00:00 2001 From: Logan Darklock Date: Tue, 3 Sep 2019 21:57:20 -0700 Subject: [PATCH] DON'T THROW EXCEPTIONS IN SCHEMATICS AA --- src/api/java/baritone/api/schematic/FillBomSchematic.java | 2 +- src/api/java/baritone/api/utils/BlockOptionalMeta.java | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/api/java/baritone/api/schematic/FillBomSchematic.java b/src/api/java/baritone/api/schematic/FillBomSchematic.java index 7989cbfc..a9b5f356 100644 --- a/src/api/java/baritone/api/schematic/FillBomSchematic.java +++ b/src/api/java/baritone/api/schematic/FillBomSchematic.java @@ -31,6 +31,6 @@ public class FillBomSchematic extends AbstractSchematic { } } - throw new IllegalStateException("Couldn't find desired state"); + return bom.getAnyBlockState(); } } diff --git a/src/api/java/baritone/api/utils/BlockOptionalMeta.java b/src/api/java/baritone/api/utils/BlockOptionalMeta.java index 1fd4264f..bd17307c 100644 --- a/src/api/java/baritone/api/utils/BlockOptionalMeta.java +++ b/src/api/java/baritone/api/utils/BlockOptionalMeta.java @@ -322,4 +322,12 @@ public final class BlockOptionalMeta { //noinspection deprecation return Block.getBlockFromItem(stack.getItem()).getStateFromMeta(stack.getMetadata()); } + + public IBlockState getAnyBlockState() { + if (blockstates.size() > 0) { + return blockstates.iterator().next(); + } + + return null; + } }