Search in sources :

Example 6 with AmadronOfferCustom

use of me.desht.pneumaticcraft.common.recipes.AmadronOfferCustom in project pnc-repressurized by TeamPneumatic.

the class PacketSyncAmadronOffers method toBytes.

@Override
public void toBytes(ByteBuf buf) {
    buf.writeInt(offers.size());
    for (AmadronOffer offer : offers) {
        buf.writeBoolean(offer instanceof AmadronOfferCustom);
        writeFluidOrItemStack(offer.getInput(), buf);
        writeFluidOrItemStack(offer.getOutput(), buf);
        if (offer instanceof AmadronOfferCustom) {
            ((AmadronOfferCustom) offer).writeToBuf(buf);
        }
    }
}
Also used : AmadronOffer(me.desht.pneumaticcraft.common.recipes.AmadronOffer) AmadronOfferCustom(me.desht.pneumaticcraft.common.recipes.AmadronOfferCustom)

Example 7 with AmadronOfferCustom

use of me.desht.pneumaticcraft.common.recipes.AmadronOfferCustom in project pnc-repressurized by TeamPneumatic.

the class WidgetAmadronOffer method render.

@Override
public void render(int mouseX, int mouseY, float partialTick) {
    if (renderBackground) {
        Minecraft.getMinecraft().getTextureManager().bindTexture(Textures.WIDGET_AMADRON_OFFER);
        GlStateManager.color(1f, canBuy ? 1f : 0.4f, canBuy ? 1f : 0.4f, 1f);
        Gui.drawModalRectWithCustomSizedTexture(x, y, 0, 0, getBounds().width, getBounds().height, 256, 256);
    }
    for (IGuiWidget widget : widgets) {
        widget.render(mouseX, mouseY, partialTick);
    }
    Minecraft.getMinecraft().fontRenderer.drawString(offer.getVendor(), x + 2, y + 2, 0xFF000000);
    boolean customOffer = offer instanceof AmadronOfferCustom;
    if (shoppingAmount > 0) {
        Minecraft.getMinecraft().fontRenderer.drawString(TextFormatting.BLACK.toString() + shoppingAmount, x + 36 - Minecraft.getMinecraft().fontRenderer.getStringWidth("" + shoppingAmount) / 2, y + (customOffer ? 15 : 20), 0xFF000000);
    }
    if (customOffer) {
        AmadronOfferCustom custom = (AmadronOfferCustom) offer;
        Minecraft.getMinecraft().fontRenderer.drawString(TextFormatting.DARK_BLUE.toString() + custom.getStock(), x + 36 - Minecraft.getMinecraft().fontRenderer.getStringWidth("" + custom.getStock()) / 2, y + 25, 0xFF000000);
    }
}
Also used : AmadronOfferCustom(me.desht.pneumaticcraft.common.recipes.AmadronOfferCustom)

Aggregations

AmadronOfferCustom (me.desht.pneumaticcraft.common.recipes.AmadronOfferCustom)7 AmadronOffer (me.desht.pneumaticcraft.common.recipes.AmadronOffer)3 IOException (java.io.IOException)2 BlockPos (net.minecraft.util.math.BlockPos)2 FluidStack (net.minecraftforge.fluids.FluidStack)2 ArrayList (java.util.ArrayList)1 GuiLogisticsLiquidFilter (me.desht.pneumaticcraft.client.gui.semiblock.GuiLogisticsLiquidFilter)1 EntityDrone (me.desht.pneumaticcraft.common.entity.living.EntityDrone)1 ContainerAmadronAddTrade (me.desht.pneumaticcraft.common.inventory.ContainerAmadronAddTrade)1 PacketAmadronTradeAdd (me.desht.pneumaticcraft.common.network.PacketAmadronTradeAdd)1 PacketAmadronTradeRemoved (me.desht.pneumaticcraft.common.network.PacketAmadronTradeRemoved)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 ItemStack (net.minecraft.item.ItemStack)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 TextComponentTranslation (net.minecraft.util.text.TextComponentTranslation)1 World (net.minecraft.world.World)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1