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


Java ClientTickEvent类代码示例

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


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

示例1: onClientTick

import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; //导入依赖的package包/类
@SubscribeEvent
public static void onClientTick(ClientTickEvent event) throws Throwable {
    if (event.phase == Phase.START && (!Configs.creativeOnly || Minecraft.getMinecraft().player.isCreative())) {
        int timer = (int) getDelayTimer.invoke(Minecraft.getMinecraft());
        RayTraceResult hover = Minecraft.getMinecraft().objectMouseOver;
        if (hover != null && hover.typeOfHit == Type.BLOCK) {
            BlockPos pos = hover.getBlockPos();
            if (timer > 0 && !pos.equals(lastTargetPos) && (lastTargetPos == null || !pos.equals(lastTargetPos.offset(lastTargetSide)))) {
                setDelayTimer.invoke(Minecraft.getMinecraft(), 0);
            } else if (Configs.forceNewLoc && timer == 0 && pos.equals(lastTargetPos) && hover.sideHit == lastTargetSide) {
                setDelayTimer.invoke(Minecraft.getMinecraft(), 4);
            }
            lastTargetPos = pos.toImmutable();
            lastTargetSide = hover.sideHit;
        }
    }
}
 
开发者ID:tterrag1098,项目名称:BetterPlacement,代码行数:18,代码来源:BetterPlacement.java

示例2: getPlayer

