some patches

now i go to bed
This commit is contained in:
Etil
2021-12-10 23:13:26 +01:00
parent 80f833bc14
commit 045f184c9b
6 changed files with 176 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Etil <81570777+etil2jz@users.noreply.github.com>
Date: Fri, 10 Dec 2021 22:00:25 +0100
Date: Fri, 10 Dec 2021 22:50:17 +0100
Subject: [PATCH] Don't save Fireworks
Original code by Starlis, licensed under GNU General Public License v3.0

View File

@@ -0,0 +1,41 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Etil <81570777+etil2jz@users.noreply.github.com>
Date: Fri, 10 Dec 2021 22:46:37 +0100
Subject: [PATCH] Mitigate ConcurrentModificationException by copying
entitySection access
Original code by Starlis, licensed under GNU General Public License v3.0
You can find the original code on https://github.com/starlis/empirecraft
diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
index bd7967680d7a75caff98a827895c795f2d101f99..a3acd40f24aae3c9809b76ce6f3e1b2d20acc5b1 100644
--- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
+++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
@@ -264,23 +264,23 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
if (flag2 && !flag3) {
entitysection.getEntities().filter((entityaccess) -> {
return !entityaccess.isAlwaysTicking();
- }).forEach(this::stopTicking);
+ }).collect(Collectors.toList()).forEach(this::stopTicking); // EMC
}
if (flag && !flag1) {
entitysection.getEntities().filter((entityaccess) -> {
return !entityaccess.isAlwaysTicking();
- }).forEach(this::stopTracking);
+ }).collect(Collectors.toList()).forEach(this::stopTracking); // EMC
} else if (!flag && flag1) {
entitysection.getEntities().filter((entityaccess) -> {
return !entityaccess.isAlwaysTicking();
- }).forEach(this::startTracking);
+ }).collect(Collectors.toList()).forEach(this::startTracking); // EMC
}
if (!flag2 && flag3) {
entitysection.getEntities().filter((entityaccess) -> {
return !entityaccess.isAlwaysTicking();
- }).forEach(this::startTicking);
+ }).collect(Collectors.toList()).forEach(this::startTicking); // EMC
}
});

View File

@@ -0,0 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Etil <81570777+etil2jz@users.noreply.github.com>
Date: Fri, 10 Dec 2021 22:55:42 +0100
Subject: [PATCH] Fix cow rotation when shearing mooshroom
Original code by PurpurMC, licensed under MIT
You can find the original code on https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java b/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java
index a91c8d37b818161fb7e2dc0def82a56d7db04fc1..75b745bc8bf4d96946b3000c0a20c4c6c952225a 100644
--- a/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java
+++ b/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java
@@ -181,7 +181,13 @@ public class MushroomCow extends Cow implements Shearable {
entitycow.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
entitycow.setHealth(this.getHealth());
+ // Purpur start
+ entitycow.copyPosition(this);
entitycow.yBodyRot = this.yBodyRot;
+ entitycow.setYHeadRot(this.getYHeadRot());
+ entitycow.yRotO = this.yRotO;
+ entitycow.xRotO = this.xRotO;
+ // Purpur end
if (this.hasCustomName()) {
entitycow.setCustomName(this.getCustomName());
entitycow.setCustomNameVisible(this.isCustomNameVisible());

View File

@@ -0,0 +1,20 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Etil <81570777+etil2jz@users.noreply.github.com>
Date: Fri, 10 Dec 2021 23:01:59 +0100
Subject: [PATCH] End gateway should check if entity can use portal
Original code by PurpurMC, licensed under MIT
You can find the original code on https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
index 6e911b9a2fbdb4495605f68bc465b1f9e2d80ea1..4b5e8f1d1973f50b45bab7908c416a3b7619fdb9 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
@@ -176,6 +176,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {
public static void teleportEntity(Level world, BlockPos pos, BlockState state, Entity entity, TheEndGatewayBlockEntity blockEntity) {
if (world instanceof ServerLevel && !blockEntity.isCoolingDown()) {
+ if (!entity.canChangeDimensions()) return; // Purpur
ServerLevel worldserver = (ServerLevel) world;
blockEntity.teleportCooldown = 100;

View File

@@ -0,0 +1,21 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Etil <81570777+etil2jz@users.noreply.github.com>
Date: Fri, 10 Dec 2021 23:04:17 +0100
Subject: [PATCH] Arrows should not reset despawn counter
Original code by PurpurMC, licensed under MIT
You can find the original code on https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index 3d3dcb47720055f550d17d1f106a2c0e59de2919..8a0a0ce2fce81b78bf3e4f9deb74b412ef15058b 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -308,7 +308,7 @@ public abstract class AbstractArrow extends Projectile {
Vec3 vec3d = this.getDeltaMovement();
this.setDeltaMovement(vec3d.multiply((double) (this.random.nextFloat() * 0.2F), (double) (this.random.nextFloat() * 0.2F), (double) (this.random.nextFloat() * 0.2F)));
- this.life = 0;
+ //this.life = 0; // Purpur - do not reset despawn counter
}
@Override

View File

@@ -0,0 +1,67 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Etil <81570777+etil2jz@users.noreply.github.com>
Date: Fri, 10 Dec 2021 23:08:06 +0100
Subject: [PATCH] Spread out and optimise player list ticksSpread out and
optimise player list ticks
Original code by PurpurMC, licensed under MIT
You can find the original code on https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index dc53441ce82240f8cf7bb35afe01b40743777cd5..d487535566025c376750cfc328e6c8f5a1f78cc5 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1017,22 +1017,21 @@ public abstract class PlayerList {
}
public void tick() {
- if (++this.sendAllPlayerInfoIn > 600) {
- // CraftBukkit start
- for (int i = 0; i < this.players.size(); ++i) {
- final ServerPlayer target = (ServerPlayer) this.players.get(i);
-
- target.connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.UPDATE_LATENCY, this.players.stream().filter(new Predicate<ServerPlayer>() {
- @Override
- public boolean apply(ServerPlayer input) {
- return target.getBukkitEntity().canSee(input.getBukkitEntity());
- }
- }).collect(Collectors.toList())));
+ // Purpur start
+ if (this.sendAllPlayerInfoIn < this.players.size()) {
+ final org.bukkit.craftbukkit.entity.CraftPlayer target = this.players.get(this.sendAllPlayerInfoIn).getBukkitEntity();
+ final List<ServerPlayer> list = new java.util.ArrayList<>();
+ for (ServerPlayer player : this.players) {
+ if (target.canSee(player.getUUID())) {
+ list.add(player);
+ }
}
- // CraftBukkit end
+ target.getHandle().connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.UPDATE_LATENCY, list));
+ }
+ if (++this.sendAllPlayerInfoIn > 600) {
this.sendAllPlayerInfoIn = 0;
}
-
+ // Purpur end
}
public void broadcastAll(Packet<?> packet) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index c6cd4a5790384811f3171ce740afb9459f3d6fc0..fa91fa1d3842f1c9cb2e3d33cef02995bca32601 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1544,7 +1544,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public boolean canSee(org.bukkit.entity.Entity entity) {
- return !this.hiddenEntities.containsKey(entity.getUniqueId());
+ // Purpur start
+ return this.canSee(entity.getUniqueId());
+ }
+
+ public boolean canSee(UUID uuid) {
+ return !this.hiddenEntities.containsKey(uuid);
+ // Purpur end
}
@Override