net.minecraft.util.Timer Java Examples

The following examples show how to use net.minecraft.util.Timer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RenderUtils.java    From LiquidBounce with GNU General Public License v3.0 6 votes vote down vote up
public static void drawPlatform(final Entity entity, final Color color) {
    final RenderManager renderManager = mc.getRenderManager();
    final Timer timer = mc.timer;

    final double x = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * timer.renderPartialTicks
            - renderManager.renderPosX;
    final double y = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * timer.renderPartialTicks
            - renderManager.renderPosY;
    final double z = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * timer.renderPartialTicks
            - renderManager.renderPosZ;

    final AxisAlignedBB axisAlignedBB = entity.getEntityBoundingBox()
            .offset(-entity.posX, -entity.posY, -entity.posZ)
            .offset(x, y, z);

    drawAxisAlignedBB(
            new AxisAlignedBB(axisAlignedBB.minX, axisAlignedBB.maxY + 0.2, axisAlignedBB.minZ, axisAlignedBB.maxX, axisAlignedBB.maxY + 0.26, axisAlignedBB.maxZ),
            color
    );
}
 
Example #2
Source File: RenderUtils.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
public static void drawEntityBox(final Entity entity, final Color color, final boolean outline) {
    final RenderManager renderManager = mc.getRenderManager();
    final Timer timer = mc.timer;

    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    enableGlCap(GL_BLEND);
    disableGlCap(GL_TEXTURE_2D, GL_DEPTH_TEST);
    glDepthMask(false);

    final double x = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * timer.renderPartialTicks
            - renderManager.renderPosX;
    final double y = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * timer.renderPartialTicks
            - renderManager.renderPosY;
    final double z = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * timer.renderPartialTicks
            - renderManager.renderPosZ;

    final AxisAlignedBB entityBox = entity.getEntityBoundingBox();
    final AxisAlignedBB axisAlignedBB = new AxisAlignedBB(
            entityBox.minX - entity.posX + x - 0.05D,
            entityBox.minY - entity.posY + y,
            entityBox.minZ - entity.posZ + z - 0.05D,
            entityBox.maxX - entity.posX + x + 0.05D,
            entityBox.maxY - entity.posY + y + 0.15D,
            entityBox.maxZ - entity.posZ + z + 0.05D
    );

    if (outline) {
        glLineWidth(1F);
        enableGlCap(GL_LINE_SMOOTH);
        glColor(color.getRed(), color.getGreen(), color.getBlue(), 95);
        drawSelectionBoundingBox(axisAlignedBB);
    }

    glColor(color.getRed(), color.getGreen(), color.getBlue(), outline ? 26 : 35);
    drawFilledBox(axisAlignedBB);
    GlStateManager.resetColor();
    glDepthMask(true);
    resetCaps();
}
 
Example #3
Source File: HyperiumMinecraft.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void loop(boolean inGameHasFocus, WorldClient theWorld, EntityPlayerSP thePlayer, RenderManager renderManager, Timer timer) {
    if (inGameHasFocus && theWorld != null) {
        HyperiumHandlers handlers = Hyperium.INSTANCE.getHandlers();
        RenderPlayerEvent event = new RenderPlayerEvent(thePlayer, renderManager, renderManager.viewerPosZ, renderManager.viewerPosY, renderManager.viewerPosZ,
            timer.renderPartialTicks);
        if (handlers != null && Settings.SHOW_PART_1ST_PERSON) {
            handlers.getParticleAuraHandler().renderPlayer(event);
        }
    }
}
 
Example #4
Source File: TimerHack.java    From ForgeWurst with GNU General Public License v3.0 5 votes vote down vote up
private void setTickLength(float tickLength)
{
	try
	{
		Field fTimer = mc.getClass().getDeclaredField(
			wurst.isObfuscated() ? "field_71428_T" : "timer");
		fTimer.setAccessible(true);
		
		if(WMinecraft.VERSION.equals("1.10.2"))
		{
			Field fTimerSpeed = Timer.class.getDeclaredField(
				wurst.isObfuscated() ? "field_74278_d" : "timerSpeed");
			fTimerSpeed.setAccessible(true);
			fTimerSpeed.setFloat(fTimer.get(mc), 50 / tickLength);
			
		}else
		{
			Field fTickLength = Timer.class.getDeclaredField(
				wurst.isObfuscated() ? "field_194149_e" : "tickLength");
			fTickLength.setAccessible(true);
			fTickLength.setFloat(fTimer.get(mc), tickLength);
		}
		
	}catch(ReflectiveOperationException e)
	{
		throw new RuntimeException(e);
	}
}
 
Example #5
Source File: RenderUtils.java    From LiquidBounce with GNU General Public License v3.0 4 votes vote down vote up
public static void drawBlockBox(final BlockPos blockPos, final Color color, final boolean outline) {
    final RenderManager renderManager = mc.getRenderManager();
    final Timer timer = mc.timer;

    final double x = blockPos.getX() - renderManager.renderPosX;
    final double y = blockPos.getY() - renderManager.renderPosY;
    final double z = blockPos.getZ() - renderManager.renderPosZ;

    AxisAlignedBB axisAlignedBB = new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0);
    final Block block = BlockUtils.getBlock(blockPos);

    if (block != null) {
        final EntityPlayer player = mc.thePlayer;

        final double posX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) timer.renderPartialTicks;
        final double posY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) timer.renderPartialTicks;
        final double posZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) timer.renderPartialTicks;
        axisAlignedBB = block.getSelectedBoundingBox(mc.theWorld, blockPos)
                .expand(0.0020000000949949026D, 0.0020000000949949026D, 0.0020000000949949026D)
                .offset(-posX, -posY, -posZ);
    }

    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    enableGlCap(GL_BLEND);
    disableGlCap(GL_TEXTURE_2D, GL_DEPTH_TEST);
    glDepthMask(false);

    glColor(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha() != 255 ? color.getAlpha() : outline ? 26 : 35);
    drawFilledBox(axisAlignedBB);

    if (outline) {
        glLineWidth(1F);
        enableGlCap(GL_LINE_SMOOTH);
        glColor(color);

        drawSelectionBoundingBox(axisAlignedBB);
    }

    GlStateManager.resetColor();
    glDepthMask(true);
    resetCaps();
}
 
Example #6
Source File: WrapperTimer.java    From ClientBase with MIT License 4 votes vote down vote up
public WrapperTimer(Timer var1) {
    this.real = var1;
}
 
Example #7
Source File: WrapperTimer.java    From ClientBase with MIT License 4 votes vote down vote up
public Timer unwrap() {
    return this.real;
}
 
Example #8
Source File: Speed.java    From ehacks-pro with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onTicks() {
    Timer timer = (Timer) ReflectionHelper.getPrivateValue(Minecraft.class, Wrapper.INSTANCE.mc(), new String[]{Mappings.timer});
    timer.timerSpeed = (float) CheatConfiguration.config.speedhack;
}
 
Example #9
Source File: Speed.java    From ehacks-pro with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onModuleDisabled() {
    Timer timer = (Timer) ReflectionHelper.getPrivateValue(Minecraft.class, Wrapper.INSTANCE.mc(), new String[]{Mappings.timer});
    timer.timerSpeed = 1.0f;
}
 
Example #10
Source File: TimerMod.java    From ForgeHax with MIT License 4 votes vote down vote up
private void setSpeed(float value) {
  Timer timer = FastReflection.Fields.Minecraft_timer.get(MC);
  FastReflection.Fields.Timer_tickLength.set(timer, value);
}