本文整理汇总了Java中cpw.mods.fml.common.eventhandler.EventPriority类的典型用法代码示例。如果您正苦于以下问题:Java EventPriority类的具体用法?Java EventPriority怎么用?Java EventPriority使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EventPriority类属于cpw.mods.fml.common.eventhandler包,在下文中一共展示了EventPriority类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dropEvent
import cpw.mods.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void dropEvent(LivingDropsEvent event) {
if (event.entityLiving.worldObj.isRemote)
return;
if (EtFuturum.enableSkullDrop)
dropHead(event.entityLiving, event.source, event.lootingLevel, event.drops);
Random rand = event.entityLiving.worldObj.rand;
if (EtFuturum.enableMutton && event.entityLiving instanceof EntitySheep) {
int amount = rand.nextInt(3) + 1 + rand.nextInt(1 + event.lootingLevel);
for (int i = 0; i < amount; i++)
if (event.entityLiving.isBurning())
addDrop(new ItemStack(ModItems.cooked_mutton), event.entityLiving, event.drops);
else
addDrop(new ItemStack(ModItems.raw_mutton), event.entityLiving, event.drops);
}
}
示例2: updateSoulDrain
import cpw.mods.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void updateSoulDrain(final LivingSpawnEvent event) {
if (event.world.isRemote) {
return;
}
if (!EntityPlayerMP.class.equals(event.getClass())) {
return;
}
final IAttributeInstance a = event.entityLiving.getAttributeMap().getAttributeInstanceByName(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName());
final AttributeModifier attr = a.getModifier(ItemSoul.uuid);
if (attr == null || attr.getOperation() == 2) {
return;
}
final double l = attr.getAmount() / 20.0;
a.removeModifier(attr);
a.applyModifier(new AttributeModifier(ItemSoul.uuid, "Missing Soul", l, 0));
}
示例3: entityColorRender
import cpw.mods.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void entityColorRender(final RenderLivingEvent.Pre event) {
final String s = EnumChatFormatting.getTextWithoutFormattingCodes(event.entity.getCommandSenderName());
if (s.startsWith("Aureylian") && !(event.entity instanceof EntityPlayer)) {
GL11.glColor4f(0.9686f, 0.7059f, 0.8392f, 1.0f);
this.resetRender = true;
}
if (EventHandlerClient.holograms.contains(s) && (!(event.entity instanceof EntityPlayer) || !((EntityPlayer)event.entity).getHideCape())) {
GL11.glColor4f(1.0f, 1.0f, 1.0f, 0.45f);
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
this.resetRender = true;
}
if (s.equals("RWTema") && !(event.entity instanceof EntityPlayer)) {
GL11.glColor4f(1.0f, 1.0f, 1.0f, 0.65f);
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
this.resetRender = true;
}
if (s.equals("jadedcat") && (!(event.entity instanceof EntityPlayer) || !((EntityPlayer)event.entity).getHideCape())) {
GL11.glColor4f(0.69f, 0.392f, 0.847f, 1.0f);
this.resetRender = true;
}
}
示例4: denyCraft
import cpw.mods.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOWEST)
public void denyCraft(final ToolBuildEvent event) {
if (ExtraUtils.tcon_unstable_material_id <= 0) {
return;
}
final WorldServer world = DimensionManager.getWorld(0);
if (world == null) {
return;
}
if (isToolExpired(event.headStack, world) || isToolExpired(event.handleStack, world) || isToolExpired(event.accessoryStack, world) || isToolExpired(event.extraStack, world)) {
event.headStack = null;
event.handleStack = null;
event.accessoryStack = null;
event.extraStack = null;
}
}
示例5: gunRenderEvent
import cpw.mods.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@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;
}
}
示例6: onServerChat
import cpw.mods.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@SubscribeEvent(priority=EventPriority.LOWEST)
public void onServerChat(ServerChatEvent e)
{
EntityPlayerMP sender = e.player;
List<EntityPlayerMP> players = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
String finalMessage = ChatFormatter.ChatParser(sender);
for (EntityPlayerMP receiver : players)
{receiver.addChatMessage(new ChatComponentText(finalMessage + "<" + e.username + ">: " + e.message));
}
BetterChat.bLog.info(sender.getDisplayName() + " said: " + e.message);
e.setCanceled(true);
}
示例7: onEvent
import cpw.mods.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
public void onEvent(PlayerTickEvent event)
{
if (!ClientProxy.haveWarnedVersionOutOfDate && event.player.worldObj.isRemote
&& !ClientProxy.versionChecker.isLatestVersion())
{
ClickEvent versionCheckChatClickEvent = new ClickEvent(ClickEvent.Action.OPEN_URL,
"http://www.planetminecraft.com/mod/popularmmos-epicproportions-mod-season-9/");
ChatStyle clickableChatStyle = new ChatStyle().setChatClickEvent(versionCheckChatClickEvent);
ChatComponentText versionWarningChatComponent =
new ChatComponentText("Your EpicProportions Mod is not latest version! Click here to update.");
versionWarningChatComponent.setChatStyle(clickableChatStyle);
event.player.addChatMessage(versionWarningChatComponent);
ClientProxy.haveWarnedVersionOutOfDate = true;
}
}
示例8: onEvent
import cpw.mods.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
public void onEvent(PlayerTickEvent event)
{
if (!ClientProxy.haveWarnedVersionOutOfDate && event.player.worldObj.isRemote
&& !ClientProxy.versionChecker.isLatestVersion())
{
ClickEvent versionCheckChatClickEvent = new ClickEvent(ClickEvent.Action.OPEN_URL,
"http://www.planetminecraft.com/mod/popularmmos-epicproportions-mod-season-9/");
ChatStyle clickableChatStyle = new ChatStyle().setChatClickEvent(versionCheckChatClickEvent);
ChatComponentText versionWarningChatComponent =
new ChatComponentText("�4�l" + "Your EpicProportions Mod is not latest version! Click here to update.");
versionWarningChatComponent.setChatStyle(clickableChatStyle);
event.player.addChatMessage(versionWarningChatComponent);
ClientProxy.haveWarnedVersionOutOfDate = true;
}
}
示例9: onPlayerPearl
import cpw.mods.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onPlayerPearl(EnderTeleportEvent event)
{
if ( !(event.entityLiving instanceof EntityPlayerMP) )
return;
if ( Config.getKnockBack() == 0.0 || !Config.getDenyEnderpearl() )
return;
EntityPlayerMP player = (EntityPlayerMP) event.entityLiving;
Log.trace( "Caught pearl teleport event by %s", player.getDisplayName() );
Location target = new Location(event, player);
Location newLoc = BorderCheck.checkPlayer(player, target, true, true);
if (newLoc != null)
{
event.setCanceled(true);
event.targetX = newLoc.posX;
event.targetY = newLoc.posY;
event.targetZ = newLoc.posZ;
}
}
示例10: onWorldDecoration
import cpw.mods.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onWorldDecoration(DecorateBiomeEvent.Decorate event)
{
if ((event.getResult() == Result.ALLOW || event.getResult() == Result.DEFAULT) && event.type == EventType.FLOWERS)
{
for(int i = 0; i < 2; i++)
{
int x = event.chunkX + event.rand.nextInt(16) + 8;
int z = event.chunkZ + event.rand.nextInt(16) + 8;
int y = event.world.getTopSolidOrLiquidBlock(x, z);
if(event.world.isAirBlock(x, y, z) && Blocks.flower_pot.canBlockStay(event.world, x, y, z) && ConfigPrimitiveCraft.genrocks)
{
event.world.setBlock(x, y, z, ModBlocks.rock);
}
else if(event.world.getBlock(x, y, z) == Blocks.water && ConfigPrimitiveCraft.genshale)
{
event.world.setBlock(x, y-1, z, ModBlocks.shale);
}
}
}
}
示例11: onEvent
import cpw.mods.fml.common.eventhandler.EventPriority; //导入依赖的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());
}
}
示例12: entityInteract
import cpw.mods.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = false)
public void entityInteract(final EntityInteractEvent event) {
if(event.entityPlayer instanceof EntityPlayerMP && event.target instanceof EntityAnimal) {
final EntityPlayerMP player = (EntityPlayerMP)event.entityPlayer;
final ItemStack heldItem = player.getCurrentEquippedItem();
if(heldItem != null) {
final EntityAnimal animal = (EntityAnimal)event.target;
if(canBreed(animal, player)) {
final Set<ItemStackKey> possibleFood = foodItems.get(event.target.getClass());
if(possibleFood != null && possibleFood.contains(ItemStackKey.getCachedKey(heldItem))) {
if (!event.entityPlayer.capabilities.isCreativeMode) {
heldItem.stackSize--;
if (heldItem.stackSize <= 0)
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
animal.func_146082_f(player);
}
}
}
}
}
示例13: tickEventEnd
import cpw.mods.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@SubscribeEvent(priority=EventPriority.LOWEST)
public void tickEventEnd(ServerTickEvent event) {
if(event.phase == Phase.END)
{
getTimedGroup("other").endTimer();
root.endTick(true);
if(debugTimer)
System.out.println("Tick time used: " + (root.getTimeUsed()/root.timeMilisecond) + "ms");
//After every world is done ticking, re-balance the time slices according
//to the data gathered during the tick.
root.balanceTime();
//Calculate TPS
updateTPS();
if(saveConfig)
{
saveConfig = false;
config.save();
}
}
}
示例14: gunRenderEvent
import cpw.mods.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@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;
}
}
示例15: onBiomeDecoration
import cpw.mods.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onBiomeDecoration(DecorateBiomeEvent.Decorate event)
{
if (event.type == DecorateBiomeEvent.Decorate.EventType.FLOWERS && (event.getResult() == Event.Result.ALLOW || event.getResult() == Event.Result.DEFAULT))
{
for (int i = 0; i < Settings.FLOWER_QUANTITY; i++)
{
int x = event.chunkX + event.rand.nextInt(16) + 8;
int z = event.chunkZ + event.rand.nextInt(16) + 8;
int y = event.world.getTopSolidOrLiquidBlock(x, z);
Block randomPlant = ModBlocks.plants[event.rand.nextInt(ModBlocks.plants.length)];
if (event.world.isAirBlock(x, y, z) && (!event.world.provider.hasNoSky || y < 255) && randomPlant.canBlockStay(event.world, x, y, z))
{
event.world.setBlock(x, y, z, randomPlant, 0, 2);
}
}
}
}