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


Java Phase.START属性代码示例

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


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

示例1: onClientTick

@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,代码行数:17,代码来源:BetterPlacement.java

示例2: onClientTick

/** Tick event called on the Client.<br>
 * Used to simulate pressing and releasing of our additional keys.<br>
 * This is about as close as we can (easily) get in the call stack to the point when Minecraft does the equivalent code for its own keys.
 * @param ev ClientTickEvent for this tick.
 */
@SubscribeEvent
public void onClientTick(TickEvent.ClientTickEvent ev)
{
    if (ev != null && ev.phase == Phase.START)
    {
        for (InternalKey binding : this.additionalKeys)
        {
            if (binding.isKeyDown())
            {
                binding.onKeyDown();
            }
            if (binding.isPressed())
            {
                binding.onPressed();
            }
        }
    }
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:23,代码来源:KeyManager.java

示例3: onRenderTick

/** Called for each screen redraw - approximately three times as often as the other tick events, 
 * under normal conditions.<br>
 * This is where we want to update our yaw/pitch, in order to get smooth panning etc
 * (which is how Minecraft itself does it).
 * The speed of the render ticks is not guaranteed, and can vary from machine to machine, so
 * we try to account for this in the calculations.
 * @param ev the RenderTickEvent object for this tick
 */
@SubscribeEvent
public void onRenderTick(TickEvent.RenderTickEvent ev)
{
    if (ev.phase == Phase.START)
    {
        if (this.isOverriding())
        {
            EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
            if (player != null)
            {
                updateYawAndPitch();
                player.rotationPitch = this.mCameraPitch;
                player.rotationYaw = this.mYaw;
            }
        }
    }
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:25,代码来源:CommandForWheeledRobotNavigationImplementation.java

示例4: tickEvent

@SideOnly(Side.CLIENT)
@SubscribeEvent
public void tickEvent(TickEvent.ClientTickEvent event) {
	if(event.phase==Phase.START){
		EntityPlayer player=Minecraft.getMinecraft().player;
		if(player != null && player.getDataManager().get(SPIN_TIME) && !player.getHeldItemMainhand().isEmpty()){
			player.getEntityData().setInteger("SpinTime", player.getEntityData().getInteger("SpinTime")-1);
			if(player.getEntityData().getInteger("SpinTime")<=0)
				player.getEntityData().setInteger("SpinTime", this.getDuration(player.getHeldItemMainhand(), player));
			if(Minecraft.getMinecraft().gameSettings.thirdPersonView==0 ){
				
				Minecraft.getMinecraft().gameSettings.thirdPersonView=1;
				player.getEntityData().setBoolean("SetFirstpersonAfter", true);
			}
		}
		if(player != null && !player.getDataManager().get(SPIN_TIME) && player.getEntityData().getBoolean("SetFirstpersonAfter")){
			Minecraft.getMinecraft().gameSettings.thirdPersonView=0;
			player.getEntityData().setBoolean("SetFirstpersonAfter",false);
		}
	}
	
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:22,代码来源:SpinToWin.java

示例5: onRenderTick

/** Called for each screen redraw - approximately three times as often as the other tick events, 
 * under normal conditions.<br>
 * This is where we want to update our yaw/pitch, in order to get smooth panning etc
 * (which is how Minecraft itself does it).
 * The speed of the render ticks is not guaranteed, and can vary from machine to machine, so
 * we try to account for this in the calculations.
 * @param ev the RenderTickEvent object for this tick
 */
@SubscribeEvent
public void onRenderTick(TickEvent.RenderTickEvent ev)
{
    if (ev.phase == Phase.START)
    {
        if (this.isOverriding())
        {
            EntityPlayerSP player = Minecraft.getMinecraft().player;
            if (player != null)
            {
                updateYawAndPitch();
                player.rotationPitch = this.mCameraPitch;
                player.rotationYaw = this.mYaw;
            }
        }
    }
}
 
开发者ID:Microsoft,项目名称:malmo,代码行数:25,代码来源:CommandForWheeledRobotNavigationImplementation.java

示例6: onPlayerTick

/**
 * This is going to record the player actions
 */
@SubscribeEvent
public void onPlayerTick(PlayerTickEvent event)
{
    EntityPlayer player = event.player;

    if (event.phase == Phase.START)
    {
        return;
    }

    if (!player.worldObj.isRemote && CommonProxy.manager.recorders.containsKey(player))
    {
        RecordRecorder recorder = CommonProxy.manager.recorders.get(player);

        if (player.isDead)
        {
            CommonProxy.manager.stopRecording(player, true, true);
            Utils.broadcastInfo("recording.dead", recorder.record.filename);

            return;
        }

        recorder.record(player);
    }
}
 
开发者ID:mchorse,项目名称:blockbuster,代码行数:28,代码来源:ActionHandler.java

示例7: onPlayerTick

/**
 * This is going to record the player actions
 */
@SubscribeEvent
public void onPlayerTick(PlayerTickEvent event)
{
    EntityPlayer player = event.player;

    if (event.phase == Phase.START)
    {
        return;
    }

    if (player.worldObj.isRemote && ClientProxy.manager.recorders.containsKey(player))
    {
        ClientProxy.manager.recorders.get(player).record(player);
    }
}
 
开发者ID:mchorse,项目名称:blockbuster,代码行数:18,代码来源:FrameHandler.java

示例8: tick

@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,代码行数:21,代码来源:ClientProxy.java

示例9: tick

@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,代码行数:22,代码来源:ClickHandler.java

示例10: onServerWorldTick

@SubscribeEvent
public void onServerWorldTick(WorldTickEvent event)
{
	World world = event.world;
	if(event.phase == Phase.START)
	{
		if(WorldGen.getInstance() != null)
		{
			if(world.provider.getDimension() == 0)
			{
				WorldGen.getInstance().trimCache();
				WorldGen.getInstance().buildFromQueue();
				WorldGen.getInstance().runUpdateLoop(event.world);
			}
		}			
	}
}
 
开发者ID:Deadrik,项目名称:TFC2,代码行数:17,代码来源:ServerTickHandler.java

示例11: onClientTick

@SubscribeEvent
public void onClientTick(TickEvent.ClientTickEvent event)
{
	World world = Minecraft.getMinecraft().world;
	if(event.phase == Phase.START)
	{
		if(WorldGen.getInstance() != null)
		{
			if(world != null && world.provider.getDimension() == 0)
			{
				WorldGen.getInstance().trimCache();
				WorldGen.getInstance().buildFromQueue();
				//We don't update on the client
				//WorldGen.getInstance().runUpdateLoop();
			}
		}			
	}
}
 
开发者ID:Deadrik,项目名称:TFC2,代码行数:18,代码来源:ClientRenderHandler.java

示例12: onCreateWeapon

@SubscribeEvent
public void onCreateWeapon(PlayerTickEvent event)
{
	if (!event.player.getEntityWorld().isRemote)
	{
		if (event.phase == Phase.START)
		{
			for (ItemStack stack : event.player.inventory.mainInventory)
			{
				if (stack != null && (stack.getItem() instanceof ItemSword || stack.getItem() instanceof ItemBow || stack.getItem() instanceof ItemArmor || stack.getItem() instanceof ItemShield))
				{
					create(stack, event.player);
				}
			}
		}
	}
}
 
开发者ID:TheXFactor117,项目名称:Levels,代码行数:17,代码来源:EventCreateWeapon.java

示例13: onRenderTick

@SubscribeEvent
public void onRenderTick(RenderTickEvent e) {
    if (!isEnabled()) {
        return;
    }

    // only record at the end of the frame
    if (e.phase == Phase.START) {
        return;
    }

    // stop at frame limit
    if (frameLimit > 0 && time.getNumFrames() >= frameLimit) {
        disable();
    }

    // skip frames if the capturing framerate is not synchronized with the
    // rendering framerate
    if (!cfg.isSyncEngine() && !time.isNextFrame()) {
        // Game renders faster than necessary for recording?
        return;
    }

    postFrameEvent(new FrameImportEvent(frame, time, movieDir));
}
 
开发者ID:ata4,项目名称:minema,代码行数:25,代码来源:CaptureSession.java

示例14: onClientTick

@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,代码行数:26,代码来源:TickSynchronizer.java

示例15: onServerTick

@SubscribeEvent
public void onServerTick(ServerTickEvent evt) {
    if (!isEnabled() || evt.phase != Phase.START) {
        return;
    }

    // server is ready now
    if (!serverReady.get()) {
        L.info("Server tick sync ready");
        serverReady.set(true);
        serverTick.set(0);
    }

    // wait for client side
    if (!clientReady.get()) {
        return;
    }

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


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