本文整理汇总了Java中net.minecraftforge.client.event.GuiOpenEvent类的典型用法代码示例。如果您正苦于以下问题:Java GuiOpenEvent类的具体用法?Java GuiOpenEvent怎么用?Java GuiOpenEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GuiOpenEvent类属于net.minecraftforge.client.event包,在下文中一共展示了GuiOpenEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onGuiOpened
import net.minecraftforge.client.event.GuiOpenEvent; //导入依赖的package包/类
@SubscribeEvent
public void onGuiOpened(GuiOpenEvent event) {
if (!hasAutoLogged)
if(event.getGui() instanceof GuiDisconnected &&
!(event.getGui() instanceof GuiDisconnectedOverride)) {
updateLastConnectedServer();
GuiDisconnected disconnected = (GuiDisconnected)event.getGui();
event.setGui(new GuiDisconnectedOverride(
FastReflection.Fields.GuiDisconnected_parentScreen.get(disconnected),
"connect.failed",
FastReflection.Fields.GuiDisconnected_message.get(disconnected),
FastReflection.Fields.GuiDisconnected_reason.get(disconnected),
delay.get()
));
}
}
示例2: onGuiOpenEvent
import net.minecraftforge.client.event.GuiOpenEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onGuiOpenEvent(GuiOpenEvent event)
{
if (event.getGui() == null)
{
// a gui has been closed -- reset remote gui
if (Minecraft.getMinecraft().world instanceof HookedClientWorld)
{
((HookedClientWorld)Minecraft.getMinecraft().world).ClearRemoteGui();
}
else
{
Util.logger.error("Minecraft.getMinecraft().world is not instance of RemoteGuiEnabledClientWorld!");
}
}
}
示例3: onOpenGui
import net.minecraftforge.client.event.GuiOpenEvent; //导入依赖的package包/类
@SubscribeEvent
public void onOpenGui(GuiOpenEvent event) {
if (event.gui instanceof GuiMainMenu) {
event.gui = new RewiMainMenu();
}
if (event.gui instanceof GuiIngameMenu) {
event.gui = new RewiIngameMenu();
}
if (event.gui instanceof GuiOptions) {
event.gui = new RewiOptionsMenu(Minecraft.getMinecraft().currentScreen, Minecraft.getMinecraft().gameSettings);
}
}
示例4: onGuiOpen
import net.minecraftforge.client.event.GuiOpenEvent; //导入依赖的package包/类
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onGuiOpen(GuiOpenEvent event)
{
if(event.getGui() instanceof GuiMainMenu && !played)
{
played = true;
if(playOn == 1 || playOn == 3)
{
SoundEvent sound = SoundEvent.REGISTRY.getObject(new ResourceLocation(name));
if(sound != null)
{
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(sound, (float)pitch));
}
else
{
logger.log(Level.WARN, "Could not find sound: %s", new ResourceLocation(name));
}
}
}
}
示例5: onGuiOpen
import net.minecraftforge.client.event.GuiOpenEvent; //导入依赖的package包/类
@SubscribeEvent
public void onGuiOpen(GuiOpenEvent event)
{
GuiScreen gui = event.getGui();
if(gui !=null && gui instanceof GuiScreenHorseInventory){
GuiScreenHorseInventory horseGui = (GuiScreenHorseInventory)gui;
EntityHorse horse = (EntityHorse)ReflectionUtils.getPrivateValue(horseGui, GuiScreenHorseInventory.class, ObfuscatedNames.GuiScreenHorseInventory_horseEntity);
if(horse !=null && HorseAccessories.hasEnderChest(horse)){
ContainerHorseChest animalchest = new ContainerHorseChest("HorseChest", 2);
animalchest.setCustomName(horse.getName());
event.setGui(new GuiHorseEnderChest(CrystalMod.proxy.getClientPlayer().inventory, animalchest, horse));
PacketGuiMessage pkt = new PacketGuiMessage("Gui");
pkt.setOpenGui(GuiHandler.GUI_ID_ENTITY, horse.getEntityId(), 0, 0);
CrystalModNetwork.sendToServer(pkt);
}
}
}
示例6: onGuiOpen
import net.minecraftforge.client.event.GuiOpenEvent; //导入依赖的package包/类
@SubscribeEvent
public static void onGuiOpen(@Nonnull final GuiOpenEvent event) {
if (!hasPlayed && event.getGui() instanceof GuiMainMenu) {
hasPlayed = true;
final String[] possibles = ModOptions.startupSoundList;
if (possibles == null || possibles.length == 0)
return;
final String res = possibles[XorShiftRandom.current().nextInt(possibles.length)];
if (!StringUtils.isEmpty(res)) {
final SoundEvent se = SoundEvent.REGISTRY.getObject(new ResourceLocation(res));
if (se != null)
SoundEngine.instance().playSound(new AdhocSound(se, SoundCategory.MASTER));
else
DSurround.log().warn("Unable to locate startup sound [%s]", res);
} else {
DSurround.log().warn("Improperly formatted startup sound list!");
}
}
}
示例7: onGuiOpen
import net.minecraftforge.client.event.GuiOpenEvent; //导入依赖的package包/类
@SubscribeEvent
public void onGuiOpen(GuiOpenEvent event)
{
// if (event.gui instanceof GuiMainMenu)
// {
// {
//
// }
// }
if (event.gui instanceof GuiGameOver)
{
GuiFNAFGameOver.ticksElapsed = 0;
mc.getSoundHandler().stopSounds();
if (!mc.getSoundHandler().isSoundPlaying(FNAFSoundHandler.deathStatic))
{
mc.getSoundHandler().playSound(FNAFSoundHandler.deathStatic);
}
}
}
示例8: guiOpenEvent
import net.minecraftforge.client.event.GuiOpenEvent; //导入依赖的package包/类
@SubscribeEvent
public void guiOpenEvent(GuiOpenEvent event) {
if (event.getGui() instanceof GuiContainer) {
if (lastGui != event.getGui()) {
if (event.getGui() == null) {
instanceTooltipHandlers = null;
} else {
instanceTooltipHandlers = new LinkedList<>();
if (event.getGui() instanceof IContainerTooltipHandler) {
instanceTooltipHandlers.add(((IContainerTooltipHandler) event.getGui()));
}
instanceTooltipHandlers.addAll(tooltipHandlers);
}
lastGui = event.getGui();
}
}
}
示例9: onEvent
import net.minecraftforge.client.event.GuiOpenEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
public void onEvent(GuiOpenEvent event) {
if (event.gui instanceof GuiIngameModOptions) {
event.gui = new GuiModList(new GuiIngameMenu());
}
}
示例10: onGuiOpen
import net.minecraftforge.client.event.GuiOpenEvent; //导入依赖的package包/类
@SubscribeEvent
public void onGuiOpen(GuiOpenEvent event) {
if (event.gui == null) {
return;
}
try {
if (event.gui.getClass() == GuiModList.class) {
event.setCanceled(true);
Minecraft.getMinecraft().displayGuiScreen(new GuiEnhancedModList((GuiScreen) _mainMenu.get(event.gui)));
}
if (event.gui.getClass() == GuiIngameModOptions.class) {
event.setCanceled(true);
Minecraft.getMinecraft().displayGuiScreen(new GuiEnhancedModList((GuiScreen) _parentScreen.get(event.gui)));
}
} catch (Exception e) {
Throwables.propagate(e);
}
}
示例11: onGuiOpen
import net.minecraftforge.client.event.GuiOpenEvent; //导入依赖的package包/类
@SubscribeEvent
public void onGuiOpen(GuiOpenEvent event)
{
GuiScreen gui = event.gui;
if (!Settings.autoRespawn)
{
return;
}
if (gui instanceof GuiGameOver && !hasClicked)
{
Minecraft mc = Minecraft.getMinecraft();
if (!mc.theWorld.getWorldInfo().isHardcoreModeEnabled())
{
hasClicked = true;
mc.thePlayer.respawnPlayer();
mc.displayGuiScreen((GuiScreen) null);
event.setCanceled(true);
}
}
else if (!(gui instanceof GuiGameOver) && hasClicked)
{
hasClicked = false;
}
}
示例12: onGuiOpenEvent
import net.minecraftforge.client.event.GuiOpenEvent; //导入依赖的package包/类
@SubscribeEvent
public void onGuiOpenEvent(GuiOpenEvent event)
{
// Reset the scrolling modifier when the player opens a GUI.
// Otherwise the key up event will get eaten and our scrolling mode will get stuck on
// until the player sneaks again.
// FIXME Apparently there are key input events for GUI screens in 1.8,
// so this probably can be removed then.
InputEventHandler.resetModifiers();
// Opening the player's Inventory GUI
if (event.getGui() != null && event.getGui().getClass() == GuiInventory.class)
{
EntityPlayer player = FMLClientHandler.instance().getClientPlayerEntity();
if (this.handyBagShouldOpen && player != null && ItemHandyBag.getOpenableBag(player).isEmpty() == false)
{
if (event.isCancelable())
{
event.setCanceled(true);
}
PacketHandler.INSTANCE.sendToServer(new MessageOpenGui(player.dimension, ReferenceGuiIds.GUI_ID_HANDY_BAG));
}
}
}
示例13: onOpenGui
import net.minecraftforge.client.event.GuiOpenEvent; //导入依赖的package包/类
@SubscribeEvent
public void onOpenGui(GuiOpenEvent evt) {
GuiScreen gui = evt.getGui();
if (gui instanceof GuiMainMenu) {
try {
GuiMainMenu menu = (GuiMainMenu) gui;
String splash = mainMenuGetSplashText(menu);
if (splash.equals("Kind of dragon free!")) {
splash = "Not really dragon free!";
mainMenuSetSplashText(menu, splash);
} else if (splashLines != null && !splashLines.isEmpty() && rand.nextInt(10) == 0) {
splash = splashLines.get(rand.nextInt(splashLines.size()));
mainMenuSetSplashText(menu, splash);
}
} catch (Throwable t) {
L.warn("Can't override splash", t);
}
}
}
示例14: openMainMenu
import net.minecraftforge.client.event.GuiOpenEvent; //导入依赖的package包/类
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void openMainMenu(GuiOpenEvent e)
{
if (e.gui instanceof GuiMainMenu && Config.replacements.isEmpty() && Config.itemReplacements.isEmpty())
{
File file = new File(configDir, Refs.MOD_ID + "_data");
if (!file.exists())
{
try
{
file.createNewFile();
}
catch (Throwable t)
{
TooManyDanyOres.logger.warn("Unable to create a data file!");
TooManyDanyOres.logger.catching(t);
}
e.gui = new GuiStartupWarning((GuiMainMenu)e.gui);
MinecraftForge.EVENT_BUS.unregister(this);
}
}
}
示例15: onGui
import net.minecraftforge.client.event.GuiOpenEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onGui(GuiOpenEvent event)
{
if (event.gui instanceof GuiMainMenu)
{
if (shouldLoadGUI && ConfigurationHandler.showIRCGui)
{
event.gui = new IRCGui();
shouldLoadGUI = false;
}
else
{
ObfuscationReflectionHelper.setPrivateValue(GuiMainMenu.class, (GuiMainMenu) event.gui, getRandTPPISplash(), "splashText", "field_73975_c");
}
}
}