Skip to content

Commit dbadda9

Browse files
committed
backport to 1.18.2
1 parent f68f8a8 commit dbadda9

114 files changed

Lines changed: 1030 additions & 771 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ allprojects {
136136
maven { url = "https://maven.cafeteria.dev/releases/" }
137137
maven { url = "https://maven.gegy.dev" }
138138
maven { url = "https://modmaven.dev" }
139-
maven { url = "https://maven.minecraftforge.net/"}
139+
maven { url = "https://maven.minecraftforge.net/" }
140140
exclusiveContent {
141141
forRepository {
142142
maven {

common/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ dependencies {
1515
modApi("dev.architectury:architectury-fabric:${rootProject.architectury_version}") { exclude group: "net.fabricmc" exclude group: "net.fabricmc.fabric-api" }
1616

1717
// for sodium compat
18-
modCompileOnly "maven.modrinth:sodium:mc1.19.2-0.4.4"
18+
modCompileOnly "maven.modrinth:sodium:mc1.18.2-0.4.1"
1919

2020
// for iris compat
21-
modCompileOnly "maven.modrinth:iris:1.6.11+1.19.2"
21+
modCompileOnly "maven.modrinth:iris:1.6.11+1.18.2"
2222

2323
// for REI compat
24-
modCompileOnly("me.shedaniel:RoughlyEnoughItems-fabric:9.2.784") { exclude group: "net.fabricmc" exclude group: "net.fabricmc.fabric-api" exclude group: "dev.architectury" }
24+
modCompileOnly("me.shedaniel:RoughlyEnoughItems-fabric:8.4.778") { exclude group: "net.fabricmc" exclude group: "net.fabricmc.fabric-api" exclude group: "dev.architectury" }
2525

2626
// for Pehkui compat
2727
modApi("com.github.Virtuoel:Pehkui:3.7.12") { exclude group: "net.fabricmc" exclude group: "net.fabricmc.fabric-api" }

common/src/main/java/org/vivecraft/client/Xplat.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,6 @@ static TextureAtlasSprite[] getFluidTextures(BlockAndTintGetter level, BlockPos
142142
return new TextureAtlasSprite[]{};
143143
}
144144

145-
/**
146-
* @param biome Biome to get the ClimateSettings from
147-
* @return ClimateSettings of the given Biome
148-
*/
149-
@ExpectPlatform
150-
static Biome.ClimateSettings getBiomeClimateSettings(Biome biome) {
151-
throw new AssertionError();
152-
}
153-
154145
/**
155146
* @param biome Biome to get the BiomeSpecialEffects from
156147
* @return BiomeSpecialEffects of the given Biome
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package org.vivecraft.client.extensions;
2+
3+
import net.minecraft.client.model.geom.ModelPart;
4+
5+
public interface ModelPartExtension {
6+
/**
7+
* set ModelPart scale, since older Minecraft versions lack that feature
8+
*
9+
* @param x x scale
10+
* @param y y scale
11+
* @param z z scale
12+
*/
13+
void vivecraft$setScale(float x, float y, float z);
14+
15+
/**
16+
* copies the ModelPart scale of parameters {@code this} to {@code other}
17+
*/
18+
void vivecraft$copyScaleTo(ModelPart other);
19+
}

common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionButton.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.vivecraft.client.gui.framework;
22

33
import net.minecraft.client.gui.components.Button;
4-
import net.minecraft.network.chat.Component;
4+
import net.minecraft.network.chat.TranslatableComponent;
55
import org.vivecraft.client_vr.ClientDataHolderVR;
66
import org.vivecraft.client_vr.settings.VRSettings;
77

@@ -24,7 +24,7 @@ public GuiVROptionButton(
2424
int id, int x, int y, int width, int height, @Nullable VRSettings.VrOptions option, String text,
2525
OnPress onPress)
2626
{
27-
super(x, y, width, height, Component.translatable(text), onPress);
27+
super(x, y, width, height, new TranslatableComponent(text), onPress);
2828
this.id = id;
2929
this.enumOptions = option;
3030
ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance();

common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionSlider.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.vivecraft.client.gui.framework;
22

33
import net.minecraft.client.gui.components.AbstractSliderButton;
4-
import net.minecraft.network.chat.Component;
4+
import net.minecraft.network.chat.TextComponent;
55
import org.vivecraft.client_vr.ClientDataHolderVR;
66
import org.vivecraft.client_vr.settings.VRSettings;
77

@@ -17,7 +17,8 @@ public GuiVROptionSlider(
1717
int id, int x, int y, int width, int height, VRSettings.VrOptions option, boolean valueOnly)
1818
{
1919
super(x, y, width, height,
20-
Component.literal(ClientDataHolderVR.getInstance().vrSettings.getButtonDisplayString(option, valueOnly)),
20+
new TextComponent(
21+
ClientDataHolderVR.getInstance().vrSettings.getButtonDisplayString(option, valueOnly)),
2122
option.normalizeValue(ClientDataHolderVR.getInstance().vrSettings.getOptionFloatValue(option)));
2223

2324
this.id = id;
@@ -38,7 +39,7 @@ public GuiVROptionSlider(int id, int x, int y, VRSettings.VrOptions option) {
3839

3940
@Override
4041
protected void updateMessage() {
41-
this.setMessage(Component.literal(
42+
this.setMessage(new TextComponent(
4243
ClientDataHolderVR.getInstance().vrSettings.getButtonDisplayString(this.enumOptions, this.valueOnly)));
4344
}
4445

common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionsBase.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
import net.minecraft.client.gui.components.events.GuiEventListener;
88
import net.minecraft.client.gui.screens.Screen;
99
import net.minecraft.client.resources.language.I18n;
10-
import net.minecraft.network.chat.Component;
1110
import net.minecraft.network.chat.FormattedText;
1211
import net.minecraft.network.chat.Style;
12+
import net.minecraft.network.chat.TextComponent;
13+
import net.minecraft.network.chat.TranslatableComponent;
1314
import net.minecraft.world.phys.Vec2;
1415
import org.lwjgl.glfw.GLFW;
1516
import org.vivecraft.client_vr.ClientDataHolderVR;
@@ -31,15 +32,15 @@ public abstract class GuiVROptionsBase extends Screen {
3132
private Button btnDefaults;
3233

3334
public GuiVROptionsBase(Screen lastScreen) {
34-
super(Component.literal(""));
35+
super(new TextComponent(""));
3536
this.lastScreen = lastScreen;
3637
this.vrSettings = ClientDataHolderVR.getInstance().vrSettings;
3738
}
3839

3940
protected void addDefaultButtons() {
4041
this.addRenderableWidget(
4142
this.btnDone = new Button(this.width / 2 + 5, this.height - 30, 150, 20,
42-
Component.translatable("gui.back"), (p) -> {
43+
new TranslatableComponent("gui.back"), (p) -> {
4344
if (!this.onDoneClicked()) {
4445
this.dataHolder.vrSettings.saveOptions();
4546
this.minecraft.setScreen(this.lastScreen);
@@ -48,7 +49,7 @@ protected void addDefaultButtons() {
4849

4950
this.addRenderableWidget(
5051
this.btnDefaults = new Button(this.width / 2 - 155, this.height - 30, 150, 20,
51-
Component.translatable("vivecraft.gui.loaddefaults"), (p) -> {
52+
new TranslatableComponent("vivecraft.gui.loaddefaults"), (p) -> {
5253
this.loadDefaults();
5354
this.dataHolder.vrSettings.saveOptions();
5455
this.reinit = true;
@@ -94,7 +95,7 @@ public void onClick(double mouseX, double mouseY) {
9495
!layout.getCustomHandler().apply((GuiVROptionButton) p, new Vec2(0.0F, 0.0F)))
9596
{
9697
this.vrSettings.setOptionValue(((GuiVROptionButton) p).getOption());
97-
p.setMessage(Component.literal(layout.getButtonText()));
98+
p.setMessage(new TextComponent(layout.getButtonText()));
9899
}
99100
}));
100101
} else if (layout.getScreen() != null) {
@@ -217,7 +218,7 @@ public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTic
217218

218219
super.render(poseStack, mouseX, mouseY, partialTick);
219220

220-
drawCenteredString(poseStack, this.font, Component.translatable(this.vrTitle), this.width / 2, 15, 0xFFFFFF);
221+
drawCenteredString(poseStack, this.font, new TranslatableComponent(this.vrTitle), this.width / 2, 15, 0xFFFFFF);
221222

222223
if (this.btnDefaults != null) {
223224
this.btnDefaults.visible = this.drawDefaultButtons;
@@ -347,10 +348,10 @@ private void renderTooltip(PoseStack poseStack, int mouseX, int mouseY) {
347348
if (guiHover.getY() + guiHover.getHeight() + formattedText.size() * (this.font.lineHeight + 1) +
348349
14 < this.height)
349350
{
350-
renderTooltip(poseStack, this.font.split(Component.literal(tooltip), 308),
351+
renderTooltip(poseStack, this.font.split(new TextComponent(tooltip), 308),
351352
this.width / 2 - 166, guiHover.getY() + guiHover.getHeight() + 14);
352353
} else {
353-
renderTooltip(poseStack, this.font.split(Component.literal(tooltip), 308),
354+
renderTooltip(poseStack, this.font.split(new TextComponent(tooltip), 308),
354355
this.width / 2 - 166,
355356
guiHover.getY() - formattedText.size() * (this.font.lineHeight + 1) + 9);
356357
}

common/src/main/java/org/vivecraft/client/gui/framework/TwoHandedScreen.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import net.minecraft.client.gui.components.AbstractWidget;
55
import net.minecraft.client.gui.components.Button;
66
import net.minecraft.client.gui.screens.Screen;
7-
import net.minecraft.network.chat.Component;
7+
import net.minecraft.network.chat.TextComponent;
88
import org.joml.Matrix4f;
99
import org.joml.Vector2f;
1010
import org.joml.Vector3f;
@@ -25,7 +25,7 @@ public abstract class TwoHandedScreen extends Screen {
2525
protected boolean reinit;
2626

2727
protected TwoHandedScreen() {
28-
super(Component.literal(""));
28+
super(new TextComponent(""));
2929
}
3030

3131
@Override

common/src/main/java/org/vivecraft/client/gui/screens/BlockedServerScreen.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import net.minecraft.client.gui.components.Button;
66
import net.minecraft.client.gui.components.MultiLineLabel;
77
import net.minecraft.client.gui.screens.Screen;
8-
import net.minecraft.network.chat.Component;
8+
import net.minecraft.network.chat.TranslatableComponent;
99

1010
public class BlockedServerScreen extends Screen {
1111

@@ -15,7 +15,7 @@ public class BlockedServerScreen extends Screen {
1515
private MultiLineLabel message;
1616

1717
public BlockedServerScreen(Screen lastScreen, String server, Runnable onContinue) {
18-
super(Component.translatable("vivecraft.messages.blocklist.title"));
18+
super(new TranslatableComponent("vivecraft.messages.blocklist.title"));
1919
this.lastScreen = lastScreen;
2020
this.server = server;
2121
this.onContinue = onContinue;
@@ -24,13 +24,13 @@ public BlockedServerScreen(Screen lastScreen, String server, Runnable onContinue
2424
protected void init() {
2525

2626
this.addRenderableWidget(new Button(this.width / 2 + 5, this.height - 32, 150, 20,
27-
Component.translatable("gui.back"), (p) ->
27+
new TranslatableComponent("gui.back"), (p) ->
2828
Minecraft.getInstance().setScreen(this.lastScreen)));
2929
this.addRenderableWidget(
3030
new Button(this.width / 2 - 155, this.height - 32, 150, 20,
31-
Component.translatable("vivecraft.gui.continueWithout"), p -> this.onContinue.run()));
31+
new TranslatableComponent("vivecraft.gui.continueWithout"), p -> this.onContinue.run()));
3232
this.message = MultiLineLabel.create(this.font,
33-
Component.translatable("vivecraft.messages.blocklist", this.server), 360);
33+
new TranslatableComponent("vivecraft.messages.blocklist", this.server), 360);
3434
}
3535

3636
@Override

common/src/main/java/org/vivecraft/client/gui/screens/ErrorScreen.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import net.minecraft.client.gui.screens.Screen;
77
import net.minecraft.network.chat.Component;
88
import net.minecraft.network.chat.Style;
9+
import net.minecraft.network.chat.TranslatableComponent;
910
import org.jetbrains.annotations.NotNull;
1011
import org.vivecraft.client.gui.widgets.TextScrollWidget;
1112

@@ -29,11 +30,11 @@ protected void init() {
2930

3031
this.addRenderableWidget(
3132
new Button(this.width / 2 + 5, this.height - 32, 150, 20,
32-
Component.translatable("gui.back"),
33+
new TranslatableComponent("gui.back"),
3334
(p) -> Minecraft.getInstance().setScreen(this.lastScreen)));
3435
this.addRenderableWidget(
3536
new Button(this.width / 2 - 155, this.height - 32, 150, 20,
36-
Component.translatable("chat.copy.click"),
37+
new TranslatableComponent("chat.copy.click"),
3738
(p) -> Minecraft.getInstance().keyboardHandler.setClipboard(
3839
this.title.getString() + "\n" + this.error.getString())));
3940
}

0 commit comments

Comments
 (0)