Skip to content

Commit

Permalink
1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
TexBlock committed Jun 27, 2023
1 parent a83e185 commit a214863
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 31 deletions.
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ loom.platform=forge

# Base properties
# minecraft version
minecraft_version=1.19.4
minecraft_version=1.20.1
# forge version, latest version can be found on https://files.minecraftforge.net/
forge_version=1.19.4-45.1.0
forge_version=1.20.1-47.0.19
# yarn, latest version can be found on https://fabricmc.net/develop/
yarn_mappings=1.19.4+build.1
yarn_mappings=1.20.1+build.2

# Mod Properties
mod_version=0.1.2
Expand All @@ -19,4 +19,4 @@ loom.platform=forge
mod_author=ThinkingStudio

# Dependencies
malilib_version=0.1.7-mc1.19.4
malilib_version=0.1.0-mc1.20.1
1 change: 0 additions & 1 deletion src/main/java/fi/dy/masa/minihud/MiniHUD.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public MiniHUD() {
public void onInitializeClient(FMLClientSetupEvent event) {
ForgePlatformCompat.getInstance().getModClientExtensionPoint();
InitializationHandler.getInstance().registerInitializationHandler(new InitHandler());

ForgePlatformCompat.getInstance().getMod(Reference.MOD_ID).registerModConfigScreen((screen) -> {
GuiConfigs gui = new GuiConfigs();
gui.setParent(screen);
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/fi/dy/masa/minihud/event/RenderHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@
import java.util.concurrent.CompletableFuture;
import javax.annotation.Nullable;
import org.joml.Matrix4f;

import net.minecraft.block.BeehiveBlock;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
import net.minecraft.block.entity.BeehiveBlockEntity;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.network.PlayerListEntry;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
Expand Down Expand Up @@ -47,6 +49,7 @@
import net.minecraft.world.chunk.ChunkStatus;
import net.minecraft.world.chunk.WorldChunk;
import net.minecraft.world.chunk.light.LightingProvider;

import fi.dy.masa.malilib.config.HudAlignment;
import fi.dy.masa.malilib.gui.GuiBase;
import fi.dy.masa.malilib.interfaces.IRenderer;
Expand All @@ -73,12 +76,9 @@ public class RenderHandler implements IRenderer
private final DataStorage data;
private final Date date;
private final Map<ChunkPos, CompletableFuture<WorldChunk>> chunkFutures = new HashMap<>();
private int fps;
private int fpsCounter;
private long fpsUpdateTime = System.currentTimeMillis();
private long infoUpdateTime;
private Set<InfoToggle> addedTypes = new HashSet<>();
private final Set<InfoToggle> addedTypes = new HashSet<>();
@Nullable private WorldChunk cachedClientChunk;
private long infoUpdateTime;

private final List<StringHolder> lineWrappers = new ArrayList<>();
private final List<String> lines = new ArrayList<>();
Expand Down Expand Up @@ -111,7 +111,7 @@ public static void fixDebugRendererState()
}

@Override
public void onRenderGameOverlayPost(MatrixStack matrixStack)
public void onRenderGameOverlayPost(DrawContext context)
{
if (Configs.Generic.MAIN_RENDERING_TOGGLE.getBooleanValue() == false)
{
Expand Down Expand Up @@ -142,12 +142,12 @@ public void onRenderGameOverlayPost(MatrixStack matrixStack)
boolean useBackground = Configs.Generic.USE_TEXT_BACKGROUND.getBooleanValue();
boolean useShadow = Configs.Generic.USE_FONT_SHADOW.getBooleanValue();

RenderUtils.renderText(x, y, Configs.Generic.FONT_SCALE.getDoubleValue(), textColor, bgColor, alignment, useBackground, useShadow, this.lines, matrixStack);
RenderUtils.renderText(x, y, Configs.Generic.FONT_SCALE.getDoubleValue(), textColor, bgColor, alignment, useBackground, useShadow, this.lines, context);
}
}

@Override
public void onRenderTooltipLast(ItemStack stack, int x, int y)
public void onRenderTooltipLast(DrawContext drawContext, ItemStack stack, int x, int y)
{
if (stack.getItem() instanceof FilledMapItem)
{
Expand All @@ -162,7 +162,7 @@ else if (Configs.Generic.SHULKER_BOX_PREVIEW.getBooleanValue())

if (render)
{
fi.dy.masa.malilib.render.RenderUtils.renderShulkerBoxPreview(stack, x, y, Configs.Generic.SHULKER_DISPLAY_BACKGROUND_COLOR.getBooleanValue());
fi.dy.masa.malilib.render.RenderUtils.renderShulkerBoxPreview(stack, x, y, Configs.Generic.SHULKER_DISPLAY_BACKGROUND_COLOR.getBooleanValue(), drawContext);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import java.util.List;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.util.math.MatrixStack;

import net.minecraft.client.gui.DrawContext;

import fi.dy.masa.malilib.gui.GuiBase;
import fi.dy.masa.malilib.gui.button.ButtonBase;
import fi.dy.masa.malilib.gui.button.ButtonGeneric;
Expand Down Expand Up @@ -67,7 +69,7 @@ public boolean canSelectAt(int mouseX, int mouseY, int mouseButton)
}

@Override
public void render(int mouseX, int mouseY, boolean selected, MatrixStack matrixStack)
public void render(int mouseX, int mouseY, boolean selected, DrawContext context)
{
RenderUtils.color(1f, 1f, 1f, 1f);

Expand All @@ -94,24 +96,22 @@ else if (this.isOdd)
}

String name = this.shape.getDisplayName();
this.drawString(this.x + 4, this.y + 7, 0xFFFFFFFF, name, matrixStack);
this.drawString(this.x + 4, this.y + 7, 0xFFFFFFFF, name, context);

RenderUtils.color(1f, 1f, 1f, 1f);
RenderSystem.disableBlend();

super.render(mouseX, mouseY, selected, matrixStack);

RenderUtils.disableDiffuseLighting();
super.render(mouseX, mouseY, selected, context);
}

@Override
public void postRenderHovered(int mouseX, int mouseY, boolean selected, MatrixStack matrixStack)
public void postRenderHovered(int mouseX, int mouseY, boolean selected, DrawContext context)
{
super.postRenderHovered(mouseX, mouseY, selected, matrixStack);
super.postRenderHovered(mouseX, mouseY, selected, context);

if (mouseX >= this.x && mouseX < this.buttonsStartX && mouseY >= this.y && mouseY <= this.y + this.height)
{
RenderUtils.drawHoverText(mouseX, mouseY, this.hoverLines, matrixStack);
RenderUtils.drawHoverText(mouseX, mouseY, this.hoverLines, context);
}
}

Expand Down
8 changes: 5 additions & 3 deletions src/main/java/fi/dy/masa/minihud/mixin/MixinSubtitlesHud.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.hud.SubtitlesHud;
import net.minecraft.client.util.math.MatrixStack;

import fi.dy.masa.minihud.event.RenderHandler;

@Mixin(SubtitlesHud.class)
Expand All @@ -14,13 +16,13 @@ public abstract class MixinSubtitlesHud
@Inject(method = "render",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/client/util/math/MatrixStack;scale(FFF)V"))
private void nudgeSubtitleOverlay(MatrixStack matrices, CallbackInfo ci)
private void nudgeSubtitleOverlay(DrawContext context, CallbackInfo ci)
{
int offset = RenderHandler.getInstance().getSubtitleOffset();

if (offset != 0)
{
matrices.translate(0, offset, 0);
context.getMatrices().translate(0, offset, 0);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public RenderObjectVbo(VertexFormat.DrawMode glMode, VertexFormat format, Suppli
{
super(glMode, shader);

this.vertexBuffer = new VertexBuffer();
this.vertexBuffer = new VertexBuffer(VertexBuffer.Usage.STATIC);
this.format = format;

boolean hasTexture = false;
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
modLoader = "javafml"
loaderVersion = "[44,)"
loaderVersion = "[46,)"
license = "LGPLv3"

[[mods]]
Expand All @@ -19,20 +19,20 @@ Configurable "mini-F3" info lines, and various overlay renderers.
[[dependencies.minihud]]
modId = "forge"
mandatory = true
versionRange = "[44,)"
versionRange = "[46,)"
ordering = "NONE"
side = "BOTH"

[[dependencies.minihud]]
modId = "minecraft"
mandatory = true
versionRange = "[1.19.3,1.19.4]"
versionRange = "[1.20,]"
ordering = "NONE"
side = "BOTH"

[[dependencies.minihud]]
modId = "malilib"
mandatory = true
versionRange = "[0.1.4,)"
versionRange = "[0.1.0,)"
ordering = "NONE"
side = "BOTH"

0 comments on commit a214863

Please sign in to comment.