Java Code Examples for net.minecraft.client.Minecraft#getMinecraft()

The following examples show how to use net.minecraft.client.Minecraft#getMinecraft() . 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: GuiTextArea.java    From pycode-minecraft with MIT License 6 votes vote down vote up
GuiTextArea(int id, FontRenderer fontRenderer, int x, int y, int width, int height) {
    this.id = id;
    this.fontRenderer = fontRenderer;
    this.xPosition = x;
    this.yPosition = y;
    this.width = width;
    this.maxRows = height / fontRenderer.FONT_HEIGHT;
    this.height = maxRows * fontRenderer.FONT_HEIGHT;

    this.textYOffset = 0;
    this.textXOffset = 0;

    ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft());
    int factor = sr.getScaleFactor();

    // screen y increases up, figure where the bottom of the text area is
    int by = Minecraft.getMinecraft().currentScreen.height - (this.yPosition + this.height);
    this.xScissor = this.xPosition*factor;
    this.yScissor = by*factor;
    this.wScissor = this.width*factor;
    this.hScissor = this.height*factor;
}
 
Example 2
Source File: CrystalAuraModule.java    From seppuku with GNU General Public License v3.0 6 votes vote down vote up
private boolean canPlaceCrystal(BlockPos pos) {
    final Minecraft mc = Minecraft.getMinecraft();

    final Block block = mc.world.getBlockState(pos).getBlock();

    if (block == Blocks.OBSIDIAN || block == Blocks.BEDROCK) {
        final Block floor = mc.world.getBlockState(pos.add(0, 1, 0)).getBlock();
        final Block ceil = mc.world.getBlockState(pos.add(0, 2, 0)).getBlock();

        if (floor == Blocks.AIR && ceil == Blocks.AIR) {
            if (mc.world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(pos.add(0, 1, 0))).isEmpty()) {
                if (mc.player.getDistance(pos.getX() + 0.5f, pos.getY() + 0.5f, pos.getZ() + 0.5f) <= this.range.getValue()) {
                    return true;
                }
            }
        }
    }

    return false;
}
 
Example 3
Source File: MinigameListener.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
@InvokeEvent
public void onTick(TickEvent event) {
    if (Minecraft.getMinecraft().theWorld != null && Hyperium.INSTANCE.getHandlers().getHypixelDetector().isHypixel() &&
        Minecraft.getMinecraft().theWorld.getScoreboard() != null) {
        if (cooldown <= 0) {
            cooldown = 3 * 20;
            String minigameName = getScoreboardTitle();
            Arrays.stream(Minigame.values()).filter(m -> minigameName.equalsIgnoreCase(m.scoreName) &&
                !minigameName.equalsIgnoreCase(currentMinigameName)).forEach(m -> {
                currentMinigameName = minigameName;
                EventBus.INSTANCE.post(new JoinMinigameEvent(m));
            });
        } else {
            cooldown--;
        }
    }
}
 
Example 4
Source File: DirectionHUD.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void draw(int x, double y, boolean isConfig) {
    List<String> list = new ArrayList<>();
    EntityPlayer player = Minecraft.getMinecraft().thePlayer;
    if (player != null) {
        int d = (int) player.rotationYaw;
        if (d < 0) d += 360;
        d += 22;
        int direction = (d % 360);
        direction = direction / (45);

        try {
            while (direction < 0) {
                direction += 8;
            }

            list.add(!shortDirection ? dir[direction] : dirShort[direction]);
        } catch (Exception ignored) {}
    }

    ElementRenderer.draw(x, y, list);
    width = isConfig ? ElementRenderer.maxWidth(list) : 0;
}
 
Example 5
Source File: NoAfkModule.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
@Listener
public void onWalkingUpdate(EventUpdateWalkingPlayer event) {
    if (event.getStage() == EventStageable.EventStage.PRE) {
        final Minecraft mc = Minecraft.getMinecraft();
        float yaw = mc.player.rotationYaw;
        yaw += (1 * Math.sin(mc.player.ticksExisted / Math.PI));
        Seppuku.INSTANCE.getRotationManager().setPlayerRotations(yaw, mc.player.rotationPitch);
    }
}
 
