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


Java Timer类代码示例

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


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

示例1: MilkCrits

import net.minecraft.util.Timer; //导入依赖的package包/类
public MilkCrits() {
    super("Milk Crits", 0xFFE2FB, ModuleCategory.TWEAKS);

    listeners.add(new Listener<PlayerUpdate>() {
        @Override
        public void call(PlayerUpdate event) {
            Timer timer = ((MinecraftExtension) mc).getTimer();
            timer.timerSpeed = 1F;

            if (Math.abs(mc.thePlayer.motionY) > 0.1) {
                if (mc.thePlayer.motionY > 0) {
                    timer.timerSpeed = 1.5F;
                } else if (mc.thePlayer.motionY < 0) {
                    timer.timerSpeed = 0.6F;
                }
            }
        }
    });
}
 
开发者ID:SerenityEnterprises,项目名称:SerenityCE,代码行数:20,代码来源:MilkCrits.java

示例2: drawGuiContainerForegroundLayer

import net.minecraft.util.Timer; //导入依赖的package包/类
@Override
protected final void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
  drawForegroundImpl(mouseX, mouseY);

  Timer t = RenderUtil.getTimer();

  if (t != null) {
    GL11.glPushMatrix();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    for (IGuiOverlay overlay : overlays) {
      if (overlay != null && overlay.isVisible()) {
        overlay.draw(realMx, realMy, t.renderPartialTicks);
      }
    }
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glPopMatrix();
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderCore,代码行数:20,代码来源:GuiContainerBase.java

示例3: doEnable

import net.minecraft.util.Timer; //导入依赖的package包/类
@Override
protected void doEnable() {
    Timer defaultTimer = minecraftGetTimer(MC);

    // check if it's modified already
    if (defaultTimer instanceof FixedTimer) {
        L.warn("Timer is already modified!");
        return;
    }

    // get default ticks per second if possible
    if (defaultTimer != null) {
        defaultTps = timerGetTicksPerSecond(defaultTimer);
    }

    float fps = cfg.frameRate.get().floatValue();
    float speed = cfg.engineSpeed.get().floatValue();

    // set fixed delay timer
    minecraftSetTimer(MC, new FixedTimer(defaultTps, fps, speed));
}
 
开发者ID:ata4,项目名称:minema,代码行数:22,代码来源:TimerModifier.java

示例4: controlClient

import net.minecraft.util.Timer; //导入依赖的package包/类
@Override
public void controlClient(EntityPlayerCustom playerCustom, EntityPlayer player) {
	if (keyPressedSlow && !playerCustom.slow) {
		ObfuscationReflectionHelper.setPrivateValue(Timer.class,
				((Timer) ObfuscationReflectionHelper.getPrivateValue(
						Minecraft.class, Minecraft.getMinecraft(), 16)),
				5F, 0);
		playerCustom.slow = true;
	}
	if (playerCustom.slow) {
		playerCustom.slowTime++;
	}
	if (playerCustom.slowTime == 25 && playerCustom.slow) {
		ObfuscationReflectionHelper.setPrivateValue(Timer.class,
				((Timer) ObfuscationReflectionHelper.getPrivateValue(
						Minecraft.class, Minecraft.getMinecraft(), 16)),
				20F, 0);
		playerCustom.slowTime = 0;
		Minecraft.getMinecraft().gameSettings.mouseSensitivity = defaultSensitivity;
		keyPressedSlow = false;
		playerCustom.slow = false;
	}
}
 
开发者ID:ZakCreeper,项目名称:CubesEdge,代码行数:24,代码来源:MovementSlowClient.java

示例5: onEnable

import net.minecraft.util.Timer; //导入依赖的package包/类
@Override
public void onEnable() {
    Timer.timerSpeed = 1.0f;
    this.cancel = false;
    this.stage = 1;
    this.moveSpeed = ((this.mc.thePlayer == null) ? 0.2873 : this.getBaseMoveSpeed());
    if (!this.disabling || !OptionManager.getOption("Boost", this).value || !OptionManager.getOption("Bhop", this).value) {
        super.onEnable();
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:11,代码来源:Speed.java

示例6: onDisable

import net.minecraft.util.Timer; //导入依赖的package包/类
@Override
public void onDisable() {
    Timer.timerSpeed = 1.0f;
    this.moveSpeed = this.getBaseMoveSpeed();
    if (OptionManager.getOption("Boost", this).value) {
        this.spedUp = false;
        this.disabling = true;
    }
    else {
        Speed.yOffset = 0.0;
        this.stage = 0;
        this.disabling = false;
        super.onDisable();
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:16,代码来源:Speed.java

示例7: getTimer

import net.minecraft.util.Timer; //导入依赖的package包/类
@Nullable
public static Timer getTimer() {
  if (timerField == null) {
    return null;
  }
  try {
    return (Timer) timerField.get(Minecraft.getMinecraft());
  } catch (Exception e) {
    e.printStackTrace();
    return null;
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderCore,代码行数:13,代码来源:RenderUtil.java

示例8: getPartialTick

import net.minecraft.util.Timer; //导入依赖的package包/类
public static float getPartialTick()
{
	try {
		Timer t = (Timer)MekanismUtils.getPrivateValue(Minecraft.getMinecraft(), Minecraft.class, ObfuscatedNames.Minecraft_timer);
		return t.renderPartialTicks;
	} catch(Exception e) {}
	
	return 0;
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:10,代码来源:MekanismRenderer.java

示例9: doDisable

import net.minecraft.util.Timer; //导入依赖的package包/类
@Override
protected void doDisable() {
    // check if it's still modified
    if (!(minecraftGetTimer(MC) instanceof FixedTimer)) {
        L.warn("Timer is already restored!");
        return;
    }

    // restore default timer
    minecraftSetTimer(MC, new Timer(defaultTps));
}
 
开发者ID:ata4,项目名称:minema,代码行数:12,代码来源:TimerModifier.java

示例10: minecraftGetTimer

import net.minecraft.util.Timer; //导入依赖的package包/类
default Timer minecraftGetTimer(Minecraft mc) {
    try {
        return ReflectionHelper.getPrivateValue(Minecraft.class, mc, PrivateAccessor.MINECRAFT_TIMER);
    } catch (Exception ex) {
        throw new RuntimeException("Can't get timer", ex);
    }
}
 
开发者ID:ata4,项目名称:minema,代码行数:8,代码来源:PrivateAccessor.java

示例11: minecraftSetTimer

import net.minecraft.util.Timer; //导入依赖的package包/类
default void minecraftSetTimer(Minecraft mc, Timer timer) {
    try {
        ReflectionHelper.setPrivateValue(Minecraft.class, mc, timer, PrivateAccessor.MINECRAFT_TIMER);
    } catch (Exception ex) {
        throw new RuntimeException("Can't set timer", ex);
    }
}
 
开发者ID:ata4,项目名称:minema,代码行数:8,代码来源:PrivateAccessor.java

示例12: timerGetTicksPerSecond

import net.minecraft.util.Timer; //导入依赖的package包/类
default float timerGetTicksPerSecond(Timer timer) {
    try {
        return ReflectionHelper.getPrivateValue(Timer.class, timer, PrivateAccessor.TIMER_TICKSPERSECOND);
    } catch (Exception ex) {
        // hard-coded default
        return 20;
    }
}
 
开发者ID:ata4,项目名称:minema,代码行数:9,代码来源:PrivateAccessor.java

示例13: getTimer

import net.minecraft.util.Timer; //导入依赖的package包/类
default Timer getTimer(Minecraft mc) {
    try {
        return ReflectionHelper.getPrivateValue(Minecraft.class, mc, MINECRAFT_TIMER);
    } catch (Exception ex) {
        L.error("getTimer() failed", ex);
        return null;
    }
}
 
开发者ID:ata4,项目名称:mineshot,代码行数:9,代码来源:PrivateAccessor.java

示例14: initRenders

import net.minecraft.util.Timer; //导入依赖的package包/类
@Override
public void initRenders() {
	ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPumpkin.class, new TileEntityPumpkinRenderer());

	ItemRendererPumpkin itemRendererPumpkin = new ItemRendererPumpkin();
	MinecraftForgeClient.registerItemRenderer(PumpkinCarvier.item_pumpkin, itemRendererPumpkin);
	MinecraftForgeClient.registerItemRenderer(PumpkinCarvier.item_lit_pumpkin, itemRendererPumpkin);

	mcTimer = (Timer) ReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getMinecraft(), PumpkinCarvier.F_TIMER);

	FMLCommonHandler.instance().bus().register(new TickHandlerPumpkin());
}
 
开发者ID:pau101,项目名称:Pumpkin-Carvier,代码行数:13,代码来源:ClientProxy.java

示例15: getTimer

import net.minecraft.util.Timer; //导入依赖的package包/类
@Override
public Timer getTimer() {
    return timer;
}
 
开发者ID:SerenityEnterprises,项目名称:SerenityCE,代码行数:5,代码来源:MixinMinecraft.java


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