This repository has been archived by the owner on Mar 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
252 additions
and
2 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
patches/0001-unsort-map-value-in-CommandNode-to-prevent-lag.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
From bbd80c909630aed651b23a6966ed562010d350c6 Mon Sep 17 00:00:00 2001 | ||
From: ReinWD <ReinWDD@gmail.com> | ||
Date: Wed, 1 Jan 2020 17:14:11 +0800 | ||
Subject: [PATCH 2/4] reduce EntityInsentient AI | ||
|
||
--- | ||
.../net/minecraft/server/EntityInsentient.java | 6 ++- | ||
.../minecraft/server/PathfinderGoalSelector.java | 46 +++++++++++----------- | ||
2 files changed, 28 insertions(+), 24 deletions(-) | ||
|
||
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java | ||
index 1991cee4..3366b5cb 100644 | ||
--- a/src/main/java/net/minecraft/server/EntityInsentient.java | ||
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java | ||
@@ -7,6 +7,7 @@ import java.util.List; | ||
import java.util.Map; | ||
import java.util.Random; | ||
import java.util.UUID; | ||
+import java.util.concurrent.ThreadLocalRandom; | ||
import javax.annotation.Nullable; | ||
|
||
// CraftBukkit start | ||
@@ -679,11 +680,12 @@ public abstract class EntityInsentient extends EntityLiving { | ||
this.world.getMethodProfiler().enter("sensing"); | ||
this.bw.a(); | ||
this.world.getMethodProfiler().exit(); | ||
+ boolean skipGoalUpdate = !(this instanceof EntityPigZombie || this instanceof EntitySnowman || this instanceof EntityCat || this instanceof EntityWolf) && ThreadLocalRandom.current().nextInt(100) < 90 ; | ||
this.world.getMethodProfiler().enter("targetSelector"); | ||
- this.targetSelector.doTick(); | ||
+ this.targetSelector.doTick(skipGoalUpdate); | ||
this.world.getMethodProfiler().exit(); | ||
this.world.getMethodProfiler().enter("goalSelector"); | ||
- this.goalSelector.doTick(); | ||
+ this.goalSelector.doTick(skipGoalUpdate); | ||
this.world.getMethodProfiler().exit(); | ||
this.world.getMethodProfiler().enter("navigation"); | ||
this.navigation.c(); | ||
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java | ||
index 93513677..4bfd6130 100644 | ||
--- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java | ||
+++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java | ||
@@ -66,7 +66,7 @@ public class PathfinderGoalSelector { | ||
}); | ||
} | ||
|
||
- public void doTick() { | ||
+ public void doTick(boolean skipGoalUpdate) { | ||
this.e.enter("goalCleanup"); | ||
this.c().filter((pathfindergoalwrapped) -> { | ||
boolean flag; | ||
@@ -92,29 +92,31 @@ public class PathfinderGoalSelector { | ||
|
||
}); | ||
this.e.exit(); | ||
- this.e.enter("goalUpdate"); | ||
- this.d.stream().filter((pathfindergoalwrapped) -> { | ||
- return !pathfindergoalwrapped.g(); | ||
- }).filter((pathfindergoalwrapped) -> { | ||
- Stream stream = pathfindergoalwrapped.i().stream(); | ||
- EnumSet enumset = this.f; | ||
- | ||
- this.f.getClass(); | ||
- return stream.noneMatch(enumset::contains); | ||
- }).filter((pathfindergoalwrapped) -> { | ||
- return pathfindergoalwrapped.i().stream().allMatch((pathfindergoal_type) -> { | ||
- return ((PathfinderGoalWrapped) this.c.getOrDefault(pathfindergoal_type, PathfinderGoalSelector.b)).a(pathfindergoalwrapped); | ||
- }); | ||
- }).filter(PathfinderGoalWrapped::a).forEach((pathfindergoalwrapped) -> { | ||
- pathfindergoalwrapped.i().forEach((pathfindergoal_type) -> { | ||
- PathfinderGoalWrapped pathfindergoalwrapped1 = (PathfinderGoalWrapped) this.c.getOrDefault(pathfindergoal_type, PathfinderGoalSelector.b); | ||
+ if (!skipGoalUpdate) { | ||
+ this.e.enter("goalUpdate"); | ||
+ this.d.stream().filter((pathfindergoalwrapped) -> { | ||
+ return !pathfindergoalwrapped.g(); | ||
+ }).filter((pathfindergoalwrapped) -> { | ||
+ Stream stream = pathfindergoalwrapped.i().stream(); | ||
+ EnumSet enumset = this.f; | ||
|
||
- pathfindergoalwrapped1.d(); | ||
- this.c.put(pathfindergoal_type, pathfindergoalwrapped); | ||
+ this.f.getClass(); | ||
+ return stream.noneMatch(enumset::contains); | ||
+ }).filter((pathfindergoalwrapped) -> { | ||
+ return pathfindergoalwrapped.i().stream().allMatch((pathfindergoal_type) -> { | ||
+ return ((PathfinderGoalWrapped) this.c.getOrDefault(pathfindergoal_type, PathfinderGoalSelector.b)).a(pathfindergoalwrapped); | ||
+ }); | ||
+ }).filter(PathfinderGoalWrapped::a).forEach((pathfindergoalwrapped) -> { | ||
+ pathfindergoalwrapped.i().forEach((pathfindergoal_type) -> { | ||
+ PathfinderGoalWrapped pathfindergoalwrapped1 = (PathfinderGoalWrapped) this.c.getOrDefault(pathfindergoal_type, PathfinderGoalSelector.b); | ||
+ | ||
+ pathfindergoalwrapped1.d(); | ||
+ this.c.put(pathfindergoal_type, pathfindergoalwrapped); | ||
+ }); | ||
+ pathfindergoalwrapped.c(); | ||
}); | ||
- pathfindergoalwrapped.c(); | ||
- }); | ||
- this.e.exit(); | ||
+ this.e.exit(); | ||
+ } | ||
this.e.enter("goalTick"); | ||
this.c().forEach(PathfinderGoalWrapped::e); | ||
this.e.exit(); | ||
-- | ||
2.11.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
From 8cec4f35b52083f0e2f2a7563780f015ffe5c243 Mon Sep 17 00:00:00 2001 | ||
From: ReinWD <ReinWDD@gmail.com> | ||
Date: Fri, 14 Feb 2020 07:26:37 +0000 | ||
Subject: [PATCH 3/4] fix compile error | ||
|
||
--- | ||
src/main/java/net/minecraft/server/EntityInsentient.java | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java | ||
index 3366b5cb..3bd5f479 100644 | ||
--- a/src/main/java/net/minecraft/server/EntityInsentient.java | ||
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java | ||
@@ -121,7 +121,7 @@ public abstract class EntityInsentient extends EntityLiving { | ||
super.inactiveTick(); | ||
this.goalSelector.inactiveTick(); | ||
if (this.targetSelector.inactiveTick()) { | ||
- this.targetSelector.doTick(); | ||
+ this.targetSelector.doTick(true); | ||
} | ||
} | ||
// Paper end | ||
-- | ||
2.11.0 | ||
|
60 changes: 60 additions & 0 deletions
60
patches/0004-remove-prespawn-event-implement-monster-tick.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
From 4b80edaff489704476bd22ddca1664417269f2dc Mon Sep 17 00:00:00 2001 | ||
From: ReinWD <ReinWDD@gmail.com> | ||
Date: Mon, 24 Feb 2020 13:28:27 +0000 | ||
Subject: [PATCH 4/4] remove prespawn event & implement monster tick | ||
|
||
--- | ||
.../java/net/minecraft/server/ChunkProviderServer.java | 3 ++- | ||
src/main/java/net/minecraft/server/PlayerChunkMap.java | 15 +-------------- | ||
2 files changed, 3 insertions(+), 15 deletions(-) | ||
|
||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java | ||
index 0de82202..2662e06e 100644 | ||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java | ||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java | ||
@@ -623,6 +623,7 @@ public class ChunkProviderServer extends IChunkProvider { | ||
int k = this.world.getGameRules().getInt(GameRules.RANDOM_TICK_SPEED); | ||
BlockPosition blockposition = this.world.getSpawn(); | ||
boolean flag2 = world.ticksPerAnimalSpawns != 0L && worlddata.getTime() % world.ticksPerAnimalSpawns == 0L; // CraftBukkit // PAIL: TODO monster ticks | ||
+ boolean monsterTick = world.ticksPerMonsterSpawns != 0L && worlddata.getTime() % world.ticksPerMonsterSpawns == 0L; // ReinWD: monsterTick | ||
|
||
this.world.getMethodProfiler().enter("naturalSpawnCount"); | ||
this.world.timings.countNaturalMobs.startTiming(); // Paper - timings | ||
@@ -671,7 +672,7 @@ public class ChunkProviderServer extends IChunkProvider { | ||
// Paper start - timings | ||
this.world.timings.chunkRangeCheckSmall.startTiming(); | ||
// note: this is just a copy of the expression in the if | ||
- boolean smallRadiusOutsideRange = flag1 && (this.allowMonsters || this.allowAnimals) && this.world.getWorldBorder().isInBounds(chunk.getPos()) && !this.playerChunkMap.isOutsideOfRange(chunkcoordintpair, true); | ||
+ boolean smallRadiusOutsideRange = (flag1) && (this.allowMonsters || this.allowAnimals) && (flag2 || monsterTick) && this.world.getWorldBorder().isInBounds(chunk.getPos()) && !this.playerChunkMap.isOutsideOfRange(chunkcoordintpair, true);//ReinWD:monsterTick | ||
this.world.timings.chunkRangeCheckSmall.stopTiming(); | ||
if (smallRadiusOutsideRange) { // Spigot | ||
// Paper end | ||
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java | ||
index 46d20538..a82a06f2 100644 | ||
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java | ||
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java | ||
@@ -1275,20 +1275,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { | ||
// Spigot end | ||
long i = chunkcoordintpair.pair(); | ||
|
||
- return !this.chunkDistanceManager.d(i) ? true : this.playerMap.a(i).noneMatch((entityplayer) -> { | ||
- // Paper start - | ||
- com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent event; | ||
- double blockRange = 16384.0D; | ||
- if (reducedRange) { | ||
- event = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(entityplayer.getBukkitEntity(), (byte) finalChunkRange); | ||
- event.callEvent(); | ||
- blockRange = (double) ((event.getSpawnRadius() << 4) * (event.getSpawnRadius() << 4)); | ||
- if (event.isCancelled()) return false; | ||
- } | ||
- | ||
- return (!entityplayer.isSpectator() && a(chunkcoordintpair, (Entity) entityplayer) < blockRange); // Spigot | ||
- // Paper end | ||
- }); | ||
+ return !this.chunkDistanceManager.d(i); | ||
} | ||
|
||
private boolean b(EntityPlayer entityplayer) { | ||
-- | ||
2.11.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
From 22a0859dc776dc310d3a1e731546ecb48887dd49 Mon Sep 17 00:00:00 2001 | ||
From: ReinWD <ReinWDD@gmail.com> | ||
Date: Tue, 25 Feb 2020 14:50:09 +0000 | ||
Subject: [PATCH] fix map frame | ||
|
||
--- | ||
src/main/java/net/minecraft/server/EntityTrackerEntry.java | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java | ||
index 3a88c9a6..f1139b63 100644 | ||
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java | ||
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java | ||
@@ -83,7 +83,7 @@ public class EntityTrackerEntry { | ||
EntityItemFrame entityitemframe = (EntityItemFrame) this.tracker; | ||
ItemStack itemstack = entityitemframe.getItem(); | ||
|
||
- if (this.tickCounter % 10 == 0 && itemstack.getItem() instanceof ItemWorldMap) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks | ||
+ if (this.tickCounter % 200 == 0 && itemstack.getItem() instanceof ItemWorldMap) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks | ||
WorldMap worldmap = ItemWorldMap.getSavedMap(itemstack, this.b); | ||
Iterator iterator = this.trackedPlayers.iterator(); // CraftBukkit | ||
|
||
-- | ||
2.11.0 | ||
|
34 changes: 34 additions & 0 deletions
34
villager-suppressed/0001-unsort-map-value-in-CommandNode-to-prevent-lag.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
From baa6bcf9efda74fb26fb3be681a0cc7fb1e7b1e4 Mon Sep 17 00:00:00 2001 | ||
From: ReinWD <ReinWDD@gmail.com> | ||
Date: Mon, 30 Dec 2019 23:47:22 +0800 | ||
Subject: [PATCH 1/7] unsort map value in CommandNode to prevent lag | ||
|
||
--- | ||
src/main/java/com/mojang/brigadier/tree/CommandNode.java | 4 ++-- | ||
1 file changed, 2 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main/java/com/mojang/brigadier/tree/CommandNode.java | ||
index 98592a3e..0fbdaf2c 100644 | ||
--- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java | ||
+++ b/src/main/java/com/mojang/brigadier/tree/CommandNode.java | ||
@@ -26,7 +26,7 @@ import java.util.stream.Collectors; | ||
import net.minecraft.server.CommandListenerWrapper; // CraftBukkit | ||
|
||
public abstract class CommandNode<S> implements Comparable<CommandNode<S>> { | ||
- private Map<String, CommandNode<S>> children = Maps.newLinkedHashMap(); | ||
+ private Map<String, CommandNode<S>> children = Maps.newTreeMap(); | ||
private Map<String, LiteralCommandNode<S>> literals = Maps.newLinkedHashMap(); | ||
private Map<String, ArgumentCommandNode<S, ?>> arguments = Maps.newLinkedHashMap(); | ||
private final Predicate<S> requirement; | ||
@@ -107,7 +107,7 @@ public abstract class CommandNode<S> implements Comparable<CommandNode<S>> { | ||
} | ||
} | ||
|
||
- children = children.entrySet().stream().sorted(Map.Entry.comparingByValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new)); | ||
+// children = children.entrySet().stream().sorted(Map.Entry.comparingByValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new)); | ||
} | ||
|
||
public void findAmbiguities(final AmbiguityConsumer<S> consumer) { | ||
-- | ||
2.11.0 | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.