Example 6
Source File: ClientProxy.java    From Et-Futurum with The Unlicense 5 votes vote down vote up
@SuppressWarnings("unchecked")
private void registerEntityRenderers() {
	if (EtFuturum.enableArmourStand)
		RenderingRegistry.registerEntityRenderingHandler(EntityArmourStand.class, new ArmourStandRenderer());
	if (EtFuturum.enableEndermite)
		RenderingRegistry.registerEntityRenderingHandler(EntityEndermite.class, new EndermiteRenderer());
	if (EtFuturum.enableRabbit)
		RenderingRegistry.registerEntityRenderingHandler(EntityRabbit.class, new RabbitRenderer());
	if (EtFuturum.enableLingeringPotions) {
		RenderingRegistry.registerEntityRenderingHandler(EntityLingeringPotion.class, new LingeringPotionRenderer());
		RenderingRegistry.registerEntityRenderingHandler(EntityLingeringEffect.class, new LingeringEffectRenderer());
	}
	if (EtFuturum.enableVillagerZombies)
		RenderingRegistry.registerEntityRenderingHandler(EntityZombieVillager.class, new VillagerZombieRenderer());
	if (EtFuturum.enableDragonRespawn)
		RenderingRegistry.registerEntityRenderingHandler(EntityPlacedEndCrystal.class, new PlacedEndCrystalRenderer());
	if (EtFuturum.enablePlayerSkinOverlay) {
		TextureManager texManager = Minecraft.getMinecraft().renderEngine;
		File fileAssets = ReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getMinecraft(), "fileAssets", "field_110446_Y", " field_110607_c");
		File skinFolder = new File(fileAssets, "skins");
		MinecraftSessionService sessionService = Minecraft.getMinecraft().func_152347_ac();
		ReflectionHelper.setPrivateValue(Minecraft.class, Minecraft.getMinecraft(), new NewSkinManager(Minecraft.getMinecraft().func_152342_ad(), texManager, skinFolder, sessionService), "field_152350_aA");

		RenderManager.instance.entityRenderMap.put(EntityPlayer.class, new NewRenderPlayer());
	}
	if (EtFuturum.enableShearableGolems)
		RenderingRegistry.registerEntityRenderingHandler(EntityNewSnowGolem.class, new NewSnowGolemRenderer());
}
 
Example 7
Source File: HolesModule.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
@Listener
public void onUpdate(EventPlayerUpdate event) {
    final Minecraft mc = Minecraft.getMinecraft();

    if (mc.player == null)
        return;

    this.holes.clear();

    final Vec3i playerPos = new Vec3i(mc.player.posX, mc.player.posY, mc.player.posZ);

    for (int x = playerPos.getX() - radius.getValue(); x < playerPos.getX() + radius.getValue(); x++) {
        for (int z = playerPos.getZ() - radius.getValue(); z < playerPos.getZ() + radius.getValue(); z++) {
            for (int y = playerPos.getY(); y > playerPos.getY() - 4; y--) {
                final BlockPos blockPos = new BlockPos(x, y, z);
                final IBlockState blockState = mc.world.getBlockState(blockPos);
                if (this.isBlockValid(blockState, blockPos)) {
                    final IBlockState downBlockState = mc.world.getBlockState(blockPos.down());
                    if (downBlockState.getBlock() == Blocks.AIR) {
                        final BlockPos downPos = blockPos.down();
                        if (this.isBlockValid(downBlockState, downPos)) {
                            this.holes.add(new Hole(downPos.getX(), downPos.getY(), downPos.getZ(), true));
                        }
                    } else {
                        this.holes.add(new Hole(blockPos.getX(), blockPos.getY(), blockPos.getZ()));
                    }
                }
            }
        }
    }
}
 
Example 8
Source File: BaitManager.java    From SkyblockAddons with MIT License 5 votes vote down vote up
/**
 * Check if our Player is holding a Fishing Rod, and filters out the Grapple Hook (If any more items are made that
 * are Items.fishing_rods but aren't used for fishing, add them here)
 *
 * @return True if it can be used for fishing
 */
public boolean isHoldingRod() {
    EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;

    if (player != null) {
        ItemStack item = player.getHeldItem();
        if (item == null || item.getItem() != Items.fishing_rod) return false;

        return !"GRAPPLING_HOOK".equals(ItemUtils.getSkyBlockItemID(item));
    }
    return false;
}
 
Example 9
Source File: CommandEntity.java    From wailanbt with MIT License 5 votes vote down vote up
@Override
public void processCommand(ICommandSender sender, String[] array) {
    EntityPlayer player = (EntityPlayer) sender;
    Minecraft minecraft = Minecraft.getMinecraft();
    MovingObjectPosition objectMouseOver = minecraft.objectMouseOver;
    if (objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY){
        Class pointEntityClass  = objectMouseOver.entityHit.getClass();
        if (EntityList.classToStringMapping.containsKey(pointEntityClass)){
         player.addChatComponentMessage(new ChatComponentText(EntityList.getEntityString(objectMouseOver.entityHit)));
        }
    }else{
        player.addChatComponentMessage(new ChatComponentTranslation("wailanbt.info.NotPointing"));
    }
}
 
