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

The following examples show how to use net.minecraft.client.Minecraft#getInstance() . 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: IngameOverlay.java    From bleachhack-1.14 with GNU General Public License v3.0 6 votes vote down vote up
public void drawArrayList() {
	if (Minecraft.getInstance().gameSettings.showDebugInfo) return;
	List<String> lines = new ArrayList<>();
	
	for (Module m: ModuleManager.getModules()) if (m.isToggled()) lines.add(m.getName());
	
	lines.sort((a, b) -> Integer.compare(font.getStringWidth(b), font.getStringWidth(a)));
	
	int count = 0;
	int color = 0x40bbff;
	for (String s: lines) {
		fill(0, 1+(count*10),font.getStringWidth(s)+3, 11+(count*10), 0x50000000);
		font.drawStringWithShadow(s, 2, 2+(count*10), color);
		color -= 200/lines.size();
		count++;
	}
}
 
Example 2
Source File: GuiSelectionScreen.java    From XRay-Mod with GNU General Public License v3.0 6 votes vote down vote up
@Override // @mcp: func_230432_a_  = render
public void func_230432_a_(MatrixStack stack, int entryIdx, int top, int left, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean p_194999_5_, float partialTicks) {
    BlockData blockData = this.block;

    FontRenderer font = Minecraft.getInstance().fontRenderer;
    // @mcp: func_238407_a_ = drawString
    font.func_238407_a_(stack, ITextProperties.func_240652_a_(blockData.getEntryName()), left + 40, top + 7, 0xFFFFFF);
    font.func_238407_a_(stack, ITextProperties.func_240652_a_(blockData.isDrawing() ? "Enabled" : "Disabled"), left + 40, top + 17, blockData.isDrawing() ? Color.GREEN.getRGB() : Color.RED.getRGB());

    RenderHelper.enableStandardItemLighting();
    Minecraft.getInstance().getItemRenderer().renderItemAndEffectIntoGUI(blockData.getItemStack(), left + 15, top + 7);
    RenderHelper.disableStandardItemLighting();
    if (mouseX > left && mouseX < (left + entryWidth) && mouseY > top && mouseY < (top + entryHeight) && mouseY < (this.parent.getTop() + this.parent.getHeight()) && mouseY > this.parent.getTop()) {
        this.parent.parent.func_238654_b_(
                stack,
                Arrays.asList(new TranslationTextComponent("xray.tooltips.edit1"), new TranslationTextComponent("xray.tooltips.edit2")),
                left + 15,
                (entryIdx == this.parent.func_231039_at__().size() - 1 ? (top - (entryHeight - 20)) : (top + (entryHeight + 15))) // @mcp: func_231039_at__ = getEntries
        );  // @mcp: func_230457_a_ = renderTooltip
    }

    RenderSystem.enableAlphaTest();
    RenderSystem.enableBlend();
    RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
    Minecraft.getInstance().getRenderManager().textureManager.bindTexture(GuiSelectionScreen.CIRCLE);
    GuiBase.drawTexturedQuadFit((left + entryWidth) - 37, top + (entryHeight / 2f) - 9, 14, 14, new int[]{255, 255, 255}, 50f);
    GuiBase.drawTexturedQuadFit((left + entryWidth) - 35, top + (entryHeight / 2f) - 7, 10, 10, blockData.getColor());
    RenderSystem.disableAlphaTest();
    RenderSystem.disableBlend();
}
 
Example 3
Source File: CustomParticleHandler.java    From CodeChickenLib with GNU Lesser General Public License v2.1 6 votes vote down vote up
@OnlyIn (Dist.CLIENT)
public static boolean handleRunningEffects(World world, BlockPos pos, BlockState state, Entity entity) {
    //Spoof a raytrace from the feet.
    BlockRayTraceResult traceResult = new BlockRayTraceResult(entity.getPositionVec().add(0, 1, 0), Direction.UP, pos, false);
    BlockModelShapes modelShapes = Minecraft.getInstance().getBlockRendererDispatcher().getBlockModelShapes();
    IBakedModel model = modelShapes.getModel(state);
    if (model instanceof IModelParticleProvider) {
        IModelData modelData = ModelDataManager.getModelData(world, pos);
        ParticleManager particleManager = Minecraft.getInstance().particles;
        List<TextureAtlasSprite> sprites = new ArrayList<>(((IModelParticleProvider) model).getHitEffects(traceResult, state, world, pos, modelData));
        TextureAtlasSprite rolledSprite = sprites.get(world.rand.nextInt(sprites.size()));
        double x = entity.getPosX() + (world.rand.nextFloat() - 0.5D) * entity.getWidth();
        double y = entity.getBoundingBox().minY + 0.1D;
        double z = entity.getPosZ() + (world.rand.nextFloat() - 0.5D) * entity.getWidth();
        particleManager.addEffect(new CustomBreakingParticle(world, x, y, z, -entity.getMotion().x * 4.0D, 1.5D, -entity.getMotion().z * 4.0D, rolledSprite));
        return true;
    }

    return false;
}
 
