Skip to content

Commit

Permalink
Update to Minecraft 1.20.5.
Browse files Browse the repository at this point in the history
- Update to Minecraft 1.20.5
* Major changes to pano render to accommodate vanilla menu changes
  • Loading branch information
gniftygnome committed Apr 27, 2024
1 parent 6adf94c commit b56e55a
Show file tree
Hide file tree
Showing 13 changed files with 175 additions and 151 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/check_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,29 @@ jobs:
strategy:
matrix:
# Use these Java versions
java: [17]
java: [21]
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup JDK ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
- name: Make Gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: Build
run: ./gradlew build --stacktrace --parallel
- name: Capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from LTS java on one OS
uses: actions/upload-artifact@v2
if: ${{ runner.os == 'Linux' && matrix.java == '21' }} # Only upload artifacts built from LTS java on one OS
uses: actions/upload-artifact@v4
with:
name: Artifacts
path: build/libs/
17 changes: 9 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ jobs:
strategy:
matrix:
# Use these Java versions
java: [17]
java: [21]
# and run on both Linux and Windows
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create version tag
uses: actions/github-script@v3
uses: actions/github-script@v7
with:
github-token: ${{ github.token }}
script: |
github.git.createRef({
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/v${{ github.event.inputs.version }}",
Expand All @@ -36,10 +36,11 @@ jobs:
- name: Fetch tags
run: git fetch --tags
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
uses: gradle/wrapper-validation-action@v2
- name: Setup JDK ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
- name: Make Gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
Expand All @@ -55,8 +56,8 @@ jobs:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
DISCORD_ANNOUNCEMENT_WEBHOOK: ${{ secrets.DISCORD_ANNOUNCEMENT_WEBHOOK }}
- name: Capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from LTS java on one OS
uses: actions/upload-artifact@v2
if: ${{ runner.os == 'Linux' && matrix.java == '21' }} # Only upload artifacts built from LTS java on one OS
uses: actions/upload-artifact@v4
with:
name: Artifacts
path: build/libs/
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
plugins {
id 'fabric-loom' version '1.4.+'
id 'fabric-loom' version '1.6.+'
}

apply from: 'https://raw.githubusercontent.com/TerraformersMC/GradleScripts/2.6/ferry.gradle'

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21

dependencies {
minecraft "com.mojang:minecraft:$project.minecraft_version"
Expand Down
16 changes: 8 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ org.gradle.jvmargs=-Xmx1G
maven_group=com.terraformersmc
archive_name=vistas

minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10
loader_version=0.15.6
fabric_version=0.91.0+1.20.1
modmenu_version=7.2.2
clothconfig_version=11.1.118
minecraft_version=1.20.5
yarn_mappings=1.20.5+build.1
loader_version=0.15.10
fabric_version=0.97.7+1.20.5
modmenu_version=10.0.0-beta.1
clothconfig_version=14.0.126

# Project Metadata
project_name=Vistas
Expand All @@ -21,14 +21,14 @@ default_release_type=beta
# CurseForge Metadata
curseforge_slug=vistas
curseforge_id=423659
curseforge_game_versions=1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4, Fabric, Quilt
curseforge_game_versions=1.20.5, 1.20.6-Snapshot, Fabric, Quilt
curseforge_required_dependencies=fabric-api
curseforge_optional_dependencies=

# Modrinth Metadata
modrinth_slug=vistas
modrinth_id=itzZXRxq
modrinth_game_versions=1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4
modrinth_game_versions=1.20.5, 1.20.6-rc1
modrinth_mod_loaders=fabric, quilt
modrinth_required_dependencies=fabric-api

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
30 changes: 30 additions & 0 deletions src/main/java/com/terraformersmc/vistas/mixin/ScreenMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.terraformersmc.vistas.mixin;

import com.terraformersmc.vistas.title.VistasRotatingCubemapRenderer;
import net.minecraft.client.gui.CubeMapRenderer;
import net.minecraft.client.gui.RotatingCubeMapRenderer;
import net.minecraft.client.gui.screen.Screen;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(Screen.class)
public class ScreenMixin {
@Shadow
@Final
protected static CubeMapRenderer PANORAMA_RENDERER;

@Shadow
@Mutable
@Final
protected static RotatingCubeMapRenderer ROTATING_PANORAMA_RENDERER;

@Inject(method = "<clinit>", at = @At("TAIL"))
private static void vistas$useOurRenderer(CallbackInfo ci) {
ROTATING_PANORAMA_RENDERER = new VistasRotatingCubemapRenderer(PANORAMA_RENDERER);
}
}
Original file line number Diff line number Diff line change
@@ -1,31 +1,20 @@
package com.terraformersmc.vistas.mixin;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import com.terraformersmc.vistas.Vistas;
import com.terraformersmc.vistas.config.VistasConfig;
import com.terraformersmc.vistas.resource.PanoramaResourceReloader;
import com.terraformersmc.vistas.title.BenignCubemapRenderer;
import com.terraformersmc.vistas.title.LogoDrawerAccessor;
import com.terraformersmc.vistas.title.PanoramaRenderer;
import com.terraformersmc.vistas.title.VistasTitle;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.LogoDrawer;
import net.minecraft.client.gui.RotatingCubeMapRenderer;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.SplashTextRenderer;
import net.minecraft.client.gui.screen.TitleScreen;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -37,29 +26,19 @@
@Mixin(TitleScreen.class)
public abstract class TitleScreenMixin extends Screen {
@Shadow
@Mutable
@Final
private RotatingCubeMapRenderer backgroundRenderer;

@Shadow
@Final
private boolean doBackgroundFade;
private LogoDrawer logoDrawer;

@Nullable
@Shadow
private SplashTextRenderer splashText;

@Shadow
@Final
private LogoDrawer logoDrawer;

protected TitleScreenMixin(Text title) {
super(title);
}

@Inject(method = "<init>(Z)V", at = @At("TAIL"))
private void vistas$init(boolean doBackgroundFade, CallbackInfo ci) {
this.backgroundRenderer = new BenignCubemapRenderer();
((LogoDrawerAccessor)this.logoDrawer).vistas$setIsVistas(new Random().nextDouble() < 1.0E-4D && VistasTitle.CURRENT.getValue().equals(VistasTitle.PANORAMAS.get(Vistas.DEFAULT)));
}

Expand All @@ -73,30 +52,4 @@ protected TitleScreenMixin(Text title) {
this.splashText = null;
}
}

@WrapOperation(
method = "render",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/RotatingCubeMapRenderer;render(FF)V"
)
)
@SuppressWarnings("unused")
private void vistas$render(RotatingCubeMapRenderer instance, float delta, float fade, Operation<Void> operation, DrawContext context) {
assert this.client != null;
PanoramaRenderer.time += delta;
VistasTitle.CURRENT.getValue().getCubemaps().forEach((cubemap) -> {
PanoramaRenderer panoramaRenderer = new PanoramaRenderer(cubemap);
panoramaRenderer.render(delta, fade);
Identifier overlayId = new Identifier(panoramaRenderer.getCubemap().getCubemapId() + "_overlay.png");
if (this.client.getResourceManager().getResource(overlayId).isPresent()) {
RenderSystem.enableBlend();
RenderSystem.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, this.doBackgroundFade ? (float) MathHelper.ceil(fade) : 1.0F);
context.drawTexture(overlayId, 0, 0, this.width, this.height, 0.0F, 0.0F, 16, 128, 16, 128);
}
});

operation.call(instance, delta, fade);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.client.MinecraftClient;

import java.util.Optional;

Expand Down Expand Up @@ -86,16 +87,25 @@ public double getSpeedMultiplier() {
return speedMultiplier;
}

public double getSpeed() {
MinecraftClient client = MinecraftClient.getInstance();
if (client == null) {
return this.getSpeedMultiplier();
}

return client.options.getPanoramaSpeed().getValue() * this.getSpeedMultiplier();
}

public double getPitch(double time) {
return ((this.isWoozy() ? -time * 0.1D : Math.sin(time * 0.001D) * 5.0D + 25.0D) + this.getAddedPitch()) * this.getSpeedMultiplier();
return ((this.isWoozy() ? -time * 0.1D : Math.sin(time * 0.001D) * 5.0D + 25.0D) + this.getAddedPitch()) * this.getSpeed();
}

public double getYaw(double time) {
return ((-time * 0.1D) + this.getAddedYaw()) * this.getSpeedMultiplier();
return ((-time * 0.1D) + this.getAddedYaw()) * this.getSpeed();
}

public double getRoll(double time) {
return (this.getAddedRoll()) * this.getSpeedMultiplier();
return (this.getAddedRoll()) * this.getSpeed();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import com.terraformersmc.vistas.panorama.Panorama;
import com.terraformersmc.vistas.title.VistasTitle;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.Session;
import net.minecraft.client.session.Session;
import net.minecraft.resource.Resource;
import net.minecraft.resource.ResourceManager;
import net.minecraft.resource.SinglePreparationResourceReloader;
Expand Down Expand Up @@ -47,7 +47,7 @@ protected HashMap<Identifier, Pair<Panorama, List<String>>> prepare(ResourceMana
profiler.push(namespace);
try {
for (Resource resource : manager.getAllResources(new Identifier(namespace, "panoramas.json"))) {
profiler.push(resource.getResourcePackName());
profiler.push(resource.getPackId());
try {
InputStream inputStream = resource.getInputStream();
try {
Expand Down Expand Up @@ -93,7 +93,7 @@ protected HashMap<Identifier, Pair<Panorama, List<String>>> prepare(ResourceMana
}
inputStream.close();
} catch (RuntimeException runtimeBreak) {
Vistas.LOGGER.warn("Invalid panoramas.json in resourcepack: '{}'", resource.getResourcePackName(), runtimeBreak);
Vistas.LOGGER.warn("Invalid panoramas.json in resourcepack: '{}'", resource.getPackId(), runtimeBreak);
}
profiler.pop();
}
Expand Down

This file was deleted.

Loading

0 comments on commit b56e55a

Please sign in to comment.