Example 10
Source File: NoBiomeColorModule.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
private void reload() {
    final Minecraft mc = Minecraft.getMinecraft();

    if (mc.world != null) {
        mc.renderGlobal.markBlockRangeForRenderUpdate(
                (int) mc.player.posX - 256,
                (int) mc.player.posY - 256,
                (int) mc.player.posZ - 256,
                (int) mc.player.posX + 256,
                (int) mc.player.posY + 256,
                (int) mc.player.posZ + 256);
    }
}
 
Example 11
Source File: ArtifactClientEventHandler.java    From Artifacts with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onFogRender(FogDensity event) {
	//Handle player "cloaking" with Obscurity component.
	Minecraft mc = Minecraft.getMinecraft();
	if((cloaked && !mc.thePlayer.isPotionActive(Potion.invisibility)) || mc.thePlayer.isPotionActive(Potion.blindness)) {
		cloaked = false;
	}
	
	//Make the fog max depend on the render distance.
	float fogMax = mc.gameSettings.renderDistanceChunks * 16;
	if(fogCurrent > fogMax) {
		fogCurrent = fogMax;
	}

       //Check if the effect should or shouldn't be applied (it shouldn't if the player already has a strong fog effect).
	if(!mc.thePlayer.isPotionActive(Potion.blindness) && !mc.thePlayer.isInsideOfMaterial(Material.water) && !mc.thePlayer.isInsideOfMaterial(Material.lava)) {
	   //Note to self - this didn't work that well: && !BlockQuickSand.headInQuicksand(mc.theWorld, MathHelper.floor_double(mc.thePlayer.posX), MathHelper.floor_double(mc.thePlayer.posY + mc.thePlayer.getEyeHeight()), MathHelper.floor_double(mc.thePlayer.posZ), mc.thePlayer)
		
		//If the player is cloaked, render the fog coming in. It stops when it reaches fogMin.
		if(cloaked) {
			event.setCanceled(true);
			if(fogCurrent > fogMin + 0.01) {
				fogCurrent -= (fogCurrent-fogMin)/fogMax * 0.3f;
			}
		}
		//Otherwise render the fog going out, then stop rendering when it reaches fogMax.
		else {
			if(fogCurrent < fogMax) {
				event.setCanceled(true);
				
				fogCurrent += 0.1f;
			}
		} 
	}
	else {
		//"Insta-move" the fog if it isn't rendering.
		if(cloaked) {
			fogCurrent = fogMin;
		}
		else {
			fogCurrent = fogMax;
		}
	}
	
	//Render the fog.
	if(event.isCanceled()) {
		GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_LINEAR);

		GL11.glFogf(GL11.GL_FOG_START, fogCurrent * 0.25F);
		GL11.glFogf(GL11.GL_FOG_END, fogCurrent);

		if (GLContext.getCapabilities().GL_NV_fog_distance)
		{
			GL11.glFogi(34138, 34139);
		}
	}
}
 
Example 12
Source File: YouCouldMakeAReligionOutOfThis.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
@SubscribeEvent
@SideOnly(Side.CLIENT)
public static void onClientTick(TickEvent.ClientTickEvent event) {
    if (event.phase == TickEvent.Phase.START) {
        Minecraft client = Minecraft.getMinecraft();
        if (client.world != null && !client.isGamePaused()) {
            RANDOM.setSeed((client.world.getTotalWorldTime() * M) ^ client.world.getSeed());
            if (RANDOM.nextInt(CHANCE) == 0) {
                ISound sound = PositionedSoundRecord.getMasterRecord(YOU_COULD_MAKE_A_RELIGION_OUT_OF_THIS, 1.0F);
                client.getSoundHandler().playSound(sound);
            }
        }
    }
}
 
