Search in sources :

Example 6 with EnumColor

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

the class PlasticSlabsRecipeProvider method registerPlasticSlabs.

private void registerPlasticSlabs(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();
        registerPlasticSlab(consumer, color, entry.getValue(), plastic.get(color), blockType, transparent, basePath);
    }
}
Also used : EnumColor(mekanism.api.text.EnumColor) Map(java.util.Map)

Example 7 with EnumColor

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

the class ModelFluidTank method render.

public void render(@Nonnull MatrixStack matrix, @Nonnull IRenderTypeBuffer renderer, int light, int overlayLight, FluidTankTier tier, boolean hasEffect) {
    renderToBuffer(matrix, getVertexBuilder(renderer, RENDER_TYPE, hasEffect), light, overlayLight, 1, 1, 1, 1);
    EnumColor color = tier.getBaseTier().getColor();
    // TODO: Try to make it so the lines can still show up on the back walls of the tank in first person
    renderGlass(matrix, getVertexBuilder(renderer, GLASS_RENDER_TYPE, hasEffect), light, overlayLight, color.getColor(0), color.getColor(1), color.getColor(2), 1);
}
Also used : EnumColor(mekanism.api.text.EnumColor)

Example 8 with EnumColor

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

the class GuiMekanismTile method drawForegroundText.

@Override
protected void drawForegroundText(@Nonnull MatrixStack matrix, int mouseX, int mouseY) {
    super.drawForegroundText(matrix, mouseX, mouseY);
    if (tile instanceof ISideConfiguration) {
        ItemStack stack = getMinecraft().player.inventory.getCarried();
        if (!stack.isEmpty() && stack.getItem() instanceof ItemConfigurator) {
            for (int i = 0; i < menu.slots.size(); i++) {
                Slot slot = menu.slots.get(i);
                if (isMouseOverSlot(slot, mouseX, mouseY)) {
                    DataType data = getFromSlot(slot);
                    if (data != null) {
                        EnumColor color = data.getColor();
                        displayTooltip(matrix, MekanismLang.GENERIC_WITH_PARENTHESIS.translateColored(color, data, color.getName()), mouseX - leftPos, mouseY - topPos);
                    }
                    break;
                }
            }
        }
    }
}
Also used : EnumColor(mekanism.api.text.EnumColor) ItemConfigurator(mekanism.common.item.ItemConfigurator) InventoryContainerSlot(mekanism.common.inventory.container.slot.InventoryContainerSlot) IInventorySlot(mekanism.api.inventory.IInventorySlot) Slot(net.minecraft.inventory.container.Slot) DataType(mekanism.common.tile.component.config.DataType) ItemStack(net.minecraft.item.ItemStack) ISideConfiguration(mekanism.common.tile.interfaces.ISideConfiguration)

Example 9 with EnumColor

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

the class TransporterPathfinder method checkPath.

private static boolean checkPath(InventoryNetwork network, List<BlockPos> path, TransporterStack stack) {
    for (int i = path.size() - 1; i > 0; i--) {
        LogisticalTransporterBase transmitter = network.getTransmitter(path.get(i));
        if (transmitter == null) {
            return false;
        }
        EnumColor color = transmitter.getColor();
        if (color != null && color != stack.color) {
            return false;
        }
    }
    return true;
}
Also used : EnumColor(mekanism.api.text.EnumColor) LogisticalTransporterBase(mekanism.common.content.network.transmitter.LogisticalTransporterBase)

Example 10 with EnumColor

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

the class TileEntityTeleporter method onUpdateServer.

@Override
protected void onUpdateServer() {
    super.onUpdateServer();
    if (teleportBounds == null && frameDirection != null) {
        resetBounds();
    }
    status = canTeleport();
    if (MekanismUtils.canFunction(this) && status == 1 && teleDelay == 0) {
        teleport();
    }
    if (teleDelay == 0 && teleportBounds != null && !didTeleport.isEmpty()) {
        cleanTeleportCache();
    }
    boolean prevShouldRender = shouldRender;
    shouldRender = status == 1 || status > 4;
    EnumColor prevColor = color;
    TeleporterFrequency freq = getFrequency(FrequencyType.TELEPORTER);
    color = freq != null ? freq.getColor() : null;
    if (shouldRender != prevShouldRender) {
        // This also means the comparator output changed so notify the neighbors we have a change
        WorldUtils.notifyLoadedNeighborsOfTileChange(level, getBlockPos());
        sendUpdatePacket();
    } else if (color != prevColor) {
        sendUpdatePacket();
    }
    teleDelay = Math.max(0, teleDelay - 1);
    energySlot.fillContainerOrConvert();
}
Also used : EnumColor(mekanism.api.text.EnumColor) TeleporterFrequency(mekanism.common.content.teleporter.TeleporterFrequency)

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