本文整理匯總了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);
}
}
}
示例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);
}
}
}
示例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());
}
}
示例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")));
}
}
示例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")));
}
}
示例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")));
}
}
示例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")));
}
}
示例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();
}
}
}
示例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)
{
}
}
示例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();
}
示例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);
}
示例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();
}
}
示例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);
}
}
}
}
示例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);
}
}
}
示例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);
}
}
}
}
}
}
}