Example 4
Source File: MixinChatScreen.java    From BoundingBoxOutlineReloaded with MIT License 5 votes vote down vote up
@Inject(method = "keyPressed", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;displayGuiScreen(Lnet/minecraft/client/gui/screen/Screen;)V", shift = At.Shift.BEFORE), cancellable = true)
private void keyPressed(CallbackInfoReturnable<Boolean> cir) {
    if (Minecraft.getInstance().currentScreen instanceof ListScreen) {
        cir.setReturnValue(true);
        cir.cancel();
    }
}
 
Example 5
Source File: BlockRenderingRegistry.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@OnlyIn (Dist.CLIENT)
public static void init() {
    if (!initialized) {
        Minecraft mc = Minecraft.getInstance();
        BlockRendererDispatcher parentDispatcher = mc.getBlockRendererDispatcher();
        mc.blockRenderDispatcher = new CCBlockRendererDispatcher(parentDispatcher, mc.getBlockColors());
        initialized = true;
    }
}
 
Example 6
Source File: ControlList.java    From BoundingBoxOutlineReloaded with MIT License 5 votes vote down vote up
ControlList(int width, int height, int top, int bottom) {
    this.minecraft = Minecraft.getInstance();
    this.width = width;
    this.scrollBarLeft = width - 6;
    this.height = height;
    this.top = top;
    this.bottom = bottom;
    this.listHeight = bottom - top;
    this.listLeft = width / 2 - CONTROLS_WIDTH / 2;
}
 
Example 7
Source File: SpawningSphereHelper.java    From BoundingBoxOutlineReloaded with MIT License 5 votes vote down vote up
public static void findSpawnableSpaces(Point center, Coords coords, int width, int height, BlockProcessor blockProcessor) {
    int blockX = coords.getX();
    int minX = blockX - width;
    int maxX = blockX + width + 1;

    int blockZ = coords.getZ();
    int minZ = blockZ - width;
    int maxZ = blockZ + width + 1;

    int blockY = coords.getY();
    int minY = Math.max(1, blockY - height);
    int maxY = Math.min(255, blockY + height);

    World world = Minecraft.getInstance().world;
    for (int x = minX; x < maxX; x++) {
        for (int z = minZ; z < maxZ; z++) {
            double closestX = x + 0.5D;
            double closestZ = z + 0.5D;
            double distance = center.getDistance(new Point(closestX, center.getY(), closestZ));
            if (distance > BoundingBoxSpawningSphere.SPAWN_RADIUS) continue;

            if (SpawnableBlocksHelper.isBiomeHostileSpawnProof(world, new BlockPos(x, 1, z))) continue;

            BlockState upperBlockState = world.getBlockState(new BlockPos(x, minY - 1, z));
            for (int y = minY; y < maxY; y++) {
                BlockState spawnBlockState = upperBlockState;
                BlockPos pos = new BlockPos(x, y, z);
                upperBlockState = world.getBlockState(pos);
                distance = center.getDistance(new Point(closestX, y, closestZ));
                if (isWithinSpawnableZone(distance) &&
                        SpawnableBlocksHelper.isSpawnable(world, pos, spawnBlockState, upperBlockState)) {
                    blockProcessor.process(pos);
                }
            }
        }
    }
}
 
Example 8
Source File: MiningGadget.java    From MiningGadgets with MIT License 5 votes vote down vote up
@OnlyIn(Dist.CLIENT)
public void playLoopSound(LivingEntity player, ItemStack stack) {
    float volume = MiningProperties.getVolume(stack);
    PlayerEntity myplayer = Minecraft.getInstance().player;
    if (myplayer.equals(player)) {
        if (volume != 0.0f) {
            if (laserLoopSound == null) {
                laserLoopSound = new LaserLoopSound((PlayerEntity) player, volume);
                Minecraft.getInstance().getSoundHandler().play(laserLoopSound);
            }
        }
    }
}
 
Example 9
Source File: MiningGadget.java    From MiningGadgets with MIT License 5 votes vote down vote up
@Override
public void addInformation(ItemStack stack, @Nullable World world, List<ITextComponent> tooltip, ITooltipFlag flag) {
    super.addInformation(stack, world, tooltip, flag);

    List<Upgrade> upgrades = UpgradeTools.getUpgrades(stack);
    Minecraft mc = Minecraft.getInstance();

    if (!InputMappings.isKeyDown(mc.getMainWindow().getHandle(), mc.gameSettings.keyBindSneak.getKey().getKeyCode())) {
        tooltip.add(new TranslationTextComponent("mininggadgets.tooltip.item.show_upgrades",
                mc.gameSettings.keyBindSneak.getLocalizedName().toLowerCase())
                .applyTextStyle(TextFormatting.GRAY));
    } else {
        tooltip.add(new TranslationTextComponent("mininggadgets.tooltip.item.break_cost", getEnergyCost(stack)).applyTextStyle(TextFormatting.RED));
        if (!(upgrades.isEmpty())) {
            tooltip.add(new TranslationTextComponent("mininggadgets.tooltip.item.upgrades").applyTextStyle(TextFormatting.AQUA));
            for (Upgrade upgrade : upgrades) {
                tooltip.add(new StringTextComponent(" - " +
                        I18n.format(upgrade.getLocal())
                ).applyTextStyle(TextFormatting.GRAY));
            }
        }
    }

    stack.getCapability(CapabilityEnergy.ENERGY, null)
            .ifPresent(energy -> tooltip.add(
                    new TranslationTextComponent("mininggadgets.gadget.energy",
                            MagicHelpers.tidyValue(energy.getEnergyStored()),
                            MagicHelpers.tidyValue(energy.getMaxEnergyStored())).applyTextStyles(TextFormatting.GREEN)));
}
 
Example 10
Source File: SaveGameStructureLoader.java    From BoundingBoxOutlineReloaded with MIT License 5 votes vote down vote up
static void loadSaveGame(String fileName) {
    Minecraft minecraft = Minecraft.getInstance();
    SaveFormat saveLoader = minecraft.getSaveLoader();
    saveHandler = saveLoader.getSaveLoader(fileName, null);
    worldDirectory = saveLoader.func_215781_c().resolve(fileName).toFile();

    for (DimensionId dimensionId : nbtStructureLoaders.keySet()) {
        NBTStructureLoader dimensionProcessor = getNBTStructureLoader(dimensionId);
        dimensionProcessor.configure(saveHandler, worldDirectory);
    }

    loadChunksAroundPlayer();
}
 
Example 11
Source File: ModificationTableScreen.java    From MiningGadgets with MIT License 5 votes vote down vote up
@Override
 public void init() {
     super.init();

     this.scrollingUpgrades = new ScrollingUpgrades(Minecraft.getInstance(), this.xSize - 14, 72, guiTop + 7, guiLeft + 7, this);
     this.children.add(this.scrollingUpgrades);
}
 
Example 12
Source File: DireButton.java    From MiningGadgets with MIT License 5 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
    if (this.visible) {
        FontRenderer fontrenderer = Minecraft.getInstance().fontRenderer;
        Minecraft.getInstance().getTextureManager().bindTexture(WIDGETS_LOCATION);
        RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
        this.isHovered = isMouseOver(mouseX, mouseY);
        RenderSystem.enableBlend();
        RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA.param, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA.param, GlStateManager.SourceFactor.ONE.param, GlStateManager.DestFactor.ZERO.param);
        RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA.param, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA.param);
        this.blit(this.x, this.y, 0, 46, this.width / 2, this.height);
        this.blit(this.x + this.width / 2, this.y, 200 - this.width / 2, 46, this.width / 2, this.height);


        int bottomToDraw = 2;
        this.blit(this.x, this.y + this.height - bottomToDraw, 0, 66 - bottomToDraw, this.width / 2, bottomToDraw);
        this.blit(this.x + this.width / 2, this.y + this.height - bottomToDraw, 200 - this.width / 2, 66 - bottomToDraw, this.width / 2, bottomToDraw);

        int j = 14737632;

        if (this.packedFGColor != 0) {
            j = this.packedFGColor;
        } else if (!this.active) {
            j = 10526880;
        } else if (this.isHovered) {
            j = 16777120;
        }

        this.drawCenteredString(fontrenderer, this.getMessage(), this.x + this.width / 2, this.y + (this.height - 7) / 2, j);
    }
}
 
