Skip to content

Commit

Permalink
update to 1.20.2
Browse files Browse the repository at this point in the history
  • Loading branch information
PinkGoosik committed Sep 23, 2023
1 parent ecb67c2 commit 22de70b
Show file tree
Hide file tree
Showing 17 changed files with 68 additions and 175 deletions.
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ dependencies {
modImplementation include("me.lucko:fabric-permissions-api:0.2-SNAPSHOT")
}

vineflower {
toolVersion = "1.9.3"
}

loom {
accessWidenerPath = file("src/main/resources/" + base.archivesName.get() + ".accesswidener")
}
Expand Down
16 changes: 8 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ org.gradle.parallel = true
# Mod Properties
maven_group = ru.pinkgoosik
archives_base_name = skylands
mod_version = 0.3.11+1.20
mod_version = 0.3.12+1.20.2

# Dependencies | Check these on https://fabricmc.net/develop
minecraft_version = 1.20.1
yarn_mappings = 1.20.1+build.9
fabric_loader = 0.14.21
fabric_api = 0.85.0+1.20.1
minecraft_version = 1.20.2
yarn_mappings = 1.20.2+build.1
fabric_loader = 0.14.22
fabric_api = 0.89.1+1.20.2

# https://github.com/OnyxStudios/Cardinal-Components-API/releases
cca = 5.2.1
cca = 5.3.0
# https://github.com/NucleoidMC/fantasy/releases
fantasy = 0.4.11+1.20-rc1
# https://github.com/Patbox/TextPlaceholderAPI/releases
placeholder_api = 2.1.2+1.20.1
placeholder_api = 2.2.0+1.20.2
# https://github.com/NucleoidMC/Server-Translations/releases
server_translations_api = 2.0.0+1.20
server_translations_api = 2.1.0+1.20.2-rc2
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
26 changes: 17 additions & 9 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,10 @@ do
esac
done

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

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

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,22 +130,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,6 +197,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down Expand Up @@ -237,4 +245,4 @@ eval "set -- $(
tr '\n' ' '
)" '"$@"'

