Java Code Examples for cpw.mods.fml.common.eventhandler.EventPriority#NORMAL

The following examples show how to use cpw.mods.fml.common.eventhandler.EventPriority#NORMAL . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EventHandlerGolem.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@SubscribeEvent(priority = EventPriority.NORMAL)
public void on(LivingHurtEvent event) {
    if (!event.entity.worldObj.isRemote) {
        if(event.entity instanceof EntityGolemBase) {
            EntityGolemBase golem = (EntityGolemBase) event.entity;
            if(event.ammount > 0 && RegisteredGolemStuff.upgradeRunicShield.hasUpgrade(golem)) {
                event.ammount = RegisteredGolemStuff.upgradeRunicShield.absorb(golem, event.ammount, event.source);
            }
        }

        /*if(event.source.getEntity() != null && event.source.getEntity() instanceof EntityGolemBase
                && ((EntityGolemBase) event.source.getEntity()).getGolemType()
                    == RegisteredGolemStuff.typeObsidian.getEnumEntry()) {
            event.entityLiving.addPotionEffect(new PotionEffect(Potion.wither.getId(), 3*20, 1));
        }*/
    }
}
 
Example 2
Source File: EventHandlerWorld.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@SubscribeEvent(priority = EventPriority.NORMAL)
public void on(ItemTooltipEvent e) {
    if (e.toolTip.size() > 0 && e.itemStack.hasTagCompound()) {
        if (e.itemStack.stackTagCompound.getBoolean("isStickyJar")) {
            e.toolTip.add(1, "\u00a7a" + StatCollector.translateToLocal("gadomancy.lore.stickyjar"));
        }
    }

    if(e.toolTip.size() > 0 && NBTHelper.hasPersistentData(e.itemStack)) {
        NBTTagCompound compound = NBTHelper.getPersistentData(e.itemStack);
        if(compound.hasKey("disguise")) {
            NBTBase base = compound.getTag("disguise");
            String lore;
            if(base instanceof NBTTagCompound) {
                ItemStack stack = ItemStack.loadItemStackFromNBT((NBTTagCompound) base);
                lore = String.format(StatCollector.translateToLocal("gadomancy.lore.disguise.item"), EnumChatFormatting.getTextWithoutFormattingCodes(stack.getDisplayName()));
            } else {
                lore = StatCollector.translateToLocal("gadomancy.lore.disguise.none");
            }
            e.toolTip.add("\u00a7a" + lore);
        }
    }
}
 
Example 3
Source File: EventHandlerWorld.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.NORMAL)
public void on(WorldEvent.Load e) {
    if (!e.world.isRemote && e.world.provider.dimensionId == 0) {
        Gadomancy.loadModData();

        GolemEnumHelper.validateSavedMapping();
        GolemEnumHelper.reorderEnum();

        TCMazeHandler.init();
    }

    GameRules rules = e.world.getGameRules();
    rules.theGameRules.put("mobGriefing", new ValueOverride(this, String.valueOf(rules.getGameRuleBooleanValue("mobGriefing"))));
}
 
Example 4
Source File: EventHandlerWorld.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.NORMAL)
public void on(WorldEvent.Unload e) {
    if (!e.world.isRemote && e.world.provider.dimensionId == 0) {
        Gadomancy.unloadModData();

        TCMazeHandler.closeAllSessionsAndCleanup();
    }
}
 
Example 5
Source File: MultiblockEventHandler.java    From BeefCore with MIT License 4 votes vote down vote up
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onChunkLoad(ChunkEvent.Load loadEvent) {
	Chunk chunk = loadEvent.getChunk();
	World world = loadEvent.world;
	MultiblockRegistry.onChunkLoaded(world, chunk.xPosition, chunk.zPosition);
}
 
Example 6
Source File: MultiblockEventHandler.java    From BeefCore with MIT License 4 votes vote down vote up
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onWorldUnload(WorldEvent.Unload unloadWorldEvent) {
	MultiblockRegistry.onWorldUnloaded(unloadWorldEvent.world);
}