Example 13
Source File: BlockOverlayRender.java    From MiningGadgets with MIT License 5 votes vote down vote up
public static void render(RenderWorldLastEvent event, ItemStack item) {
    final Minecraft mc = Minecraft.getInstance();

    IRenderTypeBuffer.Impl buffer = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource();

    int range = MiningProperties.getBeamRange(item);
    BlockRayTraceResult lookingAt = VectorHelper.getLookingAt(mc.player, RayTraceContext.FluidMode.NONE, range);
    if (mc.world.getBlockState(VectorHelper.getLookingAt(mc.player, item, range).getPos()) == Blocks.AIR.getDefaultState()) {
        return;
    }

    List<BlockPos> coords = MiningCollect.collect(mc.player, lookingAt, mc.world, MiningProperties.getRange(item));
    Vec3d view = mc.gameRenderer.getActiveRenderInfo().getProjectedView();

    MatrixStack matrix = event.getMatrixStack();
    matrix.push();
    matrix.translate(-view.getX(), -view.getY(), -view.getZ());

    IVertexBuilder builder;
    builder = buffer.getBuffer(MyRenderType.BlockOverlay);
    coords.forEach(e -> {
        if (mc.world.getBlockState(e).getBlock() != ModBlocks.RENDER_BLOCK.get()) {

            matrix.push();
            matrix.translate(e.getX(), e.getY(), e.getZ());
            matrix.translate(-0.005f, -0.005f, -0.005f);
            matrix.scale(1.01f, 1.01f, 1.01f);
            matrix.rotate(Vector3f.YP.rotationDegrees(-90.0F));

            Matrix4f positionMatrix = matrix.getLast().getMatrix();
            BlockOverlayRender.render(positionMatrix, builder, e, Color.GREEN);
            matrix.pop();
        }
    });
    matrix.pop();
    RenderSystem.disableDepthTest();
    buffer.finish(MyRenderType.BlockOverlay);
}
 