exec "$JAVACMD" "$@"
exec "$JAVACMD" "$@"
1 change: 0 additions & 1 deletion src/main/java/skylands/config/SkylandsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public class SkylandsConfig {
public boolean updateCheckerEnabled = true;
public boolean teleportAfterIslandCreation = false;
public boolean createIslandOnPlayerJoin = false;
public boolean rightClickHarvestEnabled = true;

public static void init() {
Skylands.config = SkylandsConfig.read();
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/skylands/config/SkylandsConfigCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@ public static void init(CommandDispatcher<ServerCommandSource> dispatcher) {
context.getSource().sendFeedback(() -> Text.of("config.updateCheckerEnabled has changed to: " + config.updateCheckerEnabled), true);
return 1;

})).then(literal("toggle-right-click-harvest").executes(context -> {
var config = Skylands.config;
config.rightClickHarvestEnabled = !config.rightClickHarvestEnabled;
config.save();
context.getSource().sendFeedback(() -> Text.of("config.rightClickHarvestEnabled has changed to: " + config.rightClickHarvestEnabled), true);
return 1;
})).then(literal("reload").executes(context -> {
Skylands.config = SkylandsConfig.read();
context.getSource().sendFeedback(() -> Text.of("Config successfully reloaded!"), true);
Expand Down
18 changes: 8 additions & 10 deletions src/main/java/skylands/event/BlockBreakEvent.java
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
package skylands.event;

import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents;
import net.minecraft.block.BlockState;
import net.minecraft.block.CropBlock;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import skylands.logic.Skylands;
import org.jetbrains.annotations.Nullable;
import skylands.util.SkylandsTexts;
import skylands.util.WorldProtection;

@SuppressWarnings("unused")
public class BlockBreakEvent {
public class BlockBreakEvent implements PlayerBlockBreakEvents.Before {
static final BlockBreakEvent INSTANCE = new BlockBreakEvent();

public static boolean onBreak(World world, PlayerEntity player, BlockPos pos, BlockState state) {
if(!WorldProtection.canModify(world, player)) {
@Override
public boolean beforeBlockBreak(World world, PlayerEntity player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity) {
if(!world.isClient() && !WorldProtection.canModify(world, player)) {
player.sendMessage(SkylandsTexts.prefixed("message.skylands.world_protection.block_break"), true);
return false;
}

if(Skylands.config.rightClickHarvestEnabled && state.getBlock() instanceof CropBlock crop && crop.isMature(state)) {
player.sendMessage(SkylandsTexts.prefixed("message.skylands.right_click_harvest.tip"), true);
}

return true;
}
}
13 changes: 10 additions & 3 deletions src/main/java/skylands/event/PlayerConnectEvent.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package skylands.event;

import net.fabricmc.fabric.api.networking.v1.PacketSender;
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.network.ServerPlayNetworkHandler;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.world.World;
import skylands.logic.Member;
Expand All @@ -12,9 +15,12 @@
import java.util.Set;

@SuppressWarnings("unused")
public class PlayerConnectEvent {
public class PlayerConnectEvent implements ServerPlayConnectionEvents.Join, ServerPlayConnectionEvents.Disconnect {
static final PlayerConnectEvent INSTANCE = new PlayerConnectEvent();

public static void onJoin(MinecraftServer server, ServerPlayerEntity player) {
@Override
public void onPlayReady(ServerPlayNetworkHandler handler, PacketSender sender, MinecraftServer server) {
ServerPlayerEntity player = handler.getPlayer();

if(server.getFile("hub_template").exists()) {
if(player.getWorld().getRegistryKey().equals(World.OVERWORLD)) {
Expand Down Expand Up @@ -54,7 +60,8 @@ public static void onJoin(MinecraftServer server, ServerPlayerEntity player) {
}
}

public static void onLeave(MinecraftServer server, ServerPlayerEntity player) {
@Override
public void onPlayDisconnect(ServerPlayNetworkHandler handler, MinecraftServer server) {

}
}
7 changes: 5 additions & 2 deletions src/main/java/skylands/event/ServerStartEvent.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package skylands.event;

import com.google.common.collect.Lists;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.resource.ResourcePackManager;
import net.minecraft.server.MinecraftServer;
Expand All @@ -13,9 +14,11 @@
import java.io.File;
import java.util.Collection;

public class ServerStartEvent {
public class ServerStartEvent implements ServerLifecycleEvents.ServerStarting {
static final ServerStartEvent INSTANCE = new ServerStartEvent();

public static void onStarting(MinecraftServer server) {
@Override
public void onServerStarting(MinecraftServer server) {
Skylands.instance = new Skylands(server);

try {
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/skylands/event/ServerTickEvent.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package skylands.event;

import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.minecraft.server.MinecraftServer;
import skylands.logic.Skylands;

public class ServerTickEvent {
public class ServerTickEvent implements ServerTickEvents.EndTick {
static final ServerTickEvent INSTANCE = new ServerTickEvent();

public static void onTick(MinecraftServer server) {
@Override
public void onEndTick(MinecraftServer server) {
Skylands.getInstance().onTick(server);
}
}
39 changes: 5 additions & 34 deletions src/main/java/skylands/event/SkylandsEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents;
import net.fabricmc.fabric.api.event.player.UseBlockCallback;
import net.fabricmc.fabric.api.event.player.UseEntityCallback;
import net.fabricmc.fabric.api.event.player.UseItemCallback;
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
import net.minecraft.util.ActionResult;
import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World;
import skylands.logic.Skylands;

Expand All @@ -25,34 +20,10 @@ public static void init() {
}
});

ServerLifecycleEvents.SERVER_STARTING.register(ServerStartEvent::onStarting);
ServerTickEvents.END_SERVER_TICK.register(ServerTickEvent::onTick);
ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> PlayerConnectEvent.onJoin(server, handler.player));
ServerPlayConnectionEvents.DISCONNECT.register((handler, server) -> PlayerConnectEvent.onLeave(server, handler.player));
PlayerBlockBreakEvents.BEFORE.register((world, player, pos, state, blockEntity) -> {
if(!world.isClient) {
return BlockBreakEvent.onBreak(world, player, pos, state);
}
return true;
});
UseItemCallback.EVENT.register((player, world, hand) -> {
if(!world.isClient) {
return UseItemEvent.onUse(player, world, hand);
}
return TypedActionResult.pass(player.getStackInHand(hand));
});
UseEntityCallback.EVENT.register((player, world, hand, entity, hitResult) -> {
if(!world.isClient) {
return UseEntityEvent.onUse(player, world, hand, entity);
}
return ActionResult.PASS;
});

UseBlockCallback.EVENT.register((player, world, hand, hitResult) -> {
if(!world.isClient) {
return UseBlockEvent.onBlockUse(player, world, hand, hitResult);
}
return ActionResult.PASS;
});
ServerLifecycleEvents.SERVER_STARTING.register(ServerStartEvent.INSTANCE);
ServerTickEvents.END_SERVER_TICK.register(ServerTickEvent.INSTANCE);
ServerPlayConnectionEvents.JOIN.register(PlayerConnectEvent.INSTANCE);
ServerPlayConnectionEvents.DISCONNECT.register(PlayerConnectEvent.INSTANCE);
PlayerBlockBreakEvents.BEFORE.register(BlockBreakEvent.INSTANCE);
}
}
56 changes: 0 additions & 56 deletions src/main/java/skylands/event/UseBlockEvent.java

This file was deleted.

22 changes: 0 additions & 22 deletions src/main/java/skylands/event/UseEntityEvent.java

This file was deleted.

Loading

0 comments on commit 22de70b

Please sign in to comment.