cpw.mods.fml.common.eventhandler.EventPriority Java Examples

The following examples show how to use cpw.mods.fml.common.eventhandler.EventPriority. 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: EventHandlerWorld.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@SubscribeEvent(priority = EventPriority.LOWEST, receiveCanceled = true)
public void on(BlockEvent.PlaceEvent e) {
    if (e.isCanceled()) {
        if (interacts != null)
            interacts.remove(e.player);
    } else {
        if (!e.world.isRemote && isStickyJar(e.itemInHand)) {
            TileEntity parent = e.world.getTileEntity(e.x, e.y, e.z);
            if (parent instanceof TileJarFillable) {
                int metadata = e.world.getBlockMetadata(e.x, e.y, e.z);
                e.world.setBlock(e.x, e.y, e.z, RegisteredBlocks.blockStickyJar, metadata, 2);

                TileEntity tile = e.world.getTileEntity(e.x, e.y, e.z);
                if (tile instanceof TileStickyJar) {
                    Integer sideHit = interacts.get(e.player);
                    ((TileStickyJar) tile).init((TileJarFillable) parent, e.placedBlock, metadata,
                            ForgeDirection.getOrientation(sideHit == null ? 1 : sideHit).getOpposite());
                    RegisteredBlocks.blockStickyJar.onBlockPlacedBy(e.world, e.x, e.y, e.z, e.player, e.itemInHand);
                }
            }
        }
    }
}
 
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.LOWEST)
public void on(PlayerInteractEvent e) {
    if (!e.world.isRemote && e.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK
            && isStickyJar(e.entityPlayer.getHeldItem())) {
        if (interacts == null) {
            interacts = new HashMap<EntityPlayer, Integer>();
        }
        interacts.put(e.entityPlayer, e.face);
    }

    if (e.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
        ItemStack i = e.entityPlayer.getHeldItem();
        if (i != null && (i.getItem() instanceof ItemWandCasting)) {
            WandHandler.handleWandInteract(e.world, e.x, e.y, e.z, e.entityPlayer, i);
        }
    }
}
 
Example #3
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 #4
Source File: TickDynamicMod.java    From TickDynamic with MIT License 6 votes vote down vote up
@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();
  	}
	}
}
 
Example #5
Source File: ServerEventHandler.java    From Et-Futurum with The Unlicense 6 votes vote down vote up
@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);
	}
}
 
Example #6
Source File: EventHandlerWorld.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@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);
        }
    }
}
 
Example #7
Source File: EventHandlerGolem.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@SubscribeEvent(priority = EventPriority.LOWEST)
public void on(ItemTooltipEvent event) {
    if(event.itemStack != null) {
        if(event.itemStack.getItem() instanceof ItemGolemPlacer
                || event.itemStack.getItem() instanceof ItemAdditionalGolemPlacer) {
            if(RegisteredGolemStuff.upgradeRunicShield.hasUpgrade(event.itemStack)) {
                event.toolTip.add("\u00a76" + StatCollector.translateToLocal("item.runic.charge") + " +" + RegisteredGolemStuff.upgradeRunicShield.getChargeLimit(event.itemStack));
            }

            AdditionalGolemCore core = GadomancyApi.getAdditionalGolemCore(event.itemStack);
            if(core != null) {
                String searchStr = StatCollector.translateToLocal("item.ItemGolemCore.name");
                for(int i = 0; i < event.toolTip.size(); i++) {
                    String line = event.toolTip.get(i);
                    if(line.contains(searchStr)) {
                        int index = line.indexOf('\u00a7', searchStr.length()) + 2;
                        event.toolTip.remove(i);
                        event.toolTip.add(i, line.substring(0, index) + StatCollector.translateToLocal(core.getUnlocalizedName()));
                        break;
                    }
                }
            }
        }
    }
}
 
Example #8
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 #9
Source File: ProtectionHandlers.java    From MyTown2 with The Unlicense 6 votes vote down vote up
@SuppressWarnings("unchecked")
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onPlayerInteract(PlayerInteractEvent ev) {
    if (ev.entityPlayer.worldObj.isRemote || ev.isCanceled()) {
        return;
    }

    Resident res = MyTownUniverse.instance.getOrMakeResident(ev.entityPlayer);
    if(ev.entityPlayer.getHeldItem() != null) {
        ProtectionManager.checkUsage(ev.entityPlayer.getHeldItem(), res, ev.action, createBlockPos(ev), ev.face, ev);
    }
    if (!ev.isCanceled()) {
        ProtectionManager.checkBlockInteraction(res, new BlockPos(ev.x, ev.y, ev.z, ev.world.provider.dimensionId), ev.action, ev);
    }

    // Some things (Autonomous Activator) only care about these. So always deny them if the event is canceled.
    if (ev.isCanceled()) {
        ev.useBlock = Event.Result.DENY;
        ev.useItem = Event.Result.DENY;
    }
}
 
