Skip to content

Commit

Permalink
Update to 1.20 (#156)
Browse files Browse the repository at this point in the history
* Update to 1.20

* Fixed background for SettingsScreen

* Update to 1.20.1 (#3)

* Add range to support 1.20.x

---------

Co-authored-by: KennyT <[email protected]>
Co-authored-by: LambdAurora <[email protected]>
  • Loading branch information
3 people authored Jun 19, 2023
1 parent b10591f commit 3f8a0c4
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 42 deletions.
1 change: 1 addition & 0 deletions .github/workflows/gradle_build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Gradle Build

on:
workflow_dispatch:
push:
branches:
- '*'
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,12 @@
- Updated [SpruceUI].
- Updated [pridelib].


### 2.3.1

- Fixed ATLauncher configuration somehow ([#152](https://github.com/LambdAurora/LambDynamicLights/pull/152)).
- Updated to Minecraft 1.20 ([#156](https://github.com/LambdAurora/LambDynamicLights/pull/156))
- Updated [SpruceUI].
- Updated night config.

[SpruceUI]: https://github.com/LambdAurora/SpruceUI "SpruceUI page"
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ org.gradle.jvmargs=-Xmx2G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.19.4
quilt_mappings=5
minecraft_version=1.20.1
quilt_mappings=1
loader_version=0.14.21
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_api_version=0.76.0+1.19.4
fabric_api_version=0.83.1+1.20.1

# Mod Properties
mod_version = 2.3.1
Expand All @@ -18,6 +18,6 @@ curseforge_id=393442

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
spruceui_version=4.2.0+1.19.4
spruceui_version=5.0.0+1.20
pridelib_version=1.2.0+1.19.4
modmenu_version=6.2.3
modmenu_version=7.0.1
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
import dev.lambdaurora.spruceui.background.DirtTexturedBackground;
import dev.lambdaurora.spruceui.widget.SpruceWidget;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.gui.GuiGraphics;

public class InnerBackground implements Background {

public class InnerBackground extends DrawableHelper implements Background {
@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) {
if (MinecraftClient.getInstance().world != null) {
this.fillGradient(matrices, widget.getX(), widget.getY(),
graphics.fillGradient(widget.getX(), widget.getY(),
widget.getX() + widget.getWidth(), widget.getY() + widget.getHeight(),
0xc0060606, 0xd0060606);
} else {
DirtTexturedBackground.DARKENED.render(matrices, widget, vOffset, mouseX, mouseY, delta);
DirtTexturedBackground.DARKENED.render(graphics, widget, vOffset, mouseX, mouseY, delta);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import dev.lambdaurora.spruceui.widget.WithBackground;
import dev.lambdaurora.spruceui.widget.container.SpruceEntryListWidget;
import dev.lambdaurora.spruceui.widget.container.SpruceParentWidget;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.gui.screen.narration.NarrationPart;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.glfw.GLFW;
Expand Down Expand Up @@ -203,14 +203,12 @@ 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));
}

@Override
protected void renderBackground(MatrixStack matrices, int mouseX, int mouseY, float delta) {
this.background.render(matrices, this, 0, mouseX, mouseY, delta);
protected void renderBackground(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
this.background.render(graphics, this, 0, mouseX, mouseY, delta);
}

/* Narration */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,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 org.joml.Matrix4f;
import org.joml.Vector4f;
Expand All @@ -46,13 +46,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 @@ -96,10 +96,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
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import dev.lambdaurora.spruceui.widget.container.tabbed.SpruceTabbedWidget;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.registry.Registries;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
Expand Down Expand Up @@ -134,12 +133,12 @@ private SpruceContainerWidget buildTabContainer(int width, int height, SpruceTab
innerWidget.getPosition().setRelativeY(43);
container.addChild(innerWidget);

container.setBackground((matrices, widget, vOffset, mouseX, mouseY, delta) -> {
container.setBackground((graphics, widget, vOffset, mouseX, mouseY, delta) -> {
if (this.client.world != null) {
this.fillGradient(matrices, widget.getX(), widget.getY(),
graphics.fillGradient(widget.getX(), widget.getY(),
widget.getX() + widget.getWidth(), innerWidget.getY(),
0xc0101010, 0xd0101010);
this.fillGradient(matrices, widget.getX(), innerWidget.getY() + innerWidget.getHeight(),
graphics.fillGradient(widget.getX(), innerWidget.getY() + innerWidget.getHeight(),
widget.getX() + widget.getWidth(), widget.getY() + widget.getHeight(),
0xc0101010, 0xd0101010);
} else {
Expand Down Expand Up @@ -197,8 +196,4 @@ private LightSourceListWidget buildLightSourcesTab(int width, int height, List<D
list.addAll(entries);
return list;
}

@Override
public void renderBackground(MatrixStack matrices) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@

import dev.lambdaurora.lambdynlights.gui.DynamicLightsOptionsOption;
import dev.lambdaurora.spruceui.Tooltip;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.option.GameOptionsScreen;
import net.minecraft.client.gui.screen.option.VideoOptionsScreen;
import net.minecraft.client.option.GameOptions;
import net.minecraft.client.option.Option;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
Expand Down Expand Up @@ -55,7 +55,7 @@ private Option<?>[] addOptionButton(Option<?>[] old) {
}

@Inject(method = "render", at = @At("TAIL"))
private void onRender(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
Tooltip.renderAll(this, matrices);
private void onRender(GuiGraphics graphics, int mouseX, int mouseY, float delta, CallbackInfo ci) {
Tooltip.renderAll(graphics);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public AbstractMinecartEntityMixin(EntityType<?> type, World world) {
@Inject(method = "tick", at = @At("HEAD"))
private void onTick(CallbackInfo ci) {
// We do not want to update the entity on the server.
if (this.world.isClient()) {
if (this.getWorld().isClient()) {
if (this.isRemoved()) {
this.setDynamicLightEnabled(false);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void dynamicLightTick() {
} else {
int luminance = 0;
var eyePos = BlockPos.create(this.getX(), this.getEyeY(), this.getZ());
boolean submergedInFluid = !this.world.getFluidState(eyePos).isEmpty();
boolean submergedInFluid = !this.getWorld().getFluidState(eyePos).isEmpty();
for (var equipped : this.getItemsEquipped()) {
if (!equipped.isEmpty())
luminance = Math.max(luminance, LambDynLights.getLuminanceFromItemStack(equipped, submergedInFluid));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void dynamicLightTick() {
int luminance = DynamicLightHandlers.getLuminanceFrom((Entity) this);

var eyePos = BlockPos.create(this.getX(), this.getEyeY(), this.getZ());
boolean submergedInFluid = !this.world.getFluidState(eyePos).isEmpty();
boolean submergedInFluid = !this.getWorld().getFluidState(eyePos).isEmpty();
for (var equipped : this.getItemsEquipped()) {
if (!equipped.isEmpty())
luminance = Math.max(luminance, LambDynLights.getLuminanceFromItemStack(equipped, submergedInFluid));
Expand Down
10 changes: 5 additions & 5 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
"lambdynlights.lightsource.mixins.json"
],
"depends": {
"fabricloader": ">=0.14.11",
"fabric": ">=0.76.0+1.19.4",
"minecraft": "1.19.4",
"spruceui": ">=4.2.0",
"fabricloader": ">=0.14.21",
"fabric": ">=0.83.1+1.20.1",
"minecraft": ">=1.20 <=1.20.1",
"spruceui": ">=5.0.0",
"java": ">=17"
},
"recommends": {
"modmenu": ">=6.2.3",
"modmenu": ">=7.0.1",
"quilt_loader": ">=0.19.1"
},
"suggests": {
Expand Down

0 comments on commit 3f8a0c4

Please sign in to comment.