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