@Override public int hashCode() { int ret = toImmutableState().hashCode() << 3; if (hasNbtData()) { ret += getNbtData().hashCode(); } return ret; }
@Nullable @Override public BlockState apply(@Nullable String input) { try { return WorldEdit.getInstance().getBlockFactory().parseFromInput(input, TO_BLOCK_CONTEXT).toImmutableState(); } catch (InputParseException e) { e.printStackTrace(); return null; } } });
/** * Checks whether the type ID and data value are equal. */ @Override public boolean equals(Object o) { if (!(o instanceof BaseBlock)) { if (!hasNbtData() && o instanceof BlockStateHolder) { return Objects.equals(toImmutableState(), ((BlockStateHolder<?>) o).toImmutableState()); } return false; } final BaseBlock otherBlock = (BaseBlock) o; return this.blockState.equalsFuzzy(otherBlock.blockState) && Objects.equals(getNbtData(), otherBlock.getNbtData()); }
try { String id = blockEntry.getKey(); BlockState state = WorldEdit.getInstance().getBlockFactory().parseFromInput(blockEntry.getValue(), parserContext).toImmutableState(); blockToStringMap.put(state, id); stringToBlockMap.put(id, state);
String blockKey = block.toImmutableState().getAsString(); int blockId; if (palette.containsKey(blockKey)) {
@Override public BlockState getBlock(BlockVector3 position) { if (region.contains(position)) { BlockVector3 v = position.subtract(region.getMinimumPoint()); BaseBlock block = blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()]; if (block != null) { return block.toImmutableState(); } } return BlockTypes.AIR.getDefaultState(); }
BlockState state; try { state = WorldEdit.getInstance().getBlockFactory().parseFromInput(palettePart, parserContext).toImmutableState(); } catch (InputParseException e) { throw new IOException("Invalid BlockState in schematic: " + palettePart + ". Are you missing a mod of using a schematic made in a newer version of Minecraft?");