Example 13
Source File: RenderChunkSchematicVbo.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void rebuildWorldView()
{
    synchronized (this.boxes)
    {
        this.ignoreClientWorldFluids = Configs.Visuals.IGNORE_EXISTING_FLUIDS.getBooleanValue();
        this.overlayEnabled = Configs.Visuals.ENABLE_SCHEMATIC_OVERLAY.getBooleanValue();
        this.overlayReducedInnerSides = Configs.Visuals.OVERLAY_REDUCED_INNER_SIDES.getBooleanValue();
        this.overlayLinesEnabled = Configs.Visuals.SCHEMATIC_OVERLAY_ENABLE_OUTLINES.getBooleanValue();
        this.overlayModelLines = Configs.Visuals.SCHEMATIC_OVERLAY_MODEL_OUTLINE.getBooleanValue();
        this.overlayModelSides = Configs.Visuals.SCHEMATIC_OVERLAY_MODEL_SIDES.getBooleanValue();
        this.overlaySidesEnabled = Configs.Visuals.SCHEMATIC_OVERLAY_ENABLE_SIDES.getBooleanValue();
        this.renderColliding = Configs.Visuals.RENDER_COLLIDING_SCHEMATIC_BLOCKS.getBooleanValue();
        this.renderAsTranslucent = Configs.Visuals.RENDER_BLOCKS_AS_TRANSLUCENT.getBooleanValue();
        this.overlayTypeExtra = Configs.Visuals.SCHEMATIC_OVERLAY_TYPE_EXTRA.getBooleanValue();
        this.overlayTypeMissing = Configs.Visuals.SCHEMATIC_OVERLAY_TYPE_MISSING.getBooleanValue();
        this.overlayTypeWrongBlock = Configs.Visuals.SCHEMATIC_OVERLAY_TYPE_WRONG_BLOCK.getBooleanValue();
        this.overlayTypeWrongState = Configs.Visuals.SCHEMATIC_OVERLAY_TYPE_WRONG_STATE.getBooleanValue();

        this.overlayColorExtra = Configs.Colors.SCHEMATIC_OVERLAY_COLOR_EXTRA.getColor();
        this.overlayColorMissing = Configs.Colors.SCHEMATIC_OVERLAY_COLOR_MISSING.getColor();
        this.overlayColorWrongBlock = Configs.Colors.SCHEMATIC_OVERLAY_COLOR_WRONG_BLOCK.getColor();
        this.overlayColorWrongState = Configs.Colors.SCHEMATIC_OVERLAY_COLOR_WRONG_STATE.getColor();

        this.schematicWorldView = new ChunkCacheSchematic(this.getWorld(), this.getPosition(), 2);
        this.clientWorldView    = new ChunkCacheSchematic(Minecraft.getMinecraft().world, this.getPosition(), 2);

        BlockPos pos = this.getPosition();
        SubChunkPos subChunk = new SubChunkPos(pos.getX() >> 4, pos.getY() >> 4, pos.getZ() >> 4);
        this.boxes.clear();
        this.boxes.addAll(DataManager.getSchematicPlacementManager().getTouchedBoxesInSubChunk(subChunk));
    }
}
 
Example 14
Source File: ClientProxy.java    From EnderZoo with Creative Commons Zero v1.0 Universal 4 votes vote down vote up
@Override
public EntityPlayer getClientPlayer() {
  return Minecraft.getMinecraft().player;
}
 
