當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。