Drop akarin's stream replacements

Fixes bad performance out of the box for production. 
Apparently there's another issue which is thinkering our minds up, it is that after certain amount of time the gc just can't keep up. We're investigating into this, but until it is fixed - this is gonna be a stable build 

Co-authored-by: Mykyta Komarn <nkomarn@hotmail.com>
This commit is contained in:
Ivan Pekov 2020-10-08 14:04:22 +03:00 committed by GitHub
parent 5431509f72
commit 0a19056af0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 725 additions and 1400 deletions

View File

@ -62,8 +62,8 @@ # Patches
| server | Fix the dead lagging the server | William Blake Galbreath | | | server | Fix the dead lagging the server | William Blake Galbreath | |
| server | Fix villager dupe | Ivan Pekov | | | server | Fix villager dupe | Ivan Pekov | |
| server | Global Eula file | tr7zw | | | server | Global Eula file | tr7zw | |
| server | Heavily optimize furnance fuel and recipe lookups | tr7zw | | | server | Heavily optimize furnance fuel and recipe lookups | tr7zw | Mykyta Komarn |
| server | Heavily optimize recipe lookups in CraftingManager | Mykyta Komarn | | | server | Heavily optimize recipe lookups in CraftingManager | Mykyta Komarn | Ivan Pekov |
| server | Highly optimize VillagePlace filtering | Ivan Pekov | | | server | Highly optimize VillagePlace filtering | Ivan Pekov | |
| server | Hopper Optimizations | Phoenix616 | | | server | Hopper Optimizations | Phoenix616 | |
| server | Improve task performance | ishland | Mykyta Komarn | | server | Improve task performance | ishland | Mykyta Komarn |
@ -98,12 +98,9 @@ # Patches
| server | ProxyForwardDataEvent | Ivan Pekov | | | server | ProxyForwardDataEvent | Ivan Pekov | |
| server | Purpur config files | William Blake Galbreath | | | server | Purpur config files | William Blake Galbreath | |
| server | Redirect Configs | tr7zw | | | server | Redirect Configs | tr7zw | |
| api | Remove Streams using IntelliJ IDEA | ㄗㄠˋ ㄑㄧˊ | |
| server | Remove Streams using IntelliJ IDEA | ㄗㄠˋ ㄑㄧˊ | |
| server | Remove a few more streams | Sotr | |
| server | Remove some streams and object allocations | Phoenix616 | | | server | Remove some streams and object allocations | Phoenix616 | |
| server | Remove stream for ender teleport | Sotr | |
| server | Remove vanilla profiler callers | Sotr | | | server | Remove vanilla profiler callers | Sotr | |
| server | Replace some hot streams | Ivan Pekov | |
| server | Respect PlayerKickEvent leaveMessage | Ivan Pekov | | | server | Respect PlayerKickEvent leaveMessage | Ivan Pekov | |
| server | Respect rotation when respawning | Ivan Pekov | | | server | Respect rotation when respawning | Ivan Pekov | |
| server | Send more packets immediately | MrIvanPlays | | | server | Send more packets immediately | MrIvanPlays | |

View File

@ -1 +0,0 @@
Remove-Streams-using-IntelliJ-IDEA

View File

@ -1 +1 @@
Disable-the-Snooper&Avoid-double-I-O-operation-on-load-player-file&Remove-vanilla-profiler-callers&Swaps-the-predicate-order-of-collision&Remove-stream-for-ender-teleport&Remove-a-few-more-streams&Remove-Streams-using-IntelliJ-IDEA Disable-the-Snooper&Avoid-double-I-O-operation-on-load-player-file&Remove-vanilla-profiler-callers&Swaps-the-predicate-order-of-collision

File diff suppressed because it is too large Load Diff

View File

