Skip to content

Commit

Permalink
backport to 1.18.2
Browse files Browse the repository at this point in the history
  • Loading branch information
fayer3 committed Aug 5, 2023
1 parent a0e9b3e commit 3105661
Show file tree
Hide file tree
Showing 88 changed files with 712 additions and 550 deletions.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ subprojects {
mappings loom.officialMojangMappings()
// The following line declares the yarn mappings you may select this one as well.
// mappings "net.fabricmc:yarn:1.18.2+build.4:v2"
implementation("org.lwjgl:lwjgl-openvr:3.3.1")
implementation("org.lwjgl:lwjgl-openvr:3.3.1:natives-linux")
implementation("org.lwjgl:lwjgl-openvr:3.3.1:natives-macos")
implementation("org.lwjgl:lwjgl-openvr:3.3.1:natives-windows")
implementation("org.lwjgl:lwjgl-openvr:3.2.2")
implementation("org.lwjgl:lwjgl-openvr:3.2.2:natives-linux")
implementation("org.lwjgl:lwjgl-openvr:3.2.2:natives-macos")
implementation("org.lwjgl:lwjgl-openvr:3.2.2:natives-windows")
}

tasks.withType(JavaCompile) {
Expand Down
19 changes: 10 additions & 9 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,33 @@ dependencies {
modApi("dev.architectury:architectury-fabric:${rootProject.architectury_version}")

// for sodium compat
modCompileOnly "maven.modrinth:sodium:mc1.19.2-0.4.4"
modCompileOnly "maven.modrinth:sodium:mc1.18.2-0.4.1"
modCompileOnly "maven.modrinth:sodium:mc1.19.3-0.4.9"
modCompileOnly "883067831485366304:1076634925077364786:sodium-fabric-mc1.19.3-0.4.10rev.c131708-dirty:jar"
modCompileOnly("maven.modrinth:rubidium:0.6.1")
modCompileOnly "maven.modrinth:rubidium:0.5.6"


// for iris compat
modCompileOnly "maven.modrinth:iris:1.5.2+1.19.2"
modCompileOnly "maven.modrinth:iris:1.5.2+1.18.2"

// for REI compat
modCompileOnly "me.shedaniel:RoughlyEnoughItems-fabric:9.1.619"
modCompileOnly "me.shedaniel:RoughlyEnoughItems-fabric:8.3.618"

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

// other mods
// modCompileOnly("com.simibubi.create:create-fabric-1.19.2:0.5.0.i-969+1.19.2")
modCompileOnly "maven.modrinth:lithium:mc1.19.2-0.11.1"
modCompileOnly "maven.modrinth:indium:1.0.9+mc1.19.2"
// modCompileOnly("com.simibubi.create:create-fabric-1.18.2:0.5.0.i-1016+1.18.2")
modCompileOnly "maven.modrinth:lithium:mc1.18.2-0.10.3"
modCompileOnly "maven.modrinth:indium:1.0.7+mc1.18.2"

/*
// for immersive portals compat
modCompileOnly ('com.github.qouteall.ImmersivePortalsMod:imm_ptl_core:v2.3.2-mc1.19.2'){ //temp immersiveportals
modCompileOnly ('com.github.qouteall.ImmersivePortalsMod:imm_ptl_core:v1.4.11-1.18'){ //temp immersiveportals
exclude(group: "net.fabricmc.fabric-api")
transitive(false)
}
modCompileOnly ('com.github.qouteall.ImmersivePortalsMod:q_misc_util:v2.3.2-mc1.19.2'){ //temp immersiveportals
modCompileOnly ('com.github.qouteall.ImmersivePortalsMod:q_misc_util:v1.4.11-1.18'){ //temp immersiveportals
exclude(group: "net.fabricmc.fabric-api")
transitive(false)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.vivecraft.client_vr.settings.VRSettings;

import net.minecraft.client.gui.components.Button;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;

public class GuiVROptionButton extends Button implements GuiVROption
{
Expand All @@ -26,7 +26,7 @@ public GuiVROptionButton(int id, int x, int y, @Nullable VRSettings.VrOptions op

public GuiVROptionButton(int id, int x, int y, int width, int height, @Nullable VRSettings.VrOptions option, String text, OnPress action)
{
super(x, y, width, height, Component.translatable(text), action);
super(x, y, width, height, new TranslatableComponent(text), action);
this.id = id;
this.enumOptions = option;
ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package org.vivecraft.client.gui.framework;

import net.minecraft.client.gui.components.AbstractSliderButton;
import net.minecraft.network.chat.TextComponent;
import org.vivecraft.client_vr.ClientDataHolderVR;
import org.vivecraft.client_vr.settings.VRSettings;

import net.minecraft.network.chat.Component;

import javax.annotation.Nullable;

public class GuiVROptionSlider extends AbstractSliderButton implements GuiVROption
Expand All @@ -17,7 +16,7 @@ public class GuiVROptionSlider extends AbstractSliderButton implements GuiVROpti
public GuiVROptionSlider(int id, int x, int y, int width, int height, VRSettings.VrOptions option)
{
super(x, y, width, height,
Component.literal(ClientDataHolderVR.getInstance().vrSettings.getButtonDisplayString(option)),
new TextComponent(ClientDataHolderVR.getInstance().vrSettings.getButtonDisplayString(option)),
option.normalizeValue(ClientDataHolderVR.getInstance().vrSettings.getOptionFloatValue(option)));

this.id = id;
Expand All @@ -31,7 +30,7 @@ public GuiVROptionSlider(int id, int x, int y, VRSettings.VrOptions option)

@Override
protected void updateMessage() {
this.setMessage(Component.literal(ClientDataHolderVR.getInstance().vrSettings.getButtonDisplayString(this.enumOptions)));
this.setMessage(new TextComponent(ClientDataHolderVR.getInstance().vrSettings.getButtonDisplayString(this.enumOptions)));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
import net.minecraft.client.gui.components.events.GuiEventListener;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.FormattedText;
import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.phys.Vec2;
import org.vivecraft.client_vr.ClientDataHolderVR;
import org.vivecraft.client_vr.ScreenUtils;
Expand All @@ -36,22 +37,22 @@ public abstract class GuiVROptionsBase extends Screen

public GuiVROptionsBase(Screen lastScreen)
{
super(Component.literal(""));
super(new TextComponent(""));
this.lastScreen = lastScreen;
this.settings = ClientDataHolderVR.getInstance().vrSettings;
}

protected void addDefaultButtons()
{
this.addRenderableWidget(this.btnDone = new Button(this.width / 2 + 5, this.height - 30, 150, 20, Component.translatable("gui.back"), (p) ->
this.addRenderableWidget(this.btnDone = new Button(this.width / 2 + 5, this.height - 30, 150, 20, new TranslatableComponent("gui.back"), (p) ->
{
if (!this.onDoneClicked())
{
this.dataholder.vrSettings.saveOptions();
this.minecraft.setScreen(this.lastScreen);
}
}));
this.addRenderableWidget(this.btnDefaults = new Button(this.width / 2 - 155, this.height - 30, 150, 20, Component.translatable("vivecraft.gui.loaddefaults"), (p) ->
this.addRenderableWidget(this.btnDefaults = new Button(this.width / 2 - 155, this.height - 30, 150, 20, new TranslatableComponent("vivecraft.gui.loaddefaults"), (p) ->
{
this.loadDefaults();
this.dataholder.vrSettings.saveOptions();
Expand Down Expand Up @@ -95,7 +96,7 @@ else if (vroptionlayout.getOption() != null)
if (vroptionlayout.getCustomHandler() == null || !vroptionlayout.getCustomHandler().apply((GuiVROptionButton)p, new Vec2(0.0F, 0.0F)))
{
this.settings.setOptionValue(((GuiVROptionButton)p).getOption());
p.setMessage(Component.literal(vroptionlayout.getButtonText()));
p.setMessage(new TextComponent(vroptionlayout.getButtonText()));
}
}));
}
Expand Down Expand Up @@ -224,7 +225,7 @@ public void render(PoseStack pMatrixStack, int pMouseX, int pMouseY, float pPart
this.visibleList.render(pMatrixStack, pMouseX, pMouseY, pPartialTicks);
}

drawCenteredString(pMatrixStack, this.font, Component.translatable(this.vrTitle), this.width / 2, 15, 16777215);
drawCenteredString(pMatrixStack, this.font, new TranslatableComponent(this.vrTitle), this.width / 2, 15, 16777215);

if (this.btnDefaults != null)
{
Expand Down Expand Up @@ -339,9 +340,9 @@ private void renderTooltip(PoseStack pMatrixStack, int pMouseX, int pMouseY) {

// if tooltip is not too low, draw below button, else above
if (guiHover.getY() + guiHover.getHeight() + formattedText.size() * (font.lineHeight + 1) + 14 < this.height) {
renderTooltip(pMatrixStack, font.split(Component.literal(tooltip), 308), this.width / 2 - 166, guiHover.getY() + guiHover.getHeight() + 14);
renderTooltip(pMatrixStack, font.split(new TextComponent(tooltip), 308), this.width / 2 - 166, guiHover.getY() + guiHover.getHeight() + 14);
} else {
renderTooltip(pMatrixStack, font.split(Component.literal(tooltip), 308), this.width / 2 - 166, guiHover.getY() - formattedText.size() * (font.lineHeight + 1) + 9);
renderTooltip(pMatrixStack, font.split(new TextComponent(tooltip), 308), this.width / 2 - 166, guiHover.getY() - formattedText.size() * (font.lineHeight + 1) + 9);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//import net.minecraft.client.gui.screens.Screen;
//import net.minecraft.network.chat.FormattedText;
//import net.minecraft.network.chat.Style;
//import net.minecraft.network.chat.Component;
//import net.minecraft.network.chat.TextComponent;
//import net.optifine.Lang;
//import net.optifine.gui.TooltipProvider;
//import org.vivecraft.settings.VRSettings;
Expand Down Expand Up @@ -75,8 +75,8 @@
// else
// {
// int i = s2.indexOf(s2.trim().charAt(0));
// TextComponent textcomponent = i > 0 ? Component.literal(String.join("", Collections.nCopies(i, " "))) : null;
// List<FormattedText> list1 = Utils.wrapText(Component.literal(s2), width, Minecraft.getInstance().font, textcomponent);
// TextComponent textcomponent = i > 0 ? new TextComponent(String.join("", Collections.nCopies(i, " "))) : null;
// List<FormattedText> list1 = Utils.wrapText(new TextComponent(s2), width, Minecraft.getInstance().font, textcomponent);
// Style style = Style.EMPTY;
//
// for (FormattedText formattedtext : list1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;

public abstract class TwoHandedScreen extends Screen
{
Expand All @@ -25,7 +25,7 @@ public abstract class TwoHandedScreen extends Screen

protected TwoHandedScreen()
{
super(Component.literal(""));
super(new TextComponent(""));
}

public boolean mouseClicked(double pMouseX, double p_94738_, int pMouseY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import org.jetbrains.annotations.NotNull;
import org.vivecraft.client.gui.widgets.TextScrollWidget;

Expand All @@ -15,7 +17,7 @@ public class ErrorScreen extends Screen {
private final Component error;

public ErrorScreen(String title, Component error) {
super(Component.literal(title));
super(new TextComponent(title));
lastScreen = Minecraft.getInstance().screen;
this.error = error;
}
Expand All @@ -27,12 +29,12 @@ protected void init() {
this.addRenderableWidget(new Button(
this.width / 2 + 5, this.height - 32,
150, 20,
Component.translatable("gui.back"),
new TranslatableComponent("gui.back"),
(p) -> Minecraft.getInstance().setScreen(this.lastScreen)));
this.addRenderableWidget(new Button(
this.width / 2 - 155, this.height - 32,
150, 20,
Component.translatable("chat.copy"),
new TranslatableComponent("chat.copy"),
(p) -> Minecraft.getInstance().keyboardHandler.setClipboard(error.getString())));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import org.jetbrains.annotations.NotNull;
import org.vivecraft.client.gui.widgets.TextScrollWidget;
import org.vivecraft.client.utils.UpdateChecker;
Expand All @@ -19,7 +20,7 @@ public class UpdateScreen extends Screen {
private final Screen lastScreen;

public UpdateScreen() {
super(Component.literal("New Update Available"));
super(new TextComponent("New Update Available"));
lastScreen = Minecraft.getInstance().screen;
}

Expand All @@ -30,7 +31,7 @@ protected void init() {
this.addRenderableWidget(new Button(
this.width / 2 - 155, this.height - 56,
150, 20,
Component.literal("Download from Modrinth"),
new TextComponent("Download from Modrinth"),
(p) -> {
try {
Util.getPlatform().openUri(new URI("https://modrinth.com/mod/vivecraft"));
Expand All @@ -41,7 +42,7 @@ protected void init() {
this.addRenderableWidget(new Button(
this.width / 2 + 5, this.height - 56,
150, 20,
Component.literal("Download from Curseforge"),
new TextComponent("Download from Curseforge"),
(p) -> {
try {
Util.getPlatform().openUri(new URI("https://www.curseforge.com/minecraft/mc-mods/vivecraft"));
Expand All @@ -52,7 +53,7 @@ protected void init() {
this.addRenderableWidget(new Button(
this.width / 2 - 75, this.height - 32,
150, 20,
Component.translatable("gui.back"),
new TranslatableComponent("gui.back"),
(p) -> Minecraft.getInstance().setScreen(this.lastScreen)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import net.minecraft.client.KeyMapping;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;

public class GuiQuickCommandsInGame extends Screen
{
Expand All @@ -18,7 +19,7 @@ public class GuiQuickCommandsInGame extends Screen

public GuiQuickCommandsInGame(Screen parent)
{
super(Component.literal(""));
super(new TextComponent(""));
this.parentScreen = parent;
}

Expand All @@ -36,18 +37,14 @@ public void init()
{
i = j > 5 ? 1 : 0;
String s = astring[j];
this.addRenderableWidget(new Button(this.width / 2 - 125 + 127 * i, 36 + (j - 6 * i) * 24, 125, 20, Component.translatable(s.toString()), (p) ->
this.addRenderableWidget(new Button(this.width / 2 - 125 + 127 * i, 36 + (j - 6 * i) * 24, 125, 20, new TranslatableComponent(s.toString()), (p) ->
{
this.minecraft.setScreen((Screen)null);
if (p.getMessage().getString().startsWith("/")) {
this.minecraft.player.commandSigned(p.getMessage().getString().substring(1), Component.empty());
} else {
this.minecraft.player.chatSigned(p.getMessage().getString(), Component.empty());
}
this.minecraft.player.chat(p.getMessage().getString());
}));
}

this.addRenderableWidget(new Button(this.width / 2 - 50, this.height - 30 + b0, 100, 20, Component.translatable("Cancel"), (p) ->
this.addRenderableWidget(new Button(this.width / 2 - 50, this.height - 30 + b0, 100, 20, new TranslatableComponent("Cancel"), (p) ->
{
this.minecraft.setScreen(this.parentScreen);
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import net.minecraft.client.Minecraft;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;

public class GuiQuickCommandsList extends ObjectSelectionList<GuiQuickCommandsList.CommandEntry>
{
Expand All @@ -23,17 +24,15 @@ public GuiQuickCommandsList(GuiQuickCommandEditor parent, Minecraft mc)
String s = null;
int i = 0;

setRenderSelection(false);

for (String s1 : astring)
{
this.minecraft.font.width(s1);
this.addEntry(new CommandEntry(s1, this));
}
}

@Override
protected void renderSelection(PoseStack poseStack, int i, int j, int k, int l, int m) {
}

@Override
public boolean mouseClicked(double d, double e, int i) {
GuiEventListener focused = this.getFocused();
Expand All @@ -50,9 +49,9 @@ public class CommandEntry extends Entry<CommandEntry>

private CommandEntry(String command, GuiQuickCommandsList parent)
{
this.txt = new EditBox(GuiQuickCommandsList.this.minecraft.font, parent.width / 2 - 100, 60, 200, 20, Component.literal(""));
this.txt = new EditBox(GuiQuickCommandsList.this.minecraft.font, parent.width / 2 - 100, 60, 200, 20, new TextComponent(""));
this.txt.setValue(command);
this.btnDelete = new Button(0, 0, 18, 18, Component.literal("X"), (p) ->
this.btnDelete = new Button(0, 0, 18, 18, new TextComponent("X"), (p) ->
{
this.txt.setValue("");
this.txt.changeFocus(true);
Expand Down
Loading

0 comments on commit 3105661

Please sign in to comment.