Example 15
Source File: NearbySmeltCommandsImplementation.java    From malmo with MIT License 4 votes vote down vote up
@Override
public IMessage onMessage(SmeltNearbyMessage message, MessageContext ctx) {
    EntityPlayerMP player = ctx.getServerHandler().playerEntity;
    Vec3d headPos = new Vec3d(player.posX, player.posY + 1.6, player.posZ);

    // Location checking
    boolean closeFurnace = false;
    for (BlockPos furnace : furnaces) {
        Vec3d blockVec = new Vec3d(furnace.getX() + 0.5, furnace.getY() + 0.5, furnace.getZ() + 0.5);

        if (headPos.squareDistanceTo(blockVec) <= 25.0) {
            // Within a reasonable FOV?
            // Lots of trig, let's go
            double fov = Minecraft.getMinecraft().gameSettings.fovSetting;
            double height = Minecraft.getMinecraft().displayHeight;
            double width = Minecraft.getMinecraft().displayWidth;
            Vec3d lookVec = player.getLookVec();
            Vec3d toBlock = blockVec.subtract(headPos);

            // Projection of block onto player look vector - if greater than 0, then in front of us
            double scalarProjection = lookVec.dotProduct(toBlock) / lookVec.lengthVector();
            if (scalarProjection > 0) {
                Vec3d yUnit = new Vec3d(0, 1.0, 0);
                Vec3d lookCross = lookVec.crossProduct(yUnit);
                Vec3d blockProjectedOntoCross = lookCross.scale(lookCross.dotProduct(toBlock) / lookCross.lengthVector());
                Vec3d blockProjectedOntoPlayerPlane = toBlock.subtract(blockProjectedOntoCross);
                double xyDot = lookVec.dotProduct(blockProjectedOntoPlayerPlane);
                double pitchTheta = Math.acos(xyDot / (lookVec.lengthVector() * blockProjectedOntoPlayerPlane.lengthVector()));

                Vec3d playerY = lookCross.crossProduct(lookVec);
                Vec3d blockProjectedOntoPlayerY = playerY.scale(playerY.dotProduct(toBlock) / playerY.lengthVector());
                Vec3d blockProjectedOntoYawPlane = toBlock.subtract(blockProjectedOntoPlayerY);
                double xzDot = lookVec.dotProduct(blockProjectedOntoYawPlane);
                double yawTheta = Math.acos(xzDot / (lookVec.lengthVector() * blockProjectedOntoYawPlane.lengthVector()));

                if (Math.abs(Math.toDegrees(yawTheta)) <= Math.min(1, width / height) * (fov / 2.0) && Math.abs(Math.toDegrees(pitchTheta)) <= Math.min(1, height / width) * (fov / 2.0))
                    closeFurnace = true;
            }
        }
    }

    if (closeFurnace) {
        ItemStack input = CraftingHelper.getSmeltingRecipeForRequestedOutput(message.parameters);
        if (input != null)
            if (CraftingHelper.attemptSmelting(player, input))
                return null;
    }

    return null;
}
 
Example 16
Source File: ScoreboardDisplay.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void draw(int starX, double startY, boolean config) {
    if (objective != null) {
        boolean guiF = false;

        Scoreboard scoreboard = objective.getScoreboard();
        Collection<Score> collection = scoreboard.getSortedScores(objective);
        List<Score> list = collection.stream().filter(p_apply_1_ -> p_apply_1_.getPlayerName() != null &&
            !p_apply_1_.getPlayerName().startsWith("#")).collect(Collectors.toList());

        collection = list.size() > 15 ? Lists.newArrayList(Iterables.skip(list, collection.size() - 15)) : list;

        int i = Minecraft.getMinecraft().fontRendererObj.getStringWidth(objective.getDisplayName());

        for (Score score : collection) {
            ScorePlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(score.getPlayerName());
            String s = ScorePlayerTeam.formatPlayerName(scoreplayerteam, score.getPlayerName()) + ": " + EnumChatFormatting.RED + score.getScorePoints();
            i = Math.max(i, Minecraft.getMinecraft().fontRendererObj.getStringWidth(s));
        }

        int i1 = collection.size() * Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT;
        int l1 = starX;
        if (ElementRenderer.getCurrent().isRightSided()) l1 -= i;
        int j = 0;

        int k;
        for (Score score1 : collection) {
            ++j;
            ScorePlayerTeam scoreplayerteam1 = scoreboard.getPlayersTeam(score1.getPlayerName());
            String s1 = ScorePlayerTeam.formatPlayerName(scoreplayerteam1, score1.getPlayerName());
            String s2 = EnumChatFormatting.RED + "" + score1.getScorePoints();
            k = ((int) startY) + (collection.size() - j + 1) * Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT;

            if (ElementRenderer.getCurrent().isHighlighted()) {
                if (guiF) {
                    Gui.drawRect(l1 - 2, k, l1 + i, k + Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT, 1342177280);
                } else {
                    RenderUtils.drawRect(l1 - 2, k, l1 + i, k + Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT, 1342177280);
                }
            }

            Minecraft.getMinecraft().fontRendererObj.drawString(s1, l1, k, Color.WHITE.getRGB());
            if (data.optBoolean("numbers")) {
                Minecraft.getMinecraft().fontRendererObj.drawString(s2, l1 + i - Minecraft.getMinecraft().fontRendererObj.getStringWidth(s2), k, Color.WHITE.getRGB());
            }

            if (j == collection.size()) {
                String s3 = objective.getDisplayName();
                if (ElementRenderer.getCurrent().isHighlighted()) {
                    if (guiF) {
                        Gui.drawRect(l1 - 2, k - Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT - 1, l1 + i, k - 1, 1610612736);
                        Gui.drawRect(l1 - 2, k - 1, l1 + i, k, 1342177280);
                    } else {
                        RenderUtils.drawRect(l1 - 2, k - Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT - 1, l1 + i, k - 1, 1610612736);
                        RenderUtils.drawRect(l1 - 2, k - 1, l1 + i, k, 1342177280);
                    }
                }

                Minecraft.getMinecraft().fontRendererObj.drawString(s3, l1 + i / 2 - Minecraft.getMinecraft().fontRendererObj.getStringWidth(s3) / 2, k - Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT, Color.WHITE.getRGB());
            }
        }

        width = i - (data.optBoolean("numbers") ? 0 : 10);
        height = i1 + 10;
    }
}
 
