Skip to content

Commit

Permalink
work
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaKR93 committed Oct 31, 2024
1 parent dfb64f5 commit e37f05b
Show file tree
Hide file tree
Showing 7 changed files with 9,378 additions and 19 deletions.
9,358 changes: 9,358 additions & 0 deletions patches/24w44a.patch

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ 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 4b4bdaf8c43e15ba953c160a003a719aaf730318..35f150d348c3bd27416c60840988d381b85f9ccf 100644
index ff9d23aef4658922692b43a859bd83632fe23612..8e5ad4cd6c8f61661b87dc96ba914c0bcd199879 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -953,10 +953,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
//ProfilerFiller gameprofilerfiller = this.level().getProfiler(); // Purpur
@@ -949,10 +949,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
//ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur

//gameprofilerfiller.push("sensing"); // Purpur
- this.sensing.tick();
+ //this.sensing.tick(); // Plazma - Moved down
+ //this.sensing.tick(); // Plazma - moved down
//gameprofilerfiller.pop(); // Purpur
int i = this.tickCount + 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) {
//gameprofilerfiller.push("targetSelector"); // Purpur
if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
this.targetSelector.tickRunningGoals(false);
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index d5e7d74b0e203c9f2c03c9b4f8d1b9c57168e61f..eff241544ba009f62179fb1668bd9d78795e7002 100644
index 4d204a0dc976d96c98764092c8461b0e2b920fc1..33bcfec86f83ce6e0ec17436ad38da8aeced48be 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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Variable entity wakeup duration


diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index eff241544ba009f62179fb1668bd9d78795e7002..8690dc9d818d7991c7b05d471c547b4cb1713bbe 100644
index 33bcfec86f83ce6e0ec17436ad38da8aeced48be..b047af738236be3400d07d46c663017ed39b6f96 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -37,6 +37,20 @@ public class WorldConfigurations extends ConfigurationPart {
Expand All @@ -28,21 +28,22 @@ index eff241544ba009f62179fb1668bd9d78795e7002..8690dc9d818d7991c7b05d471c547b4c
+
}

public Structure structure;
public Block block;
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index ed1cdea66dd117ecafd14a52727f094430f39b60..2c30e659d0ec28c0ec4f8ccb0fa29de5a31d3881 100644
index 813b8aeb7bf39e03346fd9ca63c4c6498e162965..9843f440d921a61c60df5ec5e6e7ffebc9444b71 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -67,29 +67,36 @@ public class ActivationRange
Activity.PANIC
@@ -61,29 +61,37 @@ public class ActivationRange
net.minecraft.world.entity.schedule.Activity.PANIC
};

+ // Plazma start - Variable entity wakeup duration
+ private static int getWakeupDuration(net.minecraft.util.RandomSource random, int duration, double deviation) {
+ private static int getWakeUpDuration(net.minecraft.util.RandomSource random, int duration, double deviation) {
+ if (deviation == 0) return duration;
+ return (int) Math.min(Integer.MAX_VALUE, Math.max(1, Math.round(duration * (1 + deviation * random.nextGaussian()))));
+ }
+ // Plazma end - Variable entity wakeup duration
+
private static int checkInactiveWakeup(Entity entity) {
Level world = entity.level();
SpigotWorldConfig config = world.spigotConfig;
Expand All @@ -52,25 +53,25 @@ index ed1cdea66dd117ecafd14a52727f094430f39b60..2c30e659d0ec28c0ec4f8ccb0fa29de5
if (inactiveFor > config.wakeUpInactiveVillagersEvery && world.wakeupInactiveRemainingVillagers > 0) {
world.wakeupInactiveRemainingVillagers--;
- return config.wakeUpInactiveVillagersFor;
+ return getWakeupDuration(world.getRandom(), config.wakeUpInactiveVillagersFor, plazmaConfig.entity.wakeUpDurationVariance.villager()); // Plazma - Variable entity wakeup duration
+ return getWakeUpDuration(world.getRandom(), config.wakeUpInactiveVillagersFor, plazmaConfig.entity.wakeUpDurationVariance.villager()); // Plazma - Variable entity wakeup duration
}
} else if (entity.activationType == ActivationType.ANIMAL) {
if (inactiveFor > config.wakeUpInactiveAnimalsEvery && world.wakeupInactiveRemainingAnimals > 0) {
world.wakeupInactiveRemainingAnimals--;
- return config.wakeUpInactiveAnimalsFor;
+ return getWakeupDuration(world.getRandom(), config.wakeUpInactiveAnimalsFor, plazmaConfig.entity.wakeUpDurationVariance.animal()); // Plazma - Variable entity wakeup duration
+ return getWakeUpDuration(world.getRandom(), config.wakeUpInactiveAnimalsFor, plazmaConfig.entity.wakeUpDurationVariance.animal()); // Plazma - Variable entity wakeup duration
}
} else if (entity.activationType == ActivationType.FLYING_MONSTER) {
if (inactiveFor > config.wakeUpInactiveFlyingEvery && world.wakeupInactiveRemainingFlying > 0) {
world.wakeupInactiveRemainingFlying--;
- return config.wakeUpInactiveFlyingFor;
+ return getWakeupDuration(world.getRandom(), config.wakeUpInactiveFlyingFor, plazmaConfig.entity.wakeUpDurationVariance.flying()); // Plazma - Variable entity wakeup duration
+ return getWakeUpDuration(world.getRandom(), config.wakeUpInactiveFlyingFor, plazmaConfig.entity.wakeUpDurationVariance.flying()); // Plazma - Variable entity wakeup duration
}
} else if (entity.activationType == ActivationType.MONSTER || entity.activationType == ActivationType.RAIDER) {
if (inactiveFor > config.wakeUpInactiveMonstersEvery && world.wakeupInactiveRemainingMonsters > 0) {
world.wakeupInactiveRemainingMonsters--;
- return config.wakeUpInactiveMonstersFor;
+ return getWakeupDuration(world.getRandom(), config.wakeUpInactiveMonstersFor, plazmaConfig.entity.wakeUpDurationVariance.monster()); // Plazma - Variable entity wakeup duration
+ return getWakeUpDuration(world.getRandom(), config.wakeUpInactiveMonstersFor, plazmaConfig.entity.wakeUpDurationVariance.monster()); // Plazma - Variable entity wakeup duration
}
}
return -1;
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Subject: [PATCH] Add entity spawn deadlock timer
- AbsolemJackdaw/FixMySpawnR

diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index 967af8771ff8564c715d89f4b4b69b16c25add59..2ac5fb585636523787e05edaa58a4fa34a39ef28 100644
index bb4411cfdf1bc7adc12c2f918d2eec830299f38b..357d484029fe338bea4f5770d13ccfc0dce4432e 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -50,6 +50,8 @@ public abstract class BaseSpawner {
Expand Down Expand Up @@ -61,7 +61,7 @@ index 967af8771ff8564c715d89f4b4b69b16c25add59..2ac5fb585636523787e05edaa58a4fa3
return nbt;
}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index 8690dc9d818d7991c7b05d471c547b4cb1713bbe..e5989010aa752c23eda58a6df87aa6925f45671a 100644
index b047af738236be3400d07d46c663017ed39b6f96..6c9c28ae5fbe62ba647e7790acccb377d1e62490 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -51,6 +51,14 @@ public class WorldConfigurations extends ConfigurationPart {
Expand All @@ -78,4 +78,4 @@ index 8690dc9d818d7991c7b05d471c547b4cb1713bbe..e5989010aa752c23eda58a6df87aa692
+
}

public Structure structure;
public Block block;

0 comments on commit e37f05b

Please sign in to comment.