Skip to content

Commit

Permalink
Payload Splitter / IServerPayloadData
Browse files Browse the repository at this point in the history
  • Loading branch information
sakura-ryoko committed Jun 11, 2024
1 parent d98bc57 commit 3dca9f2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ author = masa
mod_file_name = servux-fabric

# Current mod version
mod_version = 0.1.999-sakura.6
mod_version = 0.1.999-sakura.7

# The Minecraft version that gets set in the built file name
minecraft_version_out = 1.20.6

# Minecraft, Fabric and mappings versions
minecraft_version = 1.20.6
mappings_version = 1.20.6+build.1
mappings_version = 1.20.6+build.3

fabric_loader_version = 0.15.10
fabric_api_version = 0.97.8+1.20.5
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ public class StructureDataProvider extends DataProviderBase
protected int timeout = 30 * 20;
protected int updateInterval = 40;
protected int retainDistance;
protected final int MAX_STRUCTURE_SIZE = 2097152;
// Maximum structure size of one Nbt packet
protected final int MAX_STRUCTURE_SIZE = 1572864;
// Maximum structure size of one Nbt packet (2097152)
// 2097152 = 2048 x 1024
// 1572864 = 1536 x 1024 ~halfway
// 1048576 = 1024 x 1024

// FIXME --> Move out of structures channel in the future
private BlockPos spawnPos = BlockPos.ORIGIN;
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/fi/dy/masa/servux/event/PlayerHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.jetbrains.annotations.ApiStatus;
import com.mojang.authlib.GameProfile;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.Text;
Expand All @@ -30,9 +31,7 @@ public void unregisterPlayerHandler(IPlayerListener handler)
this.handlers.remove(handler);
}

/**
* NOT PUBLIC API - DO NOT CALL
*/
@ApiStatus.Internal
public void onClientConnect(SocketAddress addr, GameProfile profile, @Nullable Text result)
{
if (!this.handlers.isEmpty())
Expand All @@ -44,6 +43,7 @@ public void onClientConnect(SocketAddress addr, GameProfile profile, @Nullable T
}
}

@ApiStatus.Internal
public void onPlayerJoin(SocketAddress addr, GameProfile profile, ServerPlayerEntity player)
{
if (!this.handlers.isEmpty())
Expand All @@ -55,6 +55,7 @@ public void onPlayerJoin(SocketAddress addr, GameProfile profile, ServerPlayerEn
}
}

@ApiStatus.Internal
public void onPlayerRespawn(ServerPlayerEntity newPlayer, ServerPlayerEntity oldPlayer)
{
if (!this.handlers.isEmpty())
Expand All @@ -66,6 +67,7 @@ public void onPlayerRespawn(ServerPlayerEntity newPlayer, ServerPlayerEntity old
}
}

@ApiStatus.Internal
public void onPlayerOp(GameProfile profile, UUID uuid, @Nullable ServerPlayerEntity player)
{
if (!this.handlers.isEmpty())
Expand All @@ -77,6 +79,7 @@ public void onPlayerOp(GameProfile profile, UUID uuid, @Nullable ServerPlayerEnt
}
}

@ApiStatus.Internal
public void onPlayerDeOp(GameProfile profile, UUID uuid, @Nullable ServerPlayerEntity player)
{
if (!this.handlers.isEmpty())
Expand All @@ -88,6 +91,7 @@ public void onPlayerDeOp(GameProfile profile, UUID uuid, @Nullable ServerPlayerE
}
}

@ApiStatus.Internal
public void onPlayerLeave(ServerPlayerEntity player)
{
if (!this.handlers.isEmpty())
Expand Down
17 changes: 5 additions & 12 deletions src/main/java/fi/dy/masa/servux/event/ServerHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.ArrayList;
import java.util.List;
import org.jetbrains.annotations.ApiStatus;
import net.minecraft.server.MinecraftServer;
import fi.dy.masa.servux.interfaces.IServerListener;

Expand Down Expand Up @@ -30,9 +31,7 @@ public void unregisterServerHandler(IServerListener handler)
this.handlers.remove(handler);
}

/**
* NOT PUBLIC API - DO NOT CALL
*/
@ApiStatus.Internal
public void onServerStarting(MinecraftServer server)
{
if (!this.handlers.isEmpty())
Expand All @@ -44,9 +43,7 @@ public void onServerStarting(MinecraftServer server)
}
}

/**
* NOT PUBLIC API - DO NOT CALL
*/
@ApiStatus.Internal
public void onServerStarted(MinecraftServer server)
{
if (!this.handlers.isEmpty())
Expand All @@ -58,9 +55,7 @@ public void onServerStarted(MinecraftServer server)
}
}

/**
* NOT PUBLIC API - DO NOT CALL
*/
@ApiStatus.Internal
public void onServerStopping(MinecraftServer server)
{
if (!this.handlers.isEmpty())
Expand All @@ -72,9 +67,7 @@ public void onServerStopping(MinecraftServer server)
}
}

/**
* NOT PUBLIC API - DO NOT CALL
*/
@ApiStatus.Internal
public void onServerStopped(MinecraftServer server)
{
if (!this.handlers.isEmpty())
Expand Down

0 comments on commit 3dca9f2

Please sign in to comment.