当前位置: 首页>>代码示例>>Java>>正文


Java EventPriority.NORMAL属性代码示例

本文整理汇总了Java中net.minecraftforge.fml.common.eventhandler.EventPriority.NORMAL属性的典型用法代码示例。如果您正苦于以下问题:Java EventPriority.NORMAL属性的具体用法?Java EventPriority.NORMAL怎么用?Java EventPriority.NORMAL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在net.minecraftforge.fml.common.eventhandler.EventPriority的用法示例。


在下文中一共展示了EventPriority.NORMAL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onEvent

@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true)
public static void onEvent(KeyInputEvent event) {
	Minecraft mc = Minecraft.getMinecraft();
	EntityPlayer player = mc.player;

	CartCapability entityData = player.getCapability(Currency.CART_DATA, null);

	boolean isEmpty = true;

	if (entityData != null && entityData.getCart() != null) {
		for (ItemStack stack : entityData.getCart()) {
			if (!stack.isEmpty()) {
				isEmpty = false;
			}
		}
	}

	if (!isEmpty && openList.isPressed()) {
		Minecraft.getMinecraft().player.openGui(Currency.INSTANCE, 5, mc.world, (int) player.posX, (int) player.posY, (int) player.posZ);
	}
}
 
开发者ID:Zundrel,项目名称:Never-Enough-Currency,代码行数:22,代码来源:KeybindHandler.java

示例2: onItemCraft

@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true)
public void onItemCraft(ItemCraftedEvent event) {
	Item item = event.crafting.getItem();
	if (item == HFItems.seeds_hemp_crushed || item == HFItems.seeds_indica_crushed
			|| item == HFItems.seeds_sativa_crushed) {
		for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) {
			if (event.craftMatrix.getStackInSlot(i) != null) {
				ItemStack stack = event.craftMatrix.getStackInSlot(i);
				if (stack.getItem() instanceof ItemShears) {
					if (stack.getItemDamage() < stack.getMaxDamage()) {
						stack.shrink(1);
						stack.setItemDamage(stack.getItemDamage() + 1);
						event.craftMatrix.setInventorySlotContents(i, stack);
					}
				}
			}
		}
	}
	

}
 
开发者ID:MinecraftModDevelopmentMods,项目名称:HempFarmer,代码行数:21,代码来源:HempFarmer.java

示例3: rainOverrideGR

@SubscribeEvent(priority = EventPriority.NORMAL)
public void rainOverrideGR (TickEvent.ServerTickEvent event) {
    WorldInfo worldinfo = GameInfo.worldInfo;
    GameRules gameRules = GameInfo.gameRules;

    try {
        if (!gameRules.getBoolean("doWeather")) {
            gameRules.setOrCreateGameRule("doWeather", "true");
            gameRules.setOrCreateGameRule("doWeatherCycle", "false");
            LogHelper.info("Switched weather GameRule over to Vanilla GameRule.");
        }
    }
    catch (Exception e) {
        LogHelper.error("Exception in RainOverride: " + e);
    }
}
 
开发者ID:fabbe50,项目名称:TFICore,代码行数:16,代码来源:EventRainOverride.java

示例4: onItemCraftedEvent

@SubscribeEvent(priority = EventPriority.NORMAL)
public void onItemCraftedEvent(ItemCraftedEvent event){
    //System.out.println(event.crafting.getUnlocalizedName());
    if (event.crafting.getUnlocalizedName().equals("item.stick")){
        int random_number = (int) (Math.random() * 4);
        if (!event.player.world.isRemote) {
            event.player.inventory.addItemStackToInventory(new ItemStack(ModItems.brokenstick, random_number));
            event.crafting.shrink(random_number);
            if (event.player instanceof EntityPlayerMP){
                ((EntityPlayerMP) event.player).sendContainerToPlayer(event.player.inventoryContainer);
            }
        }
    }
}
 
开发者ID:DeflatedPickles-Old-Repositories,项目名称:JustJunk,代码行数:14,代码来源:FMLEventHandlerCommon.java

示例5: onLivingEntityUseItemEventFinish

