Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
UselessBullets committed Nov 6, 2023
1 parent 1169deb commit 2f6d2a1
Showing 1 changed file with 1 addition and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,29 @@
import net.minecraft.client.render.dynamictexture.DynamicTexture;
import net.minecraft.core.Global;
import net.minecraft.core.util.helper.Buffer;
import net.minecraft.core.util.helper.Textures;
import org.lwjgl.opengl.GL11;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import turniplabs.halplibe.helper.TextureHelper;

import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.image.WritableRaster;
import java.nio.ByteBuffer;
import java.util.List;
import java.util.Map;

@Mixin(value = RenderEngine.class, remap = false)
public abstract class RenderEngineMixin {
@Shadow
private List<DynamicTexture> dynamicTextures;

@Shadow public abstract int getTexture(String name);

@Shadow protected abstract void generateMipmaps(ByteBuffer buffer, BufferedImage image, int levels, boolean smooth);

@Shadow @Final public Minecraft minecraft;
@Shadow private boolean clampTexture;
@Shadow private boolean blurTexture;
@Shadow private Map<String, Integer> textureMap;
@Unique
private final RenderEngine thisAsRenderEngine = (RenderEngine)(Object)this;
@Inject(method = "initDynamicTextures", at = @At("TAIL"))
Expand All @@ -63,7 +53,7 @@ private void adjustAtlasSize(BufferedImage img, int id, boolean mipmap, Callback
// }
// }
// }
if (mipmap){
if (mipmap){ // TODO Replace with a way to directly detect if a texture is Terrain.png or Items.png
BufferedImage resizedAtlas = new BufferedImage((img.getWidth()/32) * Global.TEXTURE_ATLAS_WIDTH_TILES, (img.getHeight()/32) * Global.TEXTURE_ATLAS_WIDTH_TILES, img.getType());
if (img.getWidth() == resizedAtlas.getWidth() && img.getHeight() == resizedAtlas.getHeight()){
return; // Don't scale and transfer image if they're the same size
Expand Down

0 comments on commit 2f6d2a1

Please sign in to comment.