本文整理汇总了Java中net.minecraft.client.gui.GuiSlot类的典型用法代码示例。如果您正苦于以下问题:Java GuiSlot类的具体用法?Java GuiSlot怎么用?Java GuiSlot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GuiSlot类属于net.minecraft.client.gui包,在下文中一共展示了GuiSlot类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setSelectedID
import net.minecraft.client.gui.GuiSlot; //导入依赖的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);
}
}
示例2: isSelected
import net.minecraft.client.gui.GuiSlot; //导入依赖的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);
}
}
示例3: getListSize
import net.minecraft.client.gui.GuiSlot; //导入依赖的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);
}
}
示例4: SlotClicked
import net.minecraft.client.gui.GuiSlot; //导入依赖的package包/类
public SlotClicked(List<GuiButton> buttonList, GuiSlot slotClicked)
{
super(buttonList);
this.slotClicked = slotClicked;
}