import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; //导入依赖的package包/类
public static EntityPlayer getPlayer(Event event)
{
	if(event instanceof LivingEvent && ((LivingEvent)event).getEntity() instanceof EntityPlayer)
		return (EntityPlayer)((LivingEvent)event).getEntity();
	if(event instanceof RenderGameOverlayEvent || event instanceof RenderWorldLastEvent || event instanceof ClientTickEvent)
		return HarshenCastle.proxy.getPlayer();
	if(event instanceof PlayerTickEvent)
		return ((PlayerTickEvent)event).player;
	if(event instanceof PlayerEvent)
		return ((PlayerEvent)event).player;
	if(event instanceof net.minecraftforge.event.entity.player.PlayerEvent)
		return ((net.minecraftforge.event.entity.player.PlayerEvent)event).getEntityPlayer();
	if(event instanceof PlayerPunchedEvent)
		return ((PlayerPunchedEvent)event).attacker;
	if(event instanceof LivingDropsEvent && isSourceFromPlayer(((LivingDropsEvent)event).getSource()))
		return getPlayerFromSource(((LivingDropsEvent)event).getSource());
	return null;
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:19,代码来源:HarshenUtils.java

示例3: clientTick

import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; //导入依赖的package包/类
@HarshenEvent
public void clientTick(ClientTickEvent event)
{
	EntityPlayer player = HarshenUtils.getPlayer(event);
	if ( (event.phase == TickEvent.Phase.END) && (player != null) )
	{
		localPosX = MathHelper.floor(player.posX);
		localPosY = MathHelper.floor(player.posY);
		localPosZ = MathHelper.floor(player.posZ);
		prevLocalPosX = MathHelper.floor(player.prevPosX);
		prevLocalPosZ = MathHelper.floor(player.prevPosZ);

		if(((this.thread == null) || !this.thread.isAlive()) && (player.world != null) && (player != null))
		{
			this.thread = new Thread(this);
			this.thread.setDaemon(false);
			this.thread.setPriority(Thread.MAX_PRIORITY);
			this.thread.start();
		}
	}
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:22,代码来源:XrayPendant.java

示例4: gameTick

import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void gameTick(ClientTickEvent event) {
    if (Autotip.onHypixel && Autotip.toggle && (unixTime
            != System.currentTimeMillis() / 1000L)) {
        if (waveCounter == waveLength) {
            Autotip.THREAD_POOL.submit(new FetchBoosters());
            waveCounter = 0;
        }

        if (!tipQueue.isEmpty()) {
            tipDelay++;
        } else {
            tipDelay = 4;
        }

        if (!tipQueue.isEmpty() && (tipDelay % 5 == 0)) {
            System.out.println("Attempting to tip: " + tipQueue.get(0));
            Autotip.mc.thePlayer.sendChatMessage("/tip " + tipQueue.get(0));
            tipQueue.remove(0);
            tipDelay = 0;
        }
        waveCounter++;
    }
    unixTime = System.currentTimeMillis() / 1000L;
}
 
开发者ID:Semx11,项目名称:Autotip,代码行数:26,代码来源:Tipper.java

示例5: ClientTickEnd

import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; //导入依赖的package包/类
/**
 * This is used to increment the ticks in game value.
 * @param event The event object.
 */
@SubscribeEvent
public static void ClientTickEnd(ClientTickEvent event)
{
	if (event.phase == Phase.END)
	{
		GuiScreen gui = Minecraft.getMinecraft().currentScreen;
		
		if (gui == null || !gui.doesGuiPauseGame()) 
		{
			// Reset the ticks in game if we are getting close to the maximum value of an integer.
			if (Integer.MAX_VALUE - 100 == ClientEventHandler.ticksInGame)
			{
				ClientEventHandler.ticksInGame = 1;
			}
			
			ClientEventHandler.ticksInGame++;
		}
	}
}
 
开发者ID:Brian-Wuest,项目名称:MC-Prefab,代码行数:24,代码来源:ClientEventHandler.java

示例6: tick

import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void tick(ClientTickEvent event) {
    // NORELEASE: Just move everything to the proxy?
    // NORELEASE: Can't this be done in DseRayTarget?
    if (event.phase != Phase.START) return;
    if (current_attacking_target == null) {
        resetProgress();
        return;
    }
    if (current_attacking_target.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK) {
        resetProgress();
        return;
    }
    MovingObjectPosition hit = Hammer.proxy.getShadowHit();
    if (!current_attacking_target.getBlockPos().equals(hit.getBlockPos())
            || current_attacking_target.subHit != hit.subHit) {
        resetClick();
        resetProgress();
        return;
    }
    tickClickBlock(hit);
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:23,代码来源:ClickHandler.java

示例7: onTick

import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onTick(final ClientTickEvent e) {
	if (PathHandler.isTravelling()) {
		return;
	}

	if (Main.cameraClock.isKeyDown()) {
		CameraRoll.rotateClockWise();
	}

	if (Main.cameraCounterClock.isKeyDown()) {
		CameraRoll.rotateCounterClockWise();
	}

	if (Main.fovHigh.isKeyDown()) {
		DynamicFOV.increase();
	}

	if (Main.fovLow.isKeyDown()) {
		DynamicFOV.decrease();
	}
}
 
开发者ID:daipenger,项目名称:BauerCam,代码行数:23,代码来源:EventListener.java

示例8: tick

import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; //导入依赖的package包/类
@Override
public void tick(TickEvent event) {
	super.tick(event);

	if(event instanceof ClientTickEvent) {
		while(!clientTickQeue.isEmpty())
			clientTickQeue.poll().run();
	}
	if(event instanceof RenderTickEvent) {
		RenderTickEvent revt = (RenderTickEvent) event;

		// Pre-Scene Render
		if(revt.phase == Phase.START) {
			clientRenderer.on_render_world_terrain_pre(revt);
		} else
			// Post-World >> Pre-HUD Render
			if(revt.phase == Phase.END) {
				clientRenderer.on_render_world_terrain_post(revt);
			}
	}
}
 
开发者ID:tiffit,项目名称:TaleCraft,代码行数:22,代码来源:ClientProxy.java

示例9: onTick

import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onTick(ClientTickEvent event) {
	if(mc.theWorld != null) {
		if(mc.isSingleplayer()) {
			String worldName = mc.getIntegratedServer().getWorldName();
			if(worldName == null) {
				return;
			}
			if(!currentServer.equals(worldName)) {
				currentServer = worldName;
				loadWaypoints(new File(waypointDir, worldName + ".points"));
			}
		} else if (mc.getCurrentServerData() != null) {
			if(!currentServer.equals(mc.getCurrentServerData().serverIP)) {
				currentServer = mc.getCurrentServerData().serverIP;
				loadWaypoints(new File(waypointDir, currentServer + ".points"));
			}
		}
	}
}
 
开发者ID:TealNerd,项目名称:CivRadar,代码行数:21,代码来源:CivRadar.java

示例10: onTick

import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onTick(ClientTickEvent event) {
	if(event.phase == TickEvent.Phase.START && mc.theWorld != null) {
		if(pingDelay <= -10.0D) {
			pingDelay = 63.0D;
		}
		pingDelay -= 1.0D;
		entityList = mc.theWorld.loadedEntityList;
		ArrayList<String> newInRangePlayers = new ArrayList();
		for(Object o : entityList) {
			if(o instanceof EntityOtherPlayerMP) {
				newInRangePlayers.add(((EntityOtherPlayerMP)o).getName());
			}
		}
		ArrayList<String> temp = (ArrayList)newInRangePlayers.clone();
		newInRangePlayers.removeAll(inRangePlayers);
		for(String name : newInRangePlayers) {	
			mc.theWorld.playSound(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, "minecraft:note.pling", config.getPingVolume(), 1.0F, false);
		}
		inRangePlayers = temp;
	}
}
 
开发者ID:TealNerd,项目名称:CivRadar,代码行数:23,代码来源:RenderHandler.java

示例11: onTick

import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onTick(ClientTickEvent event) {
	if(mc.currentScreen instanceof GuiDisconnected) {
		GuiDisconnected current = (GuiDisconnected) mc.currentScreen;
		current.drawCenteredString(mc.fontRendererObj, time + " seconds", current.width / 2, 30, Color.WHITE.getRGB());
		if(System.currentTimeMillis() - last >= 1000l) {
			time--;
			last = System.currentTimeMillis();
		}
		if(time == 0) {
			connectToServer();
		}
	}
	if(mc.getCurrentServerData() != null) {
		data = mc.getCurrentServerData();
	}
}
 
开发者ID:TealNerd,项目名称:AutoJoin,代码行数:18,代码来源:AutoJoin.java

示例12: onClientTick

import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onClientTick(ClientTickEvent evt) {
    if (!isEnabled() || evt.phase != Phase.START) {
        return;
    }

    // client is ready now
    if (!clientReady.get()) {
        L.info("Client tick sync ready");
        clientReady.set(true);
        clientTick.set(0);
    }

    // wait for server side
    if (!serverReady.get()) {
        return;
    }

    // don't wait for the server while the game is paused!
    if (MC.isGamePaused()) {
        return;
    }

    // now sync with the server
    waitFor(evt.side, clientTick, serverTick, clientAhead, serverAhead);
}
 
开发者ID:ata4,项目名称:minema,代码行数:27,代码来源:TickSynchronizer.java

示例13: onPlayerEvent

import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onPlayerEvent(ClientTickEvent event) {
	if (!SV.settings.updateDetection) return;
	if (lastExecute != 0l && ((System.currentTimeMillis() - lastExecute) < SVPlayerHandler.delay)) {
		skips++;
		return;
	}
	try {
		lastExecute = System.currentTimeMillis();
		EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
		if (player != null) {
			if (Math.floor(player.prevPosX) != Math.floor(player.posX)
					|| Math.floor(player.prevPosY) != Math.floor(player.posY)
					|| Math.floor(player.prevPosZ) != Math.floor(player.posZ)) {
				player.prevPosX = player.posX;
				player.prevPosY = player.posY;
				player.prevPosZ = player.posZ;
				onPlayerMove(player);
				skips = 0l;
			}
		};
	} catch (Exception e) {
		logger.error("Unexpected error during client tick event handler for player movement.", e);
	}
}
 
开发者ID:Scuwr,项目名称:Snitch-Visualizer,代码行数:26,代码来源:SVPlayerHandler.java

示例14: clientTick

import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void clientTick(ClientTickEvent event) {
    if (event.phase == Phase.START) {
        WirelessBolt.update(WirelessBolt.clientboltlist);
    }

    if (ClientUtils.inWorld()) {
        if (event.phase == Phase.START) {
            TriangTexManager.processAllTextures();
        } else {
            RedstoneEtherAddons.client().tick();
        }
    }
}
 
开发者ID:TheCBProject,项目名称:WirelessRedstone,代码行数:15,代码来源:WREventHandler.java

示例15: onClientTick

import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; //导入依赖的package包/类
@SubscribeEvent
public static void onClientTick(ClientTickEvent ev)
{
	World world = Minecraft.getMinecraft().world;

	if (world != null)
	{
		EntityPlayer player = Minecraft.getMinecraft().player;

		if (player != null)
		{
			ParticleQueue.getInstance().updateQueue(world, player);
		}
	}
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:16,代码来源:ClientEvents.java


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