@ -39,10 +39,10 @@ index 74ed02fa9296583977bb721014b10ff8b708b43c..a13c7b2b5bc79ecaea404779149ed02c
.completer(new ConsoleCommandCompleter(this.server)) .completer(new ConsoleCommandCompleter(this.server))
); );
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index bb3e62ace9b0e9f599b5434f6f1dd4eede842593..a610187193cc0b19a34e93939fa2a96105157810 100644 index 6da7e4acb1993b919afc5c5c063010a26568e707..96943eae34eb95d14f45cd59bc73c7901baf27c4 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1513,7 +1513,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -1520,7 +1520,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
} }
public String getServerModName() { public String getServerModName() {
@ -155,10 +155,10 @@ index 0000000000000000000000000000000000000000..fdfd1af1309df4a400b47768708bec7a
+} +}
\ No newline at end of file \ No newline at end of file
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index b07659d2df48f3d131c8ddf94ff2a1e12afc3d08..42628d6dbf54977d34442f46c89b771af3af5b11 100644 index ed594eb6c8102b0ce1b52f2d2db714aa9fdeffd0..7277919e1cc5ee8f8fead434a1a33c9008c1618e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -218,7 +218,7 @@ import javax.annotation.Nullable; // Paper @@ -232,7 +232,7 @@ import javax.annotation.Nullable; // Paper
import javax.annotation.Nonnull; // Paper import javax.annotation.Nonnull; // Paper
public final class CraftServer implements Server { public final class CraftServer implements Server {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add GameProfileLookupEvent
diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
index dd96dd296d042c0625e527b50b3acfc19a2bf43e..2a67013f6d2656a3d89cb042ba401bcaeb731d83 100644 index 2751ce7f1556da07ef853807a588f096adf6ef7f..8bda2180576d3c58ad592e6158621160a8c4c5cf 100644
--- a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java --- a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java +++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
@@ -185,13 +185,24 @@ public class CraftPlayerProfile implements PlayerProfile { @@ -183,13 +183,24 @@ public class CraftPlayerProfile implements PlayerProfile {
boolean isCompleteFromCache = this.completeFromCache(true, onlineMode); boolean isCompleteFromCache = this.completeFromCache(true, onlineMode);
if (onlineMode && (!isCompleteFromCache || textures && !hasTextures())) { if (onlineMode && (!isCompleteFromCache || textures && !hasTextures())) {

View File

@ -7,10 +7,10 @@ Original patch by:
Co-authored-by: tr7zw <tr7zw@live.de> Co-authored-by: tr7zw <tr7zw@live.de>
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index a610187193cc0b19a34e93939fa2a96105157810..680c139e249fce8dedf5a63ac5034b930b8e8540 100644 index 96943eae34eb95d14f45cd59bc73c7901baf27c4..ac31ce44ec5605a9f6bede0e68c13a7696ad0521 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -928,6 +928,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -935,6 +935,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
// Paper End // Paper End
// Spigot End // Spigot End
@ -19,7 +19,7 @@ index a610187193cc0b19a34e93939fa2a96105157810..680c139e249fce8dedf5a63ac5034b93
protected void w() { protected void w() {
try { try {
long serverStartTime = SystemUtils.getMonotonicNanos(); // Paper long serverStartTime = SystemUtils.getMonotonicNanos(); // Paper
@@ -996,7 +998,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -1003,7 +1005,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.a(gameprofilertick); this.a(gameprofilertick);
//this.methodProfiler.a(); // Akarin - remove caller //this.methodProfiler.a(); // Akarin - remove caller
//this.methodProfiler.enter("tick"); // Akarin - remove caller //this.methodProfiler.enter("tick"); // Akarin - remove caller
@ -63,10 +63,10 @@ index 0000000000000000000000000000000000000000..b506aaeab4ad997b83d3aa6daaab6eea
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 42628d6dbf54977d34442f46c89b771af3af5b11..4bae0e82bc25b576a23b5f05af7c3ad944a54bcf 100644 index 7277919e1cc5ee8f8fead434a1a33c9008c1618e..0645185e2d73f7001a07a9f5c8461da71b1327d5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2420,4 +2420,6 @@ public final class CraftServer implements Server { @@ -2432,4 +2432,6 @@ public final class CraftServer implements Server {
return getServer().lagging; return getServer().lagging;
} }
// Purpur end // Purpur end

View File

@ -46,7 +46,7 @@ index 050e0d7ec29755590dde2f35090b96f6f2457952..72d7a017f2aa7f2fde3b5de437e7fd2e
this.setAllowFlight(dedicatedserverproperties.allowFlight); this.setAllowFlight(dedicatedserverproperties.allowFlight);
this.setResourcePack(dedicatedserverproperties.resourcePack, this.aZ()); this.setResourcePack(dedicatedserverproperties.resourcePack, this.aZ());
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 7623705cab7c749fc53187e4d0324fe5f061c545..6c03d218aa6a4d4d12d7e3f73093057f5af11bf8 100644 index 154cb30369fdda685dcb82051a5244dba4d5b912..2247b200cd3f2246c35eb5312153122fa033d05e 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -267,6 +267,7 @@ public abstract class EntityLiving extends Entity { @@ -267,6 +267,7 @@ public abstract class EntityLiving extends Entity {
@ -278,10 +278,10 @@ index 0000000000000000000000000000000000000000..c4dd521d18dd60ec07bdcf0d367b5135
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 4bae0e82bc25b576a23b5f05af7c3ad944a54bcf..78d7fc805a1aeb0d31e51a5aa68e92d9ffd7ba73 100644 index 0645185e2d73f7001a07a9f5c8461da71b1327d5..efbfcc5038a1019725eba46e5379a86e78617fb8 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -845,6 +845,7 @@ public final class CraftServer implements Server { @@ -859,6 +859,7 @@ public final class CraftServer implements Server {
com.tuinity.tuinity.config.TuinityConfig.init((File) console.options.valueOf("tuinity-settings")); // Tuinity - Server Config com.tuinity.tuinity.config.TuinityConfig.init((File) console.options.valueOf("tuinity-settings")); // Tuinity - Server Config
net.pl3x.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur net.pl3x.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur
de.minebench.origami.OrigamiConfig.init((File) console.options.valueOf("origami-settings")); // Origami de.minebench.origami.OrigamiConfig.init((File) console.options.valueOf("origami-settings")); // Origami
@ -289,7 +289,7 @@ index 4bae0e82bc25b576a23b5f05af7c3ad944a54bcf..78d7fc805a1aeb0d31e51a5aa68e92d9
for (WorldServer world : console.getWorlds()) { for (WorldServer world : console.getWorlds()) {
world.worldDataServer.setDifficulty(config.difficulty); world.worldDataServer.setDifficulty(config.difficulty);
world.setSpawnFlags(config.spawnMonsters, config.spawnAnimals); world.setSpawnFlags(config.spawnMonsters, config.spawnAnimals);
@@ -2274,6 +2275,13 @@ public final class CraftServer implements Server { @@ -2288,6 +2289,13 @@ public final class CraftServer implements Server {
} }
// Origami end // Origami end

View File

@ -59,10 +59,10 @@ index 537456a7427cddd6783f5b5d8ee2d655668c4c53..004184a7c3da4f72f68a5fd9b4dd5abd
} }
\ No newline at end of file \ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 6c03d218aa6a4d4d12d7e3f73093057f5af11bf8..bf1cea04d5c997106a55775a4ad5b27267032f87 100644 index 2247b200cd3f2246c35eb5312153122fa033d05e..f09fc6460f514367aad146e4122e18a679961e2a 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -2861,7 +2861,7 @@ public abstract class EntityLiving extends Entity { @@ -2859,7 +2859,7 @@ public abstract class EntityLiving extends Entity {
// Paper - end don't run getEntities if we're not going to use its result // Paper - end don't run getEntities if we're not going to use its result
// Tuinity start - reduce memory allocation from collideNearby // Tuinity start - reduce memory allocation from collideNearby
List<Entity> list = com.tuinity.tuinity.util.CachedLists.getTempGetEntitiesList(); List<Entity> list = com.tuinity.tuinity.util.CachedLists.getTempGetEntitiesList();

View File

@ -39,7 +39,7 @@ index 5d3bb5f393a1e0e4a2e8b9a466530a91279697a9..7f084e7f11a829c10d113c7fb39eec0b
if (enumdirection2 != EnumDirection.DOWN && world.isBlockFacePowered(blockposition1.shift(enumdirection2), enumdirection2)) { if (enumdirection2 != EnumDirection.DOWN && world.isBlockFacePowered(blockposition1.shift(enumdirection2), enumdirection2)) {
return true; return true;
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index bf1cea04d5c997106a55775a4ad5b27267032f87..3fcf1c09def4675ecf815cb161561574ef802d0c 100644 index f09fc6460f514367aad146e4122e18a679961e2a..d7e72ae7c33c55f05b59932404c81544ab483864 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -2580,10 +2580,12 @@ public abstract class EntityLiving extends Entity { @@ -2580,10 +2580,12 @@ public abstract class EntityLiving extends Entity {

View File

@ -9,7 +9,7 @@ Original code by JellySquid, licensed under GNU Lesser General Public License v3
you can find the original code on https://github.com/jellysquid3/lithium-fabric/tree/1.16.x/fabric (Yarn mappings) you can find the original code on https://github.com/jellysquid3/lithium-fabric/tree/1.16.x/fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
index b783028e5526df722d98e4760ffb214d5d2f83dd..9be854ebef1eb23ee4cc5d733e43dfca7d6439f7 100644 index 81df1cf34db8a1477bd394acd4e10b0da197c595..3cac9ebf4f9e2d9289a71e2065260b628b8ad19f 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java --- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
@@ -11,6 +11,7 @@ import java.util.function.Supplier; @@ -11,6 +11,7 @@ import java.util.function.Supplier;

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Option for simpler Villagers
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
index 962257cc86abe5aaa96c03c6db6611843ab59c7f..16e52c38788719b275c92390893a6e9c0e769eb7 100644 index 8c58564ee9397e549a51c1a7cb76156c26a82e0c..939ef3bd6439a68dba4224661d050c6af0164178 100644
--- a/src/main/java/net/minecraft/server/EntityVillager.java --- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java
@@ -27,6 +27,7 @@ import org.bukkit.event.entity.VillagerReplenishTradeEvent; @@ -31,6 +31,7 @@ import org.bukkit.event.entity.VillagerReplenishTradeEvent;
public class EntityVillager extends EntityVillagerAbstract implements ReputationHandler, VillagerDataHolder { public class EntityVillager extends EntityVillagerAbstract implements ReputationHandler, VillagerDataHolder {
@ -16,7 +16,7 @@ index 962257cc86abe5aaa96c03c6db6611843ab59c7f..16e52c38788719b275c92390893a6e9c
private static final DataWatcherObject<VillagerData> br = DataWatcher.a(EntityVillager.class, DataWatcherRegistry.q); private static final DataWatcherObject<VillagerData> br = DataWatcher.a(EntityVillager.class, DataWatcherRegistry.q);
public static final Map<Item, Integer> bp = ImmutableMap.of(Items.BREAD, 4, Items.POTATO, 1, Items.CARROT, 1, Items.BEETROOT, 1); public static final Map<Item, Integer> bp = ImmutableMap.of(Items.BREAD, 4, Items.POTATO, 1, Items.CARROT, 1, Items.BEETROOT, 1);
private static final Set<Item> bs = ImmutableSet.of(Items.BREAD, Items.POTATO, Items.CARROT, Items.WHEAT, Items.WHEAT_SEEDS, Items.BEETROOT, new Item[]{Items.BEETROOT_SEEDS}); private static final Set<Item> bs = ImmutableSet.of(Items.BREAD, Items.POTATO, Items.CARROT, Items.WHEAT, Items.WHEAT_SEEDS, Items.BEETROOT, new Item[]{Items.BEETROOT_SEEDS});
@@ -63,13 +64,55 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @@ -67,13 +68,55 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
public EntityVillager(EntityTypes<? extends EntityVillager> entitytypes, World world, VillagerType villagertype) { public EntityVillager(EntityTypes<? extends EntityVillager> entitytypes, World world, VillagerType villagertype) {
super(entitytypes, world); super(entitytypes, world);
this.by = new Reputation(); this.by = new Reputation();
@ -72,7 +72,7 @@ index 962257cc86abe5aaa96c03c6db6611843ab59c7f..16e52c38788719b275c92390893a6e9c
@Override @Override
public BehaviorController<EntityVillager> getBehaviorController() { public BehaviorController<EntityVillager> getBehaviorController() {
return (BehaviorController<EntityVillager>) super.getBehaviorController(); // CraftBukkit - decompile error return (BehaviorController<EntityVillager>) super.getBehaviorController(); // CraftBukkit - decompile error
@@ -82,6 +125,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @@ -86,6 +129,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
@Override @Override
protected BehaviorController<?> a(Dynamic<?> dynamic) { protected BehaviorController<?> a(Dynamic<?> dynamic) {
@ -80,7 +80,7 @@ index 962257cc86abe5aaa96c03c6db6611843ab59c7f..16e52c38788719b275c92390893a6e9c
BehaviorController<EntityVillager> behaviorcontroller = this.cJ().a(dynamic); BehaviorController<EntityVillager> behaviorcontroller = this.cJ().a(dynamic);
this.a(behaviorcontroller); this.a(behaviorcontroller);
@@ -167,10 +211,39 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @@ -171,10 +215,39 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
} }
// Spigot End // Spigot End
@ -120,7 +120,7 @@ index 962257cc86abe5aaa96c03c6db6611843ab59c7f..16e52c38788719b275c92390893a6e9c
// Purpur start // Purpur start
boolean tick = (world.getTime() + brainTickOffset) % world.purpurConfig.villagerBrainTicks == 0; boolean tick = (world.getTime() + brainTickOffset) % world.purpurConfig.villagerBrainTicks == 0;
if (((WorldServer) world).getMinecraftServer().lagging ? tick : world.purpurConfig.villagerUseBrainTicksOnlyWhenLagging || tick) if (((WorldServer) world).getMinecraftServer().lagging ? tick : world.purpurConfig.villagerUseBrainTicksOnlyWhenLagging || tick)
@@ -340,6 +413,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @@ -344,6 +417,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
return this.bD == 0 || this.bD < 2 && this.world.getTime() > this.bC + 2400L; return this.bD == 0 || this.bD < 2 && this.world.getTime() > this.bC + 2400L;
} }
@ -128,7 +128,7 @@ index 962257cc86abe5aaa96c03c6db6611843ab59c7f..16e52c38788719b275c92390893a6e9c
public boolean fc() { public boolean fc() {
long i = this.bC + 12000L; long i = this.bC + 12000L;
long j = this.world.getTime(); long j = this.world.getTime();
@@ -362,6 +436,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @@ -366,6 +440,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
return this.fn() && this.fm(); return this.fn() && this.fm();
} }
@ -136,7 +136,7 @@ index 962257cc86abe5aaa96c03c6db6611843ab59c7f..16e52c38788719b275c92390893a6e9c
private void fo() { private void fo() {
int i = 2 - this.bD; int i = 2 - this.bD;
@@ -592,6 +667,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @@ -596,6 +671,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
} }
private void a(Entity entity) { private void a(Entity entity) {
@ -144,7 +144,7 @@ index 962257cc86abe5aaa96c03c6db6611843ab59c7f..16e52c38788719b275c92390893a6e9c
if (this.world instanceof WorldServer) { if (this.world instanceof WorldServer) {
Optional<List<EntityLiving>> optional = this.bg.getMemory(MemoryModuleType.VISIBLE_MOBS); Optional<List<EntityLiving>> optional = this.bg.getMemory(MemoryModuleType.VISIBLE_MOBS);
@@ -617,6 +693,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @@ -612,6 +688,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
} }
public void a(MemoryModuleType<GlobalPos> memorymoduletype) { public void a(MemoryModuleType<GlobalPos> memorymoduletype) {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Heavily optimize furnance fuel and recipe lookups
Co-authored-by: Mykyta Komarn <nkomarn@hotmail.com> Co-authored-by: Mykyta Komarn <nkomarn@hotmail.com>
diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java
index 99bd8626b28a837f0da2268d89fddb6d28b2a944..ba9424eafc02a5311e0cbd43c340ca8962917acc 100644 index 1d3c2dd93657fb5dc71ee6b444c585b54619d1e8..77ea56c5a25fe09a1721429d42965ad34d905870 100644
--- a/src/main/java/net/minecraft/server/TileEntityFurnace.java --- a/src/main/java/net/minecraft/server/TileEntityFurnace.java
+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java +++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java
@@ -83,7 +83,14 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I @@ -83,7 +83,14 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
@ -32,7 +32,7 @@ index 99bd8626b28a837f0da2268d89fddb6d28b2a944..ba9424eafc02a5311e0cbd43c340ca89
return map; return map;
} }
@@ -273,7 +281,10 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I @@ -271,7 +279,10 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
this.cookTime = MathHelper.clamp(this.cookTime - 2, 0, this.cookTimeTotal); this.cookTime = MathHelper.clamp(this.cookTime - 2, 0, this.cookTimeTotal);
} }
} else { } else {
@ -44,7 +44,7 @@ index 99bd8626b28a837f0da2268d89fddb6d28b2a944..ba9424eafc02a5311e0cbd43c340ca89
if (!this.isBurning() && this.canBurn(irecipe)) { if (!this.isBurning() && this.canBurn(irecipe)) {
// CraftBukkit start // CraftBukkit start
@@ -599,4 +610,18 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I @@ -597,4 +608,18 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
} }
} }

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Fix lead fall dmg config
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 6c8368c40501e4c30fb24496a348d9994695ee9a..7fda4b1492783e37b5bf83f7d33df92d46fa8ff0 100644 index 1ec7046dd79c07203d7c4a8c60145db9d0ac3b82..898446130f264055eeca2e5de3c30201e05f484a 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1264,6 +1264,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -1264,6 +1264,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Optimize player loops around weather
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 72d033f2dae5d8a4670265fbd9c125701b945be1..0c8500ddc5a6662da7de292639e976b07d3a29d6 100644 index 7c60ad59e7dbb2fd4089f762c9bbe1cb5f7b6054..274b7e04ff09e459cd63040b1c29e3d197aafe72 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -814,12 +814,17 @@ public class WorldServer extends World implements GeneratorAccessSeed { @@ -821,12 +821,17 @@ public class WorldServer extends World implements GeneratorAccessSeed {
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.i, this.thunderLevel)); this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.i, this.thunderLevel));
} }
// */ // */
@ -19,8 +19,8 @@ index 72d033f2dae5d8a4670265fbd9c125701b945be1..0c8500ddc5a6662da7de292639e976b0
+ for (EntityPlayer player : players) { + for (EntityPlayer player : players) {
+ if (player.world == this) { + if (player.world == this) {
+ player.tickWeather(); + player.tickWeather();
+ player.updateWeather(this.lastRainLevel, this.rainLevel, this.lastThunderLevel, this.thunderLevel);
+ if (flag != this.isRaining()) player.setPlayerWeather((!flag ? WeatherType.DOWNFALL : WeatherType.CLEAR), false); + if (flag != this.isRaining()) player.setPlayerWeather((!flag ? WeatherType.DOWNFALL : WeatherType.CLEAR), false);
+ player.updateWeather(this.lastRainLevel, this.rainLevel, this.lastThunderLevel, this.thunderLevel);
+ // Yatopia end + // Yatopia end
} }
} }
@ -29,11 +29,11 @@ index 72d033f2dae5d8a4670265fbd9c125701b945be1..0c8500ddc5a6662da7de292639e976b0
if (flag != this.isRaining()) { if (flag != this.isRaining()) {
// Only send weather packets to those affected // Only send weather packets to those affected
for (int idx = 0; idx < this.players.size(); ++idx) { for (int idx = 0; idx < this.players.size(); ++idx) {
@@ -833,6 +838,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { @@ -841,6 +846,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
((EntityPlayer) this.players.get(idx)).updateWeather(this.lastRainLevel, this.rainLevel, this.lastThunderLevel, this.thunderLevel);
} }
} }
+ */ // Yatopia end
// CraftBukkit end // CraftBukkit end
+ */ // Yatopia end
if (this.everyoneSleeping) { if (this.everyoneSleeping && this.players.stream().noneMatch((entityplayer) -> {
return !entityplayer.isSpectator() && !entityplayer.isDeeplySleeping() && !entityplayer.fauxSleeping; // CraftBukkit

View File

@ -28,14 +28,13 @@ index 4230872de3551393a35c567d07a570dd07976fb8..febd0a7413382e059b681a43cc9ac42a
} }
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
index dbd6efb897ed62d0a9eda503e9af819e3243c174..99c641e409a416f22ba6c7d0d321a8816977d344 100644 index f6ffefd7e356c9c68cb6591cab55de9363442faf..eddf3dff9a00bf3c7318745e52befd4c04fa2af7 100644
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java --- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java +++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
@@ -29,6 +29,15 @@ public class PortalTravelAgent { @@ -30,6 +30,13 @@ public class PortalTravelAgent {
return villageplacerecord.f().getY(); }); // Yatopia
}); // Yatopia start
java.util.List<VillagePlaceRecord> list = villageplace.b(type -> type == VillagePlaceType.v, blockposition, i, VillagePlace.Occupancy.ANY).collect(java.util.stream.Collectors.toList()); java.util.List<VillagePlaceRecord> list = villageplace.b(type -> type == VillagePlaceType.v, blockposition, i, VillagePlace.Occupancy.ANY).collect(java.util.stream.Collectors.toList());
+ // Yatopia start - fix portal bug
+ if (world.origamiConfig.useBlockDistanceInPortalSearchRadius) { + if (world.origamiConfig.useBlockDistanceInPortalSearchRadius) {
+ list.removeIf(villagePlaceRecord -> { + list.removeIf(villagePlaceRecord -> {
+ BlockPosition portalPosition = villagePlaceRecord.getPosition(); + BlockPosition portalPosition = villagePlaceRecord.getPosition();
@ -43,7 +42,6 @@ index dbd6efb897ed62d0a9eda503e9af819e3243c174..99c641e409a416f22ba6c7d0d321a881
+ || Math.abs(portalPosition.getZ() - blockposition.getZ()) > i; + || Math.abs(portalPosition.getZ() - blockposition.getZ()) > i;
+ }); + });
+ } + }
+ // Yatopia end
Optional<VillagePlaceRecord> optional = Optional.empty(); Optional<VillagePlaceRecord> optional = Optional.empty();
if (!list.isEmpty()) { if (!list.isEmpty()) {
list.sort(comparator); list.sort(comparator);

View File

@ -11,7 +11,7 @@ as the server shouldn't really care about those packets - they're not related wi
Additionally, I'm thinking of making those packets send asynchronously. Additionally, I'm thinking of making those packets send asynchronously.
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index fe123dc746c96b465393b2af788fae9519e5e55c..5b4901acf7d4661e52839a7ab0ebe24b93bec0d6 100644 index aa1597c77251ce18da47532209476cd42239e874..332f8ec16f48fb158b8cd058d3115b006ba34134 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java --- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -229,7 +229,11 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> { @@ -229,7 +229,11 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {

View File

@ -849,7 +849,7 @@ index ac6e5e3309affc830d4db07fd9b8d809c3085033..b7fcbef8d38c9406a891d64f8016bc16
@Override @Override
public NBTTagCompound i(BlockPosition blockposition) { public NBTTagCompound i(BlockPosition blockposition) {
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 7fda4b1492783e37b5bf83f7d33df92d46fa8ff0..a86f958ad01b5b935413b093540f8d3a2f4fb41a 100644 index 898446130f264055eeca2e5de3c30201e05f484a..ebb35de9a2293594c1ec936463ea175cc0a8bec0 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -73,7 +73,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -73,7 +73,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -1029,10 +1029,10 @@ index 882b82d8952d34f6e3c639404d1a1521dedf1bb0..ccf1416000354b78ccef78b072062ce0
default EntityHuman findNearbyPlayer(Entity entity, double d0, @Nullable Predicate<Entity> predicate) { return this.findNearbyPlayer(entity.locX(), entity.locY(), entity.locZ(), d0, predicate); } // Paper default EntityHuman findNearbyPlayer(Entity entity, double d0, @Nullable Predicate<Entity> predicate) { return this.findNearbyPlayer(entity.locX(), entity.locY(), entity.locZ(), d0, predicate); } // Paper
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index c3eb85c71539ebdb1b6c9a386e4de9ba717f030e..9f32a26fdbfaf024cfe5c0996c2253f2dd581d5e 100644 index e94d99f2284aec0e0c374a880122ff7d30f9c2be..6c8cb39ac8786734cda994ef29ba74c685f3b9be 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -1343,11 +1343,11 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -1334,11 +1334,11 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
chunk.setLoaded(true); chunk.setLoaded(true);
this.world.a(chunk.getTileEntities().values()); this.world.a(chunk.getTileEntities().values());
List<Entity> list = null; List<Entity> list = null;
@ -1046,17 +1046,8 @@ index c3eb85c71539ebdb1b6c9a386e4de9ba717f030e..9f32a26fdbfaf024cfe5c0996c2253f2
Iterator iterator = entityslice.iterator(); Iterator iterator = entityslice.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@@ -1640,7 +1640,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
// CraftBukkit - decompile error
csvwriter.a(chunkcoordintpair.x, chunkcoordintpair.z, playerchunk.getTicketLevel(), optional.isPresent(), optional.map(IChunkAccess::getChunkStatus).orElse(null), optional1.map(Chunk::getState).orElse(null), a(playerchunk.c()), a(playerchunk.a()), a(playerchunk.b()), this.chunkDistanceManager.c(entry.getLongKey()), !this.isOutsideOfRange(chunkcoordintpair), optional1.map((chunk) -> {
int sum = 0;
- for (List<Entity> entities : chunk.getEntitySlices()) {
+ for (EntitySlice<Entity> entities : chunk.getAsSlices()) { // Yatopia - this was caused due to md_5 being stupid
int size = entities.size();
sum += size;
}
diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java
index f9a1f5e92a7559a50dfb72d7455a8fc03dbad25f..3094ce00b3fa5b266f5d0ad0875f160e80c62e18 100644 index 4bdadffee07c54f6f538ba09db72d562d05cb337..eb358d4453fce1de7f15f38b32e594fa63e4deb5 100644
--- a/src/main/java/net/minecraft/server/VoxelShapes.java --- a/src/main/java/net/minecraft/server/VoxelShapes.java
+++ b/src/main/java/net/minecraft/server/VoxelShapes.java +++ b/src/main/java/net/minecraft/server/VoxelShapes.java
@@ -40,7 +40,9 @@ public final class VoxelShapes { @@ -40,7 +40,9 @@ public final class VoxelShapes {
@ -1070,10 +1061,10 @@ index f9a1f5e92a7559a50dfb72d7455a8fc03dbad25f..3094ce00b3fa5b266f5d0ad0875f160e
} else if (shape instanceof VoxelShapeArray) { } else if (shape instanceof VoxelShapeArray) {
VoxelShapeArray shapeCasted = (VoxelShapeArray)shape; VoxelShapeArray shapeCasted = (VoxelShapeArray)shape;
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 0c8500ddc5a6662da7de292639e976b07d3a29d6..a991fb7b6123ebcf7b6e42f8cdd2f3377ab14970 100644 index 274b7e04ff09e459cd63040b1c29e3d197aafe72..97db7999968bceb2f069eb449c64e7da874d787f 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -649,8 +649,14 @@ public class WorldServer extends World implements GeneratorAccessSeed { @@ -656,8 +656,14 @@ public class WorldServer extends World implements GeneratorAccessSeed {
} }
public final void getCollisions(@Nullable Entity entity, AxisAlignedBB axisalignedbb, List<AxisAlignedBB> list, boolean loadChunks) { public final void getCollisions(@Nullable Entity entity, AxisAlignedBB axisalignedbb, List<AxisAlignedBB> list, boolean loadChunks) {
@ -1088,7 +1079,7 @@ index 0c8500ddc5a6662da7de292639e976b07d3a29d6..a991fb7b6123ebcf7b6e42f8cdd2f337
} }
@Override @Override
@@ -1737,12 +1743,12 @@ public class WorldServer extends World implements GeneratorAccessSeed { @@ -1730,12 +1736,12 @@ public class WorldServer extends World implements GeneratorAccessSeed {
} }
// Spigot End // Spigot End
this.tileEntityListUnload.addAll(chunk.getTileEntities().values()); this.tileEntityListUnload.addAll(chunk.getTileEntities().values());

View File

@ -33,10 +33,10 @@ index 700660dd93b3090334bb3033d5f5fdd6ab684744..fd34dffa63995c1fc277eac28eb1cd23
return this.a(EnumAxisCycle.a(enumdirection_enumaxis, EnumDirection.EnumAxis.X), axisalignedbb, d0); return this.a(EnumAxisCycle.a(enumdirection_enumaxis, EnumDirection.EnumAxis.X), axisalignedbb, d0);
} }
diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java
index 3094ce00b3fa5b266f5d0ad0875f160e80c62e18..10060c9a87ceb35b06bc00430cd4aceac1b6600f 100644 index eb358d4453fce1de7f15f38b32e594fa63e4deb5..88f309073bc4aa6fe0e5421b1d85977aebf5fbb1 100644
--- a/src/main/java/net/minecraft/server/VoxelShapes.java --- a/src/main/java/net/minecraft/server/VoxelShapes.java
+++ b/src/main/java/net/minecraft/server/VoxelShapes.java +++ b/src/main/java/net/minecraft/server/VoxelShapes.java
@@ -278,6 +278,21 @@ public final class VoxelShapes { @@ -274,6 +274,21 @@ public final class VoxelShapes {
return 0.0D; return 0.0D;
} else { } else {
EnumAxisCycle enumaxiscycle1 = enumaxiscycle.a(); EnumAxisCycle enumaxiscycle1 = enumaxiscycle.a();

View File

@ -7,7 +7,7 @@ Original code by JellySquid, licensed under LGPLv3
you can find the original code on https://github.com/jellysquid3/lithium-fabric/ (Yarn mappings) you can find the original code on https://github.com/jellysquid3/lithium-fabric/ (Yarn mappings)
diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java
index 5541531223456d9890dee154fec058314d56f256..c1f992b2ebac9819085bec74bc40ca3b5384c741 100644 index 100afe2000c981c6837b98436bd53add96e17a29..fb083996c10f553d7eff629a815b11eb7f0bf42c 100644
--- a/src/main/java/net/minecraft/server/BlockBase.java --- a/src/main/java/net/minecraft/server/BlockBase.java
+++ b/src/main/java/net/minecraft/server/BlockBase.java +++ b/src/main/java/net/minecraft/server/BlockBase.java
@@ -345,6 +345,8 @@ public abstract class BlockBase { @@ -345,6 +345,8 @@ public abstract class BlockBase {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Load also the chunk that you're teleporting to
Fixes Tuinity-178 Fixes Tuinity-178
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index a991fb7b6123ebcf7b6e42f8cdd2f3377ab14970..be8da6114ad905602dd8e50a36f9ca824f5c4912 100644 index 97db7999968bceb2f069eb449c64e7da874d787f..fc8d97262f39db62e1ea2cdd1d9c1df092175c63 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -225,7 +225,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { @@ -232,7 +232,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
return true; return true;
} }
@ -18,7 +18,7 @@ index a991fb7b6123ebcf7b6e42f8cdd2f3377ab14970..be8da6114ad905602dd8e50a36f9ca82
java.util.function.Consumer<List<IChunkAccess>> onLoad) { java.util.function.Consumer<List<IChunkAccess>> onLoad) {
if (Thread.currentThread() != this.serverThread) { if (Thread.currentThread() != this.serverThread) {
this.getChunkProvider().serverThreadQueue.execute(() -> { this.getChunkProvider().serverThreadQueue.execute(() -> {
@@ -282,6 +282,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { @@ -289,6 +289,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
chunkProvider.getChunkAtAsynchronously(cx, cz, ChunkStatus.FULL, true, false, consumer); chunkProvider.getChunkAtAsynchronously(cx, cz, ChunkStatus.FULL, true, false, consumer);
} }
} }

View File

@ -114,18 +114,18 @@ index 2193fecab4406f49548c0952b2754269f91e2515..0785bfe1c28b63b492e25c678ebad89d
Vec3D vec3d = Vec3D.ORIGIN; Vec3D vec3d = Vec3D.ORIGIN;
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
index 99c641e409a416f22ba6c7d0d321a8816977d344..d49ca751516f15494035771c1a2dfe810c610ffc 100644 index eddf3dff9a00bf3c7318745e52befd4c04fa2af7..c47dc39dcdacbefa07c69f04601f7a125cfbb25c 100644
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java --- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java +++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
@@ -28,7 +28,7 @@ public class PortalTravelAgent { @@ -29,7 +29,7 @@ public class PortalTravelAgent {
}).thenComparingInt((villageplacerecord) -> {
return villageplacerecord.f().getY(); return villageplacerecord.f().getY();
}); }); // Yatopia
// Yatopia start
- java.util.List<VillagePlaceRecord> list = villageplace.b(type -> type == VillagePlaceType.v, blockposition, i, VillagePlace.Occupancy.ANY).collect(java.util.stream.Collectors.toList()); - java.util.List<VillagePlaceRecord> list = villageplace.b(type -> type == VillagePlaceType.v, blockposition, i, VillagePlace.Occupancy.ANY).collect(java.util.stream.Collectors.toList());
+ java.util.List<VillagePlaceRecord> list = villageplace.bList(type -> type == VillagePlaceType.v, blockposition, i, VillagePlace.Occupancy.ANY); // Yatopia + java.util.List<VillagePlaceRecord> list = villageplace.bList(type -> type == VillagePlaceType.v, blockposition, i, VillagePlace.Occupancy.ANY);
// Yatopia start - fix portal bug
if (world.origamiConfig.useBlockDistanceInPortalSearchRadius) { if (world.origamiConfig.useBlockDistanceInPortalSearchRadius) {
list.removeIf(villagePlaceRecord -> { list.removeIf(villagePlaceRecord -> {
BlockPosition portalPosition = villagePlaceRecord.getPosition();
diff --git a/src/main/java/net/minecraft/server/SectionPosition.java b/src/main/java/net/minecraft/server/SectionPosition.java diff --git a/src/main/java/net/minecraft/server/SectionPosition.java b/src/main/java/net/minecraft/server/SectionPosition.java
index f95925f1c5d091f1a129d0437bb6e175c6ac080f..6796b1a832779b65d337c63d6b600e2a3b5e9559 100644 index f95925f1c5d091f1a129d0437bb6e175c6ac080f..6796b1a832779b65d337c63d6b600e2a3b5e9559 100644
--- a/src/main/java/net/minecraft/server/SectionPosition.java --- a/src/main/java/net/minecraft/server/SectionPosition.java
@ -171,7 +171,7 @@ index f95925f1c5d091f1a129d0437bb6e175c6ac080f..6796b1a832779b65d337c63d6b600e2a
return StreamSupport.stream(new AbstractSpliterator<SectionPosition>((long) ((l - i + 1) * (i1 - j + 1) * (j1 - k + 1)), 64) { return StreamSupport.stream(new AbstractSpliterator<SectionPosition>((long) ((l - i + 1) * (i1 - j + 1) * (j1 - k + 1)), 64) {
final CursorPosition a = new CursorPosition(i, j, k, l, i1, j1); final CursorPosition a = new CursorPosition(i, j, k, l, i1, j1);
diff --git a/src/main/java/net/minecraft/server/VillagePlace.java b/src/main/java/net/minecraft/server/VillagePlace.java diff --git a/src/main/java/net/minecraft/server/VillagePlace.java b/src/main/java/net/minecraft/server/VillagePlace.java
index 6ab80cf7908437309a7346d71e42cf128a6f13d9..ee41cb15408be403ba813c624943b476f51e1d5c 100644 index adacfce6f3b6067e54fc1a95bab7d42796950cd6..2ddf3e0c5efe0e2b5a1a18de1a055ec427924672 100644
--- a/src/main/java/net/minecraft/server/VillagePlace.java --- a/src/main/java/net/minecraft/server/VillagePlace.java
+++ b/src/main/java/net/minecraft/server/VillagePlace.java +++ b/src/main/java/net/minecraft/server/VillagePlace.java
@@ -46,7 +46,7 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> { @@ -46,7 +46,7 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
@ -242,7 +242,7 @@ index 6ab80cf7908437309a7346d71e42cf128a6f13d9..ee41cb15408be403ba813c624943b476
public Stream<BlockPosition> b(Predicate<VillagePlaceType> predicate, Predicate<BlockPosition> predicate1, BlockPosition blockposition, int i, VillagePlace.Occupancy villageplace_occupancy) { public Stream<BlockPosition> b(Predicate<VillagePlaceType> predicate, Predicate<BlockPosition> predicate1, BlockPosition blockposition, int i, VillagePlace.Occupancy villageplace_occupancy) {
return this.a(predicate, predicate1, blockposition, i, villageplace_occupancy).sorted(Comparator.comparingDouble((blockposition1) -> { return this.a(predicate, predicate1, blockposition, i, villageplace_occupancy).sorted(Comparator.comparingDouble((blockposition1) -> {
return blockposition1.j(blockposition); return blockposition1.j(blockposition);
@@ -94,26 +135,55 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> { @@ -94,31 +135,68 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
} }
public Optional<BlockPosition> c(Predicate<VillagePlaceType> predicate, Predicate<BlockPosition> predicate1, BlockPosition blockposition, int i, VillagePlace.Occupancy villageplace_occupancy) { public Optional<BlockPosition> c(Predicate<VillagePlaceType> predicate, Predicate<BlockPosition> predicate1, BlockPosition blockposition, int i, VillagePlace.Occupancy villageplace_occupancy) {
@ -291,7 +291,7 @@ index 6ab80cf7908437309a7346d71e42cf128a6f13d9..ee41cb15408be403ba813c624943b476
villageplacerecord.b(); villageplacerecord.b();
return villageplacerecord.f(); return villageplacerecord.f();
}); });
+ */ // Yatopia end + */ // Yatopia end
} }
public Optional<BlockPosition> a(Predicate<VillagePlaceType> predicate, Predicate<BlockPosition> predicate1, VillagePlace.Occupancy villageplace_occupancy, BlockPosition blockposition, int i, Random random) { public Optional<BlockPosition> a(Predicate<VillagePlaceType> predicate, Predicate<BlockPosition> predicate1, VillagePlace.Occupancy villageplace_occupancy, BlockPosition blockposition, int i, Random random) {
@ -299,8 +299,21 @@ index 6ab80cf7908437309a7346d71e42cf128a6f13d9..ee41cb15408be403ba813c624943b476
+ List<VillagePlaceRecord> list = this.cList(predicate, blockposition, i, villageplace_occupancy); // Yatopia + List<VillagePlaceRecord> list = this.cList(predicate, blockposition, i, villageplace_occupancy); // Yatopia
Collections.shuffle(list, random); Collections.shuffle(list, random);
for (VillagePlaceRecord villageplacerecord : list) { + // Yatopia start - replace stream
@@ -214,7 +284,7 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> { + for (VillagePlaceRecord record : list) {
+ BlockPosition recordPosition = record.getPosition();
+ if (predicate1.test(recordPosition)) return Optional.of(recordPosition);
+ }
+ return Optional.empty();
+ /*
return list.stream().filter((villageplacerecord) -> {
return predicate1.test(villageplacerecord.f());
}).findFirst().map(VillagePlaceRecord::f);
+ */
}
public boolean b(BlockPosition blockposition) {
@@ -211,7 +289,7 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
} }
private void a(ChunkSection chunksection, SectionPosition sectionposition, BiConsumer<BlockPosition, VillagePlaceType> biconsumer) { private void a(ChunkSection chunksection, SectionPosition sectionposition, BiConsumer<BlockPosition, VillagePlaceType> biconsumer) {
@ -309,7 +322,7 @@ index 6ab80cf7908437309a7346d71e42cf128a6f13d9..ee41cb15408be403ba813c624943b476
IBlockData iblockdata = chunksection.getType(SectionPosition.b(blockposition.getX()), SectionPosition.b(blockposition.getY()), SectionPosition.b(blockposition.getZ())); IBlockData iblockdata = chunksection.getType(SectionPosition.b(blockposition.getX()), SectionPosition.b(blockposition.getY()), SectionPosition.b(blockposition.getZ()));
VillagePlaceType.b(iblockdata).ifPresent((villageplacetype) -> { VillagePlaceType.b(iblockdata).ifPresent((villageplacetype) -> {
@@ -224,6 +294,16 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> { @@ -221,6 +299,16 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
} }
public void a(IWorldReader iworldreader, BlockPosition blockposition, int i) { public void a(IWorldReader iworldreader, BlockPosition blockposition, int i) {
@ -326,7 +339,7 @@ index 6ab80cf7908437309a7346d71e42cf128a6f13d9..ee41cb15408be403ba813c624943b476
SectionPosition.b(new ChunkCoordIntPair(blockposition), Math.floorDiv(i, 16)).map((sectionposition) -> { SectionPosition.b(new ChunkCoordIntPair(blockposition), Math.floorDiv(i, 16)).map((sectionposition) -> {
return Pair.of(sectionposition, this.d(sectionposition.s())); return Pair.of(sectionposition, this.d(sectionposition.s()));
}).filter((pair) -> { }).filter((pair) -> {
@@ -235,6 +315,7 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> { @@ -232,6 +320,7 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
}).forEach((chunkcoordintpair) -> { }).forEach((chunkcoordintpair) -> {
iworldreader.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.EMPTY); iworldreader.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.EMPTY);
}); });

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Nuke streams off BlockPosition
diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java
index c1f992b2ebac9819085bec74bc40ca3b5384c741..462d3431367f97f9d8506fd1a1adf8dc418b4414 100644 index fb083996c10f553d7eff629a815b11eb7f0bf42c..17c8e5fe9e3e18244bbcf479267289dce01f9615 100644
--- a/src/main/java/net/minecraft/server/BlockBase.java --- a/src/main/java/net/minecraft/server/BlockBase.java
+++ b/src/main/java/net/minecraft/server/BlockBase.java +++ b/src/main/java/net/minecraft/server/BlockBase.java
@@ -637,6 +637,7 @@ public abstract class BlockBase { @@ -637,6 +637,7 @@ public abstract class BlockBase {

View File

@ -35,7 +35,7 @@ index d0e7c6b4c0b1e5993f0019e7a448423e048a8af5..b788685331bc28e0d339e6600b5805a2
public static boolean a(EntityInsentient entityinsentient, EntityLiving entityliving, int i) { public static boolean a(EntityInsentient entityinsentient, EntityLiving entityliving, int i) {
diff --git a/src/main/java/net/minecraft/server/Raid.java b/src/main/java/net/minecraft/server/Raid.java diff --git a/src/main/java/net/minecraft/server/Raid.java b/src/main/java/net/minecraft/server/Raid.java
index f7f97d441b3b7c4bd6bc34d2ce3fae5f6f5721c8..86726f48f7cdf98379da050a5d41acd40dd4db83 100644 index 5dd5249caf55945607d5ac7830e54eedf9ca2c0d..89464cc770b4875ad65c5e84315e462689cea57b 100644
--- a/src/main/java/net/minecraft/server/Raid.java --- a/src/main/java/net/minecraft/server/Raid.java
+++ b/src/main/java/net/minecraft/server/Raid.java +++ b/src/main/java/net/minecraft/server/Raid.java
@@ -355,6 +355,18 @@ public class Raid { @@ -355,6 +355,18 @@ public class Raid {

View File

@ -83,7 +83,7 @@ index 57a3a8d09427012e5c8aba5085d187c6be047652..fa0a8a7e00a64df4d3ba09407193d984
} catch (Exception ex) { } catch (Exception ex) {
disconnect("Failed to verify username!"); disconnect("Failed to verify username!");
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index 5b4901acf7d4661e52839a7ab0ebe24b93bec0d6..4bc33861b015937a2081541f6b1ff2470a01d895 100644 index 332f8ec16f48fb158b8cd058d3115b006ba34134..57de1f541107ec3c53abb5a2c02ba579bc03f7ab 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java --- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -49,6 +49,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> { @@ -49,6 +49,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {

View File

@ -18,10 +18,10 @@ index fd0beefb900c064d3c35a3d2f79f5b7d9c1287bb..4d024a4849b7566c0faba131caab57b4
return this.size == 0 && this.pendingTasks.isEmpty(); return this.size == 0 && this.pendingTasks.isEmpty();
} }
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index be8da6114ad905602dd8e50a36f9ca824f5c4912..14b8bf88f6755818e0cdeb0a2ab0a8996ea1f886 100644 index fc8d97262f39db62e1ea2cdd1d9c1df092175c63..b3e24d6f44320bf9b13f627dc5a9cb46614afe9b 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1780,6 +1780,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { @@ -1773,6 +1773,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
} }
// Paper end // Paper end

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Respect PlayerKickEvent leaveMessage
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index cb4f173774b46793bc3744cb3242edd9272df463..e41c374e10576be00e3c87a115fcbf038c4df1b2 100644 index 7f551ad4b80c092b3cb22f040dcf9a40ec5b03e9..f4a2bae611806aa861b4f12b7f42c3117d528d95 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -308,7 +308,7 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -308,7 +308,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@ -17,7 +17,7 @@ index cb4f173774b46793bc3744cb3242edd9272df463..e41c374e10576be00e3c87a115fcbf03
this.networkManager.stopReading(); this.networkManager.stopReading();
MinecraftServer minecraftserver = this.minecraftServer; MinecraftServer minecraftserver = this.minecraftServer;
NetworkManager networkmanager = this.networkManager; NetworkManager networkmanager = this.networkManager;
@@ -1603,6 +1603,11 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -1601,6 +1601,11 @@ public class PlayerConnection implements PacketListenerPlayIn {
@Override @Override
public void a(IChatBaseComponent ichatbasecomponent) { public void a(IChatBaseComponent ichatbasecomponent) {
@ -29,7 +29,7 @@ index cb4f173774b46793bc3744cb3242edd9272df463..e41c374e10576be00e3c87a115fcbf03
// CraftBukkit start - Rarely it would send a disconnect line twice // CraftBukkit start - Rarely it would send a disconnect line twice
if (this.processedDisconnect) { if (this.processedDisconnect) {
return; return;
@@ -1618,7 +1623,7 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -1616,7 +1621,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
*/ */
this.player.p(); this.player.p();

View File

@ -30,7 +30,7 @@ index 48e31e9142ffeb2725af6b1f483de67410e25694..b149e32aac86ce2f7521958fa7394e4f
public static DataFixer getDataFixer() { return a(); } // Paper - OBFHELPER public static DataFixer getDataFixer() { return a(); } // Paper - OBFHELPER
public static DataFixer a() { public static DataFixer a() {
diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java
index 869dcf1545601358a273a5cfb47afa88fa13a11c..94fadd3d7ea7cdea07cb3fdc9e9bb1f92da0afcd 100644 index 916a6a1fc1ccc73e4fb974ad77310d16fd8bd7e6..61d399077f87fc1f198811ee31fc779b6f0ecfa9 100644
--- a/src/main/java/net/minecraft/server/SystemUtils.java --- a/src/main/java/net/minecraft/server/SystemUtils.java
+++ b/src/main/java/net/minecraft/server/SystemUtils.java +++ b/src/main/java/net/minecraft/server/SystemUtils.java
@@ -48,7 +48,7 @@ import org.apache.logging.log4j.Logger; @@ -48,7 +48,7 @@ import org.apache.logging.log4j.Logger;

View File

@ -12,25 +12,6 @@ The following has been done to fix the mentioned problems:
- Replaced stream off BehaviorFindPosition - Replaced stream off BehaviorFindPosition
- Made sure that chunks are loaded for the POIs (Points Of Interest) that are gonna be tried. - Made sure that chunks are loaded for the POIs (Points Of Interest) that are gonna be tried.
- Added a profession cache, which followed by a stream removal. - Added a profession cache, which followed by a stream removal.
- Added a config option, villagers-only-open-doors-if-attacked-by-mobs , the default of is "true", defaulting to
vanilla behavior. If the specified option is false, then if the villager is not going to a path, he will try
to go to the nearest door.
diff --git a/src/main/java/de/minebench/origami/OrigamiConfig.java b/src/main/java/de/minebench/origami/OrigamiConfig.java
index febd0a7413382e059b681a43cc9ac42ab5c14128..923219083f8021e8a4df0fee6512bf4677321fb6 100644
--- a/src/main/java/de/minebench/origami/OrigamiConfig.java
+++ b/src/main/java/de/minebench/origami/OrigamiConfig.java
@@ -177,6 +177,11 @@ public final class OrigamiConfig {
private void useBlockDistanceInPortalSearchRadius() {
useBlockDistanceInPortalSearchRadius = getBoolean("use-block-distance-in-portal-search-radius", false);
}
+
+ public boolean villagersOnlyOpenDoorsIfAttackedByMobs = true;
+ private void villagersOnlyOpenDoorsIfAttackedByMobs() {
+ villagersOnlyOpenDoorsIfAttackedByMobs = getBoolean("villagers-only-open-doors-if-attacked-by-mobs", true);
+ }
// Yatopia end
}
diff --git a/src/main/java/net/minecraft/server/BehaviorFindPosition.java b/src/main/java/net/minecraft/server/BehaviorFindPosition.java diff --git a/src/main/java/net/minecraft/server/BehaviorFindPosition.java b/src/main/java/net/minecraft/server/BehaviorFindPosition.java
index 63a761ebef80d4af09cdc2682e496d78492c4a3a..047910f441b5e8ad97024177afbac703a0d0c5e9 100644 index 63a761ebef80d4af09cdc2682e496d78492c4a3a..047910f441b5e8ad97024177afbac703a0d0c5e9 100644
@ -107,31 +88,6 @@ index 63a761ebef80d4af09cdc2682e496d78492c4a3a..047910f441b5e8ad97024177afbac703
}); });
} }
} }
diff --git a/src/main/java/net/minecraft/server/BehaviorInteractDoor.java b/src/main/java/net/minecraft/server/BehaviorInteractDoor.java
index 31f9001142ff8507499098f7da013b2b61d6847b..eb1df4046a81a011901d2763b51f2b5885e2095f 100644
--- a/src/main/java/net/minecraft/server/BehaviorInteractDoor.java
+++ b/src/main/java/net/minecraft/server/BehaviorInteractDoor.java
@@ -128,6 +128,12 @@ public class BehaviorInteractDoor extends Behavior<EntityLiving> {
BehaviorController<?> behaviorcontroller = entityliving.getBehaviorController();
// Yatopia start - replaced logic
+ if (!worldserver.origamiConfig.villagersOnlyOpenDoorsIfAttackedByMobs) {
+ if (b(worldserver, entityliving, blockposition)) {
+ return false;
+ }
+ return blockposition.distanceSquared(entityliving.getPositionVector(), 2.0D);
+ } else {
if (!behaviorcontroller.hasMemory(MemoryModuleType.MOBS)) return false;
for (EntityLiving entity : behaviorcontroller.getMemory(MemoryModuleType.MOBS).get()) {
if (entity.getEntityType() == entityliving.getEntityType()
@@ -137,6 +143,7 @@ public class BehaviorInteractDoor extends Behavior<EntityLiving> {
}
}
return false;
+ }
/*
return !behaviorcontroller.hasMemory(MemoryModuleType.MOBS) ? false : (behaviorcontroller.getMemory(MemoryModuleType.MOBS).get()).stream().filter((entityliving1) -> { // CraftBukkit - decompile error
return entityliving1.getEntityType() == entityliving.getEntityType();
diff --git a/src/main/java/net/minecraft/server/VillagePlaceType.java b/src/main/java/net/minecraft/server/VillagePlaceType.java diff --git a/src/main/java/net/minecraft/server/VillagePlaceType.java b/src/main/java/net/minecraft/server/VillagePlaceType.java
index a5718af9b614ae505067131f04ebb490617d6aa4..2ea0cfad4b35264cd3b70b930dd28de58c77d0c0 100644 index a5718af9b614ae505067131f04ebb490617d6aa4..2ea0cfad4b35264cd3b70b930dd28de58c77d0c0 100644
--- a/src/main/java/net/minecraft/server/VillagePlaceType.java --- a/src/main/java/net/minecraft/server/VillagePlaceType.java

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix villager dupe
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
index 16e52c38788719b275c92390893a6e9c0e769eb7..7f66131a820ff3a22bf6b10d26cedf6189a8bc1d 100644 index 939ef3bd6439a68dba4224661d050c6af0164178..4c7e1f5c2a332f5b5ed15b0528ed717f5f84f63f 100644
--- a/src/main/java/net/minecraft/server/EntityVillager.java --- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java
@@ -203,7 +203,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @@ -207,7 +207,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
} else { } else {
this.mobTick(true); this.mobTick(true);
} }
@ -17,7 +17,7 @@ index 16e52c38788719b275c92390893a6e9c0e769eb7..7f66131a820ff3a22bf6b10d26cedf61
doReputationTick(); doReputationTick();
// Paper end // Paper end
@@ -283,6 +283,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @@ -287,6 +287,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
if (this.getVillagerData().getProfession() == VillagerProfession.NONE && this.eN()) { if (this.getVillagerData().getProfession() == VillagerProfession.NONE && this.eN()) {
this.eT(); this.eT();
} }
@ -25,7 +25,7 @@ index 16e52c38788719b275c92390893a6e9c0e769eb7..7f66131a820ff3a22bf6b10d26cedf61
if (inactive) return; // Paper if (inactive) return; // Paper
super.mobTick(); super.mobTick();
@@ -1084,4 +1085,10 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @@ -1071,4 +1072,10 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
return optional.isPresent() ? i - (Long) optional.get() < 24000L : false; return optional.isPresent() ? i - (Long) optional.get() < 24000L : false;
} }

View File

@ -185,10 +185,10 @@ index 0224a6d0e47e836fa485b39e7b4ce5b83ea554bf..fe578d306575bbdc8ca4a993a648e889
return (String[]) this.d.keySet().toArray(new String[this.d.size()]); return (String[]) this.d.keySet().toArray(new String[this.d.size()]);
} }
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 680c139e249fce8dedf5a63ac5034b930b8e8540..07fc09543c154fdf8b8beb86c3466c9ccd24372b 100644 index ac31ce44ec5605a9f6bede0e68c13a7696ad0521..31ba3474b4dfdc2d60d127e0ff667744941d55ec 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1954,6 +1954,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -1959,6 +1959,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
return new DataPackConfiguration(list, list1); return new DataPackConfiguration(list, list1);
} }

View File

@ -24,7 +24,7 @@ index fa0a8a7e00a64df4d3ba09407193d984e1ff0952..a747d75e3da17c077ccf2cf16be0b7f3
// Paper end // Paper end
// Spigot start // Spigot start
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
index 118acbd559c599cf9708ff61a4a6fe8477c61b82..eeb5c6e6ed8785570befbabde97cbae0122bebff 100644 index 653ba0f1d84af1997d768426d3542c9d465f6c93..748742fb03c6066a72ac6046a96e8d9f8fad2694 100644
--- a/src/main/java/net/minecraft/server/MCUtil.java --- a/src/main/java/net/minecraft/server/MCUtil.java
+++ b/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java
@@ -42,12 +42,12 @@ public final class MCUtil { @@ -42,12 +42,12 @@ public final class MCUtil {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix merging spawning values
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 62e7282b4baf375d57f881241231ebf2ce1b82ad..7e99aa27fc4cac2e553d0b84dcf85f8f637d5451 100644 index 9108321741e9d3f896c43be8f204735b1b73127e..b16ca40d49a0cc8f4fb3b1de1ce695b367040ad4 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java --- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -161,9 +161,12 @@ public final class SpawnerCreature { @@ -157,9 +157,12 @@ public final class SpawnerCreature {
spawnercreature_d.a(entityinsentient, ichunkaccess); spawnercreature_d.a(entityinsentient, ichunkaccess);
}, },
difference, worldserver.paperConfig.perPlayerMobSpawns ? worldserver.getChunkProvider().playerChunkMap::updatePlayerMobTypeMap : null); difference, worldserver.paperConfig.perPlayerMobSpawns ? worldserver.getChunkProvider().playerChunkMap::updatePlayerMobTypeMap : null);

View File

@ -52,7 +52,7 @@ index 7ed343cfb3130446c85dab2ca04d60f91e2c94fb..194d2f177b05c594c7a27b6191860a3f
if (collisionShape != VoxelShapes.empty()) { if (collisionShape != VoxelShapes.empty()) {
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index a86f958ad01b5b935413b093540f8d3a2f4fb41a..9f953cc49d3bd770cb460f5fe6466a4c61ea4186 100644 index ebb35de9a2293594c1ec936463ea175cc0a8bec0..2beb2b53e8d9f04e5d90898282d8cd186d251c14 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2156,9 +2156,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -2156,9 +2156,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke

View File

@ -132,10 +132,10 @@ index 0237e91512dd15dae1597f1cbb37b0fb178ae35e..e4c5a485caa9e97388aefd9dc5a3ce40
// this method is only to remove non-used values in the config // this method is only to remove non-used values in the config
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 78d7fc805a1aeb0d31e51a5aa68e92d9ffd7ba73..e64614c7c98ecc1dfc5aa6de07db07eeb399d351 100644 index efbfcc5038a1019725eba46e5379a86e78617fb8..165914e95afae82597ebcbde4f7e8a0d9c8aeaab 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -902,6 +902,7 @@ public final class CraftServer implements Server { @@ -916,6 +916,7 @@ public final class CraftServer implements Server {
org.spigotmc.SpigotConfig.registerCommands(); // Spigot org.spigotmc.SpigotConfig.registerCommands(); // Spigot
com.destroystokyo.paper.PaperConfig.registerCommands(); // Paper com.destroystokyo.paper.PaperConfig.registerCommands(); // Paper
net.pl3x.purpur.PurpurConfig.registerCommands(); // Purpur net.pl3x.purpur.PurpurConfig.registerCommands(); // Purpur

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Configurable flight checks
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index e41c374e10576be00e3c87a115fcbf038c4df1b2..3706d27a9b3e364d72be049a3a84318b07c83eed 100644 index f4a2bae611806aa861b4f12b7f42c3117d528d95..b690fcdd1fdfa1cc2c34961ae8f6c533a4e8da02 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -166,7 +166,7 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -166,7 +166,7 @@ public class PlayerConnection implements PacketListenerPlayIn {

View File

@ -9,11 +9,13 @@ GlueList was also used as a replacement for ArrayList as it is substantially fas
These changes knock off an extra ~10ms of tick duration with a sample of ~7,700 running furnaces on a server. These changes knock off an extra ~10ms of tick duration with a sample of ~7,700 running furnaces on a server.
Co-authored-by: Ivan Pekov <ivan@mrivanplays.com>
diff --git a/src/main/java/net/minecraft/server/CraftingManager.java b/src/main/java/net/minecraft/server/CraftingManager.java diff --git a/src/main/java/net/minecraft/server/CraftingManager.java b/src/main/java/net/minecraft/server/CraftingManager.java
index 2cbfef98508bcb07db1ad1e5bdafc4cc2bff1393..06c025beed61feaf3239382b7d7778c5741869cc 100644 index 58ecbe1e20581dc9e78cdd2f4ece29cfa014da8a..1a1a71abb91f09033b26ec8bc88c160259ebea41 100644
--- a/src/main/java/net/minecraft/server/CraftingManager.java --- a/src/main/java/net/minecraft/server/CraftingManager.java
+++ b/src/main/java/net/minecraft/server/CraftingManager.java +++ b/src/main/java/net/minecraft/server/CraftingManager.java
@@ -25,6 +25,10 @@ public class CraftingManager extends ResourceDataJson { @@ -31,6 +31,10 @@ public class CraftingManager extends ResourceDataJson {
private static final Logger LOGGER = LogManager.getLogger(); private static final Logger LOGGER = LogManager.getLogger();
public Map<Recipes<?>, Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>>> recipes = ImmutableMap.of(); // CraftBukkit public Map<Recipes<?>, Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>>> recipes = ImmutableMap.of(); // CraftBukkit
private boolean d; private boolean d;
@ -24,13 +26,16 @@ index 2cbfef98508bcb07db1ad1e5bdafc4cc2bff1393..06c025beed61feaf3239382b7d7778c5
public CraftingManager() { public CraftingManager() {
super(CraftingManager.a, "recipes"); super(CraftingManager.a, "recipes");
@@ -78,21 +82,37 @@ public class CraftingManager extends ResourceDataJson { @@ -84,18 +88,38 @@ public class CraftingManager extends ResourceDataJson {
public <C extends IInventory, T extends IRecipe<C>> Optional<T> craft(Recipes<T> recipes, C c0, World world) { public <C extends IInventory, T extends IRecipe<C>> Optional<T> craft(Recipes<T> recipes, C c0, World world) {
// CraftBukkit start // CraftBukkit start
- Optional<T> recipe = this.b(recipes).values().stream().flatMap((irecipe) -> { + // Yatopia start - replace stream
- return SystemUtils.a(recipes.a(irecipe, world, c0)); + /*
- }).findFirst(); Optional<T> recipe = this.b(recipes).values().stream().flatMap((irecipe) -> {
return SystemUtils.a(recipes.a(irecipe, world, c0));
}).findFirst();
+ */
+ // Yatopia start - replace stream + // Yatopia start - replace stream
+ Collection<IRecipe<C>> allTypes = this.b(recipes).values(); + Collection<IRecipe<C>> allTypes = this.b(recipes).values();
+ Optional<T> recipe = Optional.empty(); + Optional<T> recipe = Optional.empty();
@ -42,48 +47,68 @@ index 2cbfef98508bcb07db1ad1e5bdafc4cc2bff1393..06c025beed61feaf3239382b7d7778c5
+ break; + break;
+ } + }
+ } + }
+ + // Yatopia end
c0.setCurrentRecipe(recipe.orElse(null)); // CraftBukkit - Clear recipe when no recipe is found c0.setCurrentRecipe(recipe.orElse(null)); // CraftBukkit - Clear recipe when no recipe is found
// CraftBukkit end // CraftBukkit end
return recipe; return recipe;
+ // Yatopia end
} }
public <C extends IInventory, T extends IRecipe<C>> List<T> a(Recipes<T> recipes) { public <C extends IInventory, T extends IRecipe<C>> List<T> a(Recipes<T> recipes) {
+ // Yatopia start - replaced Logic + // Yatopia start - replaced logic
+ return (List) CACHE.computeIfAbsent(recipes, recipes1 -> {
+ return new net.yatopia.server.list.GlueList<>(this.b(recipes).values());
+ });
+ /* + /*
List<IRecipe<C>> list = new ArrayList<>(); return (List) this.b(recipes).values().stream().map((irecipe) -> {
for (IRecipe<C> irecipe : this.b(recipes).values()) { return irecipe;
IRecipe<C> ciRecipe = irecipe; }).collect(Collectors.toList());
list.add(ciRecipe); + */
} + return (List) CACHE.computeIfAbsent(recipes, recipes1 -> new net.yatopia.server.list.GlueList<>(getRecipesMap(recipes).values()));
return (List) list; + // Yatopia end
+ */ // Yatopia end
} }
public <C extends IInventory, T extends IRecipe<C>> List<T> b(Recipes<T> recipes, C c0, World world) { public <C extends IInventory, T extends IRecipe<C>> List<T> b(Recipes<T> recipes, C c0, World world) {
@@ -104,7 +124,7 @@ public class CraftingManager extends ResourceDataJson { @@ -106,8 +130,9 @@ public class CraftingManager extends ResourceDataJson {
})).collect(Collectors.toList());
} }
+ private <C extends IInventory, T extends IRecipe<C>> Map<MinecraftKey, IRecipe<C>> getRecipesMap(Recipes<T> recipes) { return b(recipes); } // Yatopia - OBFHELPER
private <C extends IInventory, T extends IRecipe<C>> Map<MinecraftKey, IRecipe<C>> b(Recipes<T> recipes) { private <C extends IInventory, T extends IRecipe<C>> Map<MinecraftKey, IRecipe<C>> b(Recipes<T> recipes) {
- return (Map) this.recipes.getOrDefault(recipes, new Object2ObjectLinkedOpenHashMap<>()); // CraftBukkit - return (Map) this.recipes.getOrDefault(recipes, new Object2ObjectLinkedOpenHashMap<>()); // CraftBukkit
+ return (Map) this.recipes.getOrDefault(recipes, EMPTY_MAP); // CraftBukkit // Yatopia + return (Map) this.recipes.getOrDefault(recipes, EMPTY_MAP); // CraftBukkit // Yatopia
} }
public <C extends IInventory, T extends IRecipe<C>> NonNullList<ItemStack> c(Recipes<T> recipes, C c0, World world) { public <C extends IInventory, T extends IRecipe<C>> NonNullList<ItemStack> c(Recipes<T> recipes, C c0, World world) {
diff --git a/src/main/java/net/minecraft/server/RecipeItemStack.java b/src/main/java/net/minecraft/server/RecipeItemStack.java @@ -127,15 +152,35 @@ public class CraftingManager extends ResourceDataJson {
index 30da7471c3ecc66a61cb9fe1dd58d6d65438c505..27978f7b52c8db02f69fdcb092ffcce4550904d3 100644 }
--- a/src/main/java/net/minecraft/server/RecipeItemStack.java
+++ b/src/main/java/net/minecraft/server/RecipeItemStack.java
@@ -32,7 +32,7 @@ public final class RecipeItemStack implements Predicate<ItemStack> {
public void buildChoices() { public Optional<? extends IRecipe<?>> getRecipe(MinecraftKey minecraftkey) {
if (this.choices == null) { + // Yatopia start - replace stream
- List<ItemStack> list = new ArrayList<>(); + /*
+ List<ItemStack> list = new net.yatopia.server.list.GlueList<>(); // Yatopia return this.recipes.values().stream().map((map) -> {
Set<ItemStack> uniqueValues = new HashSet<>(); return map.get(minecraftkey); // CraftBukkit - decompile error
for (Provider recipeitemstack_provider : this.b) { }).filter(Objects::nonNull).findFirst();
for (ItemStack itemStack : recipeitemstack_provider.a()) { + */
+ for (Map<MinecraftKey, IRecipe<?>> map : recipes.values()) {
+ IRecipe<?> recipe = map.get(minecraftkey);
+ if (recipe != null) {
+ return Optional.of(recipe);
+ }
+ }
+ return Optional.empty();
+ // Yatopia end
}
public Collection<IRecipe<?>> b() {
+ // Yatopia start - replace stream
+ /*
return (Collection) this.recipes.values().stream().flatMap((map) -> {
return map.values().stream();
}).collect(Collectors.toSet());
+ */
+ List<IRecipe<?>> list = new net.yatopia.server.list.GlueList<>();
+ for (Map<MinecraftKey, IRecipe<?>> map : recipes.values()) {
+ list.addAll(map.values());
+ }
+ return list;
+ // Yatopia end
}
public Stream<MinecraftKey> d() {

View File

@ -21,7 +21,7 @@ go up.
Co-authored-by: Ivan Pekov <ivan@mrivanplays.com> Co-authored-by: Ivan Pekov <ivan@mrivanplays.com>
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index e6f2021e8406f7b14ce41429e871ffaffa52f108..867ab3f3145d8bfcf62c10697a009ec96357ca96 100644 index b43b02c0bdd5dbf0b7d30de90bdc2f74c015ecc8..4144dc7ca04b9a5d7da8ae619d3510c34c43e158 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java --- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -1801,10 +1801,18 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @@ -1801,10 +1801,18 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@ -45,7 +45,7 @@ index e6f2021e8406f7b14ce41429e871ffaffa52f108..867ab3f3145d8bfcf62c10697a009ec9
this.playerConnection.teleport(this.spectatedEntity.locX(), this.spectatedEntity.locY(), this.spectatedEntity.locZ(), this.yaw, this.pitch, TeleportCause.SPECTATE); // CraftBukkit this.playerConnection.teleport(this.spectatedEntity.locX(), this.spectatedEntity.locY(), this.spectatedEntity.locZ(), this.yaw, this.pitch, TeleportCause.SPECTATE); // CraftBukkit
} }
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 2c058a9eb4ce77f6090f3516ea048483173e7511..7678ee6f8fbe5d40739f8426724447268474f3ab 100644 index 3e71332c47000b21ff90aec6937f90dc639a41bd..f0cee1cd163a2054d73e0e4bdd20d1f68747a33c 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java --- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java +++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -87,7 +87,12 @@ public class EntityTNTPrimed extends Entity { @@ -87,7 +87,12 @@ public class EntityTNTPrimed extends Entity {
@ -62,9 +62,9 @@ index 2c058a9eb4ce77f6090f3516ea048483173e7511..7678ee6f8fbe5d40739f842672444726
if (ete != null) { if (ete != null) {
PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity(this); PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity(this);
PacketPlayOutEntityTeleport positionPacket = new PacketPlayOutEntityTeleport(this); PacketPlayOutEntityTeleport positionPacket = new PacketPlayOutEntityTeleport(this);
@@ -110,6 +115,9 @@ public class EntityTNTPrimed extends Entity { @@ -99,6 +104,9 @@ public class EntityTNTPrimed extends Entity {
} viewer.playerConnection.sendPacket(positionPacket);
// Akarin end });
} }
+ } finally { // Yatopia start + } finally { // Yatopia start
+ chunkMap.trackedEntitiesLock.unlock(); + chunkMap.trackedEntitiesLock.unlock();
@ -136,7 +136,7 @@ index aea72b0db10eed151db18490c02f291c3cded92a..f379d591ed7083840e15ba94f514b4bf
this.tracker.velocityChanged = false; this.tracker.velocityChanged = false;
} }
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 9f32a26fdbfaf024cfe5c0996c2253f2dd581d5e..807a54e24018455a997e4410cdb7579dac13bd8d 100644 index 6c8cb39ac8786734cda994ef29ba74c685f3b9be..36d4aeec34186c3f065d7bae3cc49a49f59188d0 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -11,6 +11,7 @@ import com.google.common.collect.Sets; @@ -11,6 +11,7 @@ import com.google.common.collect.Sets;
@ -147,7 +147,7 @@ index 9f32a26fdbfaf024cfe5c0996c2253f2dd581d5e..807a54e24018455a997e4410cdb7579d
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.longs.Long2ByteMap; import it.unimi.dsi.fastutil.longs.Long2ByteMap;
import it.unimi.dsi.fastutil.longs.Long2ByteOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ByteOpenHashMap;
@@ -104,10 +105,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -113,10 +114,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
private final File w; private final File w;
private final PlayerMap playerMap; private final PlayerMap playerMap;
public final Int2ObjectMap<PlayerChunkMap.EntityTracker> trackedEntities; public final Int2ObjectMap<PlayerChunkMap.EntityTracker> trackedEntities;
@ -160,7 +160,7 @@ index 9f32a26fdbfaf024cfe5c0996c2253f2dd581d5e..807a54e24018455a997e4410cdb7579d
// CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback() // CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback()
public final CallbackExecutor callbackExecutor = new CallbackExecutor(); public final CallbackExecutor callbackExecutor = new CallbackExecutor();
@@ -292,7 +295,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -301,7 +304,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
this.unloadQueue = new LongOpenHashSet(); this.unloadQueue = new LongOpenHashSet();
this.u = new AtomicInteger(); this.u = new AtomicInteger();
this.playerMap = new PlayerMap(); this.playerMap = new PlayerMap();
@ -169,7 +169,7 @@ index 9f32a26fdbfaf024cfe5c0996c2253f2dd581d5e..807a54e24018455a997e4410cdb7579d
this.z = new Long2ByteOpenHashMap(); this.z = new Long2ByteOpenHashMap();
this.A = new com.destroystokyo.paper.utils.CachedSizeConcurrentLinkedQueue<>(); // Paper - need constant-time size() this.A = new com.destroystokyo.paper.utils.CachedSizeConcurrentLinkedQueue<>(); // Paper - need constant-time size()
this.definedStructureManager = definedstructuremanager; this.definedStructureManager = definedstructuremanager;
@@ -2033,6 +2036,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -2008,6 +2011,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
protected void addEntity(Entity entity) { protected void addEntity(Entity entity) {
org.spigotmc.AsyncCatcher.catchOp("entity track"); // Spigot org.spigotmc.AsyncCatcher.catchOp("entity track"); // Spigot
// Paper start - ignore and warn about illegal addEntity calls instead of crashing server // Paper start - ignore and warn about illegal addEntity calls instead of crashing server
@ -178,7 +178,7 @@ index 9f32a26fdbfaf024cfe5c0996c2253f2dd581d5e..807a54e24018455a997e4410cdb7579d
if (!entity.valid || entity.world != this.world || this.trackedEntities.containsKey(entity.getId())) { if (!entity.valid || entity.world != this.world || this.trackedEntities.containsKey(entity.getId())) {
new Throwable("[ERROR] Illegal PlayerChunkMap::addEntity for world " + this.world.getWorld().getName() new Throwable("[ERROR] Illegal PlayerChunkMap::addEntity for world " + this.world.getWorld().getName()
+ ": " + entity + (this.trackedEntities.containsKey(entity.getId()) ? " ALREADY CONTAINED (This would have crashed your server)" : "")) + ": " + entity + (this.trackedEntities.containsKey(entity.getId()) ? " ALREADY CONTAINED (This would have crashed your server)" : ""))
@@ -2072,10 +2077,15 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -2047,10 +2052,15 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
} }
} }
@ -194,7 +194,7 @@ index 9f32a26fdbfaf024cfe5c0996c2253f2dd581d5e..807a54e24018455a997e4410cdb7579d
if (entity instanceof EntityPlayer) { if (entity instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) entity; EntityPlayer entityplayer = (EntityPlayer) entity;
@@ -2094,6 +2104,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -2069,6 +2079,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
if (playerchunkmap_entitytracker1 != null) { if (playerchunkmap_entitytracker1 != null) {
playerchunkmap_entitytracker1.a(); playerchunkmap_entitytracker1.a();
} }
@ -204,7 +204,7 @@ index 9f32a26fdbfaf024cfe5c0996c2253f2dd581d5e..807a54e24018455a997e4410cdb7579d
entity.tracker = null; // Paper - We're no longer tracked entity.tracker = null; // Paper - We're no longer tracked
} }
@@ -2102,12 +2115,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -2077,12 +2090,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
this.world.timings.tracker1.startTiming(); this.world.timings.tracker1.startTiming();
try { try {
com.tuinity.tuinity.util.maplist.IteratorSafeOrderedReferenceSet.Iterator<Chunk> iterator = this.world.getChunkProvider().entityTickingChunks.iterator(); com.tuinity.tuinity.util.maplist.IteratorSafeOrderedReferenceSet.Iterator<Chunk> iterator = this.world.getChunkProvider().entityTickingChunks.iterator();
@ -219,7 +219,7 @@ index 9f32a26fdbfaf024cfe5c0996c2253f2dd581d5e..807a54e24018455a997e4410cdb7579d
EntityTracker tracker = this.trackedEntities.get(entity.getId()); EntityTracker tracker = this.trackedEntities.get(entity.getId());
if (tracker != null) { if (tracker != null) {
tracker.updatePlayers(tracker.tracker.getPlayersInTrackRange()); tracker.updatePlayers(tracker.tracker.getPlayersInTrackRange());
@@ -2117,6 +2132,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -2092,6 +2107,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
} }
} finally { } finally {
iterator.finishedIterating(); iterator.finishedIterating();
@ -227,7 +227,7 @@ index 9f32a26fdbfaf024cfe5c0996c2253f2dd581d5e..807a54e24018455a997e4410cdb7579d
} }
} finally { } finally {
this.world.timings.tracker1.stopTiming(); this.world.timings.tracker1.stopTiming();
@@ -2124,10 +2140,10 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -2099,10 +2115,10 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
} }
// Paper end - optimised tracker // Paper end - optimised tracker
@ -240,7 +240,7 @@ index 9f32a26fdbfaf024cfe5c0996c2253f2dd581d5e..807a54e24018455a997e4410cdb7579d
return; return;
} }
// Paper end - optimized tracker // Paper end - optimized tracker
@@ -2171,20 +2187,30 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -2146,20 +2162,30 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
} }
protected void broadcast(Entity entity, Packet<?> packet) { protected void broadcast(Entity entity, Packet<?> packet) {
@ -271,7 +271,7 @@ index 9f32a26fdbfaf024cfe5c0996c2253f2dd581d5e..807a54e24018455a997e4410cdb7579d
} }
@@ -2297,11 +2323,13 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially @@ -2272,11 +2298,13 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
entityplayer.a(chunk.getPos(), apacket[0], apacket[1]); entityplayer.a(chunk.getPos(), apacket[0], apacket[1]);
PacketDebug.a(this.world, chunk.getPos()); PacketDebug.a(this.world, chunk.getPos());
@ -287,7 +287,7 @@ index 9f32a26fdbfaf024cfe5c0996c2253f2dd581d5e..807a54e24018455a997e4410cdb7579d
for (int i = 0, size = chunk.entities.size(); i < size; ++i) { for (int i = 0, size = chunk.entities.size(); i < size; ++i) {
Entity entity = entities[i]; Entity entity = entities[i];
if (entity == entityplayer) { if (entity == entityplayer) {
@@ -2323,6 +2351,9 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially @@ -2298,6 +2326,9 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
list1.add(entity); list1.add(entity);
} }
} }
@ -297,7 +297,7 @@ index 9f32a26fdbfaf024cfe5c0996c2253f2dd581d5e..807a54e24018455a997e4410cdb7579d
// Paper end - optimise entity tracker // Paper end - optimise entity tracker
Iterator iterator; Iterator iterator;
@@ -2461,7 +2492,7 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially @@ -2436,7 +2467,7 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
} }
public void updatePlayer(EntityPlayer entityplayer) { public void updatePlayer(EntityPlayer entityplayer) {

View File

@ -0,0 +1,387 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ivan Pekov <ivan@mrivanplays.com>
Date: Wed, 7 Oct 2020 17:38:05 +0300
Subject: [PATCH] Replace some hot streams
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 24a6102b37b7e6b4ed208f803d646645dcafe1c3..422b5f0c28d85ee167bce2967e1b5ee9fa7833dd 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -416,10 +416,21 @@ public class ChunkRegionLoader {
NBTTagCompound nbttagcompound2;
for (int i = -1; i < 17; ++i) { // Paper - conflict on loop parameter change
+ // Yatopia start - replace stream
+ /*
int finalI = i;
ChunkSection chunksection = (ChunkSection) Arrays.stream(achunksection).filter((chunksection1) -> {
return chunksection1 != null && chunksection1.getYPosition() >> 4 == finalI;
}).findFirst().orElse(Chunk.a);
+ */
+ ChunkSection chunksection = Chunk.EMPTY_CHUNK_SECTION;
+ for (ChunkSection section : achunksection) {
+ if (section != null && section.getYPosition() >> 4 == i) {
+ chunksection = section;
+ break;
+ }
+ }
+ // Yatopia end
// Paper start - async chunk save for unload
NibbleArray nibblearray; // block light
NibbleArray nibblearray1; // sky light
@@ -706,6 +717,8 @@ public class ChunkRegionLoader {
while (iterator.hasNext()) {
String s = (String) iterator.next();
+ // Yatopia start - replace stream
+ /*
map.put(StructureGenerator.a.get(s.toLowerCase(Locale.ROOT)), new LongOpenHashSet(Arrays.stream(nbttagcompound1.getLongArray(s)).filter((i) -> {
ChunkCoordIntPair chunkcoordintpair1 = new ChunkCoordIntPair(i);
@@ -716,6 +729,22 @@ public class ChunkRegionLoader {
return true;
}
}).toArray()));
+ */
+ long[] longArray = nbttagcompound1.getLongArray(s);
+ LongSet set = new LongOpenHashSet();
+ for (long value : longArray) {
+ // got from ChunkCoordIntPair
+ // avoid creating additional object
+ int x = (int) value;
+ int z = (int) (value >> 32);
+ if (Math.max(Math.abs(x - chunkcoordintpair.x), Math.abs(z - chunkcoordintpair.z)) > 8) {
+ ChunkRegionLoader.LOGGER.warn("Found invalid structure reference [ {} @ {} ] for chunk {}. ", s, "[" + x + ", " + z + "]", chunkcoordintpair);
+ } else {
+ set.add(value);
+ }
+ }
+ map.put(StructureGenerator.a.get(s.toLowerCase(Locale.ROOT)), set);
+ // Yatopia end
}
return map;
diff --git a/src/main/java/net/minecraft/server/DefinedStructure.java b/src/main/java/net/minecraft/server/DefinedStructure.java
index 8974d7944f159b9346680c639daf0f8c06767cfe..bd610bfcd9571d7478ed13a0c35bc959cab07f0f 100644
--- a/src/main/java/net/minecraft/server/DefinedStructure.java
+++ b/src/main/java/net/minecraft/server/DefinedStructure.java
@@ -811,9 +811,18 @@ public class DefinedStructure {
public List<DefinedStructure.BlockInfo> a(Block block) {
return (List) this.b.computeIfAbsent(block, (block1) -> {
+ // Yatopia start - replace stream
+ /*
return (List) this.a.stream().filter((definedstructure_blockinfo) -> {
return definedstructure_blockinfo.b.a(block1);
}).collect(Collectors.toList());
+ */
+ List<DefinedStructure.BlockInfo> ret = new net.yatopia.server.list.GlueList<>();
+ for (BlockInfo info : a) {
+ if (info.b.isBlock(block1)) { ret.add(info); }
+ }
+ return ret;
+ // Yatopia end
});
}
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 2beb2b53e8d9f04e5d90898282d8cd186d251c14..6357d05aad07e5c2f10c899637bc7739957f92d0 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2529,6 +2529,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return this.world.getScoreboard().getPlayerTeam(this.getName());
}
+ public final boolean isAlly(Entity entity) { return r(entity); } // Yatopia - OBFHELPER
public boolean r(Entity entity) {
return this.a(entity.getScoreboardTeam());
}
diff --git a/src/main/java/net/minecraft/server/EntityPigZombie.java b/src/main/java/net/minecraft/server/EntityPigZombie.java
index a60bb54270b98bad9cc8caa9ce2538f54b03fbfe..3b9ba7c012586c7620e69cf450b8d1c1fee3b215 100644
--- a/src/main/java/net/minecraft/server/EntityPigZombie.java
+++ b/src/main/java/net/minecraft/server/EntityPigZombie.java
@@ -101,6 +101,8 @@ public class EntityPigZombie extends EntityZombie implements IEntityAngerable {
double d0 = this.b(GenericAttributes.FOLLOW_RANGE);
AxisAlignedBB axisalignedbb = AxisAlignedBB.a(this.getPositionVector()).grow(d0, 10.0D, d0);
+ // Yatopia start - replace stream
+ /*
this.world.b(EntityPigZombie.class, axisalignedbb).stream().filter((entitypigzombie) -> {
return entitypigzombie != this;
}).filter((entitypigzombie) -> {
@@ -110,6 +112,13 @@ public class EntityPigZombie extends EntityZombie implements IEntityAngerable {
}).forEach((entitypigzombie) -> {
entitypigzombie.setGoalTarget(this.getGoalTarget(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true); // CraftBukkit
});
+ */
+ for (EntityPigZombie zombie : world.b(EntityPigZombie.class, axisalignedbb)) {
+ if (zombie != this && zombie.getGoalTarget() == null && !zombie.isAlly(getGoalTarget())) {
+ zombie.setGoalTarget(getGoalTarget(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true);
+ }
+ }
+ // Yatopia end
}
private void fa() {
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 4144dc7ca04b9a5d7da8ae619d3510c34c43e158..f441da3af423c8468a3446ede49197562b451752 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -761,11 +761,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
private void eV() {
AxisAlignedBB axisalignedbb = (new AxisAlignedBB(this.getChunkCoordinates())).grow(32.0D, 10.0D, 32.0D);
+ // Yatopia start - replace stream
+ /*
this.world.b(EntityInsentient.class, axisalignedbb).stream().filter((entityinsentient) -> {
return entityinsentient instanceof IEntityAngerable;
}).forEach((entityinsentient) -> {
((IEntityAngerable) entityinsentient).b(this);
});
+ */
+ for (EntityInsentient insentient : world.b(EntityInsentient.class, axisalignedbb)) {
+ if (insentient instanceof IEntityAngerable) {
+ insentient.b(this);
+ }
+ }
+ // Yatopia end
}
@Override
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
index 4c7e1f5c2a332f5b5ed15b0528ed717f5f84f63f..2a6735ce6a3ac233e5b2e75538c182e613c9896e 100644
--- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
@@ -679,11 +679,20 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
if (optional.isPresent()) {
WorldServer worldserver = (WorldServer) this.world;
+ // Yatopia start - replace stream
+ /*
((List) optional.get()).stream().filter((entityliving) -> {
return entityliving instanceof ReputationHandler;
}).forEach((entityliving) -> {
worldserver.a(ReputationEvent.d, entity, (ReputationHandler) entityliving);
});
+ */
+ for (EntityLiving livingEntity : optional.get()) {
+ if (livingEntity instanceof ReputationHandler) {
+ worldserver.a(ReputationEvent.d, entity, (ReputationHandler) livingEntity);
+ }
+ }
+ // Yatopia end
}
}
}
diff --git a/src/main/java/net/minecraft/server/InventorySubcontainer.java b/src/main/java/net/minecraft/server/InventorySubcontainer.java
index db5def8b1d4179a64b28366339a3634af593cd5e..8627fb85f5f8b3309caf681eede4c3455bdc618c 100644
--- a/src/main/java/net/minecraft/server/InventorySubcontainer.java
+++ b/src/main/java/net/minecraft/server/InventorySubcontainer.java
@@ -90,9 +90,19 @@ public class InventorySubcontainer implements IInventory, AutoRecipeOutput {
}
public List<ItemStack> f() {
+ // Yatopia start - replace stream
+ /*
List<ItemStack> list = (List) this.items.stream().filter((itemstack) -> {
return !itemstack.isEmpty();
}).collect(Collectors.toList());
+ */
+ List<ItemStack> list = new net.yatopia.server.list.GlueList<>();
+ for (ItemStack item : items) {
+ if (!item.isEmpty()) {
+ list.add(item);
+ }
+ }
+ // Yatopia end
this.clear();
return list;
diff --git a/src/main/java/net/minecraft/server/LootTable.java b/src/main/java/net/minecraft/server/LootTable.java
index 9922c8b2a7fbb55cfb8b9cea9545c9ec0a0dcbf8..0e8c52f64dd3ffe5e9510227cc6cbaf5b38a5e87 100644
--- a/src/main/java/net/minecraft/server/LootTable.java
+++ b/src/main/java/net/minecraft/server/LootTable.java
@@ -85,7 +85,7 @@ public class LootTable {
}
public List<ItemStack> populateLoot(LootTableInfo loottableinfo) {
- List<ItemStack> list = Lists.newArrayList();
+ List<ItemStack> list = new net.yatopia.server.list.GlueList<>(); // Yatopia
this.populateLoot(loottableinfo, list::add);
return list;
@@ -122,7 +122,15 @@ public class LootTable {
if (event.isCancelled()) {
return;
}
+ // Yatopia start - replace stream
+ /*
list = event.getLoot().stream().map(CraftItemStack::asNMSCopy).collect(Collectors.toList());
+ */
+ list = new net.yatopia.server.list.GlueList<>();
+ for (org.bukkit.inventory.ItemStack bukkitItem : event.getLoot()) {
+ list.add(CraftItemStack.asNMSCopy(bukkitItem));
+ }
+ // Yatopia end
// CraftBukkit end
List<Integer> list1 = this.a(iinventory, random);
diff --git a/src/main/java/net/minecraft/server/PiglinAI.java b/src/main/java/net/minecraft/server/PiglinAI.java
index 0407fa1751d89a037da8cb01f5ceef9b9833dd18..a4e98b11e4ce4a4c9f3aa0986b7b2018b1f24f33 100644
--- a/src/main/java/net/minecraft/server/PiglinAI.java
+++ b/src/main/java/net/minecraft/server/PiglinAI.java
@@ -359,6 +359,8 @@ public class PiglinAI {
public static void a(EntityHuman entityhuman, boolean flag) {
List<EntityPiglinAbstract> list = entityhuman.world.a(EntityPiglin.class, entityhuman.getBoundingBox().g(16.0D)); // CraftBukkit - decompile error
+ // Yatopia start - replace stream
+ /*
list.stream().filter(PiglinAI::d).filter((entitypiglin) -> {
return !flag || BehaviorUtil.c(entitypiglin, entityhuman);
}).forEach((entitypiglin) -> {
@@ -369,6 +371,17 @@ public class PiglinAI {
}
});
+ */
+ for (EntityPiglinAbstract piglinAbstract : list) {
+ if (PiglinAI.d(piglinAbstract) && (!flag || BehaviorUtil.c(piglinAbstract, entityhuman))) {
+ if (piglinAbstract.world.getGameRules().getBoolean(GameRules.UNIVERSAL_ANGER)) {
+ d(piglinAbstract, entityhuman);
+ } else {
+ c(piglinAbstract, entityhuman);
+ }
+ }
+ }
+ // Yatopia end
}
public static EnumInteractionResult a(EntityPiglin entitypiglin, EntityHuman entityhuman, EnumHand enumhand) {
diff --git a/src/main/java/net/minecraft/server/Raid.java b/src/main/java/net/minecraft/server/Raid.java
index 89464cc770b4875ad65c5e84315e462689cea57b..ed13f8fe725ce7601e5c506b590042cedbac7b54 100644
--- a/src/main/java/net/minecraft/server/Raid.java
+++ b/src/main/java/net/minecraft/server/Raid.java
@@ -794,7 +794,16 @@ public class Raid {
// CraftBukkit start - a method to get all raiders
public java.util.Collection<EntityRaider> getRaiders() {
+ // Yatopia start - replace stream
+ /*
return this.raiders.values().stream().flatMap(Set::stream).collect(java.util.stream.Collectors.toSet());
+ */
+ java.util.List<EntityRaider> ret = new net.yatopia.server.list.GlueList<>();
+ for (Set<EntityRaider> raid : raiders.values()) {
+ ret.addAll(raid);
+ }
+ return ret;
+ // Yatopia end
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index b3e24d6f44320bf9b13f627dc5a9cb46614afe9b..304769013a68ec18cb87916b0363edfa0e7a0cda 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -60,11 +60,11 @@ public class WorldServer extends World implements GeneratorAccessSeed {
public final Int2ObjectMap<Entity> entitiesById = new Int2ObjectLinkedOpenHashMap(); final com.tuinity.tuinity.util.maplist.IteratorSafeOrderedReferenceSet<Entity> entitiesForIteration = new com.tuinity.tuinity.util.maplist.IteratorSafeOrderedReferenceSet<>(2048, 0.5f, 2048, 0.2, true); // Tuinity - make removing entities while ticking safe
private final Map<UUID, Entity> entitiesByUUID = Maps.newHashMap();
private final Queue<Entity> entitiesToAdd = Queues.newArrayDeque();
- public final List<EntityPlayer> players = Lists.newArrayList(); // Paper - private -> public
+ public final List<EntityPlayer> players = new net.yatopia.server.list.GlueList<>(); // Paper - private -> public // Yatopia
public final ChunkProviderServer chunkProvider; // Paper - public
boolean tickingEntities;
// Paper start
- List<java.lang.Runnable> afterEntityTickingTasks = Lists.newArrayList();
+ List<java.lang.Runnable> afterEntityTickingTasks = new net.yatopia.server.list.GlueList<>(); // Yatopia
public void doIfNotEntityTicking(java.lang.Runnable run) {
if (tickingEntities) {
afterEntityTickingTasks.add(run);
@@ -829,6 +829,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
}
// */
// Yatopia start
+ boolean sleepyMatch = true;
for (EntityPlayer player : players) {
if (player.world == this) {
player.tickWeather();
@@ -836,6 +837,11 @@ public class WorldServer extends World implements GeneratorAccessSeed {
player.updateWeather(this.lastRainLevel, this.rainLevel, this.lastThunderLevel, this.thunderLevel);
// Yatopia end
}
+ // Yatopia start
+ if (sleepyMatch && !player.isSpectator() && !player.isDeeplySleeping() && !player.fauxSleeping) {
+ sleepyMatch = false;
+ }
+ // Yatopia end
}
/* // Yatopia start - moved up
@@ -855,9 +861,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
// CraftBukkit end
*/ // Yatopia end
- if (this.everyoneSleeping && this.players.stream().noneMatch((entityplayer) -> {
- return !entityplayer.isSpectator() && !entityplayer.isDeeplySleeping() && !entityplayer.fauxSleeping; // CraftBukkit
- })) {
+ if (this.everyoneSleeping && sleepyMatch) { // Yatopia
// CraftBukkit start
long l = this.worldData.getDayTime() + 24000L;
TimeSkipEvent event = new TimeSkipEvent(this.getWorld(), TimeSkipEvent.SkipReason.NIGHT_SKIP, (l - l % 24000L) - this.getDayTime());
@@ -1027,9 +1031,9 @@ public class WorldServer extends World implements GeneratorAccessSeed {
}
private void wakeupPlayers() {
- (this.players.stream().filter(EntityLiving::isSleeping).collect(Collectors.toList())).forEach((entityplayer) -> { // CraftBukkit - decompile error
+ for (EntityPlayer entityplayer : players) { if (entityplayer.isSleeping()) { // Yatopia
entityplayer.wakeup(false, false);
- });
+ }} // Yatopia
}
// Paper start - optimise random block ticking
@@ -1795,8 +1799,9 @@ public class WorldServer extends World implements GeneratorAccessSeed {
// Spigot start
if ( entity instanceof EntityHuman )
{
- this.getMinecraftServer().worldServer.values().stream().map( WorldServer::getWorldPersistentData ).forEach( (worldData) ->
+ for ( WorldServer worldServer : getMinecraftServer().worldServer.values() ) // Yatopia
{
+ WorldPersistentData worldData = worldServer.getWorldPersistentData(); // Yatopia
for (Object o : worldData.data.values() )
{
if ( o instanceof WorldMap )
@@ -1813,7 +1818,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
}
}
}
- } );
+ } // Yatopia
}
// Spigot end
// Spigot Start
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRaid.java b/src/main/java/org/bukkit/craftbukkit/CraftRaid.java
index 360a4901f5159a3f0606214f1abf2f8cee2ecbe1..450a64396f8fe167bc0accb7fdfcfeebb16351ac 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftRaid.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRaid.java
@@ -91,11 +91,20 @@ public final class CraftRaid implements Raid {
@Override
public List<Raider> getRaiders() {
+ // Yatopia start - replace stream
+ /*
return handle.getRaiders().stream().map(new Function<EntityRaider, Raider>() {
@Override
public Raider apply(EntityRaider entityRaider) {
return (Raider) entityRaider.getBukkitEntity();
}
}).collect(ImmutableList.toImmutableList());
+ */
+ List<Raider> ret = new net.yatopia.server.list.GlueList<>();
+ for (EntityRaider raider : handle.getRaiders()) {
+ ret.add((Raider) raider.getBukkitEntity());
+ }
+ return Collections.unmodifiableList(ret);
+ // Yatopia end
}
}