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


Java TickEvent.PlayerTickEvent方法代码示例

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


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

示例1: onTickEvent

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onTickEvent(TickEvent.PlayerTickEvent evt) {
	if (tick >= 15) {
		for (TileEntity t : (List<TileEntity>) evt.player.worldObj.loadedTileEntityList) {
			if (t instanceof LobbyTileEntity) {
				tile = (LobbyTileEntity) t;
				
				if (tile.players.size() != tile.blockMetadata)
					tile.check();
			}
		}

		tick = 0;
	}
}
 
开发者ID:TominoCZ,项目名称:PAYDAY,代码行数:16,代码来源:MEventHandler.java

示例2: playerTick

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void playerTick(final TickEvent.PlayerTickEvent event) {
    if (event.phase == TickEvent.Phase.START) {
        return;
    }
    final EntityPlayer player = event.player;
    if (player.worldObj.isRemote) {
        return;
    }
    if (LogHelper.isDeObf) {}
    if ((player.worldObj.getTotalWorldTime() & 0x1FL) > 0L) {
        return;
    }
    final int i = this.chunkmap.adjustOrPutValue(new ChunkLocation(event.player), 1, 1);
    if (i > 2250) {}
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:17,代码来源:SpecialEventCoordinator.java

示例3: onPlayerTick

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event)
{
	if (event.phase != Phase.START)
		return;

	updatePosition();
	if (!moved)
		return;

	Block b = getBlockUnderPlayer();
	onElevator = (b == IndicatorMod.instance.elevatorBlock);

	if (onElevator)
		findElevators();
}
 
开发者ID:bartbes,项目名称:OpenBlocks-Elevator-Indicator,代码行数:17,代码来源:IndicatorOverlay.java

示例4: tickStart

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void tickStart(TickEvent.PlayerTickEvent event){
	if (event.player.worldObj.isRemote){
		//System.out.println("tick");
		IChatComponent message = ClientErrorMessageStorage.getMessage();
		if (message != null && ticksElapsed == 0){
			ClientErrorMessageStorage.getPlayer().addChatComponentMessage(message);
			ClientErrorMessageStorage.sent();
			ticksElapsed++; 
		} else if (ticksElapsed > 0 && ticksElapsed < minDelay){
			ticksElapsed++;
		} else if (ticksElapsed >= minDelay){
			ticksElapsed = 0;
		}
	} else {
		//System.out.println("server");
	}
	
}
 
开发者ID:Zenith-One,项目名称:RecallResurrection,代码行数:20,代码来源:ClientErrorMessageHandler.java

示例5: onPlayerTick

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent tick) {
    if (tick.side == Side.SERVER) {
        EntityPlayer player = tick.player;
        if (tick.phase == TickEvent.Phase.END) {
            if (Rings.proxy.manaHandler.playerHasSession(player)) {
                IPlayerSession playerSession = Rings.proxy.manaHandler.getPlayerSession(player);
                if (++this.tick >= ModLibs.RECHARGE_WAIT_TIME) {
                    if (!player.capabilities.isCreativeMode) {
                        if (player.getFoodStats().getFoodLevel() > 4)
                            playerSession.adjustMana(((player.getFoodStats().getFoodLevel() / 4)), false);
                    } else
                        playerSession.setMana(playerSession.getMaxMana());
                    Rings.proxy.manaHandler.updatePlayerSession(playerSession, player.getEntityWorld().provider.dimensionId);
                    this.tick = 0;
                }
            }
        }
    }
}
 
开发者ID:Lomeli12,项目名称:MagicalRings,代码行数:21,代码来源:GameEventHandler.java

示例6: magicCollectorUpdate

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void magicCollectorUpdate(TickEvent.PlayerTickEvent e) {
    if (e.player.worldObj.isRemote)
        return;

    if (e.player.openContainer == null)
        return;

    if (!(e.player.openContainer instanceof ContainerMagicCollector))
        return;

    ContainerMagicCollector cont = (ContainerMagicCollector) e.player.openContainer;
    ItemStack stack = cont.getCollectorStack();
    ItemMagicCollector item = cont.getCollectorItem();

    ItemStack magicItem = (ItemStack) cont.getInventory().get(0);

    if (item.getMagic(stack) < 1)
        return;

    if (magicItem == null)
        return;

    if (((IMagicalItem) magicItem.getItem()).getMagic(magicItem) >= ((IMagicalItem) magicItem.getItem()).getMaxMagic(magicItem))
        return;

    if (item.getMagic(stack) >= item.getMaxMagic(stack))
        return;

    item.extractMagic(stack, 1);
    ((IMagicalItem) magicItem.getItem()).receiveMagic(magicItem, 1);
}
 
