use of com.bluepowermod.block.BlockBPMicroblock in project BluePower by Qmunity.
the class BPMicroblockModel method getQuads.
@Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) {
List<BakedQuad> outquads = new ArrayList<>();
IBakedModel typeModel = Minecraft.getInstance().getBlockRenderer().getBlockModel(this.defBlock.defaultBlockState());
IBakedModel sizeModel = Minecraft.getInstance().getModelManager().getModel(new ModelResourceLocation(defSize.getRegistryName(), "face=" + Direction.WEST));
if (state != null && state.getBlock() instanceof BlockBPMicroblock) {
sizeModel = Minecraft.getInstance().getModelManager().getModel(new ModelResourceLocation(state.getBlock().getRegistryName(), "face=" + state.getValue(BlockBPMicroblock.FACING)));
}
List<BakedQuad> sizeModelQuads = sizeModel.getQuads(state, side, rand);
TextureAtlasSprite sprite = typeModel.getParticleIcon();
for (BakedQuad quad : sizeModelQuads) {
List<BakedQuad> typeModelQuads = typeModel.getQuads(this.defBlock.defaultBlockState(), quad.getDirection(), rand);
if (typeModelQuads.size() > 0) {
sprite = typeModelQuads.get(0).getSprite();
}
outquads.add(transform(quad, sprite, Direction.EAST, defBlock));
}
return outquads;
}
use of com.bluepowermod.block.BlockBPMicroblock in project BluePower by Qmunity.
the class Renderers method init.
public static void init() {
ClientRegistry.bindTileEntityRenderer(BPTileEntityType.LAMP, RenderLamp::new);
ClientRegistry.bindTileEntityRenderer(BPTileEntityType.ENGINE, RenderEngine::new);
for (Item item : BPItems.itemList) {
if (item instanceof IBPColoredItem) {
Minecraft.getInstance().getItemColors().register(new BPItemColor(), item);
}
}
for (Block block : BPBlocks.blockList) {
if (block instanceof IBPColoredBlock) {
Minecraft.getInstance().getBlockColors().register(new BPBlockColor(), block);
Minecraft.getInstance().getItemColors().register(new BPBlockColor(), Item.byBlock(block));
}
if (block instanceof BlockLampSurface || block instanceof BlockGateBase || block instanceof BlockBattery)
RenderTypeLookup.setRenderLayer(block, RenderType.cutout());
if (block instanceof BlockBPGlass || block instanceof BlockBPMicroblock || block instanceof BlockBPMultipart)
RenderTypeLookup.setRenderLayer(block, RenderType.translucent());
}
RenderTypeLookup.setRenderLayer(BPBlocks.indigo_flower, RenderType.cutout());
RenderTypeLookup.setRenderLayer(BPBlocks.flax_crop, RenderType.cutout());
RenderTypeLookup.setRenderLayer(BPBlocks.cracked_basalt_lava, RenderType.cutout());
RenderTypeLookup.setRenderLayer(BPBlocks.cracked_basalt_decorative, RenderType.cutout());
RenderTypeLookup.setRenderLayer(BPBlocks.rubber_leaves, RenderType.cutout());
RenderTypeLookup.setRenderLayer(BPBlocks.rubber_sapling, RenderType.cutout());
RenderTypeLookup.setRenderLayer(BPBlocks.tube, RenderType.cutout());
}
use of com.bluepowermod.block.BlockBPMicroblock in project BluePower by Qmunity.
the class MicroblockRecipe method matches.
@Override
public boolean matches(CraftingInventory inv, World worldIn) {
int blockCount = 0;
int saw = 0;
for (int i = 0; i < inv.getContainerSize(); ++i) {
ItemStack stack = inv.getItem(i);
if (!stack.isEmpty()) {
if (stack.getItem() instanceof BlockItem && (Block.byItem(stack.getItem()) instanceof BlockBPMicroblock || !Block.byItem(stack.getItem()).hasTileEntity(Block.byItem(stack.getItem()).defaultBlockState()))) {
VoxelShape shape = null;
try {
shape = Block.byItem(stack.getItem()).defaultBlockState().getShape(null, null);
} catch (NullPointerException ignored) {
// Shulker Boxes try to query the Tile Entity
}
if (shape == VoxelShapes.block() || Block.byItem(stack.getItem()) == BPBlocks.half_block || Block.byItem(stack.getItem()) == BPBlocks.panel) {
blockCount++;
}
} else if (stack.getItem() instanceof ItemSaw) {
saw++;
} else {
return false;
}
}
}
return blockCount == 1 && saw == 1;
}
use of com.bluepowermod.block.BlockBPMicroblock in project BluePower by Qmunity.
the class BPMicroblockModel method getQuads.
@Nonnull
@Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData) {
Pair<Block, Integer> info = extraData.getData(TileBPMicroblock.PROPERTY_INFO);
if (info != null) {
IBakedModel typeModel = Minecraft.getInstance().getBlockRenderer().getBlockModel(info.getKey().defaultBlockState());
IBakedModel sizeModel = Minecraft.getInstance().getModelManager().getModel(new ModelResourceLocation(defSize.getRegistryName(), "face=" + Direction.WEST));
List<BakedQuad> bakedQuads = new ArrayList<>();
if (state != null && state.getBlock() instanceof BlockBPMicroblock) {
sizeModel = Minecraft.getInstance().getModelManager().getModel(new ModelResourceLocation(state.getBlock().getRegistryName(), "face=" + state.getValue(BlockBPMicroblock.FACING)));
}
List<BakedQuad> sizeModelQuads = sizeModel.getQuads(state, side, rand);
if (state != null) {
TextureAtlasSprite sprite = typeModel.getParticleIcon();
for (BakedQuad quad : sizeModelQuads) {
List<BakedQuad> typeModelQuads = typeModel.getQuads(info.getKey().defaultBlockState(), quad.getDirection(), rand);
if (typeModelQuads.size() > 0) {
sprite = typeModelQuads.get(0).getSprite();
}
bakedQuads.add(transform(quad, sprite, state.getValue(BlockBPMicroblock.FACING), defBlock));
}
return bakedQuads;
}
}
return Collections.emptyList();
}
Aggregations