Giter VIP home page Giter VIP logo

renderer's Introduction

Renderer

An easy-to-use rendering library for modern fabric.

Installing

You can install this library using Jitpack

To install this library, just add the jitpack repository to your repositories section as described on the jitpack website, and add the ladysnake repository (for gradle to find satin):

maven {
    name = 'Ladysnake Mods'
    url = 'https://maven.ladysnake.org/releases'
    content {
        includeGroup 'io.github.ladysnake'
        includeGroup 'org.ladysnake'
        includeGroupByRegex 'dev\\.onyxstudios.*'
    }
}

Then add this to your dependencies block in build.gradle.

include modImplementation("com.github.0x3C50:Renderer:master-SNAPSHOT")

This will use the latest commit as build target, but will cache that build target every time. Use the latest short commit hash found on Jitpack (example: d2cc995ff4) as the version, to get that release instead.

Caution

It's important to use fabric's modImplementation instead of the regular implementation, since this is technically a mod that needs remapping. Using anything else except modImplementation will not remap the library, which causes invalid names to be present.

Similarly, using fabric's include is also recommended over anything else, since it includes the whole jar as a Jar-In-Jar ("JIJ") dependency, which fabric can handle better than just copying the classes over. JIJing it this way will make it appear in the mod list, as well as making the license and credits visible, whereas copying the classes into the final jar will just keep the library and effectively strip the metadata.

Usage

The api has an extensive javadoc, which explains almost anything. The wiki also has some more insights and examples.

The two renderers

Renderer2d draws in 2 dimensions, on the hud. Renderer3d draws in 3 dimensions, in the world.

Events

This library uses fabric's event system, the wiki has examples on how it works. Their wiki has more details.

Suggestions

You can leave suggestions in the issues section

If this library helped you, please consider leaving a star, since this library took me a while to make as it is right now :)

renderer's People

Contributors

0x3c50 avatar amunak avatar cattyngmd avatar hexadecimal233 avatar kevinthegreat1 avatar offeex avatar psjahn avatar steanky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

renderer's Issues

Game Crashing (1.18.2)

Just before I load into my world it gives me this error :

The game crashed whilst batching chunks

Error: org.spongepowered.asm.mixin.injection.throwables.InjectionError: LVT in
net/minecraft/class_846$class_851$class_4578::method_22785(FFFLnet/minecraft/class_846$class_849;Lnet/minecraft/class_750;)Ljava/util/Set; has incompatible changes at opcode 473 in callback renderer.mixins.json:RebuildTaskMixin->@Inject::renderer_preBlockRender(FFFLnet/minecraft/class_846$class_849;Lnet/minecraft/class_750;Lorg/spongepowered/asm/mixin/injection/callback/CallbackInfoReturnable;ILnet/minecraft/class_2338;Lnet/minecraft/class_2338;Lnet/minecraft/class_852;Ljava/util/Set;Lnet/minecraft/class_853;Lnet/minecraft/class_4587;Ljava/util/Random;Lnet/minecraft/class_776;Ljava/util/Iterator;Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;Lnet/minecraft/class_2680;Lnet/minecraft/class_3610;Lnet/minecraft/class_1921;Lnet/minecraft/class_287;)V from mod renderer.

Exit Code: 255

Can't install Renderer | Linkage Error

Bug Description

I cant get Renderer running while having owolib installed, but cant tell whats the problem is as Satin and Renderer are not using org.w3c.dom.Node?

    include(modImplementation("io.github.ladysnake:satin:1.14.0")!!)
    include(modImplementation("io.wispforest:owo-lib:0.11.2-pre.12+1.20")!!)

Code

---- Minecraft Crash Report ----
// Don't do that.

Time: 2023-08-27 16:54:51
Description: Unexpected error

