本文整理汇总了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;
}
}
}
});
}
示例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();
}
}
示例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));
}
示例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;
}
}
示例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();
}
}
示例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();
}
}
示例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;
}
}
示例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;
}
示例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));
}
示例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);
}
}
示例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);
}
}
示例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;
}
}
示例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;
}
}
示例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());
}
示例15: getTimer
import net.minecraft.util.Timer; //导入依赖的package包/类
@Override
public Timer getTimer() {
return timer;
}