Java 类net.minecraft.client.gui.GuiListExtended 实例源码

项目:MacroKey    文件:GuiKeyBindingsListing.java   
public GuiKeyBindingsListing(GuiKeybindings controls, Minecraft mcIn) {
    super(mcIn, controls.width + 45, controls.height, 63, controls.height - 32, 20);
    this.mc = mcIn;
    guiKeybindings = controls;
    this.listEntries = new GuiListExtended.IGuiListEntry[MacroKey.instance.boundKeys.size()];
    this.maxListLabelWidth = new int[MacroKey.instance.boundKeys.size()];

    int i = 0;

    for(BoundKey bind : MacroKey.instance.boundKeys){
            this.listEntries[i] = new GuiKeyBindingsListing.KeyEntry(bind, i);

            int j = mcIn.fontRenderer.getStringWidth(I18n.format(bind.getCommand(), new Object[0]));

            if (j > this.maxListLabelWidth[i])
            {
                this.maxListLabelWidth[i] = j;
            }
        i++;
    }

}
项目:MacroKey    文件:GuiLayerList.java   
public GuiLayerList(GuiManageLayers controls, Minecraft mcIn) {
    super(mcIn, controls.width + 45, controls.height, 63, controls.height - 32, 20);
    this.mc = mcIn;
    this.parent = controls;
    this.listEntries = new GuiListExtended.IGuiListEntry[MacroKey.instance.layers.size()];
    this.maxListLabelWidth = new int[MacroKey.instance.layers.size()];

    int i = 0;

    for(Layer layer : MacroKey.instance.layers){
        this.listEntries[i] = new GuiLayerList.KeyEntry(layer, i);

        int j = mcIn.fontRenderer.getStringWidth(I18n.format(layer.getDisplayName(), new Object[0]));

        if (j > this.maxListLabelWidth[i])
        {
            this.maxListLabelWidth[i] = j;
        }
        i++;
    }

}
项目:Controller-Support    文件:ActionListSelect.java   
private static void setSelectedID(GuiListExtended list, int id) {
    Field field;
    try{
        if(list instanceof GuiListWorldSelection) {
            field = GuiListWorldSelection.class.getDeclaredField("selectedIdx");
        } else {
            field = GuiSlot.class.getDeclaredField("selectedElement");
        }
        field.setAccessible(true);
        field.set(list, id);
        if(list instanceof GuiListWorldSelection) {
            ((GuiListWorldSelection) list).selectWorld(id);
        }
    } catch (Exception e) {
        throw new RuntimeException("Error accessing index field!", e);
    }
}
项目:Coherence    文件:CoherenceSSL.java   
/**
 * Gets the IGuiListEntry object for the given index
 */
public GuiListExtended.IGuiListEntry getListEntry(int index)
{
    if (index < this.slenList.size())
    {
        return (GuiListExtended.IGuiListEntry)this.slenList.get(index);
    }
    else
    {
        index = index - this.slenList.size();

        if (index == 0)
        {
            return this.lanScanEntry;
        }
        else
        {
            --index;
            return (GuiListExtended.IGuiListEntry)this.sleldList.get(index);
        }
    }
}
项目:morecommands    文件:PatchEntityPlayerSP.java   
@Override
public void connectToSelected() {
    ServerSelectionList selector = ReflectionHelper.get(ObfuscatedField.GuiMultiplayer_serverListSelector, serverListSelector, this);

    if (selector == null) {
        PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(PatchList.PATCH_ENTITYPLAYERSP, false);
        super.connectToSelected();

        return;
    }

    GuiListExtended.IGuiListEntry entry = selector.getSelected() < 0 ? null : selector.getListEntry(selector.getSelected());

       if (entry instanceof ServerListEntryNormal)
        this.connectToServer(((ServerListEntryNormal) entry).getServerData());
       else if (entry instanceof ServerListEntryLanDetected) {
        LanServerInfo lanserverinfo = ((ServerListEntryLanDetected) entry).getServerData();
        this.connectToServer(new ServerData(lanserverinfo.getServerMotd(), lanserverinfo.getServerIpPort(), true));
       }
   }