java.lang.LinkageError: loader constraint violation: loader net.fabricmc.loader.impl.launch.knot.KnotClassLoader @4cf4d528 wants to load interface org.w3c.dom.Node. A different interface with the same name was previously loaded by 'bootstrap'. (org.w3c.dom.Node is in module java.xml of loader 'bootstrap')
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
	at net.fabricmc.loader.impl.launch.knot.KnotClassLoader.defineClassFwd(KnotClassLoader.java:153)
	at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.tryLoadClass(KnotClassDelegate.java:355)
	at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.loadClass(KnotClassDelegate.java:218)
	at net.fabricmc.loader.impl.launch.knot.KnotClassLoader.loadClass(KnotClassLoader.java:112)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
	at io.wispforest.owo.ui.base.BaseParentComponent.<init>(BaseParentComponent.java:32)
	at io.wispforest.owo.ui.container.FlowLayout.<init>(FlowLayout.java:25)
	at io.wispforest.owo.ui.hud.HudContainer.<init>(HudContainer.java:18)
	at io.wispforest.owo.ui.core.OwoUIAdapter.createWithoutScreen(OwoUIAdapter.java:92)
	at io.wispforest.owo.ui.hud.Hud.initializeAdapter(Hud.java:74)
	at io.wispforest.owo.ui.hud.Hud.lambda$static$3(Hud.java:102)
	at net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback.lambda$static$0(HudRenderCallback.java:27)
	at net.minecraft.client.gui.hud.InGameHud.handler$bde000$fabric-rendering-v1$render(InGameHud.java:2886)
	at net.minecraft.client.gui.hud.InGameHud.render(InGameHud.java:370)
	at net.minecraft.client.render.GameRenderer.render(GameRenderer.java:926)
	at net.minecraft.client.MinecraftClient.render(MinecraftClient.java:1219)
	at net.minecraft.client.MinecraftClient.run(MinecraftClient.java:802)
	at net.minecraft.client.main.Main.main(Main.java:250)
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:468)
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
	at net.fabricmc.devlaunchinjector.Main.main(Main.java:86)

Desktop

  • OS: Windows
  • GPU: Nvidia

World Rendering utiltities

Methods that allow you to pass in a matrices, world, blockpos, direction ect. and it renders that section of the world for you?

Satin dependency

Bug Description

Since commit e733e65, Ladysnake must be added to the repositories by mods using this library like this:

repositories {
        maven {
        name = 'Ladysnake Mods'
        url = 'https://maven.ladysnake.org/releases'
        content {
            includeGroup 'io.github.ladysnake'
            includeGroup 'org.ladysnake'
            includeGroupByRegex 'dev\\.onyxstudios.*'
        }
    }
}

or else the following error occurs:

A problem occurred configuring root project 'Skyblocker'.
> Could not resolve all files for configuration ':modImplementation'.
   > Could not find io.github.ladysnake:satin:1.13.0.
     Searched in the following locations:
       - https://maven.fabricmc.net/io/github/ladysnake/satin/1.13.0/satin-1.13.0.pom
       - https://libraries.minecraft.net/io/github/ladysnake/satin/1.13.0/satin-1.13.0.pom
       - https://libraries.minecraft.net/io/github/ladysnake/satin/1.13.0/satin-1.13.0.jar
       - https://repo.maven.apache.org/maven2/io/github/ladysnake/satin/1.13.0/satin-1.13.0.pom
       - https://maven.terraformersmc.com/releases/io/github/ladysnake/satin/1.13.0/satin-1.13.0.pom
       - https://maven.shedaniel.me/io/github/ladysnake/satin/1.13.0/satin-1.13.0.pom
       - https://maven.meteordev.org/releases/io/github/ladysnake/satin/1.13.0/satin-1.13.0.pom
       - https://repo.codemc.io/repository/maven-public/io/github/ladysnake/satin/1.13.0/satin-1.13.0.pom
       - https://jitpack.io/io/github/ladysnake/satin/1.13.0/satin-1.13.0.pom
     Required by:
         project : > com.github.0x3C50:Renderer:9c4eead2fb

Expected Behavior

Mods using this library should not have to add this repository. The suggested fix is to add include to the satin dependency.

-   modImplementation "io.github.ladysnake:satin:1.13.0"
+   include modImplementation("io.github.ladysnake:satin:1.13.0")

Breaks view bobbing

This breaks the default view shake with the view bobbing setting turned on. I see that there is code to prevent view bobbing in GameRendererMixin, and I'm wondering what is it fixing?

I got the bug report from here.

Version control?

after i use
include modImplementation("com.github.0x3C50:Renderer:master-SNAPSHOT")

Such an error has occurred

Exception in thread "main" java.lang.ExceptionInInitializerError
        at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
        at net.fabricmc.devlaunchinjector.Main.main(Main.java:86)
Caused by: java.lang.IllegalStateException: duplicate fabric loader classes found on classpath: jar:file:/C:/Users/11386/.gradle/caches/modules-2/files-2.1/net.fabricmc/fabric-loader/0.15.7/809a1a6b0f4bcca07e3dffc01f8a62265db3ff5d/fabric-loader-0.15.7.jar!/net/fabricmc/loader/api/FabricLoader.class, jar:file:/C:/Users/11386/.gradle/caches/modules-2/files-2.1/net.fabricmc/fabric-loader/0.15.6/2b6b8b0f6d842b6891f7c9b8b66f2aed12bc2619/fabric-loader-0.15.6.jar!/net/fabricmc/loader/api/FabricLoader.class
        at net.fabricmc.loader.impl.util.LoaderUtil.verifyClasspath(LoaderUtil.java:65)
        at net.fabricmc.loader.impl.launch.knot.Knot.<clinit>(Knot.java:347)
        ... 2 more

