當前位置: 首頁>>代碼示例>>Java>>正文


Java TickEvent類代碼示例

本文整理匯總了Java中cpw.mods.fml.common.gameevent.TickEvent的典型用法代碼示例。如果您正苦於以下問題:Java TickEvent類的具體用法?Java TickEvent怎麽用?Java TickEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TickEvent類屬於cpw.mods.fml.common.gameevent包,在下文中一共展示了TickEvent類的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: onWorldTick

import cpw.mods.fml.common.gameevent.TickEvent; //導入依賴的package包/類
@SubscribeEvent
@SuppressWarnings("unchecked")
public void onWorldTick(TickEvent.ServerTickEvent event) {
	if (event.phase != TickEvent.Phase.END || event.side != Side.SERVER)
		return;

	if (EtFuturum.enablePlayerSkinOverlay)
		if (playerLoggedInCooldown != null)
			if (--playerLoggedInCooldown <= 0) {
				for (World world : MinecraftServer.getServer().worldServers)
					for (EntityPlayer player : (List<EntityPlayer>) world.playerEntities) {
						NBTTagCompound nbt = player.getEntityData();
						if (nbt.hasKey(SetPlayerModelCommand.MODEL_KEY, Constants.NBT.TAG_BYTE)) {
							boolean isAlex = nbt.getBoolean(SetPlayerModelCommand.MODEL_KEY);
							EtFuturum.networkWrapper.sendToAll(new SetPlayerModelMessage(player, isAlex));
						}
					}
				playerLoggedInCooldown = null;
			}
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:21,代碼來源:ServerEventHandler.java

示例3: renderTick

import cpw.mods.fml.common.gameevent.TickEvent; //導入依賴的package包/類
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void renderTick(TickEvent.RenderTickEvent event)
{
	Minecraft mc = FMLClientHandler.instance().getClient();
	World world = mc.theWorld;
	
	if (event.phase != TickEvent.Phase.START) {
	    if ((Minecraft.getMinecraft().renderViewEntity instanceof EntityPlayer)) {
	    	EntityPlayer player = (EntityPlayer)Minecraft.getMinecraft().renderViewEntity;

	        if ((player != null) && (mc.inGameHasFocus) && (Minecraft.isGuiEnabled())) {
	        	// If player have radiation detector on hotbar.
	        	if (isPlayerHasItemOnHotbar(player.inventory, ItemsHZDS.radiation_detector)) {
        			PlayerTracker tracker = TrackerManager.lookupTrackerFromUsername(mc.thePlayer.getCommandSenderName());
        			
        			if (tracker != null) {
        				renderRadiation(tracker);
        			}
        		}

	        }
	    }
	}
}
 
開發者ID:TwilightWingsStudio,項目名稱:HazardsLib,代碼行數:26,代碼來源:ClientEventHandler.java

示例4: onServerTick

import cpw.mods.fml.common.gameevent.TickEvent; //導入依賴的package包/類
@SubscribeEvent
public void onServerTick(final TickEvent.ServerTickEvent event) {
    if (event.phase != TickEvent.Phase.END || CommandTPSTimer.playerSet.isEmpty()) {
        return;
    }
    final MinecraftServer server = MinecraftServer.getServer();
    final int counter = server.getTickCounter() % 100;
    final long[] longs = server.tickTimeArray;
    if (longs == null) {
        return;
    }
    for (final Object o : server.getConfigurationManager().playerEntityList) {
        final EntityPlayer player = (EntityPlayer)o;
        if (CommandTPSTimer.playerSet.contains(player.getCommandSenderName())) {
            NetworkHandler.sendPacketToPlayer(new PacketTime(longs[counter], counter), player);
        }
    }
}
 
開發者ID:sameer,項目名稱:ExtraUtilities,代碼行數:19,代碼來源:CommandTPSTimer.java

示例5: onDraw

import cpw.mods.fml.common.gameevent.TickEvent; //導入依賴的package包/類
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onDraw(final TickEvent.RenderTickEvent event) {
    if (event.phase != TickEvent.Phase.END || !this.display || CommandTPSTimer.displayString.length() == 0) {
        return;
    }
    final Minecraft minecraft = Minecraft.getMinecraft();
    if (minecraft.theWorld == null) {
        CommandTPSTimer.displayString = "";
        return;
    }
    final FontRenderer fontrenderer = minecraft.fontRenderer;
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
    GL11.glEnable(3042);
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    GL11.glBlendFunc(770, 771);
    RenderHelper.disableStandardItemLighting();
    fontrenderer.drawString(CommandTPSTimer.displayString, 0, 0, -1, true);
}
 
開發者ID:sameer,項目名稱:ExtraUtilities,代碼行數:20,代碼來源:CommandTPSTimer.java

示例6: 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

示例7: onServerTick

import cpw.mods.fml.common.gameevent.TickEvent; //導入依賴的package包/類
@SubscribeEvent
public void onServerTick(TickEvent.ServerTickEvent event)
{
	MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
	//Prevent issues when clients switch to LAN servers
	if (server == null) return;

	if (event.phase == TickEvent.Phase.START)
    {
        if (AsteroidsTickHandlerServer.spaceRaceData == null)
        {
            World world = server.worldServerForDimension(0);
            AsteroidsTickHandlerServer.spaceRaceData = (ShortRangeTelepadHandler) world.mapStorage.loadData(ShortRangeTelepadHandler.class, ShortRangeTelepadHandler.saveDataID);

            if (AsteroidsTickHandlerServer.spaceRaceData == null)
            {
                AsteroidsTickHandlerServer.spaceRaceData = new ShortRangeTelepadHandler(ShortRangeTelepadHandler.saveDataID);
                world.mapStorage.setData(ShortRangeTelepadHandler.saveDataID, AsteroidsTickHandlerServer.spaceRaceData);
            }
        }
    }
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:23,代碼來源:AsteroidsTickHandlerServer.java

示例8: onTick

import cpw.mods.fml.common.gameevent.TickEvent; //導入依賴的package包/類
@SubscribeEvent
public void onTick(TickEvent.ServerTickEvent e) {
    if (e.phase == TickEvent.Phase.START) {
        final Runnable[] adds;
        synchronized (pending) {
            adds = pending.toArray(new Runnable[pending.size()]);
            pending.clear();
        }
        for (Runnable runnable : adds) {
            try {
                runnable.run();
            } catch (Throwable t) {
                log.warn("Error in scheduled tick action.", t);
            }
        }
    }
}
 
開發者ID:Avaja,項目名稱:OpenTechnology,代碼行數:18,代碼來源:SimpleComponentTickHandler.java

示例9: onRenderTick

import cpw.mods.fml.common.gameevent.TickEvent; //導入依賴的package包/類
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onRenderTick(TickEvent.RenderTickEvent event) {
	// If no client world we're not playing. Abort.
	if (Minecraft.getMinecraft().theWorld == null) return;
	if (event.phase == TickEvent.Phase.START) {
		// Anything we need to render for the current frame should happen either during or before the main world render
		// Here we call the renderer for "live portal" renders.
		PerspectiveRenderManager.onRenderTick(printstream);
		return;
	}
	if (event.phase == TickEvent.Phase.END) {
		// We render the world views at the end of the render tick.  
		WorldViewRenderManager.onRenderTick(printstream);
		return;
	}
}
 
開發者ID:XCompWiz,項目名稱:LookingGlass,代碼行數:18,代碼來源:LookingGlassEventHandler.java

示例10: onWorldTickLoad

import cpw.mods.fml.common.gameevent.TickEvent; //導入依賴的package包/類
@SubscribeEvent
public void onWorldTickLoad(TickEvent.WorldTickEvent event)
{
	EAWorldData eaWD = EAWorldData.forWorld((WorldServer)event.world);
	eaWD.markDirty();
	
	if(event.phase == TickEvent.Phase.START)
	{
		EAPlugin.internalTick();
		for(EAPluginContainer plugin : EALoader.instance().loadedPlugins)
		{	
			try
			{
				plugin.plugin.onTick(event.world);
			}
			catch(Exception e)
			{
				e.printStackTrace();
			}
		}
	}
}
 
開發者ID:Cephrus,項目名稱:Elite-Armageddon,代碼行數:23,代碼來源:Handler.java

示例11: onEvent

import cpw.mods.fml.common.gameevent.TickEvent; //導入依賴的package包/類
@SubscribeEvent
public void onEvent(TickEvent.ServerTickEvent event)
{
    // Only need once a tick
    if(event.phase == TickEvent.Phase.START)
    {
        return;
    }

    // This is useless :p
    if(tickCount < TICK_DELAY)
    {
        tickCount++;
    }

    if(tickCount == TICK_DELAY)
    {
        InventoryPlayerUnificationHandler.unifyAll();
        tickCount = 0;
    }
}
 
開發者ID:Technici4n,項目名稱:ProjectU,代碼行數:22,代碼來源:ServerTickEventHandler.java

示例12: onClientTick

import cpw.mods.fml.common.gameevent.TickEvent; //導入依賴的package包/類
@SubscribeEvent
public void onClientTick(TickEvent.ClientTickEvent event) {
    if (Minecraft.getMinecraft().theWorld == null && !nowPlaying.isEmpty()) {
        stop();
        return;
    }

    boolean currentState = false;
    if (Minecraft.getMinecraft().isGamePaused()) {
        currentState = true;
    }

    if (currentState && !gamePause) {
        pause();
        gamePause = true;
    } else if (!currentState && gamePause) {
        resume();
        gamePause = false;
    }
}
 
開發者ID:dmillerw,項目名稱:EventMod,代碼行數:21,代碼來源:SoundHandler.java

示例13: 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

示例14: tickEnd

import cpw.mods.fml.common.gameevent.TickEvent; //導入依賴的package包/類
public void tickEnd( PlayerTickEvent event )
{
	if ( !event.phase.equals( TickEvent.Phase.END ) )
	{
		return;
	}
	EntityPlayer player = ( EntityPlayer ) event.player;
	
	if ( !player.openContainer.getClass().getName().equals( "thaumcraft.common.container.ContainerArcaneBore" ) )
	{
		return;
	}
	
	Slot oldSlot = player.openContainer.getSlot( 1 );
	if ( oldSlot instanceof PickaxeSlot )
	{
		return;
	}
	
	PickaxeSlot newSlot = new PickaxeSlot( oldSlot.inventory, 1, oldSlot.xDisplayPosition, oldSlot.yDisplayPosition );
	newSlot.slotNumber = oldSlot.slotNumber;
	player.openContainer.inventorySlots.set( 1, newSlot );
}
 
開發者ID:spacechase0,項目名稱:ComponentEquipment,代碼行數:24,代碼來源:ArcaneBoreSlotChanger.java

示例15: tick

import cpw.mods.fml.common.gameevent.TickEvent; //導入依賴的package包/類
@SubscribeEvent
public void tick(TickEvent.ServerTickEvent event) {
	//Tick satellites
	if(event.phase == event.phase.END) {
		DimensionManager.getInstance().tickDimensions();
		time++;

		if(!transitionMap.isEmpty()) {
			Iterator<Entry<Long, TransitionEntity>> itr = transitionMap.entrySet().iterator();

			while(itr.hasNext()) {
				Entry<Long, TransitionEntity> entry = itr.next();
				TransitionEntity ent = entry.getValue();
				if(ent.entity.worldObj.getTotalWorldTime() >= entry.getKey()) {
					ent.entity.setLocationAndAngles(ent.location.x, ent.location.y, ent.location.z, ent.entity.rotationYaw, ent.entity.rotationPitch);

					MinecraftServer.getServer().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP)ent.entity, ent.dimId, new TeleporterNoPortal(MinecraftServer.getServer().worldServerForDimension(ent.dimId)));

					ent.entity.mountEntity(ent.entity2);
					itr.remove();
				}
			}
		}
	}
}
 
開發者ID:zmaster587,項目名稱:AdvancedRocketry,代碼行數:26,代碼來源:PlanetEventHandler.java


注:本文中的cpw.mods.fml.common.gameevent.TickEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。