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


Java Phase类代码示例

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


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

示例1: onTick

import cpw.mods.fml.common.gameevent.TickEvent.Phase; //导入依赖的package包/类
@SubscribeEvent
public void onTick(ClientTickEvent event)
{
    if (event.side == Side.CLIENT)
    {
        if (event.phase == Phase.START)
        {
            this.keyTick(event.type, false);
        }
        else if (event.phase == Phase.END)
        {
            this.keyTick(event.type, true);
        }
    }

}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:17,代码来源:KeyHandler.java

示例2: tickStart

import cpw.mods.fml.common.gameevent.TickEvent.Phase; //导入依赖的package包/类
@SubscribeEvent
public void tickStart(PlayerTickEvent evt) {
	if (evt.phase != Phase.START) {
		return;
	}
	if (ticksToPoll > 0) {
		ticksToPoll--;
		return;
	}
	ticksToPoll = TICK_POLL_INTERVAL;
	
	if (versionInfo.versionCheckComplete) {
		unsubscribeFromBus();
		
		if (updateNotificationsEnabledOrCriticalUpdate()) {
			sendNotificationToPlayer(evt.player);
		}
	}
}
 
开发者ID:MagicBees,项目名称:MagicBees,代码行数:20,代码来源:TickHandlerVersion.java

示例3: onClientTick

import cpw.mods.fml.common.gameevent.TickEvent.Phase; //导入依赖的package包/类
@SubscribeEvent
public void onClientTick(ClientTickEvent event) {
    if (event.phase == Phase.END && ++ticker == UPDATE_RATE) {
        ticker = 0;

        Iterator<Particle> iter = alive.iterator();
        while (iter.hasNext()) {
            Particle p = iter.next();
            if (p.isDead) {
                iter.remove();
                if (dead.size() < MAX_POOL_SIZE) {
                    dead.add(p);
                }
            }
        }
        // System.out.println("GC: " + alive.size() + " / " +
        // dead.size());
    }
}
 
开发者ID:LambdaInnovation,项目名称:LambdaLib,代码行数:20,代码来源:ParticleFactoryBase.java

示例4: Point_CuringFog

import cpw.mods.fml.common.gameevent.TickEvent.Phase; //导入依赖的package包/类
/** ʵ��Skill331-������֮����Ч���� */
@SubscribeEvent
public void Point_CuringFog(PlayerTickEvent event) {
	if (event.phase == Phase.END) {
		return;
	}
	
	EntityPlayer player = event.player;
	if (!player.worldObj.isRemote // ����¼�ֻ�����ڷ�����
		&& RewriteHelper.hasSkill(player, RewriteHelper.CuringFog.id)
		&& new Random().nextInt(1200) == 600
		) {
		List entities = player.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(player.posX-3.0D, player.posY-2.0D, player.posZ-3.0D, player.posX+3.0D, player.posY+2.0D, player.posZ+3.0D));
   		for (Iterator iterator = entities.iterator(); iterator.hasNext(); ) {
   			EntityLivingBase entity = (EntityLivingBase)iterator.next();
   			if (entity.isPotionActive(Potion.blindness)) entity.removePotionEffect(Potion.blindness.id);
   			if (entity.isPotionActive(Potion.confusion)) entity.removePotionEffect(Potion.confusion.id);
   			if (entity.isPotionActive(Potion.digSlowdown)) entity.removePotionEffect(Potion.digSlowdown.id);
   			if (entity.isPotionActive(Potion.hunger)) entity.removePotionEffect(Potion.hunger.id);
   			if (entity.isPotionActive(Potion.poison)) entity.removePotionEffect(Potion.poison.id);
   			if (entity.isPotionActive(Potion.weakness)) entity.removePotionEffect(Potion.weakness.id);
   			if (entity.isPotionActive(Potion.wither)) entity.removePotionEffect(Potion.wither.id);			
   		}
		player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("keycraft.prompt.cure")));
	}
}
 
开发者ID:NullaDev,项目名称:KeyCraft,代码行数:27,代码来源:SubscribeOnTick_Effect.java

示例5: Point_HealingFog

