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