Skip to content

Commit

Permalink
Update target to 1.20.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Jun 8, 2024
1 parent f8373bc commit fedccf0
Show file tree
Hide file tree
Showing 54 changed files with 214 additions and 367 deletions.
39 changes: 19 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
plugins {
id 'fabric-loom' version '1.4.+'
id 'fabric-loom' version '1.6.+'
id 'maven-publish'
id "com.modrinth.minotaur" version "2.+"
}

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21

archivesBaseName = project.archives_base_name
group = project.maven_group
Expand Down Expand Up @@ -84,30 +84,29 @@ dependencies {

modApi "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

modApi include('xyz.nucleoid:server-translations-api:2.2.0+1.20.3-rc1')
modApi include('xyz.nucleoid:packet-tweaker:0.5.0+1.20.2-rc1')
modApi include('xyz.nucleoid:fantasy:0.5.0+1.20.4')
modApi include('xyz.nucleoid:server-translations-api:2.3.0+1.20.5-rc2')
modApi include('xyz.nucleoid:packet-tweaker:0.5.1+1.20.6')
modApi include('xyz.nucleoid:fantasy:0.6.0+1.20.6')
modApi include('xyz.nucleoid:more-codecs:0.3.3+1.20.2')
modApi include('xyz.nucleoid:stimuli:0.4.10+1.20.4')
modApi include('xyz.nucleoid:stimuli:0.4.11+1.20.6')
modApi include('xyz.nucleoid:map-templates:0.1.9+1.20.4')
modApi include('xyz.nucleoid:substrate:0.2.2+1.20.1')
modApi 'eu.pb4:polymer-core:0.7.5+1.20.4'
modApi 'eu.pb4:polymer-resource-pack:0.7.5+1.20.4'
modApi 'eu.pb4:polymer-blocks:0.7.5+1.20.4'
modApi 'eu.pb4:polymer-virtual-entity:0.7.5+1.20.4'
modApi include('eu.pb4:hologram-api:0.2.5+1.20.2')
modApi include('eu.pb4:sgui:1.4.1+1.20.4')
modApi include('eu.pb4:sidebar-api:0.3.0+1.20.3')
modApi include("eu.pb4:placeholder-api:2.3.0+1.20.3")
modApi include("eu.pb4:map-canvas-api:0.2.2+1.19.4")
modApi include("eu.pb4:player-data-api:0.4.0+1.20.3")
modApi include("eu.pb4:predicate-api:0.3.0+1.20.2")
modApi 'eu.pb4:polymer-core:0.8.2+1.20.6'
modApi 'eu.pb4:polymer-resource-pack:0.8.2+1.20.6'
modApi 'eu.pb4:polymer-blocks:0.8.2+1.20.6'
modApi 'eu.pb4:polymer-virtual-entity:0.8.2+1.20.6'
modApi include('eu.pb4:sgui:1.5.1+1.20.5')
modApi include('eu.pb4:sidebar-api:0.4.0+1.20.5')
modApi include("eu.pb4:placeholder-api:2.4.0-pre.1+1.20.5")
modApi include("eu.pb4:map-canvas-api:0.3.0+1.20.6")
modApi include("eu.pb4:player-data-api:0.5.0+1.20.5")
modApi include("eu.pb4:predicate-api:0.4.0+1.20.5")

modImplementation include("me.lucko:fabric-permissions-api:0.2-SNAPSHOT")

modCompileOnly('xyz.nucleoid:disguiselib-fabric:1.3.2')
modCompileOnly('maven.modrinth:afkdisplay:1.1.0')
modCompileOnly('eu.pb4:polymer-autohost:0.7.4+1.20.4')
modCompileOnly('eu.pb4:polymer-autohost:0.8.2+1.20.6')
modCompileOnly("dev.emi:trinkets:3.7.1")

testmodImplementation sourceSets.main.output
Expand All @@ -123,7 +122,7 @@ processResources {

tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 17
it.options.release = 21
}

java {
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
org.gradle.jvmargs=-Xmx2G

# Fabric Properties
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.1
loader_version=0.15.1
minecraft_version=1.20.6
yarn_mappings=1.20.6+build.1
loader_version=0.15.10

#Fabric api
fabric_version=0.89.2+1.20.2
fabric_version=0.99.0+1.20.6

# Mod Properties
mod_version=0.6
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 3 additions & 3 deletions src/main/java/xyz/nucleoid/plasmid/Plasmid.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public final class Plasmid implements ModInitializer {
public void onInitialize() {
DynamicRegistries.register(GameConfigs.REGISTRY_KEY, GameConfig.DIRECT_CODEC);

Registry.register(Registries.CHUNK_GENERATOR, new Identifier(ID, "game"), GameChunkGenerator.CODEC);
Registry.register(Registries.CHUNK_GENERATOR, new Identifier(ID, "config"), GameChunkGenerator.CODEC);

GamePortalConfig.register(new Identifier(ID, "single_game"), SingleGamePortalConfig.CODEC);
GamePortalConfig.register(new Identifier(ID, "new_game"), NewGamePortalConfig.CODEC);
Expand All @@ -57,7 +57,7 @@ public void onInitialize() {
GamePortalConfig.register(new Identifier(ID, "menu"), MenuPortalConfig.CODEC);
GamePortalConfig.register(new Identifier(ID, "advanced_menu"), AdvancedMenuPortalConfig.CODEC);

MenuEntryConfig.register(new Identifier(ID, "game"), GameMenuEntryConfig.CODEC);
MenuEntryConfig.register(new Identifier(ID, "config"), GameMenuEntryConfig.CODEC);
MenuEntryConfig.register(new Identifier(ID, "portal"), PortalEntryConfig.CODEC);
MenuEntryConfig.register(new Identifier(ID, "portal_gui"), PortalGuiEntryConfig.CODEC);

Expand Down Expand Up @@ -106,7 +106,7 @@ private void registerCallbacks() {
try {
game.getBehavior().propagatingInvoker(GameActivityEvents.TICK).onTick();
} catch (Throwable t) {
game.closeWithError("An unexpected error occurred while ticking the game");
game.closeWithError("An unexpected error occurred while ticking the config");
}
}
});
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/xyz/nucleoid/plasmid/command/GameCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public final class GameCommand {
// @formatter:off
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
dispatcher.register(
literal("game")
literal("config")
.then(literal("open")
.requires(source -> source.hasPermissionLevel(2))
.then(GameConfigArgument.argument("game_config")
Expand Down Expand Up @@ -209,7 +209,7 @@ private static void onOpenSuccess(ServerCommandSource source, GameSpace gameSpac
}

private static void onOpenError(ServerCommandSource source, Throwable throwable) {
Plasmid.LOGGER.error("Failed to start game", throwable);
Plasmid.LOGGER.error("Failed to start config", throwable);

var gameOpenException = GameOpenException.unwrap(throwable);

Expand Down Expand Up @@ -405,7 +405,7 @@ private static int stopGameConfirmed(CommandContext<ServerCommandSource> context
var message = GameTexts.Stop.stoppedBy(source);
playerSet.sendMessage(message.formatted(Formatting.GRAY));
} catch (Throwable throwable) {
Plasmid.LOGGER.error("Failed to stop game", throwable);
Plasmid.LOGGER.error("Failed to stop config", throwable);

playerSet.sendMessage(GameTexts.Stop.genericError().formatted(Formatting.RED));
}
Expand All @@ -422,7 +422,7 @@ private static int listGames(CommandContext<ServerCommandSource> context) {
registry.streamEntries().forEach(game -> {
var id = game.registryKey().getValue();
source.sendFeedback(() -> {
String command = "/game open " + id;
String command = "/config open " + id;

var link = GameConfig.name(game).copy()
.setStyle(GameTexts.commandLinkStyle(command));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public final class GamePortalCommand {
// @formatter:off
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
dispatcher.register(
literal("game")
literal("config")
.then(literal("portal")
.then(literal("connect")
.requires(source -> source.hasPermissionLevel(3))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public final class GameTestCommand {
// @formatter:off
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
dispatcher.register(
literal("game")
literal("config")
.then(literal("test")
.requires(source -> source.hasPermissionLevel(2))
.then(GameConfigArgument.argument("game_config")
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/xyz/nucleoid/plasmid/command/ui/GameJoinUi.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private void changePage(int change) {

private GuiElementBuilder createIconFor(GameSpace gameSpace) {
var sourceConfig = gameSpace.getMetadata().sourceConfig();
var element = GuiElementBuilder.from(sourceConfig.value().icon().copy()).hideFlags()
var element = GuiElementBuilder.from(sourceConfig.value().icon().copy()).hideDefaultTooltip()
.setName(GameConfig.name(sourceConfig).copy());

for (var line : sourceConfig.value().description()) {
Expand All @@ -133,7 +133,7 @@ private GuiElementBuilder createIconFor(GameSpace gameSpace) {
Text.literal(gameSpace.getPlayers().size() + "").formatted(Formatting.YELLOW)).formatted(Formatting.GOLD))
);

element.hideFlags();
element.hideDefaultTooltip();
element.setCallback((a, b, c, d) -> tryJoinGame(this.getPlayer(), gameSpace));

return element;
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/xyz/nucleoid/plasmid/event/GameEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ private GameEvents() {

public interface GameSpaceOpened {
/**
* @param game The game and its configuration
* @param gameSpace The {@link GameSpace} the game is running in.
* @param game The config and its configuration
* @param gameSpace The {@link GameSpace} the config is running in.
*/
void onGameSpaceOpened(RegistryEntry<GameConfig<?>> game, GameSpace gameSpace);
}

public interface CreateActivity {
/**
* Called when the {@link GameActivity} of a {@link GameSpace} is being created (eg. when going from waiting lobby -> active game)
* Called when the {@link GameActivity} of a {@link GameSpace} is being created (eg. when going from waiting lobby -> active config)
* Note: This event can be called multiple times on the same {@link GameSpace}
*
* @param gameSpace The {@link GameSpace} that is having its {@link GameActivity} changed.
Expand All @@ -92,7 +92,7 @@ public interface CreateActivity {

public interface DestroyActivity {
/**
* Called when the {@link GameActivity} of a {@link GameSpace} is being destroyed (eg. when going from waiting lobby -> active game)
* Called when the {@link GameActivity} of a {@link GameSpace} is being destroyed (eg. when going from waiting lobby -> active config)
* Note: This event can be called multiple times on the same {@link GameSpace}
*
* @param gameSpace The {@link GameSpace} that is having its {@link GameActivity} changed.
Expand All @@ -103,7 +103,7 @@ public interface DestroyActivity {

public interface RequestStart {
/**
* @param gameSpace The {@link GameSpace} the game is in
* @param gameSpace The {@link GameSpace} the config is in
* @param result The current {@link GameResult} of the request that may have been overridden by other listener, and may also be a failure
* @return <code>null</code> if you don't want to override the result, or a {@link GameResult} if you want to override it.
*/
Expand All @@ -122,23 +122,23 @@ public interface CollectPlayersForJoin {
*
* @param gameSpace the {@link GameSpace} being joined
* @param player the initial player who tried to join a {@link GameSpace}
* @param additional a set of additional players who should join the game
* @param additional a set of additional players who should join the config
*/
void collectPlayersForJoin(GameSpace gameSpace, ServerPlayerEntity player, Set<ServerPlayerEntity> additional);
}


public interface PlayerJoin {
/**
* @param gameSpace The {@link GameSpace} the game is running in.
* @param gameSpace The {@link GameSpace} the config is running in.
* @param player the initial player who tried to join a {@link GameSpace}
*/
void onPlayerJoin(GameSpace gameSpace, ServerPlayerEntity player);
}

public interface PlayerLeft {
/**
* @param gameSpace The {@link GameSpace} the game is running in.
* @param gameSpace The {@link GameSpace} the config is running in.
* @param player the initial player who tried to join a {@link GameSpace}
*/
void onPlayerLeft(GameSpace gameSpace, ServerPlayerEntity player);
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/xyz/nucleoid/plasmid/game/GameCloseReason.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
package xyz.nucleoid.plasmid.game;

/**
* Represents a reason for a game to close.
* Represents a reason for a config to close.
*
* <p>To close a game, see {@link GameSpace#close}.
* <p>To listen for game closure, see {@link xyz.nucleoid.plasmid.event.GameEvents#CLOSING}.
* <p>To close a config, see {@link GameSpace#close}.
* <p>To listen for config closure, see {@link xyz.nucleoid.plasmid.event.GameEvents#CLOSING}.
*/
public enum GameCloseReason {
/**
* Used when a game ends normally.
* Used when a config ends normally.
*/
FINISHED,
/**
* Used when the server closes or a player manually runs a command to close the game.
* Used when the server closes or a player manually runs a command to close the config.
*/
CANCELED,
/**
* Used when the game space is unloaded or the game's last player leaves, making the game no longer useful.
* Used when the config space is unloaded or the config's last player leaves, making the config no longer useful.
*/
GARBAGE_COLLECTED,
/**
* Used when an exception is thrown that requires the game to close.
* Used when an exception is thrown that requires the config to close.
*/
ERRORED,
/**
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/xyz/nucleoid/plasmid/game/GameOpenContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@
import java.util.function.Consumer;

/**
* This object is passed to game constructors, holding all relevant information needed to construct the game as well as
* This object is passed to config constructors, holding all relevant information needed to construct the config as well as
* providing the access through which to create a {@link GameSpace}.
*
* @param <C> the config type passed for this game
* @param <C> the config type passed for this config
* @see GameOpenProcedure
* @see GameType.Open
*/
public record GameOpenContext<C>(MinecraftServer server, GameConfig<C> game) {
/**
* Creates a {@link GameOpenProcedure} that opens a game given the {@code setup} function.
* Creates a {@link GameOpenProcedure} that opens a config given the {@code setup} function.
* <p>
* This setup function should set any rules or event listeners on the given {@link GameActivity} needed for it to
* function. The setup function furthermore runs on-thread and should not run any slow operations.
*
* @param setup the setup function for the newly constructed {@link GameActivity}
* @return a {@link GameOpenProcedure} which should be returned by a game constructor
* @return a {@link GameOpenProcedure} which should be returned by a config constructor
* @see GameActivity
* @see GameActivity#listen(StimulusEvent, Object)
* @see GameActivity#setRule(GameRuleType, ActionResult)
Expand All @@ -37,14 +37,14 @@ public GameOpenProcedure open(Consumer<GameActivity> setup) {
}

/**
* Creates a {@link GameOpenProcedure} that opens a game given the {@code setup} function and creates a world.
* Creates a {@link GameOpenProcedure} that opens a config given the {@code setup} function and creates a world.
* <p>
* This setup function should set any rules or event listeners on the given {@link GameActivity} needed for it to
* function. The setup function furthermore runs on-thread and should not run any slow operations.
*
* @param setup the setup function for the newly constructed {@link GameActivity}
* @param worldConfig the configuration describing how the added world should be constructed
* @return a {@link GameOpenProcedure} which should be returned by a game constructor
* @return a {@link GameOpenProcedure} which should be returned by a config constructor
* @see GameActivity
* @see GameActivity#listen(StimulusEvent, Object)
* @see GameActivity#setRule(GameRuleType, ActionResult)
Expand All @@ -57,7 +57,7 @@ public GameOpenProcedure openWithWorld(RuntimeWorldConfig worldConfig, BiConsume
}

/**
* @return the configuration that this game was opened with
* @return the configuration that this config was opened with
*/
public C config() {
return this.game.config();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/xyz/nucleoid/plasmid/game/GameResources.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public synchronized void close() {
try {
resource.close();
} catch (Exception e) {
Plasmid.LOGGER.warn("Failed to close resource for game", e);
Plasmid.LOGGER.warn("Failed to close resource for config", e);
}
}
this.resources.clear();
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/xyz/nucleoid/plasmid/game/GameSpace.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
import java.util.function.Consumer;

/**
* Represents an instance of a game, and the "space" within which it occurs.
* Represents an instance of a config, and the "space" within which it occurs.
* <p>
* The {@link GameSpace} controls all of its attached {@link ServerWorld} objects, all joined players, and all the
* behavior that takes place within the game.
* behavior that takes place within the config.
* <p>
* Behavior should be controlled by game implementations through the use of {@link GameActivity} instances.
* Behavior should be controlled by config implementations through the use of {@link GameActivity} instances.
*
* @see GameType
* @see GameActivity
Expand Down Expand Up @@ -50,11 +50,11 @@ public interface GameSpace {
void setActivity(Consumer<GameActivity> builder);

/**
* Submits a request to the currently active {@link GameActivity} for this game to be started.
* What a start request means is dependent on the game implementation, and a game does not necessarily need to
* respond to this event unless they wish to respond to the {@code /game start} command.
* Submits a request to the currently active {@link GameActivity} for this config to be started.
* What a start request means is dependent on the config implementation, and a config does not necessarily need to
* respond to this event unless they wish to respond to the {@code /config start} command.
*
* @return a {@link GameResult} describing whether this game was successfully started, or an error if not
* @return a {@link GameResult} describing whether this config was successfully started, or an error if not
* @see GameActivityEvents#REQUEST_START
*/
GameResult requestStart();
Expand All @@ -68,7 +68,7 @@ public interface GameSpace {
* <li>{@link GamePlayerEvents#REMOVE} for every player in this {@link GameSpace}</li>
* <li>{@link GameActivityEvents#DESTROY}</li>
*
* @param reason the reason for this game closing
* @param reason the reason for this config closing
*/
void close(GameCloseReason reason);

Expand Down
Loading

0 comments on commit fedccf0

Please sign in to comment.