use of net.minecraft.client.util.math.MatrixStack in project KiwiClient by TangyKiwi.
the class RenderUtils method matrixFrom.
public static MatrixStack matrixFrom(double x, double y, double z) {
MatrixStack matrices = new MatrixStack();
Camera camera = MinecraftClient.getInstance().gameRenderer.getCamera();
matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(camera.getPitch()));
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(camera.getYaw() + 180.0F));
matrices.translate(x - camera.getPos().x, y - camera.getPos().y, z - camera.getPos().z);
return matrices;
}
use of net.minecraft.client.util.math.MatrixStack in project KiwiClient by TangyKiwi.
the class RenderUtils method drawBoxOutline.
public static void drawBoxOutline(Box box, QuadColor color, float lineWidth, Direction... excludeDirs) {
if (!FrustumUtils.isBoxVisible(box)) {
return;
}
setup();
MatrixStack matrices = matrixFrom(box.minX, box.minY, box.minZ);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
// Outline
RenderSystem.disableCull();
RenderSystem.setShader(GameRenderer::getRenderTypeLinesShader);
RenderSystem.lineWidth(lineWidth);
buffer.begin(VertexFormat.DrawMode.LINES, VertexFormats.LINES);
Vertexer.vertexBoxLines(matrices, buffer, Boxes.moveToZero(box), color, excludeDirs);
tessellator.draw();
RenderSystem.enableCull();
cleanup();
}
use of net.minecraft.client.util.math.MatrixStack in project KiwiClient by TangyKiwi.
the class KiwiClient method onInitialize.
@Override
public void onInitialize() {
mc = MinecraftClient.getInstance();
Utils.mc = mc;
CustomMatrix.begin(new MatrixStack());
moduleManager = new ModuleManager();
moduleManager.init();
commandManager = new CommandManager();
commandManager.init();
discordRPC = new DiscordRP();
discordRPC.start();
EChestMemory eChestMemory = new EChestMemory();
TickRate tickRate = new TickRate();
eventBus.register(eChestMemory);
eventBus.register(tickRate);
eventBus.register(moduleManager);
ClickGui.clickGui.initWindows();
FabricLoader.getInstance().getModContainer("kiwiclient").ifPresent(modContainer -> {
ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("kiwiclient:kiwitweaks"), "resourcepacks/kiwitweaks", modContainer, true);
});
UseItemCallback.EVENT.register((player, world, hand) -> {
MinecraftClient mc = MinecraftClient.getInstance();
ClientPlayerInteractionManager interactionManager = mc.interactionManager;
if (mc.mouse.wasRightButtonClicked() && moduleManager.getModule(ArmorSwap.class).isEnabled()) {
ItemStack stack = player.getMainHandStack();
int currentItemIndex = player.getInventory().main.indexOf(stack);
EquipmentSlot equipmentSlot = MobEntity.getPreferredEquipmentSlot(stack);
int armorIndexSlot = determineIndex(equipmentSlot);
if (hand == Hand.MAIN_HAND && armorIndexSlot != -1) {
SoundEvent sound = determineSound(stack.getItem());
player.playSound(sound, 1.0F, 1.0F);
interactionManager.clickSlot(player.playerScreenHandler.syncId, armorIndexSlot, currentItemIndex, SlotActionType.SWAP, player);
return TypedActionResult.success(stack);
}
}
return TypedActionResult.pass(ItemStack.EMPTY);
});
KeyBindingHelper.registerKeyBinding(zoomKey);
}
use of net.minecraft.client.util.math.MatrixStack in project isometric-renders by gliscowo.
the class IsometricRenderHelper method renderIntoImage.
public static NativeImage renderIntoImage(int size, RenderCallback renderCallback) {
Framebuffer framebuffer = new Framebuffer(size, size, true, MinecraftClient.IS_SYSTEM_MAC);
RenderSystem.pushMatrix();
RenderSystem.enableBlend();
RenderSystem.clear(16640, MinecraftClient.IS_SYSTEM_MAC);
framebuffer.setClearColor(0, 0, 0, 0);
framebuffer.clear(MinecraftClient.IS_SYSTEM_MAC);
framebuffer.beginWrite(true);
RenderSystem.matrixMode(GL11.GL_PROJECTION);
RenderSystem.pushMatrix();
RenderSystem.loadIdentity();
RenderSystem.ortho(-1, 1, 1, -1, -100.0, 100.0);
RenderSystem.matrixMode(GL11.GL_MODELVIEW);
RenderSystem.pushMatrix();
RenderSystem.loadIdentity();
setupLighting();
VertexConsumerProvider.Immediate vertexConsumers = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers();
MatrixStack matrixStack = new MatrixStack();
renderCallback.render(matrixStack, vertexConsumers, ((MinecraftClientAccessor) MinecraftClient.getInstance()).getRenderTickCounter().tickDelta);
vertexConsumers.draw();
RenderSystem.popMatrix();
RenderSystem.matrixMode(GL11.GL_PROJECTION);
RenderSystem.popMatrix();
RenderSystem.matrixMode(GL11.GL_MODELVIEW);
RenderSystem.popMatrix();
framebuffer.endWrite();
return takeKeyedSnapshot(framebuffer, RuntimeConfig.backgroundColor, false, false);
}
use of net.minecraft.client.util.math.MatrixStack in project isometric-renders by gliscowo.
the class IsometricRenderScreen method drawContent.
@Override
protected void drawContent(MatrixStack matrices) {
float scale = renderScale * height / 515f;
RenderSystem.pushMatrix();
RenderSystem.translatef(115, (float) Math.round(renderHeight * 1f + (height - 515f) / 10f), 1500);
RenderSystem.scalef(1, 1, -1);
MatrixStack matrixStack = new MatrixStack();
matrixStack.translate(0, 0, 1000);
matrixStack.scale(scale, scale, 1);
Quaternion flip = Vector3f.POSITIVE_Z.getDegreesQuaternion(180);
flip.hamiltonProduct(Vector3f.POSITIVE_X.getDegreesQuaternion(-angle));
Quaternion rotation = Vector3f.POSITIVE_Y.getDegreesQuaternion(RuntimeConfig.rotation);
matrixStack.multiply(flip);
matrixStack.multiply(rotation);
EntityRenderDispatcher entityRenderDispatcher = MinecraftClient.getInstance().getEntityRenderDispatcher();
entityRenderDispatcher.setRenderShadows(false);
VertexConsumerProvider.Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers();
renderCallback.render(matrixStack, immediate, playAnimations ? ((MinecraftClientAccessor) client).getRenderTickCounter().tickDelta : 0);
immediate.draw();
entityRenderDispatcher.setRenderShadows(true);
RenderSystem.popMatrix();
}
Aggregations