本文整理汇总了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;
}
}
}
示例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;
}
示例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();
}
}
}
示例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;
}
示例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++;
}
}
}
示例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);
}
示例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();
}
}
示例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);
}
}
}
示例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"));
}
}
}
}
示例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;
}
}
示例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();
}
}
示例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);
}
示例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);
}
}
示例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();
}
}
}
示例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);
}
}
}