Example #10
Source File: ProtectionHandlers.java    From MyTown2 with The Unlicense 5 votes vote down vote up
@SuppressWarnings("unchecked")
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onPlayerAttackEntityEvent(AttackEntityEvent ev) {
    if(ev.entity.worldObj.isRemote || ev.isCanceled()) {
        return;
    }

    Resident res = MyTownUniverse.instance.getOrMakeResident(ev.entityPlayer);
    ProtectionManager.checkInteraction(ev.target, res, ev);
}
 
Example #11
Source File: MOPHelper.java    From Framez with GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onRenderHighlight(DrawBlockHighlightEvent event) {

    if (!(event.target instanceof ExtendedMOP)
            && event.player.worldObj.getTileEntity(event.target.blockX, event.target.blockY, event.target.blockZ) instanceof TileMultipart)
        event.setCanceled(true);
}
 
Example #12
Source File: PlayerSpecials.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onPlayerRenderPre(RenderLivingEvent.Pre event) {
       if(nameIsGood(event.entity)){
           GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);
           GL11.glEnable(GL11.GL_BLEND);
           GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
       }
}
 
Example #13
Source File: Ticker.java    From MyTown2 with The Unlicense 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent ev) {
    Resident res = MyTownUniverse.instance.getOrMakeResident(ev.player);
    if (res != null) {
        res.setPlayer(ev.player);
    } else {
        MyTown.instance.LOG.error("Didn't create resident for player {} ({})", ev.player.getCommandSenderName(), ev.player.getPersistentID());
    }
}
 
Example #14
Source File: ServerEventHandler.java    From bartworks with MIT License 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.LOWEST)
public void EntityJoinWorldEvent(EntityJoinWorldEvent event) {
    if (event == null || !(event.entity instanceof EntityPlayerMP) || !SideReference.Side.Server)
        return;
    MainMod.BW_Network_instance.sendToPlayer(new OreDictCachePacket(OreDictHandler.getNonBWCache()), (EntityPlayerMP) event.entity);
    MainMod.BW_Network_instance.sendToPlayer(new ServerJoinedPackage(null),(EntityPlayerMP) event.entity);
}
 
Example #15
Source File: ProtectionHandlers.java    From MyTown2 with The Unlicense 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onProjectileImpact(ProjectileImpactEvent ev) {
    if (ev.entity.worldObj.isRemote || ev.isCanceled()) {
        return;
    }

    EntityLivingBase firingEntity = ev.firingEntity;
    Resident owner = null;
    if (firingEntity instanceof EntityPlayerMP && !(firingEntity instanceof FakePlayer)) {
        owner = MyTownUniverse.instance.getOrMakeResident(firingEntity);
    }
    ProtectionManager.checkImpact(ev.entity, owner, ev.movingObjectPosition, ev);
}
 
Example #16
Source File: ProtectionHandlers.java    From MyTown2 with The Unlicense 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onAE2PartPlace(AE2PartPlaceEvent ev) {
    if (ev.world.isRemote || ev.isCanceled()) {
        return;
    }

    Resident res = MyTownUniverse.instance.getOrMakeResident(ev.player);
    if(ev.player.getHeldItem() != null) {
        ProtectionManager.checkUsage(ev.player.getHeldItem(), res, Action.RIGHT_CLICK_BLOCK, new BlockPos(ev.x, ev.y, ev.z, ev.world.provider.dimensionId), ev.face, ev);
    }
}
 
Example #17
Source File: ProtectionHandlers.java    From MyTown2 with The Unlicense 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onModifyBlock(ModifyBlockEvent ev) {
    if (ev.world.isRemote || ev.isCanceled() || Config.instance.fireSpreadInTowns.get()) {
        return;
    }

    if(!ProtectionManager.getFlagValueAtLocation(FlagType.MODIFY, ev.world.provider.dimensionId, ev.x, ev.y, ev.z)) {
        ev.setCanceled(true);
        return;
    }
}
 
