Compare commits
14 Commits
ae5783aa1d
...
szar-26.4.
| Author | SHA1 | Date | |
|---|---|---|---|
| 5dcf4fc221 | |||
| 34b8fccf24 | |||
| 62ad19516b | |||
| c3eb514db7 | |||
| 4bc0779967 | |||
| ab32bc230e | |||
| 034fac759c | |||
| aa07b71ed1 | |||
| 20027a974a | |||
| 539e4ad637 | |||
| 1313fd97db | |||
| b9393d179e | |||
| 5a42ec1e9e | |||
| 245f5ea035 |
@@ -18,11 +18,19 @@ jobs:
|
|||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: 21
|
java-version: 21
|
||||||
|
|
||||||
|
- name: Ensure Gradle wrapper exists
|
||||||
|
run: |
|
||||||
|
if [ ! -f "./gradlew" ]; then
|
||||||
|
echo "ERROR: gradlew not found in repository!"
|
||||||
|
echo "Please run 'gradle wrapper' locally and push the files."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Make gradlew executable
|
- name: Make gradlew executable
|
||||||
run: chmod +x ./gradlew
|
run: chmod +x ./gradlew
|
||||||
|
|
||||||
- name: Build mod
|
- name: Build mod
|
||||||
run: ./gradlew build
|
run: ./gradlew build --no-daemon --max-workers=1 -Dorg.gradle.jvmargs="-Xmx1g -XX:MaxMetaspaceSize=256m"
|
||||||
|
|
||||||
- name: Read mod info
|
- name: Read mod info
|
||||||
id: mod_info
|
id: mod_info
|
||||||
@@ -67,16 +75,22 @@ jobs:
|
|||||||
path: ./release-artifacts/
|
path: ./release-artifacts/
|
||||||
|
|
||||||
- name: Install jq
|
- name: Install jq
|
||||||
run: sudo apt-get update && sudo apt-get install -y jq
|
run: apt-get update && apt-get install -y jq
|
||||||
|
|
||||||
- name: Read mod info again
|
- name: Read mod info from gradle.properties
|
||||||
|
id: mod_info
|
||||||
run: |
|
run: |
|
||||||
NAME=$(grep "^archives_base_name" gradle.properties | cut -d'=' -f2)
|
NAME=$(grep "^archives_base_name" gradle.properties | cut -d'=' -f2)
|
||||||
VERSION=$(grep "^mod_version" gradle.properties | cut -d'=' -f2)
|
VERSION=$(grep "^mod_version" gradle.properties | cut -d'=' -f2)
|
||||||
|
|
||||||
|
if [ -z "$NAME" ] || [ -z "$VERSION" ]; then
|
||||||
|
echo "Failed to read mod info"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
JAR="${NAME}-${VERSION}.jar"
|
||||||
echo "NAME=$NAME" >> $GITEA_ENV
|
echo "NAME=$NAME" >> $GITEA_ENV
|
||||||
echo "VERSION=$VERSION" >> $GITEA_ENV
|
echo "VERSION=$VERSION" >> $GITEA_ENV
|
||||||
|
echo "JAR=$JAR" >> $GITEA_ENV
|
||||||
- name: Determine tag
|
- name: Determine tag
|
||||||
run: |
|
run: |
|
||||||
BASE="${NAME}-${VERSION}"
|
BASE="${NAME}-${VERSION}"
|
||||||
@@ -99,14 +113,12 @@ jobs:
|
|||||||
echo "TAG=$TAG" >> $GITEA_ENV
|
echo "TAG=$TAG" >> $GITEA_ENV
|
||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
run: |
|
uses: softprops/action-gh-release@v1
|
||||||
curl -X POST "${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases" \
|
with:
|
||||||
-H "Authorization: token ${{ secrets.GITEATOKEN }}" \
|
files: build/libs/*.jar
|
||||||
-H "Content-Type: application/json" \
|
tag_name: ${{ env.TAG }}
|
||||||
-d "{
|
env:
|
||||||
\"tag_name\": \"${TAG}\",
|
GITHUB_TOKEN: ${{ secrets.GITEATOKEN }}
|
||||||
\"name\": \"${TAG}\"
|
|
||||||
}"
|
|
||||||
|
|
||||||
- name: Get release ID
|
- name: Get release ID
|
||||||
run: |
|
run: |
|
||||||
@@ -117,12 +129,20 @@ jobs:
|
|||||||
|
|
||||||
echo "RELEASE_ID=$RELEASE_ID" >> $GITEA_ENV
|
echo "RELEASE_ID=$RELEASE_ID" >> $GITEA_ENV
|
||||||
|
|
||||||
- name: Upload jar to release
|
- name: Upload the mod JAR
|
||||||
run: |
|
run: |
|
||||||
FILE=$(ls ./release-artifacts/*.jar | head -n 1)
|
# Find the largest JAR file (the main mod file is 120 MiB, others are KiB)
|
||||||
|
JAR_FILE=$(ls -S ./release-artifacts/*.jar | head -n 1)
|
||||||
|
|
||||||
|
if [ ! -f "$JAR_FILE" ]; then
|
||||||
|
echo "Error: Main JAR not found in ./release-artifacts/"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Uploading largest file: $(basename $JAR_FILE)"
|
||||||
|
|
||||||
curl -X POST \
|
curl -X POST \
|
||||||
-H "Authorization: token ${{ secrets.GITEATOKEN }}" \
|
-H "Authorization: token ${{ secrets.GITEATOKEN }}" \
|
||||||
-H "Content-Type: application/java-archive" \
|
-H "Content-Type: application/java-archive" \
|
||||||
--data-binary @"$FILE" \
|
--data-binary @"$JAR_FILE" \
|
||||||
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets?name=$(basename $FILE)"
|
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets?name=$(basename $JAR_FILE)"
|
||||||
@@ -6,7 +6,7 @@ minecraft_version=1.20.1
|
|||||||
yarn_mappings=1.20.1+build.10
|
yarn_mappings=1.20.1+build.10
|
||||||
loader_version=0.18.3
|
loader_version=0.18.3
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=26.3.30
|
mod_version=26.4.1
|
||||||
maven_group=dev.tggamesyt
|
maven_group=dev.tggamesyt
|
||||||
archives_base_name=szar
|
archives_base_name=szar
|
||||||
# Dependencies
|
# Dependencies
|
||||||
|
|||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
248
gradlew
vendored
Normal file
248
gradlew
vendored
Normal file
@@ -0,0 +1,248 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "$( uname )" in #(
|
||||||
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
|
Darwin* ) darwin=true ;; #(
|
||||||
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
|
NONSTOP* ) nonstop=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
|
else
|
||||||
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD=java
|
||||||
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
@@ -58,7 +58,34 @@ public class SzarClient implements ClientModInitializer {
|
|||||||
// add this field to your client init class
|
// add this field to your client init class
|
||||||
public static final int april = Szar.april;
|
public static final int april = Szar.april;
|
||||||
public static final int fools = Szar.fools;
|
public static final int fools = Szar.fools;
|
||||||
|
public static boolean hasBeaten = false;
|
||||||
|
|
||||||
|
// Transition state
|
||||||
|
public static long transitionStartTime = -1L;
|
||||||
|
public static boolean transitioningToNormal = false; // true = flipped->normal, false = normal->flipped
|
||||||
|
public static boolean wasFlipped = false;
|
||||||
|
|
||||||
|
public static final long TRANSITION_DURATION_MS = 2000L;
|
||||||
|
|
||||||
private float drogOverlayProgress = 0.0F;
|
private float drogOverlayProgress = 0.0F;
|
||||||
|
public static float getCurrentFlipAngle() {
|
||||||
|
if (transitionStartTime != -1L) {
|
||||||
|
long elapsed = System.currentTimeMillis() - transitionStartTime;
|
||||||
|
if (elapsed >= TRANSITION_DURATION_MS) {
|
||||||
|
transitionStartTime = -1L;
|
||||||
|
wasFlipped = false;
|
||||||
|
return hasBeaten ? 0f : 180f;
|
||||||
|
}
|
||||||
|
float t = (float) elapsed / (float) TRANSITION_DURATION_MS;
|
||||||
|
t = t * t * (3f - 2f * t);
|
||||||
|
if (transitioningToNormal) {
|
||||||
|
return 180f * (1f - t); // 180 -> 0
|
||||||
|
} else {
|
||||||
|
return 180f * t; // 0 -> 180
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hasBeaten ? 0f : 180f;
|
||||||
|
}
|
||||||
private long lastTime = 0;
|
private long lastTime = 0;
|
||||||
private static final Map<KeyBinding, KeyBinding> activeScramble = new HashMap<>();
|
private static final Map<KeyBinding, KeyBinding> activeScramble = new HashMap<>();
|
||||||
public static final EntityModelLayer PLANE =
|
public static final EntityModelLayer PLANE =
|
||||||
@@ -90,6 +117,22 @@ public class SzarClient implements ClientModInitializer {
|
|||||||
);
|
);
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
|
ClientPlayNetworking.registerGlobalReceiver(Szar.APRIL_GAME_BEATEN, (client, handler, buf, responseSender) -> {
|
||||||
|
client.execute(() -> {
|
||||||
|
hasBeaten = true;
|
||||||
|
transitionStartTime = System.currentTimeMillis();
|
||||||
|
transitioningToNormal = true;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
ClientPlayNetworking.registerGlobalReceiver(Szar.APRIL_GAME_BEATEN_REVOKED, (client, handler, buf, responseSender) -> {
|
||||||
|
client.execute(() -> {
|
||||||
|
hasBeaten = false;
|
||||||
|
transitionStartTime = System.currentTimeMillis();
|
||||||
|
transitioningToNormal = false;
|
||||||
|
wasFlipped = true;
|
||||||
|
});
|
||||||
|
});
|
||||||
BlockEntityRendererFactories.register(BlueprintBlocks.BLUEPRINT_STAIRS_BE_TYPE, BlueprintBlockEntityRenderer::new);
|
BlockEntityRendererFactories.register(BlueprintBlocks.BLUEPRINT_STAIRS_BE_TYPE, BlueprintBlockEntityRenderer::new);
|
||||||
BlockEntityRendererFactories.register(BlueprintBlocks.BLUEPRINT_SLAB_BE_TYPE, BlueprintBlockEntityRenderer::new);
|
BlockEntityRendererFactories.register(BlueprintBlocks.BLUEPRINT_SLAB_BE_TYPE, BlueprintBlockEntityRenderer::new);
|
||||||
BlockEntityRendererFactories.register(BlueprintBlocks.BLUEPRINT_DOOR_BE_TYPE, BlueprintBlockEntityRenderer::new);
|
BlockEntityRendererFactories.register(BlueprintBlocks.BLUEPRINT_DOOR_BE_TYPE, BlueprintBlockEntityRenderer::new);
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ public class MouseFlipMixin {
|
|||||||
)
|
)
|
||||||
private double flipMouseY(double pitchDelta) {
|
private double flipMouseY(double pitchDelta) {
|
||||||
if (!isAprilFools()) return pitchDelta;
|
if (!isAprilFools()) return pitchDelta;
|
||||||
return -pitchDelta;
|
// Flip mouse when angle is past 90 degrees (i.e. screen is more flipped than not)
|
||||||
|
if (SzarClient.getCurrentFlipAngle() > 90f) return -pitchDelta;
|
||||||
|
return pitchDelta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,20 +26,27 @@ public class ScreenFlipMixin {
|
|||||||
@ModifyReturnValue(method = "getBasicProjectionMatrix", at = @At("RETURN"))
|
@ModifyReturnValue(method = "getBasicProjectionMatrix", at = @At("RETURN"))
|
||||||
private Matrix4f flipProjection(Matrix4f original) {
|
private Matrix4f flipProjection(Matrix4f original) {
|
||||||
if (!isAprilFools()) return original;
|
if (!isAprilFools()) return original;
|
||||||
return original.scale(1.0f, -1.0f, 1.0f);
|
|
||||||
|
float angle = SzarClient.getCurrentFlipAngle();
|
||||||
|
if (angle == 0f) return original;
|
||||||
|
if (angle == 180f) return original.scale(1.0f, -1.0f, 1.0f);
|
||||||
|
|
||||||
|
return original.rotateZ((float) Math.toRadians(angle));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "renderWorld", at = @At("HEAD"))
|
@Inject(method = "renderWorld", at = @At("HEAD"))
|
||||||
private void setFrontFaceCW(float tickDelta, long limitTime, MatrixStack matrices, CallbackInfo ci) {
|
private void setFrontFaceCW(float tickDelta, long limitTime, MatrixStack matrices, CallbackInfo ci) {
|
||||||
if (!isAprilFools()) return;
|
if (!isAprilFools()) return;
|
||||||
// Y flip reverses winding order, so tell GL that clockwise = front face
|
if (SzarClient.getCurrentFlipAngle() > 90f) {
|
||||||
GL11.glFrontFace(GL11.GL_CW);
|
GL11.glFrontFace(GL11.GL_CW);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "renderWorld", at = @At("TAIL"))
|
@Inject(method = "renderWorld", at = @At("TAIL"))
|
||||||
private void restoreFrontFaceCCW(float tickDelta, long limitTime, MatrixStack matrices, CallbackInfo ci) {
|
private void restoreFrontFaceCCW(float tickDelta, long limitTime, MatrixStack matrices, CallbackInfo ci) {
|
||||||
if (!isAprilFools()) return;
|
if (!isAprilFools()) return;
|
||||||
// Restore default: counter-clockwise = front face
|
if (SzarClient.getCurrentFlipAngle() > 90f) {
|
||||||
GL11.glFrontFace(GL11.GL_CCW);
|
GL11.glFrontFace(GL11.GL_CCW);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,6 +103,8 @@ public class Szar implements ModInitializer {
|
|||||||
public static final Logger LOGGER = LogManager.getLogger(MOD_ID);
|
public static final Logger LOGGER = LogManager.getLogger(MOD_ID);
|
||||||
public static int april = 4;
|
public static int april = 4;
|
||||||
public static int fools = 1;
|
public static int fools = 1;
|
||||||
|
public static final Identifier APRIL_GAME_BEATEN = new Identifier(MOD_ID, "april_game_beaten");
|
||||||
|
public static final Identifier APRIL_GAME_BEATEN_REVOKED = new Identifier("szar", "april_game_beaten_revoked");
|
||||||
public static final Identifier DRUNK_TYPE_PACKET = new Identifier(MOD_ID, "drunk_type");
|
public static final Identifier DRUNK_TYPE_PACKET = new Identifier(MOD_ID, "drunk_type");
|
||||||
public static final Identifier OPEN_DETONATOR_SCREEN = new Identifier(MOD_ID, "open_coord_screen");
|
public static final Identifier OPEN_DETONATOR_SCREEN = new Identifier(MOD_ID, "open_coord_screen");
|
||||||
public static final Identifier DETONATOR_INPUT = new Identifier(MOD_ID, "coord_input");
|
public static final Identifier DETONATOR_INPUT = new Identifier(MOD_ID, "coord_input");
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package dev.tggamesyt.szar.mixin;
|
||||||
|
|
||||||
|
import dev.tggamesyt.szar.Szar;
|
||||||
|
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
|
||||||
|
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
|
||||||
|
import net.minecraft.advancement.Advancement;
|
||||||
|
import net.minecraft.advancement.PlayerAdvancementTracker;
|
||||||
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
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.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
@Mixin(PlayerAdvancementTracker.class)
|
||||||
|
public class PlayerAdvancementTrackerMixin {
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
private ServerPlayerEntity owner;
|
||||||
|
|
||||||
|
@Inject(method = "grantCriterion", at = @At("RETURN"))
|
||||||
|
private void onCriterionGranted(Advancement advancement, String criterionName, CallbackInfoReturnable<Boolean> cir) {
|
||||||
|
if (!cir.getReturnValue()) return;
|
||||||
|
if (owner == null) return;
|
||||||
|
|
||||||
|
if (advancement.getId().equals(new Identifier("end", "kill_dragon"))) {
|
||||||
|
if (!owner.getAdvancementTracker().getProgress(advancement).isDone()) return;
|
||||||
|
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
if (today.getMonthValue() != Szar.april || today.getDayOfMonth() != Szar.fools) return;
|
||||||
|
|
||||||
|
Szar.grantAdvancement(owner, "april_game_beaten");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!advancement.getId().equals(new Identifier(Szar.MOD_ID, "april_game_beaten"))) return;
|
||||||
|
if (!owner.getAdvancementTracker().getProgress(advancement).isDone()) return;
|
||||||
|
|
||||||
|
ServerPlayNetworking.send(owner, Szar.APRIL_GAME_BEATEN, PacketByteBufs.empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "revokeCriterion", at = @At("RETURN"))
|
||||||
|
private void onCriterionRevoked(Advancement advancement, String criterionName, CallbackInfoReturnable<Boolean> cir) {
|
||||||
|
if (!cir.getReturnValue()) return;
|
||||||
|
if (owner == null) return;
|
||||||
|
|
||||||
|
if (!advancement.getId().equals(new Identifier(Szar.MOD_ID, "april_game_beaten"))) return;
|
||||||
|
// If it's no longer done after revoking, send the revoke packet
|
||||||
|
if (owner.getAdvancementTracker().getProgress(advancement).isDone()) return;
|
||||||
|
|
||||||
|
ServerPlayNetworking.send(owner, Szar.APRIL_GAME_BEATEN_REVOKED, PacketByteBufs.empty());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -206,5 +206,8 @@
|
|||||||
"block.szar.ender_obsidian": "Ender Obsidian",
|
"block.szar.ender_obsidian": "Ender Obsidian",
|
||||||
"block.szar.ender_ore": "Ender Ore",
|
"block.szar.ender_ore": "Ender Ore",
|
||||||
"item.szar.raw_ender": "Raw Ender",
|
"item.szar.raw_ender": "Raw Ender",
|
||||||
"item.szar.ender_ingot": "Ender Ingot"
|
"item.szar.ender_ingot": "Ender Ingot",
|
||||||
|
|
||||||
|
"advancement.szar.april_game_beaten.title": "We are so back",
|
||||||
|
"advancement.szar.april_game_beaten.description": "Beat the game on april 1st to flip the game back."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"parent": "szar:april",
|
||||||
|
"display": {
|
||||||
|
"icon": {
|
||||||
|
"item": "szar:april"
|
||||||
|
},
|
||||||
|
"title": {"translate": "advancement.szar.april_game_beaten.title"},
|
||||||
|
"description": {"translate": "advancement.szar.april_game_beaten.description"},
|
||||||
|
"show_toast": true,
|
||||||
|
"announce_to_chat": false,
|
||||||
|
"frame": "challenge"
|
||||||
|
},
|
||||||
|
"criteria": {
|
||||||
|
"used_item": {
|
||||||
|
"trigger": "minecraft:impossible"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
"NoClipMixin",
|
"NoClipMixin",
|
||||||
"NoiseChunkGeneratorMixin",
|
"NoiseChunkGeneratorMixin",
|
||||||
"PlaneBlockInteractionMixin",
|
"PlaneBlockInteractionMixin",
|
||||||
|
"PlayerAdvancementTrackerMixin",
|
||||||
"PlayerDropMixin",
|
"PlayerDropMixin",
|
||||||
"PlayerEntityMixin",
|
"PlayerEntityMixin",
|
||||||
"PlayerInteractionMixin",
|
"PlayerInteractionMixin",
|
||||||
|
|||||||
Reference in New Issue
Block a user