This commit is contained in:
Owen1212055 2024-10-23 10:08:40 -04:00
parent af125d26a9
commit 6bfc6db99e
No known key found for this signature in database
GPG key ID: 2133292072886A30
15 changed files with 48 additions and 58 deletions

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Implement Mob Goal API
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index 0c349354ba76dfd2c5f16fb232263b18e77a9a40..6c3ed9e685473d7f555ae0e34fb9d4f3873f109a 100644 index da2f9c5afb2994f403a1128af0f7acbd6b73b862..38585b7f0b8e1e287b37820924a1b0d464fe9e99 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -41,6 +41,7 @@ dependencies { @@ -41,6 +41,7 @@ dependencies {
@ -758,11 +758,11 @@ index 0000000000000000000000000000000000000000..b5c594a5499556ad452d9939c75e150a
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/Goal.java b/src/main/java/net/minecraft/world/entity/ai/goal/Goal.java diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/Goal.java b/src/main/java/net/minecraft/world/entity/ai/goal/Goal.java
index 6667ecc4b7eded4e20a415cef1e1b1179e6710b8..16f9a98b8a939e5ca7e2dc04f87134a7ed66736b 100644 index a8d6d7054110b5d95830296699f004418dae10db..acc25b08ed3b9f978229fa017d23f9fa0da519e3 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/Goal.java --- a/src/main/java/net/minecraft/world/entity/ai/goal/Goal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/Goal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/Goal.java
@@ -51,7 +51,19 @@ public abstract class Goal { @@ -62,7 +62,19 @@ public abstract class Goal {
return Mth.positiveCeilDiv(serverTicks, 2); return (ServerLevel)world;
} }
+ // Paper start - Mob goal api + // Paper start - Mob goal api
@ -782,10 +782,10 @@ index 6667ecc4b7eded4e20a415cef1e1b1179e6710b8..16f9a98b8a939e5ca7e2dc04f87134a7
LOOK, LOOK,
JUMP, JUMP,
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 75ea1d68c4be6f73ad05cd53b4e4c0182832395c..2b3eaeea881b12fe7e4c5150815ad00fe9f026e0 100644 index 0d36eb7ae9d07d51449a4a15a6474c3f4befec94..aa7e0c08552ba476cfb266ad474eaecb9cc21a96 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
@@ -2938,5 +2938,11 @@ public final class CraftServer implements Server { @@ -2957,5 +2957,11 @@ public final class CraftServer implements Server {
public boolean isStopping() { public boolean isStopping() {
return net.minecraft.server.MinecraftServer.getServer().hasStopped(); return net.minecraft.server.MinecraftServer.getServer().hasStopped();
} }

View file

@ -57,12 +57,12 @@ index f06a5f0d9c5c877ddf963254d3124f5fe2d67282..aa32804bc9affe9a615d3ffaa513f6f0
static record GossipEntry(UUID target, GossipType type, int value) { static record GossipEntry(UUID target, GossipType type, int value) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
index 957c9ec21c7a9888b3038402b0111c68f816f968..52312bec840322d32ea845f0bd64eb3ca1380854 100644 index ded319d10a5907b96abfd5620036b66a9aa3b3f7..45c44c46edee9f46b8e197f1f54ea2779bf1184c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
@@ -20,6 +20,13 @@ import org.bukkit.entity.Villager; @@ -21,6 +21,13 @@ import org.bukkit.entity.ZombieVillager;
import org.bukkit.entity.ZombieVillager;
import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityTransformEvent;
+// Paper start +// Paper start
+import com.destroystokyo.paper.entity.villager.Reputation; +import com.destroystokyo.paper.entity.villager.Reputation;
@ -74,7 +74,7 @@ index 957c9ec21c7a9888b3038402b0111c68f816f968..52312bec840322d32ea845f0bd64eb3c
public class CraftVillager extends CraftAbstractVillager implements Villager { public class CraftVillager extends CraftAbstractVillager implements Villager {
public CraftVillager(CraftServer server, net.minecraft.world.entity.npc.Villager entity) { public CraftVillager(CraftServer server, net.minecraft.world.entity.npc.Villager entity) {
@@ -298,4 +305,45 @@ public class CraftVillager extends CraftAbstractVillager implements Villager { @@ -299,4 +306,45 @@ public class CraftVillager extends CraftAbstractVillager implements Villager {
return this.getKey().hashCode(); return this.getKey().hashCode();
} }
} }

View file

@ -21,10 +21,10 @@ Co-authored-by: Aikar <aikar@aikar.co>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
index 0916e24271d07ad5db51c5bc68791722b0f69c2b..a758b2456acac23095fe4619ae10300a034cb460 100644 index 9d9e3daebc5da0af627c3d3cdb50029aacbc587b..3a7af27bb1ce0cbe56bd3760cd400083daf98d4c 100644
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java --- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
@@ -244,6 +244,7 @@ public class ExperienceOrb extends Entity { @@ -245,6 +245,7 @@ public class ExperienceOrb extends Entity {
} }
private static boolean tryMergeToExisting(ServerLevel world, Vec3 pos, int amount) { private static boolean tryMergeToExisting(ServerLevel world, Vec3 pos, int amount) {
@ -32,7 +32,7 @@ index 0916e24271d07ad5db51c5bc68791722b0f69c2b..a758b2456acac23095fe4619ae10300a
AABB axisalignedbb = AABB.ofSize(pos, 1.0D, 1.0D, 1.0D); AABB axisalignedbb = AABB.ofSize(pos, 1.0D, 1.0D, 1.0D);
int j = world.getRandom().nextInt(40); int j = world.getRandom().nextInt(40);
List<ExperienceOrb> list = world.getEntities(EntityTypeTest.forClass(ExperienceOrb.class), axisalignedbb, (entityexperienceorb) -> { List<ExperienceOrb> list = world.getEntities(EntityTypeTest.forClass(ExperienceOrb.class), axisalignedbb, (entityexperienceorb) -> {
@@ -270,6 +271,11 @@ public class ExperienceOrb extends Entity { @@ -271,6 +272,11 @@ public class ExperienceOrb extends Entity {
} }
private void merge(ExperienceOrb other) { private void merge(ExperienceOrb other) {
@ -44,7 +44,7 @@ index 0916e24271d07ad5db51c5bc68791722b0f69c2b..a758b2456acac23095fe4619ae10300a
this.count += other.count; this.count += other.count;
this.age = Math.min(this.age, other.age); this.age = Math.min(this.age, other.age);
other.discard(EntityRemoveEvent.Cause.MERGE); // CraftBukkit - add Bukkit remove cause other.discard(EntityRemoveEvent.Cause.MERGE); // CraftBukkit - add Bukkit remove cause
@@ -360,7 +366,7 @@ public class ExperienceOrb extends Entity { @@ -364,7 +370,7 @@ public class ExperienceOrb extends Entity {
int l = amount - k * amount / j; int l = amount - k * amount / j;
if (l > 0) { if (l > 0) {
@ -77,10 +77,10 @@ index 5a7d314ec0562e472f5dc45924a7b24841cff126..650e4a01cecc4cc08e7ff9ebcc4c3670
public java.util.UUID getTriggerEntityId() { public java.util.UUID getTriggerEntityId() {
return getHandle().triggerEntityId; return getHandle().triggerEntityId;
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 26f8a8cb18205bfb9fe9dc557097946987ddcb18..f3ec3d14e66b9c1dff32088d4aef57e21265048c 100644 index 0b9c96105bea9a0d1af17b7ecf4479d3596faa80..b40117e9940ab493ea4a945dbd9754a38b1159b9 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -714,15 +714,29 @@ public class CraftEventFactory { @@ -712,15 +712,29 @@ public class CraftEventFactory {
if (entity instanceof net.minecraft.world.entity.ExperienceOrb xp) { if (entity instanceof net.minecraft.world.entity.ExperienceOrb xp) {
double radius = world.spigotConfig.expMerge; double radius = world.spigotConfig.expMerge;
if (radius > 0) { if (radius > 0) {

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Fix PotionEffect ignores icon flag
Co-authored-by: Tamion <70228790+notTamion@users.noreply.github.com> Co-authored-by: Tamion <70228790+notTamion@users.noreply.github.com>
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 05ba1654ec02ff2b518251c128661e3d8dfa4c6d..733c69a2cfa60fb8c920400e3d9acfc2465090e5 100644 index 81034513faa3bd4f306430bc48532ba671a7b94b..35130dc4e20ef644b5764091fcbccda2e4da780b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -485,7 +485,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -494,7 +494,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override @Override
public boolean addPotionEffect(PotionEffect effect, boolean force) { public boolean addPotionEffect(PotionEffect effect, boolean force) {
@ -18,7 +18,7 @@ index 05ba1654ec02ff2b518251c128661e3d8dfa4c6d..733c69a2cfa60fb8c920400e3d9acfc2
return true; return true;
} }
@@ -506,7 +506,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -515,7 +515,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override @Override
public PotionEffect getPotionEffect(PotionEffectType type) { public PotionEffect getPotionEffect(PotionEffectType type) {
MobEffectInstance handle = this.getHandle().getEffect(CraftPotionEffectType.bukkitToMinecraftHolder(type)); MobEffectInstance handle = this.getHandle().getEffect(CraftPotionEffectType.bukkitToMinecraftHolder(type));
@ -27,7 +27,7 @@ index 05ba1654ec02ff2b518251c128661e3d8dfa4c6d..733c69a2cfa60fb8c920400e3d9acfc2
} }
@Override @Override
@@ -518,7 +518,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -527,7 +527,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public Collection<PotionEffect> getActivePotionEffects() { public Collection<PotionEffect> getActivePotionEffects() {
List<PotionEffect> effects = new ArrayList<PotionEffect>(); List<PotionEffect> effects = new ArrayList<PotionEffect>();
for (MobEffectInstance handle : this.getHandle().activeEffects.values()) { for (MobEffectInstance handle : this.getHandle().activeEffects.values()) {

View file

@ -8,18 +8,10 @@ Adds a new method to fetch the location of a player's bed without generating any
getPotentialBedLocation - Gets the last known location of a player's bed. This does not preform any check if the bed is still valid and does not load any chunks. getPotentialBedLocation - Gets the last known location of a player's bed. This does not preform any check if the bed is still valid and does not load any chunks.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index ba63c58d40cb3b8655fdb8177c423c67ac7cc3ef..c17dd4205983855615289cf0a5619056d237f325 100644 index 6ec6b80d224e2402054afb85b78c793942a58bbf..b2ab430392fc0f214ba8c5383e3f3ad5c548bda2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -12,6 +12,7 @@ import net.minecraft.nbt.CompoundTag; @@ -130,6 +130,22 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
import net.minecraft.network.chat.Component;
import net.minecraft.network.protocol.game.ClientboundOpenScreenPacket;
import net.minecraft.network.protocol.game.ServerboundContainerClosePacket;
+import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.Entity;
@@ -129,6 +130,22 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
return this.getHandle().sleepCounter; return this.getHandle().sleepCounter;
} }
@ -32,7 +24,7 @@ index ba63c58d40cb3b8655fdb8177c423c67ac7cc3ef..c17dd4205983855615289cf0a5619056
+ return null; + return null;
+ } + }
+ +
+ ServerLevel worldServer = handle.server.getLevel(handle.getRespawnDimension()); + net.minecraft.server.level.ServerLevel worldServer = handle.server.getLevel(handle.getRespawnDimension());
+ if (worldServer == null) { + if (worldServer == null) {
+ return null; + return null;
+ } + }

View file

@ -10,10 +10,10 @@ Adds a 5 second grace period for any async tasks to finish and warns
if any are still running after that delay just as reload does. if any are still running after that delay just as reload does.
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 8b17df3d18fe9acc1a7b10c6809886da0143f8c5..0370d26bd1e1d2fe1d640b052aca8a9c05dcb9dc 100644 index a08cebda577223184af8b42a90eb3559e419438e..b4eff440e3d9489f99e10a73611421ef877aa871 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
@@ -942,6 +942,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -958,6 +958,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start // CraftBukkit start
if (this.server != null) { if (this.server != null) {
this.server.disablePlugins(); this.server.disablePlugins();
@ -22,10 +22,10 @@ index 8b17df3d18fe9acc1a7b10c6809886da0143f8c5..0370d26bd1e1d2fe1d640b052aca8a9c
// CraftBukkit end // CraftBukkit end
if (io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper != null) io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper.shutdown(); // Paper - Plugin remapping if (io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper != null) io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper.shutdown(); // Paper - Plugin remapping
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 2b3eaeea881b12fe7e4c5150815ad00fe9f026e0..e56f4b254af45311acb0b55195dcbd9f372cae98 100644 index aa7e0c08552ba476cfb266ad474eaecb9cc21a96..f80164bf8fde13a8702f09e1e1d8aab3ba075e42 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
@@ -1060,6 +1060,32 @@ public final class CraftServer implements Server { @@ -1063,6 +1063,32 @@ public final class CraftServer implements Server {
org.spigotmc.WatchdogThread.hasStarted = true; // Paper - Disable watchdog early timeout on reload org.spigotmc.WatchdogThread.hasStarted = true; // Paper - Disable watchdog early timeout on reload
} }

View file

@ -6,14 +6,14 @@ Subject: [PATCH] Ensure EntityRaider respects game and entity rules for
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raider.java b/src/main/java/net/minecraft/world/entity/raid/Raider.java diff --git a/src/main/java/net/minecraft/world/entity/raid/Raider.java b/src/main/java/net/minecraft/world/entity/raid/Raider.java
index 6fb56c826f0eaf76ab7896f784084b4fb1b3d105..f9bd6f5e54bdb4e2fe4cc73e54961721f440ef07 100644 index 96c6a2a6cb015d4ac90f98ce48a4c345ab72fd7a..4b9b961b1b910775788f85b13ee48abcc474daca 100644
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java --- a/src/main/java/net/minecraft/world/entity/raid/Raider.java
+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java +++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java
@@ -292,6 +292,7 @@ public abstract class Raider extends PatrollingMonster { @@ -338,6 +338,7 @@ public abstract class Raider extends PatrollingMonster {
}
@Override private boolean cannotPickUpBanner() {
public boolean canUse() {
+ if (!this.mob.level().getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_MOBGRIEFING) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items + if (!this.mob.level().getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_MOBGRIEFING) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items
Raid raid = this.mob.getCurrentRaid(); if (!this.mob.hasActiveRaid()) {
return true;
if (this.mob.hasActiveRaid() && !this.mob.getCurrentRaid().isOver() && this.mob.canBeLeader() && !ItemStack.matches(this.mob.getItemBySlot(EquipmentSlot.HEAD), Raid.getLeaderBannerInstance(this.mob.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN)))) { } else if (this.mob.getCurrentRaid().isOver()) {

View file

@ -15,10 +15,10 @@ Previously maps would load all chunks in a certain radius depending on
five ticks that movement occur in anyways. five ticks that movement occur in anyways.
diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java
index 4e6d42051de14a1a62184fbb586ea38fb31261b3..36de7c63370c529579d31ba1d77ec12b754ef313 100644 index 2715c89fb9ea098d8c77b124be1be634835ecb93..af78d15aead7a2dc8304c541e37e306215b761be 100644
--- a/src/main/java/net/minecraft/world/item/MapItem.java --- a/src/main/java/net/minecraft/world/item/MapItem.java
+++ b/src/main/java/net/minecraft/world/item/MapItem.java +++ b/src/main/java/net/minecraft/world/item/MapItem.java
@@ -98,8 +98,8 @@ public class MapItem extends ComplexItem { @@ -97,8 +97,8 @@ public class MapItem extends Item {
int r = (j / i + o - 64) * i; int r = (j / i + o - 64) * i;
int s = (k / i + p - 64) * i; int s = (k / i + p - 64) * i;
Multiset<MapColor> multiset = LinkedHashMultiset.create(); Multiset<MapColor> multiset = LinkedHashMultiset.create();

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Use seed based lookup for Treasure Maps - Fixes lag from
diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java
index 36de7c63370c529579d31ba1d77ec12b754ef313..ce461b1a8d7fab87ae28e30205f6fab67f1808b6 100644 index af78d15aead7a2dc8304c541e37e306215b761be..571f2540a1e9422025efe651167e26b44b437daa 100644
--- a/src/main/java/net/minecraft/world/item/MapItem.java --- a/src/main/java/net/minecraft/world/item/MapItem.java
+++ b/src/main/java/net/minecraft/world/item/MapItem.java +++ b/src/main/java/net/minecraft/world/item/MapItem.java
@@ -206,7 +206,7 @@ public class MapItem extends ComplexItem { @@ -205,7 +205,7 @@ public class MapItem extends Item {
for (int n = 0; n < 128; n++) { for (int n = 0; n < 128; n++) {
for (int o = 0; o < 128; o++) { for (int o = 0; o < 128; o++) {

View file

@ -7,7 +7,7 @@ Subject: [PATCH] Fix CraftScheduler#runTaskTimerAsynchronously(Plugin,
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 02835e4f0a0b262af27acff0939c981cae728db4..d7c2d8993a172e343669228cf24a58d8992a1c10 100644 index fd5a058dd802599598a64467cf25f08329df9e99..fdfdcac6644e5343fb1f1cbe5d9aa76a79627046 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -197,7 +197,7 @@ public class CraftScheduler implements BukkitScheduler { @@ -197,7 +197,7 @@ public class CraftScheduler implements BukkitScheduler {

View file

@ -32,11 +32,11 @@ This patch fixes https://bugs.mojang.com/browse/MC-188840
This patch also fixes rail duping and carpet duping. This patch also fixes rail duping and carpet duping.
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
index 530b6af1ca2e0ac81c0a8a55dbc7cf5c796c93ce..4aa34b7df734bb755906b228e0df9eb629569ea0 100644 index 0b80940ed23a35e0412957a50d04907b676b0aca..e84501fdce7b94300b1f5d6d20e2db90b175454d 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java --- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
@@ -414,14 +414,26 @@ public class PistonBaseBlock extends DirectionalBlock { @@ -419,13 +419,25 @@ public class PistonBaseBlock extends DirectionalBlock {
} BlockState iblockdata2;
for (j = list.size() - 1; j >= 0; --j) { for (j = list.size() - 1; j >= 0; --j) {
- blockposition3 = (BlockPos) list.get(j); - blockposition3 = (BlockPos) list.get(j);
@ -48,16 +48,14 @@ index 530b6af1ca2e0ac81c0a8a55dbc7cf5c796c93ce..4aa34b7df734bb755906b228e0df9eb6
+ // Paper end - fix a variety of piston desync dupes + // Paper end - fix a variety of piston desync dupes
blockposition3 = blockposition3.relative(enumdirection1); blockposition3 = blockposition3.relative(enumdirection1);
map.remove(blockposition3); map.remove(blockposition3);
BlockState iblockdata2 = (BlockState) Blocks.MOVING_PISTON.defaultBlockState().setValue(PistonBaseBlock.FACING, dir); iblockdata2 = (BlockState) Blocks.MOVING_PISTON.defaultBlockState().setValue(PistonBaseBlock.FACING, dir);
world.setBlock(blockposition3, iblockdata2, 68); world.setBlock(blockposition3, iblockdata2, 68);
- world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(blockposition3, iblockdata2, (BlockState) list1.get(j), dir, retract, false));
+ // Paper start - fix a variety of piston desync dupes + // Paper start - fix a variety of piston desync dupes
+ if (!allowDesync) { + if (!allowDesync) {
+ iblockdata1 = world.getBlockState(oldPos); + iblockdata1 = world.getBlockState(oldPos);
+ map.replace(oldPos, iblockdata1); + map.replace(oldPos, iblockdata1);
+ } + }
+ world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(blockposition3, iblockdata2, allowDesync ? list1.get(j) : iblockdata1, dir, retract, false)); world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(blockposition3, iblockdata2, (BlockState) list1.get(j), dir, extend, false));
+ if (!allowDesync) { + if (!allowDesync) {
+ world.setBlock(oldPos, Blocks.AIR.defaultBlockState(), Block.UPDATE_CLIENTS | Block.UPDATE_KNOWN_SHAPE | Block.UPDATE_MOVE_BY_PISTON | 1024); // set air to prevent later physics updates from seeing this block + world.setBlock(oldPos, Blocks.AIR.defaultBlockState(), Block.UPDATE_CLIENTS | Block.UPDATE_KNOWN_SHAPE | Block.UPDATE_MOVE_BY_PISTON | 1024); // set air to prevent later physics updates from seeing this block
+ } + }
@ -66,10 +64,10 @@ index 530b6af1ca2e0ac81c0a8a55dbc7cf5c796c93ce..4aa34b7df734bb755906b228e0df9eb6
} }
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
index 8ea7d7da26e7d5644a8ee1a8d9e4c828c6b70a00..d7b963571c900f0f68005d6954bcd9ef1d9e0b7c 100644 index 53d0057e123540162852cb10fba1b7f7ac8388ad..46afba838cf12eeb1bbccaa260131a76f090364b 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
@@ -297,7 +297,7 @@ public class PistonMovingBlockEntity extends BlockEntity { @@ -306,7 +306,7 @@ public class PistonMovingBlockEntity extends BlockEntity {
if (world.getBlockState(pos).is(Blocks.MOVING_PISTON)) { if (world.getBlockState(pos).is(Blocks.MOVING_PISTON)) {
BlockState blockState = Block.updateFromNeighbourShapes(blockEntity.movedState, world, pos); BlockState blockState = Block.updateFromNeighbourShapes(blockEntity.movedState, world, pos);
if (blockState.isAir()) { if (blockState.isAir()) {

View file

@ -13,10 +13,10 @@ behaviour, we need to move all of this dangerous logic outside
of the move call and into an appropriate place in the tick method. of the move call and into an appropriate place in the tick method.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index c6bcde25b476ef2362f469bd7cba82ce97cb300c..3455781a47fbececab33406e829ceb392c72a113 100644 index 7b8aaf763020cf7be7114f329f22af75f7a80ef0..e329503681961566a76a383245303e88acef37a4 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1349,6 +1349,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1352,6 +1352,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player.move(MoverType.PLAYER, new Vec3(d6, d7, d8)); this.player.move(MoverType.PLAYER, new Vec3(d6, d7, d8));
this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move