Skip to content

Commit

Permalink
backport to 1.19.2
Browse files Browse the repository at this point in the history
  • Loading branch information
fayer3 committed Aug 5, 2023
1 parent d4bec67 commit a0e9b3e
Show file tree
Hide file tree
Showing 89 changed files with 731 additions and 866 deletions.
15 changes: 8 additions & 7 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,32 @@ 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.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.3")
modCompileOnly("maven.modrinth:rubidium:0.6.1")

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

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

// 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.3-0.11.1"
modCompileOnly "maven.modrinth:indium:1.0.14+mc1.19.3"
modCompileOnly "maven.modrinth:lithium:mc1.19.2-0.11.1"
modCompileOnly "maven.modrinth:indium:1.0.9+mc1.19.2"

/*
// for immersive portals compat
modCompileOnly ('com.github.qouteall.ImmersivePortalsMod:imm_ptl_core:v2.5.2-mc1.19.3'){ //temp immersiveportals
modCompileOnly ('com.github.qouteall.ImmersivePortalsMod:imm_ptl_core:v2.3.2-mc1.19.2'){ //temp immersiveportals
exclude(group: "net.fabricmc.fabric-api")
transitive(false)
}
modCompileOnly ('com.github.qouteall.ImmersivePortalsMod:q_misc_util:v2.5.2-mc1.19.3'){ //temp immersiveportals
modCompileOnly ('com.github.qouteall.ImmersivePortalsMod:q_misc_util:v2.3.2-mc1.19.2'){ //temp immersiveportals
exclude(group: "net.fabricmc.fabric-api")
transitive(false)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ public interface GuiVROption {
// implement those with a cast to Abstract widget, since pre 1.19.4 those methods are there
default int getY() {
if (this instanceof AbstractWidget widget) {
return widget.getY();
return widget.y;
}
return 0;
}
default int getX() {
if (this instanceof AbstractWidget widget) {
return widget.getX();
return widget.x;
}
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, Button.DEFAULT_NARRATION);
super(x, y, width, height, Component.translatable(text), action);
this.id = id;
this.enumOptions = option;
ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,20 @@ public GuiVROptionsBase(Screen lastScreen)

protected void addDefaultButtons()
{
this.addRenderableWidget(this.btnDone = new Button.Builder(Component.translatable("gui.back"), (p) ->
{
if (!this.onDoneClicked())
{
this.dataholder.vrSettings.saveOptions();
this.minecraft.setScreen(this.lastScreen);
}
})
.pos(this.width / 2 + 5, this.height - 30)
.size(150, 20)
.build());
this.addRenderableWidget(this.btnDefaults = new Button.Builder(Component.translatable("vivecraft.gui.loaddefaults"), (p) ->
{
this.loadDefaults();
this.dataholder.vrSettings.saveOptions();
this.reinit = true;
})
.pos(this.width / 2 - 155, this.height - 30)
.size(150, 20)
.build());
this.addRenderableWidget(this.btnDone = new Button(this.width / 2 + 5, this.height - 30, 150, 20, Component.translatable("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.loadDefaults();
this.dataholder.vrSettings.saveOptions();
this.reinit = true;
}));
}

protected boolean onDoneClicked()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ public void render(PoseStack pMatrixStack, int pMouseX, int pMouseY, float pPart
for (int i = 0; i < this.children().size(); ++i)
{
AbstractWidget abstractwidget2 = (AbstractWidget) this.children().get(i);
boolean flag = d0 >= (double)abstractwidget2.getX() && d1 >= (double)abstractwidget2.getY() && d0 < (double)(abstractwidget2.getX() + abstractwidget2.getWidth()) && d1 < (double)(abstractwidget2.getY() + 20);
boolean flag1 = d2 >= (double)abstractwidget2.getX() && d3 >= (double)abstractwidget2.getY() && d2 < (double)(abstractwidget2.getX() + abstractwidget2.getWidth()) && d3 < (double)(abstractwidget2.getY() + 20);
boolean flag = d0 >= (double)abstractwidget2.x && d1 >= (double)abstractwidget2.y && d0 < (double)(abstractwidget2.x + abstractwidget2.getWidth()) && d1 < (double)(abstractwidget2.y + 20);
boolean flag1 = d2 >= (double)abstractwidget2.x && d3 >= (double)abstractwidget2.y && d2 < (double)(abstractwidget2.x + abstractwidget2.getWidth()) && d3 < (double)(abstractwidget2.y + 20);

if (flag)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ protected void init() {

this.addRenderableWidget(new TextScrollWidget(this.width / 2 - 155, 30, 310, this.height - 30 - 36, error));

this.addRenderableWidget(new Button.Builder(Component.translatable("gui.back"), (p) ->
Minecraft.getInstance().setScreen(this.lastScreen))
.pos(this.width / 2 + 5, this.height - 32)
.size(150, 20)
.build());
this.addRenderableWidget(new Button.Builder(Component.translatable("chat.copy"), (p) ->
Minecraft.getInstance().keyboardHandler.setClipboard(error.getString()))
.pos(this.width / 2 - 155, this.height - 32)
.size(150, 20)
.build());
this.addRenderableWidget(new Button(
this.width / 2 + 5, this.height - 32,
150, 20,
Component.translatable("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"),
(p) -> Minecraft.getInstance().keyboardHandler.setClipboard(error.getString())));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,33 @@ protected void init() {

this.addRenderableWidget(new TextScrollWidget(this.width / 2 - 155, 30, 310, this.height - 30 - 60, UpdateChecker.changelog));

this.addRenderableWidget(new Button.Builder(Component.literal("Download from Modrinth"), (p) -> {
try {
Util.getPlatform().openUri(new URI("https://modrinth.com/mod/vivecraft"));
} catch (URISyntaxException ignored) {
}
})
.pos(this.width / 2 - 155, this.height - 56)
.size(150, 20)
.build());
this.addRenderableWidget(new Button(
this.width / 2 - 155, this.height - 56,
150, 20,
Component.literal("Download from Modrinth"),
(p) -> {
try {
Util.getPlatform().openUri(new URI("https://modrinth.com/mod/vivecraft"));
} catch (URISyntaxException ignored) {
}
}));

this.addRenderableWidget(new Button.Builder(Component.literal("Download from Curseforge"), (p) -> {
try {
Util.getPlatform().openUri(new URI("https://www.curseforge.com/minecraft/mc-mods/vivecraft"));
} catch (URISyntaxException ignored) {
}
})
.pos(this.width / 2 + 5, this.height - 56)
.size(150, 20)
.build());
this.addRenderableWidget(new Button(
this.width / 2 + 5, this.height - 56,
150, 20,
Component.literal("Download from Curseforge"),
(p) -> {
try {
Util.getPlatform().openUri(new URI("https://www.curseforge.com/minecraft/mc-mods/vivecraft"));
} catch (URISyntaxException ignored) {
}
}));

this.addRenderableWidget(new Button.Builder(Component.translatable("gui.back"), (p) ->
Minecraft.getInstance().setScreen(this.lastScreen))
.pos(this.width / 2 - 75, this.height - 32)
.size(150, 20)
.build());
this.addRenderableWidget(new Button(
this.width / 2 - 75, this.height - 32,
150, 20,
Component.translatable("gui.back"),
(p) -> Minecraft.getInstance().setScreen(this.lastScreen)));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,21 @@ public void init()
{
i = j > 5 ? 1 : 0;
String s = astring[j];
this.addRenderableWidget(new Button.Builder( Component.translatable(s.toString()), (p) ->
{
this.minecraft.setScreen((Screen)null);
if (p.getMessage().getString().startsWith("/")) {
this.minecraft.player.connection.sendCommand(p.getMessage().getString().substring(1));
} else {
this.minecraft.player.connection.sendChat(p.getMessage().getString());
}
})
.size( 125, 20)
.pos(this.width / 2 - 125 + 127 * i, 36 + (j - 6 * i) * 24)
.build());
this.addRenderableWidget(new Button(this.width / 2 - 125 + 127 * i, 36 + (j - 6 * i) * 24, 125, 20, Component.translatable(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.addRenderableWidget(new Button.Builder( Component.translatable("Cancel"), (p) ->
{
this.minecraft.setScreen(this.parentScreen);
})
.size( 100, 20)
.pos(this.width / 2 - 50, this.height - 30 + b0)
.build());
this.addRenderableWidget(new Button(this.width / 2 - 50, this.height - 30 + b0, 100, 20, Component.translatable("Cancel"), (p) ->
{
this.minecraft.setScreen(this.parentScreen);
}));
}

public void render(PoseStack pMatrixStack, int pMouseX, int pMouseY, float pPartialTicks)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,11 @@ 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.setValue(command);
this.btnDelete = new Button.Builder( Component.literal("X"), (p) ->
{
this.txt.setValue("");
this.txt.changeFocus(true);
})
.size( 18, 18)
.pos(0, 0)
.build();
this.btnDelete = new Button(0, 0, 18, 18, Component.literal("X"), (p) ->
{
this.txt.setValue("");
this.txt.changeFocus(true);
});
}

@Override
Expand Down Expand Up @@ -128,11 +125,11 @@ public boolean keyPressed(int pKeyCode, int pScanCode, int pModifiers)

public void render(PoseStack pMatrixStack, int pIndex, int pTop, int pLeft, int pWidth, int pHeight, int pMouseX, int pMouseY, boolean pIsMouseOver, float pPartialTicks)
{
this.txt.setX(pLeft);
this.txt.setY(pTop);
this.txt.x = pLeft;
this.txt.y = pTop;
this.txt.render(pMatrixStack, pMouseX, pMouseY, pPartialTicks);
this.btnDelete.setX(this.txt.getX() + this.txt.getWidth() + 2);
this.btnDelete.setY(this.txt.getY());
this.btnDelete.x = this.txt.x + this.txt.getWidth() + 2;
this.btnDelete.y = this.txt.y;
this.btnDelete.visible = true;
this.btnDelete.render(pMatrixStack, pMouseX, pMouseY, pPartialTicks);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,46 +65,34 @@ public void init()

if (this.isselectmode)
{
this.addRenderableWidget(new Button.Builder( Component.translatable("gui.cancel"), (p) ->
{
this.isselectmode = false;
this.reinit = true;
this.visibleList = null;
})
.size( 150, 20)
.pos(this.width / 2 - 155, this.height - 25)
.build());
this.addRenderableWidget(new Button.Builder( Component.translatable("vivecraft.gui.clear"), (p) ->
{
this.setKey((KeyMapping)null);
})
.size( 150, 20)
.pos(this.width / 2 - 155, 25)
.build());
this.addRenderableWidget(new Button(this.width / 2 - 155, this.height - 25, 150, 20, Component.translatable("gui.cancel"), (p) ->
{
this.isselectmode = false;
this.reinit = true;
this.visibleList = null;
}));
this.addRenderableWidget(new Button(this.width / 2 - 155, 25, 150, 20, Component.translatable("vivecraft.gui.clear"), (p) ->
{
this.setKey((KeyMapping)null);
}));
}
else
{
if (this.isShift)
{
this.addRenderableWidget(new Button.Builder( Component.translatable("vivecraft.gui.radialmenu.mainset"), (p) ->
{
this.isShift = !this.isShift;
this.reinit = true;
})
.size( 150, 20)
.pos(this.width / 2 + 2, 30)
.build());
this.addRenderableWidget(new Button(this.width / 2 + 2, 30, 150, 20, Component.translatable("vivecraft.gui.radialmenu.mainset"), (p) ->
{
this.isShift = !this.isShift;
this.reinit = true;
}));
}
else
{
this.addRenderableWidget(new Button.Builder( Component.translatable("vivecraft.gui.radialmenu.alternateset"), (p) ->
{
this.isShift = !this.isShift;
this.reinit = true;
})
.size( 150, 20)
.pos(this.width / 2 + 2, 30)
.build());
this.addRenderableWidget(new Button(this.width / 2 + 2, 30, 150, 20, Component.translatable("vivecraft.gui.radialmenu.alternateset"), (p) ->
{
this.isShift = !this.isShift;
this.reinit = true;
}));
}

super.init(options, false);
Expand Down Expand Up @@ -187,16 +175,13 @@ else if (k1 == 7)
}

int l1 = k1;
this.addRenderableWidget(new Button.Builder( Component.translatable(s), (p) ->
{
this.selectedIndex = l1;
this.isselectmode = true;
this.reinit = true;
this.visibleList = this.list;
})
.size( i2, 20)
.pos(i1 + j2 - i2 / 2, j1 + k2)
.build());
this.addRenderableWidget(new Button(i1 + j2 - i2 / 2, j1 + k2, i2, 20, Component.translatable(s), (p) ->
{
this.selectedIndex = l1;
this.isselectmode = true;
this.reinit = true;
this.visibleList = this.list;
}));
super.addDefaultButtons();
}
}
Expand Down
Loading

0 comments on commit a0e9b3e

Please sign in to comment.