Search in sources :

Example 1 with BarrelLook

use of com.latmod.yabba.util.BarrelLook in project YABBA by LatvianModder.

the class ItemBlockBarrel method addInformation.

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag flag) {
    if (stack.hasTagCompound() && stack.getTagCompound().hasKey("BlockEntityTag")) {
        TileBarrelBase barrel = (TileBarrelBase) block.createTileEntity(world, block.getDefaultState());
        barrel.readFromNBT(stack.getTagCompound().getCompoundTag("BlockEntityTag"));
        if (block instanceof BlockAdvancedBarrelBase) {
            BarrelLook look = barrel.getLook();
            tooltip.add(ItemHammer.getModelTooltip(look.model));
            tooltip.add(ItemPainter.getSkinTooltip(look.skin));
        }
        barrel.addInformation(tooltip, flag);
    } else if (block instanceof BlockAdvancedBarrelBase) {
        tooltip.add(ItemHammer.getModelTooltip(""));
        tooltip.add(ItemPainter.getSkinTooltip(""));
    }
}
Also used : TileBarrelBase(com.latmod.yabba.tile.TileBarrelBase) BlockAdvancedBarrelBase(com.latmod.yabba.block.BlockAdvancedBarrelBase) BarrelLook(com.latmod.yabba.util.BarrelLook) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with BarrelLook

use of com.latmod.yabba.util.BarrelLook in project YABBA by LatvianModder.

the class BakedBarrelBlockModel method getQuads.

@Override
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
    if (state instanceof IExtendedBlockState) {
        IExtendedBlockState statex = (IExtendedBlockState) state;
        BarrelLook look = statex.getValue(BlockAdvancedBarrelBase.LOOK);
        if (look == null) {
            look = BarrelLook.DEFAULT;
        }
        BarrelModel model = look.getModel();
        BarrelSkin skin = look.getSkin();
        if (MinecraftForgeClient.getRenderLayer() == ClientUtils.getStrongest(model.layer, skin.layer)) {
            return get(BarrelLook.get(model.id, skin.id)).getQuads(state.getValue(BlockAdvancedBarrelBase.ROTATION).getModelRotationIndexFromFacing(state.getValue(BlockHorizontal.FACING)));
        }
    }
    return Collections.emptyList();
}
Also used : IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) BarrelLook(com.latmod.yabba.util.BarrelLook) BarrelSkin(com.latmod.yabba.api.BarrelSkin)

Aggregations

BarrelLook (com.latmod.yabba.util.BarrelLook)2 BarrelSkin (com.latmod.yabba.api.BarrelSkin)1 BlockAdvancedBarrelBase (com.latmod.yabba.block.BlockAdvancedBarrelBase)1 TileBarrelBase (com.latmod.yabba.tile.TileBarrelBase)1 IExtendedBlockState (net.minecraftforge.common.property.IExtendedBlockState)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1