Skip to content

Commit

Permalink
Update to 1.21.3
Browse files Browse the repository at this point in the history
  • Loading branch information
PotatoPresident committed Dec 2, 2024
1 parent 6ca75fc commit 3b4e251
Show file tree
Hide file tree
Showing 128 changed files with 580 additions and 808 deletions.
25 changes: 11 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
plugins {
id 'fabric-loom' version '1.3.+'
id 'fabric-loom' version '1.8.+'
id 'maven-publish'
}

archivesBaseName = project.archives_base_name
version = project.mod_version + "-" + getVersionMetadata()
group = project.maven_group

base {
archivesName = project.archives_base_name
}

repositories {
mavenLocal()
maven { url = "https://jitpack.io/" }
maven { url = "https://maven.nucleoid.xyz/" }
maven { url = "https://maven.gegy.dev/" }
}

dependencies {
Expand Down Expand Up @@ -47,24 +47,21 @@ processResources {
}
}

// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
tasks.withType(JavaCompile).configureEach {
it.options.release = 21
}

jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
rename { "${it}_${project.base.archivesName.get()}"}
}

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

java {
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

// configure the maven publication
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
loader_version=0.15.0
minecraft_version=1.21.3
yarn_mappings=1.21.3+build.2
loader_version=0.16.9

# Mod Properties
mod_version=1.0.0
Expand All @@ -14,7 +14,7 @@ archives_base_name=skywars

# Dependencies
# check these on https://modmuss50.me/fabric.html
fabric_version=0.91.1+1.20.4
fabric_version=0.110.0+1.21.3

# check this on https://ci.gegy.dev/job/plasmid/
plasmid_version=0.5.102-SNAPSHOT+1.20.4
plasmid_version=0.6.1+1.21.3
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
40 changes: 27 additions & 13 deletions gradlew
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015-2021 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.
Expand Down Expand Up @@ -32,10 +32,10 @@
# 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».
# * 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:
#
Expand All @@ -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 @@ -133,22 +130,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
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=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 +197,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 +213,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
15 changes: 9 additions & 6 deletions src/main/java/us/potatoboy/skywars/SkyWars.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package us.potatoboy.skywars;

import eu.pb4.playerdata.api.PlayerDataApi;
import net.fabricmc.api.ModInitializer;
import net.minecraft.util.Identifier;
import org.apache.logging.log4j.LogManager;
Expand All @@ -9,20 +10,21 @@
import us.potatoboy.skywars.game.SkyWarsWaiting;
import us.potatoboy.skywars.kit.KitRegistry;
import us.potatoboy.skywars.kit.PlayerKitStorage;
import xyz.nucleoid.plasmid.game.GameType;
import xyz.nucleoid.plasmid.game.rule.GameRuleType;
import xyz.nucleoid.plasmid.storage.ServerStorage;
import xyz.nucleoid.plasmid.api.game.GameType;
import xyz.nucleoid.plasmid.api.game.rule.GameRuleType;

import java.util.Random;

public class SkyWars implements ModInitializer {
public static final String ID = "skywars";
public static final Logger LOGGER = LogManager.getLogger(ID);
public static final PlayerKitStorage KIT_STORAGE = ServerStorage.createStorage(identifier("kits"), new PlayerKitStorage());
public static final Random RANDOM = new Random();

public static GameRuleType PROJECTILE_PLAYER_MOMENTUM = GameRuleType.create();
public static GameRuleType REDUCED_EXPLOSION_DAMAGE = GameRuleType.create();

public static final GameType<SkyWarsConfig> TYPE = GameType.register(
new Identifier(ID, "skywars"),
Identifier.of(ID, "skywars"),
SkyWarsConfig.CODEC,
SkyWarsWaiting::open
);
Expand All @@ -31,10 +33,11 @@ public class SkyWars implements ModInitializer {
public void onInitialize() {
SWBlocks.register();

PlayerDataApi.register(PlayerKitStorage.STORAGE);
KitRegistry.register();
}

public static Identifier identifier(String value) {
return new Identifier(ID, value);
return Identifier.of(ID, value);
}
}
7 changes: 3 additions & 4 deletions src/main/java/us/potatoboy/skywars/SkywarsStatistics.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package us.potatoboy.skywars;

import us.potatoboy.skywars.utility.TextUtil;
import xyz.nucleoid.plasmid.game.stats.StatisticKey;
import xyz.nucleoid.plasmid.api.game.stats.StatisticKey;

public class SkywarsStatistics {
public static final StatisticKey<Integer> ARROWS_SHOT = StatisticKey.intKey(TextUtil.id("arrows_shot"), StatisticKey.StorageType.TOTAL);
public static final StatisticKey<Integer> ARROWS_HIT = StatisticKey.intKey(TextUtil.id("arrows_hit"), StatisticKey.StorageType.TOTAL);

public static final StatisticKey<Integer> ARROWS_SHOT = StatisticKey.intKey(TextUtil.id("arrows_shot"));
public static final StatisticKey<Integer> ARROWS_HIT = StatisticKey.intKey(TextUtil.id("arrows_hit"));
}
6 changes: 4 additions & 2 deletions src/main/java/us/potatoboy/skywars/custom/SWBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import us.potatoboy.skywars.SkyWars;
import us.potatoboy.skywars.custom.block.LaunchPadBlock;
import us.potatoboy.skywars.custom.block.LaunchPadBlockEntity;

public class SWBlocks {
public static final Block GOLD_LAUNCH_PAD = new LaunchPadBlock(AbstractBlock.Settings.copy(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE).strength(100).noCollision(), Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE);
public static final Block IRON_LAUNCH_PAD = new LaunchPadBlock(AbstractBlock.Settings.copy(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE).strength(100).noCollision(), Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE);
public static final Block GOLD_LAUNCH_PAD = new LaunchPadBlock(AbstractBlock.Settings.copy(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE).strength(100).noCollision().registryKey(RegistryKey.of(RegistryKeys.BLOCK, SkyWars.identifier("gold_launch_pad"))), Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE.getDefaultState());
public static final Block IRON_LAUNCH_PAD = new LaunchPadBlock(AbstractBlock.Settings.copy(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE).strength(100).noCollision().registryKey(RegistryKey.of(RegistryKeys.BLOCK, SkyWars.identifier("iron_launch_pad"))), Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE.getDefaultState());

public static final BlockEntityType<LaunchPadBlockEntity> LAUNCH_PAD_ENTITY = FabricBlockEntityTypeBuilder.create(LaunchPadBlockEntity::new, GOLD_LAUNCH_PAD, IRON_LAUNCH_PAD).build(null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import xyz.nucleoid.packettweaker.PacketContext;

// Taken from https://github.com/NucleoidMC/nucleoid-extras/blob/1.17/src/main/java/xyz/nucleoid/extras/lobby/block/LaunchPadBlock.java
public class LaunchPadBlock extends Block implements BlockEntityProvider, PolymerBlock {
private final Block virtualBlock;
private final BlockState virtualBlock;

public LaunchPadBlock(Settings settings, Block virtualBlock) {
public LaunchPadBlock(Settings settings, BlockState virtualBlock) {
super(settings);
this.virtualBlock = virtualBlock;
}

@Override
public Block getPolymerBlock(BlockState state) {
return this.virtualBlock;
public BlockState getPolymerBlockState(BlockState blockState, PacketContext packetContext) {
return virtualBlock;
}

@Override
Expand All @@ -38,7 +39,7 @@ public void onEntityCollision(BlockState state, World world, BlockPos pos, Entit
entity.setVelocity(getVector(launchPad.getPitch(), entity.getYaw(0)).multiply(launchPad.getPower()));
if (entity instanceof ServerPlayerEntity player) {
player.networkHandler.sendPacket(new EntityVelocityUpdateS2CPacket(entity));
player.playSound(SoundEvents.BLOCK_PISTON_EXTEND, SoundCategory.BLOCKS, 0.5f, 1);
world.playSound(null, pos, SoundEvents.BLOCK_PISTON_EXTEND, SoundCategory.BLOCKS, 0.5f, 1);
}
super.onEntityCollision(state, world, pos, entity);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.util.math.BlockPos;
import us.potatoboy.skywars.custom.SWBlocks;

Expand All @@ -24,14 +25,14 @@ public float getPower() {
}

@Override
public void writeNbt(NbtCompound nbt) {
public void writeNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registries) {
nbt.putFloat("Pitch", this.pitch);
nbt.putFloat("Power", this.power);
}

@Override
public void readNbt(NbtCompound nbt) {
super.readNbt(nbt);
public void readNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registries) {
super.readNbt(nbt, registries);
this.pitch = nbt.getFloat("Pitch");
this.power = nbt.getFloat("Power");
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/us/potatoboy/skywars/game/AttackRecord.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package us.potatoboy.skywars.game;

import net.minecraft.server.network.ServerPlayerEntity;
import xyz.nucleoid.plasmid.util.PlayerRef;
import xyz.nucleoid.plasmid.api.util.PlayerRef;

public class AttackRecord {
public static final long EXPIRE_TIME = 20 * 10;
Expand Down
Loading

0 comments on commit 3b4e251

Please sign in to comment.