Search in sources :

Example 31 with EnumColor

use of mekanism.api.text.EnumColor in project Mekanism by mekanism.

the class PlasticFencesRecipeProvider method registerPlasticFence.

private void registerPlasticFence(Consumer<IFinishedRecipe> consumer, BlockRegistryObject<? extends IColoredBlock, ?> result, IItemProvider plastic, String basePath) {
    EnumColor color = result.getBlock().getColor();
    ExtendedShapedRecipeBuilder.shapedRecipe(result, 3).pattern(PLASTIC_FENCE).key(AdditionsRecipeProvider.PLASTIC_ROD_CHAR, MekanismTags.Items.RODS_PLASTIC).key(Pattern.CONSTANT, plastic).build(consumer, MekanismAdditions.rl(basePath + color.getRegistryPrefix()));
    PlasticBlockRecipeProvider.registerRecolor(consumer, result, AdditionsTags.Items.FENCES_PLASTIC, color, basePath);
}
Also used : EnumColor(mekanism.api.text.EnumColor)

Example 32 with EnumColor

use of mekanism.api.text.EnumColor in project Mekanism by mekanism.

the class PlasticStairsRecipeProvider method registerPlasticStairs.

private void registerPlasticStairs(Consumer<IFinishedRecipe> consumer, Map<EnumColor, ? extends IItemProvider> blocks, Map<EnumColor, ? extends IItemProvider> plastic, ITag<Item> blockType, boolean transparent, String basePath) {
    for (Map.Entry<EnumColor, ? extends IItemProvider> entry : blocks.entrySet()) {
        EnumColor color = entry.getKey();
        registerPlasticStairs(consumer, color, entry.getValue(), plastic.get(color), blockType, transparent, basePath);
    }
}
Also used : EnumColor(mekanism.api.text.EnumColor) Map(java.util.Map)

Example 33 with EnumColor

use of mekanism.api.text.EnumColor in project Mekanism by mekanism.

the class RenderBalloon method render.

@Override
public void render(@Nonnull EntityBalloon balloon, float entityYaw, float partialTick, @Nonnull MatrixStack matrix, @Nonnull IRenderTypeBuffer renderer, int light) {
    matrix.pushPose();
    matrix.translate(-0.5, -1, -0.5);
    if (balloon.isLatchedToEntity()) {
        // Shift the rendering of the balloon to be over the entity
        double x = balloon.latchedEntity.xOld + (balloon.latchedEntity.getX() - balloon.latchedEntity.xOld) * partialTick - (balloon.xOld + (balloon.getX() - balloon.xOld) * partialTick);
        double y = balloon.latchedEntity.yOld + (balloon.latchedEntity.getY() - balloon.latchedEntity.yOld) * partialTick - (balloon.yOld + (balloon.getY() - balloon.yOld) * partialTick) + balloon.getAddedHeight();
        double z = balloon.latchedEntity.zOld + (balloon.latchedEntity.getZ() - balloon.latchedEntity.zOld) * partialTick - (balloon.zOld + (balloon.getZ() - balloon.zOld) * partialTick);
        matrix.translate(x, y, z);
    }
    JSONModelData model = balloon.isLatched() ? AdditionsModelCache.INSTANCE.BALLOON : AdditionsModelCache.INSTANCE.BALLOON_FREE;
    List<BakedQuad> quads = model.getBakedModel().getQuads(null, null, balloon.level.random);
    RenderType renderType = RenderType.entityTranslucent(AtlasTexture.LOCATION_BLOCKS);
    IVertexBuilder builder = renderer.getBuffer(renderType);
    MatrixStack.Entry last = matrix.last();
    for (BakedQuad quad : quads) {
        float[] color = new float[] { 1, 1, 1, 1 };
        if (quad.getTintIndex() == 0) {
            EnumColor balloonColor = balloon.getColor();
            color[0] = balloonColor.getColor(0);
            color[1] = balloonColor.getColor(1);
            color[2] = balloonColor.getColor(2);
        }
        builder.addVertexData(last, quad, color[0], color[1], color[2], color[3], light, OverlayTexture.NO_OVERLAY);
    }
    ((IRenderTypeBuffer.Impl) renderer).endBatch(renderType);
    matrix.popPose();
    super.render(balloon, entityYaw, partialTick, matrix, renderer, light);
}
Also used : BakedQuad(net.minecraft.client.renderer.model.BakedQuad) EnumColor(mekanism.api.text.EnumColor) JSONModelData(mekanism.client.model.BaseModelCache.JSONModelData) MatrixStack(com.mojang.blaze3d.matrix.MatrixStack) RenderType(net.minecraft.client.renderer.RenderType) IVertexBuilder(com.mojang.blaze3d.vertex.IVertexBuilder)

Aggregations

EnumColor (mekanism.api.text.EnumColor)33 Map (java.util.Map)6 DyeColor (net.minecraft.item.DyeColor)6 ItemStack (net.minecraft.item.ItemStack)5 ISideConfiguration (mekanism.common.tile.interfaces.ISideConfiguration)4 DataType (mekanism.common.tile.component.config.DataType)3 ArrayList (java.util.ArrayList)2 IPigmentProvider (mekanism.api.providers.IPigmentProvider)2 ItemConfigurator (mekanism.common.item.ItemConfigurator)2 PigmentRegistryObject (mekanism.common.registration.impl.PigmentRegistryObject)2 ITextComponent (net.minecraft.util.text.ITextComponent)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 MatrixStack (com.mojang.blaze3d.matrix.MatrixStack)1 IVertexBuilder (com.mojang.blaze3d.vertex.IVertexBuilder)1 Long2ObjectMap (it.unimi.dsi.fastutil.longs.Long2ObjectMap)1 Object2ObjectOpenHashMap (it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap)1 EnumMap (java.util.EnumMap)1 HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Consumer (java.util.function.Consumer)1