当前位置: 首页>>代码示例>>Java>>正文


Java PlayerTickEvent类代码示例

本文整理汇总了Java中net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent的典型用法代码示例。如果您正苦于以下问题:Java PlayerTickEvent类的具体用法?Java PlayerTickEvent怎么用?Java PlayerTickEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PlayerTickEvent类属于net.minecraftforge.fml.common.gameevent.TickEvent包,在下文中一共展示了PlayerTickEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onLivingTick

import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onLivingTick(PlayerTickEvent evt) {
	if (!evt.player.world.isRemote && evt.phase == Phase.END) {
		CapabilityDivination data = evt.player.getCapability(CapabilityDivination.CAPABILITY, null);
		Fortune f = data.getFortune();
		if (f != null) {
			if (data.isRemovable()) {
				data.setFortune(null);
			} else {
				if (!data.isActive() && f.canShouldBeAppliedNow(evt.player)) {
					data.setActive();
					if (f.apply(evt.player))
						data.setFortune(null);
				}
			}
		}
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:19,代码来源:DivinationEvents.java

示例2: getPlayer

import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; //导入依赖的package包/类
public static EntityPlayer getPlayer(Event event)
{
	if(event instanceof LivingEvent && ((LivingEvent)event).getEntity() instanceof EntityPlayer)
		return (EntityPlayer)((LivingEvent)event).getEntity();
	if(event instanceof RenderGameOverlayEvent || event instanceof RenderWorldLastEvent || event instanceof ClientTickEvent)
		return HarshenCastle.proxy.getPlayer();
	if(event instanceof PlayerTickEvent)
		return ((PlayerTickEvent)event).player;
	if(event instanceof PlayerEvent)
		return ((PlayerEvent)event).player;
	if(event instanceof net.minecraftforge.event.entity.player.PlayerEvent)
		return ((net.minecraftforge.event.entity.player.PlayerEvent)event).getEntityPlayer();
	if(event instanceof PlayerPunchedEvent)
		return ((PlayerPunchedEvent)event).attacker;
	if(event instanceof LivingDropsEvent && isSourceFromPlayer(((LivingDropsEvent)event).getSource()))
		return getPlayerFromSource(((LivingDropsEvent)event).getSource());
	return null;
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:19,代码来源:HarshenUtils.java

示例3: track

import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void track(PlayerTickEvent event) {
    EntityPlayer player = event.player;
    
    Item heldItem = player.getHeldItemMainhand().getItem();
    if (!(heldItem instanceof ItemBlock)) {
        return;
    }    
    
    IBlockState heldBlockState = Block.getBlockFromItem(heldItem).getDefaultState();
    BlockPos basePos = player.getPosition().add(0, -1, 0);
    IBlockState baseState = player.getEntityWorld().getBlockState(basePos);
    
    if (heldBlockState.equals(baseState)) {
        return;
    }

    player.getEntityWorld().setBlockState(basePos, heldBlockState);
}
 
开发者ID:JustinSDK,项目名称:craftsman,代码行数:20,代码来源:Turtle.java

示例4: onTick

import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; //导入依赖的package包/类
/**
 * Used to update containers at the rate specified by the poll rate in the
 * config file
 */
@SubscribeEvent
public void onTick(PlayerTickEvent event) {
	if (event.player.getEntityWorld().isRemote) {
		return;
	}

	count++;
	if (count >= maxCount) {
		sender = event.player;
		if (boxContainers == null) {
			buildCommands.refreshAndBuildContainers();
		} else {
			buildCommands.updateContainers(true);
		}
		count = 0;
	}
}
 
开发者ID:AdityaGupta1,项目名称:mobycraft,代码行数:22,代码来源:MainCommand.java

示例5: playerUpdate

import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void playerUpdate(PlayerTickEvent event){
	EntityPlayer player = event.player;
	if(event.side == Side.CLIENT){
		return;
	}
	if(event.phase != TickEvent.Phase.END)return;
	//BLUE
	int pureCount = getArmorCount(player, "pure");
	
	if(pureCount == 4){
		if(!player.getEntityWorld().isRemote){
			player.clearActivePotions();
		}
	}
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:17,代码来源:ArmorEventHandler.java

示例6: playerTickClient

import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void playerTickClient(PlayerTickEvent event) {
	if (event.side == Side.SERVER) return;
	EntityPlayer player = event.player;
	if(FMLClientHandler.instance().getClient().gameSettings.keyBindJump.isPressed()){
		if(!player.onGround){
			ItemStack boots = player.getItemStackFromSlot(EntityEquipmentSlot.FEET);
			if(ItemStackTools.isValid(boots)){
				if(EnchantmentHelper.getEnchantmentLevel(ModEnchantments.jump, boots) > 0){
					CrystalModNetwork.sendToServer(new PacketEntityMessage(player, "#Jump#"));
				}
			}
		}
	}
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:17,代码来源:EnchantmentDoubleJump.java

示例7: tick

import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void tick(PlayerTickEvent event) {
    if(event.phase != Phase.END) return;
    if(event.side != Side.SERVER) return;
    IPlayerData data = event.player.getCapability(CapabilityProvider.PLAYER_DATA, null);
    Item item = data.getHoldItem();
    if(item != null) {
        int holdTicks = data.getHoldTicks() + 1;
        data.setHoldTicks(holdTicks);
        System.out.println("TICK: " + holdTicks);
        // TODO fix
        if(holdTicks > 10) {
            System.out.println("STOP");
            data.setHoldItem(null);
            //event.player.getCooldownTracker().setCooldown(item, ((IItemSpell)item).getCooldown());
        }
    }
}
 
开发者ID:ExoMagica,项目名称:ExoMagica,代码行数:19,代码来源:SpellHandler.java

示例8: onPlayerTick

import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; //导入依赖的package包/类
/**
 * This is going to record the player actions
 */
@SubscribeEvent
public void onPlayerTick(PlayerTickEvent event)
{
    EntityPlayer player = event.player;

    if (event.phase == Phase.START)
    {
        return;
    }

    if (!player.worldObj.isRemote && CommonProxy.manager.recorders.containsKey(player))
    {
        RecordRecorder recorder = CommonProxy.manager.recorders.get(player);

        if (player.isDead)
        {
            CommonProxy.manager.stopRecording(player, true, true);
            Utils.broadcastInfo("recording.dead", recorder.record.filename);

            return;
        }

        recorder.record(player);
    }
}
 
开发者ID:mchorse,项目名称:blockbuster,代码行数:29,代码来源:ActionHandler.java

示例9: onPlayerTick

import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; //导入依赖的package包/类
/**
 * This is going to record the player actions
 */
@SubscribeEvent
public void onPlayerTick(PlayerTickEvent event)
{
    EntityPlayer player = event.player;

    if (event.phase == Phase.START)
    {
        return;
    }

    if (player.worldObj.isRemote && ClientProxy.manager.recorders.containsKey(player))
    {
        ClientProxy.manager.recorders.get(player).record(player);
    }
}
 
开发者ID:mchorse,项目名称:blockbuster,代码行数:19,代码来源:FrameHandler.java

示例10: onPlayerTick

import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onPlayerTick(PlayerTickEvent evt)
{
	EntityPlayer p = evt.player;
	ItemStack stack = p.getCurrentEquippedItem();
	if (stack != null && stack.getItem() instanceof ItemRangedWeapon)
	{
		ItemRangedWeapon w = (ItemRangedWeapon) stack.getItem();
		if (w.isReloading(stack))
		{
			if (++reloadTicks >= w.getReloadDuration())
			{
				if (!p.worldObj.isRemote)
				{
					w.setReloading(stack, p, false);
					reloadTicks = 0;
					w.hasAmmoAndConsume(stack, p);
					w.effectReloadDone(stack, p.worldObj, p);
					ARKCraft.modChannel.sendTo(new ReloadFinished(), (EntityPlayerMP) p);
				}
			}
		}
	}
}
 
开发者ID:Archiving,项目名称:ARKCraft-Code,代码行数:25,代码来源:CommonEventHandler.java

示例11: onCreateWeapon

import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onCreateWeapon(PlayerTickEvent event)
{
	if (!event.player.getEntityWorld().isRemote)
	{
		if (event.phase == Phase.START)
		{
			for (ItemStack stack : event.player.inventory.mainInventory)
			{
				if (stack != null && (stack.getItem() instanceof ItemSword || stack.getItem() instanceof ItemBow || stack.getItem() instanceof ItemArmor || stack.getItem() instanceof ItemShield))
				{
					create(stack, event.player);
				}
			}
		}
	}
}
 
开发者ID:TheXFactor117,项目名称:Levels,代码行数:18,代码来源:EventCreateWeapon.java

示例12: climbWall

import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void climbWall(PlayerTickEvent event) {

	EntityPlayer player = event.player;

	if (!player.isCollidedHorizontally) {
		return;
	}

	if (player.isActiveItemStackBlocking()) {
		player.motionY = -0.5;
	} else if (player.isSneaking()) {
		player.motionY = 0;
	} else {
		player.motionY = 0.5;
	}

}
 
开发者ID:jarryDk,项目名称:MineCraft,代码行数:19,代码来源:WallClimber.java

示例13: playerUpdate

import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void playerUpdate(PlayerTickEvent event)
{
	if (ConfigHandler.allowMyth())
	{
		EntityPlayer player = event.player;
		CannibalismNBT nbt = CannibalismNBT.getNBT(player);
		float wendigoLevel = nbt.getWendigoValue();
		if (wendigoLevel < 100)
		{
			nbt.setWarningEffect(true);
			nbt.setWedigoSpawn(false);
		}

		if (!event.player.world.isRemote)
			addServerEffect(player, wendigoLevel, nbt);;
	}
}
 
开发者ID:SoraZodia,项目名称:Cannibalism,代码行数:19,代码来源:EntityNBTEvents.java

示例14: onPlayerTickClient

import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onPlayerTickClient(PlayerTickEvent evt) {
  if (evt.side != Side.CLIENT || evt.phase != Phase.END) {
    return;
  }
  RayTraceResult mo = Minecraft.getMinecraft().objectMouseOver;
  if (mo != null && mo.entityHit != null && mo.entityHit instanceof EntityLivingBase) {
    EntityLivingBase el = (EntityLivingBase) mo.entityHit;
    if (el != lastMouseOver) {
      double baseAttack = 0;
      double attack = 0;
      IAttributeInstance damAtt = el.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.ATTACK_DAMAGE);
      if (damAtt != null) {
        baseAttack = damAtt.getBaseValue();
        attack = damAtt.getAttributeValue();
      }
      System.out.println("DebugUtil.onPlayerTickClient: Health: " + el.getMaxHealth() + " Base Damage: " + baseAttack + " Damage: " + attack);
    }
    lastMouseOver = el;
  } else {
    lastMouseOver = null;
  }

}
 
开发者ID:SleepyTrousers,项目名称:EnderZoo,代码行数:26,代码来源:DebugUtil.java

示例15: onAbilityTick

import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; //导入依赖的package包/类
@SubscribeEvent
public static void onAbilityTick(PlayerTickEvent event)
{
	if (event.phase == Phase.START && !event.player.getEntityWorld().isRemote)
	{
		for (Ability ability : AbilityHelper.abilities)
		{
			if (ability.isActive())
			{
				ability.onTick();
			}
		}
	}
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:15,代码来源:EventAbilityTick.java


注:本文中的net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。