Example 17
Source File: CommandForWheeledRobotNavigationImplementation.java    From malmo with MIT License 4 votes vote down vote up
@Override
public void deinstall(MissionInit missionInit)
{
    // Restore the player's normal movement control:
    EntityPlayerSP player = Minecraft.getMinecraft().player;
    if (player != null)
    {
        player.movementInput = this.originalMovement;
    }
    
    MinecraftForge.EVENT_BUS.unregister(this);
}
 
Example 18
Source File: TileEntityScannerRenderer.java    From Cyberware with MIT License 4 votes vote down vote up
@Override
public void renderTileEntityAt(TileEntityScanner te, double x, double y, double z, float partialTicks, int destroyStage)
{
	if (te != null)
	{
		float ticks = Minecraft.getMinecraft().thePlayer.ticksExisted + partialTicks;
		
		GL11.glPushMatrix();
		GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
		GL11.glTranslated(x+.5, y+.5, z+.5);
		
		IBlockState state = te.getWorld().getBlockState(te.getPos());
		if (state.getBlock() == CyberwareContent.scanner)
		{
			ItemStack stack = te.slots.getStackInSlot(0);
			if (stack != null)
			{
				Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
				GL11.glPushMatrix();
				GlStateManager.color(1F, 1F, 1F, 1F);
				GL11.glTranslatef(0F, -1.6F / 16F, 0F);
				GL11.glScalef(.8F, .8F, .8F);
				GL11.glRotatef(90F, 1F, 0F, 0F);
				Minecraft.getMinecraft().getRenderItem().renderItem(stack, ItemCameraTransforms.TransformType.NONE);
				GL11.glPopMatrix();
			}
			ClientUtils.bindTexture(texture);

			int difference = Math.abs(te.x - te.lastX);
			float timeToTake = difference * 3;
			float time = Math.min(timeToTake, te.ticks + partialTicks - te.ticksMove);
			float progress = (float) Math.cos((Math.PI / 2) * (1F - (time / timeToTake)));
			if (difference == 0)
			{
				progress = 1.0F;
			}
			GL11.glTranslatef(0F, 0F, ((te.lastX + (te.x - te.lastX) * progress) + 1.5F) * 1F / 16F);
			
			model.render(null, 0, 0, 0, 0, 0, .0625f);
			
			int difference2 = Math.abs(te.z - te.lastZ);
			float timeToTake2 = difference2 * 3;
			float time2 = Math.max(0, Math.min(timeToTake2, te.ticks + partialTicks - te.ticksMove/* - timeToTake*/));
			float progress2 = (float) Math.cos((Math.PI / 2) * (1F - (time2 / timeToTake2)));
			if (difference2 == 0)
			{
				progress2 = 1.0F;
			}
			GL11.glTranslatef(((te.lastZ + (te.z - te.lastZ) * progress2) + .5F) * 1F / 16F, 0F, 0F);
			
			model.renderScanner(null, 0, 0, 0, 0, 0, .0625f);

			if (te.ticks > 0 && (progress2 >= 1F && progress >= 1F) && (((int) (te.ticks + partialTicks)) % 2F == 0))
			{
				GL11.glEnable(GL11.GL_BLEND);
				model.renderBeam(null, 0, 0, 0, 0, 0, 0.0625F);
				GL11.glDisable(GL11.GL_BLEND);
			}
			
			
			GL11.glPopMatrix();
		}
	}
}
 
Example 19
Source File: ActionWidgetDropdown.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public WidgetComboBox getWidget(){
    if(widget == null) {
        widget = new WidgetComboBox(Minecraft.getMinecraft().fontRenderer, x, y, width, height);
        widget.setElements(getDropdownElements());
        widget.setFixedOptions();
        updateWidget();
    }
    return widget;
}
 
Example 20
Source File: FakeWorldServer.java    From Framez with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected int func_152379_p() {

    return Minecraft.getMinecraft().gameSettings.renderDistanceChunks;
}