import cpw.mods.fml.common.gameevent.TickEvent.Phase; //导入依赖的package包/类
/** ʵ��Skill332-������֮����Ч���� */
@SubscribeEvent
public void Point_HealingFog(PlayerTickEvent event) {
	if (event.phase == Phase.END) {
		return;
	}
	
	EntityPlayer player = event.player;
	if (!player.worldObj.isRemote // ����¼�ֻ�����ڷ�����
		&& RewriteHelper.hasSkill(player, RewriteHelper.HealingFog.id)
		&& new Random().nextInt(2400) == 800
		) {
		List entities = player.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(player.posX-3.0D, player.posY-2.0D, player.posZ-3.0D, player.posX+3.0D, player.posY+2.0D, player.posZ+3.0D));
   		for (Iterator iterator = entities.iterator(); iterator.hasNext(); ) {
   			EntityLivingBase entity = (EntityLivingBase)iterator.next();
   			entity.addPotionEffect(new PotionEffect(Potion.heal.id, 1, 0));
   		}
		player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("keycraft.prompt.heal")));
	}
}
 
开发者ID:NullaDev,项目名称:KeyCraft,代码行数:21,代码来源:SubscribeOnTick_Effect.java

示例6: Point_HurtingFog

import cpw.mods.fml.common.gameevent.TickEvent.Phase; //导入依赖的package包/类
/** ʵ��Skill333-���˺�֮����Ч���� */
@SubscribeEvent
public void Point_HurtingFog(PlayerTickEvent event) {
	if (event.phase == Phase.END) {
		return;
	}
	
	EntityPlayer player = event.player;
	if (!player.worldObj.isRemote // ����¼�ֻ�����ڷ�����
		&& RewriteHelper.hasSkill(player, RewriteHelper.HurtingFog.id)
		&& new Random().nextInt(2400) == 1600
		) {
		List entities = player.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(player.posX-3.0D, player.posY-2.0D, player.posZ-3.0D, player.posX+3.0D, player.posY+2.0D, player.posZ+3.0D));
   		for (Iterator iterator = entities.iterator(); iterator.hasNext(); ) {
   			EntityLivingBase entity = (EntityLivingBase)iterator.next();
   			if (!entity.equals(player)) entity.attackEntityFrom(DamageSource.causePlayerDamage(player), 10.0F);
   		}
		player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("keycraft.prompt.hurt")));
	}
}
 
开发者ID:NullaDev,项目名称:KeyCraft,代码行数:21,代码来源:SubscribeOnTick_Effect.java

示例7: Point_AuroraAutoRecover

import cpw.mods.fml.common.gameevent.TickEvent.Phase; //导入依赖的package包/类
/** �������Skill343-��ŷ������������ŷ�������� */
@SubscribeEvent
public void Point_AuroraAutoRecover(PlayerTickEvent event) {
	if (event.phase == Phase.END) {
		return;
	}
	
	EntityPlayer player = event.player;
	if (!player.worldObj.isRemote // ����¼�ֻ�����ڷ�����
		&& RewriteHelper.hasSkill(player, RewriteHelper.AuroraRegeneration.id)
		&& new Random().nextInt(6000) == 3000
		) {
		RewriteHelper.modifyAuroraPoint(player, 1);
		player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("keycraft.prompt.aurorarecovery")));
	}
}
 
开发者ID:NullaDev,项目名称:KeyCraft,代码行数:17,代码来源:SubscribeOnTick_Effect.java

示例8: tickEventEnd

import cpw.mods.fml.common.gameevent.TickEvent.Phase; //导入依赖的package包/类
@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();
  	}
	}
}
 
开发者ID:wildex999,项目名称:TickDynamic,代码行数:25,代码来源:TickDynamicMod.java

示例9: onServerWorldTick

import cpw.mods.fml.common.gameevent.TickEvent.Phase; //导入依赖的package包/类
@SubscribeEvent 
  public void onServerWorldTick(WorldTickEvent e) 
  { 
      if (e.phase == Phase.START) 
      { 
      	if (e.world.provider.dimensionId == 0  && !ModRecipes.ScriptsReloaded)
      	{
      		//ModRecipes.initialiseAnvil(); 

      	}	
      } 
else if(e.phase == Phase.END)
{
	
}
  }
 
开发者ID:AnodeCathode,项目名称:TechNodefirmacraftMod,代码行数:17,代码来源:STickHandler.java

示例10: onPlayerTick

import cpw.mods.fml.common.gameevent.TickEvent.Phase; //导入依赖的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

示例11: handleClientSide

import cpw.mods.fml.common.gameevent.TickEvent.Phase; //导入依赖的package包/类
@Override
public void handleClientSide(EntityPlayer player) {

    TileEntity tile = player.worldObj.getTileEntity(x, y, z);
    if (tile == null || !(tile instanceof TileMotor))
        return;
    TileMotor te = (TileMotor) tile;

    structure = new MovingStructure(te, te.getMovement(), speed);
    for (Vec3i b : blocks)
        structure.addBlock(new MovingBlock(b.setWorld(player.worldObj), structure, null).snapshot());

    MovingStructure s = te.getStructure();
    if (s != null) {
        while (s.getProgress() < 1) {
            s.tick(Phase.START);
            s.tick(Phase.END);
        }
    }

    te.setStructure(structure);
    MovementScheduler.instance().addStructure(structure);
}
 