Example #18
Source File: ProtectionHandlers.java    From MyTown2 with The Unlicense 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onBlockTrample(BlockTrampleEvent ev) {
    if(ev.world.isRemote || ev.isCanceled())
        return;

    Entity entity = ev.entity;
    Resident res = null;

    if(!(entity instanceof EntityPlayer)) {
        // Protect from players ridding any entity
        if(entity.riddenByEntity != null && (entity.riddenByEntity instanceof EntityPlayer))
            entity = entity.riddenByEntity;
        // Protect from players jumping and leaving the horse in mid-air
        else
            res = ProtectionManager.getOwner(entity);
    }

    // Fake players are special
    if(entity instanceof FakePlayer) {
        if(!ProtectionManager.getFlagValueAtLocation(FlagType.FAKERS, ev.world.provider.dimensionId, ev.x, ev.y, ev.z)) {
            ev.setCanceled(true);
        }
    } else {
        // Will be null if we didn't find the player responsible for this trampling
        if(res == null) {
            res = MyTownUniverse.instance.getOrMakeResident(entity);
            // Will be null if it wasn't caused by a known player
            if(res == null)
                return;
        }

        // Trampling crops will break them and will modify the terrain
        if (!ProtectionManager.checkBlockBreak(ev.block)) {
            if(!ProtectionManager.hasPermission(res, FlagType.MODIFY, ev.world.provider.dimensionId, ev.x, ev.y, ev.z)) {
                ev.setCanceled(true);
            }
        }
    }
}
 
Example #19
Source File: ProtectionHandlers.java    From MyTown2 with The Unlicense 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onModifyBiome(ModifyBiomeEvent ev) {
    if (ev.world.isRemote || ev.isCanceled() || Config.instance.taintSpreadInTowns.get()) {
        return;
    }

    if(MyTownUniverse.instance.blocks.contains(ev.world.provider.dimensionId, ev.x >> 4, ev.z >> 4)) {
        ev.setCanceled(true);
    }
}
 
Example #20
Source File: FMEventHandler.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onFeelPain(LivingHurtEvent event){
    if(!Config.noLust && event.ammount > 0 && event.entityLiving instanceof EntityPlayer){
        EntityPlayer player = (EntityPlayer)event.entityLiving;
        ItemStack amulet = BaublesApi.getBaubles(player).getStackInSlot(0);
        if(amulet != null && amulet.getItem() == ForbiddenItems.subCollar){
            int doses = 3 * (int)event.ammount;
            if(event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer){
                EntityPlayer dom = (EntityPlayer)event.source.getEntity();
                int chance = 1;
                if(dom.getHeldItem() != null && dom.getHeldItem().getItem() instanceof ItemRidingCrop) {
                    doses += 3;
                    chance += 3;
                }
                if(player.worldObj.provider.dimensionId == -1 && randy.nextInt(30) < chance){
                    EntityItem ent = player.entityDropItem(new ItemStack(ForbiddenItems.deadlyShards, 1, 4), 1.0F);
                    ent.motionY += player.worldObj.rand.nextFloat() * 0.05F;
                    ent.motionX += (player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.1F;
                    ent.motionZ += (player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.1F;
                }
            }
            for(int x = 0;x < doses; x++){
                ((ItemSubCollar)ForbiddenItems.subCollar).addVis(amulet, primals[randy.nextInt(6)], 1, true);
            }
        }
    }
}
 
Example #21
Source File: FMPPlacementListener.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@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);
    }
}
 
Example #22
Source File: EventHandlerPneumaticCraft.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onEnderTeleport(EnderTeleportEvent event){
    if(!HackableEnderman.onEndermanTeleport(event.entity)) {
        event.setCanceled(true);
    } else {
        if(Config.enableEndermanSeedDrop && Math.random() < 0.05D) {
            if(!event.entity.worldObj.isRemote) ItemPlasticPlants.markInactive(event.entity.entityDropItem(new ItemStack(Itemss.plasticPlant, 1, ItemPlasticPlants.ENDER_PLANT_DAMAGE), 0));
        }
    }
}
 
