DrawTexture does not draw texture as it did in 1.16
Drommedhar opened this issue ยท 7 comments
After updating my plugin to the latest Fabric version for MC 1.17.1, I get the following error while building it:
src\main\java\buddy\CommandHelper.java:9: error: package net.fabricmc.fabric.api.client.command.v1 does not exist import net.fabricmc.fabric.api.client.command.v1.ClientCommandManager; ^ src\main\java\buddy\CommandHelper.java:10: error: package net.fabricmc.fabric.api.client.command.v1 does not exist import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
I already ran "gradlew vscode" and "gradlew genSources" and also ran remapping.
Does someone know how to fix it? In 1.16 it worked perfectly fine.
Both did not help.
runClient still can't build the code and clearing the workspace does not fix it either.
I'm not sure why it suddenly stopped finding the import namespace for net.fabricmc.fabric. It should still be present, even in 1.17.1 (for what I could find out)
Deleting both folders did not really do the trick.
I somehow fixed it by creating a new mod based on the example mod and readding my code to it.
Now it builds.
But the next issue is, that images I render on screen are now completly damaged (it looks like MC is trying to render a different image, in my example it's trying to render the players steve texture).
It's not using the images referenced from the "resources\assets%modid%" folder anymore.
So a quick example code on how the rendering stuff was done (and working in 1.16):
private final Identifier coinId = new Identifier("buddy", "coin_bc.png");
...
@Inject(method = "render(Lnet/minecraft/client/util/math/MatrixStack;F)V", at = @at("HEAD"))
public void render(net.minecraft.client.util.math.MatrixStack matrices, float tickDelta, CallbackInfo info) {
mc.getTextureManager().bindTexture(coinId);
DrawableHelper.drawTexture(matrices, centerX + 95, mainWindow.getScaledHeight()-15 - 1, 0, 0, 10, 10, 10, 10);
...
Is there something wrong here for newer Fabric versions?
that code in 1.16 mc.getTextureManager().bindTexture(coinId);
is something like this in 1.17 RenderSystem.setShaderTexture(0, coinId);
I don't think this issue belongs in the fabric-api (programming) bug reports.
If anything it is a fabric-loom, gradle or vsc (build system) issue.
Anyway:
Do you know where it is getting the fabric api jars from?
e.g. project-root/.gradle (project specific) or user-home/.gradle/caches (shared across projects)
A couple of simple things to try:
- Delete your project/.gradle folder (NOTE: .gradle with a dot on the front, not gradle)
- Run gradlew with the option --refresh-dependencies
These will force gradle to redownload all your cached jars for the build (in case something is messed up).