Skip to content

Commit

Permalink
Update to 1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
TibiNonEst committed Jul 21, 2023
1 parent 027b685 commit 8d52c1a
Show file tree
Hide file tree
Showing 22 changed files with 146 additions and 156 deletions.
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
plugins {
id 'org.quiltmc.loom' version '1.0.+'
id 'org.quiltmc.loom' version '1.2.+'
id 'java-library'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '7.1.0'
id 'org.quiltmc.gradle.licenser' version '1.1.+'
id 'com.github.johnrengelman.shadow' version '8.1.+'
id 'org.quiltmc.gradle.licenser' version '2.0.+'
}

group = project.maven_group
Expand Down Expand Up @@ -73,8 +73,8 @@ dependencies {
exclude group: 'net.fabricmc.fabric-api'
})

shadow 'com.electronwill.night-config:core:3.6.4'
shadow "com.electronwill.night-config:toml:3.6.4"
shadow 'com.electronwill.night-config:core:3.6.6'
shadow "com.electronwill.night-config:toml:3.6.6"
}

java {
Expand Down Expand Up @@ -117,7 +117,7 @@ shadowJar {

relocate 'com.electronwill.nightconfig', 'dev.lambdaurora.lambdamap.shadow.nightconfig'
}
prepareRemapJar.dependsOn(shadowJar)
remapJar.dependsOn(shadowJar)

// configure the maven publication
publishing {
Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
org.gradle.jvmargs=-Xmx1G

# Quilt properties
minecraft_version=1.19.4
quilt_mappings=7
loader_version=0.18.6
fabric_api_version=6.0.0-beta.2+0.76.0
qsl_version=5.0.0-beta.1
minecraft_version=1.20.1
quilt_mappings=20
loader_version=0.19.2
fabric_api_version=7.0.6+0.85.0
qsl_version=6.0.4

# Mod properties
mod_version=1.0.0-alpha.1
maven_group=dev.lambdaurora
archives_base_name=lambdamap

# Dependencies
spruceui_version=4.2.0+1.19.4
spruceui_version=5.0.0+1.20
pridelib_version=1.2.0+1.19.4
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
12 changes: 8 additions & 4 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum

Expand Down Expand Up @@ -133,10 +130,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
Expand Down Expand Up @@ -197,6 +197,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/dev/lambdaurora/lambdamap/BlockSearcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void searchForBlock(Chunk chunk, Heightmap surfaceHeightmap, int x, int z
do {
this.pos.setY(--this.height);
this.state = chunk.getBlockState(this.pos);
} while (this.state.getMapColor(this.world, this.pos) == MapColor.CLEAR && this.height > minimumY);
} while (this.state.getMapColor(this.world, this.pos) == MapColor.NONE && this.height > minimumY);
}
}

