Java 类net.minecraft.client.gui.GuiSlot 实例源码
项目: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);
}
}
项目: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);
}
}
项目:4-Space-Legacy
文件:GCCoreEventChoosePlanetGui.java
public SlotClicked(List<GuiButton> buttonList, GuiSlot slotClicked)
{
super(buttonList);
this.slotClicked = slotClicked;
}