Just changing the fabric-api version of my project is not enough, because the project also bundles other things, such as satin version 1.16, which is only available on 1.20.4, while my development version is 1.20.1

Unrendering

So sorry to bother you again, but how do I unrender something?

Inconsistency rendering a texture on the screen

Bug Description

While rendering a PNG texture on the screen it sometimes displays it correctly and some other times it gets drawn more badly, more "pixellated", and I can't figure out why, if it's something I miscofigured or not. Images below.

Code

RenderEvents.HUD.register(matrixStack -> {
            MSAAFramebuffer.use(MSAAFramebuffer.MAX_SAMPLES, () -> {
                center_x = MinecraftClient.getInstance().getWindow().getScaledWidth()/2;
                center_y = MinecraftClient.getInstance().getWindow().getScaledHeight()/2;
                scale_factor = MinecraftClient.getInstance().getWindow().getScaleFactor();

                if(LightWithinClient.isLightReady()){
                    ClipStack.addWindow(matrixStack.getMatrices(),new Rectangle(1,1,1000,1000));
                    Renderer2d.renderTexture(matrixStack.getMatrices(), new Identifier(LightWithin.MOD_ID, "textures/lights/light.png"), x, y, 20, 20);
                    ClipStack.popWindow();
                }

(isLightReady returns true for 10ish seconds after a packet is sent from the server, if you need more context [here is the full source])(https://github.com/Emafire003/LightWithin/blob/main/src/main/java/me/emafire003/dev/lightwithin/client/RendererEventHandler.java)

Expected Behavior

I would expect the icons/textures/images to be rendered at least the same way each time, and not changing after a few seconds.

Screenshots

2024-01-14_14 30 28 correct
2024-01-14_14 30 38 incorrect

Desktop

  • OS: Windows
  • GPU: Nvidia/Intel integrated

Additional Context

Sometimes it starts as pixellated and then after a few seconds turns normal. Also, this is one of the files that should be rendered, along with how it turns out.
correct correct
incorrect incorrect

Also sometimes dying while the icon is displayes makes it dispaly as more pixellated or whatever and when the icon disappears it seems briefly to display normally.

:)

no issues, just that this is a really nice library you made, good job.

Suggestion

Hi, i rly like this library so far and i have a suggestion that i think not many mods/clients have implemented:
Basically it would be cool to be able to blur parts of the screen (like the new 1.21 pause menu background) but in select rects/areas.
And maybe even be able to control how much blur there is or the blur color(?). i think that would be awesom and im too dumb to do it myself lol

Issue with two rounded rectangles

Bug Description

I'm trying to create a some ui elements and I'm creating two boxes, though when I create the second box when I try to make it rounded it seems to go.. well all over the place (as seen in the screenshot below), It works perfectly fine if I don't try to round it (though ofc it won't be rounded).

I'm running 1.20.1 if that is needed info

Code

public void render(DrawContext context, int mousex, int mousey, float delta) {
        MatrixStack fs = context.getMatrices();
        fs.push();

        Renderer2d.renderRoundedQuad(fs, Color.BLACK, 15,15, 100, 30, 3, 5);
        Renderer2d.renderRoundedQuad(fs, Color.BLACK, 80,80, 150, 60, 3,5);

        font.drawString(fs, "Fun Text", 15, 15, 1f, 1f, 1f, 1f);
        font.drawString(fs, "Fun Text v3", 80, 60, 1f, 1f, 1f, 1f);
        
        fs.pop();
    }

Expected Behavior

The second box goes all over the place when rendering

Screenshots

image

Desktop

  • OS: Windows 11
  • GPU: AMD Radeon RX 6600

1.19

1.19 soon tm?

Bad class file when building

Bug Description

Im trying to use this library for my mod but if i try to compile, it fails and says it can't find any Events classes

Code

import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
                                                        ^
  bad class file: /.../.gradle/loom-cache/remapped_mods/net_fabricmc_yarn_1_20_2_1_20_2_build_4_v2/net/fabricmc/fabric-api/fabric-lifecycle-events-v1/2.3.4+c5fc38b30d/fabric-lifecycle-events-v1-2.3.4+c5fc38b30d.jar(/net/fabricmc/fabric/api/client/event/lifecycle/v1/ClientLifecycleEvents.class)
    class file has wrong version 65.0, should be 61.0
    Please remove or make sure it appears in the correct subdirectory of the classpath.

Desktop

  • OS: MacOS
  • GPU: M2

Mod crashes upon startup

Bug Description

When trying to gradlew runClient whilst having renderer as a dependency, the mod crashes with

	at net.minecraft.resource.ResourcePackProfile.loadMetadata(ResourcePackProfile.java:70)
	at net.minecraft.resource.ResourcePackProfile.create(ResourcePackProfile.java:47)
	at net.fabricmc.fabric.impl.resource.loader.ModResourcePackCreator.register(ModResourcePackCreator.java:84)
	at net.minecraft.client.option.GameOptions.handler$zeh000$fabric-resource-loader-v0$onLoad(GameOptions.java:2368)
	at net.minecraft.client.option.GameOptions.load(GameOptions.java:1480)
	at net.minecraft.client.option.GameOptions.<init>(GameOptions.java:1237)
	at net.minecraft.client.MinecraftClient.<init>(MinecraftClient.java:460)
	at net.minecraft.client.main.Main.main(Main.java:211)
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470)
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
	at net.fabricmc.devlaunchinjector.Main.main(Main.java:86)

i am not using any resourcepacks in my dev enviroment, and removing the dependency fixes it.

Expected Behavior

The game starting up as expected and not crashing

Desktop

  • OS: Windows
  • GPU: Nvidia

Additional Context

Before i managed to get this error, i got a different error, fabric trying to parse "minecraft" as a version string from some fabric.mod.json, removing Renderer as a dependency fixed that issue but after readding it, i am getting the above described error.

Any idea whats going on here?

Issue when building with gradle

When I try to build my gradle project with this repo i get this error :

Could not find io.github.ladysnake:satin:1.9.0

any help is appreciated,

thanks :)

Jitpack build failed, please rebuild

The jitpack build failed, causing the newest version to be unusable, which is required for 1.19.4. You can log in on jitpack, select builds and click the x on the right of newest build (0b4ebfcf45) to rebuild.

some examples?

Yeap. There is some javadoc.
For example will take Renderer3d#renderFilled
params:
start - The start coordinate of the block
dimensions - The dimensions of the block
color - The color of the filling

so I'm trying to call render by:
var filled = Renderer3d.renderFilled(new Vec3d(0 - .5, 0 - .5, 0 - .5), new Vec3d(1, 1, 1), Color.CYAN);
filled.drawWithVBO(Renderer3d.getEmptyMatrixStack());

and result is:

image

I know that my code is bad. Because I don't know how to use this method. Help me please :)

FEATURE REQUEST: glowing effect rendering

Hello, I was just thinking if you implemented a way to render a glowing-like effect but with custom color and position and size and possibly custom line width. I'm bad at rendering so idk how hard it would be to make, so sorry if its too hard, anyways thanks.

Update to 1.20.5

I understand that 1.20.5 has some of the biggest changes Minecraft's ever seen, so I understand if it takes a while. However, myself and many others use this lib as apart of our mods, and we cannot port until this has been updated.
I hope you understand.

[Suggestion] Text rendering

It would be really cool if text rendering was possible with Renderer2d. Maybe it could even support TTF fonts or something.

Game Crashing on Launch

I recently updated to 1.19 and upgraded my gradle settings. I got the game running however when I implemented the renderer it gives me this :

Incompatible mod set!
net.fabricmc.loader.impl.FormattedException: Mod resolution encountered an incompatible mod set!
A potential solution has been determined:
- Replace mod 'Renderer' (renderer) 1.0 with any version that is compatible with:
- minecraft 1.19
Unmet dependency listing:
- Mod 'Renderer' (renderer) 1.0 requires version 1.18.2 of 'Minecraft' (minecraft), but only the wrong version is present: 1.19!
at net.fabricmc.loader.impl.FabricLoaderImpl.load(FabricLoaderImpl.java:190)
at net.fabricmc.loader.impl.launch.knot.Knot.init(Knot.java:148)
at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:68)
at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
at net.fabricmc.devlaunchinjector.Main.main(Main.java:86)

I did not change the "include modImplementation("com.github.0x3C50:Renderer:master-SNAPSHOT")" because it says it will automatically update.

1.21 Update

Just a few days ago (at the time of making this issue) Minecraft has updated to 1.21.
My mod, and many other mods people develop relies on this library to fundamentally function.
With that said, a 1.21 update will unlock the ability for all of us to update our mods to the latest Minecraft version.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.