Skip to content

Commit

Permalink
56% Complete
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaKR93 committed Sep 27, 2023
1 parent 4042f69 commit 5efc27e
Show file tree
Hide file tree
Showing 18 changed files with 631 additions and 425 deletions.
2 changes: 1 addition & 1 deletion patches/api/0001-Pufferfish-API-Changes.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Kevin Raneri <[email protected]>
Date: Wed, 27 Sep 2023 09:35:56 +0000
Date: Wed, 27 Sep 2023 05:21:18 +0000
Subject: [PATCH] Pufferfish API Changes

Original: Kevin Raneri <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion patches/api/0002-Purpur-API-Changes.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <[email protected]>
Date: Wed, 27 Sep 2023 09:45:16 +0000
Date: Wed, 27 Sep 2023 05:28:53 +0000
Subject: [PATCH] Purpur API Changes

Original: PurpurMC
Expand Down
2 changes: 1 addition & 1 deletion patches/server/0001-Pufferfish-Server-Changes.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Kevin Raneri <[email protected]>
Date: Wed, 27 Sep 2023 09:35:56 +0000
Date: Wed, 27 Sep 2023 05:21:18 +0000
Subject: [PATCH] Pufferfish Server Changes

Original: Kevin Raneri <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion patches/server/0002-Purpur-Server-Changes.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <[email protected]>
Date: Wed, 27 Sep 2023 09:45:16 +0000
Date: Wed, 27 Sep 2023 05:28:53 +0000
Subject: [PATCH] Purpur Server Changes

