本文整理汇总了Java中net.minecraftforge.fml.common.eventhandler.EventPriority.HIGHEST属性的典型用法代码示例。如果您正苦于以下问题:Java EventPriority.HIGHEST属性的具体用法?Java EventPriority.HIGHEST怎么用?Java EventPriority.HIGHEST使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraftforge.fml.common.eventhandler.EventPriority
的用法示例。
在下文中一共展示了EventPriority.HIGHEST属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onLivingAttack
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onLivingAttack(LivingAttackEvent event)
{
/*
* Player attacks a monster OR another player
*/
if (event.getSource().getTrueSource() instanceof EntityPlayer && !event.getSource().getTrueSource().getEntityWorld().isRemote)
{
EntityPlayer player = (EntityPlayer) event.getSource().getTrueSource();
EntityLivingBase enemy = event.getEntityLiving();
ItemStack stack = player.inventory.getCurrentItem();
PlayerInformation playerInfo = (PlayerInformation) player.getCapability(CapabilityPlayerInformation.PLAYER_INFORMATION, null);
if (playerInfo != null && stack != null && stack.getItem() instanceof ItemSword && !(stack.getItem() instanceof ItemLEAdvancedMelee))
{
NBTTagCompound nbt = NBTHelper.loadStackNBT(stack);
if (playerInfo.getPlayerLevel() >= nbt.getInteger("Level"))
{
useWeaponAttributes(event.getAmount(), player, enemy, stack, nbt);
}
}
}
}
示例2: onItemTooltip
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onItemTooltip(ItemTooltipEvent event)
{
ArrayList<String> tooltip = (ArrayList<String>) event.getToolTip();
ItemStack stack = event.getItemStack();
NBTTagCompound nbt = NBTHelper.loadStackNBT(stack);
if (event.getEntityPlayer() != null)
{
PlayerInformation info = (PlayerInformation) event.getEntityPlayer().getCapability(CapabilityPlayerInformation.PLAYER_INFORMATION, null);
if (info != null && (stack.getItem() instanceof ItemSword || stack.getItem() instanceof ItemArmor || stack.getItem() instanceof ItemLEMagical || stack.getItem() instanceof ItemLEBauble))
{
Rarity rarity = Rarity.getRarity(nbt);
if (rarity != Rarity.DEFAULT)
{
if (stack.getItem() instanceof ItemSword) drawMelee(tooltip, stack, nbt, event.getEntityPlayer(), info);
else if (stack.getItem() instanceof ItemArmor) drawArmor(tooltip, stack, nbt, event.getEntityPlayer(), info);
else if (stack.getItem() instanceof ItemLEMagical) drawMagical(tooltip, stack, nbt, event.getEntityPlayer(), info);
else if (stack.getItem() instanceof ItemLEBauble) drawBauble(tooltip, stack, nbt, event.getEntityPlayer(), info);
}
}
}
}
示例3: CommandEvents
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void CommandEvents(CommandEvent evt) {
if(Main.debug==1)System.out.println(evt.getSender().getName() + " called Command " + evt.getSender().toString());
if(evt.getSender() instanceof EntityPlayer){
if(!Main.logged.contains(evt.getSender().getName())){
//System.out.println(evt.getCommand().getCommandName().toString());
if(!evt.getCommand().getCommandName().toString().contains("login") && !evt.getCommand().getCommandName().toString().contains("register")){
evt.setCanceled(true);
if(Main.passwords.containsKey(evt.getSender().getName())){
evt.getSender().addChatMessage(new TextComponentString(TextFormatting.RED + (String)Main.config.get("loginmessage")));
} else {
evt.getSender().addChatMessage(new TextComponentString(TextFormatting.RED + (String)Main.config.get("registermessage")));
}
}
}
}
}
示例4: HarvestDropsEvent
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void HarvestDropsEvent(BlockEvent.HarvestDropsEvent e){
try {
if (e != null && e.getHarvester() == null && !e.getDrops().isEmpty() && ((e.getState().getBlock().equals(Blocks.LEAVES))
|| e.getState().getBlock().equals(Blocks.LEAVES2)) && !e.getWorld().isRemote) {
Block block = Block.getBlockFromItem(e.getDrops().get(0).getItem());
int meta = e.getDrops().get(0).getMetadata();
BlockPos pos = findGround(e.getWorld(), e.getPos());
if (pos != null && e.getWorld() != null) {
e.getWorld().setBlockState(pos, block.getStateFromMeta(meta));
deleteCopySapling(e.getWorld(), pos, Item.getItemFromBlock(block));
}
}
}catch(Throwable throwable){
System.out.println(" EXCEPTION FOUND IN EVENT TWEAKS FOREST REPLANTING: PLEASE REPORT LOGS TO EVENT TWEAKS WITH INFORMATION ON REPRODUCING");
throwable.printStackTrace();
}
}
示例5: itemFishedEvent
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void itemFishedEvent(ItemFishedEvent event) {
ItemStack stack = event.getEntityPlayer().getHeldItemMainhand();
if (!stack.isEmpty()) {
NBTTagList nbtList = stack.getEnchantmentTagList();
for (NBTBase nbt : nbtList) {
if (((NBTTagCompound) nbt).getInteger("id") == Enchantment.getEnchantmentID(GSEnchantment.CURSE_BROKEN_HOOK)) {
if (EnchantmentBrokenHookCurse.cancelFishing()) {
event.setCanceled(true);
}
break;
}
}
}
}
示例6: onModelBake
@SubscribeEvent (priority = EventPriority.HIGHEST)
public void onModelBake(ModelBakeEvent event) {
IModel missingIModel = ModelLoaderRegistry.getMissingModel();
IBakedModel missingModel = missingIModel.bake(missingIModel.getDefaultState(), DefaultVertexFormats.ITEM, TextureUtils.bakedTextureGetter);
Map<IModel, IBakedModel> bakedModels = new HashMap<>();
HashMultimap<IModel, ModelResourceLocation> models = HashMultimap.create();
Multimaps.invertFrom(Multimaps.forMap(toBake), models);
ProgressBar bar = ProgressManager.push("CCL ModelLoading: Baking", models.keySet().size());
for (IModel model : models.keySet()) {
bar.step(String.format("[%s]", Joiner.on(", ").join(models.get(model))));
if (model == missingIModel) {
bakedModels.put(model, missingModel);
continue;
}
bakedModels.put(model, model.bake(model.getDefaultState(), DefaultVertexFormats.ITEM, TextureUtils.bakedTextureGetter));
}
ProgressManager.pop(bar);
for (Entry<ModelResourceLocation, IModel> entry : toBake.entrySet()) {
event.getModelRegistry().putObject(entry.getKey(), bakedModels.get(entry.getValue()));
}
}
示例7: PlayerInteraction
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void PlayerInteraction(LivingHurtEvent evt) {
if(Main.debug==1)System.out.println(evt.getEntity().getName() + " called PlayerHurt " + evt.getEntity().toString());
if(evt.getEntity() instanceof EntityPlayer && !Main.logged.contains(evt.getEntity().getName())){
evt.setCanceled(true);
}
}
示例8: onPlayerRespawn
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onPlayerRespawn(PlayerRespawnEvent event)
{
if(stackMap.containsKey(event.player.getUniqueID()))
{
event.player.getEntityData().setTag("harshenInventory", stackMap.get(event.player.getUniqueID()).serializeNBT());
for(int i = 0; i < stackMap.get(event.player.getUniqueID()).getSlots(); i++)
if(stackMap.get(event.player.getUniqueID()).getStackInSlot(i).getItem() instanceof IHarshenProvider)
((IHarshenProvider)stackMap.get(event.player.getUniqueID()).getStackInSlot(i).getItem()).onAdd(event.player, i);
}
}
示例9: onSpecialSpawn
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onSpecialSpawn(LivingSpawnEvent.SpecialSpawn event)
{
if ( isInsideBorder(event) )
return;
// SpecialSpawn uses event cancellation instead of result
event.setCanceled(true);
}
示例10: onDimensionUnload
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onDimensionUnload(WorldEvent.Unload event)
{
ForgeChunkManager.unloadWorld(event.getWorld());
if (event.getWorld() instanceof WorldServer)
FakePlayerFactory.unloadWorld((WorldServer) event.getWorld());
}
示例11: onOpenGui
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onOpenGui(GuiOpenEvent event) {
Minecraft mc = Minecraft.getMinecraft();
if (mc.player != null && mc.player.getHealth() <= 0f) {
mc.player.setSneaking(false);
if (event.getGui() instanceof GuiChat && mc.gameSettings.keyBindSneak.isKeyDown()) {
event.setGui(new GuiChat("/team "));
}
}
}
示例12: onBlockPlace
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onBlockPlace(BlockEvent.PlaceEvent event)
{
if ( isInsideBorder(event.getWorld(), event.getPos().getX(), event.getPos().getZ()) )
return;
event.setResult(BlockEvent.Result.DENY);
event.setCanceled(true);
}
示例13: onBreakProgress
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onBreakProgress(PlayerEvent.BreakSpeed event) {
EntityPlayer player = event.getEntityPlayer();
if (player != null && player.getHealth() <= 0f) {
event.setNewSpeed(0f);
}
}
示例14: ChatEvent
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void ChatEvent(ServerChatEvent evt) {
if(Main.debug==1)System.out.println(evt.getPlayer().getName() + " called ChatEvent");
if(evt.getPlayer() instanceof EntityPlayer && !Main.logged.contains(evt.getPlayer().getName()) && Integer.parseInt((String) Main.config.get("nochat")) == 1){
evt.setCanceled(true);
if(Main.passwords.containsKey(evt.getPlayer().getName())){
evt.getPlayer().addChatMessage(new TextComponentString(TextFormatting.RED + (String)Main.config.get("loginmessage")));
} else {
evt.getPlayer().addChatMessage(new TextComponentString(TextFormatting.RED + (String)Main.config.get("registermessage")));
}
}
}
示例15: EntityEvents
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void EntityEvents(BlockEvent.PlaceEvent evt) {
if(Main.debug==1)System.out.println(evt.getPlayer().getName() + " called PlaceEvent");
if(!Main.logged.contains(evt.getPlayer().getName())){
evt.setCanceled(true);
}
}