Skip to content
This repository has been archived by the owner on Mar 18, 2023. It is now read-only.

Commit

Permalink
play 0.3.1 (#96)
Browse files Browse the repository at this point in the history
* fix tick of player suffocation on teleport and join game

* bump mcxr-play version

* remove fart and fix rendering bugs
  • Loading branch information
Sorenon authored Jul 25, 2022
1 parent 9d89f62 commit 1f52e99
Show file tree
Hide file tree
Showing 9 changed files with 279 additions and 130 deletions.
153 changes: 79 additions & 74 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,74 +1,79 @@
name: gradle-ci

on:
release:
types:
- published

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: checkout repository
uses: actions/checkout@v3
- name: setup JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: adopt
- name: update cache
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/loom-cache
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-

- name: make gradle wrapper executable
run: chmod +x ./gradlew

- name: build
run: ./gradlew build

- if: ${{ contains(github.ref, 'core') }}
name: Upload MCXR-Core artifacts to Modrinth, Curseforge and GitHub
uses: Kir-Antipov/mc-publish@v2.0
with:
modrinth-id: hcEWWGik
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}

curseforge-id: 631772
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}

github-token: ${{ secrets.GITHUB_TOKEN }}

files: mcxr-core/build/libs/!(*-@(dev|sources|all)).jar

version-type: beta

loaders: fabric

version-resolver: latest

- if: ${{ contains(github.ref, 'play') }}
name: Upload MCXR-Play artifacts to Modrinth, Curseforge and GitHub
uses: Kir-Antipov/mc-publish@v2.0
with:
modrinth-id: hcEWWGik
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}

curseforge-id: 9jVyqpHR
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}

github-token: ${{ secrets.GITHUB_TOKEN }}

files: mcxr-play/build/libs/!(*-@(dev|sources|all)).jar

version-type: beta

loaders: fabric

version-resolver: latest
## TODO this
#name: gradle-ci
#
#on:
# release:
# types:
# - published
#
#jobs:
# build:
# runs-on: ubuntu-latest
#
# steps:
# - name: checkout repository
# uses: actions/checkout@v3
# - name: setup JDK 17
# uses: actions/setup-java@v3
# with:
# java-version: 17
# distribution: adopt
# - name: update cache
# uses: actions/cache@v3
# with:
# path: |
# ~/.gradle/caches
# ~/.gradle/loom-cache
# ~/.gradle/wrapper
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle-wrapper.properties') }}
# restore-keys: ${{ runner.os }}-gradle-
#
# - name: make gradle wrapper executable
# run: chmod +x ./gradlew
#
# - name: build
# run: ./gradlew build
#
# - if: ${{ contains(github.ref, 'core') }}
# name: Upload MCXR-Core artifacts to Modrinth, Curseforge and GitHub
# uses: Kir-Antipov/mc-publish@v2.0
# with:
# name: MCXR Core
#
# modrinth-id: hcEWWGik
# modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
#
# curseforge-id: 631772
# curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
#
# github-token: ${{ secrets.GITHUB_TOKEN }}
#
# files: mcxr-core/build/libs/!(*-@(dev|sources|all)).jar
#
# version-type: beta
#
# loaders: fabric
#
# version-resolver: latest
#
# - if: ${{ contains(github.ref, 'play') }}
# name: Upload MCXR-Play artifacts to Modrinth, Curseforge and GitHub
# uses: Kir-Antipov/mc-publish@v2.0
# with:
# name: MCXR Play
#
# modrinth-id: hcEWWGik
# modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
#
# curseforge-id: 9jVyqpHR
# curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
#
# github-token: ${{ secrets.GITHUB_TOKEN }}
#
# files: mcxr-play/build/libs/!(*-@(dev|sources|all)).jar
#
# version-type: beta
#
# loaders: fabric
#
# version-resolver: latest
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G

# Mod Properties
core_version = 0.3.0
play_version = 0.3.0
play_version = 0.3.1
maven_group = net.sorenon

# Dependencies
Expand Down
6 changes: 4 additions & 2 deletions mcxr-play/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ dependencies {
implementation("org.joml:joml:${properties["joml_version"].toString()}")
implementation("com.electronwill.night-config:core:${properties["night_config_version"].toString()}")
implementation("com.electronwill.night-config:toml:${properties["night_config_version"].toString()}")
//Rendering API when pls
include(modImplementation("com.github.Sorenon:fart:8ded02d6af")!!)
}

loom {
accessWidenerPath.set(file("src/main/resources/mcxr-play.accesswidener"))
}