Expand Down Expand Up @@ -93,7 +93,7 @@ public void searchForBlockCeil(Chunk chunk, int x, int z, int chunkStartX, int c
if (this.state.isAir()) {
brokeThroughCeil = true;
}
while ((!brokeThroughCeil || this.state.getMapColor(this.world, this.pos) == MapColor.CLEAR)
while ((!brokeThroughCeil || this.state.getMapColor(this.world, this.pos) == MapColor.NONE)
&& this.height > this.world.getBottomSectionCoord()) {
this.pos.setY(--this.height);
this.state = chunk.getBlockState(this.pos);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/dev/lambdaurora/lambdamap/LambdaMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public void updateChunk(World world, int chunkX, int chunkZ) {
var biome = world.getBiome(searcher.pos);
int shade;

if (mapColor == MapColor.WATER_BLUE) {
if (mapColor == MapColor.WATER) {
double shadeTest = (double) searcher.getWaterDepth() * 0.1D + (double) (xOffset + zOffset & 1) * 0.2D;
shade = 1;
if (shadeTest < 0.5D) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@
import dev.lambdaurora.spruceui.background.EmptyBackground;
import dev.lambdaurora.spruceui.widget.SpruceButtonWidget;
import dev.lambdaurora.spruceui.widget.container.SpruceContainerWidget;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.CommonTexts;
import net.minecraft.text.OrderedText;
import net.minecraft.text.ScreenTexts;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;

Expand All @@ -43,20 +42,20 @@ public ConfirmDeletionWidget(MarkerTabWidget parent, Position position, int widt
int fixedWidth = this.getWidth() / 2 - 2 * spacing;

SpruceButtonWidget deleteButton = new SpruceButtonWidget(Position.of(this, spacing + offset, fixedY),
fixedWidth, 20, ScreenTexts.PROCEED, button -> {
fixedWidth, 20, CommonTexts.PROCEED, button -> {
this.markerEntry.parent.removeMarker(markerEntry);
parent.switchBack();
});
SpruceButtonWidget cancelButton = new SpruceButtonWidget(Position.of(this, getWidth() / 2 + spacing - offset, fixedY),
fixedWidth, 20, ScreenTexts.CANCEL, button -> parent.switchBack());
fixedWidth, 20, CommonTexts.CANCEL, button -> parent.switchBack());

this.addChild(deleteButton);
this.addChild(cancelButton);
}

@Override
protected void renderWidget(MatrixStack matrices, int mouseX, int mouseY, float delta) {
this.forEach(child -> child.render(matrices, mouseX, mouseY, delta));
protected void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
this.forEach(child -> child.render(graphics, mouseX, mouseY, delta));

VertexConsumerProvider.Immediate immediate = VertexConsumerProvider.immediate(Tessellator.getInstance().getBufferBuilder());

Expand All @@ -66,7 +65,7 @@ protected void renderWidget(MatrixStack matrices, int mouseX, int mouseY, float
name.equals("") ? Text.translatable("lambdamap.marker.confirm_deletion.prompt.unnamed") : name)
.asOrderedText();

DrawableHelper.drawCenteredTextWithShadow(matrices, this.client.textRenderer, prompt, this.getX() + this.getWidth() / 2, this.getHeight() / 3, 0xffffffff);
graphics.drawCenteredShadowedText(this.client.textRenderer, prompt, this.getX() + this.getWidth() / 2, this.getHeight() / 3, 0xffffffff);

immediate.draw();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
import dev.lambdaurora.spruceui.widget.container.SpruceParentWidget;
import dev.lambdaurora.spruceui.widget.text.SpruceTextFieldWidget;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.render.LightmapTextureManager;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.OrderedText;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
Expand Down Expand Up @@ -284,16 +284,16 @@ protected boolean onCharTyped(char chr, int keyCode) {
/* Rendering */

@Override
protected void renderWidget(MatrixStack matrices, int mouseX, int mouseY, float delta) {
this.forEach(widget -> widget.render(matrices, mouseX, mouseY, delta));
protected void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
this.forEach(widget -> widget.render(graphics, mouseX, mouseY, delta));

int light = LightmapTextureManager.pack(15, 15);

VertexConsumerProvider.Immediate immediate = VertexConsumerProvider.immediate(Tessellator.getInstance().getBufferBuilder());

float textY = this.getY() + this.getHeight() / 2.f - 5;

Matrix4f model = matrices.peek().getModel();
Matrix4f model = graphics.getMatrices().peek().getModel();

this.client.textRenderer.draw("X: ", this.getX() + this.getWidth() / 2.f, textY, 0xffffffff, true, model, immediate, TextRenderer.TextLayerType.NORMAL, 0, light);
this.client.textRenderer.draw("Z: ", this.getX() + this.getWidth() / 2.f + 48 + 20, textY, 0xffffffff, true, model, immediate, TextRenderer.TextLayerType.NORMAL, 0, light);
Expand All @@ -302,8 +302,8 @@ protected void renderWidget(MatrixStack matrices, int mouseX, int mouseY, float
}

@Override
protected void renderBackground(MatrixStack matrices, int mouseX, int mouseY, float delta) {
fill(matrices, this.getX(), this.getY(), this.getX() + this.parent.getInnerWidth(), this.getY() + this.getHeight() - 2, 0x55555555);
protected void renderBackground(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
graphics.fill(this.getX(), this.getY(), this.getX() + this.parent.getInnerWidth(), this.getY() + this.getHeight() - 2, 0x55555555);
}
}
}
20 changes: 9 additions & 11 deletions src/main/java/dev/lambdaurora/lambdamap/gui/MarkerTypeButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@

package dev.lambdaurora.lambdamap.gui;

import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.Tessellator;
import dev.lambdaurora.lambdamap.LambdaMap;
import dev.lambdaurora.lambdamap.map.marker.MarkerType;
import dev.lambdaurora.spruceui.Position;
import dev.lambdaurora.spruceui.widget.SpruceButtonWidget;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.render.LightmapTextureManager;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import org.lwjgl.glfw.GLFW;
Expand Down Expand Up @@ -79,23 +78,22 @@ public void setMarkerType(MarkerType type) {
}

@Override
protected void renderWidget(MatrixStack matrices, int mouseX, int mouseY, float delta) {
matrices.push();
matrices.translate(this.getX() + 9, this.getY() + 11, 5);
matrices.scale(2, 2, 1);
protected void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
graphics.getMatrices().push();
graphics.getMatrices().translate(this.getX() + 9, this.getY() + 11, 5);
graphics.getMatrices().scale(2, 2, 1);
VertexConsumerProvider.Immediate immediate = VertexConsumerProvider.immediate(Tessellator.getInstance().getBufferBuilder());
this.type.render(matrices, immediate, 180.f, null, LightmapTextureManager.pack(15, 15));
this.type.render(graphics, immediate, 180.f, null, LightmapTextureManager.pack(15, 15));
immediate.draw();
matrices.pop();
graphics.getMatrices().pop();
}

@Override
protected void renderBackground(MatrixStack matrices, int mouseX, int mouseY, float delta) {
protected void renderBackground(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
if (this.isFocused()) {
int width = this.getWidth();
int height = this.getHeight();
RenderSystem.setShaderTexture(0, FOCUSED_TEXTURE);
drawTexture(matrices, this.getX(), this.getY(), 0, 0, width, height, width, height);
graphics.drawTexture(FOCUSED_TEXTURE, this.getX(), this.getY(), 0, 0, width, height, width, height);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import io.github.queerbric.pride.PrideFlag;
import io.github.queerbric.pride.PrideFlagShapes;
import io.github.queerbric.pride.PrideFlags;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Identifier;

import java.util.Random;
Expand All @@ -54,13 +54,13 @@ public RandomPrideFlagBackground(PrideFlag flag) {
}

@Override
public void render(MatrixStack matrices, SpruceWidget widget, int vOffset, int mouseX, int mouseY, float delta) {
public void render(GuiGraphics graphics, SpruceWidget widget, int vOffset, int mouseX, int mouseY, float delta) {
int x = widget.getX();
int y = widget.getY();

RenderSystem.setShader(GameRenderer::getPositionColorShader);
if (this.flag.getShape() == PrideFlagShapes.get(new Identifier("pride", "horizontal_stripes"))) {
var model = matrices.peek().getModel();
var model = graphics.getMatrices().peek().getModel();
var tessellator = Tessellator.getInstance();
var vertices = tessellator.getBufferBuilder();
vertices.begin(VertexFormat.DrawMode.TRIANGLES, VertexFormats.POSITION_COLOR);
Expand Down Expand Up @@ -104,10 +104,10 @@ public void render(MatrixStack matrices, SpruceWidget widget, int vOffset, int m

tessellator.draw();
} else {
this.flag.render(matrices, x, y, widget.getWidth(), widget.getHeight());
this.flag.render(graphics.getMatrices(), x, y, widget.getWidth(), widget.getHeight());
}

SECOND_LAYER.render(matrices, widget, vOffset, mouseX, mouseY, delta);
SECOND_LAYER.render(graphics, widget, vOffset, mouseX, mouseY, delta);
}

/**
Expand Down
30 changes: 15 additions & 15 deletions src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import dev.lambdaurora.lambdamap.map.WorldMap;
import dev.lambdaurora.lambdamap.map.marker.MarkerType;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.render.LightmapTextureManager;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumerProvider;
Expand Down Expand Up @@ -212,20 +212,20 @@ public void update(boolean forceRedraw) {
}
}

public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, float delta) {
DrawableHelper.fill(matrices, 0, 0, this.width, this.height, 0xff000000);
public void render(GuiGraphics graphics, VertexConsumerProvider vertexConsumers, float delta) {
graphics.fill(0, 0, this.width, this.height, 0xff000000);

int light = LightmapTextureManager.pack(15, 15);
this.textureManager.render(matrices, vertexConsumers, light);
this.textureManager.render(graphics, vertexConsumers, light);

this.worldMap.getMarkerManager().forEachInBox(this.cornerViewX - 5, this.cornerViewZ - 5,
this.scaledWidth() + 10, this.scaledHeight() + 10,
marker -> marker.render(matrices, vertexConsumers, this.cornerViewX, this.cornerViewZ, this.scale, light));
marker -> marker.render(graphics, vertexConsumers, this.cornerViewX, this.cornerViewZ, this.scale, light));

this.renderPlayerIcon(matrices, vertexConsumers, light, delta);
this.renderPlayerIcon(graphics, vertexConsumers, light, delta);
}

private void renderPlayerIcon(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, float delta) {
private void renderPlayerIcon(GuiGraphics graphics, VertexConsumerProvider vertexConsumers, int light, float delta) {
var client = MinecraftClient.getInstance();

var pos = client.player.getBlockPos();
Expand All @@ -234,10 +234,10 @@ private void renderPlayerIcon(MatrixStack matrices, VertexConsumerProvider verte
|| this.cornerViewX + this.scaledWidth() < pos.getX() || this.cornerViewZ + this.scaledHeight() < pos.getZ())
return;

matrices.push();
matrices.translate((pos.getX() - this.cornerViewX) / (float) this.scale, (pos.getZ() - this.cornerViewZ) / (float) this.scale, 1.1f);
MarkerType.PLAYER.render(matrices, vertexConsumers, client.player.getYaw(delta), null, light);
matrices.pop();
graphics.getMatrices().push();
graphics.getMatrices().translate((pos.getX() - this.cornerViewX) / (float) this.scale, (pos.getZ() - this.cornerViewZ) / (float) this.scale, 1.1f);
MarkerType.PLAYER.render(graphics, vertexConsumers, client.player.getYaw(delta), null, light);
graphics.getMatrices().pop();
}

public static void vertex(VertexConsumer vertices, Matrix4f model, float x, float y,
Expand Down Expand Up @@ -326,7 +326,7 @@ public void updateTextures(boolean forceRedraw) {
LOGGER.debug("Took {}ms to update {} textures.", (System.currentTimeMillis() - start), count);
}

public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light) {
public void render(GuiGraphics graphics, VertexConsumerProvider vertexConsumers, int light) {
int scale = WorldMapRenderer.this.scale;
float originX = -((WorldMapRenderer.this.cornerViewX & 127) / (float) scale);
float originZ = -((WorldMapRenderer.this.cornerViewZ & 127) / (float) scale);
Expand Down Expand Up @@ -355,7 +355,7 @@ public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers,
width = WorldMapRenderer.this.width - (originX + x * 128);
}

line[x].render(matrices, vertexConsumers, Math.round(originX + x * 128), Math.round(originZ + z * 128), offsetX, offsetZ, width, height, light);
line[x].render(graphics, vertexConsumers, Math.round(originX + x * 128), Math.round(originZ + z * 128), offsetX, offsetZ, width, height, light);
offsetX = 0;
}

Expand Down Expand Up @@ -422,10 +422,10 @@ public void update(WorldMap map, int chunkStartX, int chunkStartZ, int scale) {
this.texture.upload();
}

public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, float originX, float originY,
public void render(GuiGraphics graphics, VertexConsumerProvider vertexConsumers, float originX, float originY,
int offsetX, int offsetY,
float width, float height, int light) {
var model = matrices.peek().getModel();
var model = graphics.getMatrices().peek().getModel();
var vertices = vertexConsumers.getBuffer(this.mapRenderLayer);

float uOffset = offsetX / 128.f;
Expand Down
Loading

0 comments on commit 8d52c1a

Please sign in to comment.