Search in sources :

Example 1 with PreferencesProperties

use of mcjty.lib.preferences.PreferencesProperties in project RFTools by McJty.

the class RenderGameOverlayEventHandler method renderBuffs.

private static void renderBuffs() {
    if (buffs == null || buffs.isEmpty()) {
        return;
    }
    EntityPlayerSP player = Minecraft.getMinecraft().player;
    PreferencesProperties preferences = McJtyLib.getPreferencesProperties(player);
    int x = preferences.getBuffX();
    int y = preferences.getBuffY();
    if (x == -1 || y == -1) {
        return;
    }
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_LIGHTING);
    for (PlayerBuff buff : buffs) {
        Item item = getBuffItem(buff);
        if (item != null) {
            RenderItem itemRender = Minecraft.getMinecraft().getRenderItem();
            RenderHelper.renderItemStack(Minecraft.getMinecraft(), itemRender, new ItemStack(item), x, y, "", false);
            // itemRender.renderItem(new ItemStack(item), player, ItemCameraTransforms.TransformType.FIXED, true);
            x += BUFF_ICON_SIZE;
        }
    }
}
Also used : PreferencesProperties(mcjty.lib.preferences.PreferencesProperties) RenderItem(net.minecraft.client.renderer.RenderItem) Item(net.minecraft.item.Item) RenderItem(net.minecraft.client.renderer.RenderItem) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) ItemStack(net.minecraft.item.ItemStack)

Example 2 with PreferencesProperties

use of mcjty.lib.preferences.PreferencesProperties in project RFTools by McJty.

the class CmdReset method execute.

@Override
public void execute(ICommandSender sender, String[] args) {
    if (args.length > 1) {
        ITextComponent component = new TextComponentString(TextFormatting.RED + "Too many parameters!");
        if (sender instanceof EntityPlayer) {
            ((EntityPlayer) sender).sendStatusMessage(component, false);
        } else {
            sender.sendMessage(component);
        }
        return;
    }
    if (!(sender instanceof EntityPlayer)) {
        ITextComponent component = new TextComponentString(TextFormatting.RED + "This command only works as a player!");
        if (sender instanceof EntityPlayer) {
            ((EntityPlayer) sender).sendStatusMessage(component, false);
        } else {
            sender.sendMessage(component);
        }
        return;
    }
    EntityPlayer player = (EntityPlayer) sender;
    PreferencesProperties preferencesProperties = McJtyLib.getPreferencesProperties(player);
    if (preferencesProperties != null) {
        preferencesProperties.reset();
    }
}
Also used : PreferencesProperties(mcjty.lib.preferences.PreferencesProperties) ITextComponent(net.minecraft.util.text.ITextComponent) EntityPlayer(net.minecraft.entity.player.EntityPlayer) TextComponentString(net.minecraft.util.text.TextComponentString)

Example 3 with PreferencesProperties

use of mcjty.lib.preferences.PreferencesProperties in project RFTools by McJty.

the class CmdSetBuffBar method execute.

@Override
public void execute(ICommandSender sender, String[] args) {
    if (args.length > 3) {
        ITextComponent component = new TextComponentString(TextFormatting.RED + "Too many parameters!");
        if (sender instanceof EntityPlayer) {
            ((EntityPlayer) sender).sendStatusMessage(component, false);
        } else {
            sender.sendMessage(component);
        }
        return;
    }
    if (!(sender instanceof EntityPlayer)) {
        ITextComponent component = new TextComponentString(TextFormatting.RED + "This command only works as a player!");
        if (sender instanceof EntityPlayer) {
            ((EntityPlayer) sender).sendStatusMessage(component, false);
        } else {
            sender.sendMessage(component);
        }
        return;
    }
    EntityPlayer player = (EntityPlayer) sender;
    PreferencesProperties properties = McJtyLib.getPreferencesProperties(player);
    if (args.length < 3) {
        int buffX = properties.getBuffX();
        int buffY = properties.getBuffY();
        ITextComponent component = new TextComponentString(TextFormatting.YELLOW + "Current buffbar location: " + buffX + "," + buffY);
        if (sender instanceof EntityPlayer) {
            ((EntityPlayer) sender).sendStatusMessage(component, false);
        } else {
            sender.sendMessage(component);
        }
        return;
    }
    int x = fetchInt(sender, args, 1, 0);
    int y = fetchInt(sender, args, 2, 0);
    properties.setBuffXY(x, y);
}
Also used : PreferencesProperties(mcjty.lib.preferences.PreferencesProperties) ITextComponent(net.minecraft.util.text.ITextComponent) EntityPlayer(net.minecraft.entity.player.EntityPlayer) TextComponentString(net.minecraft.util.text.TextComponentString)

Example 4 with PreferencesProperties

use of mcjty.lib.preferences.PreferencesProperties in project RFTools by McJty.

the class CmdSetStyle method execute.

@Override
public void execute(ICommandSender sender, String[] args) {
    if (args.length > 2) {
        ITextComponent component = new TextComponentString(TextFormatting.RED + "Too many parameters!");
        if (sender instanceof EntityPlayer) {
            ((EntityPlayer) sender).sendStatusMessage(component, false);
        } else {
            sender.sendMessage(component);
        }
        return;
    }
    if (!(sender instanceof EntityPlayer)) {
        ITextComponent component = new TextComponentString(TextFormatting.RED + "This command only works as a player!");
        if (sender instanceof EntityPlayer) {
            ((EntityPlayer) sender).sendStatusMessage(component, false);
        } else {
            sender.sendMessage(component);
        }
        return;
    }
    EntityPlayer player = (EntityPlayer) sender;
    PreferencesProperties properties = McJtyLib.getPreferencesProperties(player);
    if (args.length < 2) {
        GuiStyle style = properties.getStyle();
        ITextComponent component = new TextComponentString(TextFormatting.YELLOW + "Current GUI style: " + style.getStyle());
        if (sender instanceof EntityPlayer) {
            ((EntityPlayer) sender).sendStatusMessage(component, false);
        } else {
            sender.sendMessage(component);
        }
        return;
    }
    String s = fetchString(sender, args, 1, "");
    boolean b = properties.setStyle(s);
    if (!b) {
        String buf = "";
        for (GuiStyle style : GuiStyle.values()) {
            buf = buf + " " + style.getStyle();
        }
        ITextComponent component = new TextComponentString(TextFormatting.RED + "Unknown style! Options:" + buf);
        if (sender instanceof EntityPlayer) {
            ((EntityPlayer) sender).sendStatusMessage(component, false);
        } else {
            sender.sendMessage(component);
        }
    }
}
Also used : PreferencesProperties(mcjty.lib.preferences.PreferencesProperties) GuiStyle(mcjty.lib.gui.GuiStyle) ITextComponent(net.minecraft.util.text.ITextComponent) EntityPlayer(net.minecraft.entity.player.EntityPlayer) TextComponentString(net.minecraft.util.text.TextComponentString) TextComponentString(net.minecraft.util.text.TextComponentString)

Aggregations

PreferencesProperties (mcjty.lib.preferences.PreferencesProperties)4 EntityPlayer (net.minecraft.entity.player.EntityPlayer)3 ITextComponent (net.minecraft.util.text.ITextComponent)3 TextComponentString (net.minecraft.util.text.TextComponentString)3 GuiStyle (mcjty.lib.gui.GuiStyle)1 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)1 RenderItem (net.minecraft.client.renderer.RenderItem)1 Item (net.minecraft.item.Item)1 ItemStack (net.minecraft.item.ItemStack)1