开发者ID:amadornes,项目名称:Framez,代码行数:24,代码来源:PacketStartMoving.java

示例12: tick

import cpw.mods.fml.common.gameevent.TickEvent.Phase; //导入依赖的package包/类
public void tick(Phase phase) {

        FakeWorld.getFakeWorld(this);

        if (progress >= 1)
            return;

        if (phase == Phase.END) {
            if (progress == 0) {
                if (!getWorld().isRemote)
                    NetworkHandler.instance().sendToAllAround(new PacketStartMoving(motor, this), getWorld(), 128);

                startMoving();
                if (!getWorld().isRemote)
                    NetworkHandler.instance().sendToAllAround(new PacketBlockSync(motor, this), getWorld(), 128);
            }

            progress += speed;
            moveEntities();

            if (progress >= 1)
                finishMoving();
        }
    }
 
开发者ID:amadornes,项目名称:Framez,代码行数:25,代码来源:MovingStructure.java

示例13: onWorldTick

import cpw.mods.fml.common.gameevent.TickEvent.Phase; //导入依赖的package包/类
@SubscribeEvent
public void onWorldTick(WorldTickEvent event) {
    if(event.side == Side.SERVER && event.phase == Phase.END) {
        World world = event.world;
        if (world.provider.dimensionId == 0) { // only operate on overworld (for now)
            Long thisTick = world.getWorldTime();
            if (instantTickDelay == 0) {
                if (WorldTickEvents.eventPendingInstant) {
                    if (eventPendingInstantUsers.size() > 0) { // player instants
                        doPlayerInstants();
                    }
                }
                instantTickDelay = instantTickDelayReset;
            }
            instantTickDelay--;
            if (thisTick % ticksPerQuartHour == 0) { // check for stuff every in-game quarter-hour
                globalTicker(event);
            }
        }
    }
}
 
开发者ID:CosmicDan-Minecraft,项目名称:Imperium,代码行数:22,代码来源:WorldTickEvents.java

示例14: onTick

import cpw.mods.fml.common.gameevent.TickEvent.Phase; //导入依赖的package包/类
@SubscribeEvent
public void onTick(ServerTickEvent e) {
	if (e.phase == Phase.END) {
		if (!chunksToGen.isEmpty()) {
			GenData data = chunksToGen.pop();
			Chunk chunk = data.chunk;
			if (data.level == 0) {
				yttrGen.generate(chunk.worldObj.rand, chunk.xPosition, chunk.zPosition, chunk.worldObj, null, null);
			} else if (data.level == 1) {
				xenoGen.generate(chunk.worldObj.rand, chunk.xPosition, chunk.zPosition, chunk.worldObj, null, null);
			}
			chunk.setChunkModified();
			log.info("Retrogenerating "+chunk.xPosition+", "+chunk.zPosition);
		}
	}
}
 
开发者ID:unascribed,项目名称:Farrago,代码行数:17,代码来源:FarragoMod.java

示例15: onClientTick

import cpw.mods.fml.common.gameevent.TickEvent.Phase; //导入依赖的package包/类
@SubscribeEvent
public void onClientTick(ClientTickEvent event) {
	if(event.phase == Phase.END) {
		for(EQMod mod : EQMod.mods.values()) {
			if(mod.config.displayVersionResult && !mod.versionMessage && mod.versionResult == EQVersion.OUTDATED) {
				if(FMLClientHandler.instance().getClient().currentScreen == null) {
					if(mod.versionResult != EQVersion.UNINITIALIZED || mod.versionResult != EQVersion.FINAL_ERROR) {
						mod.versionMessage = true;
						if(mod.versionResult == EQVersion.OUTDATED) {
							ChatComponentText chatComponent = new ChatComponentText(EQVersion.getResultMessageForClient(mod));
							chatComponent.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(LanguageManager.getLocalization("elconqore.version.chat_hover"))));
							chatComponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, mod.remoteUpdateLocation));
							Minecraft.getMinecraft().thePlayer.addChatMessage(chatComponent);
						}
					}
				}
			}
		}
	}
}
 
开发者ID:ElConquistador,项目名称:ElConQore,代码行数:21,代码来源:EQTickHandlerClient.java


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