@SubscribeEvent(priority = EventPriority.NORMAL)
public void onLivingEntityUseItemEventFinish(LivingEntityUseItemEvent.Finish event) {
    if (the_item.equals("item.apple")){
        if (!event.getEntityLiving().world.isRemote){
            EntityItem item = new EntityItem(event.getEntityLiving().world, event.getEntityLiving().posX, event.getEntityLiving().posY, event.getEntityLiving().posZ, new ItemStack(ModItems.applecore, 1));
            event.getEntityLiving().world.spawnEntity(item);
        }
    }
}
 
开发者ID:DeflatedPickles-Old-Repositories,项目名称:JustJunk,代码行数:9,代码来源:EventHandlerCommon.java

示例6: onHarvestDropsEvent

@SubscribeEvent(priority = EventPriority.NORMAL)
public void onHarvestDropsEvent(HarvestDropsEvent event){
    // System.out.println("Block: " + event.getState().getBlock().getUnlocalizedName());
    if (event.getState().getBlock() == Blocks.DIAMOND_ORE){
        int random_number = (int) (Math.random() * 5);
        System.out.println(random_number);
        if (random_number == 4) {
            event.getDrops().clear();
            event.getDrops().add(new ItemStack(ModItems.crackeddiamond));
        }
    }
}
 
开发者ID:DeflatedPickles-Old-Repositories,项目名称:JustJunk,代码行数:12,代码来源:EventHandlerCommon.java

示例7: onEvent

@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true)
public void onEvent(KeyInputEvent event) {
	KeyBinding[] keyBindings = ClientProxy.keyBindings;
	if (keyBindings[0].isPressed()) {
		// TODO convert this to a toggle so that it opens and closes the gui
		NemesisSystem.NETWORK.sendToServer(new MessageOpenNemesisGuiRequest());
	}
}
 
开发者ID:ToroCraft,项目名称:NemesisSystem,代码行数:8,代码来源:InputHandler.java

示例8: onEvent

@SideOnly(Side.CLIENT)
@SubscribeEvent(priority= EventPriority.NORMAL, receiveCanceled=true)
public void onEvent(InputEvent.KeyInputEvent event)
{
	KeyBinding[] keyBindings = MacroKey.forgeKeybindings;

	if (keyBindings[0].isPressed())
	{
		Minecraft.getMinecraft().player.openGui(MacroKey.instance, 5002, Minecraft.getMinecraft().world, (int) Minecraft.getMinecraft().player.posX, (int) Minecraft.getMinecraft().player.posY, (int) Minecraft.getMinecraft().player.posZ);
	}

	for(int i = 0; i< Layer.getActiveKeys().size(); i++) {
		if(Keyboard.isKeyDown(Layer.getActiveKeys().get(i).getKeyCode()) & (!Layer.getActiveKeys().get(i).isPressed())){
			Layer.getActiveKeys().get(i).setPressed(true);

			String command = Layer.getActiveKeys().get(i).getCommand();
			if(command.contains("exec") || (command.contains("sleep") & command.contains(";"))) {
				ParseCommand.parse(command);
			}else{
				if (net.minecraftforge.client.ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().player, command) != 0) {return;}
				Minecraft.getMinecraft().player.sendChatMessage(command);
			}

		}
		if(!Keyboard.isKeyDown(Layer.getActiveKeys().get(i).getKeyCode())){
			Layer.getActiveKeys().get(i).setPressed(false);
		}
	}
}
 
开发者ID:Matts,项目名称:MacroKey,代码行数:29,代码来源:IngameEventHandler.java

示例9: onEvent

@SubscribeEvent(priority = EventPriority.NORMAL)
public void onEvent(ConfigChangedEvent.OnConfigChangedEvent event) {
    if (TAIGA.MODID.equals(event.getModID()) && !event.isWorldRunning()) {
        if (event.getConfigID().equals(CATEGORY_NAME_GENERAL) || event.getConfigID().equals(CATEGORY_NAME_ORE_GEN)) {
            syncFromGUI();
        }
    }
}
 
开发者ID:TeamFRM,项目名称:TAIGA,代码行数:8,代码来源:TAIGAConfiguration.java

示例10: onRenderExperienceBar

