From fdbadd6696493e023cb2488385027c6cead489ac Mon Sep 17 00:00:00 2001 From: hypherionmc Date: Sun, 9 Mar 2025 17:13:18 +0200 Subject: [PATCH] [NOJANG] New GameRules API to access game rules in mods and fix paper command issues with LuckPerms --- .../nojang/server/BridgedMinecraftServer.java | 6 + .../nojang/world/level/BridgedGameRules.java | 103 ++++++++++++++++++ 1.18.2/changelog.md | 9 +- 1.18.2/gradle.properties | 4 +- .../nojang/server/BridgedMinecraftServer.java | 6 + .../nojang/world/level/BridgedGameRules.java | 103 ++++++++++++++++++ 1.19.2/changelog.md | 9 +- 1.19.2/gradle.properties | 4 +- .../nojang/server/BridgedMinecraftServer.java | 6 + .../nojang/world/level/BridgedGameRules.java | 103 ++++++++++++++++++ .../Paper/src/main/resources/paper-plugin.yml | 12 ++ 1.19.3/changelog.md | 9 +- 1.19.3/gradle.properties | 4 +- .../nojang/server/BridgedMinecraftServer.java | 6 + .../nojang/world/level/BridgedGameRules.java | 103 ++++++++++++++++++ .../Paper/src/main/resources/paper-plugin.yml | 12 ++ 1.20.2/changelog.md | 9 +- 1.20.2/gradle.properties | 4 +- .../nojang/server/BridgedMinecraftServer.java | 6 + .../nojang/world/level/BridgedGameRules.java | 103 ++++++++++++++++++ .../Paper/src/main/resources/paper-plugin.yml | 12 ++ 1.20.4/changelog.md | 9 +- 1.20.4/gradle.properties | 4 +- .../nojang/server/BridgedMinecraftServer.java | 6 + .../nojang/world/level/BridgedGameRules.java | 103 ++++++++++++++++++ .../Paper/src/main/resources/paper-plugin.yml | 12 ++ 1.20/changelog.md | 10 +- 1.20/gradle.properties | 4 +- .../nojang/server/BridgedMinecraftServer.java | 6 + .../nojang/world/level/BridgedGameRules.java | 103 ++++++++++++++++++ .../Paper/src/main/resources/paper-plugin.yml | 14 ++- 1.21.2/changelog.md | 9 +- 1.21.2/gradle.properties | 4 +- 1.21.2/settings.gradle | 3 +- .../nojang/server/BridgedMinecraftServer.java | 6 + .../nojang/world/level/BridgedGameRules.java | 103 ++++++++++++++++++ .../Paper/src/main/resources/paper-plugin.yml | 12 ++ 1.21/changelog.md | 9 +- 1.21/gradle.properties | 6 +- 1.21/settings.gradle | 3 +- commit.sha | 2 +- .../server/BridgedMinecraftServer.java.patch | 6 +- .../world/level/BridgedGameRules.java.patch | 90 +++++++++++++++ .../src/main/resources/paper-plugin.yml.patch | 14 ++- .../world/level/BridgedGameRules.java.patch | 86 +++++++++++++++ .../src/main/resources/paper-plugin.yml.patch | 14 ++- .../world/level/BridgedGameRules.java.patch | 69 ++++++++++++ .../src/main/resources/paper-plugin.yml.patch | 3 +- .../world/level/BridgedGameRules.java.patch | 67 ++++++++++++ .../src/main/resources/paper-plugin.yml.patch | 3 +- .../world/level/BridgedGameRules.java.patch | 45 ++++++++ .../src/main/resources/paper-plugin.yml.patch | 3 +- .../world/level/BridgedGameRules.java.patch | 69 ++++++++++++ .../src/main/resources/paper-plugin.yml.patch | 3 +- patches/1.20/changelog.md.patch | 10 ++ .../world/level/BridgedGameRules.java.patch | 32 ++++++ patches/1.21.2/settings.gradle.patch | 4 +- .../world/level/BridgedGameRules.java.patch | 44 ++++++++ .../src/main/resources/paper-plugin.yml.patch | 3 +- patches/1.21/gradle.properties.patch | 9 +- patches/1.21/settings.gradle.patch | 4 +- 61 files changed, 1545 insertions(+), 94 deletions(-) create mode 100644 1.18.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java create mode 100644 1.19.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java create mode 100644 1.19.3/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java create mode 100644 1.20.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java create mode 100644 1.20.4/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java create mode 100644 1.20/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java create mode 100644 1.21.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java create mode 100644 1.21/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java create mode 100644 patches/1.18.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch create mode 100644 patches/1.19.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch create mode 100644 patches/1.19.3/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch create mode 100644 patches/1.20.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch create mode 100644 patches/1.20.4/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch create mode 100644 patches/1.20/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch create mode 100644 patches/1.20/changelog.md.patch create mode 100644 patches/1.21.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch create mode 100644 patches/1.21/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch diff --git a/1.18.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java b/1.18.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java index dd851aa..f173d0e 100644 --- a/1.18.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java +++ b/1.18.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java @@ -1,8 +1,10 @@ package com.hypherionmc.craterlib.nojang.server; import com.hypherionmc.craterlib.nojang.authlib.BridgedGameProfile; +import com.hypherionmc.craterlib.nojang.client.multiplayer.BridgedClientLevel; import com.hypherionmc.craterlib.nojang.commands.BridgedFakePlayer; import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer; +import com.hypherionmc.craterlib.nojang.world.level.BridgedGameRules; import com.hypherionmc.craterlib.utils.ChatUtils; import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.Component; @@ -78,6 +80,10 @@ public class BridgedMinecraftServer { return profiles; } + public BridgedGameRules getGameRules() { + return BridgedGameRules.bridge(internal.getGameRules()); + } + public void banPlayer(BridgedGameProfile profile) { internal.getPlayerList().getBans().add(new UserBanListEntry(profile.toMojang())); } diff --git a/1.18.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java b/1.18.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java new file mode 100644 index 0000000..b543409 --- /dev/null +++ b/1.18.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java @@ -0,0 +1,103 @@ +package com.hypherionmc.craterlib.nojang.world.level; + +import lombok.RequiredArgsConstructor; +import net.minecraft.world.level.GameRules; + +@RequiredArgsConstructor(staticName = "bridge") +public class BridgedGameRules { + + private final GameRules internal; + + // Wrapped Mojang Rules for convenience + public static final WrappedBooleanKey RULE_DOFIRETICK = WrappedBooleanKey.wrap(GameRules.RULE_DOFIRETICK); + public static final WrappedBooleanKey RULE_ALLOWFIRETICKAWAYFROMPLAYERS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_MOBGRIEFING = WrappedBooleanKey.wrap(GameRules.RULE_MOBGRIEFING); + public static final WrappedBooleanKey RULE_KEEPINVENTORY = WrappedBooleanKey.wrap(GameRules.RULE_KEEPINVENTORY); + public static final WrappedBooleanKey RULE_DOMOBSPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBSPAWNING); + public static final WrappedBooleanKey RULE_DOMOBLOOT = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBLOOT); + public static final WrappedBooleanKey RULE_PROJECTILESCANBREAKBLOCKS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DOBLOCKDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOBLOCKDROPS); + public static final WrappedBooleanKey RULE_DOENTITYDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOENTITYDROPS); + public static final WrappedBooleanKey RULE_COMMANDBLOCKOUTPUT = WrappedBooleanKey.wrap(GameRules.RULE_COMMANDBLOCKOUTPUT); + public static final WrappedBooleanKey RULE_NATURAL_REGENERATION = WrappedBooleanKey.wrap(GameRules.RULE_NATURAL_REGENERATION); + public static final WrappedBooleanKey RULE_DAYLIGHT = WrappedBooleanKey.wrap(GameRules.RULE_DAYLIGHT); + public static final WrappedBooleanKey RULE_LOGADMINCOMMANDS = WrappedBooleanKey.wrap(GameRules.RULE_LOGADMINCOMMANDS); + public static final WrappedBooleanKey RULE_SHOWDEATHMESSAGES = WrappedBooleanKey.wrap(GameRules.RULE_SHOWDEATHMESSAGES); + public static final WrappedIntegerKey RULE_RANDOMTICKING = WrappedIntegerKey.wrap(GameRules.RULE_RANDOMTICKING); + public static final WrappedBooleanKey RULE_SENDCOMMANDFEEDBACK = WrappedBooleanKey.wrap(GameRules.RULE_SENDCOMMANDFEEDBACK); + public static final WrappedBooleanKey RULE_REDUCEDDEBUGINFO = WrappedBooleanKey.wrap(GameRules.RULE_REDUCEDDEBUGINFO); + public static final WrappedBooleanKey RULE_SPECTATORSGENERATECHUNKS = WrappedBooleanKey.wrap(GameRules.RULE_SPECTATORSGENERATECHUNKS); + public static final WrappedIntegerKey RULE_SPAWN_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_RADIUS); + public static final WrappedBooleanKey RULE_DISABLE_PLAYER_MOVEMENT_CHECK = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DISABLE_ELYTRA_MOVEMENT_CHECK = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK); + public static final WrappedIntegerKey RULE_MAX_ENTITY_CRAMMING = WrappedIntegerKey.wrap(GameRules.RULE_MAX_ENTITY_CRAMMING); + public static final WrappedBooleanKey RULE_WEATHER_CYCLE = WrappedBooleanKey.wrap(GameRules.RULE_WEATHER_CYCLE); + public static final WrappedBooleanKey RULE_LIMITED_CRAFTING = WrappedBooleanKey.wrap(GameRules.RULE_LIMITED_CRAFTING); + public static final WrappedIntegerKey RULE_MAX_COMMAND_CHAIN_LENGTH = WrappedIntegerKey.wrap(GameRules.RULE_MAX_COMMAND_CHAIN_LENGTH); + public static final WrappedIntegerKey RULE_MAX_COMMAND_FORK_COUNT = WrappedIntegerKey.wrap(null); + public static final WrappedIntegerKey RULE_COMMAND_MODIFICATION_BLOCK_LIMIT = WrappedIntegerKey.wrap(null); + public static final WrappedBooleanKey RULE_ANNOUNCE_ADVANCEMENTS = WrappedBooleanKey.wrap(GameRules.RULE_ANNOUNCE_ADVANCEMENTS); + public static final WrappedBooleanKey RULE_DISABLE_RAIDS = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_RAIDS); + public static final WrappedBooleanKey RULE_DOINSOMNIA = WrappedBooleanKey.wrap(GameRules.RULE_DOINSOMNIA); + public static final WrappedBooleanKey RULE_DO_IMMEDIATE_RESPAWN = WrappedBooleanKey.wrap(GameRules.RULE_DO_IMMEDIATE_RESPAWN); + public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY = WrappedIntegerKey.wrap(null); + public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY = WrappedIntegerKey.wrap(null); + public static final WrappedBooleanKey RULE_DROWNING_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_DROWNING_DAMAGE); + public static final WrappedBooleanKey RULE_FALL_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FALL_DAMAGE); + public static final WrappedBooleanKey RULE_FIRE_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FIRE_DAMAGE); + public static final WrappedBooleanKey RULE_FREEZE_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FREEZE_DAMAGE); + public static final WrappedBooleanKey RULE_DO_PATROL_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_PATROL_SPAWNING); + public static final WrappedBooleanKey RULE_DO_TRADER_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_TRADER_SPAWNING); + public static final WrappedBooleanKey RULE_DO_WARDEN_SPAWNING = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_FORGIVE_DEAD_PLAYERS = WrappedBooleanKey.wrap(GameRules.RULE_FORGIVE_DEAD_PLAYERS); + public static final WrappedBooleanKey RULE_UNIVERSAL_ANGER = WrappedBooleanKey.wrap(GameRules.RULE_UNIVERSAL_ANGER); + public static final WrappedIntegerKey RULE_PLAYERS_SLEEPING_PERCENTAGE = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); + public static final WrappedBooleanKey RULE_BLOCK_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_MOB_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_TNT_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(null); + public static final WrappedIntegerKey RULE_SNOW_ACCUMULATION_HEIGHT = WrappedIntegerKey.wrap(null); + public static final WrappedBooleanKey RULE_WATER_SOURCE_CONVERSION = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_LAVA_SOURCE_CONVERSION = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_GLOBAL_SOUND_EVENTS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DO_VINES_SPREAD = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_ENDER_PEARLS_VANISH_ON_DEATH = WrappedBooleanKey.wrap(null); + public static final WrappedIntegerKey RULE_MINECART_MAX_SPEED = WrappedIntegerKey.wrap(null); + public static final WrappedIntegerKey RULE_SPAWN_CHUNK_RADIUS = WrappedIntegerKey.wrap(null); + public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(null); + + public boolean getBoolean(WrappedBooleanKey key) { + if (key.toMojang() == null) + return false; + + return internal.getBoolean(key.toMojang()); + } + + public int getInt(WrappedIntegerKey key) { + if (key.toMojang() == null) + return 0; + + return internal.getInt(key.toMojang()); + } + + public GameRules toMojang() { + return internal; + } + + @RequiredArgsConstructor(staticName = "wrap") + public static final class WrappedBooleanKey { + private final GameRules.Key internal; + + public GameRules.Key toMojang() { + return internal; + } + } + + @RequiredArgsConstructor(staticName = "wrap") + public static final class WrappedIntegerKey { + private final GameRules.Key internal; + + public GameRules.Key toMojang() { + return internal; + } + } +} diff --git a/1.18.2/changelog.md b/1.18.2/changelog.md index 1e6ff6e..d38a3f6 100644 --- a/1.18.2/changelog.md +++ b/1.18.2/changelog.md @@ -1,12 +1,7 @@ **Bug Fixes**: -- Added a workaround for LuckPerms turning players into ghost players -- Fixed Missing Getters on LuckPerms events +- Fixed LuckPerms breaking commands on Paper **New Features**: -- Swapped Built In Config screen for a Cloth Config System, so client side mods can have in-game configs -- Added new APIs for Simple RPC (V4 rewrite) -- Added new APIs for getting player information from Commands -- Added Compat API for Player Revive Mod -- Added new APIs to know when the Minecraft Whitelist changes \ No newline at end of file +- Added Nojang API to allow mods to access GameRules (SDLink) \ No newline at end of file diff --git a/1.18.2/gradle.properties b/1.18.2/gradle.properties index 3b3329f..d4763f2 100644 --- a/1.18.2/gradle.properties +++ b/1.18.2/gradle.properties @@ -1,8 +1,8 @@ #Project version_major=2 version_minor=1 -version_patch=3 -version_build=1 +version_patch=4 +version_build=0 #Mod mod_author=HypherionSA diff --git a/1.19.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java b/1.19.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java index cb818b7..7bc4ea5 100644 --- a/1.19.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java +++ b/1.19.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java @@ -1,8 +1,10 @@ package com.hypherionmc.craterlib.nojang.server; import com.hypherionmc.craterlib.nojang.authlib.BridgedGameProfile; +import com.hypherionmc.craterlib.nojang.client.multiplayer.BridgedClientLevel; import com.hypherionmc.craterlib.nojang.commands.BridgedFakePlayer; import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer; +import com.hypherionmc.craterlib.nojang.world.level.BridgedGameRules; import com.hypherionmc.craterlib.utils.ChatUtils; import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.Component; @@ -76,6 +78,10 @@ public class BridgedMinecraftServer { return profiles; } + public BridgedGameRules getGameRules() { + return BridgedGameRules.bridge(internal.getGameRules()); + } + public void banPlayer(BridgedGameProfile profile) { internal.getPlayerList().getBans().add(new UserBanListEntry(profile.toMojang())); } diff --git a/1.19.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java b/1.19.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java new file mode 100644 index 0000000..5286772 --- /dev/null +++ b/1.19.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java @@ -0,0 +1,103 @@ +package com.hypherionmc.craterlib.nojang.world.level; + +import lombok.RequiredArgsConstructor; +import net.minecraft.world.level.GameRules; + +@RequiredArgsConstructor(staticName = "bridge") +public class BridgedGameRules { + + private final GameRules internal; + + // Wrapped Mojang Rules for convenience + public static final WrappedBooleanKey RULE_DOFIRETICK = WrappedBooleanKey.wrap(GameRules.RULE_DOFIRETICK); + public static final WrappedBooleanKey RULE_ALLOWFIRETICKAWAYFROMPLAYERS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_MOBGRIEFING = WrappedBooleanKey.wrap(GameRules.RULE_MOBGRIEFING); + public static final WrappedBooleanKey RULE_KEEPINVENTORY = WrappedBooleanKey.wrap(GameRules.RULE_KEEPINVENTORY); + public static final WrappedBooleanKey RULE_DOMOBSPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBSPAWNING); + public static final WrappedBooleanKey RULE_DOMOBLOOT = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBLOOT); + public static final WrappedBooleanKey RULE_PROJECTILESCANBREAKBLOCKS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DOBLOCKDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOBLOCKDROPS); + public static final WrappedBooleanKey RULE_DOENTITYDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOENTITYDROPS); + public static final WrappedBooleanKey RULE_COMMANDBLOCKOUTPUT = WrappedBooleanKey.wrap(GameRules.RULE_COMMANDBLOCKOUTPUT); + public static final WrappedBooleanKey RULE_NATURAL_REGENERATION = WrappedBooleanKey.wrap(GameRules.RULE_NATURAL_REGENERATION); + public static final WrappedBooleanKey RULE_DAYLIGHT = WrappedBooleanKey.wrap(GameRules.RULE_DAYLIGHT); + public static final WrappedBooleanKey RULE_LOGADMINCOMMANDS = WrappedBooleanKey.wrap(GameRules.RULE_LOGADMINCOMMANDS); + public static final WrappedBooleanKey RULE_SHOWDEATHMESSAGES = WrappedBooleanKey.wrap(GameRules.RULE_SHOWDEATHMESSAGES); + public static final WrappedIntegerKey RULE_RANDOMTICKING = WrappedIntegerKey.wrap(GameRules.RULE_RANDOMTICKING); + public static final WrappedBooleanKey RULE_SENDCOMMANDFEEDBACK = WrappedBooleanKey.wrap(GameRules.RULE_SENDCOMMANDFEEDBACK); + public static final WrappedBooleanKey RULE_REDUCEDDEBUGINFO = WrappedBooleanKey.wrap(GameRules.RULE_REDUCEDDEBUGINFO); + public static final WrappedBooleanKey RULE_SPECTATORSGENERATECHUNKS = WrappedBooleanKey.wrap(GameRules.RULE_SPECTATORSGENERATECHUNKS); + public static final WrappedIntegerKey RULE_SPAWN_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_RADIUS); + public static final WrappedBooleanKey RULE_DISABLE_PLAYER_MOVEMENT_CHECK = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DISABLE_ELYTRA_MOVEMENT_CHECK = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK); + public static final WrappedIntegerKey RULE_MAX_ENTITY_CRAMMING = WrappedIntegerKey.wrap(GameRules.RULE_MAX_ENTITY_CRAMMING); + public static final WrappedBooleanKey RULE_WEATHER_CYCLE = WrappedBooleanKey.wrap(GameRules.RULE_WEATHER_CYCLE); + public static final WrappedBooleanKey RULE_LIMITED_CRAFTING = WrappedBooleanKey.wrap(GameRules.RULE_LIMITED_CRAFTING); + public static final WrappedIntegerKey RULE_MAX_COMMAND_CHAIN_LENGTH = WrappedIntegerKey.wrap(GameRules.RULE_MAX_COMMAND_CHAIN_LENGTH); + public static final WrappedIntegerKey RULE_MAX_COMMAND_FORK_COUNT = WrappedIntegerKey.wrap(null); + public static final WrappedIntegerKey RULE_COMMAND_MODIFICATION_BLOCK_LIMIT = WrappedIntegerKey.wrap(null); + public static final WrappedBooleanKey RULE_ANNOUNCE_ADVANCEMENTS = WrappedBooleanKey.wrap(GameRules.RULE_ANNOUNCE_ADVANCEMENTS); + public static final WrappedBooleanKey RULE_DISABLE_RAIDS = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_RAIDS); + public static final WrappedBooleanKey RULE_DOINSOMNIA = WrappedBooleanKey.wrap(GameRules.RULE_DOINSOMNIA); + public static final WrappedBooleanKey RULE_DO_IMMEDIATE_RESPAWN = WrappedBooleanKey.wrap(GameRules.RULE_DO_IMMEDIATE_RESPAWN); + public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY = WrappedIntegerKey.wrap(null); + public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY = WrappedIntegerKey.wrap(null); + public static final WrappedBooleanKey RULE_DROWNING_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_DROWNING_DAMAGE); + public static final WrappedBooleanKey RULE_FALL_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FALL_DAMAGE); + public static final WrappedBooleanKey RULE_FIRE_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FIRE_DAMAGE); + public static final WrappedBooleanKey RULE_FREEZE_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FREEZE_DAMAGE); + public static final WrappedBooleanKey RULE_DO_PATROL_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_PATROL_SPAWNING); + public static final WrappedBooleanKey RULE_DO_TRADER_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_TRADER_SPAWNING); + public static final WrappedBooleanKey RULE_DO_WARDEN_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_WARDEN_SPAWNING); + public static final WrappedBooleanKey RULE_FORGIVE_DEAD_PLAYERS = WrappedBooleanKey.wrap(GameRules.RULE_FORGIVE_DEAD_PLAYERS); + public static final WrappedBooleanKey RULE_UNIVERSAL_ANGER = WrappedBooleanKey.wrap(GameRules.RULE_UNIVERSAL_ANGER); + public static final WrappedIntegerKey RULE_PLAYERS_SLEEPING_PERCENTAGE = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); + public static final WrappedBooleanKey RULE_BLOCK_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_MOB_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_TNT_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(null); + public static final WrappedIntegerKey RULE_SNOW_ACCUMULATION_HEIGHT = WrappedIntegerKey.wrap(null); + public static final WrappedBooleanKey RULE_WATER_SOURCE_CONVERSION = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_LAVA_SOURCE_CONVERSION = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_GLOBAL_SOUND_EVENTS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DO_VINES_SPREAD = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_ENDER_PEARLS_VANISH_ON_DEATH = WrappedBooleanKey.wrap(null); + public static final WrappedIntegerKey RULE_MINECART_MAX_SPEED = WrappedIntegerKey.wrap(null); + public static final WrappedIntegerKey RULE_SPAWN_CHUNK_RADIUS = WrappedIntegerKey.wrap(null); + public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(null); + + public boolean getBoolean(WrappedBooleanKey key) { + if (key.toMojang() == null) + return false; + + return internal.getBoolean(key.toMojang()); + } + + public int getInt(WrappedIntegerKey key) { + if (key.toMojang() == null) + return 0; + + return internal.getInt(key.toMojang()); + } + + public GameRules toMojang() { + return internal; + } + + @RequiredArgsConstructor(staticName = "wrap") + public static final class WrappedBooleanKey { + private final GameRules.Key internal; + + public GameRules.Key toMojang() { + return internal; + } + } + + @RequiredArgsConstructor(staticName = "wrap") + public static final class WrappedIntegerKey { + private final GameRules.Key internal; + + public GameRules.Key toMojang() { + return internal; + } + } +} diff --git a/1.19.2/changelog.md b/1.19.2/changelog.md index 1e6ff6e..d38a3f6 100644 --- a/1.19.2/changelog.md +++ b/1.19.2/changelog.md @@ -1,12 +1,7 @@ **Bug Fixes**: -- Added a workaround for LuckPerms turning players into ghost players -- Fixed Missing Getters on LuckPerms events +- Fixed LuckPerms breaking commands on Paper **New Features**: -- Swapped Built In Config screen for a Cloth Config System, so client side mods can have in-game configs -- Added new APIs for Simple RPC (V4 rewrite) -- Added new APIs for getting player information from Commands -- Added Compat API for Player Revive Mod -- Added new APIs to know when the Minecraft Whitelist changes \ No newline at end of file +- Added Nojang API to allow mods to access GameRules (SDLink) \ No newline at end of file diff --git a/1.19.2/gradle.properties b/1.19.2/gradle.properties index a97f913..ca6b331 100644 --- a/1.19.2/gradle.properties +++ b/1.19.2/gradle.properties @@ -1,8 +1,8 @@ #Project version_major=2 version_minor=1 -version_patch=3 -version_build=1 +version_patch=4 +version_build=0 #Mod mod_author=HypherionSA diff --git a/1.19.3/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java b/1.19.3/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java index cb818b7..7bc4ea5 100644 --- a/1.19.3/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java +++ b/1.19.3/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java @@ -1,8 +1,10 @@ package com.hypherionmc.craterlib.nojang.server; import com.hypherionmc.craterlib.nojang.authlib.BridgedGameProfile; +import com.hypherionmc.craterlib.nojang.client.multiplayer.BridgedClientLevel; import com.hypherionmc.craterlib.nojang.commands.BridgedFakePlayer; import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer; +import com.hypherionmc.craterlib.nojang.world.level.BridgedGameRules; import com.hypherionmc.craterlib.utils.ChatUtils; import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.Component; @@ -76,6 +78,10 @@ public class BridgedMinecraftServer { return profiles; } + public BridgedGameRules getGameRules() { + return BridgedGameRules.bridge(internal.getGameRules()); + } + public void banPlayer(BridgedGameProfile profile) { internal.getPlayerList().getBans().add(new UserBanListEntry(profile.toMojang())); } diff --git a/1.19.3/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java b/1.19.3/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java new file mode 100644 index 0000000..bef0356 --- /dev/null +++ b/1.19.3/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java @@ -0,0 +1,103 @@ +package com.hypherionmc.craterlib.nojang.world.level; + +import lombok.RequiredArgsConstructor; +import net.minecraft.world.level.GameRules; + +@RequiredArgsConstructor(staticName = "bridge") +public class BridgedGameRules { + + private final GameRules internal; + + // Wrapped Mojang Rules for convenience + public static final WrappedBooleanKey RULE_DOFIRETICK = WrappedBooleanKey.wrap(GameRules.RULE_DOFIRETICK); + public static final WrappedBooleanKey RULE_ALLOWFIRETICKAWAYFROMPLAYERS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_MOBGRIEFING = WrappedBooleanKey.wrap(GameRules.RULE_MOBGRIEFING); + public static final WrappedBooleanKey RULE_KEEPINVENTORY = WrappedBooleanKey.wrap(GameRules.RULE_KEEPINVENTORY); + public static final WrappedBooleanKey RULE_DOMOBSPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBSPAWNING); + public static final WrappedBooleanKey RULE_DOMOBLOOT = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBLOOT); + public static final WrappedBooleanKey RULE_PROJECTILESCANBREAKBLOCKS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DOBLOCKDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOBLOCKDROPS); + public static final WrappedBooleanKey RULE_DOENTITYDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOENTITYDROPS); + public static final WrappedBooleanKey RULE_COMMANDBLOCKOUTPUT = WrappedBooleanKey.wrap(GameRules.RULE_COMMANDBLOCKOUTPUT); + public static final WrappedBooleanKey RULE_NATURAL_REGENERATION = WrappedBooleanKey.wrap(GameRules.RULE_NATURAL_REGENERATION); + public static final WrappedBooleanKey RULE_DAYLIGHT = WrappedBooleanKey.wrap(GameRules.RULE_DAYLIGHT); + public static final WrappedBooleanKey RULE_LOGADMINCOMMANDS = WrappedBooleanKey.wrap(GameRules.RULE_LOGADMINCOMMANDS); + public static final WrappedBooleanKey RULE_SHOWDEATHMESSAGES = WrappedBooleanKey.wrap(GameRules.RULE_SHOWDEATHMESSAGES); + public static final WrappedIntegerKey RULE_RANDOMTICKING = WrappedIntegerKey.wrap(GameRules.RULE_RANDOMTICKING); + public static final WrappedBooleanKey RULE_SENDCOMMANDFEEDBACK = WrappedBooleanKey.wrap(GameRules.RULE_SENDCOMMANDFEEDBACK); + public static final WrappedBooleanKey RULE_REDUCEDDEBUGINFO = WrappedBooleanKey.wrap(GameRules.RULE_REDUCEDDEBUGINFO); + public static final WrappedBooleanKey RULE_SPECTATORSGENERATECHUNKS = WrappedBooleanKey.wrap(GameRules.RULE_SPECTATORSGENERATECHUNKS); + public static final WrappedIntegerKey RULE_SPAWN_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_RADIUS); + public static final WrappedBooleanKey RULE_DISABLE_PLAYER_MOVEMENT_CHECK = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DISABLE_ELYTRA_MOVEMENT_CHECK = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK); + public static final WrappedIntegerKey RULE_MAX_ENTITY_CRAMMING = WrappedIntegerKey.wrap(GameRules.RULE_MAX_ENTITY_CRAMMING); + public static final WrappedBooleanKey RULE_WEATHER_CYCLE = WrappedBooleanKey.wrap(GameRules.RULE_WEATHER_CYCLE); + public static final WrappedBooleanKey RULE_LIMITED_CRAFTING = WrappedBooleanKey.wrap(GameRules.RULE_LIMITED_CRAFTING); + public static final WrappedIntegerKey RULE_MAX_COMMAND_CHAIN_LENGTH = WrappedIntegerKey.wrap(GameRules.RULE_MAX_COMMAND_CHAIN_LENGTH); + public static final WrappedIntegerKey RULE_MAX_COMMAND_FORK_COUNT = WrappedIntegerKey.wrap(null); + public static final WrappedIntegerKey RULE_COMMAND_MODIFICATION_BLOCK_LIMIT = WrappedIntegerKey.wrap(GameRules.RULE_COMMAND_MODIFICATION_BLOCK_LIMIT); + public static final WrappedBooleanKey RULE_ANNOUNCE_ADVANCEMENTS = WrappedBooleanKey.wrap(GameRules.RULE_ANNOUNCE_ADVANCEMENTS); + public static final WrappedBooleanKey RULE_DISABLE_RAIDS = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_RAIDS); + public static final WrappedBooleanKey RULE_DOINSOMNIA = WrappedBooleanKey.wrap(GameRules.RULE_DOINSOMNIA); + public static final WrappedBooleanKey RULE_DO_IMMEDIATE_RESPAWN = WrappedBooleanKey.wrap(GameRules.RULE_DO_IMMEDIATE_RESPAWN); + public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY = WrappedIntegerKey.wrap(null); + public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY = WrappedIntegerKey.wrap(null); + public static final WrappedBooleanKey RULE_DROWNING_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_DROWNING_DAMAGE); + public static final WrappedBooleanKey RULE_FALL_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FALL_DAMAGE); + public static final WrappedBooleanKey RULE_FIRE_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FIRE_DAMAGE); + public static final WrappedBooleanKey RULE_FREEZE_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FREEZE_DAMAGE); + public static final WrappedBooleanKey RULE_DO_PATROL_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_PATROL_SPAWNING); + public static final WrappedBooleanKey RULE_DO_TRADER_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_TRADER_SPAWNING); + public static final WrappedBooleanKey RULE_DO_WARDEN_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_WARDEN_SPAWNING); + public static final WrappedBooleanKey RULE_FORGIVE_DEAD_PLAYERS = WrappedBooleanKey.wrap(GameRules.RULE_FORGIVE_DEAD_PLAYERS); + public static final WrappedBooleanKey RULE_UNIVERSAL_ANGER = WrappedBooleanKey.wrap(GameRules.RULE_UNIVERSAL_ANGER); + public static final WrappedIntegerKey RULE_PLAYERS_SLEEPING_PERCENTAGE = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); + public static final WrappedBooleanKey RULE_BLOCK_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(GameRules.RULE_BLOCK_EXPLOSION_DROP_DECAY); + public static final WrappedBooleanKey RULE_MOB_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(GameRules.RULE_MOB_EXPLOSION_DROP_DECAY); + public static final WrappedBooleanKey RULE_TNT_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(GameRules.RULE_TNT_EXPLOSION_DROP_DECAY); + public static final WrappedIntegerKey RULE_SNOW_ACCUMULATION_HEIGHT = WrappedIntegerKey.wrap(GameRules.RULE_SNOW_ACCUMULATION_HEIGHT); + public static final WrappedBooleanKey RULE_WATER_SOURCE_CONVERSION = WrappedBooleanKey.wrap(GameRules.RULE_WATER_SOURCE_CONVERSION); + public static final WrappedBooleanKey RULE_LAVA_SOURCE_CONVERSION = WrappedBooleanKey.wrap(GameRules.RULE_LAVA_SOURCE_CONVERSION); + public static final WrappedBooleanKey RULE_GLOBAL_SOUND_EVENTS = WrappedBooleanKey.wrap(GameRules.RULE_GLOBAL_SOUND_EVENTS); + public static final WrappedBooleanKey RULE_DO_VINES_SPREAD = WrappedBooleanKey.wrap(GameRules.RULE_DO_VINES_SPREAD); + public static final WrappedBooleanKey RULE_ENDER_PEARLS_VANISH_ON_DEATH = WrappedBooleanKey.wrap(null); + public static final WrappedIntegerKey RULE_MINECART_MAX_SPEED = WrappedIntegerKey.wrap(null); + public static final WrappedIntegerKey RULE_SPAWN_CHUNK_RADIUS = WrappedIntegerKey.wrap(null); + public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(null); + + public boolean getBoolean(WrappedBooleanKey key) { + if (key.toMojang() == null) + return false; + + return internal.getBoolean(key.toMojang()); + } + + public int getInt(WrappedIntegerKey key) { + if (key.toMojang() == null) + return 0; + + return internal.getInt(key.toMojang()); + } + + public GameRules toMojang() { + return internal; + } + + @RequiredArgsConstructor(staticName = "wrap") + public static final class WrappedBooleanKey { + private final GameRules.Key internal; + + public GameRules.Key toMojang() { + return internal; + } + } + + @RequiredArgsConstructor(staticName = "wrap") + public static final class WrappedIntegerKey { + private final GameRules.Key internal; + + public GameRules.Key toMojang() { + return internal; + } + } +} diff --git a/1.19.3/Paper/src/main/resources/paper-plugin.yml b/1.19.3/Paper/src/main/resources/paper-plugin.yml index 5c3758e..7ef801e 100644 --- a/1.19.3/Paper/src/main/resources/paper-plugin.yml +++ b/1.19.3/Paper/src/main/resources/paper-plugin.yml @@ -6,3 +6,15 @@ author: HypherionSA api-version: '1.19' bootstrapper: com.hypherionmc.craterlib.paper.CraterLibBootstrap load: STARTUP + +dependencies: + bootstrap: + LuckPerms: + load: BEFORE + required: false + join-classpath: true + server: + LuckPerms: + load: BEFORE + required: false + join-classpath: true diff --git a/1.19.3/changelog.md b/1.19.3/changelog.md index 1e6ff6e..d38a3f6 100644 --- a/1.19.3/changelog.md +++ b/1.19.3/changelog.md @@ -1,12 +1,7 @@ **Bug Fixes**: -- Added a workaround for LuckPerms turning players into ghost players -- Fixed Missing Getters on LuckPerms events +- Fixed LuckPerms breaking commands on Paper **New Features**: -- Swapped Built In Config screen for a Cloth Config System, so client side mods can have in-game configs -- Added new APIs for Simple RPC (V4 rewrite) -- Added new APIs for getting player information from Commands -- Added Compat API for Player Revive Mod -- Added new APIs to know when the Minecraft Whitelist changes \ No newline at end of file +- Added Nojang API to allow mods to access GameRules (SDLink) \ No newline at end of file diff --git a/1.19.3/gradle.properties b/1.19.3/gradle.properties index 982f32b..df194bc 100644 --- a/1.19.3/gradle.properties +++ b/1.19.3/gradle.properties @@ -1,8 +1,8 @@ #Project version_major=2 version_minor=1 -version_patch=3 -version_build=1 +version_patch=4 +version_build=0 #Mod mod_author=HypherionSA diff --git a/1.20.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java b/1.20.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java index cb818b7..7bc4ea5 100644 --- a/1.20.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java +++ b/1.20.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java @@ -1,8 +1,10 @@ package com.hypherionmc.craterlib.nojang.server; import com.hypherionmc.craterlib.nojang.authlib.BridgedGameProfile; +import com.hypherionmc.craterlib.nojang.client.multiplayer.BridgedClientLevel; import com.hypherionmc.craterlib.nojang.commands.BridgedFakePlayer; import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer; +import com.hypherionmc.craterlib.nojang.world.level.BridgedGameRules; import com.hypherionmc.craterlib.utils.ChatUtils; import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.Component; @@ -76,6 +78,10 @@ public class BridgedMinecraftServer { return profiles; } + public BridgedGameRules getGameRules() { + return BridgedGameRules.bridge(internal.getGameRules()); + } + public void banPlayer(BridgedGameProfile profile) { internal.getPlayerList().getBans().add(new UserBanListEntry(profile.toMojang())); } diff --git a/1.20.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java b/1.20.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java new file mode 100644 index 0000000..7b77589 --- /dev/null +++ b/1.20.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java @@ -0,0 +1,103 @@ +package com.hypherionmc.craterlib.nojang.world.level; + +import lombok.RequiredArgsConstructor; +import net.minecraft.world.level.GameRules; + +@RequiredArgsConstructor(staticName = "bridge") +public class BridgedGameRules { + + private final GameRules internal; + + // Wrapped Mojang Rules for convenience + public static final WrappedBooleanKey RULE_DOFIRETICK = WrappedBooleanKey.wrap(GameRules.RULE_DOFIRETICK); + public static final WrappedBooleanKey RULE_ALLOWFIRETICKAWAYFROMPLAYERS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_MOBGRIEFING = WrappedBooleanKey.wrap(GameRules.RULE_MOBGRIEFING); + public static final WrappedBooleanKey RULE_KEEPINVENTORY = WrappedBooleanKey.wrap(GameRules.RULE_KEEPINVENTORY); + public static final WrappedBooleanKey RULE_DOMOBSPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBSPAWNING); + public static final WrappedBooleanKey RULE_DOMOBLOOT = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBLOOT); + public static final WrappedBooleanKey RULE_PROJECTILESCANBREAKBLOCKS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DOBLOCKDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOBLOCKDROPS); + public static final WrappedBooleanKey RULE_DOENTITYDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOENTITYDROPS); + public static final WrappedBooleanKey RULE_COMMANDBLOCKOUTPUT = WrappedBooleanKey.wrap(GameRules.RULE_COMMANDBLOCKOUTPUT); + public static final WrappedBooleanKey RULE_NATURAL_REGENERATION = WrappedBooleanKey.wrap(GameRules.RULE_NATURAL_REGENERATION); + public static final WrappedBooleanKey RULE_DAYLIGHT = WrappedBooleanKey.wrap(GameRules.RULE_DAYLIGHT); + public static final WrappedBooleanKey RULE_LOGADMINCOMMANDS = WrappedBooleanKey.wrap(GameRules.RULE_LOGADMINCOMMANDS); + public static final WrappedBooleanKey RULE_SHOWDEATHMESSAGES = WrappedBooleanKey.wrap(GameRules.RULE_SHOWDEATHMESSAGES); + public static final WrappedIntegerKey RULE_RANDOMTICKING = WrappedIntegerKey.wrap(GameRules.RULE_RANDOMTICKING); + public static final WrappedBooleanKey RULE_SENDCOMMANDFEEDBACK = WrappedBooleanKey.wrap(GameRules.RULE_SENDCOMMANDFEEDBACK); + public static final WrappedBooleanKey RULE_REDUCEDDEBUGINFO = WrappedBooleanKey.wrap(GameRules.RULE_REDUCEDDEBUGINFO); + public static final WrappedBooleanKey RULE_SPECTATORSGENERATECHUNKS = WrappedBooleanKey.wrap(GameRules.RULE_SPECTATORSGENERATECHUNKS); + public static final WrappedIntegerKey RULE_SPAWN_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_RADIUS); + public static final WrappedBooleanKey RULE_DISABLE_PLAYER_MOVEMENT_CHECK = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DISABLE_ELYTRA_MOVEMENT_CHECK = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK); + public static final WrappedIntegerKey RULE_MAX_ENTITY_CRAMMING = WrappedIntegerKey.wrap(GameRules.RULE_MAX_ENTITY_CRAMMING); + public static final WrappedBooleanKey RULE_WEATHER_CYCLE = WrappedBooleanKey.wrap(GameRules.RULE_WEATHER_CYCLE); + public static final WrappedBooleanKey RULE_LIMITED_CRAFTING = WrappedBooleanKey.wrap(GameRules.RULE_LIMITED_CRAFTING); + public static final WrappedIntegerKey RULE_MAX_COMMAND_CHAIN_LENGTH = WrappedIntegerKey.wrap(GameRules.RULE_MAX_COMMAND_CHAIN_LENGTH); + public static final WrappedIntegerKey RULE_MAX_COMMAND_FORK_COUNT = WrappedIntegerKey.wrap(null); + public static final WrappedIntegerKey RULE_COMMAND_MODIFICATION_BLOCK_LIMIT = WrappedIntegerKey.wrap(GameRules.RULE_COMMAND_MODIFICATION_BLOCK_LIMIT); + public static final WrappedBooleanKey RULE_ANNOUNCE_ADVANCEMENTS = WrappedBooleanKey.wrap(GameRules.RULE_ANNOUNCE_ADVANCEMENTS); + public static final WrappedBooleanKey RULE_DISABLE_RAIDS = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_RAIDS); + public static final WrappedBooleanKey RULE_DOINSOMNIA = WrappedBooleanKey.wrap(GameRules.RULE_DOINSOMNIA); + public static final WrappedBooleanKey RULE_DO_IMMEDIATE_RESPAWN = WrappedBooleanKey.wrap(GameRules.RULE_DO_IMMEDIATE_RESPAWN); + public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY = WrappedIntegerKey.wrap(null); + public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY = WrappedIntegerKey.wrap(null); + public static final WrappedBooleanKey RULE_DROWNING_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_DROWNING_DAMAGE); + public static final WrappedBooleanKey RULE_FALL_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FALL_DAMAGE); + public static final WrappedBooleanKey RULE_FIRE_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FIRE_DAMAGE); + public static final WrappedBooleanKey RULE_FREEZE_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FREEZE_DAMAGE); + public static final WrappedBooleanKey RULE_DO_PATROL_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_PATROL_SPAWNING); + public static final WrappedBooleanKey RULE_DO_TRADER_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_TRADER_SPAWNING); + public static final WrappedBooleanKey RULE_DO_WARDEN_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_WARDEN_SPAWNING); + public static final WrappedBooleanKey RULE_FORGIVE_DEAD_PLAYERS = WrappedBooleanKey.wrap(GameRules.RULE_FORGIVE_DEAD_PLAYERS); + public static final WrappedBooleanKey RULE_UNIVERSAL_ANGER = WrappedBooleanKey.wrap(GameRules.RULE_UNIVERSAL_ANGER); + public static final WrappedIntegerKey RULE_PLAYERS_SLEEPING_PERCENTAGE = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); + public static final WrappedBooleanKey RULE_BLOCK_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(GameRules.RULE_BLOCK_EXPLOSION_DROP_DECAY); + public static final WrappedBooleanKey RULE_MOB_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(GameRules.RULE_MOB_EXPLOSION_DROP_DECAY); + public static final WrappedBooleanKey RULE_TNT_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(GameRules.RULE_TNT_EXPLOSION_DROP_DECAY); + public static final WrappedIntegerKey RULE_SNOW_ACCUMULATION_HEIGHT = WrappedIntegerKey.wrap(GameRules.RULE_SNOW_ACCUMULATION_HEIGHT); + public static final WrappedBooleanKey RULE_WATER_SOURCE_CONVERSION = WrappedBooleanKey.wrap(GameRules.RULE_WATER_SOURCE_CONVERSION); + public static final WrappedBooleanKey RULE_LAVA_SOURCE_CONVERSION = WrappedBooleanKey.wrap(GameRules.RULE_LAVA_SOURCE_CONVERSION); + public static final WrappedBooleanKey RULE_GLOBAL_SOUND_EVENTS = WrappedBooleanKey.wrap(GameRules.RULE_GLOBAL_SOUND_EVENTS); + public static final WrappedBooleanKey RULE_DO_VINES_SPREAD = WrappedBooleanKey.wrap(GameRules.RULE_DO_VINES_SPREAD); + public static final WrappedBooleanKey RULE_ENDER_PEARLS_VANISH_ON_DEATH = WrappedBooleanKey.wrap(GameRules.RULE_ENDER_PEARLS_VANISH_ON_DEATH); + public static final WrappedIntegerKey RULE_MINECART_MAX_SPEED = WrappedIntegerKey.wrap(null); + public static final WrappedIntegerKey RULE_SPAWN_CHUNK_RADIUS = WrappedIntegerKey.wrap(null); + public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(null); + + public boolean getBoolean(WrappedBooleanKey key) { + if (key.toMojang() == null) + return false; + + return internal.getBoolean(key.toMojang()); + } + + public int getInt(WrappedIntegerKey key) { + if (key.toMojang() == null) + return 0; + + return internal.getInt(key.toMojang()); + } + + public GameRules toMojang() { + return internal; + } + + @RequiredArgsConstructor(staticName = "wrap") + public static final class WrappedBooleanKey { + private final GameRules.Key internal; + + public GameRules.Key toMojang() { + return internal; + } + } + + @RequiredArgsConstructor(staticName = "wrap") + public static final class WrappedIntegerKey { + private final GameRules.Key internal; + + public GameRules.Key toMojang() { + return internal; + } + } +} diff --git a/1.20.2/Paper/src/main/resources/paper-plugin.yml b/1.20.2/Paper/src/main/resources/paper-plugin.yml index 50e8646..768e1f7 100644 --- a/1.20.2/Paper/src/main/resources/paper-plugin.yml +++ b/1.20.2/Paper/src/main/resources/paper-plugin.yml @@ -6,3 +6,15 @@ author: HypherionSA api-version: '1.20' bootstrapper: com.hypherionmc.craterlib.paper.CraterLibBootstrap load: STARTUP + +dependencies: + bootstrap: + LuckPerms: + load: BEFORE + required: false + join-classpath: true + server: + LuckPerms: + load: BEFORE + required: false + join-classpath: true diff --git a/1.20.2/changelog.md b/1.20.2/changelog.md index 1e6ff6e..d38a3f6 100644 --- a/1.20.2/changelog.md +++ b/1.20.2/changelog.md @@ -1,12 +1,7 @@ **Bug Fixes**: -- Added a workaround for LuckPerms turning players into ghost players -- Fixed Missing Getters on LuckPerms events +- Fixed LuckPerms breaking commands on Paper **New Features**: -- Swapped Built In Config screen for a Cloth Config System, so client side mods can have in-game configs -- Added new APIs for Simple RPC (V4 rewrite) -- Added new APIs for getting player information from Commands -- Added Compat API for Player Revive Mod -- Added new APIs to know when the Minecraft Whitelist changes \ No newline at end of file +- Added Nojang API to allow mods to access GameRules (SDLink) \ No newline at end of file diff --git a/1.20.2/gradle.properties b/1.20.2/gradle.properties index 4a3cd89..410e9d9 100644 --- a/1.20.2/gradle.properties +++ b/1.20.2/gradle.properties @@ -1,8 +1,8 @@ #Project version_major=2 version_minor=1 -version_patch=3 -version_build=1 +version_patch=4 +version_build=0 #Mod mod_author=HypherionSA diff --git a/1.20.4/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java b/1.20.4/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java index cb818b7..7bc4ea5 100644 --- a/1.20.4/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java +++ b/1.20.4/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java @@ -1,8 +1,10 @@ package com.hypherionmc.craterlib.nojang.server; import com.hypherionmc.craterlib.nojang.authlib.BridgedGameProfile; +import com.hypherionmc.craterlib.nojang.client.multiplayer.BridgedClientLevel; import com.hypherionmc.craterlib.nojang.commands.BridgedFakePlayer; import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer; +import com.hypherionmc.craterlib.nojang.world.level.BridgedGameRules; import com.hypherionmc.craterlib.utils.ChatUtils; import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.Component; @@ -76,6 +78,10 @@ public class BridgedMinecraftServer { return profiles; } + public BridgedGameRules getGameRules() { + return BridgedGameRules.bridge(internal.getGameRules()); + } + public void banPlayer(BridgedGameProfile profile) { internal.getPlayerList().getBans().add(new UserBanListEntry(profile.toMojang())); } diff --git a/1.20.4/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java b/1.20.4/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java new file mode 100644 index 0000000..eea6f80 --- /dev/null +++ b/1.20.4/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java @@ -0,0 +1,103 @@ +package com.hypherionmc.craterlib.nojang.world.level; + +import lombok.RequiredArgsConstructor; +import net.minecraft.world.level.GameRules; + +@RequiredArgsConstructor(staticName = "bridge") +public class BridgedGameRules { + + private final GameRules internal; + + // Wrapped Mojang Rules for convenience + public static final WrappedBooleanKey RULE_DOFIRETICK = WrappedBooleanKey.wrap(GameRules.RULE_DOFIRETICK); + public static final WrappedBooleanKey RULE_ALLOWFIRETICKAWAYFROMPLAYERS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_MOBGRIEFING = WrappedBooleanKey.wrap(GameRules.RULE_MOBGRIEFING); + public static final WrappedBooleanKey RULE_KEEPINVENTORY = WrappedBooleanKey.wrap(GameRules.RULE_KEEPINVENTORY); + public static final WrappedBooleanKey RULE_DOMOBSPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBSPAWNING); + public static final WrappedBooleanKey RULE_DOMOBLOOT = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBLOOT); + public static final WrappedBooleanKey RULE_PROJECTILESCANBREAKBLOCKS = WrappedBooleanKey.wrap(GameRules.RULE_PROJECTILESCANBREAKBLOCKS); + public static final WrappedBooleanKey RULE_DOBLOCKDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOBLOCKDROPS); + public static final WrappedBooleanKey RULE_DOENTITYDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOENTITYDROPS); + public static final WrappedBooleanKey RULE_COMMANDBLOCKOUTPUT = WrappedBooleanKey.wrap(GameRules.RULE_COMMANDBLOCKOUTPUT); + public static final WrappedBooleanKey RULE_NATURAL_REGENERATION = WrappedBooleanKey.wrap(GameRules.RULE_NATURAL_REGENERATION); + public static final WrappedBooleanKey RULE_DAYLIGHT = WrappedBooleanKey.wrap(GameRules.RULE_DAYLIGHT); + public static final WrappedBooleanKey RULE_LOGADMINCOMMANDS = WrappedBooleanKey.wrap(GameRules.RULE_LOGADMINCOMMANDS); + public static final WrappedBooleanKey RULE_SHOWDEATHMESSAGES = WrappedBooleanKey.wrap(GameRules.RULE_SHOWDEATHMESSAGES); + public static final WrappedIntegerKey RULE_RANDOMTICKING = WrappedIntegerKey.wrap(GameRules.RULE_RANDOMTICKING); + public static final WrappedBooleanKey RULE_SENDCOMMANDFEEDBACK = WrappedBooleanKey.wrap(GameRules.RULE_SENDCOMMANDFEEDBACK); + public static final WrappedBooleanKey RULE_REDUCEDDEBUGINFO = WrappedBooleanKey.wrap(GameRules.RULE_REDUCEDDEBUGINFO); + public static final WrappedBooleanKey RULE_SPECTATORSGENERATECHUNKS = WrappedBooleanKey.wrap(GameRules.RULE_SPECTATORSGENERATECHUNKS); + public static final WrappedIntegerKey RULE_SPAWN_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_RADIUS); + public static final WrappedBooleanKey RULE_DISABLE_PLAYER_MOVEMENT_CHECK = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DISABLE_ELYTRA_MOVEMENT_CHECK = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK); + public static final WrappedIntegerKey RULE_MAX_ENTITY_CRAMMING = WrappedIntegerKey.wrap(GameRules.RULE_MAX_ENTITY_CRAMMING); + public static final WrappedBooleanKey RULE_WEATHER_CYCLE = WrappedBooleanKey.wrap(GameRules.RULE_WEATHER_CYCLE); + public static final WrappedBooleanKey RULE_LIMITED_CRAFTING = WrappedBooleanKey.wrap(GameRules.RULE_LIMITED_CRAFTING); + public static final WrappedIntegerKey RULE_MAX_COMMAND_CHAIN_LENGTH = WrappedIntegerKey.wrap(GameRules.RULE_MAX_COMMAND_CHAIN_LENGTH); + public static final WrappedIntegerKey RULE_MAX_COMMAND_FORK_COUNT = WrappedIntegerKey.wrap(GameRules.RULE_MAX_COMMAND_FORK_COUNT); + public static final WrappedIntegerKey RULE_COMMAND_MODIFICATION_BLOCK_LIMIT = WrappedIntegerKey.wrap(GameRules.RULE_COMMAND_MODIFICATION_BLOCK_LIMIT); + public static final WrappedBooleanKey RULE_ANNOUNCE_ADVANCEMENTS = WrappedBooleanKey.wrap(GameRules.RULE_ANNOUNCE_ADVANCEMENTS); + public static final WrappedBooleanKey RULE_DISABLE_RAIDS = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_RAIDS); + public static final WrappedBooleanKey RULE_DOINSOMNIA = WrappedBooleanKey.wrap(GameRules.RULE_DOINSOMNIA); + public static final WrappedBooleanKey RULE_DO_IMMEDIATE_RESPAWN = WrappedBooleanKey.wrap(GameRules.RULE_DO_IMMEDIATE_RESPAWN); + public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY); + public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY); + public static final WrappedBooleanKey RULE_DROWNING_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_DROWNING_DAMAGE); + public static final WrappedBooleanKey RULE_FALL_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FALL_DAMAGE); + public static final WrappedBooleanKey RULE_FIRE_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FIRE_DAMAGE); + public static final WrappedBooleanKey RULE_FREEZE_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FREEZE_DAMAGE); + public static final WrappedBooleanKey RULE_DO_PATROL_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_PATROL_SPAWNING); + public static final WrappedBooleanKey RULE_DO_TRADER_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_TRADER_SPAWNING); + public static final WrappedBooleanKey RULE_DO_WARDEN_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_WARDEN_SPAWNING); + public static final WrappedBooleanKey RULE_FORGIVE_DEAD_PLAYERS = WrappedBooleanKey.wrap(GameRules.RULE_FORGIVE_DEAD_PLAYERS); + public static final WrappedBooleanKey RULE_UNIVERSAL_ANGER = WrappedBooleanKey.wrap(GameRules.RULE_UNIVERSAL_ANGER); + public static final WrappedIntegerKey RULE_PLAYERS_SLEEPING_PERCENTAGE = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); + public static final WrappedBooleanKey RULE_BLOCK_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(GameRules.RULE_BLOCK_EXPLOSION_DROP_DECAY); + public static final WrappedBooleanKey RULE_MOB_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(GameRules.RULE_MOB_EXPLOSION_DROP_DECAY); + public static final WrappedBooleanKey RULE_TNT_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(GameRules.RULE_TNT_EXPLOSION_DROP_DECAY); + public static final WrappedIntegerKey RULE_SNOW_ACCUMULATION_HEIGHT = WrappedIntegerKey.wrap(GameRules.RULE_SNOW_ACCUMULATION_HEIGHT); + public static final WrappedBooleanKey RULE_WATER_SOURCE_CONVERSION = WrappedBooleanKey.wrap(GameRules.RULE_WATER_SOURCE_CONVERSION); + public static final WrappedBooleanKey RULE_LAVA_SOURCE_CONVERSION = WrappedBooleanKey.wrap(GameRules.RULE_LAVA_SOURCE_CONVERSION); + public static final WrappedBooleanKey RULE_GLOBAL_SOUND_EVENTS = WrappedBooleanKey.wrap(GameRules.RULE_GLOBAL_SOUND_EVENTS); + public static final WrappedBooleanKey RULE_DO_VINES_SPREAD = WrappedBooleanKey.wrap(GameRules.RULE_DO_VINES_SPREAD); + public static final WrappedBooleanKey RULE_ENDER_PEARLS_VANISH_ON_DEATH = WrappedBooleanKey.wrap(GameRules.RULE_ENDER_PEARLS_VANISH_ON_DEATH); + public static final WrappedIntegerKey RULE_MINECART_MAX_SPEED = WrappedIntegerKey.wrap(null); + public static final WrappedIntegerKey RULE_SPAWN_CHUNK_RADIUS = WrappedIntegerKey.wrap(null); + public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(null); + + public boolean getBoolean(WrappedBooleanKey key) { + if (key.toMojang() == null) + return false; + + return internal.getBoolean(key.toMojang()); + } + + public int getInt(WrappedIntegerKey key) { + if (key.toMojang() == null) + return 0; + + return internal.getInt(key.toMojang()); + } + + public GameRules toMojang() { + return internal; + } + + @RequiredArgsConstructor(staticName = "wrap") + public static final class WrappedBooleanKey { + private final GameRules.Key internal; + + public GameRules.Key toMojang() { + return internal; + } + } + + @RequiredArgsConstructor(staticName = "wrap") + public static final class WrappedIntegerKey { + private final GameRules.Key internal; + + public GameRules.Key toMojang() { + return internal; + } + } +} diff --git a/1.20.4/Paper/src/main/resources/paper-plugin.yml b/1.20.4/Paper/src/main/resources/paper-plugin.yml index 50e8646..768e1f7 100644 --- a/1.20.4/Paper/src/main/resources/paper-plugin.yml +++ b/1.20.4/Paper/src/main/resources/paper-plugin.yml @@ -6,3 +6,15 @@ author: HypherionSA api-version: '1.20' bootstrapper: com.hypherionmc.craterlib.paper.CraterLibBootstrap load: STARTUP + +dependencies: + bootstrap: + LuckPerms: + load: BEFORE + required: false + join-classpath: true + server: + LuckPerms: + load: BEFORE + required: false + join-classpath: true diff --git a/1.20.4/changelog.md b/1.20.4/changelog.md index 1e6ff6e..d38a3f6 100644 --- a/1.20.4/changelog.md +++ b/1.20.4/changelog.md @@ -1,12 +1,7 @@ **Bug Fixes**: -- Added a workaround for LuckPerms turning players into ghost players -- Fixed Missing Getters on LuckPerms events +- Fixed LuckPerms breaking commands on Paper **New Features**: -- Swapped Built In Config screen for a Cloth Config System, so client side mods can have in-game configs -- Added new APIs for Simple RPC (V4 rewrite) -- Added new APIs for getting player information from Commands -- Added Compat API for Player Revive Mod -- Added new APIs to know when the Minecraft Whitelist changes \ No newline at end of file +- Added Nojang API to allow mods to access GameRules (SDLink) \ No newline at end of file diff --git a/1.20.4/gradle.properties b/1.20.4/gradle.properties index 4ccc0f9..dde3f40 100644 --- a/1.20.4/gradle.properties +++ b/1.20.4/gradle.properties @@ -1,8 +1,8 @@ #Project version_major=2 version_minor=1 -version_patch=3 -version_build=1 +version_patch=4 +version_build=0 #Mod mod_author=HypherionSA diff --git a/1.20/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java b/1.20/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java index cb818b7..7bc4ea5 100644 --- a/1.20/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java +++ b/1.20/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java @@ -1,8 +1,10 @@ package com.hypherionmc.craterlib.nojang.server; import com.hypherionmc.craterlib.nojang.authlib.BridgedGameProfile; +import com.hypherionmc.craterlib.nojang.client.multiplayer.BridgedClientLevel; import com.hypherionmc.craterlib.nojang.commands.BridgedFakePlayer; import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer; +import com.hypherionmc.craterlib.nojang.world.level.BridgedGameRules; import com.hypherionmc.craterlib.utils.ChatUtils; import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.Component; @@ -76,6 +78,10 @@ public class BridgedMinecraftServer { return profiles; } + public BridgedGameRules getGameRules() { + return BridgedGameRules.bridge(internal.getGameRules()); + } + public void banPlayer(BridgedGameProfile profile) { internal.getPlayerList().getBans().add(new UserBanListEntry(profile.toMojang())); } diff --git a/1.20/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java b/1.20/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java new file mode 100644 index 0000000..bef0356 --- /dev/null +++ b/1.20/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java @@ -0,0 +1,103 @@ +package com.hypherionmc.craterlib.nojang.world.level; + +import lombok.RequiredArgsConstructor; +import net.minecraft.world.level.GameRules; + +@RequiredArgsConstructor(staticName = "bridge") +public class BridgedGameRules { + + private final GameRules internal; + + // Wrapped Mojang Rules for convenience + public static final WrappedBooleanKey RULE_DOFIRETICK = WrappedBooleanKey.wrap(GameRules.RULE_DOFIRETICK); + public static final WrappedBooleanKey RULE_ALLOWFIRETICKAWAYFROMPLAYERS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_MOBGRIEFING = WrappedBooleanKey.wrap(GameRules.RULE_MOBGRIEFING); + public static final WrappedBooleanKey RULE_KEEPINVENTORY = WrappedBooleanKey.wrap(GameRules.RULE_KEEPINVENTORY); + public static final WrappedBooleanKey RULE_DOMOBSPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBSPAWNING); + public static final WrappedBooleanKey RULE_DOMOBLOOT = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBLOOT); + public static final WrappedBooleanKey RULE_PROJECTILESCANBREAKBLOCKS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DOBLOCKDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOBLOCKDROPS); + public static final WrappedBooleanKey RULE_DOENTITYDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOENTITYDROPS); + public static final WrappedBooleanKey RULE_COMMANDBLOCKOUTPUT = WrappedBooleanKey.wrap(GameRules.RULE_COMMANDBLOCKOUTPUT); + public static final WrappedBooleanKey RULE_NATURAL_REGENERATION = WrappedBooleanKey.wrap(GameRules.RULE_NATURAL_REGENERATION); + public static final WrappedBooleanKey RULE_DAYLIGHT = WrappedBooleanKey.wrap(GameRules.RULE_DAYLIGHT); + public static final WrappedBooleanKey RULE_LOGADMINCOMMANDS = WrappedBooleanKey.wrap(GameRules.RULE_LOGADMINCOMMANDS); + public static final WrappedBooleanKey RULE_SHOWDEATHMESSAGES = WrappedBooleanKey.wrap(GameRules.RULE_SHOWDEATHMESSAGES); + public static final WrappedIntegerKey RULE_RANDOMTICKING = WrappedIntegerKey.wrap(GameRules.RULE_RANDOMTICKING); + public static final WrappedBooleanKey RULE_SENDCOMMANDFEEDBACK = WrappedBooleanKey.wrap(GameRules.RULE_SENDCOMMANDFEEDBACK); + public static final WrappedBooleanKey RULE_REDUCEDDEBUGINFO = WrappedBooleanKey.wrap(GameRules.RULE_REDUCEDDEBUGINFO); + public static final WrappedBooleanKey RULE_SPECTATORSGENERATECHUNKS = WrappedBooleanKey.wrap(GameRules.RULE_SPECTATORSGENERATECHUNKS); + public static final WrappedIntegerKey RULE_SPAWN_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_RADIUS); + public static final WrappedBooleanKey RULE_DISABLE_PLAYER_MOVEMENT_CHECK = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DISABLE_ELYTRA_MOVEMENT_CHECK = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK); + public static final WrappedIntegerKey RULE_MAX_ENTITY_CRAMMING = WrappedIntegerKey.wrap(GameRules.RULE_MAX_ENTITY_CRAMMING); + public static final WrappedBooleanKey RULE_WEATHER_CYCLE = WrappedBooleanKey.wrap(GameRules.RULE_WEATHER_CYCLE); + public static final WrappedBooleanKey RULE_LIMITED_CRAFTING = WrappedBooleanKey.wrap(GameRules.RULE_LIMITED_CRAFTING); + public static final WrappedIntegerKey RULE_MAX_COMMAND_CHAIN_LENGTH = WrappedIntegerKey.wrap(GameRules.RULE_MAX_COMMAND_CHAIN_LENGTH); + public static final WrappedIntegerKey RULE_MAX_COMMAND_FORK_COUNT = WrappedIntegerKey.wrap(null); + public static final WrappedIntegerKey RULE_COMMAND_MODIFICATION_BLOCK_LIMIT = WrappedIntegerKey.wrap(GameRules.RULE_COMMAND_MODIFICATION_BLOCK_LIMIT); + public static final WrappedBooleanKey RULE_ANNOUNCE_ADVANCEMENTS = WrappedBooleanKey.wrap(GameRules.RULE_ANNOUNCE_ADVANCEMENTS); + public static final WrappedBooleanKey RULE_DISABLE_RAIDS = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_RAIDS); + public static final WrappedBooleanKey RULE_DOINSOMNIA = WrappedBooleanKey.wrap(GameRules.RULE_DOINSOMNIA); + public static final WrappedBooleanKey RULE_DO_IMMEDIATE_RESPAWN = WrappedBooleanKey.wrap(GameRules.RULE_DO_IMMEDIATE_RESPAWN); + public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY = WrappedIntegerKey.wrap(null); + public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY = WrappedIntegerKey.wrap(null); + public static final WrappedBooleanKey RULE_DROWNING_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_DROWNING_DAMAGE); + public static final WrappedBooleanKey RULE_FALL_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FALL_DAMAGE); + public static final WrappedBooleanKey RULE_FIRE_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FIRE_DAMAGE); + public static final WrappedBooleanKey RULE_FREEZE_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FREEZE_DAMAGE); + public static final WrappedBooleanKey RULE_DO_PATROL_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_PATROL_SPAWNING); + public static final WrappedBooleanKey RULE_DO_TRADER_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_TRADER_SPAWNING); + public static final WrappedBooleanKey RULE_DO_WARDEN_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_WARDEN_SPAWNING); + public static final WrappedBooleanKey RULE_FORGIVE_DEAD_PLAYERS = WrappedBooleanKey.wrap(GameRules.RULE_FORGIVE_DEAD_PLAYERS); + public static final WrappedBooleanKey RULE_UNIVERSAL_ANGER = WrappedBooleanKey.wrap(GameRules.RULE_UNIVERSAL_ANGER); + public static final WrappedIntegerKey RULE_PLAYERS_SLEEPING_PERCENTAGE = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); + public static final WrappedBooleanKey RULE_BLOCK_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(GameRules.RULE_BLOCK_EXPLOSION_DROP_DECAY); + public static final WrappedBooleanKey RULE_MOB_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(GameRules.RULE_MOB_EXPLOSION_DROP_DECAY); + public static final WrappedBooleanKey RULE_TNT_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(GameRules.RULE_TNT_EXPLOSION_DROP_DECAY); + public static final WrappedIntegerKey RULE_SNOW_ACCUMULATION_HEIGHT = WrappedIntegerKey.wrap(GameRules.RULE_SNOW_ACCUMULATION_HEIGHT); + public static final WrappedBooleanKey RULE_WATER_SOURCE_CONVERSION = WrappedBooleanKey.wrap(GameRules.RULE_WATER_SOURCE_CONVERSION); + public static final WrappedBooleanKey RULE_LAVA_SOURCE_CONVERSION = WrappedBooleanKey.wrap(GameRules.RULE_LAVA_SOURCE_CONVERSION); + public static final WrappedBooleanKey RULE_GLOBAL_SOUND_EVENTS = WrappedBooleanKey.wrap(GameRules.RULE_GLOBAL_SOUND_EVENTS); + public static final WrappedBooleanKey RULE_DO_VINES_SPREAD = WrappedBooleanKey.wrap(GameRules.RULE_DO_VINES_SPREAD); + public static final WrappedBooleanKey RULE_ENDER_PEARLS_VANISH_ON_DEATH = WrappedBooleanKey.wrap(null); + public static final WrappedIntegerKey RULE_MINECART_MAX_SPEED = WrappedIntegerKey.wrap(null); + public static final WrappedIntegerKey RULE_SPAWN_CHUNK_RADIUS = WrappedIntegerKey.wrap(null); + public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(null); + + public boolean getBoolean(WrappedBooleanKey key) { + if (key.toMojang() == null) + return false; + + return internal.getBoolean(key.toMojang()); + } + + public int getInt(WrappedIntegerKey key) { + if (key.toMojang() == null) + return 0; + + return internal.getInt(key.toMojang()); + } + + public GameRules toMojang() { + return internal; + } + + @RequiredArgsConstructor(staticName = "wrap") + public static final class WrappedBooleanKey { + private final GameRules.Key internal; + + public GameRules.Key toMojang() { + return internal; + } + } + + @RequiredArgsConstructor(staticName = "wrap") + public static final class WrappedIntegerKey { + private final GameRules.Key internal; + + public GameRules.Key toMojang() { + return internal; + } + } +} diff --git a/1.20/Paper/src/main/resources/paper-plugin.yml b/1.20/Paper/src/main/resources/paper-plugin.yml index 50e8646..768e1f7 100644 --- a/1.20/Paper/src/main/resources/paper-plugin.yml +++ b/1.20/Paper/src/main/resources/paper-plugin.yml @@ -6,3 +6,15 @@ author: HypherionSA api-version: '1.20' bootstrapper: com.hypherionmc.craterlib.paper.CraterLibBootstrap load: STARTUP + +dependencies: + bootstrap: + LuckPerms: + load: BEFORE + required: false + join-classpath: true + server: + LuckPerms: + load: BEFORE + required: false + join-classpath: true diff --git a/1.20/changelog.md b/1.20/changelog.md index 1e6ff6e..1c28ab9 100644 --- a/1.20/changelog.md +++ b/1.20/changelog.md @@ -1,12 +1,8 @@ **Bug Fixes**: -- Added a workaround for LuckPerms turning players into ghost players -- Fixed Missing Getters on LuckPerms events +- Fixed LuckPerms breaking commands on Paper +- Fixed crash when trying to open config screens on NeoForge **New Features**: -- Swapped Built In Config screen for a Cloth Config System, so client side mods can have in-game configs -- Added new APIs for Simple RPC (V4 rewrite) -- Added new APIs for getting player information from Commands -- Added Compat API for Player Revive Mod -- Added new APIs to know when the Minecraft Whitelist changes \ No newline at end of file +- Added Nojang API to allow mods to access GameRules (SDLink) \ No newline at end of file diff --git a/1.20/gradle.properties b/1.20/gradle.properties index 52f1fea..65fb965 100644 --- a/1.20/gradle.properties +++ b/1.20/gradle.properties @@ -1,8 +1,8 @@ #Project version_major=2 version_minor=1 -version_patch=3 -version_build=1 +version_patch=4 +version_build=0 #Mod mod_author=HypherionSA diff --git a/1.21.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java b/1.21.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java index cb818b7..7bc4ea5 100644 --- a/1.21.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java +++ b/1.21.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java @@ -1,8 +1,10 @@ package com.hypherionmc.craterlib.nojang.server; import com.hypherionmc.craterlib.nojang.authlib.BridgedGameProfile; +import com.hypherionmc.craterlib.nojang.client.multiplayer.BridgedClientLevel; import com.hypherionmc.craterlib.nojang.commands.BridgedFakePlayer; import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer; +import com.hypherionmc.craterlib.nojang.world.level.BridgedGameRules; import com.hypherionmc.craterlib.utils.ChatUtils; import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.Component; @@ -76,6 +78,10 @@ public class BridgedMinecraftServer { return profiles; } + public BridgedGameRules getGameRules() { + return BridgedGameRules.bridge(internal.getGameRules()); + } + public void banPlayer(BridgedGameProfile profile) { internal.getPlayerList().getBans().add(new UserBanListEntry(profile.toMojang())); } diff --git a/1.21.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java b/1.21.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java new file mode 100644 index 0000000..907242b --- /dev/null +++ b/1.21.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java @@ -0,0 +1,103 @@ +package com.hypherionmc.craterlib.nojang.world.level; + +import lombok.RequiredArgsConstructor; +import net.minecraft.world.level.GameRules; + +@RequiredArgsConstructor(staticName = "bridge") +public class BridgedGameRules { + + private final GameRules internal; + + // Wrapped Mojang Rules for convenience + public static final WrappedBooleanKey RULE_DOFIRETICK = WrappedBooleanKey.wrap(GameRules.RULE_DOFIRETICK); + public static final WrappedBooleanKey RULE_ALLOWFIRETICKAWAYFROMPLAYERS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_MOBGRIEFING = WrappedBooleanKey.wrap(GameRules.RULE_MOBGRIEFING); + public static final WrappedBooleanKey RULE_KEEPINVENTORY = WrappedBooleanKey.wrap(GameRules.RULE_KEEPINVENTORY); + public static final WrappedBooleanKey RULE_DOMOBSPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBSPAWNING); + public static final WrappedBooleanKey RULE_DOMOBLOOT = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBLOOT); + public static final WrappedBooleanKey RULE_PROJECTILESCANBREAKBLOCKS = WrappedBooleanKey.wrap(GameRules.RULE_PROJECTILESCANBREAKBLOCKS); + public static final WrappedBooleanKey RULE_DOBLOCKDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOBLOCKDROPS); + public static final WrappedBooleanKey RULE_DOENTITYDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOENTITYDROPS); + public static final WrappedBooleanKey RULE_COMMANDBLOCKOUTPUT = WrappedBooleanKey.wrap(GameRules.RULE_COMMANDBLOCKOUTPUT); + public static final WrappedBooleanKey RULE_NATURAL_REGENERATION = WrappedBooleanKey.wrap(GameRules.RULE_NATURAL_REGENERATION); + public static final WrappedBooleanKey RULE_DAYLIGHT = WrappedBooleanKey.wrap(GameRules.RULE_DAYLIGHT); + public static final WrappedBooleanKey RULE_LOGADMINCOMMANDS = WrappedBooleanKey.wrap(GameRules.RULE_LOGADMINCOMMANDS); + public static final WrappedBooleanKey RULE_SHOWDEATHMESSAGES = WrappedBooleanKey.wrap(GameRules.RULE_SHOWDEATHMESSAGES); + public static final WrappedIntegerKey RULE_RANDOMTICKING = WrappedIntegerKey.wrap(GameRules.RULE_RANDOMTICKING); + public static final WrappedBooleanKey RULE_SENDCOMMANDFEEDBACK = WrappedBooleanKey.wrap(GameRules.RULE_SENDCOMMANDFEEDBACK); + public static final WrappedBooleanKey RULE_REDUCEDDEBUGINFO = WrappedBooleanKey.wrap(GameRules.RULE_REDUCEDDEBUGINFO); + public static final WrappedBooleanKey RULE_SPECTATORSGENERATECHUNKS = WrappedBooleanKey.wrap(GameRules.RULE_SPECTATORSGENERATECHUNKS); + public static final WrappedIntegerKey RULE_SPAWN_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_RADIUS); + public static final WrappedBooleanKey RULE_DISABLE_PLAYER_MOVEMENT_CHECK = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_PLAYER_MOVEMENT_CHECK); + public static final WrappedBooleanKey RULE_DISABLE_ELYTRA_MOVEMENT_CHECK = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK); + public static final WrappedIntegerKey RULE_MAX_ENTITY_CRAMMING = WrappedIntegerKey.wrap(GameRules.RULE_MAX_ENTITY_CRAMMING); + public static final WrappedBooleanKey RULE_WEATHER_CYCLE = WrappedBooleanKey.wrap(GameRules.RULE_WEATHER_CYCLE); + public static final WrappedBooleanKey RULE_LIMITED_CRAFTING = WrappedBooleanKey.wrap(GameRules.RULE_LIMITED_CRAFTING); + public static final WrappedIntegerKey RULE_MAX_COMMAND_CHAIN_LENGTH = WrappedIntegerKey.wrap(GameRules.RULE_MAX_COMMAND_CHAIN_LENGTH); + public static final WrappedIntegerKey RULE_MAX_COMMAND_FORK_COUNT = WrappedIntegerKey.wrap(GameRules.RULE_MAX_COMMAND_FORK_COUNT); + public static final WrappedIntegerKey RULE_COMMAND_MODIFICATION_BLOCK_LIMIT = WrappedIntegerKey.wrap(GameRules.RULE_COMMAND_MODIFICATION_BLOCK_LIMIT); + public static final WrappedBooleanKey RULE_ANNOUNCE_ADVANCEMENTS = WrappedBooleanKey.wrap(GameRules.RULE_ANNOUNCE_ADVANCEMENTS); + public static final WrappedBooleanKey RULE_DISABLE_RAIDS = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_RAIDS); + public static final WrappedBooleanKey RULE_DOINSOMNIA = WrappedBooleanKey.wrap(GameRules.RULE_DOINSOMNIA); + public static final WrappedBooleanKey RULE_DO_IMMEDIATE_RESPAWN = WrappedBooleanKey.wrap(GameRules.RULE_DO_IMMEDIATE_RESPAWN); + public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY); + public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY); + public static final WrappedBooleanKey RULE_DROWNING_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_DROWNING_DAMAGE); + public static final WrappedBooleanKey RULE_FALL_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FALL_DAMAGE); + public static final WrappedBooleanKey RULE_FIRE_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FIRE_DAMAGE); + public static final WrappedBooleanKey RULE_FREEZE_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FREEZE_DAMAGE); + public static final WrappedBooleanKey RULE_DO_PATROL_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_PATROL_SPAWNING); + public static final WrappedBooleanKey RULE_DO_TRADER_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_TRADER_SPAWNING); + public static final WrappedBooleanKey RULE_DO_WARDEN_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_WARDEN_SPAWNING); + public static final WrappedBooleanKey RULE_FORGIVE_DEAD_PLAYERS = WrappedBooleanKey.wrap(GameRules.RULE_FORGIVE_DEAD_PLAYERS); + public static final WrappedBooleanKey RULE_UNIVERSAL_ANGER = WrappedBooleanKey.wrap(GameRules.RULE_UNIVERSAL_ANGER); + public static final WrappedIntegerKey RULE_PLAYERS_SLEEPING_PERCENTAGE = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); + public static final WrappedBooleanKey RULE_BLOCK_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(GameRules.RULE_BLOCK_EXPLOSION_DROP_DECAY); + public static final WrappedBooleanKey RULE_MOB_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(GameRules.RULE_MOB_EXPLOSION_DROP_DECAY); + public static final WrappedBooleanKey RULE_TNT_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(GameRules.RULE_TNT_EXPLOSION_DROP_DECAY); + public static final WrappedIntegerKey RULE_SNOW_ACCUMULATION_HEIGHT = WrappedIntegerKey.wrap(GameRules.RULE_SNOW_ACCUMULATION_HEIGHT); + public static final WrappedBooleanKey RULE_WATER_SOURCE_CONVERSION = WrappedBooleanKey.wrap(GameRules.RULE_WATER_SOURCE_CONVERSION); + public static final WrappedBooleanKey RULE_LAVA_SOURCE_CONVERSION = WrappedBooleanKey.wrap(GameRules.RULE_LAVA_SOURCE_CONVERSION); + public static final WrappedBooleanKey RULE_GLOBAL_SOUND_EVENTS = WrappedBooleanKey.wrap(GameRules.RULE_GLOBAL_SOUND_EVENTS); + public static final WrappedBooleanKey RULE_DO_VINES_SPREAD = WrappedBooleanKey.wrap(GameRules.RULE_DO_VINES_SPREAD); + public static final WrappedBooleanKey RULE_ENDER_PEARLS_VANISH_ON_DEATH = WrappedBooleanKey.wrap(GameRules.RULE_ENDER_PEARLS_VANISH_ON_DEATH); + public static final WrappedIntegerKey RULE_MINECART_MAX_SPEED = WrappedIntegerKey.wrap(GameRules.RULE_MINECART_MAX_SPEED); + public static final WrappedIntegerKey RULE_SPAWN_CHUNK_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_CHUNK_RADIUS); + public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(null); + + public boolean getBoolean(WrappedBooleanKey key) { + if (key.toMojang() == null) + return false; + + return internal.getBoolean(key.toMojang()); + } + + public int getInt(WrappedIntegerKey key) { + if (key.toMojang() == null) + return 0; + + return internal.getInt(key.toMojang()); + } + + public GameRules toMojang() { + return internal; + } + + @RequiredArgsConstructor(staticName = "wrap") + public static final class WrappedBooleanKey { + private final GameRules.Key internal; + + public GameRules.Key toMojang() { + return internal; + } + } + + @RequiredArgsConstructor(staticName = "wrap") + public static final class WrappedIntegerKey { + private final GameRules.Key internal; + + public GameRules.Key toMojang() { + return internal; + } + } +} diff --git a/1.21.2/Paper/src/main/resources/paper-plugin.yml b/1.21.2/Paper/src/main/resources/paper-plugin.yml index 6e8d4e8..2339a5c 100644 --- a/1.21.2/Paper/src/main/resources/paper-plugin.yml +++ b/1.21.2/Paper/src/main/resources/paper-plugin.yml @@ -5,4 +5,16 @@ main: com.hypherionmc.craterlib.paper.CraterLibPlugin author: HypherionSA api-version: '1.21.3' bootstrapper: com.hypherionmc.craterlib.paper.CraterLibBootstrap -load: STARTUP \ No newline at end of file +load: STARTUP + +dependencies: + bootstrap: + LuckPerms: + load: BEFORE + required: false + join-classpath: true + server: + LuckPerms: + load: BEFORE + required: false + join-classpath: true \ No newline at end of file diff --git a/1.21.2/changelog.md b/1.21.2/changelog.md index 1e6ff6e..d38a3f6 100644 --- a/1.21.2/changelog.md +++ b/1.21.2/changelog.md @@ -1,12 +1,7 @@ **Bug Fixes**: -- Added a workaround for LuckPerms turning players into ghost players -- Fixed Missing Getters on LuckPerms events +- Fixed LuckPerms breaking commands on Paper **New Features**: -- Swapped Built In Config screen for a Cloth Config System, so client side mods can have in-game configs -- Added new APIs for Simple RPC (V4 rewrite) -- Added new APIs for getting player information from Commands -- Added Compat API for Player Revive Mod -- Added new APIs to know when the Minecraft Whitelist changes \ No newline at end of file +- Added Nojang API to allow mods to access GameRules (SDLink) \ No newline at end of file diff --git a/1.21.2/gradle.properties b/1.21.2/gradle.properties index 859a70f..4450eda 100644 --- a/1.21.2/gradle.properties +++ b/1.21.2/gradle.properties @@ -1,8 +1,8 @@ #Project version_major=2 version_minor=1 -version_patch=3 -version_build=1 +version_patch=4 +version_build=0 #Mod mod_author=HypherionSA diff --git a/1.21.2/settings.gradle b/1.21.2/settings.gradle index e3b6e5f..d1bb9ba 100644 --- a/1.21.2/settings.gradle +++ b/1.21.2/settings.gradle @@ -15,5 +15,4 @@ pluginManagement { rootProject.name = 'CraterLib' include("Common", "Fabric", "NeoForge") -include 'Paper' - +include 'Paper' \ No newline at end of file diff --git a/1.21/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java b/1.21/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java index cb818b7..7bc4ea5 100644 --- a/1.21/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java +++ b/1.21/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java @@ -1,8 +1,10 @@ package com.hypherionmc.craterlib.nojang.server; import com.hypherionmc.craterlib.nojang.authlib.BridgedGameProfile; +import com.hypherionmc.craterlib.nojang.client.multiplayer.BridgedClientLevel; import com.hypherionmc.craterlib.nojang.commands.BridgedFakePlayer; import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer; +import com.hypherionmc.craterlib.nojang.world.level.BridgedGameRules; import com.hypherionmc.craterlib.utils.ChatUtils; import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.Component; @@ -76,6 +78,10 @@ public class BridgedMinecraftServer { return profiles; } + public BridgedGameRules getGameRules() { + return BridgedGameRules.bridge(internal.getGameRules()); + } + public void banPlayer(BridgedGameProfile profile) { internal.getPlayerList().getBans().add(new UserBanListEntry(profile.toMojang())); } diff --git a/1.21/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java b/1.21/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java new file mode 100644 index 0000000..ae7e2a8 --- /dev/null +++ b/1.21/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java @@ -0,0 +1,103 @@ +package com.hypherionmc.craterlib.nojang.world.level; + +import lombok.RequiredArgsConstructor; +import net.minecraft.world.level.GameRules; + +@RequiredArgsConstructor(staticName = "bridge") +public class BridgedGameRules { + + private final GameRules internal; + + // Wrapped Mojang Rules for convenience + public static final WrappedBooleanKey RULE_DOFIRETICK = WrappedBooleanKey.wrap(GameRules.RULE_DOFIRETICK); + public static final WrappedBooleanKey RULE_ALLOWFIRETICKAWAYFROMPLAYERS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_MOBGRIEFING = WrappedBooleanKey.wrap(GameRules.RULE_MOBGRIEFING); + public static final WrappedBooleanKey RULE_KEEPINVENTORY = WrappedBooleanKey.wrap(GameRules.RULE_KEEPINVENTORY); + public static final WrappedBooleanKey RULE_DOMOBSPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBSPAWNING); + public static final WrappedBooleanKey RULE_DOMOBLOOT = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBLOOT); + public static final WrappedBooleanKey RULE_PROJECTILESCANBREAKBLOCKS = WrappedBooleanKey.wrap(GameRules.RULE_PROJECTILESCANBREAKBLOCKS); + public static final WrappedBooleanKey RULE_DOBLOCKDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOBLOCKDROPS); + public static final WrappedBooleanKey RULE_DOENTITYDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOENTITYDROPS); + public static final WrappedBooleanKey RULE_COMMANDBLOCKOUTPUT = WrappedBooleanKey.wrap(GameRules.RULE_COMMANDBLOCKOUTPUT); + public static final WrappedBooleanKey RULE_NATURAL_REGENERATION = WrappedBooleanKey.wrap(GameRules.RULE_NATURAL_REGENERATION); + public static final WrappedBooleanKey RULE_DAYLIGHT = WrappedBooleanKey.wrap(GameRules.RULE_DAYLIGHT); + public static final WrappedBooleanKey RULE_LOGADMINCOMMANDS = WrappedBooleanKey.wrap(GameRules.RULE_LOGADMINCOMMANDS); + public static final WrappedBooleanKey RULE_SHOWDEATHMESSAGES = WrappedBooleanKey.wrap(GameRules.RULE_SHOWDEATHMESSAGES); + public static final WrappedIntegerKey RULE_RANDOMTICKING = WrappedIntegerKey.wrap(GameRules.RULE_RANDOMTICKING); + public static final WrappedBooleanKey RULE_SENDCOMMANDFEEDBACK = WrappedBooleanKey.wrap(GameRules.RULE_SENDCOMMANDFEEDBACK); + public static final WrappedBooleanKey RULE_REDUCEDDEBUGINFO = WrappedBooleanKey.wrap(GameRules.RULE_REDUCEDDEBUGINFO); + public static final WrappedBooleanKey RULE_SPECTATORSGENERATECHUNKS = WrappedBooleanKey.wrap(GameRules.RULE_SPECTATORSGENERATECHUNKS); + public static final WrappedIntegerKey RULE_SPAWN_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_RADIUS); + public static final WrappedBooleanKey RULE_DISABLE_PLAYER_MOVEMENT_CHECK = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DISABLE_ELYTRA_MOVEMENT_CHECK = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK); + public static final WrappedIntegerKey RULE_MAX_ENTITY_CRAMMING = WrappedIntegerKey.wrap(GameRules.RULE_MAX_ENTITY_CRAMMING); + public static final WrappedBooleanKey RULE_WEATHER_CYCLE = WrappedBooleanKey.wrap(GameRules.RULE_WEATHER_CYCLE); + public static final WrappedBooleanKey RULE_LIMITED_CRAFTING = WrappedBooleanKey.wrap(GameRules.RULE_LIMITED_CRAFTING); + public static final WrappedIntegerKey RULE_MAX_COMMAND_CHAIN_LENGTH = WrappedIntegerKey.wrap(GameRules.RULE_MAX_COMMAND_CHAIN_LENGTH); + public static final WrappedIntegerKey RULE_MAX_COMMAND_FORK_COUNT = WrappedIntegerKey.wrap(GameRules.RULE_MAX_COMMAND_FORK_COUNT); + public static final WrappedIntegerKey RULE_COMMAND_MODIFICATION_BLOCK_LIMIT = WrappedIntegerKey.wrap(GameRules.RULE_COMMAND_MODIFICATION_BLOCK_LIMIT); + public static final WrappedBooleanKey RULE_ANNOUNCE_ADVANCEMENTS = WrappedBooleanKey.wrap(GameRules.RULE_ANNOUNCE_ADVANCEMENTS); + public static final WrappedBooleanKey RULE_DISABLE_RAIDS = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_RAIDS); + public static final WrappedBooleanKey RULE_DOINSOMNIA = WrappedBooleanKey.wrap(GameRules.RULE_DOINSOMNIA); + public static final WrappedBooleanKey RULE_DO_IMMEDIATE_RESPAWN = WrappedBooleanKey.wrap(GameRules.RULE_DO_IMMEDIATE_RESPAWN); + public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY); + public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY); + public static final WrappedBooleanKey RULE_DROWNING_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_DROWNING_DAMAGE); + public static final WrappedBooleanKey RULE_FALL_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FALL_DAMAGE); + public static final WrappedBooleanKey RULE_FIRE_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FIRE_DAMAGE); + public static final WrappedBooleanKey RULE_FREEZE_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FREEZE_DAMAGE); + public static final WrappedBooleanKey RULE_DO_PATROL_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_PATROL_SPAWNING); + public static final WrappedBooleanKey RULE_DO_TRADER_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_TRADER_SPAWNING); + public static final WrappedBooleanKey RULE_DO_WARDEN_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_WARDEN_SPAWNING); + public static final WrappedBooleanKey RULE_FORGIVE_DEAD_PLAYERS = WrappedBooleanKey.wrap(GameRules.RULE_FORGIVE_DEAD_PLAYERS); + public static final WrappedBooleanKey RULE_UNIVERSAL_ANGER = WrappedBooleanKey.wrap(GameRules.RULE_UNIVERSAL_ANGER); + public static final WrappedIntegerKey RULE_PLAYERS_SLEEPING_PERCENTAGE = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); + public static final WrappedBooleanKey RULE_BLOCK_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(GameRules.RULE_BLOCK_EXPLOSION_DROP_DECAY); + public static final WrappedBooleanKey RULE_MOB_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(GameRules.RULE_MOB_EXPLOSION_DROP_DECAY); + public static final WrappedBooleanKey RULE_TNT_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(GameRules.RULE_TNT_EXPLOSION_DROP_DECAY); + public static final WrappedIntegerKey RULE_SNOW_ACCUMULATION_HEIGHT = WrappedIntegerKey.wrap(GameRules.RULE_SNOW_ACCUMULATION_HEIGHT); + public static final WrappedBooleanKey RULE_WATER_SOURCE_CONVERSION = WrappedBooleanKey.wrap(GameRules.RULE_WATER_SOURCE_CONVERSION); + public static final WrappedBooleanKey RULE_LAVA_SOURCE_CONVERSION = WrappedBooleanKey.wrap(GameRules.RULE_LAVA_SOURCE_CONVERSION); + public static final WrappedBooleanKey RULE_GLOBAL_SOUND_EVENTS = WrappedBooleanKey.wrap(GameRules.RULE_GLOBAL_SOUND_EVENTS); + public static final WrappedBooleanKey RULE_DO_VINES_SPREAD = WrappedBooleanKey.wrap(GameRules.RULE_DO_VINES_SPREAD); + public static final WrappedBooleanKey RULE_ENDER_PEARLS_VANISH_ON_DEATH = WrappedBooleanKey.wrap(GameRules.RULE_ENDER_PEARLS_VANISH_ON_DEATH); + public static final WrappedIntegerKey RULE_MINECART_MAX_SPEED = WrappedIntegerKey.wrap(null); + public static final WrappedIntegerKey RULE_SPAWN_CHUNK_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_CHUNK_RADIUS); + public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(null); + + public boolean getBoolean(WrappedBooleanKey key) { + if (key.toMojang() == null) + return false; + + return internal.getBoolean(key.toMojang()); + } + + public int getInt(WrappedIntegerKey key) { + if (key.toMojang() == null) + return 0; + + return internal.getInt(key.toMojang()); + } + + public GameRules toMojang() { + return internal; + } + + @RequiredArgsConstructor(staticName = "wrap") + public static final class WrappedBooleanKey { + private final GameRules.Key internal; + + public GameRules.Key toMojang() { + return internal; + } + } + + @RequiredArgsConstructor(staticName = "wrap") + public static final class WrappedIntegerKey { + private final GameRules.Key internal; + + public GameRules.Key toMojang() { + return internal; + } + } +} diff --git a/1.21/Paper/src/main/resources/paper-plugin.yml b/1.21/Paper/src/main/resources/paper-plugin.yml index 47e5a49..6c4f561 100644 --- a/1.21/Paper/src/main/resources/paper-plugin.yml +++ b/1.21/Paper/src/main/resources/paper-plugin.yml @@ -6,3 +6,15 @@ author: HypherionSA api-version: '1.21' bootstrapper: com.hypherionmc.craterlib.paper.CraterLibBootstrap load: STARTUP + +dependencies: + bootstrap: + LuckPerms: + load: BEFORE + required: false + join-classpath: true + server: + LuckPerms: + load: BEFORE + required: false + join-classpath: true diff --git a/1.21/changelog.md b/1.21/changelog.md index 1e6ff6e..d38a3f6 100644 --- a/1.21/changelog.md +++ b/1.21/changelog.md @@ -1,12 +1,7 @@ **Bug Fixes**: -- Added a workaround for LuckPerms turning players into ghost players -- Fixed Missing Getters on LuckPerms events +- Fixed LuckPerms breaking commands on Paper **New Features**: -- Swapped Built In Config screen for a Cloth Config System, so client side mods can have in-game configs -- Added new APIs for Simple RPC (V4 rewrite) -- Added new APIs for getting player information from Commands -- Added Compat API for Player Revive Mod -- Added new APIs to know when the Minecraft Whitelist changes \ No newline at end of file +- Added Nojang API to allow mods to access GameRules (SDLink) \ No newline at end of file diff --git a/1.21/gradle.properties b/1.21/gradle.properties index 8160605..9fcd4b7 100644 --- a/1.21/gradle.properties +++ b/1.21/gradle.properties @@ -1,8 +1,8 @@ #Project version_major=2 version_minor=1 -version_patch=3 -version_build=1 +version_patch=4 +version_build=0 #Mod mod_author=HypherionSA @@ -21,7 +21,7 @@ fabric_api=0.100.1+1.21 forge_version=50.0.6 # NeoForged -neoforge_version=16-beta +neoforge_version=167 # Dependencies moon_config=1.0.10 diff --git a/1.21/settings.gradle b/1.21/settings.gradle index e3b6e5f..d1bb9ba 100644 --- a/1.21/settings.gradle +++ b/1.21/settings.gradle @@ -15,5 +15,4 @@ pluginManagement { rootProject.name = 'CraterLib' include("Common", "Fabric", "NeoForge") -include 'Paper' - +include 'Paper' \ No newline at end of file diff --git a/commit.sha b/commit.sha index 2d5c211..0f5ad10 100644 --- a/commit.sha +++ b/commit.sha @@ -1 +1 @@ -801f92a223d43ec0f709a9c3f6ccfc3d9756c13e \ No newline at end of file +76be1292f9cd9a89da05dd2ea9601f57feec7d5a \ No newline at end of file diff --git a/patches/1.18.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java.patch b/patches/1.18.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java.patch index fa8ed33..eda0c3f 100644 --- a/patches/1.18.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java.patch +++ b/patches/1.18.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java.patch @@ -1,6 +1,6 @@ --- a/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java +++ b/Common/src/main/java/com/hypherionmc/craterlib/nojang/server/BridgedMinecraftServer.java -@@ -7,6 +7,8 @@ +@@ -9,6 +9,8 @@ import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.Component; import net.minecraft.SharedConstants; @@ -9,7 +9,7 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.server.players.UserBanListEntry; import net.minecraft.server.players.UserWhiteListEntry; -@@ -44,7 +46,7 @@ +@@ -46,7 +48,7 @@ } public void broadcastSystemMessage(Component text, boolean bl) { @@ -18,7 +18,7 @@ } public boolean isPlayerBanned(BridgedGameProfile profile) { -@@ -81,7 +83,7 @@ +@@ -87,7 +89,7 @@ } public void executeCommand(BridgedMinecraftServer server, BridgedFakePlayer player, String command) { diff --git a/patches/1.18.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch b/patches/1.18.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch new file mode 100644 index 0000000..b78968a --- /dev/null +++ b/patches/1.18.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch @@ -0,0 +1,90 @@ +--- a/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java ++++ b/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java +@@ -10,12 +10,12 @@ + + // Wrapped Mojang Rules for convenience + public static final WrappedBooleanKey RULE_DOFIRETICK = WrappedBooleanKey.wrap(GameRules.RULE_DOFIRETICK); +- public static final WrappedBooleanKey RULE_ALLOWFIRETICKAWAYFROMPLAYERS = WrappedBooleanKey.wrap(GameRules.RULE_ALLOWFIRETICKAWAYFROMPLAYERS); ++ public static final WrappedBooleanKey RULE_ALLOWFIRETICKAWAYFROMPLAYERS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_MOBGRIEFING = WrappedBooleanKey.wrap(GameRules.RULE_MOBGRIEFING); + public static final WrappedBooleanKey RULE_KEEPINVENTORY = WrappedBooleanKey.wrap(GameRules.RULE_KEEPINVENTORY); + public static final WrappedBooleanKey RULE_DOMOBSPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBSPAWNING); + public static final WrappedBooleanKey RULE_DOMOBLOOT = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBLOOT); +- public static final WrappedBooleanKey RULE_PROJECTILESCANBREAKBLOCKS = WrappedBooleanKey.wrap(GameRules.RULE_PROJECTILESCANBREAKBLOCKS); ++ public static final WrappedBooleanKey RULE_PROJECTILESCANBREAKBLOCKS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DOBLOCKDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOBLOCKDROPS); + public static final WrappedBooleanKey RULE_DOENTITYDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOENTITYDROPS); + public static final WrappedBooleanKey RULE_COMMANDBLOCKOUTPUT = WrappedBooleanKey.wrap(GameRules.RULE_COMMANDBLOCKOUTPUT); +@@ -28,48 +28,54 @@ + public static final WrappedBooleanKey RULE_REDUCEDDEBUGINFO = WrappedBooleanKey.wrap(GameRules.RULE_REDUCEDDEBUGINFO); + public static final WrappedBooleanKey RULE_SPECTATORSGENERATECHUNKS = WrappedBooleanKey.wrap(GameRules.RULE_SPECTATORSGENERATECHUNKS); + public static final WrappedIntegerKey RULE_SPAWN_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_RADIUS); +- public static final WrappedBooleanKey RULE_DISABLE_PLAYER_MOVEMENT_CHECK = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_PLAYER_MOVEMENT_CHECK); ++ public static final WrappedBooleanKey RULE_DISABLE_PLAYER_MOVEMENT_CHECK = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DISABLE_ELYTRA_MOVEMENT_CHECK = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK); + public static final WrappedIntegerKey RULE_MAX_ENTITY_CRAMMING = WrappedIntegerKey.wrap(GameRules.RULE_MAX_ENTITY_CRAMMING); + public static final WrappedBooleanKey RULE_WEATHER_CYCLE = WrappedBooleanKey.wrap(GameRules.RULE_WEATHER_CYCLE); + public static final WrappedBooleanKey RULE_LIMITED_CRAFTING = WrappedBooleanKey.wrap(GameRules.RULE_LIMITED_CRAFTING); + public static final WrappedIntegerKey RULE_MAX_COMMAND_CHAIN_LENGTH = WrappedIntegerKey.wrap(GameRules.RULE_MAX_COMMAND_CHAIN_LENGTH); +- public static final WrappedIntegerKey RULE_MAX_COMMAND_FORK_COUNT = WrappedIntegerKey.wrap(GameRules.RULE_MAX_COMMAND_FORK_COUNT); +- public static final WrappedIntegerKey RULE_COMMAND_MODIFICATION_BLOCK_LIMIT = WrappedIntegerKey.wrap(GameRules.RULE_COMMAND_MODIFICATION_BLOCK_LIMIT); ++ public static final WrappedIntegerKey RULE_MAX_COMMAND_FORK_COUNT = WrappedIntegerKey.wrap(null); ++ public static final WrappedIntegerKey RULE_COMMAND_MODIFICATION_BLOCK_LIMIT = WrappedIntegerKey.wrap(null); + public static final WrappedBooleanKey RULE_ANNOUNCE_ADVANCEMENTS = WrappedBooleanKey.wrap(GameRules.RULE_ANNOUNCE_ADVANCEMENTS); + public static final WrappedBooleanKey RULE_DISABLE_RAIDS = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_RAIDS); + public static final WrappedBooleanKey RULE_DOINSOMNIA = WrappedBooleanKey.wrap(GameRules.RULE_DOINSOMNIA); + public static final WrappedBooleanKey RULE_DO_IMMEDIATE_RESPAWN = WrappedBooleanKey.wrap(GameRules.RULE_DO_IMMEDIATE_RESPAWN); +- public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY); +- public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY); ++ public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY = WrappedIntegerKey.wrap(null); ++ public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY = WrappedIntegerKey.wrap(null); + public static final WrappedBooleanKey RULE_DROWNING_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_DROWNING_DAMAGE); + public static final WrappedBooleanKey RULE_FALL_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FALL_DAMAGE); + public static final WrappedBooleanKey RULE_FIRE_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FIRE_DAMAGE); + public static final WrappedBooleanKey RULE_FREEZE_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FREEZE_DAMAGE); + public static final WrappedBooleanKey RULE_DO_PATROL_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_PATROL_SPAWNING); + public static final WrappedBooleanKey RULE_DO_TRADER_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_TRADER_SPAWNING); +- public static final WrappedBooleanKey RULE_DO_WARDEN_SPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DO_WARDEN_SPAWNING); ++ public static final WrappedBooleanKey RULE_DO_WARDEN_SPAWNING = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_FORGIVE_DEAD_PLAYERS = WrappedBooleanKey.wrap(GameRules.RULE_FORGIVE_DEAD_PLAYERS); + public static final WrappedBooleanKey RULE_UNIVERSAL_ANGER = WrappedBooleanKey.wrap(GameRules.RULE_UNIVERSAL_ANGER); + public static final WrappedIntegerKey RULE_PLAYERS_SLEEPING_PERCENTAGE = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); +- public static final WrappedBooleanKey RULE_BLOCK_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(GameRules.RULE_BLOCK_EXPLOSION_DROP_DECAY); +- public static final WrappedBooleanKey RULE_MOB_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(GameRules.RULE_MOB_EXPLOSION_DROP_DECAY); +- public static final WrappedBooleanKey RULE_TNT_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(GameRules.RULE_TNT_EXPLOSION_DROP_DECAY); +- public static final WrappedIntegerKey RULE_SNOW_ACCUMULATION_HEIGHT = WrappedIntegerKey.wrap(GameRules.RULE_SNOW_ACCUMULATION_HEIGHT); +- public static final WrappedBooleanKey RULE_WATER_SOURCE_CONVERSION = WrappedBooleanKey.wrap(GameRules.RULE_WATER_SOURCE_CONVERSION); +- public static final WrappedBooleanKey RULE_LAVA_SOURCE_CONVERSION = WrappedBooleanKey.wrap(GameRules.RULE_LAVA_SOURCE_CONVERSION); +- public static final WrappedBooleanKey RULE_GLOBAL_SOUND_EVENTS = WrappedBooleanKey.wrap(GameRules.RULE_GLOBAL_SOUND_EVENTS); +- public static final WrappedBooleanKey RULE_DO_VINES_SPREAD = WrappedBooleanKey.wrap(GameRules.RULE_DO_VINES_SPREAD); +- public static final WrappedBooleanKey RULE_ENDER_PEARLS_VANISH_ON_DEATH = WrappedBooleanKey.wrap(GameRules.RULE_ENDER_PEARLS_VANISH_ON_DEATH); +- public static final WrappedIntegerKey RULE_MINECART_MAX_SPEED = WrappedIntegerKey.wrap(GameRules.RULE_MINECART_MAX_SPEED); +- public static final WrappedIntegerKey RULE_SPAWN_CHUNK_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_CHUNK_RADIUS); +- public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(GameRules.RULE_TNT_EXPLODES); ++ public static final WrappedBooleanKey RULE_BLOCK_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(null); ++ public static final WrappedBooleanKey RULE_MOB_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(null); ++ public static final WrappedBooleanKey RULE_TNT_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(null); ++ public static final WrappedIntegerKey RULE_SNOW_ACCUMULATION_HEIGHT = WrappedIntegerKey.wrap(null); ++ public static final WrappedBooleanKey RULE_WATER_SOURCE_CONVERSION = WrappedBooleanKey.wrap(null); ++ public static final WrappedBooleanKey RULE_LAVA_SOURCE_CONVERSION = WrappedBooleanKey.wrap(null); ++ public static final WrappedBooleanKey RULE_GLOBAL_SOUND_EVENTS = WrappedBooleanKey.wrap(null); ++ public static final WrappedBooleanKey RULE_DO_VINES_SPREAD = WrappedBooleanKey.wrap(null); ++ public static final WrappedBooleanKey RULE_ENDER_PEARLS_VANISH_ON_DEATH = WrappedBooleanKey.wrap(null); ++ public static final WrappedIntegerKey RULE_MINECART_MAX_SPEED = WrappedIntegerKey.wrap(null); ++ public static final WrappedIntegerKey RULE_SPAWN_CHUNK_RADIUS = WrappedIntegerKey.wrap(null); ++ public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(null); + + public boolean getBoolean(WrappedBooleanKey key) { ++ if (key.toMojang() == null) ++ return false; ++ + return internal.getBoolean(key.toMojang()); + } + + public int getInt(WrappedIntegerKey key) { ++ if (key.toMojang() == null) ++ return 0; ++ + return internal.getInt(key.toMojang()); + } + diff --git a/patches/1.18.2/Paper/src/main/resources/paper-plugin.yml.patch b/patches/1.18.2/Paper/src/main/resources/paper-plugin.yml.patch index 03e886c..bb066c9 100644 --- a/patches/1.18.2/Paper/src/main/resources/paper-plugin.yml.patch +++ b/patches/1.18.2/Paper/src/main/resources/paper-plugin.yml.patch @@ -1,6 +1,6 @@ --- a/Paper/src/main/resources/paper-plugin.yml +++ /dev/null -@@ -1,8 +1,0 @@ +@@ -1,20 +1,0 @@ -name: CraterLib -version: ${version} -description: "A Modding API used to create 'universal' mods" @@ -9,3 +9,15 @@ -api-version: '1.21.3' -bootstrapper: com.hypherionmc.craterlib.paper.CraterLibBootstrap -load: STARTUP +- +-dependencies: +- bootstrap: +- LuckPerms: +- load: BEFORE +- required: false +- join-classpath: true +- server: +- LuckPerms: +- load: BEFORE +- required: false +- join-classpath: true diff --git a/patches/1.19.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch b/patches/1.19.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch new file mode 100644 index 0000000..77a5433 --- /dev/null +++ b/patches/1.19.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch @@ -0,0 +1,86 @@ +--- a/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java ++++ b/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java +@@ -10,12 +10,12 @@ + + // Wrapped Mojang Rules for convenience + public static final WrappedBooleanKey RULE_DOFIRETICK = WrappedBooleanKey.wrap(GameRules.RULE_DOFIRETICK); +- public static final WrappedBooleanKey RULE_ALLOWFIRETICKAWAYFROMPLAYERS = WrappedBooleanKey.wrap(GameRules.RULE_ALLOWFIRETICKAWAYFROMPLAYERS); ++ public static final WrappedBooleanKey RULE_ALLOWFIRETICKAWAYFROMPLAYERS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_MOBGRIEFING = WrappedBooleanKey.wrap(GameRules.RULE_MOBGRIEFING); + public static final WrappedBooleanKey RULE_KEEPINVENTORY = WrappedBooleanKey.wrap(GameRules.RULE_KEEPINVENTORY); + public static final WrappedBooleanKey RULE_DOMOBSPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBSPAWNING); + public static final WrappedBooleanKey RULE_DOMOBLOOT = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBLOOT); +- public static final WrappedBooleanKey RULE_PROJECTILESCANBREAKBLOCKS = WrappedBooleanKey.wrap(GameRules.RULE_PROJECTILESCANBREAKBLOCKS); ++ public static final WrappedBooleanKey RULE_PROJECTILESCANBREAKBLOCKS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DOBLOCKDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOBLOCKDROPS); + public static final WrappedBooleanKey RULE_DOENTITYDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOENTITYDROPS); + public static final WrappedBooleanKey RULE_COMMANDBLOCKOUTPUT = WrappedBooleanKey.wrap(GameRules.RULE_COMMANDBLOCKOUTPUT); +@@ -28,20 +28,20 @@ + public static final WrappedBooleanKey RULE_REDUCEDDEBUGINFO = WrappedBooleanKey.wrap(GameRules.RULE_REDUCEDDEBUGINFO); + public static final WrappedBooleanKey RULE_SPECTATORSGENERATECHUNKS = WrappedBooleanKey.wrap(GameRules.RULE_SPECTATORSGENERATECHUNKS); + public static final WrappedIntegerKey RULE_SPAWN_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_RADIUS); +- public static final WrappedBooleanKey RULE_DISABLE_PLAYER_MOVEMENT_CHECK = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_PLAYER_MOVEMENT_CHECK); ++ public static final WrappedBooleanKey RULE_DISABLE_PLAYER_MOVEMENT_CHECK = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DISABLE_ELYTRA_MOVEMENT_CHECK = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK); + public static final WrappedIntegerKey RULE_MAX_ENTITY_CRAMMING = WrappedIntegerKey.wrap(GameRules.RULE_MAX_ENTITY_CRAMMING); + public static final WrappedBooleanKey RULE_WEATHER_CYCLE = WrappedBooleanKey.wrap(GameRules.RULE_WEATHER_CYCLE); + public static final WrappedBooleanKey RULE_LIMITED_CRAFTING = WrappedBooleanKey.wrap(GameRules.RULE_LIMITED_CRAFTING); + public static final WrappedIntegerKey RULE_MAX_COMMAND_CHAIN_LENGTH = WrappedIntegerKey.wrap(GameRules.RULE_MAX_COMMAND_CHAIN_LENGTH); +- public static final WrappedIntegerKey RULE_MAX_COMMAND_FORK_COUNT = WrappedIntegerKey.wrap(GameRules.RULE_MAX_COMMAND_FORK_COUNT); +- public static final WrappedIntegerKey RULE_COMMAND_MODIFICATION_BLOCK_LIMIT = WrappedIntegerKey.wrap(GameRules.RULE_COMMAND_MODIFICATION_BLOCK_LIMIT); ++ public static final WrappedIntegerKey RULE_MAX_COMMAND_FORK_COUNT = WrappedIntegerKey.wrap(null); ++ public static final WrappedIntegerKey RULE_COMMAND_MODIFICATION_BLOCK_LIMIT = WrappedIntegerKey.wrap(null); + public static final WrappedBooleanKey RULE_ANNOUNCE_ADVANCEMENTS = WrappedBooleanKey.wrap(GameRules.RULE_ANNOUNCE_ADVANCEMENTS); + public static final WrappedBooleanKey RULE_DISABLE_RAIDS = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_RAIDS); + public static final WrappedBooleanKey RULE_DOINSOMNIA = WrappedBooleanKey.wrap(GameRules.RULE_DOINSOMNIA); + public static final WrappedBooleanKey RULE_DO_IMMEDIATE_RESPAWN = WrappedBooleanKey.wrap(GameRules.RULE_DO_IMMEDIATE_RESPAWN); +- public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY); +- public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY); ++ public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY = WrappedIntegerKey.wrap(null); ++ public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY = WrappedIntegerKey.wrap(null); + public static final WrappedBooleanKey RULE_DROWNING_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_DROWNING_DAMAGE); + public static final WrappedBooleanKey RULE_FALL_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FALL_DAMAGE); + public static final WrappedBooleanKey RULE_FIRE_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FIRE_DAMAGE); +@@ -52,24 +52,30 @@ + public static final WrappedBooleanKey RULE_FORGIVE_DEAD_PLAYERS = WrappedBooleanKey.wrap(GameRules.RULE_FORGIVE_DEAD_PLAYERS); + public static final WrappedBooleanKey RULE_UNIVERSAL_ANGER = WrappedBooleanKey.wrap(GameRules.RULE_UNIVERSAL_ANGER); + public static final WrappedIntegerKey RULE_PLAYERS_SLEEPING_PERCENTAGE = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); +- public static final WrappedBooleanKey RULE_BLOCK_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(GameRules.RULE_BLOCK_EXPLOSION_DROP_DECAY); +- public static final WrappedBooleanKey RULE_MOB_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(GameRules.RULE_MOB_EXPLOSION_DROP_DECAY); +- public static final WrappedBooleanKey RULE_TNT_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(GameRules.RULE_TNT_EXPLOSION_DROP_DECAY); +- public static final WrappedIntegerKey RULE_SNOW_ACCUMULATION_HEIGHT = WrappedIntegerKey.wrap(GameRules.RULE_SNOW_ACCUMULATION_HEIGHT); +- public static final WrappedBooleanKey RULE_WATER_SOURCE_CONVERSION = WrappedBooleanKey.wrap(GameRules.RULE_WATER_SOURCE_CONVERSION); +- public static final WrappedBooleanKey RULE_LAVA_SOURCE_CONVERSION = WrappedBooleanKey.wrap(GameRules.RULE_LAVA_SOURCE_CONVERSION); +- public static final WrappedBooleanKey RULE_GLOBAL_SOUND_EVENTS = WrappedBooleanKey.wrap(GameRules.RULE_GLOBAL_SOUND_EVENTS); +- public static final WrappedBooleanKey RULE_DO_VINES_SPREAD = WrappedBooleanKey.wrap(GameRules.RULE_DO_VINES_SPREAD); +- public static final WrappedBooleanKey RULE_ENDER_PEARLS_VANISH_ON_DEATH = WrappedBooleanKey.wrap(GameRules.RULE_ENDER_PEARLS_VANISH_ON_DEATH); +- public static final WrappedIntegerKey RULE_MINECART_MAX_SPEED = WrappedIntegerKey.wrap(GameRules.RULE_MINECART_MAX_SPEED); +- public static final WrappedIntegerKey RULE_SPAWN_CHUNK_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_CHUNK_RADIUS); +- public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(GameRules.RULE_TNT_EXPLODES); ++ public static final WrappedBooleanKey RULE_BLOCK_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(null); ++ public static final WrappedBooleanKey RULE_MOB_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(null); ++ public static final WrappedBooleanKey RULE_TNT_EXPLOSION_DROP_DECAY = WrappedBooleanKey.wrap(null); ++ public static final WrappedIntegerKey RULE_SNOW_ACCUMULATION_HEIGHT = WrappedIntegerKey.wrap(null); ++ public static final WrappedBooleanKey RULE_WATER_SOURCE_CONVERSION = WrappedBooleanKey.wrap(null); ++ public static final WrappedBooleanKey RULE_LAVA_SOURCE_CONVERSION = WrappedBooleanKey.wrap(null); ++ public static final WrappedBooleanKey RULE_GLOBAL_SOUND_EVENTS = WrappedBooleanKey.wrap(null); ++ public static final WrappedBooleanKey RULE_DO_VINES_SPREAD = WrappedBooleanKey.wrap(null); ++ public static final WrappedBooleanKey RULE_ENDER_PEARLS_VANISH_ON_DEATH = WrappedBooleanKey.wrap(null); ++ public static final WrappedIntegerKey RULE_MINECART_MAX_SPEED = WrappedIntegerKey.wrap(null); ++ public static final WrappedIntegerKey RULE_SPAWN_CHUNK_RADIUS = WrappedIntegerKey.wrap(null); ++ public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(null); + + public boolean getBoolean(WrappedBooleanKey key) { ++ if (key.toMojang() == null) ++ return false; ++ + return internal.getBoolean(key.toMojang()); + } + + public int getInt(WrappedIntegerKey key) { ++ if (key.toMojang() == null) ++ return 0; ++ + return internal.getInt(key.toMojang()); + } + diff --git a/patches/1.19.2/Paper/src/main/resources/paper-plugin.yml.patch b/patches/1.19.2/Paper/src/main/resources/paper-plugin.yml.patch index 03e886c..bb066c9 100644 --- a/patches/1.19.2/Paper/src/main/resources/paper-plugin.yml.patch +++ b/patches/1.19.2/Paper/src/main/resources/paper-plugin.yml.patch @@ -1,6 +1,6 @@ --- a/Paper/src/main/resources/paper-plugin.yml +++ /dev/null -@@ -1,8 +1,0 @@ +@@ -1,20 +1,0 @@ -name: CraterLib -version: ${version} -description: "A Modding API used to create 'universal' mods" @@ -9,3 +9,15 @@ -api-version: '1.21.3' -bootstrapper: com.hypherionmc.craterlib.paper.CraterLibBootstrap -load: STARTUP +- +-dependencies: +- bootstrap: +- LuckPerms: +- load: BEFORE +- required: false +- join-classpath: true +- server: +- LuckPerms: +- load: BEFORE +- required: false +- join-classpath: true diff --git a/patches/1.19.3/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch b/patches/1.19.3/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch new file mode 100644 index 0000000..abca3c4 --- /dev/null +++ b/patches/1.19.3/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch @@ -0,0 +1,69 @@ +--- a/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java ++++ b/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java +@@ -10,12 +10,12 @@ + + // Wrapped Mojang Rules for convenience + public static final WrappedBooleanKey RULE_DOFIRETICK = WrappedBooleanKey.wrap(GameRules.RULE_DOFIRETICK); +- public static final WrappedBooleanKey RULE_ALLOWFIRETICKAWAYFROMPLAYERS = WrappedBooleanKey.wrap(GameRules.RULE_ALLOWFIRETICKAWAYFROMPLAYERS); ++ public static final WrappedBooleanKey RULE_ALLOWFIRETICKAWAYFROMPLAYERS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_MOBGRIEFING = WrappedBooleanKey.wrap(GameRules.RULE_MOBGRIEFING); + public static final WrappedBooleanKey RULE_KEEPINVENTORY = WrappedBooleanKey.wrap(GameRules.RULE_KEEPINVENTORY); + public static final WrappedBooleanKey RULE_DOMOBSPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBSPAWNING); + public static final WrappedBooleanKey RULE_DOMOBLOOT = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBLOOT); +- public static final WrappedBooleanKey RULE_PROJECTILESCANBREAKBLOCKS = WrappedBooleanKey.wrap(GameRules.RULE_PROJECTILESCANBREAKBLOCKS); ++ public static final WrappedBooleanKey RULE_PROJECTILESCANBREAKBLOCKS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DOBLOCKDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOBLOCKDROPS); + public static final WrappedBooleanKey RULE_DOENTITYDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOENTITYDROPS); + public static final WrappedBooleanKey RULE_COMMANDBLOCKOUTPUT = WrappedBooleanKey.wrap(GameRules.RULE_COMMANDBLOCKOUTPUT); +@@ -28,20 +28,20 @@ + public static final WrappedBooleanKey RULE_REDUCEDDEBUGINFO = WrappedBooleanKey.wrap(GameRules.RULE_REDUCEDDEBUGINFO); + public static final WrappedBooleanKey RULE_SPECTATORSGENERATECHUNKS = WrappedBooleanKey.wrap(GameRules.RULE_SPECTATORSGENERATECHUNKS); + public static final WrappedIntegerKey RULE_SPAWN_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_RADIUS); +- public static final WrappedBooleanKey RULE_DISABLE_PLAYER_MOVEMENT_CHECK = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_PLAYER_MOVEMENT_CHECK); ++ public static final WrappedBooleanKey RULE_DISABLE_PLAYER_MOVEMENT_CHECK = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DISABLE_ELYTRA_MOVEMENT_CHECK = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK); + public static final WrappedIntegerKey RULE_MAX_ENTITY_CRAMMING = WrappedIntegerKey.wrap(GameRules.RULE_MAX_ENTITY_CRAMMING); + public static final WrappedBooleanKey RULE_WEATHER_CYCLE = WrappedBooleanKey.wrap(GameRules.RULE_WEATHER_CYCLE); + public static final WrappedBooleanKey RULE_LIMITED_CRAFTING = WrappedBooleanKey.wrap(GameRules.RULE_LIMITED_CRAFTING); + public static final WrappedIntegerKey RULE_MAX_COMMAND_CHAIN_LENGTH = WrappedIntegerKey.wrap(GameRules.RULE_MAX_COMMAND_CHAIN_LENGTH); +- public static final WrappedIntegerKey RULE_MAX_COMMAND_FORK_COUNT = WrappedIntegerKey.wrap(GameRules.RULE_MAX_COMMAND_FORK_COUNT); ++ public static final WrappedIntegerKey RULE_MAX_COMMAND_FORK_COUNT = WrappedIntegerKey.wrap(null); + public static final WrappedIntegerKey RULE_COMMAND_MODIFICATION_BLOCK_LIMIT = WrappedIntegerKey.wrap(GameRules.RULE_COMMAND_MODIFICATION_BLOCK_LIMIT); + public static final WrappedBooleanKey RULE_ANNOUNCE_ADVANCEMENTS = WrappedBooleanKey.wrap(GameRules.RULE_ANNOUNCE_ADVANCEMENTS); + public static final WrappedBooleanKey RULE_DISABLE_RAIDS = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_RAIDS); + public static final WrappedBooleanKey RULE_DOINSOMNIA = WrappedBooleanKey.wrap(GameRules.RULE_DOINSOMNIA); + public static final WrappedBooleanKey RULE_DO_IMMEDIATE_RESPAWN = WrappedBooleanKey.wrap(GameRules.RULE_DO_IMMEDIATE_RESPAWN); +- public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY); +- public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY); ++ public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY = WrappedIntegerKey.wrap(null); ++ public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY = WrappedIntegerKey.wrap(null); + public static final WrappedBooleanKey RULE_DROWNING_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_DROWNING_DAMAGE); + public static final WrappedBooleanKey RULE_FALL_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FALL_DAMAGE); + public static final WrappedBooleanKey RULE_FIRE_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FIRE_DAMAGE); +@@ -60,16 +60,22 @@ + public static final WrappedBooleanKey RULE_LAVA_SOURCE_CONVERSION = WrappedBooleanKey.wrap(GameRules.RULE_LAVA_SOURCE_CONVERSION); + public static final WrappedBooleanKey RULE_GLOBAL_SOUND_EVENTS = WrappedBooleanKey.wrap(GameRules.RULE_GLOBAL_SOUND_EVENTS); + public static final WrappedBooleanKey RULE_DO_VINES_SPREAD = WrappedBooleanKey.wrap(GameRules.RULE_DO_VINES_SPREAD); +- public static final WrappedBooleanKey RULE_ENDER_PEARLS_VANISH_ON_DEATH = WrappedBooleanKey.wrap(GameRules.RULE_ENDER_PEARLS_VANISH_ON_DEATH); +- public static final WrappedIntegerKey RULE_MINECART_MAX_SPEED = WrappedIntegerKey.wrap(GameRules.RULE_MINECART_MAX_SPEED); +- public static final WrappedIntegerKey RULE_SPAWN_CHUNK_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_CHUNK_RADIUS); +- public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(GameRules.RULE_TNT_EXPLODES); ++ public static final WrappedBooleanKey RULE_ENDER_PEARLS_VANISH_ON_DEATH = WrappedBooleanKey.wrap(null); ++ public static final WrappedIntegerKey RULE_MINECART_MAX_SPEED = WrappedIntegerKey.wrap(null); ++ public static final WrappedIntegerKey RULE_SPAWN_CHUNK_RADIUS = WrappedIntegerKey.wrap(null); ++ public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(null); + + public boolean getBoolean(WrappedBooleanKey key) { ++ if (key.toMojang() == null) ++ return false; ++ + return internal.getBoolean(key.toMojang()); + } + + public int getInt(WrappedIntegerKey key) { ++ if (key.toMojang() == null) ++ return 0; ++ + return internal.getInt(key.toMojang()); + } + diff --git a/patches/1.19.3/Paper/src/main/resources/paper-plugin.yml.patch b/patches/1.19.3/Paper/src/main/resources/paper-plugin.yml.patch index a3fd774..0f77144 100644 --- a/patches/1.19.3/Paper/src/main/resources/paper-plugin.yml.patch +++ b/patches/1.19.3/Paper/src/main/resources/paper-plugin.yml.patch @@ -1,6 +1,6 @@ --- a/Paper/src/main/resources/paper-plugin.yml +++ b/Paper/src/main/resources/paper-plugin.yml -@@ -3,6 +3,6 @@ +@@ -3,7 +3,7 @@ description: "A Modding API used to create 'universal' mods" main: com.hypherionmc.craterlib.paper.CraterLibPlugin author: HypherionSA @@ -8,3 +8,4 @@ +api-version: '1.19' bootstrapper: com.hypherionmc.craterlib.paper.CraterLibBootstrap load: STARTUP + diff --git a/patches/1.20.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch b/patches/1.20.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch new file mode 100644 index 0000000..50bc92a --- /dev/null +++ b/patches/1.20.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch @@ -0,0 +1,67 @@ +--- a/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java ++++ b/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java +@@ -10,12 +10,12 @@ + + // Wrapped Mojang Rules for convenience + public static final WrappedBooleanKey RULE_DOFIRETICK = WrappedBooleanKey.wrap(GameRules.RULE_DOFIRETICK); +- public static final WrappedBooleanKey RULE_ALLOWFIRETICKAWAYFROMPLAYERS = WrappedBooleanKey.wrap(GameRules.RULE_ALLOWFIRETICKAWAYFROMPLAYERS); ++ public static final WrappedBooleanKey RULE_ALLOWFIRETICKAWAYFROMPLAYERS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_MOBGRIEFING = WrappedBooleanKey.wrap(GameRules.RULE_MOBGRIEFING); + public static final WrappedBooleanKey RULE_KEEPINVENTORY = WrappedBooleanKey.wrap(GameRules.RULE_KEEPINVENTORY); + public static final WrappedBooleanKey RULE_DOMOBSPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBSPAWNING); + public static final WrappedBooleanKey RULE_DOMOBLOOT = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBLOOT); +- public static final WrappedBooleanKey RULE_PROJECTILESCANBREAKBLOCKS = WrappedBooleanKey.wrap(GameRules.RULE_PROJECTILESCANBREAKBLOCKS); ++ public static final WrappedBooleanKey RULE_PROJECTILESCANBREAKBLOCKS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DOBLOCKDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOBLOCKDROPS); + public static final WrappedBooleanKey RULE_DOENTITYDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOENTITYDROPS); + public static final WrappedBooleanKey RULE_COMMANDBLOCKOUTPUT = WrappedBooleanKey.wrap(GameRules.RULE_COMMANDBLOCKOUTPUT); +@@ -28,20 +28,20 @@ + public static final WrappedBooleanKey RULE_REDUCEDDEBUGINFO = WrappedBooleanKey.wrap(GameRules.RULE_REDUCEDDEBUGINFO); + public static final WrappedBooleanKey RULE_SPECTATORSGENERATECHUNKS = WrappedBooleanKey.wrap(GameRules.RULE_SPECTATORSGENERATECHUNKS); + public static final WrappedIntegerKey RULE_SPAWN_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_RADIUS); +- public static final WrappedBooleanKey RULE_DISABLE_PLAYER_MOVEMENT_CHECK = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_PLAYER_MOVEMENT_CHECK); ++ public static final WrappedBooleanKey RULE_DISABLE_PLAYER_MOVEMENT_CHECK = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DISABLE_ELYTRA_MOVEMENT_CHECK = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK); + public static final WrappedIntegerKey RULE_MAX_ENTITY_CRAMMING = WrappedIntegerKey.wrap(GameRules.RULE_MAX_ENTITY_CRAMMING); + public static final WrappedBooleanKey RULE_WEATHER_CYCLE = WrappedBooleanKey.wrap(GameRules.RULE_WEATHER_CYCLE); + public static final WrappedBooleanKey RULE_LIMITED_CRAFTING = WrappedBooleanKey.wrap(GameRules.RULE_LIMITED_CRAFTING); + public static final WrappedIntegerKey RULE_MAX_COMMAND_CHAIN_LENGTH = WrappedIntegerKey.wrap(GameRules.RULE_MAX_COMMAND_CHAIN_LENGTH); +- public static final WrappedIntegerKey RULE_MAX_COMMAND_FORK_COUNT = WrappedIntegerKey.wrap(GameRules.RULE_MAX_COMMAND_FORK_COUNT); ++ public static final WrappedIntegerKey RULE_MAX_COMMAND_FORK_COUNT = WrappedIntegerKey.wrap(null); + public static final WrappedIntegerKey RULE_COMMAND_MODIFICATION_BLOCK_LIMIT = WrappedIntegerKey.wrap(GameRules.RULE_COMMAND_MODIFICATION_BLOCK_LIMIT); + public static final WrappedBooleanKey RULE_ANNOUNCE_ADVANCEMENTS = WrappedBooleanKey.wrap(GameRules.RULE_ANNOUNCE_ADVANCEMENTS); + public static final WrappedBooleanKey RULE_DISABLE_RAIDS = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_RAIDS); + public static final WrappedBooleanKey RULE_DOINSOMNIA = WrappedBooleanKey.wrap(GameRules.RULE_DOINSOMNIA); + public static final WrappedBooleanKey RULE_DO_IMMEDIATE_RESPAWN = WrappedBooleanKey.wrap(GameRules.RULE_DO_IMMEDIATE_RESPAWN); +- public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY); +- public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY); ++ public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY = WrappedIntegerKey.wrap(null); ++ public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY = WrappedIntegerKey.wrap(null); + public static final WrappedBooleanKey RULE_DROWNING_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_DROWNING_DAMAGE); + public static final WrappedBooleanKey RULE_FALL_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FALL_DAMAGE); + public static final WrappedBooleanKey RULE_FIRE_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FIRE_DAMAGE); +@@ -61,15 +61,21 @@ + public static final WrappedBooleanKey RULE_GLOBAL_SOUND_EVENTS = WrappedBooleanKey.wrap(GameRules.RULE_GLOBAL_SOUND_EVENTS); + public static final WrappedBooleanKey RULE_DO_VINES_SPREAD = WrappedBooleanKey.wrap(GameRules.RULE_DO_VINES_SPREAD); + public static final WrappedBooleanKey RULE_ENDER_PEARLS_VANISH_ON_DEATH = WrappedBooleanKey.wrap(GameRules.RULE_ENDER_PEARLS_VANISH_ON_DEATH); +- public static final WrappedIntegerKey RULE_MINECART_MAX_SPEED = WrappedIntegerKey.wrap(GameRules.RULE_MINECART_MAX_SPEED); +- public static final WrappedIntegerKey RULE_SPAWN_CHUNK_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_CHUNK_RADIUS); +- public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(GameRules.RULE_TNT_EXPLODES); ++ public static final WrappedIntegerKey RULE_MINECART_MAX_SPEED = WrappedIntegerKey.wrap(null); ++ public static final WrappedIntegerKey RULE_SPAWN_CHUNK_RADIUS = WrappedIntegerKey.wrap(null); ++ public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(null); + + public boolean getBoolean(WrappedBooleanKey key) { ++ if (key.toMojang() == null) ++ return false; ++ + return internal.getBoolean(key.toMojang()); + } + + public int getInt(WrappedIntegerKey key) { ++ if (key.toMojang() == null) ++ return 0; ++ + return internal.getInt(key.toMojang()); + } + diff --git a/patches/1.20.2/Paper/src/main/resources/paper-plugin.yml.patch b/patches/1.20.2/Paper/src/main/resources/paper-plugin.yml.patch index 4e22db9..238ed03 100644 --- a/patches/1.20.2/Paper/src/main/resources/paper-plugin.yml.patch +++ b/patches/1.20.2/Paper/src/main/resources/paper-plugin.yml.patch @@ -1,6 +1,6 @@ --- a/Paper/src/main/resources/paper-plugin.yml +++ b/Paper/src/main/resources/paper-plugin.yml -@@ -3,6 +3,6 @@ +@@ -3,7 +3,7 @@ description: "A Modding API used to create 'universal' mods" main: com.hypherionmc.craterlib.paper.CraterLibPlugin author: HypherionSA @@ -8,3 +8,4 @@ +api-version: '1.20' bootstrapper: com.hypherionmc.craterlib.paper.CraterLibBootstrap load: STARTUP + diff --git a/patches/1.20.4/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch b/patches/1.20.4/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch new file mode 100644 index 0000000..2d737f4 --- /dev/null +++ b/patches/1.20.4/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch @@ -0,0 +1,45 @@ +--- a/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java ++++ b/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java +@@ -10,7 +10,7 @@ + + // Wrapped Mojang Rules for convenience + public static final WrappedBooleanKey RULE_DOFIRETICK = WrappedBooleanKey.wrap(GameRules.RULE_DOFIRETICK); +- public static final WrappedBooleanKey RULE_ALLOWFIRETICKAWAYFROMPLAYERS = WrappedBooleanKey.wrap(GameRules.RULE_ALLOWFIRETICKAWAYFROMPLAYERS); ++ public static final WrappedBooleanKey RULE_ALLOWFIRETICKAWAYFROMPLAYERS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_MOBGRIEFING = WrappedBooleanKey.wrap(GameRules.RULE_MOBGRIEFING); + public static final WrappedBooleanKey RULE_KEEPINVENTORY = WrappedBooleanKey.wrap(GameRules.RULE_KEEPINVENTORY); + public static final WrappedBooleanKey RULE_DOMOBSPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBSPAWNING); +@@ -28,7 +28,7 @@ + public static final WrappedBooleanKey RULE_REDUCEDDEBUGINFO = WrappedBooleanKey.wrap(GameRules.RULE_REDUCEDDEBUGINFO); + public static final WrappedBooleanKey RULE_SPECTATORSGENERATECHUNKS = WrappedBooleanKey.wrap(GameRules.RULE_SPECTATORSGENERATECHUNKS); + public static final WrappedIntegerKey RULE_SPAWN_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_RADIUS); +- public static final WrappedBooleanKey RULE_DISABLE_PLAYER_MOVEMENT_CHECK = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_PLAYER_MOVEMENT_CHECK); ++ public static final WrappedBooleanKey RULE_DISABLE_PLAYER_MOVEMENT_CHECK = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DISABLE_ELYTRA_MOVEMENT_CHECK = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK); + public static final WrappedIntegerKey RULE_MAX_ENTITY_CRAMMING = WrappedIntegerKey.wrap(GameRules.RULE_MAX_ENTITY_CRAMMING); + public static final WrappedBooleanKey RULE_WEATHER_CYCLE = WrappedBooleanKey.wrap(GameRules.RULE_WEATHER_CYCLE); +@@ -61,15 +61,21 @@ + public static final WrappedBooleanKey RULE_GLOBAL_SOUND_EVENTS = WrappedBooleanKey.wrap(GameRules.RULE_GLOBAL_SOUND_EVENTS); + public static final WrappedBooleanKey RULE_DO_VINES_SPREAD = WrappedBooleanKey.wrap(GameRules.RULE_DO_VINES_SPREAD); + public static final WrappedBooleanKey RULE_ENDER_PEARLS_VANISH_ON_DEATH = WrappedBooleanKey.wrap(GameRules.RULE_ENDER_PEARLS_VANISH_ON_DEATH); +- public static final WrappedIntegerKey RULE_MINECART_MAX_SPEED = WrappedIntegerKey.wrap(GameRules.RULE_MINECART_MAX_SPEED); +- public static final WrappedIntegerKey RULE_SPAWN_CHUNK_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_CHUNK_RADIUS); +- public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(GameRules.RULE_TNT_EXPLODES); ++ public static final WrappedIntegerKey RULE_MINECART_MAX_SPEED = WrappedIntegerKey.wrap(null); ++ public static final WrappedIntegerKey RULE_SPAWN_CHUNK_RADIUS = WrappedIntegerKey.wrap(null); ++ public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(null); + + public boolean getBoolean(WrappedBooleanKey key) { ++ if (key.toMojang() == null) ++ return false; ++ + return internal.getBoolean(key.toMojang()); + } + + public int getInt(WrappedIntegerKey key) { ++ if (key.toMojang() == null) ++ return 0; ++ + return internal.getInt(key.toMojang()); + } + diff --git a/patches/1.20.4/Paper/src/main/resources/paper-plugin.yml.patch b/patches/1.20.4/Paper/src/main/resources/paper-plugin.yml.patch index 4e22db9..238ed03 100644 --- a/patches/1.20.4/Paper/src/main/resources/paper-plugin.yml.patch +++ b/patches/1.20.4/Paper/src/main/resources/paper-plugin.yml.patch @@ -1,6 +1,6 @@ --- a/Paper/src/main/resources/paper-plugin.yml +++ b/Paper/src/main/resources/paper-plugin.yml -@@ -3,6 +3,6 @@ +@@ -3,7 +3,7 @@ description: "A Modding API used to create 'universal' mods" main: com.hypherionmc.craterlib.paper.CraterLibPlugin author: HypherionSA @@ -8,3 +8,4 @@ +api-version: '1.20' bootstrapper: com.hypherionmc.craterlib.paper.CraterLibBootstrap load: STARTUP + diff --git a/patches/1.20/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch b/patches/1.20/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch new file mode 100644 index 0000000..abca3c4 --- /dev/null +++ b/patches/1.20/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch @@ -0,0 +1,69 @@ +--- a/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java ++++ b/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java +@@ -10,12 +10,12 @@ + + // Wrapped Mojang Rules for convenience + public static final WrappedBooleanKey RULE_DOFIRETICK = WrappedBooleanKey.wrap(GameRules.RULE_DOFIRETICK); +- public static final WrappedBooleanKey RULE_ALLOWFIRETICKAWAYFROMPLAYERS = WrappedBooleanKey.wrap(GameRules.RULE_ALLOWFIRETICKAWAYFROMPLAYERS); ++ public static final WrappedBooleanKey RULE_ALLOWFIRETICKAWAYFROMPLAYERS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_MOBGRIEFING = WrappedBooleanKey.wrap(GameRules.RULE_MOBGRIEFING); + public static final WrappedBooleanKey RULE_KEEPINVENTORY = WrappedBooleanKey.wrap(GameRules.RULE_KEEPINVENTORY); + public static final WrappedBooleanKey RULE_DOMOBSPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBSPAWNING); + public static final WrappedBooleanKey RULE_DOMOBLOOT = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBLOOT); +- public static final WrappedBooleanKey RULE_PROJECTILESCANBREAKBLOCKS = WrappedBooleanKey.wrap(GameRules.RULE_PROJECTILESCANBREAKBLOCKS); ++ public static final WrappedBooleanKey RULE_PROJECTILESCANBREAKBLOCKS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DOBLOCKDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOBLOCKDROPS); + public static final WrappedBooleanKey RULE_DOENTITYDROPS = WrappedBooleanKey.wrap(GameRules.RULE_DOENTITYDROPS); + public static final WrappedBooleanKey RULE_COMMANDBLOCKOUTPUT = WrappedBooleanKey.wrap(GameRules.RULE_COMMANDBLOCKOUTPUT); +@@ -28,20 +28,20 @@ + public static final WrappedBooleanKey RULE_REDUCEDDEBUGINFO = WrappedBooleanKey.wrap(GameRules.RULE_REDUCEDDEBUGINFO); + public static final WrappedBooleanKey RULE_SPECTATORSGENERATECHUNKS = WrappedBooleanKey.wrap(GameRules.RULE_SPECTATORSGENERATECHUNKS); + public static final WrappedIntegerKey RULE_SPAWN_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_RADIUS); +- public static final WrappedBooleanKey RULE_DISABLE_PLAYER_MOVEMENT_CHECK = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_PLAYER_MOVEMENT_CHECK); ++ public static final WrappedBooleanKey RULE_DISABLE_PLAYER_MOVEMENT_CHECK = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DISABLE_ELYTRA_MOVEMENT_CHECK = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK); + public static final WrappedIntegerKey RULE_MAX_ENTITY_CRAMMING = WrappedIntegerKey.wrap(GameRules.RULE_MAX_ENTITY_CRAMMING); + public static final WrappedBooleanKey RULE_WEATHER_CYCLE = WrappedBooleanKey.wrap(GameRules.RULE_WEATHER_CYCLE); + public static final WrappedBooleanKey RULE_LIMITED_CRAFTING = WrappedBooleanKey.wrap(GameRules.RULE_LIMITED_CRAFTING); + public static final WrappedIntegerKey RULE_MAX_COMMAND_CHAIN_LENGTH = WrappedIntegerKey.wrap(GameRules.RULE_MAX_COMMAND_CHAIN_LENGTH); +- public static final WrappedIntegerKey RULE_MAX_COMMAND_FORK_COUNT = WrappedIntegerKey.wrap(GameRules.RULE_MAX_COMMAND_FORK_COUNT); ++ public static final WrappedIntegerKey RULE_MAX_COMMAND_FORK_COUNT = WrappedIntegerKey.wrap(null); + public static final WrappedIntegerKey RULE_COMMAND_MODIFICATION_BLOCK_LIMIT = WrappedIntegerKey.wrap(GameRules.RULE_COMMAND_MODIFICATION_BLOCK_LIMIT); + public static final WrappedBooleanKey RULE_ANNOUNCE_ADVANCEMENTS = WrappedBooleanKey.wrap(GameRules.RULE_ANNOUNCE_ADVANCEMENTS); + public static final WrappedBooleanKey RULE_DISABLE_RAIDS = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_RAIDS); + public static final WrappedBooleanKey RULE_DOINSOMNIA = WrappedBooleanKey.wrap(GameRules.RULE_DOINSOMNIA); + public static final WrappedBooleanKey RULE_DO_IMMEDIATE_RESPAWN = WrappedBooleanKey.wrap(GameRules.RULE_DO_IMMEDIATE_RESPAWN); +- public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY); +- public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY = WrappedIntegerKey.wrap(GameRules.RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY); ++ public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY = WrappedIntegerKey.wrap(null); ++ public static final WrappedIntegerKey RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY = WrappedIntegerKey.wrap(null); + public static final WrappedBooleanKey RULE_DROWNING_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_DROWNING_DAMAGE); + public static final WrappedBooleanKey RULE_FALL_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FALL_DAMAGE); + public static final WrappedBooleanKey RULE_FIRE_DAMAGE = WrappedBooleanKey.wrap(GameRules.RULE_FIRE_DAMAGE); +@@ -60,16 +60,22 @@ + public static final WrappedBooleanKey RULE_LAVA_SOURCE_CONVERSION = WrappedBooleanKey.wrap(GameRules.RULE_LAVA_SOURCE_CONVERSION); + public static final WrappedBooleanKey RULE_GLOBAL_SOUND_EVENTS = WrappedBooleanKey.wrap(GameRules.RULE_GLOBAL_SOUND_EVENTS); + public static final WrappedBooleanKey RULE_DO_VINES_SPREAD = WrappedBooleanKey.wrap(GameRules.RULE_DO_VINES_SPREAD); +- public static final WrappedBooleanKey RULE_ENDER_PEARLS_VANISH_ON_DEATH = WrappedBooleanKey.wrap(GameRules.RULE_ENDER_PEARLS_VANISH_ON_DEATH); +- public static final WrappedIntegerKey RULE_MINECART_MAX_SPEED = WrappedIntegerKey.wrap(GameRules.RULE_MINECART_MAX_SPEED); +- public static final WrappedIntegerKey RULE_SPAWN_CHUNK_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_CHUNK_RADIUS); +- public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(GameRules.RULE_TNT_EXPLODES); ++ public static final WrappedBooleanKey RULE_ENDER_PEARLS_VANISH_ON_DEATH = WrappedBooleanKey.wrap(null); ++ public static final WrappedIntegerKey RULE_MINECART_MAX_SPEED = WrappedIntegerKey.wrap(null); ++ public static final WrappedIntegerKey RULE_SPAWN_CHUNK_RADIUS = WrappedIntegerKey.wrap(null); ++ public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(null); + + public boolean getBoolean(WrappedBooleanKey key) { ++ if (key.toMojang() == null) ++ return false; ++ + return internal.getBoolean(key.toMojang()); + } + + public int getInt(WrappedIntegerKey key) { ++ if (key.toMojang() == null) ++ return 0; ++ + return internal.getInt(key.toMojang()); + } + diff --git a/patches/1.20/Paper/src/main/resources/paper-plugin.yml.patch b/patches/1.20/Paper/src/main/resources/paper-plugin.yml.patch index 4e22db9..238ed03 100644 --- a/patches/1.20/Paper/src/main/resources/paper-plugin.yml.patch +++ b/patches/1.20/Paper/src/main/resources/paper-plugin.yml.patch @@ -1,6 +1,6 @@ --- a/Paper/src/main/resources/paper-plugin.yml +++ b/Paper/src/main/resources/paper-plugin.yml -@@ -3,6 +3,6 @@ +@@ -3,7 +3,7 @@ description: "A Modding API used to create 'universal' mods" main: com.hypherionmc.craterlib.paper.CraterLibPlugin author: HypherionSA @@ -8,3 +8,4 @@ +api-version: '1.20' bootstrapper: com.hypherionmc.craterlib.paper.CraterLibBootstrap load: STARTUP + diff --git a/patches/1.20/changelog.md.patch b/patches/1.20/changelog.md.patch new file mode 100644 index 0000000..dfcf064 --- /dev/null +++ b/patches/1.20/changelog.md.patch @@ -0,0 +1,10 @@ +--- a/changelog.md ++++ b/changelog.md +@@ -1,6 +1,7 @@ + **Bug Fixes**: + + - Fixed LuckPerms breaking commands on Paper ++- Fixed crash when trying to open config screens on NeoForge + + **New Features**: + diff --git a/patches/1.21.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch b/patches/1.21.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch new file mode 100644 index 0000000..1fe2aa0 --- /dev/null +++ b/patches/1.21.2/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch @@ -0,0 +1,32 @@ +--- a/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java ++++ b/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java +@@ -10,7 +10,7 @@ + + // Wrapped Mojang Rules for convenience + public static final WrappedBooleanKey RULE_DOFIRETICK = WrappedBooleanKey.wrap(GameRules.RULE_DOFIRETICK); +- public static final WrappedBooleanKey RULE_ALLOWFIRETICKAWAYFROMPLAYERS = WrappedBooleanKey.wrap(GameRules.RULE_ALLOWFIRETICKAWAYFROMPLAYERS); ++ public static final WrappedBooleanKey RULE_ALLOWFIRETICKAWAYFROMPLAYERS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_MOBGRIEFING = WrappedBooleanKey.wrap(GameRules.RULE_MOBGRIEFING); + public static final WrappedBooleanKey RULE_KEEPINVENTORY = WrappedBooleanKey.wrap(GameRules.RULE_KEEPINVENTORY); + public static final WrappedBooleanKey RULE_DOMOBSPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBSPAWNING); +@@ -63,13 +63,19 @@ + public static final WrappedBooleanKey RULE_ENDER_PEARLS_VANISH_ON_DEATH = WrappedBooleanKey.wrap(GameRules.RULE_ENDER_PEARLS_VANISH_ON_DEATH); + public static final WrappedIntegerKey RULE_MINECART_MAX_SPEED = WrappedIntegerKey.wrap(GameRules.RULE_MINECART_MAX_SPEED); + public static final WrappedIntegerKey RULE_SPAWN_CHUNK_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_CHUNK_RADIUS); +- public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(GameRules.RULE_TNT_EXPLODES); ++ public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(null); + + public boolean getBoolean(WrappedBooleanKey key) { ++ if (key.toMojang() == null) ++ return false; ++ + return internal.getBoolean(key.toMojang()); + } + + public int getInt(WrappedIntegerKey key) { ++ if (key.toMojang() == null) ++ return 0; ++ + return internal.getInt(key.toMojang()); + } + diff --git a/patches/1.21.2/settings.gradle.patch b/patches/1.21.2/settings.gradle.patch index e9d2acd..40d3a7b 100644 --- a/patches/1.21.2/settings.gradle.patch +++ b/patches/1.21.2/settings.gradle.patch @@ -1,11 +1,11 @@ --- a/settings.gradle +++ b/settings.gradle -@@ -14,6 +14,6 @@ +@@ -14,6 +14,5 @@ } rootProject.name = 'CraterLib' -include("Common", "Fabric"/*, "NeoForge"*/) -//include 'Paper' +- +include("Common", "Fabric", "NeoForge") +include 'Paper' - diff --git a/patches/1.21/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch b/patches/1.21/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch new file mode 100644 index 0000000..71444c4 --- /dev/null +++ b/patches/1.21/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java.patch @@ -0,0 +1,44 @@ +--- a/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java ++++ b/Common/src/main/java/com/hypherionmc/craterlib/nojang/world/level/BridgedGameRules.java +@@ -10,7 +10,7 @@ + + // Wrapped Mojang Rules for convenience + public static final WrappedBooleanKey RULE_DOFIRETICK = WrappedBooleanKey.wrap(GameRules.RULE_DOFIRETICK); +- public static final WrappedBooleanKey RULE_ALLOWFIRETICKAWAYFROMPLAYERS = WrappedBooleanKey.wrap(GameRules.RULE_ALLOWFIRETICKAWAYFROMPLAYERS); ++ public static final WrappedBooleanKey RULE_ALLOWFIRETICKAWAYFROMPLAYERS = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_MOBGRIEFING = WrappedBooleanKey.wrap(GameRules.RULE_MOBGRIEFING); + public static final WrappedBooleanKey RULE_KEEPINVENTORY = WrappedBooleanKey.wrap(GameRules.RULE_KEEPINVENTORY); + public static final WrappedBooleanKey RULE_DOMOBSPAWNING = WrappedBooleanKey.wrap(GameRules.RULE_DOMOBSPAWNING); +@@ -28,7 +28,7 @@ + public static final WrappedBooleanKey RULE_REDUCEDDEBUGINFO = WrappedBooleanKey.wrap(GameRules.RULE_REDUCEDDEBUGINFO); + public static final WrappedBooleanKey RULE_SPECTATORSGENERATECHUNKS = WrappedBooleanKey.wrap(GameRules.RULE_SPECTATORSGENERATECHUNKS); + public static final WrappedIntegerKey RULE_SPAWN_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_RADIUS); +- public static final WrappedBooleanKey RULE_DISABLE_PLAYER_MOVEMENT_CHECK = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_PLAYER_MOVEMENT_CHECK); ++ public static final WrappedBooleanKey RULE_DISABLE_PLAYER_MOVEMENT_CHECK = WrappedBooleanKey.wrap(null); + public static final WrappedBooleanKey RULE_DISABLE_ELYTRA_MOVEMENT_CHECK = WrappedBooleanKey.wrap(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK); + public static final WrappedIntegerKey RULE_MAX_ENTITY_CRAMMING = WrappedIntegerKey.wrap(GameRules.RULE_MAX_ENTITY_CRAMMING); + public static final WrappedBooleanKey RULE_WEATHER_CYCLE = WrappedBooleanKey.wrap(GameRules.RULE_WEATHER_CYCLE); +@@ -61,15 +61,21 @@ + public static final WrappedBooleanKey RULE_GLOBAL_SOUND_EVENTS = WrappedBooleanKey.wrap(GameRules.RULE_GLOBAL_SOUND_EVENTS); + public static final WrappedBooleanKey RULE_DO_VINES_SPREAD = WrappedBooleanKey.wrap(GameRules.RULE_DO_VINES_SPREAD); + public static final WrappedBooleanKey RULE_ENDER_PEARLS_VANISH_ON_DEATH = WrappedBooleanKey.wrap(GameRules.RULE_ENDER_PEARLS_VANISH_ON_DEATH); +- public static final WrappedIntegerKey RULE_MINECART_MAX_SPEED = WrappedIntegerKey.wrap(GameRules.RULE_MINECART_MAX_SPEED); ++ public static final WrappedIntegerKey RULE_MINECART_MAX_SPEED = WrappedIntegerKey.wrap(null); + public static final WrappedIntegerKey RULE_SPAWN_CHUNK_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_CHUNK_RADIUS); +- public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(GameRules.RULE_TNT_EXPLODES); ++ public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(null); + + public boolean getBoolean(WrappedBooleanKey key) { ++ if (key.toMojang() == null) ++ return false; ++ + return internal.getBoolean(key.toMojang()); + } + + public int getInt(WrappedIntegerKey key) { ++ if (key.toMojang() == null) ++ return 0; ++ + return internal.getInt(key.toMojang()); + } + diff --git a/patches/1.21/Paper/src/main/resources/paper-plugin.yml.patch b/patches/1.21/Paper/src/main/resources/paper-plugin.yml.patch index ef3144f..27d31c0 100644 --- a/patches/1.21/Paper/src/main/resources/paper-plugin.yml.patch +++ b/patches/1.21/Paper/src/main/resources/paper-plugin.yml.patch @@ -1,6 +1,6 @@ --- a/Paper/src/main/resources/paper-plugin.yml +++ b/Paper/src/main/resources/paper-plugin.yml -@@ -3,6 +3,6 @@ +@@ -3,7 +3,7 @@ description: "A Modding API used to create 'universal' mods" main: com.hypherionmc.craterlib.paper.CraterLibPlugin author: HypherionSA @@ -8,3 +8,4 @@ +api-version: '1.21' bootstrapper: com.hypherionmc.craterlib.paper.CraterLibBootstrap load: STARTUP + diff --git a/patches/1.21/gradle.properties.patch b/patches/1.21/gradle.properties.patch index ffd30eb..cd198a7 100644 --- a/patches/1.21/gradle.properties.patch +++ b/patches/1.21/gradle.properties.patch @@ -1,6 +1,6 @@ --- a/gradle.properties +++ b/gradle.properties -@@ -10,12 +10,12 @@ +@@ -10,18 +10,18 @@ mod_name=CraterLib # Shared @@ -16,6 +16,13 @@ # Forge forge_version=50.0.6 + + # NeoForged +-neoforge_version=16-beta ++neoforge_version=167 + + # Dependencies + moon_config=1.0.10 @@ -29,7 +29,7 @@ adventure=4.17.0 rpc_sdk=1.0 diff --git a/patches/1.21/settings.gradle.patch b/patches/1.21/settings.gradle.patch index e9d2acd..40d3a7b 100644 --- a/patches/1.21/settings.gradle.patch +++ b/patches/1.21/settings.gradle.patch @@ -1,11 +1,11 @@ --- a/settings.gradle +++ b/settings.gradle -@@ -14,6 +14,6 @@ +@@ -14,6 +14,5 @@ } rootProject.name = 'CraterLib' -include("Common", "Fabric"/*, "NeoForge"*/) -//include 'Paper' +- +include("Common", "Fabric", "NeoForge") +include 'Paper' -