Original: PurpurMC
Expand Down
11 changes: 8 additions & 3 deletions patches/server/0006-Plazma-Configurations.patch
Original file line number Diff line number Diff line change
Expand Up @@ -617,10 +617,10 @@ index 0000000000000000000000000000000000000000..92524f24bdb56a861b06fffc900ff3c1
+}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
new file mode 100644
index 0000000000000000000000000000000000000000..5e31a23ed4f31cc06562aa7814812242a04ee086
index 0000000000000000000000000000000000000000..d990c031255daf0d43541efe175c5b52736a6990
--- /dev/null
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
@@ -0,0 +1,40 @@
@@ -0,0 +1,45 @@
+package org.plazmamc.plazma.configurations;
+
+import io.papermc.paper.configuration.Configuration;
Expand All @@ -646,11 +646,16 @@ index 0000000000000000000000000000000000000000..5e31a23ed4f31cc06562aa7814812242
+ @Setting(Configuration.VERSION_FIELD)
+ public int version = CURRENT_VERSION;
+
+ public GlobalConfiguration.Misc misc;
+ public Misc misc;
+ public class Misc extends ConfigurationPart {
+
+ }
+
+ public Entity entity;
+ public class Entity extends ConfigurationPart {
+
+ }
+
+ public Structure structure;
+ public class Structure extends ConfigurationPart {
+
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0014-Configurable-nether-portal-size.patch
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ index e7554ec800f321e4e34c926c53f2375a8c3aa979..c7f974e0b614afa1ced716ff7b6c67ee

// CraftBukkit start - return boolean
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
index 5e31a23ed4f31cc06562aa7814812242a04ee086..0d4139ec1a34510bc8f96f2cbcb913626fd26b65 100644
index d990c031255daf0d43541efe175c5b52736a6990..36c367c577e61422e51ab08c5aaa2a88c94e1636 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
@@ -34,6 +34,27 @@ public class LevelConfigurations extends ConfigurationPart {
@@ -39,6 +39,27 @@ public class LevelConfigurations extends ConfigurationPart {
public NetherPortal netherPortal;
public class NetherPortal extends ConfigurationPart {

Expand Down
385 changes: 385 additions & 0 deletions patches/server/0015-Reduce-create-random-instance.patch

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions patches/server/0016-Apply-various-optimizations.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <[email protected]>
Date: Wed, 27 Sep 2023 22:11:15 +0900
Subject: [PATCH] Apply various optimizations

[REFERENCE PATCHES]
Akarin - Swaps the predicate order of collision

diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 1ca91631b03c9690b4f661ecfb4d500d23cb47ec..4461dc1b76cc2939130680f8039b69af902aa050 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2105,8 +2105,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
public void playerTouch(Player player) {}

public void push(Entity entity) {
+ if (entity.noPhysics || this.noPhysics) return; // Plazma
if (!this.isPassengerOfSameVehicle(entity)) {
- if (!entity.noPhysics && !this.noPhysics) {
+ //if (!entity.noPhysics && !this.noPhysics) { // Plazma - moved up
if (this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper
double d0 = entity.getX() - this.getX();
double d1 = entity.getZ() - this.getZ();
@@ -2135,7 +2136,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
}

- }
+ //} // Plazma
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <[email protected]>
Date: Wed, 27 Sep 2023 22:13:07 +0900
Subject: [PATCH] Avoid double I/O operation on load player file


diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
index 36af81f0957d17e170d229059c66f4eb4539dfeb..b4b74bff0579b919266e91464b36c9381342b677 100644
--- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
+++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
@@ -56,7 +56,8 @@ public class PlayerDataStorage {
File file = new File(this.playerDir, player.getStringUUID() + ".dat");
// Spigot Start
boolean usingWrongFile = false;
- if ( org.bukkit.Bukkit.getOnlineMode() && !file.exists() ) // Paper - Check online mode first
+ boolean isNormalFile = file.exists() && file.isFile(); // Plazma - Avoid double I/O operation
+ if ( org.bukkit.Bukkit.getOnlineMode() && isNormalFile ) // Paper - Check online mode first // Plazma - Avoid double I/O operation
{
file = new File( this.playerDir, java.util.UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + player.getScoreboardName() ).getBytes( "UTF-8" ) ).toString() + ".dat");
if ( file.exists() )
@@ -67,7 +68,7 @@ public class PlayerDataStorage {
}
// Spigot End

- if (file.exists() && file.isFile()) {
+ if (isNormalFile) { // Plazma - Avoid double I/O operation
nbttagcompound = NbtIo.readCompressed(file);
}
// Spigot Start
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <[email protected]>
Date: Wed, 27 Sep 2023 22:15:39 +0900
Subject: [PATCH] Don't refresh LootTable for non player interaction


diff --git a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
index 081691f9710ff1115e4308f79ed49fbc38941193..79a27755534384ab94e79e422c0a5e9ccecacd8c 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
@@ -70,6 +70,7 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc
}

public void unpackLootTable(@Nullable Player player) {
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.dontRefreshLootTableForNonPlayerInteraction && player == null) return; // Plazma
if (this.lootableData.shouldReplenish(player) && this.level.getServer() != null) { // Paper
LootTable lootTable = this.level.getServer().getLootData().getLootTable(this.lootTable);
if (player instanceof ServerPlayer) {
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index f4634cc41e1aabc1e656f6720700c580645c8709..b58d91e842c29a28e8c6cbb275f2906eb361626a 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -26,6 +26,7 @@ public class GlobalConfiguration extends ConfigurationPart {

public boolean reduceCreateRandomInstance = DO_OPTIMIZE;
public boolean suppressThreadSafeRandom = DO_OPTIMIZE;
+ public boolean dontRefreshLootTableForNonPlayerInteraction = DO_OPTIMIZE;

}

36 changes: 36 additions & 0 deletions patches/server/0019-Don-t-load-chunks-to-spawn-phantom.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <[email protected]>
Date: Wed, 27 Sep 2023 22:17:11 +0900
Subject: [PATCH] Don't load chunks to spawn phantom


diff --git a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
index f74c5eda91a3d521763ec7bc33f23e0c62458cc2..e7a9683fe6bd72e9e7644770953506195567e03b 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
@@ -71,6 +71,7 @@ public class PhantomSpawner implements CustomSpawner {

if (randomsource.nextInt(j) >= world.paperConfig().entities.behavior.playerInsomniaStartTicks) { // Paper
BlockPos blockposition1 = blockposition.above(20 + randomsource.nextInt(15)).east(-10 + randomsource.nextInt(21)).south(-10 + randomsource.nextInt(21));
+ if (world.plazmaLevelConfiguration().entity.phantom.dontLoadChunksToSpawn && world.hasChunkAt(blockposition1)) continue; // Plazma
BlockState iblockdata = world.getBlockState(blockposition1);
FluidState fluid = world.getFluidState(blockposition1);

diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
index 146af5bb54da67c134485dc67e8d9a569889434a..0a23900b18ec46ce2a7d47160dff013c7c8a8533 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
@@ -33,6 +33,13 @@ public class LevelConfigurations extends ConfigurationPart {
public Entity entity;
public class Entity extends ConfigurationPart {

+ public Phantom phantom;
+ public class Phantom extends ConfigurationPart {
+
+ public boolean dontLoadChunksToSpawn = DO_OPTIMIZE;
+
+ }
+
}

public Structure structure;
Original file line number Diff line number Diff line change
@@ -1,32 +1,37 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <[email protected]>
Date: Sat, 25 Mar 2023 20:46:40 +0900
Subject: [PATCH] Add configuration to disable moved to quickly check for
spectators
Date: Wed, 27 Sep 2023 22:21:47 +0900
Subject: [PATCH] Add option to disable moved to quickly check for specific
players


diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 255b422078880b46dfa6f5140f6c92fef057d09e..6b6e7b8fbc0bb8a177affff0d7c7029d571faea2 100644
index e001787e40cc0a843e65b36582e9d6593d0fff0e..1af44c18724b2d2dc1d910f5af49254eb845feaf 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1566,7 +1566,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1435,6 +1435,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (!this.player.isChangingDimension() && (!this.player.level().getGameRules().getBoolean(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK) || !this.player.isFallFlying())) {
float f2 = this.player.isFallFlying() ? 300.0F : 100.0F;

- if (d10 - d9 > Math.max(f2, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
+ if (!(this.player.level().plazmaLevelConfiguration().misc.checkSpectatorMovedToQuickly && this.player.isSpectator()) && d10 - d9 > Math.max(f2, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) { // Plazma
+ if (this.player.getBukkitEntity().hasPermission("plazma.bypass-moved-to-quickly-check") || !this.player.level().plazmaLevelConfiguration().entity.player.checkSpectatorMovecToQuickly && this.player.isSpectator()) return; // Plazma
if (d10 - d9 > Math.max(f2, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
// CraftBukkit end
// Paper start - Add fail move event
io.papermc.paper.event.player.PlayerFailMoveEvent event = fireFailMove(io.papermc.paper.event.player.PlayerFailMoveEvent.FailReason.MOVED_TOO_QUICKLY,
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
index 504913e8e05869f8f0b88f0faaf684d39eb14ea7..61c06213b4ceb8e38e9aa41c3517f152d0d669ad 100644
index 0a23900b18ec46ce2a7d47160dff013c7c8a8533..414baade911fab3450430af9378feedc419868f3 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
@@ -88,6 +88,7 @@ public class LevelConfigurations extends ConfigurationPart {
public class Misc extends ConfigurationPart {
@@ -33,6 +33,13 @@ public class LevelConfigurations extends ConfigurationPart {
public Entity entity;
public class Entity extends ConfigurationPart {

public boolean reduceCreateRandomInstance = DO_OPTIMIZE;
+ public boolean checkSpectatorMovedToQuickly = DO_OPTIMIZE;

}
+ public Player player;
+ public class Player extends ConfigurationPart {
+
+ public boolean checkSpectatorMovecToQuickly = !DO_OPTIMIZE;
+
+ }
+
public Phantom phantom;
public class Phantom extends ConfigurationPart {

Loading

0 comments on commit 5efc27e

Please sign in to comment.