Search in sources :

Example 1 with MusicInstrument

use of pokefenn.totemic.api.music.MusicInstrument in project Totemic by TeamTotemic.

the class PageCeremony method renderScreen.

@Override
public void renderScreen(IGuiLexiconEntry gui, int mx, int my) {
    relativeMouseX = mx;
    relativeMouseY = my;
    Minecraft mc = Minecraft.getMinecraft();
    TextureManager render = mc.renderEngine;
    FontRenderer font = mc.fontRenderer;
    List<MusicInstrument> instruments = ceremony.getSelectors();
    int instrLeft = gui.getLeft() + gui.getWidth() / 2 - 10 * instruments.size();
    for (int i = 0; i < instruments.size(); i++) {
        ItemStack item = instruments.get(i).getItem();
        if (!item.isEmpty())
            renderItem(gui, instrLeft + 20 * i, gui.getTop() + 31, item, false);
    }
    if (!tooltipStack.isEmpty())
        RenderHelper.renderTooltip(mx, my, tooltipStack.getTooltip(mc.player, TooltipFlags.NORMAL));
    String text = I18n.format("totemicmisc.musicSelector");
    font.drawString(text, gui.getLeft() + gui.getWidth() / 2 - font.getStringWidth(text) / 2, gui.getTop() + 14, 0x999999);
    boolean unicode = font.getUnicodeFlag();
    font.setUnicodeFlag(true);
    text = I18n.format(TotemUtil.getMusicNeeded(ceremony.getMusicNeeded()));
    font.drawString(text, gui.getLeft() + gui.getWidth() / 2 - font.getStringWidth(text) / 2, gui.getTop() + 90, 0x000000);
    text = I18n.format(getUnlocalizedName());
    font.drawString(text, gui.getLeft() + gui.getWidth() / 2 - font.getStringWidth(text) / 2, gui.getTop() + 150, 0x000000);
    font.setUnicodeFlag(unicode);
    render.bindTexture(ceremonyOverlay);
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GlStateManager.color(1F, 1F, 1F, 1F);
    ((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
    GlStateManager.disableBlend();
    tooltipStack = tooltipContainerStack = ItemStack.EMPTY;
    tooltipEntry = false;
    mouseDownLastTick = Mouse.isButtonDown(0);
}
Also used : TextureManager(net.minecraft.client.renderer.texture.TextureManager) MusicInstrument(pokefenn.totemic.api.music.MusicInstrument) GuiScreen(net.minecraft.client.gui.GuiScreen) FontRenderer(net.minecraft.client.gui.FontRenderer) ItemStack(net.minecraft.item.ItemStack) Minecraft(net.minecraft.client.Minecraft)

Example 2 with MusicInstrument

use of pokefenn.totemic.api.music.MusicInstrument in project Totemic by TeamTotemic.

the class ModContent method createRegistries.

@SubscribeEvent
public static void createRegistries(RegistryEvent.NewRegistry event) {
    // RegistryEvents are fired in alphabetic order.
    // Instruments have to be registered before Ceremonies.
    new RegistryBuilder<MusicInstrument>().setName(new ResourceLocation(Totemic.MOD_ID, "a_music_instruments")).setType(MusicInstrument.class).setMaxID(Byte.MAX_VALUE).disableSaving().create();
    new RegistryBuilder<TotemEffect>().setName(new ResourceLocation(Totemic.MOD_ID, "b_totem_effects")).setType(TotemEffect.class).setMaxID(Byte.MAX_VALUE).disableSaving().create();
    new RegistryBuilder<Ceremony>().setName(new ResourceLocation(Totemic.MOD_ID, "c_ceremonies")).setType(Ceremony.class).setMaxID(Byte.MAX_VALUE).disableSaving().create();
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) MusicInstrument(pokefenn.totemic.api.music.MusicInstrument) TotemEffect(pokefenn.totemic.api.totem.TotemEffect) Ceremony(pokefenn.totemic.api.ceremony.Ceremony) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 3 with MusicInstrument

use of pokefenn.totemic.api.music.MusicInstrument in project Totemic by TeamTotemic.

the class StateSelection method writeToNBT.

@Override
void writeToNBT(NBTTagCompound tag) {
    NBTTagList selectorsTag = new NBTTagList();
    for (MusicInstrument instr : selectors) selectorsTag.appendTag(new NBTTagString(instr.getRegistryName().toString()));
    tag.setTag("selectors", selectorsTag);
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) MusicInstrument(pokefenn.totemic.api.music.MusicInstrument) NBTTagString(net.minecraft.nbt.NBTTagString)

Example 4 with MusicInstrument

use of pokefenn.totemic.api.music.MusicInstrument in project Totemic by TeamTotemic.

the class StateStartup method handleFullPacket.

public void handleFullPacket(PacketCeremonyStartupFull msg) {
    time = msg.getStartupTime();
    music.clear();
    totalMusic = 0;
    for (int i = 0; i < msg.getCount(); i++) {
        MusicInstrument instr = msg.getInstrument(i);
        int value = msg.getValue(i);
        music.put(instr, value);
        totalMusic += value;
    }
}
Also used : MusicInstrument(pokefenn.totemic.api.music.MusicInstrument)

Aggregations

MusicInstrument (pokefenn.totemic.api.music.MusicInstrument)4 Minecraft (net.minecraft.client.Minecraft)1 FontRenderer (net.minecraft.client.gui.FontRenderer)1 GuiScreen (net.minecraft.client.gui.GuiScreen)1 TextureManager (net.minecraft.client.renderer.texture.TextureManager)1 ItemStack (net.minecraft.item.ItemStack)1 NBTTagList (net.minecraft.nbt.NBTTagList)1 NBTTagString (net.minecraft.nbt.NBTTagString)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 Ceremony (pokefenn.totemic.api.ceremony.Ceremony)1 TotemEffect (pokefenn.totemic.api.totem.TotemEffect)1