本文整理汇总了Java中net.minecraft.client.gui.GuiListExtended类的典型用法代码示例。如果您正苦于以下问题:Java GuiListExtended类的具体用法?Java GuiListExtended怎么用?Java GuiListExtended使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GuiListExtended类属于net.minecraft.client.gui包,在下文中一共展示了GuiListExtended类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GuiKeyBindingsListing
import net.minecraft.client.gui.GuiListExtended; //导入依赖的package包/类
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++;
}
}
示例2: GuiLayerList
import net.minecraft.client.gui.GuiListExtended; //导入依赖的package包/类
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++;
}
}
示例3: setSelectedID
import net.minecraft.client.gui.GuiListExtended; //导入依赖的package包/类
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);
}
}
示例4: getListEntry
import net.minecraft.client.gui.GuiListExtended; //导入依赖的package包/类
/**
* 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);
}
}
}
示例5: connectToSelected
import net.minecraft.client.gui.GuiListExtended; //导入依赖的package包/类
@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));
}
}
示例6: GuiMovementList
import net.minecraft.client.gui.GuiListExtended; //导入依赖的package包/类
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);
}
}
示例7: buttonDown
import net.minecraft.client.gui.GuiListExtended; //导入依赖的package包/类
@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;
}
示例8: isSelected
import net.minecraft.client.gui.GuiListExtended; //导入依赖的package包/类
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);
}
}
示例9: getListSize
import net.minecraft.client.gui.GuiListExtended; //导入依赖的package包/类
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);
}
}
示例10: reflectiveRetrieve
import net.minecraft.client.gui.GuiListExtended; //导入依赖的package包/类
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;
}
示例11: getListEntry
import net.minecraft.client.gui.GuiListExtended; //导入依赖的package包/类
@Override
public GuiListExtended.IGuiListEntry getListEntry(int index)
{
return super.getListEntry(index);
}
示例12: GuiKeyBindingsListing
import net.minecraft.client.gui.GuiListExtended; //导入依赖的package包/类
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++;
}
}
示例13: getListEntry
import net.minecraft.client.gui.GuiListExtended; //导入依赖的package包/类
@Override
public GuiListExtended.IGuiListEntry getListEntry(int entry) {
return entries.get(entry);
}
示例14: GuiSnitchList
import net.minecraft.client.gui.GuiListExtended; //导入依赖的package包/类
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));
}
示例15: getListEntry
import net.minecraft.client.gui.GuiListExtended; //导入依赖的package包/类
/**
* Gets the IGuiListEntry object for the given index
*/
public GuiListExtended.IGuiListEntry getListEntry(int index) {
return this.iGuiList[index];
}