Compare commits

..

1 Commits

Author SHA1 Message Date
Jason Penilla
a523823513 Add ticket on player join
https://github.com/PaperMC/Paper/pull/11398
2024-09-13 16:00:06 -07:00
9 changed files with 106 additions and 86 deletions

View File

@@ -1,10 +1,5 @@
Moonrise
==
[![Modrinth](https://img.shields.io/badge/Modrinth-gray?logo=modrinth)](https://modrinth.com/mod/moonrise-opt)
[![CurseForge](https://img.shields.io/badge/CurseForge-gray?logo=curseforge)](https://www.curseforge.com/minecraft/mc-mods/moonrise)
[![Release](https://img.shields.io/github/v/release/Tuinity/Moonrise?include_prereleases)](https://github.com/Tuinity/Moonrise/releases)
[![License](https://img.shields.io/github/license/Tuinity/Moonrise)](LICENSE.md)
Fabric/NeoForge mod for optimising performance of the integrated (singleplayer/LAN) and dedicated server.
@@ -24,9 +19,8 @@ patches. Listed below are notable patches:
| Mod | Status |
|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Lithium | <details><summary>✅ compatible</summary>Lithium optimises many of the same parts of the game as Moonrise, for example the chunk system. Moonrise will automatically disable conflicting parts of Lithium. This mechanism needs to be manually validated for each Moonrise and Lithium release.</details> |
| Radium | <details><summary>✅ compatible</summary>Radium is an unofficial port of Lithium to NeoForge. Radium will automatically disable conflicting parts of itself when Moonrise is present. Any compatibility issues should be reported to Radium first.</details> |
| FerriteCore | <details><summary>📝 requires config changes</summary>In `config/ferritecore-mixin.toml`:<br/>Set `replaceNeighborLookup` and `replacePropertyMap` to `false`</details> |
| C2ME | <details><summary>❌ incompatible</summary>C2ME is based around modifications to the chunk system, which Moonrise replaces wholesale. This makes them fundamentally incompatible.</details> |
| C2ME | <details><summary>❌ incompatible</summary>C2ME is based around modifications to the chunk system, which Moonrise replaces wholesale. This makes them fundamentally incompatible.</details> |
## Configuration
Moonrise provides documented configuration options for tuning the chunk system and enabling bugfixes in the config file `$mcdir$/config/moonrise.yml`.

View File

@@ -112,18 +112,16 @@ subprojects {
}
changelog = providers.environmentVariable("RELEASE_NOTES")
List<String> supportedMcVersions = rootProject.supported_minecraft_versions.split(',')
modrinth {
projectId = "KOHu7RCS"
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
minecraftVersions = supportedMcVersions
minecraftVersions = [rootProject.minecraft_version]
}
curseforge {
projectId = "1096335"
accessToken = providers.environmentVariable("CURSEFORGE_TOKEN")
minecraftVersions = supportedMcVersions
minecraftVersions = [rootProject.minecraft_version]
}
}
}

View File

@@ -1,73 +1,71 @@
{
"schemaVersion": 1,
"id": "moonrise",
"version": "${version}",
"name": "Moonrise",
"description": "Optimisation mod for the dedicated and integrated server.",
"authors": [
"Spottedleaf"
"schemaVersion": 1,
"id": "moonrise",
"version": "${version}",
"name": "Moonrise",
"description": "Optimisation mod for the dedicated and integrated server.",
"authors": [
"Spottedleaf"
],
"contact": {
"issues": "https://github.com/Tuinity/Moonrise/issues",
"sources": "https://github.com/Tuinity/Moonrise",
"discord": "https://discord.gg/tuinity",
"homepage": "https://www.curseforge.com/minecraft/mc-mods/moonrise"
},
"breaks": {
"notenoughcrashes": "*",
"starlight": "*",
"c2me": "*"
},
"license": "GPL-3.0-only",
"icon": "assets/moonrise/icon.png",
"environment": "*",
"entrypoints": {
"modmenu": [
"ca.spottedleaf.moonrise.fabric.MoonriseModMenuHook"
],
"contact": {
"issues": "https://github.com/Tuinity/Moonrise/issues",
"sources": "https://github.com/Tuinity/Moonrise",
"discord": "https://discord.gg/tuinity",
"homepage": "https://www.curseforge.com/minecraft/mc-mods/moonrise"
},
"breaks": {
"notenoughcrashes": "*",
"starlight": "*",
"c2me": "*"
},
"license": "GPL-3.0-only",
"icon": "assets/moonrise/icon.png",
"environment": "*",
"entrypoints": {
"modmenu": [
"ca.spottedleaf.moonrise.fabric.MoonriseModMenuHook"
],
"client": [
"ca.spottedleaf.moonrise.fabric.MoonriseFabricClient"
]
},
"mixins": [
"moonrise.mixins.json",
"moonrise-fabric.mixins.json"
],
"accessWidener": "moonrise.accesswidener",
"depends": {
"fabricloader": ">=${loader_version}",
"minecraft": ">=1.21 <=1.21.1",
"fabric-command-api-v2": "*"
},
"custom": {
"lithium:options": {
"mixin.collections.chunk_tickets": false,
"mixin.collections.entity_ticking": false,
"mixin.world.temperature_cache": false,
"mixin.world.block_entity_ticking": false,
"mixin.world.chunk_access": false,
"mixin.world.tick_scheduler": false,
"mixin.world.explosions.block_raycast": false,
"mixin.world.explosions.cache_exposure": false,
"mixin.block.flatten_states": false,
"mixin.math.fast_util": false,
"mixin.math.fast_blockpos": false,
"mixin.minimal_nonvanilla.collisions.empty_space": false,
"mixin.minimal_nonvanilla.world.expiring_chunk_tickets": false,
"mixin.alloc.deep_passengers": false,
"mixin.alloc.chunk_ticking": false,
"mixin.alloc.entity_tracker": false,
"mixin.shapes.blockstate_cache": false,
"mixin.shapes.specialized_shapes": false,
"mixin.shapes.optimized_matching": false,
"mixin.ai.poi": false,
"mixin.chunk.no_validation": false,
"mixin.chunk.entity_class_groups": false,
"mixin.util.block_tracking": false,
"mixin.entity.replace_entitytype_predicates": false,
"mixin.entity.collisions.intersection": false,
"mixin.entity.collisions.movement": false,
"mixin.entity.collisions.unpushable_cramming": false
}
"client": [
"ca.spottedleaf.moonrise.fabric.MoonriseFabricClient"
]
},
"mixins": [
"moonrise.mixins.json",
"moonrise-fabric.mixins.json"
],
"accessWidener": "moonrise.accesswidener",
"depends": {
"fabricloader": ">=${loader_version}",
"minecraft": ">=1.21 <=1.21.1",
"fabric-command-api-v2": "*"
},
"custom": {
"lithium:options": {
"mixin.collections.chunk_tickets": false,
"mixin.world.temperature_cache": false,
"mixin.block.flatten_states": false,
"mixin.math.fast_util": false,
"mixin.minimal_nonvanilla.collisions.empty_space": false,
"mixin.alloc.deep_passengers": false,
"mixin.math.fast_blockpos": false,
"mixin.shapes.blockstate_cache": false,
"mixin.world.block_entity_ticking": false,
"mixin.collections.entity_ticking": false,
"mixin.world.chunk_access": false,
"mixin.ai.poi": false,
"mixin.chunk.no_validation": false,
"mixin.minimal_nonvanilla.world.expiring_chunk_tickets": false,
"mixin.world.tick_scheduler": false,
"mixin.alloc.chunk_ticking": false,
"mixin.entity.replace_entitytype_predicates": false,
"mixin.util.block_tracking": false,
"mixin.shapes.specialized_shapes": false,
"mixin.shapes.optimized_matching": false,
"mixin.entity.collisions.intersection": false,
"mixin.entity.collisions.movement": false,
"mixin.entity.collisions.unpushable_cramming": false,
"mixin.chunk.entity_class_groups": false,
"mixin.alloc.entity_tracker": false
}
}
}

View File

@@ -4,7 +4,6 @@ org.gradle.daemon=false
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.21.1
supported_minecraft_versions=1.21,1.21.1
loader_version=0.16.5
neoforge_version=21.1.42
snakeyaml_version=2.2
@@ -12,6 +11,6 @@ concurrentutil_version=0.0.2-SNAPSHOT
cloth_version=15.0.128
lithium_version=mc1.21.1-0.13.0
# Mod Properties
mod_version=0.1.0-beta.3
mod_version=0.1.0-SNAPSHOT
maven_group=ca.spottedleaf.moonrise
archives_base_name=moonrise

View File

@@ -54,14 +54,16 @@ publishMods {
incompatible(
"notenoughcrashes",
"starlight-neoforge",
"canary"
"canary",
"radium"
)
}
curseforge {
incompatible(
"not-enough-crashes-forge",
"starlight-neoforge",
"canary"
"canary",
"radium-reforged"
)
}
}

View File

@@ -45,6 +45,11 @@ type = "incompatible"
modId = "canary"
type = "incompatible"
[[dependencies.moonrise]]
# unofficial lithium port
modId = "radium"
type = "incompatible"
[[dependencies.moonrise]]
modId = "c2me"
type = "incompatible"

View File

@@ -1,11 +1,14 @@
package ca.spottedleaf.moonrise.mixin.chunk_system;
import ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel;
import ca.spottedleaf.moonrise.patches.chunk_system.player.ChunkSystemServerPlayer;
import ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader;
import net.minecraft.network.Connection;
import net.minecraft.network.protocol.Packet;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.network.CommonListenerCookie;
import net.minecraft.server.players.PlayerList;
import net.minecraft.util.Unit;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@@ -30,6 +33,26 @@ abstract class PlayerListMixin {
((ChunkSystemServerPlayer)serverPlayer).moonrise$setRealPlayer(true);
}
/**
* @reason prevent chunk load cycling on join
* @author jpenilla
*/
@Inject(
method = "placeNewPlayer",
at = @At(
target = "Lnet/minecraft/server/level/ServerLevel;addNewPlayer(Lnet/minecraft/server/level/ServerPlayer;)V",
value = "INVOKE"
)
)
private void addJoinTicket(final Connection connection, final ServerPlayer serverPlayer,
final CommonListenerCookie commonListenerCookie, final CallbackInfo ci) {
((ChunkSystemServerLevel) serverPlayer.serverLevel()).moonrise$getChunkTaskScheduler().chunkHolderManager.addTicketAtLevel(
RegionizedPlayerChunkLoader.PLAYER_JOIN,
serverPlayer.chunkPosition(),
RegionizedPlayerChunkLoader.TICK_TICKET_LEVEL,
Unit.INSTANCE);
}
/**
* @reason The RegionizedPlayerChunkLoader will handle the VD packet
* @author Spottedleaf

View File

@@ -39,8 +39,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
// Higher priority to apply after Lithium mixin.world.inline_height.WorldMixin
@Mixin(value = Level.class, priority = 1100)
@Mixin(Level.class)
abstract class LevelMixin implements CollisionLevel, LevelAccessor, AutoCloseable {
@Shadow

View File

@@ -34,6 +34,7 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.level.TicketType;
import net.minecraft.server.network.PlayerChunkSender;
import net.minecraft.util.Unit;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.chunk.ChunkAccess;
@@ -52,6 +53,7 @@ public final class RegionizedPlayerChunkLoader {
public static final TicketType<Long> PLAYER_TICKET = TicketType.create("chunk_system:player_ticket", Long::compareTo);
public static final TicketType<Long> PLAYER_TICKET_DELAYED = TicketType.create("chunk_system:player_ticket_delayed", Long::compareTo, 5 * 20);
public static final TicketType<Unit> PLAYER_JOIN = TicketType.create("chunk_system:player_join", (a, b) -> 0, 5 * 20);
public static final int MIN_VIEW_DISTANCE = 2;
public static final int MAX_VIEW_DISTANCE = 32;