Example #23
Source File: TerminalManagerServer.java    From OpenPeripheral-Addons with MIT License 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.HIGH)
public void onServerChatEvent(ServerChatEvent event) {
	final EntityPlayerMP player = event.player;
	final Optional<Long> guid = TerminalIdAccess.instance.getIdFrom(player);
	if (guid.isPresent()) {
		if (event.message.startsWith("$$")) {
			sendChatEvent(EVENT_CHAT_COMMAND, player, guid.get(), event.message.substring(2).trim());
			event.setCanceled(true);
		} else if (Config.listenToAllChat) {
			sendChatEvent(EVENT_CHAT_MESSAGE, player, guid.get(), event.message);
		}

	}
}
 
Example #24
Source File: EventHandlerWorld.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.HIGH)
public void on(ExplosionEvent.Start e) {
    Explosion expl = e.explosion;
    if(expl.isSmoking
            && (expl.exploder != null ? TileBlockProtector.isSpotProtected(e.world, expl.exploder) :
                TileBlockProtector.isSpotProtected(e.world, expl.explosionX, expl.explosionY, expl.explosionZ))) {
        //why?
        //expl.isSmoking = false;
        e.setCanceled(true);
        e.world.newExplosion(expl.exploder, expl.explosionX, expl.explosionY, expl.explosionZ, expl.explosionSize, expl.isFlaming, false);
    }
}
 
Example #25
Source File: ForgeMain.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onPlayerQuit(PlayerEvent.PlayerLoggedOutEvent event) {
    if (event.player.worldObj.isRemote) {
        return;
    }
    handleQuit((EntityPlayerMP) event.player);
}
 
Example #26
Source File: ForgeMain.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onPlayerChangedWorld(EntityJoinWorldEvent event) {
    Entity entity = event.entity;
    if (!(entity instanceof EntityPlayerMP)) {
        return;
    }
    EntityPlayerMP player = (EntityPlayerMP) entity;
    if (player.worldObj.isRemote) {
        return;
    }
}
 
Example #27
Source File: RenderEventHandler.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.LOWEST)
public void renderEntityPre(RenderLivingEvent.Pre event) {
    if(event.entity instanceof EntityPlayer) {
        EntityPlayer p = (EntityPlayer) event.entity;
        if(((DataAchromatic)SyncDataHolder.getDataClient("AchromaticData")).isAchromatic((EntityPlayer) event.entity)) {
            current = p;
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.15F);
            GL11.glDepthMask(false);
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
            GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
        }

        armor = p.inventory.armorInventory;
        p.inventory.armorInventory = new ItemStack[armor.length];
        System.arraycopy(armor, 0, p.inventory.armorInventory, 0, armor.length);

        boolean changed = false;
        for(int i = 0; i < armor.length; i++) {
            if(armor[i] != null && NBTHelper.hasPersistentData(armor[i])) {
                NBTTagCompound compound = NBTHelper.getPersistentData(armor[i]);
                if(compound.hasKey("disguise")) {
                    NBTBase base = compound.getTag("disguise");
                    if(base instanceof NBTTagCompound) {
                        p.inventory.armorInventory[i] = ItemStack.loadItemStackFromNBT((NBTTagCompound) base);
                    } else {
                        p.inventory.armorInventory[i] = null;
                    }
                    changed = true;
                }
            }
        }

        if(!changed) {
            p.inventory.armorInventory = armor;
            armor = null;
        }
    }
}
 
Example #28
Source File: RenderEventHandler.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.LOWEST, receiveCanceled = true)
public void renderPost(RenderLivingEvent.Post event) {
    if(event.entity instanceof EntityPlayer) {
        EntityPlayer p = (EntityPlayer) event.entity;
        if(armor != null) {
            p.inventory.armorInventory = armor;
        }
    }
}
 
Example #29
Source File: RenderEventHandler.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.HIGHEST, receiveCanceled = true)
public void onSetArmor(RenderPlayerEvent.SetArmorModel event) {
    if(event.entityPlayer == current) {
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
        GL11.glDepthMask(true);
    }
}
 
Example #30
Source File: IntegrationThaumicHorizions.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.LOWEST)
public void on(AttackEntityEvent e) {
    EntityPlayer player = e.entityPlayer;
    if(!e.target.worldObj.isRemote && e.target instanceof EntityGolemTH
            && player.isSneaking()) {
        e.setCanceled(true);

        ItemStack stack = player.getCurrentEquippedItem();
        if (stack != null && stack.getItem().onLeftClickEntity(stack, player, e.target)
                && e.target.isDead) {
            CommonProxy.EVENT_HANDLER_GOLEM.on(new PlaySoundAtEntityEvent(e.target, "thaumcraft:zap", 0.5f, 1.0f));
        }
    }
}