Skip to content

Commit

Permalink
Merge branch 'master' into weapon
Browse files Browse the repository at this point in the history
  • Loading branch information
jimchen5209 committed Sep 21, 2023
2 parents 7a24a31 + b8f4176 commit a8b9043
Show file tree
Hide file tree
Showing 66 changed files with 561 additions and 293 deletions.
14 changes: 7 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
// "maven-publish"
kotlin("jvm") version "1.8.10"
id("fabric-loom") version "1.1-SNAPSHOT"
kotlin("jvm") version "1.9.10"
id("fabric-loom") version "1.3-SNAPSHOT"
}

val version = "0.0.1"
val group = "one.oktw"

val fabricVersion = "0.75.3+1.19.4"
val galaxyLibVersion = "ff884e3f"
val fabricVersion = "0.88.1+1.20.1"
val galaxyLibVersion = "adc1ed90"

repositories {
mavenCentral()
Expand Down Expand Up @@ -40,9 +40,9 @@ loom {

dependencies {
// Core
minecraft(group = "com.mojang", name = "minecraft", version = "1.19.4")
mappings(group = "net.fabricmc", name = "yarn", version = "1.19.4+build.1", classifier = "v2")
modImplementation(group = "net.fabricmc", name = "fabric-loader", version = "0.14.17")
minecraft(group = "com.mojang", name = "minecraft", version = "1.20.1")
mappings(group = "net.fabricmc", name = "yarn", version = "1.20.1+build.10", classifier = "v2")
modImplementation(group = "net.fabricmc", name = "fabric-loader", version = "0.14.22")

// fabric api
modImplementation(group = "net.fabricmc.fabric-api", name = "fabric-api", version = fabricVersion) {
Expand Down
2 changes: 1 addition & 1 deletion docker
Submodule docker updated 1 files
+10 −10 Dockerfile
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
25 changes: 18 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# 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"'
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -143,12 +140,16 @@ fi
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=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=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then
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 $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand All @@ -205,6 +210,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# 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.
Expand Down
15 changes: 9 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand Down Expand Up @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* OKTW Galaxy Project
* Copyright (C) 2018-2020
* Copyright (C) 2018-2023
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
Expand All @@ -18,13 +18,17 @@

package one.oktw.galaxy.mixin.accessor;

import net.minecraft.world.storage.StorageIoWorker;
import net.minecraft.world.storage.VersionedChunkStorage;
import net.minecraft.server.world.ChunkHolder;
import net.minecraft.server.world.ThreadedAnvilChunkStorage;
import net.minecraft.util.math.ChunkPos;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(VersionedChunkStorage.class)
public interface AsyncChunk_VersionedChunkStorage {
@Accessor
StorageIoWorker getWorker();
@Mixin(ThreadedAnvilChunkStorage.class)
public interface ThreadedAnvilChunkStorageAccessor {
@Invoker
Iterable<ChunkHolder> callEntryIterator();

@Invoker
boolean callShouldTick(ChunkPos pos);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* OKTW Galaxy Project
* Copyright (C) 2018-2022
* Copyright (C) 2018-2023
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
Expand Down Expand Up @@ -47,7 +47,7 @@ private void onPlayerInteractBlock(PlayerInteractBlockC2SPacket packet, Callback
info.cancel();
if (event.getSwing()) player.swingHand(packet.getHand(), true);
// Re-sync block & inventory
ServerWorld world = player.getWorld();
ServerWorld world = player.getServerWorld();
BlockPos blockPos = packet.getBlockHitResult().getBlockPos();
player.networkHandler.sendPacket(new BlockUpdateS2CPacket(world, blockPos));
player.networkHandler.sendPacket(new BlockUpdateS2CPacket(world, blockPos.offset(packet.getBlockHitResult().getSide())));
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* OKTW Galaxy Project
* Copyright (C) 2018-2023
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package one.oktw.galaxy.mixin.tweak;

import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.ChunkPosDistanceLevelPropagator;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(ChunkPosDistanceLevelPropagator.class)
public abstract class MixinAsyncChunk_ChunkPosDistanceLevelPropagator {
@Redirect(method = "propagateLevel", at = @At(value = "NEW", target = "(J)Lnet/minecraft/util/math/ChunkPos;"))
private ChunkPos skipCreateChunkPos(long pos) {
return ChunkPos.ORIGIN;
}

@Redirect(method = "propagateLevel", at = @At(value = "FIELD", target = "Lnet/minecraft/util/math/ChunkPos;x:I"))
private int getX(ChunkPos instance, long pos, int level, boolean decrease) {
return (int) pos;
}

@Redirect(method = "propagateLevel", at = @At(value = "FIELD", target = "Lnet/minecraft/util/math/ChunkPos;z:I"))
private int getZ(ChunkPos instance, long pos, int level, boolean decrease) {
return (int) (pos >> 32);
}

@Redirect(method = "recalculateLevel", at = @At(value = "NEW", target = "(J)Lnet/minecraft/util/math/ChunkPos;"))
private ChunkPos skipCreateChunkPos2(long pos) {
return ChunkPos.ORIGIN;
}

@Redirect(method = "recalculateLevel", at = @At(value = "FIELD", target = "Lnet/minecraft/util/math/ChunkPos;x:I"))
private int getX2(ChunkPos instance, long pos, long excludedId, int maxLevel) {
return (int) pos;
}

@Redirect(method = "recalculateLevel", at = @At(value = "FIELD", target = "Lnet/minecraft/util/math/ChunkPos;z:I"))
private int getZ2(ChunkPos instance, long pos, long excludedId, int maxLevel) {
return (int) (pos >> 32);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ private static ByteArrayInputStream getInputStream(ByteBuffer buffer, int length
protected abstract DataInputStream decompress(ChunkPos chunkPos, byte b, InputStream inputStream) throws IOException;

@Inject(method = "delete", at = @At("HEAD"))
private void method_31740Lock(ChunkPos chunkPos, CallbackInfo ci) {
private void deleteLock(ChunkPos chunkPos, CallbackInfo ci) {
lock.lock();
}

@Inject(method = "delete", at = @At("RETURN"))
private void method_31740Unlock(ChunkPos chunkPos, CallbackInfo ci) {
private void deleteUnlock(ChunkPos chunkPos, CallbackInfo ci) {
lock.unlock();
}

Expand Down
Loading

0 comments on commit a8b9043

Please sign in to comment.