use of com.bluepowermod.BluePower in project BluePower by Qmunity.
the class JEIPlugin method getMicroblockRecipes.
private static List<IRecipe<?>> getMicroblockRecipes() {
List<IRecipe<?>> recipes = new ArrayList<>();
for (Block block : ForgeRegistries.BLOCKS.getValues().stream().filter(b -> !b.hasTileEntity(b.defaultBlockState())).collect(Collectors.toList())) {
VoxelShape shape = null;
try {
shape = block.defaultBlockState().getShape(null, null);
} catch (NullPointerException ignored) {
// Shulker Boxes try to query the Tile Entity
}
if (block.getRegistryName() != null && shape == VoxelShapes.block()) {
ItemStack output = ItemStack.EMPTY;
for (Block mb : BPBlocks.microblocks) {
NonNullList<Ingredient> input = NonNullList.create();
input.add(Ingredient.of(ItemTags.createOptional(new ResourceLocation("bluepower:saw"))));
if (mb == BPBlocks.half_block) {
input.add(Ingredient.of(new ItemStack(block)));
} else {
input.add(Ingredient.of(output));
}
CompoundNBT nbt = new CompoundNBT();
nbt.putString("block", block.getRegistryName().toString());
ItemStack stack = new ItemStack(mb);
stack.setTag(nbt);
stack.setHoverName(new TranslationTextComponent(block.getDescriptionId()).append(new StringTextComponent(" ")).append(new TranslationTextComponent(mb.getDescriptionId())));
output = stack;
recipes.add(new ShapelessRecipe(new ResourceLocation("bluepower:" + mb.getDescriptionId() + block.getDescriptionId()), "", output, input));
}
}
}
return recipes;
}
Aggregations