Skip to content

Commit

Permalink
more work
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaKR93 committed Nov 6, 2023
1 parent 5220936 commit 71b390a
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ index f6fa9e121fc7daa036219a4ac0daf711d644f8e3..6cfdf5a745256774c714d201604d06ff
NodePath[] REMOVED_WORLD_PATHS = {
};
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index 5e706773d2f64c81a5d3bbf41b8217a343a5d77e..0587540e7f61050d176044e005e79a9ed0e5968f 100644
index 5e706773d2f64c81a5d3bbf41b8217a343a5d77e..921d4bd66f399adcb0d5e3bde9a871b4120b9a8e 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -41,6 +41,21 @@ public class WorldConfigurations extends ConfigurationPart {
Expand All @@ -58,16 +58,16 @@ index 5e706773d2f64c81a5d3bbf41b8217a343a5d77e..0587540e7f61050d176044e005e79a9e
+ public Width width;
+ public class Width extends ConfigurationPart {
+
+ int min; public int min() { return Math.max(this.min, 1); }
+ int max; public int max() { return Math.max(this.min, this.max); }
+ int min = 2; public int min() { return Math.max(this.min, 1); }
+ int max = 21; public int max() { return Math.max(this.min, this.max); }
+
+ }
+
+ public Height height;
+ public class Height extends ConfigurationPart {
+
+ int min; public int min() { return Math.max(this.min, 2); }
+ int max; public int max() { return Math.max(this.min, this.max); }
+ int min = 3; public int min() { return Math.max(this.min, 2); }
+ int max = 21; public int max() { return Math.max(this.min, this.max); }
+
+ }

Expand Down
10 changes: 5 additions & 5 deletions patches/server/0017-Reduce-create-random-instance.patch
Original file line number Diff line number Diff line change
Expand Up @@ -331,27 +331,27 @@ index 6cfdf5a745256774c714d201604d06ff1c7adf7a..78e7583bca7570520264ff880cb112b5
NodePath[] REMOVED_WORLD_PATHS = {
};
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index a5c8b9c697c1c95553314b0cc789ef1d7b93618e..b3c35038a4ac1d2ba3e8030edf53989883d351cf 100644
index a5c8b9c697c1c95553314b0cc789ef1d7b93618e..5cac9ec7ef323134c5992c049ca28b6e7f7a9962 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -36,6 +36,8 @@ public class GlobalConfiguration extends ConfigurationPart {
public Miscellaneous misc;
public class Miscellaneous extends ConfigurationPart {

+ public boolean reduceRandom;
+ public boolean ignoreThreadSafeRandom;
+ public boolean reduceRandom = OPTIMIZE;
+ public boolean ignoreThreadSafeRandom = false;

}

diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index 0587540e7f61050d176044e005e79a9ed0e5968f..6331ea8ccce59512f0a5f69e9db929bd6b66a050 100644
index 921d4bd66f399adcb0d5e3bde9a871b4120b9a8e..dbb27a0d5861e81b59d2c54b1f0ba10d12d3b412 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -21,6 +21,7 @@ public class WorldConfigurations extends ConfigurationPart {
public Miscellaneous misc;
public class Miscellaneous extends ConfigurationPart {

+ public boolean reduceRandom;
+ public boolean reduceRandom = OPTIMIZE;

}

Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ index 78e7583bca7570520264ff880cb112b52d708d5b..48096b0be09c6e99d22e0f3b330d2abf
NodePath[] REMOVED_GLOBAL_PATH = {
};
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index b3c35038a4ac1d2ba3e8030edf53989883d351cf..ff5b557d517ca122cef041a8f9a970df5040b089 100644
index 5cac9ec7ef323134c5992c049ca28b6e7f7a9962..654e3744740b816f7822ab884a00b19d79086f74 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -38,6 +38,7 @@ public class GlobalConfiguration extends ConfigurationPart {

public boolean reduceRandom;
public boolean ignoreThreadSafeRandom;
public boolean reduceRandom = OPTIMIZE;
public boolean ignoreThreadSafeRandom = false;
+ public boolean refreshLootTableForNonPlayerInteraction = !OPTIMIZE;

}
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0024-Ignore-useless-entity-packets.patch
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ index c6ef510d335b8baea58c4491853414a52a06b66b..ccc2f5f71181c1d5c36dcb85de3e4898
this.entity.stopSeenByPlayer(player);
player.connection.send(new ClientboundRemoveEntitiesPacket(new int[]{this.entity.getId()}));
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index 50c78bb76c130e228f9160f09c09b0fb6877a040..fa578a0e72eff9721c7e3b2f21e3043b9b39c35a 100644
index e1866f5be42d7b475356b4aa298c7f454f84deab..59d0b5f605435e8a231ea1dfef05f75b5f46b791 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -28,6 +28,8 @@ public class WorldConfigurations extends ConfigurationPart {
public Entity entity;
public class Entity extends ConfigurationPart {

+ public boolean ignoreUselessPackets;
+ public boolean ignoreUselessPackets = OPTIMIZE;
+
public Phantom phantom;
public class Phantom extends ConfigurationPart {
Expand Down
28 changes: 28 additions & 0 deletions patches/server/0025-Improve-biome-temperature-cache.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <[email protected]>
Date: Mon, 6 Nov 2023 10:39:01 +0900
Subject: [PATCH] Improve biome temperature cache


diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java
index ed439b7e94646141c93a7dd3704d1cdeb5c27e16..642fd0e06f9ab53b4ef2cafe1dc3321a3fd7ee9e 100644
--- a/src/main/java/net/minecraft/world/level/biome/Biome.java
+++ b/src/main/java/net/minecraft/world/level/biome/Biome.java
@@ -67,7 +67,7 @@ public final class Biome {
private final MobSpawnSettings mobSettings;
private final BiomeSpecialEffects specialEffects;
// Pufferfish start - use our cache
- private final ThreadLocal<gg.airplane.structs.Long2FloatAgingCache> temperatureCache = ThreadLocal.withInitial(() -> {
+ private static final ThreadLocal<gg.airplane.structs.Long2FloatAgingCache> temperatureCache = ThreadLocal.withInitial(() -> { // Plazma - Improve biome temperature cache
return Util.make(() -> {
/*
Long2FloatLinkedOpenHashMap long2FloatLinkedOpenHashMap = new Long2FloatLinkedOpenHashMap(1024, 0.25F) {
@@ -125,7 +125,7 @@ public final class Biome {
public float getTemperature(BlockPos blockPos) {
long l = blockPos.asLong();
// Pufferfish start
- gg.airplane.structs.Long2FloatAgingCache cache = this.temperatureCache.get();
+ gg.airplane.structs.Long2FloatAgingCache cache = temperatureCache.get(); // Plazma - Improve biome temperature cache
float f = cache.getValue(l);
if (!Float.isNaN(f)) {
return f;
46 changes: 46 additions & 0 deletions patches/server/0026-Configurable-entity-sensor-tick.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <[email protected]>
Date: Mon, 6 Nov 2023 11:36:08 +0900
Subject: [PATCH] Configurable entity sensor tick


diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 620b5011a675e456ac685d4323df233b5b8f8799..86c1ca70ebd4b764102a59b3772e0ca799a923b2 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -938,10 +938,10 @@ public abstract class Mob extends LivingEntity implements Targeting {
}
// Paper end
//this.level().getProfiler().push("sensing"); // Purpur
- this.sensing.tick();
//this.level().getProfiler().pop(); // Purpur
int i = this.level().getServer().getTickCount() + this.getId();

+ if (i % this.level().plazmaConfig().entity.sensorTick == 0) this.sensing.tick(); // Plazma - Configurable entity sensor tick
if (i % 2 != 0 && this.tickCount > 1) {
//this.level().getProfiler().push("targetSelector"); // Purpur
if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
diff --git a/src/main/java/org/plazmamc/plazma/configurations/ChangedConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/ChangedConfigurations.java
index 5d61009f67df2de88b467d646de624e3f4e5d787..908b0a185a262f1a8db5ff566605123d36ba48cb 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/ChangedConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/ChangedConfigurations.java
@@ -15,6 +15,7 @@ interface ChangedConfigurations {
put(path("misc", "reduce-create-random-instance"), "misc.reduce-random");
put(path("misc", "suppress-thread-safe-random"), "misc.ignore-thread-safe-random");
put(path("entity", "monster", "phantom", "dont-load-chunks-to-spawn"), "entity.phantom.load-chunks-to-spawn");
+ put(path("entity", "sensor", "tick"), "entity.sensor-tick");
}};
NodePath[] REMOVED_WORLD_PATHS = {
path("misc", "check-spectator-moved-to-quickly")
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index 59d0b5f605435e8a231ea1dfef05f75b5f46b791..fae1913ec6b3689388f14f4b9c925dd53954cf62 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -29,6 +29,7 @@ public class WorldConfigurations extends ConfigurationPart {
public class Entity extends ConfigurationPart {

public boolean ignoreUselessPackets = OPTIMIZE;
+ public int sensorTick = 1;

public Phantom phantom;
public class Phantom extends ConfigurationPart {

0 comments on commit 71b390a

Please sign in to comment.