开发者ID:BRForgers,项目名称:DynamicCraft,代码行数:33,代码来源:HandlerCommon.java

示例7: onClientTick

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onClientTick(TickEvent.PlayerTickEvent event){ //handles both 1st and 3rd person rendering, but in a cheatier way
    if(ConfigHandler.animationType == 2 && event.phase == TickEvent.Phase.END) {
        if (event.side.isServer() || event.player == null || event.player.getCurrentEquippedItem() == null)
            return;
        ItemStack equippedStack = event.player.getCurrentEquippedItem();

        if (equippedStack.getItem() instanceof IEnergyTool && equippedStack.getItem().getItemUseAction(equippedStack) == EnumAction.bow) {
            if(event.player.isSwingInProgress) {
                event.player.setItemInUse(equippedStack, event.player.ticksExisted); //a bit of a hack here. I need a variable that would increase every tick, otherwise the "bow shaking" effect won't happen. player.ticksExisted works for that.
                event.player.swingProgress = 0; //disable the normal mining swing animation
            }
        }
    }
}
 
开发者ID:goldenapple3,项目名称:RFDrills,代码行数:16,代码来源:PlayerRenderHandler.java

示例8: onPlayerTick

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event) {
	
  if (event.phase == TickEvent.Phase.END) {
	  if (event.player !=  null){
		  
		  ExtendedPlayerData properties = ExtendedPlayerData.get(event.player);
		  
		  if (!stop) {
			  
			  	timeInMili++;
			  	
            	if(timeInMili > 20){
            		if (properties.decreaseShrineTimer(1)){
            			timeInMili = 0;
            		}
            	}
            	
            if (properties.getShrineTimer() <= 0) {
                stop = true;
            }
            
        if (stop) {
        		properties.resetShrineTimer();
        		event.player.worldObj.spawnEntityInWorld(new EntityLightningBolt(event.player.worldObj, event.player.posX, event.player.posY, event.player.posZ));
        		event.player.setHealth(0);
                stop = false;
        }
        }
      }
	}
  }
 
开发者ID:MoreThanHidden,项目名称:DoomShrine,代码行数:33,代码来源:TickHandler.java

示例9: onPlayerTick

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event) {
    // Only perform the effect in survival/adventure mode
    if(!event.player.capabilities.isCreativeMode) {
        PlayerSymptoms symptoms = PlayerSymptoms.getForPlayer(event.player);
        if (symptoms == null) return;
        for (AmplifiedSymptom s : symptoms.symptoms) {
            s.symptom.performSymptomEffect(event.player, s.amplifier);
        }
    }
}
 
开发者ID:meew0,项目名称:HealthMod,代码行数:12,代码来源:HealthModEventHandler.java

示例10: onPlayerTick

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event) {
    if (event.phase == TickEvent.Phase.START)
        return;

    if (event.side == Side.CLIENT)
        return;

    TriggerRegistry.fireTrigger(PassiveTrigger.Type.PLAYER, event.player);
}
 
开发者ID:dmillerw,项目名称:EventMod,代码行数:11,代码来源:EventHandler.java

示例11: tick

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void tick( TickEvent.PlayerTickEvent event )
{
	if ( !event.phase.equals( TickEvent.Phase.END ) ) return;
	
	EntityPlayer player = event.player;
	
	boolean hasWalk = false;
	ItemStack stack = player.getCurrentArmor( 0 );
	if ( stack != null && stack.getItem() == ComponentEquipment.items.boots )
	{
		int level = Armor.instance.getModifierLevel( stack, "walkSlope" );
		if ( level >= 1 )
		{
			hasWalk = true;
		}
	}
	// Doing it this way to allow other mods to do similar things without me breaking them
	
	NBTTagCompound data = player.getEntityData();
	if ( hasWalk )
	{
		data.setBoolean( "CE_WalkSlope", true );
		player.stepHeight = 1.f;
	}
	else if ( player.stepHeight > 0.5f && data.hasKey( "CE_WalkSlope" ) && data.getBoolean( "CE_WalkSlope" ) == true )
	{
		data.removeTag( "CE_WalkSlope" );
		player.stepHeight = 0.5f;
	}
}
 
开发者ID:spacechase0,项目名称:ComponentEquipment,代码行数:32,代码来源:WalkSlopeTickHandler.java