项目:CubesEdge    文件:GuiMovementList.java   
public GuiMovementList(GuiConfig config, Minecraft mc) {
    super(mc, config.width, config.height, 43, config.height - 32, 20);
    this.config = config;
    this.mc = mc;
    Object[] aObject = ArrayUtils.clone(Util.getMovements());
    this.listEntry = new GuiListExtended.IGuiListEntry[aObject.length];
    int i = 0;
    Object[] aObject1 = aObject;
    int j = aObject.length;

    for (int k = 0; k < j; ++k) {
        Movement movement = (Movement) aObject1[k];

        int l = mc.fontRenderer.getStringWidth(movement.getName());

        if (l > this.lenghtName) {
            this.lenghtName = l;
        }

        this.listEntry[i++] = new GuiMovementList.MovementEntry(movement);
    }
}
项目:Controller-Support    文件:ActionListSelect.java   
@Override
public boolean buttonDown(Pair<Float, Float> arg) {
    float y = arg.getRight();
    if(y == 0) return true;
    GuiListExtended list = reflectiveRetrieve();
    if(list == null)
        throw new RuntimeException("The current gui has no GuiListExtended!");
    int listSize = getListSize(list);
    for(int i = 0; i < listSize; i++) {
        if(isSelected(list, i)) {
            int newID = 0;
            if(y > 0) {
                newID = i + 1;
            } else if (y < 0) {
                newID = i - 1;
            }
            if(newID < 0)
                newID = 0;
            if(newID >= listSize) 
                newID = listSize - 1;
            setSelectedID(list, newID);
            return true;
        }
    }
    setSelectedID(list, 0);
    return true;
}
项目:Controller-Support    文件:ActionListSelect.java   
private static boolean isSelected(GuiListExtended list, int id) {
    try {
        Method method = GuiSlot.class.getDeclaredMethod("isSelected", int.class);
        method.setAccessible(true);
        return (boolean) method.invoke(list, id);
    } catch (Exception e) {
        throw new RuntimeException("Error accessing getSize()-Method!", e);
    }
}
项目:Controller-Support    文件:ActionListSelect.java   
private static int getListSize(GuiListExtended list) {
    try {
        Method method = GuiSlot.class.getDeclaredMethod("getSize");
        method.setAccessible(true);
        return (int) method.invoke(list);
    } catch (Exception e) {
        throw new RuntimeException("Error accessing getSize()-Method!", e);
    }
}
项目:Controller-Support    文件:ActionListSelect.java   
private static GuiListExtended reflectiveRetrieve() {
    GuiScreen screen = Minecraft.getMinecraft().currentScreen;
    for(Field field : screen.getClass().getDeclaredFields()) {
        if(GuiListExtended.class.isAssignableFrom(field.getType())) {
            field.setAccessible(true);
            try {
                return (GuiListExtended) field.get(screen);
            } catch (Exception e) {
                throw new RuntimeException("Couldn't access field " + field.getName() + "!", e);
            }
        }
    }
    return null;
}
项目:CreeperHostGui    文件:ServerSelectionListPublic.java   
@Override
public GuiListExtended.IGuiListEntry getListEntry(int index)
{
    return super.getListEntry(index);
}
项目:MacroKey    文件:GuiKeyBindingsListing.java   
public GuiKeyBindingsListing(GuiManageKeybindings controls, Minecraft mcIn, Layer layer) {
    super(mcIn, controls.width + 45, controls.height, 63, controls.height - 32, 20);
    this.mc = mcIn;
    this.guiKeybindings = controls;

    boundKeyList = MacroKey.instance.boundKeys;

    if(layer==null){
        isMaster=true;
    }else{
        isMaster=false;
        this.currentLayer=layer;
        /*boundKeyList = new ArrayList<BoundKey>();
        for (Layer layer1 : MacroKey.instance.layers) {
            if(layer1 == layer){
                for (UUID uuid:layer.getBoundKeyList()) {
                    boundKeyList.add(BoundKey.getKeyfromUUID(uuid));
                }
            }
        }*/


    }


    this.listEntries = new GuiListExtended.IGuiListEntry[boundKeyList.size()];
    this.maxListLabelWidth = new int[boundKeyList.size()];

    int i = 0;

    for(BoundKey bind : boundKeyList){
        this.listEntries[i] = new GuiKeyBindingsListing.KeyEntry(bind, i);

        int j = mcIn.fontRenderer.getStringWidth(I18n.format(bind.getCommand(), new Object[0]));

        if (j > this.maxListLabelWidth[i])
        {
            this.maxListLabelWidth[i] = j;
        }
        i++;
    }

}
项目:mcpvp-mod    文件:GuiEditBoxProps.java   
@Override
public GuiListExtended.IGuiListEntry getListEntry(int entry) {
    return entries.get(entry);
}
项目:Snitch-Visualizer    文件:GuiSnitchList.java   
public GuiSnitchList(GuiEditSnitches guiSnitches, Minecraft mc) {
    super(mc, 
            guiSnitches.width,      // width
            guiSnitches.height,         // height
            32,                         // top
            guiSnitches.height - 32,    // bottom
            20);                        // slot size

    this.guiSnitches = guiSnitches;
    this.mc = mc;

    int listSize = SV.instance.snitchList.size(); // TODO: replace with method
    this.iGuiList = new GuiListExtended.IGuiListEntry[listSize];

    int i = 0;

    this.nameWidth = 1;
    this.ctGroupWidth = mc.fontRendererObj.getStringWidth("WWWWWWWWWWWWWWWWWWWW ");
    this.worldWidth = mc.fontRendererObj.getStringWidth("WWWWWWWWWWW ");
    this.coordWidth = mc.fontRendererObj.getStringWidth("-9999  ");
    this.nameSpace = this.width - this.coordWidth * 3 - this.worldWidth - this.ctGroupWidth - 100;
    this.entryWidth = 1;

    for (int k = 0; k < listSize; ++k) {
        Snitch snitch = SV.instance.snitchList.get(k);

        int l = mc.fontRendererObj.getStringWidth(snitch.getCtGroup() + "  ");
        if (l > this.ctGroupWidth) {
            this.ctGroupWidth = l;
        }

        l = mc.fontRendererObj.getStringWidth(snitch.getName() + "  ");
        if (l > this.nameWidth) {
            this.nameWidth = l;
        }

        l = mc.fontRendererObj.getStringWidth(snitch.getWorld() + "  ");
        if (l > this.worldWidth) {
            this.worldWidth = l;
        }

        l = this.coordWidth * 3 + this.ctGroupWidth + this.nameWidth + this.worldWidth;
        if (l > this.entryWidth) {
            this.entryWidth = l;
        }

        this.iGuiList[i++] = new GuiSnitchList.ListEntry(snitch);
    }

    if (this.nameWidth > this.nameSpace) {
        this.nameWidth = this.nameSpace;
    }
    if (this.ctGroupWidth > this.nameSpace) {
        this.ctGroupWidth = this.nameSpace;
    }

    this.setHasListHeader(true, (int) ( (float) GuiSnitchList.this.mc.fontRendererObj.FONT_HEIGHT * 1.5));
}
项目:Snitch-Visualizer    文件:GuiSnitchList.java   
/**
 * Gets the IGuiListEntry object for the given index
 */
public GuiListExtended.IGuiListEntry getListEntry(int index) {
    return this.iGuiList[index];
}
项目:MineMenu    文件:GuiControlList.java   
@Override
@Nonnull
public GuiListExtended.IGuiListEntry getListEntry(int index) {
    return list.get(index);
}
项目:CubesEdge    文件:GuiMovementList.java   
/**
 * Gets the IGuiListEntry object for the given index
 */
public GuiListExtended.IGuiListEntry getListEntry(int slot) {
    return this.listEntry[slot];
}