use of net.minecraft.client.util.math.MatrixStack in project Hypnotic-Client by Hypnotic-Development.
the class GameRendererMixin method renderForEvent.
@Inject(method = "render", at = @At(value = "INVOKE", target = "net/minecraft/client/render/WorldRenderer.drawEntityOutlinesFramebuffer()V"))
public void renderForEvent(float float_1, long long_1, boolean boolean_1, CallbackInfo ci) {
RenderUtils.setup2DProjection();
new EventRender2DNoScale(new MatrixStack(), float_1).call();
}
use of net.minecraft.client.util.math.MatrixStack in project Hypnotic-Client by Hypnotic-Development.
the class ItemRendererMixin method renderGuiItemModel.
@SuppressWarnings("deprecation")
protected void renderGuiItemModel(ItemStack stack, float x, float y, BakedModel model, float scale) {
this.textureManager.getTexture(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE).setFilter(false, false);
RenderSystem.setShaderTexture(0, SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE);
RenderSystem.enableBlend();
RenderSystem.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
MatrixStack matrixStack = RenderSystem.getModelViewStack();
matrixStack.push();
matrixStack.translate((double) x, (double) y, (double) (100.0F + this.zOffset));
matrixStack.translate(8.0D, 8.0D, 0.0D);
matrixStack.scale(scale, -scale, 1.0F);
matrixStack.scale(16.0F, 16.0F, 16.0F);
RenderSystem.applyModelViewMatrix();
MatrixStack matrixStack2 = new MatrixStack();
VertexConsumerProvider.Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers();
boolean bl = !model.isSideLit();
if (bl) {
DiffuseLighting.disableGuiDepthLighting();
}
this.renderItem(stack, ModelTransformation.Mode.GUI, false, matrixStack2, immediate, 15728880, OverlayTexture.DEFAULT_UV, model);
immediate.draw();
RenderSystem.enableDepthTest();
if (bl) {
DiffuseLighting.enableGuiDepthLighting();
}
matrixStack.pop();
RenderSystem.applyModelViewMatrix();
}
use of net.minecraft.client.util.math.MatrixStack in project Hypnotic-Client by Hypnotic-Development.
the class StorageESP method onBlockEntityRender.
@EventTarget
public void onBlockEntityRender(EventBlockEntityRender.PreAll event) {
if (mode.is("Shader")) {
try {
for (Entry<BlockEntity, float[]> be : blockEntities.entrySet()) {
BlockEntityRenderer<BlockEntity> beRenderer = mc.getBlockEntityRenderDispatcher().get(be.getKey());
BlockPos pos = be.getKey().getPos();
MatrixStack matrices = RenderUtils.matrixFrom(pos.getX(), pos.getY(), pos.getZ());
if (beRenderer != null) {
beRenderer.render(be.getKey(), mc.getTickDelta(), matrices, OutlineVertexConsumers.outlineOnlyProvider(be.getValue()[0], be.getValue()[1], be.getValue()[2], 1f), 0xf000f0, OverlayTexture.DEFAULT_UV);
} else {
BlockState state = be.getKey().getCachedState();
mc.getBlockRenderManager().getModelRenderer().render(mc.world, mc.getBlockRenderManager().getModel(state), state, BlockPos.ORIGIN, matrices, OutlineVertexConsumers.outlineOnlyConsumer(be.getValue()[0], be.getValue()[1], be.getValue()[2], 1f), false, new Random(), 0L, OverlayTexture.DEFAULT_UV);
}
}
} catch (Exception e) {
}
}
}
use of net.minecraft.client.util.math.MatrixStack in project Hypnotic-Client by Hypnotic-Development.
the class TabGUI method renderGUI.
@EventTarget
public void renderGUI(EventRenderGUI event) {
MatrixStack matrices = event.getMatrices();
x = 4;
y = 30;
width = 80;
height = 15;
if (animTicks != currentTab * 15) {
if (shouldMoveDown)
animTicks++;
if (shouldMoveUp)
animTicks--;
} else {
shouldMoveUp = false;
shouldMoveDown = false;
}
if (animTicks > (Category.values().length - 1) * 15) {
animTicks = 0;
}
if (animTicks < 0) {
animTicks = 0;
}
if (animTicks2 != Category.values()[currentTab].moduleIndex * 15) {
if (shouldMoveDown2)
animTicks2++;
if (shouldMoveUp2)
animTicks2--;
} else {
shouldMoveUp2 = false;
shouldMoveDown2 = false;
}
if (animTicks2 > (ModuleManager.INSTANCE.getModulesInCategory(Category.values()[currentTab]).size() - 1) * 15) {
animTicks2 = 0;
}
if (animTicks2 < 0) {
animTicks2 = 0;
}
DrawableHelper.fill(matrices, x, y, x + width, y + Category.values().length * 15, new Color(0, 0, 0, 100).getRGB());
DrawableHelper.fill(matrices, x, y + animTicks, x + width, y + height + animTicks, ColorUtils.defaultClientColor);
DrawableHelper.fill(matrices, x, y, x + width, y - 1, ColorUtils.defaultClientColor);
DrawableHelper.fill(matrices, x, y, x + 1, y + Category.values().length * 15, ColorUtils.defaultClientColor);
DrawableHelper.fill(matrices, x, y + Category.values().length * 15, x + width, y - 1 + Category.values().length * 15, ColorUtils.defaultClientColor);
DrawableHelper.fill(matrices, x + width, y - 1, x + width + 1, y + Category.values().length * 15, ColorUtils.defaultClientColor);
int offset = 0;
for (Category category : Category.values()) {
FontManager.robotoMed.drawWithShadow(matrices, category.name, x + 4, y + offset + 2, -1);
offset += 15;
}
if (expanded) {
if (expandTicks < 165) {
expandTicks += Math.max(event.getTickDelta() * 10, 10);
}
} else {
if (expandTicks > 0) {
expandTicks -= Math.max(event.getTickDelta() * 10, 10);
}
}
int x2 = x + 4;
if (expanded || expandTicks > 0) {
ArrayList<Mod> modules = ModuleManager.INSTANCE.getModulesInCategory(Category.values()[currentTab]);
RenderSystem.enableScissor(x, y, x + width * 100, mc.getWindow().getScaledHeight());
GlStateManager._scissorBox(168, 100, expandTicks, 10000);
DrawableHelper.fill(matrices, x2 + width, y + (currentTab * 15), x2 + width * 2, y + (currentTab * 15) + ((ModuleManager.INSTANCE.getModulesInCategory(Category.values()[currentTab]).size() - 1) * 15) + height, new Color(0, 0, 0, 100).getRGB());
DrawableHelper.fill(matrices, x + width + 3, y + currentTab * 15, x2 + width, y + modules.size() * 15 + currentTab * 15, ColorUtils.defaultClientColor);
DrawableHelper.fill(matrices, x2 + 1 + width * 2, y - 1 + currentTab * 15, x2 - 1 + width, y + currentTab * 15, ColorUtils.defaultClientColor);
DrawableHelper.fill(matrices, x + 3 + width, y + (currentTab * 15) + 1 + modules.size() * 15, x2 + width * 2, y + (currentTab * 15) + modules.size() * 15, ColorUtils.defaultClientColor);
DrawableHelper.fill(matrices, x2 + width * 2, y + (currentTab * 15), x2 + width * 2 + 1, y + (currentTab * 15) + 1 + modules.size() * 15, ColorUtils.defaultClientColor);
DrawableHelper.fill(matrices, x2 + width, y + (currentTab * 15) + animTicks2, x2 + width * 2, y + (currentTab * 15) + animTicks2 + height, ColorUtils.defaultClientColor);
int modCount2 = 0;
for (Mod mod : modules) {
FontManager.robotoMed.drawWithShadow(matrices, mod.getName(), x2 + width + 4, y + 2 + (currentTab * 15) + modCount2, mod.isEnabled() ? ColorUtils.defaultClientColor : -1);
modCount2 += 15;
}
RenderSystem.disableScissor();
} else if (!expanded) {
}
}
use of net.minecraft.client.util.math.MatrixStack in project Hypnotic-Client by Hypnotic-Development.
the class Nametags method drawInv.
private void drawInv(LivingEntity player, float posX, float posY, EventRenderGUI eventRender2D) {
int itemWidth = 16;
int totalCount = getItems(player).size();
float startX = (posX - ((totalCount * itemWidth) / 2.f));
posY = (posY - 28);
count = 0;
for (ItemStack itemStack : getItems(player)) {
if (!(itemStack.getItem() instanceof AirBlockItem)) {
float newX = startX + (count * 16);
RenderUtils.drawItem(itemStack, newX, posY);
if (itemStack.hasEnchantments()) {
float scale = 0.5f;
MatrixStack matrixStack = eventRender2D.getMatrices();
matrixStack.push();
matrixStack.scale(scale, scale, 1);
int enchCount = 1;
for (NbtElement tag : itemStack.getEnchantments()) {
try {
NbtCompound compoundTag = (NbtCompound) tag;
float newY = ((posY - ((10 * scale) * enchCount) + 0.5f) / scale);
float newerX = (newX / scale);
String name = getEnchantName(compoundTag);
float nameWidth = font.getStringWidth(name);
RenderUtils.fill(eventRender2D.getMatrices(), newerX, newY - 1, newerX + nameWidth, newY + 9, 0x35000000);
font.draw(eventRender2D.getMatrices(), name, newerX, newY - 3, -1);
enchCount++;
} catch (Exception ignored) {
}
}
matrixStack.pop();
}
count++;
}
}
}
Aggregations