示例12: doMovement

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void doMovement(TickEvent.PlayerTickEvent e) {
    Iterator<Relocation> it = relocateQueue.iterator();
    while (it.hasNext()) {
        Relocation entry = it.next();
        if (entry.getPlayer().equals(e.player) && e.player instanceof EntityPlayerMP){
            FMLLog.info("Moving player: " + e.player.getDisplayName() + " to dim: " + entry.getDimension() + " @ " + entry.getCoords().toString());
            WorldServer worldserver = MinecraftServer.getServer().worldServerForDimension(entry.getDimension());
            IChunkProvider ichunkprovider = worldserver.getChunkProvider();
            ichunkprovider.loadChunk(entry.getCoords().posX - 3 >> 4, entry.getCoords().posZ - 3 >> 4);
            ichunkprovider.loadChunk(entry.getCoords().posX + 3 >> 4, entry.getCoords().posZ - 3 >> 4);
            ichunkprovider.loadChunk(entry.getCoords().posX - 3 >> 4, entry.getCoords().posZ + 3 >> 4);
            ichunkprovider.loadChunk(entry.getCoords().posX + 3 >> 4, entry.getCoords().posZ + 3 >> 4);

            for (int y = entry.getCoords().posY; y <= worldserver.getHeight(); y++) {
                Material material = worldserver.getBlock(entry.getCoords().posX, y, entry.getCoords().posZ).getMaterial();
                Material material1 = worldserver.getBlock(entry.getCoords().posX, y + 1, entry.getCoords().posZ).getMaterial();
                boolean flag1 = !material.isSolid() && !material.isLiquid();
                boolean flag2 = !material1.isSolid() && !material1.isLiquid();
                if (flag1 && flag2) {
                    entry.getCoords().posY = y;
                    break;
                }
            }
            ((EntityPlayerMP) e.player).mcServer.getConfigurationManager().transferPlayerToDimension((EntityPlayerMP) e.player, entry.getDimension(), new Teleporter(worldserver));
            e.player.setPositionAndUpdate(entry.getCoords().posX, entry.getCoords().posY, entry.getCoords().posZ);
            it.remove();
         }
     }
}
 
开发者ID:ImagineScape,项目名称:ImagineMod,代码行数:31,代码来源:PlayerEventHandler.java

示例13: onPlayerTick

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event) {
	EntityPlayer thePlayer = event.player;
	ExtendedPlayer props = ExtendedPlayer.get((EntityPlayer) thePlayer);
	if (event.player.dimension == TheDarkEra.dimension) {
		if (!thePlayer.isPotionActive(TDEPotionEffects.BreatheID)) {
			thePlayer.addPotionEffect(new PotionEffect(TDEPotionEffects.DarknessID, 10, 0, true));
		}
	}
	props.addMana(1);
}
 
开发者ID:TheDarkEra,项目名称:TheDarkEra,代码行数:12,代码来源:serverTickHandler.java

示例14: doSpeedApplication

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void doSpeedApplication(TickEvent.PlayerTickEvent event) {
    if (event.phase == TickEvent.Phase.START) {
        if (event.player.getCurrentArmor(0) != null) {
            if (event.player.getCurrentArmor(0).getItem() == ITA.Boots) {
                event.player.stepHeight = stepHeight;
            } else if (event.player.stepHeight == stepHeight) {
                event.player.stepHeight = 0.5F;
            }
        } else if (event.player.stepHeight == stepHeight) {
            event.player.stepHeight = 0.5F;
        }
        EntityPlayer p = event.player;
        float speedModifier = getSpeedModifier(event.player);
        AttributeModifier modifier = p.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getModifier(CONSTS.speedAttribute);
        if (ITA.lastSpeedModifier != speedModifier || modifier == null ||
                Double.compare(p.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue(), ITA.lastSpeedValue) != 0) {
            ITA.lastSpeedModifier = speedModifier;
            if (ITA.debug)
                System.out.println("Speed Modifier: " + speedModifier);
                System.out.println(event.player.getDisplayName() + ": " + event.player.toString());
            if (modifier != null)
                p.getEntityAttribute(SharedMonsterAttributes.movementSpeed).removeModifier(modifier);

            double x = p.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue();
            modifier = new AttributeModifier(CONSTS.speedAttribute, "ITA Speed Modifier", -x + Math.max(x * speedModifier, 0.005), 0);
            p.getEntityAttribute(SharedMonsterAttributes.movementSpeed).applyModifier(modifier);

            ITA.lastSpeedValue = p.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue();
        }
    }
}
 
开发者ID:Trcx528,项目名称:ITA,代码行数:33,代码来源:speedApplicator.java

示例15: onPlayerTick

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event)
{
	EntityPlayer player = event.player;
	if (event.phase != Phase.START || player.worldObj.isRemote)
	{
		return;
	}

	if (!player.capabilities.isCreativeMode)
	{
		player.capabilities.disableDamage = false;
	
	}
}
 
开发者ID:Pasterian,项目名称:Useful-Stuff-Mod,代码行数:16,代码来源:UMEventHandler.java


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