Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/Multiloader-1.19' into M…
Browse files Browse the repository at this point in the history
…ultiloader-1.18
  • Loading branch information
fayer3 committed Sep 15, 2024
2 parents 04c558a + 34b3d04 commit d87d626
Show file tree
Hide file tree
Showing 42 changed files with 3,232 additions and 323 deletions.
2 changes: 2 additions & 0 deletions common/src/main/java/org/vivecraft/client/VivecraftVRMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class VivecraftVRMod {
public final KeyMapping keyQuickTorch = new KeyMapping("vivecraft.key.quickTorch", -1, "key.categories.gameplay");
public final KeyMapping keyRadialMenu = new KeyMapping("vivecraft.key.radialMenu", -1, "key.categories.ui");
public final KeyMapping keyRotateAxis = new KeyMapping("vivecraft.key.rotateAxis", -1, "key.categories.movement");
public final KeyMapping keyFlickStick = new KeyMapping("vivecraft.key.flickStick", -1, "key.categories.movement");
public final KeyMapping keyRotateFree = new KeyMapping("vivecraft.key.rotateFree", -1, "key.categories.movement");
public final KeyMapping keyRotateLeft = new KeyMapping("vivecraft.key.rotateLeft", -1, "key.categories.movement");
public final KeyMapping keyRotateRight = new KeyMapping("vivecraft.key.rotateRight", -1, "key.categories.movement");
Expand Down Expand Up @@ -119,6 +120,7 @@ private void setupKeybindingSets() {
this.hiddenKeyBindingSet.add(this.keyTrackpadTouch);

this.hiddenKeyBindingSet.add(this.keyRotateAxis);
this.hiddenKeyBindingSet.add(this.keyFlickStick);
this.hiddenKeyBindingSet.add(this.keyRotateFree);
this.hiddenKeyBindingSet.add(this.keyFreeMoveRotate);
this.hiddenKeyBindingSet.add(this.keyFreeMoveStrafe);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected void actionPerformed(AbstractWidget widget) {
}
if ((button.getId() == VRSettings.VrOptions.DOUBLE_GUI_RESOLUTION.ordinal()
|| button.getId() == VRSettings.VrOptions.GUI_SCALE.ordinal())
&& VRState.vrEnabled) {
&& VRState.vrInitialized) {
this.dataholder.vrRenderer.resizeFrameBuffers("GUI Setting Changed");
this.reinit = true;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package org.vivecraft.client.gui.settings;

import com.mojang.blaze3d.vertex.PoseStack;
import org.vivecraft.client.gui.framework.GuiVROption;
import org.vivecraft.client.gui.framework.GuiVROptionsBase;
import org.vivecraft.client_vr.VRState;
import org.vivecraft.client_vr.settings.VRSettings;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.screens.Screen;

public class GuiMixedRealitySettings extends GuiVROptionsBase {
static VRSettings.VrOptions[] MROptions = new VRSettings.VrOptions[]{
VRSettings.VrOptions.MIXED_REALITY_UNITY_LIKE,
VRSettings.VrOptions.MIXED_REALITY_RENDER_HANDS,
VRSettings.VrOptions.MIXED_REALITY_ALPHA_MASK,
VRSettings.VrOptions.MIXED_REALITY_KEY_COLOR,
VRSettings.VrOptions.MIXED_REALITY_FOV,
VRSettings.VrOptions.MIXED_REALITY_RENDER_CAMERA_MODEL,
VRSettings.VrOptions.MIXED_REALITY_UNDISTORTED,
VRSettings.VrOptions.MIRROR_EYE,
VRSettings.VrOptions.MONO_FOV,
VRSettings.VrOptions.MIRROR_CENTER_SMOOTH
};

public GuiMixedRealitySettings(Screen par1Screen) {
super(par1Screen);
}

public void init() {
this.vrTitle = "vivecraft.options.screen.mixedreality";
VRSettings.VrOptions[] avrsettings$vroptions = new VRSettings.VrOptions[MROptions.length];
System.arraycopy(MROptions, 0, avrsettings$vroptions, 0, MROptions.length);

for (int j = 0; j < avrsettings$vroptions.length; ++j) {
VRSettings.VrOptions vrsettings$vroptions1 = avrsettings$vroptions[j];

if (vrsettings$vroptions1 == VRSettings.VrOptions.MONO_FOV && (!this.dataholder.vrSettings.mixedRealityUndistorted || !this.dataholder.vrSettings.mixedRealityUnityLike)) {
avrsettings$vroptions[j] = VRSettings.VrOptions.DUMMY;
}

if (vrsettings$vroptions1 == VRSettings.VrOptions.MIXED_REALITY_ALPHA_MASK && !this.dataholder.vrSettings.mixedRealityUnityLike) {
avrsettings$vroptions[j] = VRSettings.VrOptions.DUMMY;
}

if (vrsettings$vroptions1 == VRSettings.VrOptions.MIXED_REALITY_UNDISTORTED && !this.dataholder.vrSettings.mixedRealityUnityLike) {
avrsettings$vroptions[j] = VRSettings.VrOptions.DUMMY;
}

if (vrsettings$vroptions1 == VRSettings.VrOptions.MIXED_REALITY_KEY_COLOR && this.dataholder.vrSettings.mixedRealityAlphaMask && this.dataholder.vrSettings.mixedRealityUnityLike) {
avrsettings$vroptions[j] = VRSettings.VrOptions.DUMMY;
}

if (vrsettings$vroptions1 == VRSettings.VrOptions.MIRROR_CENTER_SMOOTH && (!this.dataholder.vrSettings.mixedRealityUndistorted || !this.dataholder.vrSettings.mixedRealityUnityLike)) {
avrsettings$vroptions[j] = VRSettings.VrOptions.DUMMY;
}

if (vrsettings$vroptions1 == VRSettings.VrOptions.MIRROR_EYE && (this.dataholder.vrSettings.mixedRealityUndistorted || !this.dataholder.vrSettings.mixedRealityUnityLike)) {
avrsettings$vroptions[j] = VRSettings.VrOptions.DUMMY;
}
}

super.init(avrsettings$vroptions, true);
super.addDefaultButtons();
}

public void render(PoseStack poseStack, int pMouseX, int pMouseY, float pPartialTicks) {
super.render(poseStack, pMouseX, pMouseY, pPartialTicks);
}

protected void loadDefaults() {
super.loadDefaults();
if (VRState.vrInitialized) {
this.dataholder.vrRenderer.reinitWithoutShaders("Defaults Loaded");
}
}

protected void actionPerformed(AbstractWidget widget) {
if (widget instanceof GuiVROption guivroption) {
if (guivroption.getId() == VRSettings.VrOptions.MIXED_REALITY_ALPHA_MASK.ordinal()
|| guivroption.getId() == VRSettings.VrOptions.MIXED_REALITY_UNITY_LIKE.ordinal()
|| guivroption.getId() == VRSettings.VrOptions.MIXED_REALITY_UNDISTORTED.ordinal()) {
this.reinit = true;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package org.vivecraft.client.gui.settings;

import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.screens.Screen;
import org.vivecraft.client.gui.framework.GuiVROption;
import org.vivecraft.client.gui.framework.GuiVROptionsBase;
import org.vivecraft.client.gui.framework.VROptionEntry;
import org.vivecraft.client_vr.VRState;
import org.vivecraft.client_vr.settings.VRHotkeys;
import org.vivecraft.client_vr.settings.VRSettings;
Expand All @@ -23,18 +25,8 @@ public class GuiRenderOpticsSettings extends GuiVROptionsBase {
VRSettings.VrOptions.STENCIL_ON,
VRSettings.VrOptions.HANDHELD_CAMERA_RENDER_SCALE,
VRSettings.VrOptions.HANDHELD_CAMERA_FOV,
VRSettings.VrOptions.RELOAD_EXTERNAL_CAMERA,
VRSettings.VrOptions.MIRROR_EYE
};
static VRSettings.VrOptions[] MROptions = new VRSettings.VrOptions[]{
VRSettings.VrOptions.MIXED_REALITY_UNITY_LIKE,
VRSettings.VrOptions.MIXED_REALITY_RENDER_HANDS,
VRSettings.VrOptions.MIXED_REALITY_KEY_COLOR,
VRSettings.VrOptions.MIXED_REALITY_FOV,
VRSettings.VrOptions.MIXED_REALITY_UNDISTORTED,
VRSettings.VrOptions.MONO_FOV,
VRSettings.VrOptions.MIXED_REALITY_ALPHA_MASK,
VRSettings.VrOptions.MIXED_REALITY_RENDER_CAMERA_MODEL
VRSettings.VrOptions.MIRROR_SCREENSHOT_CAMERA,
VRSettings.VrOptions.RELOAD_EXTERNAL_CAMERA
};
static VRSettings.VrOptions[] UDOptions = new VRSettings.VrOptions[]{
VRSettings.VrOptions.MONO_FOV,
Expand All @@ -45,8 +37,19 @@ public class GuiRenderOpticsSettings extends GuiVROptionsBase {
VRSettings.VrOptions.MIXED_REALITY_RENDER_CAMERA_MODEL
};
static VRSettings.VrOptions[] CROPOptions = new VRSettings.VrOptions[]{
VRSettings.VrOptions.MIRROR_EYE,
VRSettings.VrOptions.MIRROR_CROP
};
static VRSettings.VrOptions[] SOptions = new VRSettings.VrOptions[]{
VRSettings.VrOptions.MIRROR_EYE
};
final VROptionEntry[] MROptions = new VROptionEntry[]{
new VROptionEntry("vivecraft.options.screen.mixedreality.button", (button, mousePos) -> {
Minecraft.getInstance().setScreen(new GuiMixedRealitySettings(this));
return true;
})
};

private float prevRenderScaleFactor = this.settings.renderScaleFactor;
private float prevHandCameraResScale = this.settings.handCameraResScale;

Expand All @@ -65,50 +68,20 @@ public void init() {
if (vrsettings$vroptions == VRSettings.VrOptions.RELOAD_EXTERNAL_CAMERA && (!VRHotkeys.hasExternalCameraConfig() || this.dataholder.vrSettings.displayMirrorMode != VRSettings.MirrorMode.MIXED_REALITY && this.dataholder.vrSettings.displayMirrorMode != VRSettings.MirrorMode.THIRD_PERSON)) {
avrsettings$vroptions[i] = VRSettings.VrOptions.DUMMY;
}

if (vrsettings$vroptions == VRSettings.VrOptions.MIRROR_EYE && this.dataholder.vrSettings.displayMirrorMode != VRSettings.MirrorMode.CROPPED && this.dataholder.vrSettings.displayMirrorMode != VRSettings.MirrorMode.SINGLE && !(this.dataholder.vrSettings.displayMirrorMode == VRSettings.MirrorMode.MIXED_REALITY && this.dataholder.vrSettings.mixedRealityUnityLike && !this.dataholder.vrSettings.mixedRealityUndistorted)) {
if (this.dataholder.vrSettings.displayMirrorMode == VRSettings.MirrorMode.MIXED_REALITY
&& this.dataholder.vrSettings.mixedRealityUnityLike) {
avrsettings$vroptions[i] = VRSettings.VrOptions.MIRROR_CENTER_SMOOTH;
} else {
avrsettings$vroptions[i] = VRSettings.VrOptions.DUMMY;
}
}
}

super.init(avrsettings$vroptions, true);

if (this.dataholder.vrSettings.displayMirrorMode == VRSettings.MirrorMode.MIXED_REALITY) {
avrsettings$vroptions = new VRSettings.VrOptions[MROptions.length];
System.arraycopy(MROptions, 0, avrsettings$vroptions, 0, MROptions.length);

for (int j = 0; j < avrsettings$vroptions.length; ++j) {
VRSettings.VrOptions vrsettings$vroptions1 = avrsettings$vroptions[j];

if (vrsettings$vroptions1 == VRSettings.VrOptions.MONO_FOV && (!this.dataholder.vrSettings.mixedRealityUndistorted || !this.dataholder.vrSettings.mixedRealityUnityLike)) {
avrsettings$vroptions[j] = VRSettings.VrOptions.DUMMY;
}

if (vrsettings$vroptions1 == VRSettings.VrOptions.MIXED_REALITY_ALPHA_MASK && !this.dataholder.vrSettings.mixedRealityUnityLike) {
avrsettings$vroptions[j] = VRSettings.VrOptions.DUMMY;
}

if (vrsettings$vroptions1 == VRSettings.VrOptions.MIXED_REALITY_UNDISTORTED && !this.dataholder.vrSettings.mixedRealityUnityLike) {
avrsettings$vroptions[j] = VRSettings.VrOptions.DUMMY;
}

if (vrsettings$vroptions1 == VRSettings.VrOptions.MIXED_REALITY_KEY_COLOR && this.dataholder.vrSettings.mixedRealityAlphaMask && this.dataholder.vrSettings.mixedRealityUnityLike) {
avrsettings$vroptions[j] = VRSettings.VrOptions.DUMMY;
}
}

super.init(avrsettings$vroptions, false);
super.init(MROptions, false);
} else if (this.dataholder.vrSettings.displayMirrorMode == VRSettings.MirrorMode.FIRST_PERSON) {
super.init(UDOptions, false);
} else if (this.dataholder.vrSettings.displayMirrorMode == VRSettings.MirrorMode.THIRD_PERSON) {
super.init(TUDOptions, false);
} else if (this.dataholder.vrSettings.displayMirrorMode == VRSettings.MirrorMode.CROPPED) {
super.init(CROPOptions, false);
} else if (this.dataholder.vrSettings.displayMirrorMode == VRSettings.MirrorMode.SINGLE) {
super.init(SOptions, false);
}

super.addDefaultButtons();
Expand Down Expand Up @@ -141,9 +114,9 @@ protected void loadDefaults() {
protected void actionPerformed(AbstractWidget widget) {
if (widget instanceof GuiVROption guivroption) {

if (guivroption.getId() == VRSettings.VrOptions.MIRROR_DISPLAY.ordinal() || VRState.vrRunning && (guivroption.getId() == VRSettings.VrOptions.FSAA.ordinal() || guivroption.getId() == VRSettings.VrOptions.STENCIL_ON.ordinal())) {
if (VRState.vrRunning) {
if (guivroption.getId() == VRSettings.VrOptions.STENCIL_ON.ordinal() || (guivroption.getId() == VRSettings.VrOptions.MIRROR_DISPLAY.ordinal() && ShadersHelper.isShaderActive())) {
if (guivroption.getId() == VRSettings.VrOptions.MIRROR_DISPLAY.ordinal() || guivroption.getId() == VRSettings.VrOptions.FSAA.ordinal() || guivroption.getId() == VRSettings.VrOptions.STENCIL_ON.ordinal()) {
if (VRState.vrInitialized) {
if (guivroption.getId() == VRSettings.VrOptions.MIRROR_DISPLAY.ordinal() && ShadersHelper.isShaderActive()) {
this.dataholder.vrRenderer.resizeFrameBuffers("Render Setting Changed");
} else {
this.dataholder.vrRenderer.reinitFrameBuffers("Render Setting Changed");
Expand All @@ -154,19 +127,14 @@ protected void actionPerformed(AbstractWidget widget) {
if (guivroption.getId() == VRSettings.VrOptions.RELOAD_EXTERNAL_CAMERA.ordinal()) {
VRHotkeys.loadExternalCameraConfig();
}
if (guivroption.getId() == VRSettings.VrOptions.MIXED_REALITY_ALPHA_MASK.ordinal()
|| guivroption.getId() == VRSettings.VrOptions.MIXED_REALITY_UNITY_LIKE.ordinal()
|| guivroption.getId() == VRSettings.VrOptions.MIXED_REALITY_UNDISTORTED.ordinal()) {
this.reinit = true;
}
}
}

public boolean mouseReleased(double pMouseX, double p_94754_, int pMouseY) {
if (this.settings.renderScaleFactor != this.prevRenderScaleFactor || this.settings.handCameraResScale != this.prevHandCameraResScale) {
this.prevRenderScaleFactor = this.settings.renderScaleFactor;
this.prevHandCameraResScale = this.settings.handCameraResScale;
if (VRState.vrRunning) {
if (VRState.vrInitialized) {
this.dataholder.vrRenderer.resizeFrameBuffers("Render Setting Changed");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public class GuiRoomscaleSettings extends GuiVROptionsBase {
VRSettings.VrOptions.ALLOW_CRAWLING,
VRSettings.VrOptions.REALISTIC_DISMOUNT,
VRSettings.VrOptions.REALISTIC_BLOCK_INTERACT,
VRSettings.VrOptions.REALISTIC_ENTITY_INTERACT
VRSettings.VrOptions.REALISTIC_ENTITY_INTERACT,
VRSettings.VrOptions.SWORD_BLOCK_COLLISION
};

public GuiRoomscaleSettings(Screen guiScreen) {
Expand Down
31 changes: 25 additions & 6 deletions common/src/main/java/org/vivecraft/client/utils/UpdateChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ public static boolean checkForUpdates() {
String currentVersionNumber = Xplat.getModVersion() + "-" + Xplat.getModloader().name;
Version current = new Version(currentVersionNumber, currentVersionNumber, "");

// enforce update notifications if using a non release
if (current.alpha > 0 && updateType != 'a') {
updateType = 'a';
} else if (current.beta > 0 && updateType != 'a') {
updateType = 'b';
}

for (Version v : versions) {
if (v.isVersionType(updateType) && current.compareTo(v) > 0) {
changelog += "§a" + v.fullVersion + "§r" + ": \n" + v.changelog + "\n\n";
Expand Down Expand Up @@ -125,12 +132,15 @@ public Version(String version, String version_number, String changelog) {
// parts should be [mc version]-(pre/rc)-[vive version]-(vive a/b/test)-[mod loader]
if (!parts[viveVersionIndex].contains(".")) {
viveVersionIndex = parts.length - 3;
String testString = parts[parts.length - 2];
// prerelease
if (parts[parts.length - 1].matches("a\\d+")) {
alpha = Integer.parseInt(parts[parts.length - 1].replaceAll("\\D+", ""));
} else if (parts[parts.length - 1].matches("b\\d+")) {
beta = Integer.parseInt(parts[parts.length - 1].replaceAll("\\D+", ""));
} else {
if (testString.matches("a\\d+.*")) {
alpha = Integer.parseInt(testString.replaceAll("\\D+", ""));
} else if (testString.matches("b\\d+.*")) {
beta = Integer.parseInt(testString.replaceAll("\\D+", ""));
}
// if the prerelease string is not just aXX or bXX it's a feature test as well and ranked slightly higher
if (!testString.replaceAll("^[ab]\\d+", "").isEmpty()) {
featureTest = true;
}
}
Expand Down Expand Up @@ -163,7 +173,16 @@ public boolean isVersionType(char versionType) {

// two digits per segment, should be enough right?
private long compareNumber() {
return alpha + beta * 100L + (alpha + beta == 0 || featureTest ? 1000L : 0L) + patch * 100000L + minor * 10000000L + major * 1000000000L;
// digit flag
// major minor patch full release beta alpha feature test
// 00 00 00 0 00 00 0
return (featureTest ? 1L : 0L) +
alpha * 10L +
beta * 1000L +
(alpha + beta == 0 ? 10000L : 0L) +
patch * 1000000L +
minor * 100000000L +
major * 10000000000L;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public void doProcess(LocalPlayer player) {
((PlayerExtension) player).vivecraft$setItemInUseCountClient(i);
//Minecraft.getInstance().physicalGuiManager.preClickAction();
}
} else if ((float) Util.getMillis() - this.tsNotch > 500.0F) {
} else if (!this.isDrawing && (float) Util.getMillis() - this.tsNotch > 500.0F) {
this.canDraw = false;
((PlayerExtension) player).vivecraft$setItemInUseClient(ItemStack.EMPTY, interactionhand);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,6 @@ public void doProcess(LocalPlayer player) {
inAnEntity = true;
}
}

// block check
// don't hit blocks with swords or same time as hitting entity
this.canact[c] = this.canact[c] && !isSword && !inAnEntity;

// no hitting while climbey climbing
if (this.dh.climbTracker.isClimbeyClimb() && (!isTool ||
(c == 0 && VivecraftVRMod.INSTANCE.keyClimbeyGrab.isDown(ControllerType.RIGHT)) ||
Expand All @@ -229,6 +224,12 @@ public void doProcess(LocalPlayer player) {
BlockPos blockpos = new BlockPos(this.miningPoint[c]);
BlockState blockstate = this.mc.level.getBlockState(blockpos);

boolean mineableByItem = this.dh.vrSettings.swordBlockCollision && (itemstack.isCorrectToolForDrops(blockstate) || blockstate.getDestroyProgress(player, player.level, blockpos) == 1F);

// block check
// don't hit blocks with swords or same time as hitting entity
this.canact[c] = this.canact[c] && (!isSword || mineableByItem) && !inAnEntity;

// every time end of weapon enters a solid for the first time, trace from our previous air position
// and damage the block it collides with...
BlockHitResult blockHit = this.mc.level.clip(new ClipContext(this.lastWeaponEndAir[c], this.miningPoint[c], ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, this.mc.player));
Expand Down
Loading

0 comments on commit d87d626

Please sign in to comment.