sourceSets {
Expand Down
20 changes: 15 additions & 5 deletions mcxr-play/src/main/java/net/sorenon/mcxr/play/MCXRPlayClient.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package net.sorenon.mcxr.play;

import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.fabricmc.api.ClientModInitializer;
Expand All @@ -17,7 +19,6 @@
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.entity.HumanoidArm;
import net.sorenon.fart.FartRenderEvents;
import net.sorenon.mcxr.core.MCXRCore;
import net.sorenon.mcxr.core.MCXRScale;
import net.sorenon.mcxr.play.input.ControllerPoses;
Expand Down Expand Up @@ -115,7 +116,7 @@ public void onInitializeClient() {

var hitResult = Minecraft.getInstance().hitResult;
if (hitResult != null && !this.MCXRGuiManager.isScreenOpen()) {
Vec3 camPos = camera.getPosition();
Vec3 camPos = context.camera().getPosition();
matrices.pushPose();

double x = hitResult.getLocation().x();
Expand All @@ -131,8 +132,8 @@ public void onInitializeClient() {
}

matrices.scale(0.5f, 1, 0.5f);
RenderType cursorLayer = RenderType.entityCutoutNoCull(GUI_ICONS_LOCATION);
VertexConsumer vertexConsumer = context.consumers().getBuffer(cursorLayer);
RenderType SHADOW_LAYER = RenderType.entityCutoutNoCull(GUI_ICONS_LOCATION);
VertexConsumer vertexConsumer = context.consumers().getBuffer(SHADOW_LAYER);

PoseStack.Pose entry = matrices.last();

Expand All @@ -157,9 +158,18 @@ public void onInitializeClient() {
}
});

FartRenderEvents.LAST.register(context -> {
WorldRenderEvents.LAST.register(context -> {
if (MCXR_GAME_RENDERER.renderPass instanceof RenderPass.XrWorld) {
var poseStack = RenderSystem.getModelViewStack();
poseStack.pushPose();
poseStack.setIdentity();
RenderSystem.applyModelViewMatrix();
GlStateManager._disableDepthTest();

vrFirstPersonRenderer.renderLast(context);

poseStack.popPose();
RenderSystem.applyModelViewMatrix();
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,11 +665,11 @@ private void renderVignette(RenderTarget framebuffer, Entity entity) {
}
if (f > 0.0F) {
f = Mth.clamp(f, 0.0F, 1.0F);
renderOverlay(framebuffer, new ResourceLocation("textures/misc/vignette_vr.png"), 0f, 0f, 0f, f);
renderOverlay(framebuffer, MCXRPlayClient.id("textures/misc/vignette_vr.png"), 0f, 0f, 0f, f);
} else {
float l = LightTexture.getBrightness(entity.level.dimensionType(), entity.level.getMaxLocalRawBrightness(new BlockPos(entity.getX(), entity.getEyeY(), entity.getZ())));
float g = Mth.clamp(1.0F - l, 0.0F, 1.0F);
renderOverlay(framebuffer, new ResourceLocation("textures/misc/vignette_vr.png"), 0f, 0f, 0f, g);
renderOverlay(framebuffer, MCXRPlayClient.id("textures/misc/vignette_vr.png"), 0f, 0f, 0f, g);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package net.sorenon.mcxr.play.rendering;

import com.mojang.blaze3d.vertex.VertexFormat;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.layers.RenderLayer;
import net.minecraft.resources.ResourceLocation;

public class RenderTypeBuilder {

private final String name;
private final VertexFormat format;
private final VertexFormat.Mode drawMode;
private final int expectedBufferSize;
private final boolean affectsCrumbling;
private final boolean sortOnUpload;

public final RenderType.CompositeState.CompositeStateBuilder innerBuilder;

public RenderTypeBuilder(ResourceLocation name, VertexFormat format, VertexFormat.Mode drawMode, int expectedBufferSize, boolean affectsCrumbling, boolean sortOnUpload) {
this.name = "mcxr_" + name.toString();
this.format = format;
this.drawMode = drawMode;
this.expectedBufferSize = expectedBufferSize;
this.affectsCrumbling = affectsCrumbling;
this.sortOnUpload = sortOnUpload;
this.innerBuilder = RenderType.CompositeState.builder();
}

public RenderType.CompositeRenderType build(boolean affectsOutline) {
return createInner(name, format, drawMode, expectedBufferSize, affectsCrumbling, sortOnUpload, innerBuilder.createCompositeState(affectsOutline));
}

public static RenderType.CompositeRenderType createInner(String name, VertexFormat format, VertexFormat.Mode drawMode, int expectedBufferSize, boolean affectsCrumbling, boolean sortOnUpload, RenderType.CompositeState compositeState) {
return RenderType.create(name, format, drawMode, expectedBufferSize, affectsCrumbling, sortOnUpload, compositeState);
}
}
Loading

0 comments on commit 1f52e99

Please sign in to comment.