@SubscribeEvent(priority=EventPriority.NORMAL)
public void onRenderExperienceBar(RenderGameOverlayEvent.Post event) {
	if (event.getType() != ElementType.EXPERIENCE) {
		return;
	}

	CapabilityMana.IMana props = mc.player.getCapability(CapabilityMana.MANA, null);
	if (props == null || props.getMaxMana() == 0) {
		return;
	}

	int xPos = 2;
	int yPos = 2;
	this.mc.getTextureManager().bindTexture(texture);

	// Add this block of code before you draw the section of your texture containing transparency
	GlStateManager.pushAttrib();
	GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
	GlStateManager.disableLighting();
	// alpha test and blend needed due to vanilla or Forge rendering bug
	GlStateManager.enableAlpha();
	GlStateManager.enableBlend();
	// Here we draw the background bar which contains a transparent section; note the new size
	drawTexturedModalRect(xPos, yPos, 0, 0, 56, 9);
	// You can keep drawing without changing anything
	int manabarwidth = (int)(((float) props.getMana() / props.getMaxMana()) * 49);
	drawTexturedModalRect(xPos + 3, yPos + 3, 0, 9, manabarwidth, 3);
	String s = Utils.translateToLocal("gui.manaBar.mana") + " " + props.getMana() + "/" + props.getMaxMana();
	yPos += 10;
	this.mc.fontRenderer.drawString(s, xPos + 1, yPos, 0);
	this.mc.fontRenderer.drawString(s, xPos - 1, yPos, 0);
	this.mc.fontRenderer.drawString(s, xPos, yPos + 1, 0);
	this.mc.fontRenderer.drawString(s, xPos, yPos - 1, 0);
	this.mc.fontRenderer.drawString(s, xPos, yPos, 8453920);
	GlStateManager.popAttrib();
}
 
开发者ID:Ohrm,项目名称:Malgra,代码行数:36,代码来源:GuiManaBar.java

示例11: onRenderOverlay

@SubscribeEvent(priority = EventPriority.NORMAL)
public void onRenderOverlay(RenderGameOverlayEvent.Pre event) {
	if (event.getType() == ElementType.HELMET && Minecraft.getMinecraft().currentScreen instanceof GuiCamera) {
		event.setCanceled(true);
	} else if (event.getType() == ElementType.TEXT && profile) {
		displayDebugInfo();
	}
	if (i > 0)
		i--;
}
 
开发者ID:tom5454,项目名称:Toms-Mod,代码行数:10,代码来源:EventHandlerClient.java

示例12: clearRainOnPlayerOnline

@SubscribeEvent(priority = EventPriority.NORMAL)
public void clearRainOnPlayerOnline(TickEvent.ServerTickEvent event) {
	MinecraftServer server = GameInfo.server;
	World world = GameInfo.world;

	if (!world.isRemote) {
		WorldInfo worldinfo = GameInfo.worldInfo;
           String[] players = server.getPlayerList().getOnlinePlayerNames();

           try {
               if (worldinfo.getCleanWeatherTime() <= 1000 && server.getPlayerList().getCurrentPlayerCount() > 0) {    //if the weather turns to rain and the there are at least 1 player
                   for (int j = 0; j < server.getPlayerList().getCurrentPlayerCount(); j++) {
                       if ((!Configs.chaacRainGod && majorityDecides(server, world)) || (Configs.chaacRainGod && world.playerEntities.get(j).getTags().contains("norain"))) { //If chaacRainGod is false, the majority of the server is what decides whether or not the rain will go away.
                           worldinfo.setCleanWeatherTime(LogicHelper.getRainTime());                                   //Sets the clear-weather for .5 to 7.5 Minecraft days
                           worldinfo.setRainTime(0);                                                                   //Sets the rain-time to 0
                           worldinfo.setThunderTime(0);                                                                //Sets the thunder-time to 0
                           worldinfo.setRaining(false);                                                                //Turns off rain
                           worldinfo.setThundering(false);                                                             //Turns off thunder
                           LogHelper.info("Rain Blocked for " + worldinfo.getCleanWeatherTime() + "!");                //Notifies the console
                           break;                                                                                      //Breaks the loop
                       }
                   }
               }
           }
           catch (Error e) {
               LogHelper.fatal(e);
               LogHelper.trace(e);
           }
	}
}
 
开发者ID:fabbe50,项目名称:TFICore,代码行数:30,代码来源:EventRainVote.java

示例13: onRender

