本文整理匯總了Java中cpw.mods.fml.common.eventhandler.EventPriority.LOW屬性的典型用法代碼示例。如果您正苦於以下問題:Java EventPriority.LOW屬性的具體用法?Java EventPriority.LOW怎麽用?Java EventPriority.LOW使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類cpw.mods.fml.common.eventhandler.EventPriority
的用法示例。
在下文中一共展示了EventPriority.LOW屬性的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: gunRenderEvent
@SubscribeEvent(priority=EventPriority.LOW)
public void gunRenderEvent(RenderPlayerEvent.Pre event) {
ItemStack item = event.entityPlayer.getHeldItem();
RenderPlayer rp = event.renderer;
if (item != null && item.getItem() instanceof ItemGun) {
rp.modelBipedMain.aimedBow = true;
rp.modelArmor.aimedBow = true;
rp.modelArmorChestplate.aimedBow = true;
}
else {
rp.modelBipedMain.aimedBow = false;
rp.modelArmor.aimedBow = false;
rp.modelArmorChestplate.aimedBow = false;
}
}
示例2: gunRenderEvent
@SubscribeEvent(priority=EventPriority.LOW)
public void gunRenderEvent(RenderPlayerEvent.Pre event) {
ItemStack item = event.entityPlayer.getHeldItem();
RenderPlayer rp = event.renderer;
if (item != null && (item.getItem() instanceof ItemFusionGun || item.getItem() instanceof ItemRocketLauncher)) {
rp.modelBipedMain.aimedBow = true;
rp.modelArmor.aimedBow = true;
rp.modelArmorChestplate.aimedBow = true;
} else {
rp.modelBipedMain.aimedBow = false;
rp.modelArmor.aimedBow = false;
rp.modelArmorChestplate.aimedBow = false;
}
}
示例3: on
@SubscribeEvent(priority = EventPriority.LOW)
public void on(EntityJoinWorldEvent event) {
if(!event.world.isRemote && event.entity instanceof EntityItem) {
ItemStack stack = ((EntityItem) event.entity).getEntityItem();
if(isDisguised(stack)) {
long time = event.world.getTotalWorldTime() + event.world.rand.nextInt(60) + 40;
trackedItems.put((EntityItem) event.entity, time);
}
if(stack.getItem() instanceof ItemElement && !(event.entity instanceof EntityItemElement)) {
event.setCanceled(true);
EntityItem newItem = new EntityItemElement(event.world,
event.entity.posX, event.entity.posY, event.entity.posZ,
((EntityItem) event.entity).getEntityItem());
newItem.delayBeforeCanPickup = ((EntityItem) event.entity).delayBeforeCanPickup;
newItem.motionX = event.entity.motionX;
newItem.motionY = event.entity.motionY;
newItem.motionZ = event.entity.motionZ;
event.world.spawnEntityInWorld(newItem);
}
}
}
示例4: onPlayerLoggedIn
@SubscribeEvent(priority = EventPriority.LOW)
public void onPlayerLoggedIn(EntityJoinWorldEvent event) {
if (event.entity instanceof EntityPlayerMP) {
EntityPlayerMP player = (EntityPlayerMP) event.entity;
System.out.println("UUID of player: " + player.getUniqueID());
System.out.println("ID of player: " + event.entity.getEntityId());
UUIDOffline.snw.sendTo(new ActualUUIDMessage(player.getUniqueID().toString()), player);
}
}
示例5: onRenderBar
@SubscribeEvent(priority = EventPriority.LOW)
public void onRenderBar(RenderGameOverlayEvent event) {
if (event.isCancelable() || event.type != ElementType.ALL || mc.thePlayer.getHeldItem() == null ||
!(mc.thePlayer.getHeldItem().getItem() instanceof IMagicalItem)) {
return;
}
IMagicalItem f = (IMagicalItem) mc.thePlayer.getHeldItem().getItem();
// Starting position for the buff bar - 2 pixels from the top left corner.
int xPos = 2;
int yPos = 100;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_LIGHTING);
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("dynamiccraft", "textures/gui/magic.png"));
this.drawTexturedModalRect(xPos, yPos, 6, 0, 5, 70);
int i1;
if (f.getMagic(mc.thePlayer.getHeldItem()) > 0) {
i1 = f.getMagic(mc.thePlayer.getHeldItem()) * 70 / f.getMaxMagic(mc.thePlayer.getHeldItem());
this.drawTexturedModalRect(xPos, yPos + 70 - i1, 0, 70 - i1, 5, i1);
}
}
示例6: onWorldDecoration
@SubscribeEvent(priority = EventPriority.LOW)
public void onWorldDecoration(final DecorateBiomeEvent.Decorate event) {
if (isGenerationAllowed(event)) {
// Calculate the range and scaling based on
// the world sea level. Normal sea level is assumed
// to be 64, which is the Overworld sea level.
final int groundLevel = event.world.provider.getAverageGroundLevel();
final int attempts = (int) (ModOptions.getRubblePileDensity() * ((float) groundLevel / 64F));
final int maxY = groundLevel - 4;
final int spread = maxY - MIN_Y;
// In case someone does something real funky with a
// dimension.
if (spread < 1 || attempts < 1)
return;
// Use our random routine, but seed with the provided
// Random. The provided Random seed is deterministic
// where map gen is concerned.
final XorShiftRandom random = new XorShiftRandom(event.rand);
for (int i = 0; i < attempts; i++) {
final int x = event.chunkX + random.nextInt(16) + 8;
final int z = event.chunkZ + random.nextInt(16) + 8;
int y = random.nextInt(spread) + MIN_Y;
for (int j = 0; j < PLACE_ATTEMPTS; j++) {
if (event.world.isAirBlock(x, y, z)
&& BlockManager.pileOfRubble.canBlockStay(event.world, x, y, z)) {
event.world.setBlock(x, y, z, BlockManager.pileOfRubble);
break;
}
y--;
}
}
}
}
示例7: chatEvent
@SubscribeEvent(priority = EventPriority.LOW)
public void chatEvent(ServerChatEvent event)
{
String name = event.player.getDisplayName();
for (int i = 0; i < chats.size(); i++) {
if (chats.get(i).getUsername().equals(name)) {
chats.get(i).send(event.message);
}
}
}
示例8: onRenderExperienceBar
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.LOW)
public void onRenderExperienceBar(RenderGameOverlayEvent event)
{
if (event.isCancelable() || event.type != ElementType.ALL)
return;
LocX = ConfigBaublesHud.hudPositionX;
LocY = ConfigBaublesHud.hudPositionY;
isVertical = ConfigBaublesHud.isVertical;
scale = ConfigBaublesHud.hudScale;
if(isVertical == 0)
{
LocOffsetY = 15;
LocOffsetX = 0;
}
if(isVertical == 1)
{
LocOffsetY = 0;
LocOffsetX = 15;
}
if (mc.inGameHasFocus || mc.currentScreen == null || (mc.currentScreen instanceof GuiChat) || (mc.currentScreen instanceof GuiHud) && !mc.gameSettings.showDebugInfo)
{
if(ConfigBaublesHud.enable == 0)
drawBaublesHudIcons(event.resolution);
}
}
示例9: onLoadWorld
@SubscribeEvent(priority=EventPriority.LOW)
public void onLoadWorld(WorldEvent.Load event) {
if(event.world.provider.dimensionId == 0) {
if(event.world.isRemote) {
FMLCommonHandler.instance().bus().register(ModManager.getPlayerTickEventHandler());
} else {
ModManager.registerAnvilRecipes();
}
}
}
示例10: onPlayerInteract
@SubscribeEvent(priority=EventPriority.LOW)
public void onPlayerInteract(PlayerInteractEvent event) {
BlockDoor door = (BlockDoor)Blocks.wooden_door;
BlockLocation loc = BlockLocation.get(event.world, event.x, event.y, event.z);
if ((event.action != Action.RIGHT_CLICK_BLOCK) ||
event.entityPlayer.isSneaking() ||
!(loc.getBlock() == door)) return;
int direction = getDoorOrientation(door, loc);
boolean isOpen = isDoorOpen(door, loc);
boolean isMirrored = isDoorMirrored(door, loc);
int i = (isMirrored ? -1 : 1);
switch (direction) {
case 0: loc = loc.relative(0, 0, i); break;
case 1: loc = loc.relative(-i, 0, 0); break;
case 2: loc = loc.relative(0, 0, -i); break;
case 3: loc = loc.relative( i, 0, 0); break;
}
if ((loc.getBlock() == door) &&
(getDoorOrientation(door, loc) == direction) &&
(isDoorOpen(door, loc) == isOpen) &&
(isDoorMirrored(door, loc) != isMirrored))
door.onBlockActivated(loc.world, loc.x, loc.y, loc.z, event.entityPlayer, event.face, 0, 0, 0);
}
示例11: playerDies
@SubscribeEvent(priority = EventPriority.LOW)
public void playerDies(LivingDeathEvent event)
{
if (Utils.notNullAndInstanceOf(event.entity, EntityPlayer.class))
{
EntityPlayer player = (EntityPlayer) event.entity;
if (!player.worldObj.isRemote)
{
//LogHelper.info("Player died");
BackpackProperty props = BackpackProperty.get(player);
if (props.hasWearable())
{
//We want to keep the wearables on the player if KeepInventory is active.
if (!player.getEntityWorld().getGameRules().getGameRuleBooleanValue("keepInventory"))
{
//So if it isn't, we drop it like it's hot, drop it like it's hot, drop it like it's hot.
((IBackWearableItem) props.getWearable().getItem()).onPlayerDeath(player.worldObj, player, props.getWearable());
}
}
if (props.isForcedCampFire())
{
ChunkCoordinates lastCampFire = BackpackProperty.get(player).getCampFire();
if (lastCampFire != null)
{
player.setSpawnChunk(lastCampFire, false, player.dimension);
}
//Set the forced spawn coordinates on the campfire. False, because the player must respawn at spawn point if there's no campfire.
}
ServerProxy.storePlayerProps(player);
}
}
event.setResult(Event.Result.ALLOW);
}
示例12: playerInteract
@SubscribeEvent(priority = EventPriority.LOW)
public void playerInteract(PlayerInteractEvent event){
if(!Config.convertMultipartsToBlocks && event.action == Action.RIGHT_CLICK_BLOCK && event.entityPlayer.worldObj.isRemote) {
if(placing.get() != null) return;//for mods that do dumb stuff and call this event like MFR
placing.set(event);
if(place(event.entityPlayer, event.entityPlayer.worldObj)) event.setCanceled(true);
placing.set(null);
}
}