Skip to content

Commit

Permalink
pain
Browse files Browse the repository at this point in the history
  • Loading branch information
kineticneticat committed Nov 25, 2024
1 parent 061e254 commit cfd9a91
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import dev.kineticcat.complexhex.client.render.CoolerGaslightingTracker;
import dev.kineticcat.complexhex.client.render.be.BlockEntityBurntAmethystRenderer;
import dev.kineticcat.complexhex.client.render.entity.HexalWispRenderer;
import dev.kineticcat.complexhex.client.render.entity.holdoutrenderingshenannigans.HoldoutRenderer;
import dev.kineticcat.complexhex.client.render.entity.NixRenderer;
import dev.kineticcat.complexhex.client.render.entity.holdoutrenderingshenannigans.HoldoutRenderer;
import dev.kineticcat.complexhex.entity.ComplexHexEntities;
import dev.kineticcat.complexhex.item.ComplexHexItems;
import net.minecraft.client.renderer.RenderType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
import net.minecraft.server.packs.resources.PreparableReloadListener;
import org.scilab.forge.jlatexmath.TeXFormula;

import java.awt.*;
Expand All @@ -18,7 +19,7 @@

public class LaTeXRenderer extends EntityRenderer<LaTeXEntity> {

private DynamicTexture texture;
// private DynamicTexture texture;
protected LaTeXRenderer(EntityRendererProvider.Context context) {
super(context);
}
Expand All @@ -30,11 +31,18 @@ public ResourceLocation getTextureLocation(LaTeXEntity entity) {

@Override
public void render(LaTeXEntity latexEntity, float yaw, float partialTick, PoseStack ps, MultiBufferSource multiBufferSource, int packedLight) {
String LaTeX = latexEntity.getLaTeX();
TeXFormula formula = new TeXFormula(LaTeX);
BufferedImage image = (BufferedImage) formula.createBufferedImage(TeXFormula.SANSSERIF, 10, Color.BLACK, null);
DynamicTexture tex = new DynamicTexture(new NativeImage(image.getWidth(), image.getHeight(), false));
tex.
if (texture == null) {
String LaTeX = latexEntity.getLaTeX();
TeXFormula formula = new TeXFormula(LaTeX);
BufferedImage bufImg = (BufferedImage) formula.createBufferedImage(TeXFormula.SANSSERIF, 10, Color.BLACK, null);
NativeImage wawa = new NativeImage(bufImg.getWidth(), bufImg.getHeight(), true);
for (int y = 0; y < bufImg.getHeight(); y++)
for (int x = 0; x < bufImg.getWidth(); x++)
wawa.setPixelRGBA(x, y, bufImg.getRGB(x, y));
DynamicTexture texture = new DynamicTexture(wawa);
ResourceLocation resLoc = TextureManager.register("", texture);
}

}

}

0 comments on commit cfd9a91

Please sign in to comment.