@SubscribeEvent(priority = EventPriority.NORMAL)
public void onRender(RenderGameOverlayEvent evt)
{
	Minecraft mc = Minecraft.getMinecraft();
//	if ((showScopeOverlap || showSpyglassOverlay) && (mc.player.getActiveItemStack() != selected || !Mouse.isButtonDown(0))) {
//		showScopeOverlap = false;
//		showSpyglassOverlay = false;
//	}
	if (showScopeOverlap || showSpyglassOverlay) {
		// Render scope
		if (evt.getType() == RenderGameOverlayEvent.ElementType.HELMET) {
			if (mc.gameSettings.thirdPersonView == 0) {
				evt.setCanceled(true);
				if (showScopeOverlap)
					showScope();
				else if (showSpyglassOverlay)
					showSpyglass();
			}
		}
		// Remove crosshairs
		else if (evt.getType() == RenderGameOverlayEvent.ElementType.CROSSHAIRS && (showScopeOverlap || showSpyglassOverlay))
			evt.setCanceled(true);
	}
	ItemStack stack = mc.player.getActiveItemStack();
	if (evt.getType() == RenderGameOverlayEvent.ElementType.CROSSHAIRS && (stack != null && stack.getItem() instanceof ItemRangedWeapon))
		evt.setCanceled(true);
	else if (evt.getType() == RenderGameOverlayEvent.ElementType.CROSSHAIRS && !Minecraft.getMinecraft().isGamePaused()) {
		RayTraceResult mop = rayTrace(mc.player, 8, evt.getPartialTicks());
		if (mop != null && mop.typeOfHit == RayTraceResult.Type.BLOCK) {
			TileEntity tile = mc.world.getTileEntity(mop.getBlockPos());
			if (tile instanceof TileEntityCropPlot) {
				tile = ((TileEntityCropPlot) tile).getCenter();
			}
			if (tile instanceof IHoverInfo) {
				ClientUtils.drawIHoverInfoTooltip((IHoverInfo) tile, mc.fontRendererObj, evt, mop.getBlockPos());
			}
		}
	}
}
 
开发者ID:BubbleTrouble14,项目名称:ARKCraft,代码行数:39,代码来源:ClientEventHandler.java

示例14: onLootLoad

@SubscribeEvent(priority= EventPriority.NORMAL)
public void onLootLoad(LootTableLoadEvent event){
	if(event.getName().getResourceDomain().equals("minecraft") == false) return; // loot table from another mod (too fancy for ALT)
	String categoryAndEntry = event.getName().getResourcePath(); // e.g. "chests/abandoned_mineshaft"
	if(categoryAndEntry.contains("/") == false) return; // not valid
	// category is "chests" or "entities"
	String category = categoryAndEntry.substring(0,categoryAndEntry.indexOf('/'));
	// entry is the name of the loot table (e.g. "abandoned_mineshaft")
	String entry = categoryAndEntry.substring(categoryAndEntry.indexOf('/')+1,categoryAndEntry.length());
	final Map<String, Map<String, List<LootPool>>> additional_loot = AdditionalLootTables.getAdditionalLootTables();
	if(additional_loot.containsKey(category)
			&& additional_loot.get(category).containsKey(entry)){
		List<LootPool> pools = additional_loot.get(category).get(entry);
		if(pools == null || pools.isEmpty()) return; // nothing to add
		if(event.getTable() == null) {
			// table was removed by another mod
			FMLLog.info("%s: creating new loot table %s", MODID, event.getName());
			event.setTable(new LootTable(pools.toArray(new LootPool[pools.size()])));
		} else {
			// table exists, add pools to it
			FMLLog.info("%s: adding more loot to loot table %s", MODID, event.getName());
			for (LootPool pool : pools) {
				event.getTable().addPool(pool);
			}
		}
	}
}
 
开发者ID:cyanobacterium,项目名称:AdditionalLootTables,代码行数:27,代码来源:ALTEventHandler.java

示例15: onEvent

@SubscribeEvent(priority = EventPriority.NORMAL)
public void onEvent(ConfigChangedEvent.OnConfigChangedEvent event) {
    if (main.MODID.equals(event.getModID()) && !event.isWorldRunning()) {
        if (event.getConfigID().equals(CATEGORY_NAME_GENERAL) || event.getConfigID().equals(CATEGORY_NAME_OTHER)) {
            syncFromGUI();
        }
    }
}
 
开发者ID:Hoijima,项目名称:Fallout_Equestria,代码行数:8,代码来源:ConfigInit.java


注:本文中的net.minecraftforge.fml.common.eventhandler.EventPriority.NORMAL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。