Example 14
Source File: RenderMiningLaser.java    From MiningGadgets with MIT License 5 votes vote down vote up
private static void drawBeam(double xOffset, double yOffset, double zOffset, float thickness, Hand hand, double distance, BufferBuilder wr, double v1, double v2, float ticks) {
    ClientPlayerEntity player = Minecraft.getInstance().player;

    float startXOffset = -0.25f;
    float startYOffset = -.115f;
    float startZOffset = 0.65f + (1 - player.getFovModifier());

    float f = (MathHelper.lerp(ticks, player.prevRotationPitch, player.rotationPitch) - MathHelper.lerp(ticks, player.prevRenderArmPitch, player.renderArmPitch));
    float f1 = (MathHelper.lerp(ticks, player.prevRotationYaw, player.rotationYaw) - MathHelper.lerp(ticks, player.prevRenderArmYaw, player.renderArmYaw));
    startXOffset = startXOffset + (f1 / 1000);
    startYOffset = startYOffset + (f / 1000);

    // Support for hand sides remembering to take into account of Skin options
    if( Minecraft.getInstance().gameSettings.mainHand != HandSide.RIGHT )
        hand = hand == Hand.MAIN_HAND ? Hand.OFF_HAND : Hand.MAIN_HAND;

    wr.begin(GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    if (hand == Hand.MAIN_HAND) {
        wr.pos(startXOffset, -thickness + startYOffset, startZOffset).tex(1, (float) v1).endVertex();
        wr.pos(xOffset, -thickness + yOffset, distance + zOffset).tex(1, (float) v2).endVertex();
        wr.pos(xOffset, thickness + yOffset, distance + zOffset).tex(0, (float) v2).endVertex();
        wr.pos(startXOffset, thickness + startYOffset, startZOffset).tex(0, (float) v1).endVertex();
    } else {
        startYOffset = -.120f;
        wr.pos(-startXOffset, thickness + startYOffset, startZOffset).tex(0, (float) v1).endVertex();
        wr.pos(xOffset, thickness + yOffset, distance + zOffset).tex(0, (float) v2).endVertex();
        wr.pos(xOffset, -thickness + yOffset, distance + zOffset).tex(1, (float) v2).endVertex();
        wr.pos(-startXOffset, -thickness + startYOffset, startZOffset).tex(1, (float) v1).endVertex();
    }
    Tessellator.getInstance().draw();
}
 
Example 15
Source File: KeyBindings.java    From XRay-Mod with GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public static void eventInput(TickEvent event)
{
    Minecraft mc = Minecraft.getInstance();
    if (mc.player == null || event.phase == TickEvent.Phase.START || XRay.mc.currentScreen != null || XRay.mc.world == null)
        return;

    keyBindings.forEach( e -> {
        if( e.keyBinding.isPressed() )
            e.onPress.run();
    });
}
 
Example 16
Source File: RenderMiningLaser2.java    From MiningGadgets with MIT License 4 votes vote down vote up
private static void drawBeam(double xOffset, double yOffset, double zOffset, IVertexBuilder builder, Matrix4f positionMatrix, Matrix3f matrixNormalIn, float thickness, Hand hand, double distance, double v1, double v2, float ticks, float r, float g, float b, float alpha) {
    Vector3f vector3f = new Vector3f(0.0f, 1.0f, 0.0f);
    vector3f.transform(matrixNormalIn);
    ClientPlayerEntity player = Minecraft.getInstance().player;
    // Support for hand sides remembering to take into account of Skin options
    if( Minecraft.getInstance().gameSettings.mainHand != HandSide.RIGHT )
        hand = hand == Hand.MAIN_HAND ? Hand.OFF_HAND : Hand.MAIN_HAND;
    float startXOffset = -0.25f;
    float startYOffset = -.115f;
    float startZOffset = 0.65f + (1 - player.getFovModifier());
    if (hand == Hand.OFF_HAND) {
        startYOffset = -.120f;
        startXOffset = 0.25f;
    }
    float f = (MathHelper.lerp(ticks, player.prevRotationPitch, player.rotationPitch) - MathHelper.lerp(ticks, player.prevRenderArmPitch, player.renderArmPitch));
    float f1 = (MathHelper.lerp(ticks, player.prevRotationYaw, player.rotationYaw) - MathHelper.lerp(ticks, player.prevRenderArmYaw, player.renderArmYaw));
    startXOffset = startXOffset + (f1 / 100000000);
    startYOffset = startYOffset + (f / 100000000);

    Vector4f vec1 = new Vector4f(startXOffset, -thickness + startYOffset, startZOffset, 1.0F);
    vec1.transform(positionMatrix);
    Vector4f vec2 = new Vector4f((float) xOffset, -thickness + (float) yOffset, (float) distance + (float) zOffset, 1.0F);
    vec2.transform(positionMatrix);
    Vector4f vec3 = new Vector4f((float) xOffset, thickness + (float) yOffset, (float) distance + (float) zOffset, 1.0F);
    vec3.transform(positionMatrix);
    Vector4f vec4 = new Vector4f(startXOffset, thickness + startYOffset, startZOffset, 1.0F);
    vec4.transform(positionMatrix);

    if (hand == Hand.MAIN_HAND) {
        builder.addVertex(vec4.getX(), vec4.getY(), vec4.getZ(), r, g, b, alpha, 0, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        builder.addVertex(vec3.getX(), vec3.getY(), vec3.getZ(), r, g, b, alpha, 0, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        builder.addVertex(vec2.getX(), vec2.getY(), vec2.getZ(), r, g, b, alpha, 1, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        builder.addVertex(vec1.getX(), vec1.getY(), vec1.getZ(), r, g, b, alpha, 1, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        //Rendering a 2nd time to allow you to see both sides in multiplayer, shouldn't be necessary with culling disabled but here we are....
        builder.addVertex(vec1.getX(), vec1.getY(), vec1.getZ(), r, g, b, alpha, 1, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        builder.addVertex(vec2.getX(), vec2.getY(), vec2.getZ(), r, g, b, alpha, 1, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        builder.addVertex(vec3.getX(), vec3.getY(), vec3.getZ(), r, g, b, alpha, 0, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        builder.addVertex(vec4.getX(), vec4.getY(), vec4.getZ(), r, g, b, alpha, 0, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
    } else {
        builder.addVertex(vec1.getX(), vec1.getY(), vec1.getZ(), r, g, b, alpha, 1, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        builder.addVertex(vec2.getX(), vec2.getY(), vec2.getZ(), r, g, b, alpha, 1, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        builder.addVertex(vec3.getX(), vec3.getY(), vec3.getZ(), r, g, b, alpha, 0, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        builder.addVertex(vec4.getX(), vec4.getY(), vec4.getZ(), r, g, b, alpha, 0, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        //Rendering a 2nd time to allow you to see both sides in multiplayer, shouldn't be necessary with culling disabled but here we are....
        builder.addVertex(vec4.getX(), vec4.getY(), vec4.getZ(), r, g, b, alpha, 0, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        builder.addVertex(vec3.getX(), vec3.getY(), vec3.getZ(), r, g, b, alpha, 0, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        builder.addVertex(vec2.getX(), vec2.getY(), vec2.getZ(), r, g, b, alpha, 1, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        builder.addVertex(vec1.getX(), vec1.getY(), vec1.getZ(), r, g, b, alpha, 1, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
    }
}
 
Example 17
Source File: ClientInterop.java    From BoundingBoxOutlineReloaded with MIT License 4 votes vote down vote up
public static int getRenderDistanceChunks() {
    return Minecraft.getInstance().gameSettings.renderDistanceChunks;
}
 
Example 18
Source File: PacketPipeline.java    From Better-Sprinting with Mozilla Public License 2.0 4 votes vote down vote up
@OnlyIn(Dist.CLIENT)
private PlayerEntity getClientPlayer(){
	return Minecraft.getInstance().player;
}
 
Example 19
Source File: IngameOverlay.java    From bleachhack-1.14 with GNU General Public License v3.0 4 votes vote down vote up
public void addCoords() {
	boolean nether = Minecraft.getInstance().player.dimension == DimensionType.THE_NETHER;
	BlockPos pos = Minecraft.getInstance().player.getPosition();
			
	bottomLeftList.add("XYZ: " + (nether ? "�4" : "�b") + pos.getX() + " " + pos.getY() + " " + pos.getZ());
}
 
Example 20
Source File: DryingRackBakedModel.java    From Survivalist with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Nonnull
@Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData)
{
    List<BakedQuad> quads = Lists.newArrayList();

    RenderType renderLayer = MinecraftForgeClient.getRenderLayer();
    if (renderLayer == RenderType.getSolid())
    {
        quads.addAll(rackBakedModel.getQuads(state, side, rand));
    }
    else if (renderLayer == RenderType.getCutout() && side == null)
    {
        ItemRenderer renderItem = Minecraft.getInstance().getItemRenderer();
        World world = Minecraft.getInstance().world;

        DryingRackItemsStateData items = extraData.getData(DryingRackTileEntity.CONTAINED_ITEMS_DATA);

        for (int i = 0; i < 4; i++)
        {
            ItemStack stack = items.stacks[i];
            if (stack.isEmpty())
                continue;

            MatrixStack matrixStack = new MatrixStack();
            matrixStack.push(); // pushMatrix

            TransformationMatrix ct = itemTransforms[i];
            matrixStack.getLast().getMatrix().mul(ct.getMatrix()); // current().getPositionMatrix().multiply(getPositionMatrix)
            matrixStack.getLast().getNormal().mul(ct.getNormalMatrix()); // current().getNormalMatrix().multiply

            IBakedModel model = renderItem.getItemModelWithOverrides(stack, world, null);

            if (stack.getItem() == Items.TRIDENT)
            {
                model = Minecraft.getInstance().getItemRenderer().getItemModelMesher().getModelManager().getModel(new ModelResourceLocation("minecraft:trident#inventory"));
            }

            model = model.handlePerspective(ItemCameraTransforms.TransformType.FIXED, matrixStack);

            if (!model.isBuiltInRenderer())
            {
                @SuppressWarnings("unchecked")
                Map<Pair<IBakedModel, TransformationMatrix>, List<BakedQuad>> cache = caches.get(i);

                Matrix4f positionTransform = matrixStack.getLast().getMatrix(); // current() // getPositionMatrix
                TransformationMatrix transformMatrix = new TransformationMatrix(positionTransform);

                Pair<IBakedModel, TransformationMatrix> pair = Pair.of(model, transformMatrix);
                List<BakedQuad> cachedQuads = cache.get(pair);
                if (cachedQuads == null)
                {

                    cachedQuads = Lists.newArrayList();
                    for (Direction face : faces)
                    {
                        List<BakedQuad> inQuads = model.getQuads(null, face, rand);
                        List<BakedQuad> outQuads = new QuadTransformer(transformMatrix).processMany(inQuads);

                        cachedQuads.addAll(outQuads);
                    }

                    cache.put(pair, cachedQuads);
                }
                quads.addAll(cachedQuads);
            }
        }
    }

    return quads;
}