mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 02:25:28 +01:00
Patch
This commit is contained in:
parent
26f7b4c72e
commit
89bf08158b
@ -727,10 +727,10 @@ index 2e96308696e131f3f013469a395e5ddda2c5d529..65a66e484c1c39c5f41d97db52f31c67
|
||||
} catch (Throwable e) {
|
||||
LOGGER.error("Failed to run bootstrapper for %s. This plugin will not be loaded.".formatted(provider.getSource()), e);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 8b871d29d883119cd8ad9ca134f4c1fce9362705..f6b87a5249e1a21b3221f253f891d8978249c50a 100644
|
||||
index 2934e232c84603224470fdaba0103d42fc06e8b4..4dc64ab006399d62251f4a238d9c2caebd595301 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1048,6 +1048,11 @@ public final class CraftServer implements Server {
|
||||
@@ -1051,6 +1051,11 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public void reload() {
|
||||
@ -743,7 +743,7 @@ index 8b871d29d883119cd8ad9ca134f4c1fce9362705..f6b87a5249e1a21b3221f253f891d897
|
||||
this.reloadCount++;
|
||||
this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile());
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 73a3e708f21c1b9c5de1fc180f728d6da7eea0fb..b89db5335aa3984b76513165456ebe43ad9a0cc7 100644
|
||||
index b6591836a8d9301b8cf909223426df0e8e675c1f..6396af834c5ca2328896613c5d97e43624eb305d 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -652,6 +652,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
@ -5,7 +5,7 @@ Subject: [PATCH] ItemStack Tooltip API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index b89db5335aa3984b76513165456ebe43ad9a0cc7..6e8838245b0792b15fd9788f2ce11f6503d0e070 100644
|
||||
index 6396af834c5ca2328896613c5d97e43624eb305d..6e070dada87083656a19b4abf78db63f4b2513e6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -628,6 +628,21 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add getChunkSnapshot includeLightData parameter
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
||||
index d6eab2a0fdbafc35efa7ed5b404357391565f4f3..69c7fe5bf5b914276a9f7a0e57ce668e569d91f9 100644
|
||||
index 887a17a0833064eb5701222e5fb6f5ccf9511588..5fc9e8e969debb3e15ed474b36a1c48b086d0449 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
||||
@@ -328,12 +328,21 @@ public class CraftChunk implements Chunk {
|
||||
@ -49,10 +49,10 @@ index d6eab2a0fdbafc35efa7ed5b404357391565f4f3..69c7fe5bf5b914276a9f7a0e57ce668e
|
||||
if (biome != null) {
|
||||
biome[i] = ((PalettedContainer<Holder<net.minecraft.world.level.biome.Biome>>) cs[i].getBiomes()).copy(); // Paper - Perf: use copy instead of round tripping with codecs
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java
|
||||
index 85029f1acfdbb411d9ebdf95838d6db3898f4e58..0756b5adb3039997feadeb94afb10b596abd9424 100644
|
||||
index c88e4ba701b2a2325b76478b7f47278157afd2ef..ddcbdbcbfeb6efe0a587b1181505423cc9d2c951 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java
|
||||
@@ -118,6 +118,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
|
||||
@@ -119,6 +119,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
|
||||
|
||||
@Override
|
||||
public final int getBlockSkyLight(int x, int y, int z) {
|
||||
@ -60,7 +60,7 @@ index 85029f1acfdbb411d9ebdf95838d6db3898f4e58..0756b5adb3039997feadeb94afb10b59
|
||||
this.validateChunkCoordinates(x, y, z);
|
||||
|
||||
int off = ((y & 0xF) << 7) | (z << 3) | (x >> 1);
|
||||
@@ -126,6 +127,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
|
||||
@@ -127,6 +128,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
|
||||
|
||||
@Override
|
||||
public final int getBlockEmittedLight(int x, int y, int z) {
|
@ -173,7 +173,7 @@ index 0000000000000000000000000000000000000000..c0c2805cb045cdd835b402776a6923fe
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||
index a14d3e6c43b94c543790571b13808713444a239f..284234fcdd15c4c7a4567c7c887d47bf0b7967f4 100644
|
||||
index 29825ea687827c075b87e88c45672e7b0093ed17..9af491e6e9ac96fc766462a1f672f44f8fc50ef1 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||
@@ -108,6 +108,13 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
|
||||
@ -191,10 +191,10 @@ index a14d3e6c43b94c543790571b13808713444a239f..284234fcdd15c4c7a4567c7c887d47bf
|
||||
public BlockData getBlockData(Location location) {
|
||||
return this.getBlockData(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java b/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java
|
||||
index eaa9ba70b0b80d86eb376a0641420093a7c9dfdb..25598df0bb0d4347b2c17b6ec0afbfe4ecf808b9 100644
|
||||
index a23269e3bdb83f85a1d08d5f7b54742025223ada..a57ac9dc8d08b12ec00ad41d9a1779e5a81e4e8b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java
|
||||
@@ -303,4 +303,11 @@ public class CraftLimitedRegion extends CraftRegionAccessor implements LimitedRe
|
||||
@@ -304,4 +304,11 @@ public class CraftLimitedRegion extends CraftRegionAccessor implements LimitedRe
|
||||
return centerChunkZ;
|
||||
}
|
||||
// Paper end - Add more LimitedRegion API
|
@ -5,10 +5,10 @@ Subject: [PATCH] improve BanList types
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index f6b87a5249e1a21b3221f253f891d8978249c50a..0fc6e659915a4547c2db9205fed205a1d28f21d4 100644
|
||||
index 4dc64ab006399d62251f4a238d9c2caebd595301..97850b3111dfa86d15186fa200937b28bec428de 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2256,6 +2256,21 @@ public final class CraftServer implements Server {
|
||||
@@ -2223,6 +2223,21 @@ public final class CraftServer implements Server {
|
||||
};
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add BlockBreakProgressUpdateEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 34ece37aee68e4d8eeaa919e8bd489a672756049..dcd024afef50c90974723632c879258fb1dda073 100644
|
||||
index e3df141a2a49f10e83fe132514a9b1d969cc4417..3f0e5bd457e3231d84b9d14396d8d8859989f3f4 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1320,6 +1320,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1315,6 +1315,17 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
if (entity instanceof Player) entityhuman = (Player) entity;
|
||||
// CraftBukkit end
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Deprecate ItemStack#setType
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
index a1a32a77bda0560a7b7f30a5d1c1837ee96997d3..9be7859ccb5283b2040ba68d72d6dbdafb4d6835 100644
|
||||
index ffd7ba14be38a117f5a7d7035a8d71a20fb1c4fc..7228d43d331de16cbaa0e97c7e3fa45c0bc89558 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
@@ -417,4 +417,24 @@ public final class CraftItemStack extends ItemStack {
|
||||
@@ -429,4 +429,24 @@ public final class CraftItemStack extends ItemStack {
|
||||
static boolean hasItemMeta(net.minecraft.world.item.ItemStack item) {
|
||||
return !(item == null || item.getComponentsPatch().isEmpty());
|
||||
}
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add CartographyItemEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index d377804026f3f5cf80a623228d24e09c56ef0dae..fb935b505ec048522f9ab5d689b2c64c64f401a7 100644
|
||||
index 8b5be8870a0077b82e345027b323b8b4f448f231..80755a80dfd484af361c208fd4de309ca7ef8553 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -3108,6 +3108,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
@@ -3125,6 +3125,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ index d377804026f3f5cf80a623228d24e09c56ef0dae..fb935b505ec048522f9ab5d689b2c64c
|
||||
AbstractContainerMenu oldContainer = this.player.containerMenu; // SPIGOT-1224
|
||||
this.cserver.getPluginManager().callEvent(event);
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
|
||||
index ab98637bf967ac19f0bc06e8cb7f18a8b13ec809..a90e2c56c54797b2fec40eb3865835c5f640a544 100644
|
||||
index b3a16b024e46ee8203b225ee429a5c973eab12c6..dc42d42ef91bc3e49f967c0a30a0d1b56e09cf21 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
|
||||
@@ -71,7 +71,7 @@ public class CartographyTableMenu extends AbstractContainerMenu {
|
@ -7,7 +7,7 @@ Subject: [PATCH] More Raid API
|
||||
public net.minecraft.world.entity.raid.Raid raidEvent
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raid.java b/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
||||
index fe2a01ae8207c97203d331bbab51699502b977e2..dcbef04bbaab988096bf416163264833e84d1967 100644
|
||||
index 28922f2a1cf4762d5d7d09635b9268c6091300c3..11cf2d9def087b0898c828eaa21eb5f7b8811d5f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
||||
@@ -107,6 +107,11 @@ public class Raid {
|
||||
@ -34,7 +34,7 @@ index fe2a01ae8207c97203d331bbab51699502b977e2..dcbef04bbaab988096bf416163264833
|
||||
|
||||
}
|
||||
|
||||
@@ -867,6 +877,11 @@ public class Raid {
|
||||
@@ -862,6 +872,11 @@ public class Raid {
|
||||
}
|
||||
|
||||
nbt.put("HeroesOfTheVillage", nbttaglist);
|
||||
@ -86,10 +86,10 @@ index b8ce1c1c2447f9cff1717bfcfd6eb911ade0d4b3..51f21af9d75769abdcba713b9aa33392
|
||||
+ // Paper end - more Raid API
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index f27568d26e02b5244a84d0fb6d8c1d9f14b7a519..e8404d5bad60b8fa290f334d3c64ee5503e01e5c 100644
|
||||
index 1675ad5818340f21c7e5b6982af315bcad30240b..149377347fc632358a8bb97e644b1c4ab9be413d 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -2313,6 +2313,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -2326,6 +2326,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
return (raid == null) ? null : new CraftRaid(raid);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ index d9502ba028a96f9cc846f9ed428bd8066b857ca3..87e5f614ba988547a827486740db217e
|
||||
node = loader.load();
|
||||
this.verifyGlobalConfigVersion(node);
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
index 917bd0c1dd8f356edc3741ee59d24e4d090af182..f19b4a17a7e22969f7b51d3bea4056b41ab25484 100644
|
||||
index 73e8a524925ed6f2580d3bd01616646fabafda78..450a1cc8f1624dce2daf52210d017e0732b1bdf7 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
@@ -27,6 +27,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
@ -29,10 +29,10 @@ index 917bd0c1dd8f356edc3741ee59d24e4d090af182..f19b4a17a7e22969f7b51d3bea4056b4
|
||||
return instance;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 3ee0e2adf576e312c18da90adc46160ad85179fb..42a74f5471da882d63c194b1e212f78a94b103ec 100644
|
||||
index f1b1be0caff83720d77454d333abae4613c66e72..f575c0042f67c70df0ddb1d1db68e0138cf0b534 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1135,6 +1135,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1151,6 +1151,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
long tickSection = Util.getNanos();
|
||||
long currentTime;
|
||||
// Paper end - further improve server tick loop
|
@ -5,10 +5,10 @@ Subject: [PATCH] Configurable max block/fluid ticks
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index dcd024afef50c90974723632c879258fb1dda073..81f0a0dfefd9e1698548a68679dab0974921c37a 100644
|
||||
index 3f0e5bd457e3231d84b9d14396d8d8859989f3f4..2aa4437a76d29cdd793680734a36a41c6133ab91 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -501,9 +501,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -492,9 +492,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
if (!this.isDebug() && flag) {
|
||||
j = this.getGameTime();
|
||||
gameprofilerfiller.push("blockTicks");
|
@ -7,10 +7,10 @@ Fixes bees incorrectly being aged up due to upstream's
|
||||
resetting the ticks inside hive on a failed release
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
|
||||
index 1a3d8755c8f6a7cfe06069e2082d8147aaaff097..f933fa419a4b55b0096ff42caf1b071d027b8e7e 100644
|
||||
index f8828dc8334af19d7b2118e8cf34d94be5e09ee8..83ad45aed0894e90825d22e078632352c3a06816 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
|
||||
@@ -314,7 +314,7 @@ public class BeehiveBlockEntity extends BlockEntity {
|
||||
@@ -315,7 +315,7 @@ public class BeehiveBlockEntity extends BlockEntity {
|
||||
iterator.remove();
|
||||
// CraftBukkit start
|
||||
} else {
|
||||
@ -19,7 +19,7 @@ index 1a3d8755c8f6a7cfe06069e2082d8147aaaff097..f933fa419a4b55b0096ff42caf1b071d
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
@@ -474,15 +474,18 @@ public class BeehiveBlockEntity extends BlockEntity {
|
||||
@@ -475,15 +475,18 @@ public class BeehiveBlockEntity extends BlockEntity {
|
||||
private static class BeeData {
|
||||
|
||||
private final BeehiveBlockEntity.Occupant occupant;
|
@ -5,15 +5,15 @@ Subject: [PATCH] Fire EntityDamageByEntityEvent for unowned wither skulls
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
|
||||
index 315610e95c91a0db096bf572789a40e746e72ebe..60eac9df10a9a395a1568925515d010eb51a64e5 100644
|
||||
index 8c17bed56c4659a8e226e88e113884160c3fa959..8831af1000d17d5a60302e3b0c522b2d2f082484 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
|
||||
@@ -77,7 +77,7 @@ public class WitherSkull extends AbstractHurtingProjectile {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
- flag = entity.hurt(this.damageSources().magic(), 5.0F);
|
||||
+ flag = entity.hurt(this.damageSources().magic().customCausingEntity(this), 5.0F); // Paper - Fire EntityDamageByEntityEvent for unowned wither skulls
|
||||
- flag = entity.hurtServer(worldserver, this.damageSources().magic(), 5.0F);
|
||||
+ flag = entity.hurtServer(worldserver, this.damageSources().magic().customCausingEntity(this), 5.0F); // Paper - Fire EntityDamageByEntityEvent for unowned wither skulls
|
||||
}
|
||||
|
||||
if (flag && entity instanceof LivingEntity entityliving) {
|
@ -65,10 +65,10 @@ index aee26dd78953ff43306aaa64161f5b9edcdd4b83..bb1a60180e58c1333e7bb33e8acf1b02
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSources.java b/src/main/java/net/minecraft/world/damagesource/DamageSources.java
|
||||
index caf1d79e2bbdd257a5439e2973653747e678805f..e34584e4780f343d6c946af5377088d53818e88e 100644
|
||||
index fddbdb7322a2063996a28c5c3d93c265188b1256..be87cb3cfa15a7d889118cdc4b87232e30749023 100644
|
||||
--- a/src/main/java/net/minecraft/world/damagesource/DamageSources.java
|
||||
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSources.java
|
||||
@@ -264,13 +264,7 @@ public class DamageSources {
|
||||
@@ -270,13 +270,7 @@ public class DamageSources {
|
||||
}
|
||||
|
||||
public DamageSource explosion(@Nullable Entity source, @Nullable Entity attacker) {
|
||||
@ -84,38 +84,38 @@ index caf1d79e2bbdd257a5439e2973653747e678805f..e34584e4780f343d6c946af5377088d5
|
||||
|
||||
public DamageSource sonicBoom(Entity attacker) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index e88c88b6f87dddda8e8e3ed215a8f2c166afa3ef..62ef618aff33c98f96d0271bb2ab42235c941052 100644
|
||||
index 0223f2e282a85882645f4ed52891c566a268f37b..3d4bb855dec45685d6e336d913903341f0ca4a11 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -3262,7 +3262,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -3388,7 +3388,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return;
|
||||
}
|
||||
|
||||
- if (!this.hurt(this.damageSources().lightningBolt().customEntityDamager(lightning), 5.0F)) {
|
||||
+ if (!this.hurt(this.damageSources().lightningBolt().customEventDamager(lightning), 5.0F)) { // Paper - fix DamageSource API
|
||||
- if (!this.hurtServer(world, this.damageSources().lightningBolt().customEntityDamager(lightning), 5.0F)) {
|
||||
+ if (!this.hurtServer(world, this.damageSources().lightningBolt().customEventDamager(lightning), 5.0F)) { // Paper - fix DamageSource API
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
|
||||
index 2e5ef2a680e294b49f29e8d7ba8bd0ed023c393c..4bfa947531c4a67989e18032754dabf4c69e989c 100644
|
||||
index 8e91f930e19a91db44274e4ecd98841362867609..79e1e911333d4a009c0b4e2462b41a0c146b9a06 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
|
||||
@@ -334,7 +334,7 @@ public class Turtle extends Animal {
|
||||
@@ -341,7 +341,7 @@ public class Turtle extends Animal {
|
||||
|
||||
@Override
|
||||
public void thunderHit(ServerLevel world, LightningBolt lightning) {
|
||||
- this.hurt(this.damageSources().lightningBolt().customEntityDamager(lightning), Float.MAX_VALUE); // CraftBukkit
|
||||
+ this.hurt(this.damageSources().lightningBolt().customEventDamager(lightning), Float.MAX_VALUE); // CraftBukkit // Paper - fix DamageSource API
|
||||
- this.hurtServer(world, this.damageSources().lightningBolt().customEntityDamager(lightning), Float.MAX_VALUE); // CraftBukkit
|
||||
+ this.hurtServer(world, this.damageSources().lightningBolt().customEventDamager(lightning), Float.MAX_VALUE); // CraftBukkit // Paper - fix DamageSource API
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/BlockAttachedEntity.java b/src/main/java/net/minecraft/world/entity/decoration/BlockAttachedEntity.java
|
||||
index 7bc612890f941177da11da0ce047d5a74d8ebb33..270acce7411e5ada71eaa04c05efc888b295d9e3 100644
|
||||
index 608acb4f3cb8f9a0dc10b819ed4bf577c229dd2c..7ed127a0a0c0d6e7b726216c48ef37af4db37628 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/decoration/BlockAttachedEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/BlockAttachedEntity.java
|
||||
@@ -96,7 +96,7 @@ public abstract class BlockAttachedEntity extends Entity {
|
||||
@@ -108,7 +108,7 @@ public abstract class BlockAttachedEntity extends Entity {
|
||||
} else {
|
||||
if (!this.isRemoved() && !this.level().isClientSide) {
|
||||
if (!this.isRemoved()) {
|
||||
// CraftBukkit start - fire break events
|
||||
- Entity damager = (source.isDirect()) ? source.getDirectEntity() : source.getEntity();
|
||||
+ Entity damager = (!source.isDirect() && source.getEntity() != null) ? source.getEntity() : source.getDirectEntity(); // Paper - fix DamageSource API
|
||||
@ -123,20 +123,20 @@ index 7bc612890f941177da11da0ce047d5a74d8ebb33..270acce7411e5ada71eaa04c05efc888
|
||||
if (damager != null) {
|
||||
event = new HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damager.getBukkitEntity(), source.is(DamageTypeTags.IS_EXPLOSION) ? HangingBreakEvent.RemoveCause.EXPLOSION : HangingBreakEvent.RemoveCause.ENTITY);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
||||
index 9bf11a8b44e696b6587bc775904a836d390e437b..d1041f2a4f1b3ea29ad532006e18cdc30c5019fa 100644
|
||||
index 7a18dc59aed5294cd442994aa2d34ea00b877f46..1906dfc22af208d6e801ad4a8f2f9e9702432691 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
||||
@@ -271,7 +271,7 @@ public class Creeper extends Monster implements PowerableMob {
|
||||
@@ -271,7 +271,7 @@ public class Creeper extends Monster {
|
||||
if (!event.isCancelled()) {
|
||||
// CraftBukkit end
|
||||
this.dead = true;
|
||||
- this.level().explode(this, net.minecraft.world.level.Explosion.getDefaultDamageSource(this.level(), this).customCausingEntityDamager(this.entityIgniter), null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB); // CraftBukkit
|
||||
+ this.level().explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB); // CraftBukkit // Paper - fix DamageSource API (revert to vanilla, no, just no, don't change this)
|
||||
- worldserver.explode(this, net.minecraft.world.level.Explosion.getDefaultDamageSource(this.level(), this).customCausingEntityDamager(this.entityIgniter), null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB); // CraftBukkit
|
||||
+ worldserver.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB); // CraftBukkit // Paper - fix DamageSource API (revert to vanilla, no, just no, don't change this)
|
||||
this.spawnLingeringCloud();
|
||||
this.triggerOnDeathMobEffects(Entity.RemovalReason.KILLED);
|
||||
this.triggerOnDeathMobEffects(worldserver, Entity.RemovalReason.KILLED);
|
||||
this.discard(EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/EvokerFangs.java b/src/main/java/net/minecraft/world/entity/projectile/EvokerFangs.java
|
||||
index c75433bb0fcd4264148950467bf6b700296aca7b..820965950c8b6c868ee261cf9613665e583f092e 100644
|
||||
index c08074d43d105b30ed5093614062a3bcafadfb74..ccc72a2cf02a633655b95f961be310879d8f904f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/EvokerFangs.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/EvokerFangs.java
|
||||
@@ -135,7 +135,7 @@ public class EvokerFangs extends Entity implements TraceableEntity {
|
||||
@ -149,28 +149,28 @@ index c75433bb0fcd4264148950467bf6b700296aca7b..820965950c8b6c868ee261cf9613665e
|
||||
if (entityliving1.isAlliedTo((Entity) target)) {
|
||||
return;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
|
||||
index f43dd56182ced23cf1cf65c149c532a611cc933a..1aa5e57a4e6a4be60514d8808a2e6c973d93e798 100644
|
||||
index 080d886008e1f596733ea5331b32db35adef2e9b..5f790dd24f2bdae827c6dc597064b9b265089751 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
|
||||
@@ -89,7 +89,7 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
|
||||
// entity.changeDimension(new DimensionTransition(worldserver, this.position(), entity.getDeltaMovement(), entity.getYRot(), entity.getXRot(), DimensionTransition.DO_NOTHING)); // CraftBukkit - moved up
|
||||
entity.resetFallDistance();
|
||||
entityplayer.resetCurrentImpulseContext();
|
||||
- entity.hurt(this.damageSources().fall().customEntityDamager(this), 5.0F); // CraftBukkit
|
||||
+ entity.hurt(this.damageSources().fall().customEventDamager(this), 5.0F); // CraftBukkit // Paper - fix DamageSource API
|
||||
this.playSound(worldserver, this.position());
|
||||
}
|
||||
} else {
|
||||
@@ -170,7 +170,7 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
|
||||
if (entityplayer1 != null) {
|
||||
entityplayer1.resetFallDistance();
|
||||
entityplayer1.resetCurrentImpulseContext();
|
||||
- entityplayer1.hurtServer(entityplayer.serverLevel(), this.damageSources().enderPearl().customEntityDamager(this), 5.0F); // CraftBukkit
|
||||
+ entityplayer1.hurtServer(entityplayer.serverLevel(), this.damageSources().enderPearl().customEventDamager(this), 5.0F); // CraftBukkit // Paper - fix DamageSource API
|
||||
}
|
||||
|
||||
this.playSound(worldserver, vec3d);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
|
||||
index 60eac9df10a9a395a1568925515d010eb51a64e5..55fd997a4e894eeab24de269d59e486196ffbe8d 100644
|
||||
index 8831af1000d17d5a60302e3b0c522b2d2f082484..4c47b30867e30d84908abf93dbefc252bc8c3453 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
|
||||
@@ -77,7 +77,7 @@ public class WitherSkull extends AbstractHurtingProjectile {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
- flag = entity.hurt(this.damageSources().magic().customCausingEntity(this), 5.0F); // Paper - Fire EntityDamageByEntityEvent for unowned wither skulls
|
||||
+ flag = entity.hurt(this.damageSources().magic().customEventDamager(this), 5.0F); // Paper - Fire EntityDamageByEntityEvent for unowned wither skulls // Paper - fix DamageSource API
|
||||
- flag = entity.hurtServer(worldserver, this.damageSources().magic().customCausingEntity(this), 5.0F); // Paper - Fire EntityDamageByEntityEvent for unowned wither skulls
|
||||
+ flag = entity.hurtServer(worldserver, this.damageSources().magic().customEventDamager(this), 5.0F); // Paper - Fire EntityDamageByEntityEvent for unowned wither skulls // Paper - fix DamageSource API
|
||||
}
|
||||
|
||||
if (flag && entity instanceof LivingEntity entityliving) {
|
||||
@ -220,10 +220,10 @@ index 4c6e15535fa40aad8cf1920f392589404f9ba79c..35eb95ef6fb6a0f7ea63351e90741c48
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index d407e9e8f1b530f00e632e0249514fb68d48316b..1b21fdab4269df375d2f445df3bd56f7b1fd2b15 100644
|
||||
index 89109bf9ad85b1859ce6ae0808ac0a1fb2cb6816..b0e7d1841d71e377d5ad596a22dfafb90d4f80cc 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1094,7 +1094,7 @@ public class CraftEventFactory {
|
||||
@@ -1092,7 +1092,7 @@ public class CraftEventFactory {
|
||||
|
||||
private static EntityDamageEvent handleEntityDamageEvent(Entity entity, DamageSource source, Map<DamageModifier, Double> modifiers, Map<DamageModifier, Function<? super Double, Double>> modifierFunctions, boolean cancelled) {
|
||||
CraftDamageSource bukkitDamageSource = new CraftDamageSource(source);
|
@ -5,7 +5,7 @@ Subject: [PATCH] Fix creation of invalid block entity during world generation
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
index 682c8cfbd917c086072f1756861a340800ea40da..b26a4a38144ec1b171db911bbf949b53ed35708f 100644
|
||||
index 2e72e92762877b28dd908711671e1dfb933de9b0..b7d29389a357f142237cecd75f8ca91cf1eb6b5b 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
@@ -324,7 +324,7 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
@ -36,10 +36,10 @@ index 682c8cfbd917c086072f1756861a340800ea40da..b26a4a38144ec1b171db911bbf949b53
|
||||
|
||||
nbttagcompound.putInt("x", pos.getX());
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index 59f9ff720e92c69e11afe7f6ccecd81b0e54a74d..86eb9029969f4de3ada7be9e135e9764172b85f5 100644
|
||||
index 7181acfafad91aa5f6ab7ce663d9be4a1b65b02a..5dd1df0da1f954778aebe0f40611ae0f3a7866ab 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -961,9 +961,14 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -994,9 +994,14 @@ public class LevelChunk extends ChunkAccess {
|
||||
if (this.blockEntity.getType().isValid(iblockdata)) {
|
||||
this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), iblockdata, this.blockEntity);
|
||||
this.loggedInvalidBlockState = false;
|
@ -0,0 +1,95 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sat, 29 Oct 2022 17:02:42 -0700
|
||||
Subject: [PATCH] Fix possible StackOverflowError for some dispenses
|
||||
|
||||
For saddles, carpets, horse armor, and chests for horse-likes
|
||||
a BlockDispenseEvent handler that always mutated the item without
|
||||
changing the type would result in a SO error because when it went
|
||||
to find the replacement dispense behavior (since the item "changed")
|
||||
it didn't properly handle if the replacement was the same instance
|
||||
of dispense behavior.
|
||||
|
||||
Additionally equippable mob heads, wither skulls, and carved pumpkins
|
||||
are subject to the same possible error.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
index 18304349c9ab24657c4152aff800dba969174665..63b8c806b6ee0ea3cc5e6a7f613b5e57c94bfcf1 100644
|
||||
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
@@ -232,7 +232,7 @@ public interface DispenseItemBehavior {
|
||||
// Chain to handler for new item
|
||||
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
- if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != EquipmentDispenseItemBehavior.INSTANCE) {
|
||||
+ if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != EquipmentDispenseItemBehavior.INSTANCE && idispensebehavior != this) { // Paper - fix possible StackOverflowError
|
||||
idispensebehavior.dispense(pointer, eventStack);
|
||||
return stack;
|
||||
}
|
||||
@@ -283,7 +283,7 @@ public interface DispenseItemBehavior {
|
||||
// Chain to handler for new item
|
||||
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
- if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != EquipmentDispenseItemBehavior.INSTANCE) {
|
||||
+ if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != EquipmentDispenseItemBehavior.INSTANCE && idispensebehavior != this) { // Paper - fix possible StackOverflowError
|
||||
idispensebehavior.dispense(pointer, eventStack);
|
||||
return stack;
|
||||
}
|
||||
@@ -645,7 +645,7 @@ public interface DispenseItemBehavior {
|
||||
stack.shrink(1);
|
||||
this.setSuccess(true);
|
||||
} else {
|
||||
- this.setSuccess(EquipmentDispenseItemBehavior.dispenseEquipment(pointer, stack));
|
||||
+ this.setSuccess(EquipmentDispenseItemBehavior.dispenseEquipment(pointer, stack, this)); // Paper - fix possible StackOverflowError
|
||||
}
|
||||
|
||||
return stack;
|
||||
@@ -691,7 +691,7 @@ public interface DispenseItemBehavior {
|
||||
stack.shrink(1);
|
||||
this.setSuccess(true);
|
||||
} else {
|
||||
- this.setSuccess(EquipmentDispenseItemBehavior.dispenseEquipment(pointer, stack));
|
||||
+ this.setSuccess(EquipmentDispenseItemBehavior.dispenseEquipment(pointer, stack, this)); // Paper - fix possible StackOverflowError
|
||||
}
|
||||
|
||||
return stack;
|
||||
@@ -819,7 +819,7 @@ public interface DispenseItemBehavior {
|
||||
// Chain to handler for new item
|
||||
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
- if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != EquipmentDispenseItemBehavior.INSTANCE) {
|
||||
+ if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != EquipmentDispenseItemBehavior.INSTANCE && idispensebehavior != this) { // Paper - fix possible StackOverflowError
|
||||
idispensebehavior.dispense(pointer, eventStack);
|
||||
return stack;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java
|
||||
index a03cc350973fda213251cad273a2db86f438904b..036dd3b15dfee4cd079710eba1255d2bdb4d7220 100644
|
||||
--- a/src/main/java/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java
|
||||
+++ b/src/main/java/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java
|
||||
@@ -23,10 +23,15 @@ public class EquipmentDispenseItemBehavior extends DefaultDispenseItemBehavior {
|
||||
|
||||
@Override
|
||||
protected ItemStack execute(BlockSource pointer, ItemStack stack) {
|
||||
- return EquipmentDispenseItemBehavior.dispenseEquipment(pointer, stack) ? stack : super.execute(pointer, stack);
|
||||
+ return EquipmentDispenseItemBehavior.dispenseEquipment(pointer, stack, null) ? stack : super.execute(pointer, stack); // Paper - fix possible StackOverflowError
|
||||
}
|
||||
|
||||
- public static boolean dispenseEquipment(BlockSource pointer, ItemStack stack) {
|
||||
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
|
||||
+ public static boolean dispenseEquipment(BlockSource pointer, ItemStack armor) {
|
||||
+ // Paper start
|
||||
+ return dispenseEquipment(pointer, armor, null);
|
||||
+ }
|
||||
+ public static boolean dispenseEquipment(BlockSource pointer, ItemStack stack, @javax.annotation.Nullable DispenseItemBehavior currentBehavior) {
|
||||
BlockPos blockposition = pointer.pos().relative((Direction) pointer.state().getValue(DispenserBlock.FACING));
|
||||
List<LivingEntity> list = pointer.level().getEntitiesOfClass(LivingEntity.class, new AABB(blockposition), (entityliving) -> {
|
||||
return entityliving.canEquipWithDispenser(stack);
|
||||
@@ -59,7 +64,7 @@ public class EquipmentDispenseItemBehavior extends DefaultDispenseItemBehavior {
|
||||
// Chain to handler for new item
|
||||
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
- if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != EquipmentDispenseItemBehavior.INSTANCE) {
|
||||
+ if (idispensebehavior != DispenseItemBehavior.NOOP && (currentBehavior == null || idispensebehavior != EquipmentDispenseItemBehavior.INSTANCE)) { // Paper - fix possible StackOverflowError
|
||||
idispensebehavior.dispense(pointer, eventStack);
|
||||
return true;
|
||||
}
|
@ -167,27 +167,18 @@ index df26c39a2bb20e2021b50211dce905483a77f4e6..5634122dac8afeecab0cde623e9868d8
|
||||
text -> stream.map(Component::literal)
|
||||
.reduce((accumulator, current) -> accumulator.append(text).append(current))
|
||||
diff --git a/src/main/java/net/minecraft/network/chat/contents/SelectorContents.java b/src/main/java/net/minecraft/network/chat/contents/SelectorContents.java
|
||||
index 1337853badf8e124aa8439ce33a255bc4164125b..933388a60eda2af259d4ef761e31c5abb69c31fd 100644
|
||||
index 5e87f5a2bbffe2eba3fc4fb0da51acee99e72fc2..4131067620f723be28a6cdb7508e14d7e2aed48b 100644
|
||||
--- a/src/main/java/net/minecraft/network/chat/contents/SelectorContents.java
|
||||
+++ b/src/main/java/net/minecraft/network/chat/contents/SelectorContents.java
|
||||
@@ -50,7 +50,7 @@ public class SelectorContents implements ComponentContents {
|
||||
EntitySelectorParser entitySelectorParser = new EntitySelectorParser(new StringReader(pattern), true);
|
||||
entitySelector = entitySelectorParser.parse();
|
||||
} catch (CommandSyntaxException var3) {
|
||||
- LOGGER.warn("Invalid selector component: {}: {}", pattern, var3.getMessage());
|
||||
+ return null; // Paper
|
||||
}
|
||||
|
||||
return entitySelector;
|
||||
@@ -77,7 +77,7 @@ public class SelectorContents implements ComponentContents {
|
||||
@Override
|
||||
public MutableComponent resolve(@Nullable CommandSourceStack source, @Nullable Entity sender, int depth) throws CommandSyntaxException {
|
||||
if (source != null && this.selector != null) {
|
||||
@@ -36,7 +36,7 @@ public record SelectorContents(SelectorPattern selector, Optional<Component> sep
|
||||
if (source == null) {
|
||||
return Component.empty();
|
||||
} else {
|
||||
- Optional<? extends Component> optional = ComponentUtils.updateForEntity(source, this.separator, sender, depth);
|
||||
+ Optional<? extends Component> optional = ComponentUtils.updateSeparatorForEntity(source, this.separator, sender, depth); // Paper - validate separator
|
||||
return ComponentUtils.formatList(this.selector.findEntities(source), optional, Entity::getDisplayName);
|
||||
} else {
|
||||
return Component.empty();
|
||||
return ComponentUtils.formatList(this.selector.resolved().findEntities(source), optional, Entity::getDisplayName);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java b/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java
|
||||
index 56e641bc5f6edc657647993ea2efbb7bb9c2f732..4aa6232bf0f72fcde32d257100bd15b1c5192aaa 100644
|
||||
--- a/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java
|
||||
@ -248,10 +239,10 @@ index 898b19887ed34c87003fc63cb5905df2ba6234a5..b47eeb23055b135d5567552ba983bfbc
|
||||
|
||||
private void write(FriendlyByteBuf buf) {
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index fb935b505ec048522f9ab5d689b2c64c64f401a7..e0c46e548a34c963750c9411dfd3c0946d67a7c7 100644
|
||||
index 80755a80dfd484af361c208fd4de309ca7ef8553..74b70c7a41d03bae57e1b2863b7ce947f951da46 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -766,6 +766,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
@@ -770,6 +770,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
return;
|
||||
}
|
||||
// Paper end - Don't suggest if tab-complete is disabled
|
||||
@ -265,7 +256,7 @@ index fb935b505ec048522f9ab5d689b2c64c64f401a7..e0c46e548a34c963750c9411dfd3c094
|
||||
// Paper start - AsyncTabCompleteEvent
|
||||
TAB_COMPLETE_EXECUTOR.execute(() -> this.handleCustomCommandSuggestions0(packet));
|
||||
}
|
||||
@@ -818,6 +825,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
@@ -822,6 +829,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
private void sendServerSuggestions(final ServerboundCommandSuggestionPacket packet, final StringReader stringreader) {
|
||||
// Paper end - AsyncTabCompleteEvent
|
||||
ParseResults<CommandSourceStack> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack());
|
@ -5,10 +5,10 @@ Subject: [PATCH] Item Mutation Fixes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
|
||||
index fff1c39920e7d7051dfe3dd39c77865d3bdf113e..1ef014b29645ed09ccffb898f1819428c3dc6259 100644
|
||||
index 36496144dd6fa87163b692034570eba70c83678c..b7300052f3c3d496ea41b681a2d5d5b554e67c63 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
|
||||
@@ -232,7 +232,7 @@ public class EnchantmentMenu extends AbstractContainerMenu {
|
||||
@@ -220,7 +220,7 @@ public class EnchantmentMenu extends AbstractContainerMenu {
|
||||
return false;
|
||||
} else if (this.costs[id] > 0 && !itemstack.isEmpty() && (player.experienceLevel >= j && player.experienceLevel >= this.costs[id] || player.getAbilities().instabuild)) {
|
||||
this.access.execute((world, blockposition) -> {
|
||||
@ -17,7 +17,7 @@ index fff1c39920e7d7051dfe3dd39c77865d3bdf113e..1ef014b29645ed09ccffb898f1819428
|
||||
List<EnchantmentInstance> list = this.getEnchantmentList(world.registryAccess(), itemstack, id, this.costs[id]);
|
||||
|
||||
// CraftBukkit start
|
||||
@@ -255,10 +255,16 @@ public class EnchantmentMenu extends AbstractContainerMenu {
|
||||
@@ -243,10 +243,16 @@ public class EnchantmentMenu extends AbstractContainerMenu {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
@ -5,7 +5,7 @@ Subject: [PATCH] Per world ticks per spawn settings
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 471fd54edf6aa962d997878ee638974f7f594fa8..b7bf7b3b91046c81467aeb483087e12b6d9191bf 100644
|
||||
index 83537aa240ebff8dd19b450956730dc3d4f355a0..ffe894f3034a967f7e3d820c6416acb8adbcfb84 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -186,6 +186,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@ -22,9 +22,9 @@ index 471fd54edf6aa962d997878ee638974f7f594fa8..b7bf7b3b91046c81467aeb483087e12b
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
public abstract ResourceKey<LevelStem> getTypeKey();
|
||||
|
||||
@@ -198,7 +207,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public abstract ResourceKey<LevelStem> getTypeKey();
|
||||
@@ -199,7 +208,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
// CraftBukkit Ticks things
|
||||
for (SpawnCategory spawnCategory : SpawnCategory.values()) {
|
||||
if (CraftSpawnCategory.isValidForLimits(spawnCategory)) {
|
@ -5,10 +5,10 @@ Subject: [PATCH] Properly track the changed item from dispense events
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
index 0c0b8a49b3342cd015381c6a93fab23c32cd32e6..60d3319016beb4f60cbc26dde165f64cf7577602 100644
|
||||
index 63b8c806b6ee0ea3cc5e6a7f613b5e57c94bfcf1..cd77e86ff289634d2dd1c56002e569ff70d15f25 100644
|
||||
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
@@ -134,10 +134,14 @@ public interface DispenseItemBehavior {
|
||||
@@ -129,10 +129,14 @@ public interface DispenseItemBehavior {
|
||||
idispensebehavior.dispense(pointer, eventStack);
|
||||
return stack;
|
||||
}
|
||||
@ -19,12 +19,12 @@ index 0c0b8a49b3342cd015381c6a93fab23c32cd32e6..60d3319016beb4f60cbc26dde165f64c
|
||||
}
|
||||
|
||||
try {
|
||||
- entitytypes.spawn(pointer.level(), stack, (Player) null, pointer.pos().relative(enumdirection), MobSpawnType.DISPENSER, enumdirection != Direction.UP, false);
|
||||
+ entitytypes.spawn(pointer.level(), itemstack1, (Player) null, pointer.pos().relative(enumdirection), MobSpawnType.DISPENSER, enumdirection != Direction.UP, false); // Paper - track changed item in dispense event
|
||||
- entitytypes.spawn(pointer.level(), stack, (Player) null, pointer.pos().relative(enumdirection), EntitySpawnReason.DISPENSER, enumdirection != Direction.UP, false);
|
||||
+ entitytypes.spawn(pointer.level(), itemstack1, (Player) null, pointer.pos().relative(enumdirection), EntitySpawnReason.DISPENSER, enumdirection != Direction.UP, false); // Paper - track changed item in dispense event
|
||||
} catch (Exception exception) {
|
||||
DispenseItemBehavior.LOGGER.error("Error while dispensing spawn egg from dispenser at {}", pointer.pos(), exception); // CraftBukkit - decompile error
|
||||
return ItemStack.EMPTY;
|
||||
@@ -192,9 +196,10 @@ public interface DispenseItemBehavior {
|
||||
@@ -186,9 +190,10 @@ public interface DispenseItemBehavior {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -33,19 +33,19 @@ index 0c0b8a49b3342cd015381c6a93fab23c32cd32e6..60d3319016beb4f60cbc26dde165f64c
|
||||
entityarmorstand.setYRot(enumdirection.toYRot());
|
||||
- }, worldserver, stack, (Player) null);
|
||||
+ }, worldserver, newStack, (Player) null); // Paper - track changed items in the dispense event
|
||||
ArmorStand entityarmorstand = (ArmorStand) EntityType.ARMOR_STAND.spawn(worldserver, consumer, blockposition, MobSpawnType.DISPENSER, false, false);
|
||||
ArmorStand entityarmorstand = (ArmorStand) EntityType.ARMOR_STAND.spawn(worldserver, consumer, blockposition, EntitySpawnReason.DISPENSER, false, false);
|
||||
|
||||
if (entityarmorstand != null) {
|
||||
@@ -244,7 +249,7 @@ public interface DispenseItemBehavior {
|
||||
@@ -237,7 +242,7 @@ public interface DispenseItemBehavior {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
- ((Saddleable) list.get(0)).equipSaddle(itemstack1, SoundSource.BLOCKS);
|
||||
+ ((Saddleable) list.get(0)).equipSaddle(CraftItemStack.asNMSCopy(event.getItem()), SoundSource.BLOCKS); // Paper - track changed items in dispense event
|
||||
// CraftBukkit end
|
||||
if (shrink) stack.shrink(1); // Paper - actually handle here
|
||||
this.setSuccess(true);
|
||||
@@ -414,6 +419,7 @@ public interface DispenseItemBehavior {
|
||||
return stack;
|
||||
@@ -330,6 +335,7 @@ public interface DispenseItemBehavior {
|
||||
int y = blockposition.getY();
|
||||
int z = blockposition.getZ();
|
||||
BlockState iblockdata = worldserver.getBlockState(blockposition);
|
||||
@ -53,7 +53,7 @@ index 0c0b8a49b3342cd015381c6a93fab23c32cd32e6..60d3319016beb4f60cbc26dde165f64c
|
||||
// Paper start - correctly check if the bucket place will succeed
|
||||
/* Taken from SolidBucketItem#emptyContents */
|
||||
boolean willEmptyContentsSolidBucketItem = dispensiblecontaineritem instanceof net.minecraft.world.item.SolidBucketItem && worldserver.isInWorldBounds(blockposition) && iblockdata.isAir();
|
||||
@@ -443,12 +449,15 @@ public interface DispenseItemBehavior {
|
||||
@@ -359,12 +365,15 @@ public interface DispenseItemBehavior {
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,28 +72,20 @@ index 0c0b8a49b3342cd015381c6a93fab23c32cd32e6..60d3319016beb4f60cbc26dde165f64c
|
||||
} else {
|
||||
return this.defaultDispenseItemBehavior.dispense(pointer, stack);
|
||||
diff --git a/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java b/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java
|
||||
index 985954030654d521291cccbfc3ca49b67ee4357d..e37d2d29f3ba67cfe28abe4847a3dca07121f0be 100644
|
||||
index a9d230d6ff22d5e3a11b2f31e7d751f44888a12c..df495161a5842cf38518adabd359bb35193ee2b3 100644
|
||||
--- a/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java
|
||||
+++ b/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java
|
||||
@@ -36,7 +36,7 @@ public class ProjectileDispenseBehavior extends DefaultDispenseItemBehavior {
|
||||
ServerLevel worldserver = pointer.level();
|
||||
Direction enumdirection = (Direction) pointer.state().getValue(DispenserBlock.FACING);
|
||||
Position iposition = this.dispenseConfig.positionFunction().getDispensePosition(pointer, enumdirection);
|
||||
- Projectile iprojectile = this.projectileItem.asProjectile(worldserver, iposition, stack, enumdirection);
|
||||
+ // Paper - move down
|
||||
|
||||
// CraftBukkit start
|
||||
// this.projectileItem.shoot(iprojectile, (double) enumdirection.getStepX(), (double) enumdirection.getStepY(), (double) enumdirection.getStepZ(), this.dispenseConfig.power(), this.dispenseConfig.uncertainty());
|
||||
@@ -66,6 +66,7 @@ public class ProjectileDispenseBehavior extends DefaultDispenseItemBehavior {
|
||||
@@ -64,7 +64,7 @@ public class ProjectileDispenseBehavior extends DefaultDispenseItemBehavior {
|
||||
}
|
||||
}
|
||||
|
||||
+ Projectile iprojectile = this.projectileItem.asProjectile(worldserver, iposition, CraftItemStack.unwrap(event.getItem()), enumdirection); // Paper - move from above and track changed items in the dispense event; unwrap is safe here because all uses of the stack make their own copies
|
||||
this.projectileItem.shoot(iprojectile, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.dispenseConfig.power(), this.dispenseConfig.uncertainty());
|
||||
- Projectile iprojectile = Projectile.spawnProjectileUsingShoot(this.projectileItem.asProjectile(worldserver, iposition, stack, enumdirection), worldserver, stack, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.dispenseConfig.power(), this.dispenseConfig.uncertainty());
|
||||
+ Projectile iprojectile = Projectile.spawnProjectileUsingShoot(this.projectileItem.asProjectile(worldserver, iposition, CraftItemStack.unwrap(event.getItem()), enumdirection), worldserver, stack, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.dispenseConfig.power(), this.dispenseConfig.uncertainty()); // Paper - mtrack changed items in the dispense event; unwrap is safe here because all uses of the stack make their own copies
|
||||
((Entity) iprojectile).projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource(pointer.blockEntity());
|
||||
// itemstack.shrink(1); // CraftBukkit - Handled during event processing
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java b/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java
|
||||
index 6f2adf2334e35e8a617a4ced0c1af2abf32bbd8d..cb308808906a8cdb127df8284e106e00553473ca 100644
|
||||
index f84987c36a16df19286d6f1badfb1ffb9cc7e770..8e089f7d5e7fa9ddeccd0691185555f279d55426 100644
|
||||
--- a/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java
|
||||
+++ b/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java
|
||||
@@ -57,7 +57,12 @@ public class ShulkerBoxDispenseBehavior extends OptionalDispenseItemBehavior {
|
@ -12,20 +12,8 @@ So protect them from a multitude of methods of destroying them.
|
||||
A config is provided if you rather let players use these exploits, and let
|
||||
them destroy the worlds End Portals and get on top of the nether easy.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index edcc9d53ad81e2b2444335ac79abde5a4e2d9d47..2109257fde8606abda4f41427f690da3b96c0175 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -194,6 +194,7 @@ public class Explosion {
|
||||
for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) {
|
||||
BlockPos blockposition = BlockPos.containing(d4, d5, d6);
|
||||
BlockState iblockdata = this.level.getBlockState(blockposition);
|
||||
+ if (!iblockdata.isDestroyable()) continue; // Paper - Protect Bedrock and End Portal/Frames from being destroyed
|
||||
FluidState fluid = iblockdata.getFluidState(); // Paper - Perf: Optimize call to getFluid for explosions
|
||||
|
||||
if (!this.level.isInWorldBounds(blockposition)) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 9ca71a060f916868e70222e0cdc0f96b96bac450..751da19e147049c4f196d9b200b7baf9bebaed81 100644
|
||||
index ffe894f3034a967f7e3d820c6416acb8adbcfb84..35b9a6d382e420844fc21c88b7d8044e3b8b8368 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -447,6 +447,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@ -39,8 +27,20 @@ index 9ca71a060f916868e70222e0cdc0f96b96bac450..751da19e147049c4f196d9b200b7baf9
|
||||
CraftBlockState blockstate = this.capturedBlockStates.get(pos);
|
||||
if (blockstate == null) {
|
||||
blockstate = CapturedBlockState.getTreeBlockState(this, pos, flags);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/ServerExplosion.java b/src/main/java/net/minecraft/world/level/ServerExplosion.java
|
||||
index 86656de31b1e33381eddd3ef210122118b31e620..fd1ecedfab037e377e4dded61539689bacc90f80 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/ServerExplosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/ServerExplosion.java
|
||||
@@ -150,6 +150,7 @@ public class ServerExplosion implements Explosion {
|
||||
for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) {
|
||||
BlockPos blockposition = BlockPos.containing(d4, d5, d6);
|
||||
BlockState iblockdata = this.level.getBlockState(blockposition);
|
||||
+ if (!iblockdata.isDestroyable()) continue; // Paper - Protect Bedrock and End Portal/Frames from being destroyed
|
||||
FluidState fluid = iblockdata.getFluidState(); // Paper - Perf: Optimize call to getFluid for explosions
|
||||
|
||||
if (!this.level.isInWorldBounds(blockposition)) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
index bf52c36f31992a01a7403d8c85151327c9e944c4..3b06c080afebde1d649f05eca0af938ba32931c1 100644
|
||||
index 9917df070d9815b6915e4a0b022dfe4e5b7861e7..729c3d8279b13d21c65ede89ea50869b69d5bfe6 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -89,6 +89,19 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
@ -64,10 +64,10 @@ index bf52c36f31992a01a7403d8c85151327c9e944c4..3b06c080afebde1d649f05eca0af938b
|
||||
public co.aikar.timings.Timing getTiming() {
|
||||
if (timing == null) {
|
||||
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 e6bfbe2588e0c2a1be14e38d654e889d392ad4db..e0c62227b279a5fe0f3868fbf9ce8c78c515a09c 100644
|
||||
index b27cf7d27672ba9ff8ade84b5a8454b19b935607..83bffe2ac011ed0cbd86149e3c803393d30a9e6e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
@@ -213,6 +213,12 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||
@@ -216,6 +216,12 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||
@Override
|
||||
protected boolean triggerEvent(BlockState state, Level world, BlockPos pos, int type, int data) {
|
||||
Direction enumdirection = (Direction) state.getValue(PistonBaseBlock.FACING);
|
||||
@ -80,7 +80,7 @@ index e6bfbe2588e0c2a1be14e38d654e889d392ad4db..e0c62227b279a5fe0f3868fbf9ce8c78
|
||||
BlockState iblockdata1 = (BlockState) state.setValue(PistonBaseBlock.EXTENDED, true);
|
||||
|
||||
if (!world.isClientSide) {
|
||||
@@ -253,7 +259,7 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||
@@ -256,7 +262,7 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||
}
|
||||
// Paper end - Fix sticky pistons and BlockPistonRetractEvent
|
||||
world.setBlock(pos, iblockdata2, 20);
|
||||
@ -89,7 +89,7 @@ index e6bfbe2588e0c2a1be14e38d654e889d392ad4db..e0c62227b279a5fe0f3868fbf9ce8c78
|
||||
world.blockUpdated(pos, iblockdata2.getBlock());
|
||||
iblockdata2.updateNeighbourShapes(world, pos, 2);
|
||||
if (this.isSticky) {
|
||||
@@ -289,7 +295,14 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||
@@ -292,7 +298,14 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -106,19 +106,19 @@ index e6bfbe2588e0c2a1be14e38d654e889d392ad4db..e0c62227b279a5fe0f3868fbf9ce8c78
|
||||
|
||||
world.playSound((Player) null, pos, SoundEvents.PISTON_CONTRACT, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.15F + 0.6F);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
index 240c250a93289776686d09d7eae17c07d7278da5..f2036917c5ba9f536087d7ee559704055469730e 100644
|
||||
index 1b988b92e80faa1ac224caf9f9e955ac43a4c45a..95d30c2db7e291d65c24feb114b0f3598d280912 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
@@ -174,7 +174,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
@@ -178,7 +178,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
}
|
||||
|
||||
protected void onExplosionHit(BlockState state, Level world, BlockPos pos, Explosion explosion, BiConsumer<ItemStack, BlockPos> stackMerger) {
|
||||
protected void onExplosionHit(BlockState state, ServerLevel world, BlockPos pos, Explosion explosion, BiConsumer<ItemStack, BlockPos> stackMerger) {
|
||||
- if (!state.isAir() && explosion.getBlockInteraction() != Explosion.BlockInteraction.TRIGGER_BLOCK) {
|
||||
+ if (!state.isAir() && explosion.getBlockInteraction() != Explosion.BlockInteraction.TRIGGER_BLOCK && state.isDestroyable()) { // Paper - Protect Bedrock and End Portal/Frames from being destroyed
|
||||
Block block = state.getBlock();
|
||||
boolean flag = explosion.getIndirectSourceEntity() instanceof Player;
|
||||
|
||||
@@ -254,7 +254,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
@@ -257,7 +257,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
}
|
||||
|
||||
protected boolean canBeReplaced(BlockState state, BlockPlaceContext context) {
|
||||
@ -127,7 +127,7 @@ index 240c250a93289776686d09d7eae17c07d7278da5..f2036917c5ba9f536087d7ee55970405
|
||||
}
|
||||
|
||||
protected boolean canBeReplaced(BlockState state, Fluid fluid) {
|
||||
@@ -883,6 +883,12 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
@@ -945,6 +945,12 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
return this.legacySolid;
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ index 240c250a93289776686d09d7eae17c07d7278da5..f2036917c5ba9f536087d7ee55970405
|
||||
public boolean isValidSpawn(BlockGetter world, BlockPos pos, EntityType<?> type) {
|
||||
return this.getBlock().properties.isValidSpawn.test(this.asState(), world, pos, type);
|
||||
}
|
||||
@@ -986,7 +992,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
@@ -1048,7 +1054,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
}
|
||||
|
||||
public PushReaction getPistonPushReaction() {
|
||||
@ -148,9 +148,9 @@ index 240c250a93289776686d09d7eae17c07d7278da5..f2036917c5ba9f536087d7ee55970405
|
||||
+ return !this.isDestroyable() ? PushReaction.BLOCK : this.pushReaction; // Paper - Protect Bedrock and End Portal/Frames from being destroyed
|
||||
}
|
||||
|
||||
public boolean isSolidRender(BlockGetter world, BlockPos pos) {
|
||||
public boolean isSolidRender() {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
|
||||
index 5c4b2a33d4007c36aef68604bca40a4eba510b4e..fd04a50183ccb1f21fc6efa70256e1bb4db2d6d4 100644
|
||||
index eb409fb5e673d2a343813946cc59cb5da2328eec..83d294f6f48b867d09ea0d339c779011bf4138a5 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
|
||||
@@ -207,6 +207,13 @@ public class PortalForcer {
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add config for mobs immune to default effects
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
index 62271e74399a827a488159da234465ef18e15e6e..d3b4d492aee380dc17f4232d90eaae4f07bb9f86 100644
|
||||
index e1be143959fbaa1d54af2a1a2c27187d70e6a9e9..244e38db508efa3eebebb6392c4ebb0805367baf 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
@@ -604,7 +604,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
||||
@@ -602,7 +602,7 @@ public class WitherBoss extends Monster implements RangedAttackMob {
|
||||
|
||||
@Override
|
||||
public boolean canBeAffected(MobEffectInstance effect) {
|
||||
@ -18,7 +18,7 @@ index 62271e74399a827a488159da234465ef18e15e6e..d3b4d492aee380dc17f4232d90eaae4f
|
||||
|
||||
private class WitherDoNothingGoal extends Goal {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Spider.java b/src/main/java/net/minecraft/world/entity/monster/Spider.java
|
||||
index 9045f18f49a5c6685597d0a77126d7cb35bc5e88..a30fb47559eb74b7fe634678e63a85e7e2cad9a4 100644
|
||||
index 72e42605c278028480c368762da18f61806d766a..91e521414c3ea5722aac7506b7589fbb399e9636 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Spider.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java
|
||||
@@ -126,7 +126,7 @@ public class Spider extends Monster {
|
||||
@ -31,7 +31,7 @@ index 9045f18f49a5c6685597d0a77126d7cb35bc5e88..a30fb47559eb74b7fe634678e63a85e7
|
||||
|
||||
public boolean isClimbing() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java
|
||||
index 56f23d7c7b5838ff8761de8691e685dd59d2eaa2..bb2e7cee612dc1fafa042674a0b0d07d7165b54c 100644
|
||||
index c295b604f438c62d589ab05ea44c85dbefcb258b..37d3acda84a984bf4f1c44b3d27e2102839d3e8e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java
|
||||
@@ -114,6 +114,6 @@ public class WitherSkeleton extends AbstractSkeleton {
|
@ -5,10 +5,10 @@ Subject: [PATCH] Deep clone nbt tags in PDC
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
index f15456b02cabbbe33d701450ef53a0561d91cb8c..7ad1076de76c81c25b656e52237c2f60a2eca085 100644
|
||||
index 3bcc807005a677884255f1ee36cbf1653797ba55..8d13505c36d732f17293c6a6d65cac20919b8b7a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -322,7 +322,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
@@ -372,7 +372,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
this.maxDamage = meta.maxDamage;
|
||||
this.unhandledTags.copy(meta.unhandledTags.build());
|
||||
this.removedTags.addAll(meta.removedTags);
|
||||
@ -17,7 +17,7 @@ index f15456b02cabbbe33d701450ef53a0561d91cb8c..7ad1076de76c81c25b656e52237c2f60
|
||||
|
||||
this.customTag = meta.customTag;
|
||||
|
||||
@@ -1699,7 +1699,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
@@ -1966,7 +1966,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
clone.customTag = this.customTag.copy();
|
||||
}
|
||||
clone.removedTags = Sets.newHashSet(this.removedTags);
|
||||
@ -25,7 +25,7 @@ index f15456b02cabbbe33d701450ef53a0561d91cb8c..7ad1076de76c81c25b656e52237c2f60
|
||||
+ clone.persistentDataContainer = new CraftPersistentDataContainer(this.persistentDataContainer.getTagsCloned(), CraftMetaItem.DATA_TYPE_REGISTRY); // Paper - deep clone NBT tags
|
||||
clone.hideFlag = this.hideFlag;
|
||||
clone.hideTooltip = this.hideTooltip;
|
||||
clone.unbreakable = this.unbreakable;
|
||||
clone.tooltipStyle = this.tooltipStyle;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
|
||||
index 5a4e7e7150b7c137b077e0b393f17ed35b5aec34..f55fdd57ced259ad5a95878840e98ffaa3db2e05 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
|
@ -1,117 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sat, 29 Oct 2022 17:02:42 -0700
|
||||
Subject: [PATCH] Fix possible StackOverflowError for some dispenses
|
||||
|
||||
For saddles, carpets, horse armor, and chests for horse-likes
|
||||
a BlockDispenseEvent handler that always mutated the item without
|
||||
changing the type would result in a SO error because when it went
|
||||
to find the replacement dispense behavior (since the item "changed")
|
||||
it didn't properly handle if the replacement was the same instance
|
||||
of dispense behavior.
|
||||
|
||||
Additionally equippable mob heads, wither skulls, and carved pumpkins
|
||||
are subject to the same possible error.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
index 7826e2a52da47914aca39fef958b8f398a2ff937..0c0b8a49b3342cd015381c6a93fab23c32cd32e6 100644
|
||||
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
@@ -239,7 +239,7 @@ public interface DispenseItemBehavior {
|
||||
// Chain to handler for new item
|
||||
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
- if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != ArmorItem.DISPENSE_ITEM_BEHAVIOR) {
|
||||
+ if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != this) { // Paper - fix possible StackOverflowError
|
||||
idispensebehavior.dispense(pointer, eventStack);
|
||||
return stack;
|
||||
}
|
||||
@@ -295,7 +295,7 @@ public interface DispenseItemBehavior {
|
||||
// Chain to handler for new item
|
||||
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
- if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != ArmorItem.DISPENSE_ITEM_BEHAVIOR) {
|
||||
+ if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != this) { // Paper - fix possible StackOverflowError
|
||||
idispensebehavior.dispense(pointer, eventStack);
|
||||
return stack;
|
||||
}
|
||||
@@ -369,7 +369,7 @@ public interface DispenseItemBehavior {
|
||||
// Chain to handler for new item
|
||||
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
- if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != ArmorItem.DISPENSE_ITEM_BEHAVIOR) {
|
||||
+ if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != this) { // Paper - fix possible StackOverflowError
|
||||
idispensebehavior.dispense(pointer, eventStack);
|
||||
return stack;
|
||||
}
|
||||
@@ -690,7 +690,7 @@ public interface DispenseItemBehavior {
|
||||
OptionalDispenseItemBehavior dispensebehaviormaybe1 = new OptionalDispenseItemBehavior() {
|
||||
@Override
|
||||
protected ItemStack execute(BlockSource pointer, ItemStack stack) {
|
||||
- this.setSuccess(ArmorItem.dispenseArmor(pointer, stack));
|
||||
+ this.setSuccess(ArmorItem.dispenseArmor(pointer, stack, this)); // Paper - fix possible StackOverflowError
|
||||
return stack;
|
||||
}
|
||||
};
|
||||
@@ -744,7 +744,7 @@ public interface DispenseItemBehavior {
|
||||
stack.shrink(1);
|
||||
this.setSuccess(true);
|
||||
} else {
|
||||
- this.setSuccess(ArmorItem.dispenseArmor(pointer, stack));
|
||||
+ this.setSuccess(ArmorItem.dispenseArmor(pointer, stack, this)); // Paper - fix possible StackOverflowError
|
||||
}
|
||||
|
||||
return stack;
|
||||
@@ -790,7 +790,7 @@ public interface DispenseItemBehavior {
|
||||
stack.shrink(1);
|
||||
this.setSuccess(true);
|
||||
} else {
|
||||
- this.setSuccess(ArmorItem.dispenseArmor(pointer, stack));
|
||||
+ this.setSuccess(ArmorItem.dispenseArmor(pointer, stack, this)); // Paper - fix possible StackOverflowError
|
||||
}
|
||||
|
||||
return stack;
|
||||
@@ -918,7 +918,7 @@ public interface DispenseItemBehavior {
|
||||
// Chain to handler for new item
|
||||
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
- if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != ArmorItem.DISPENSE_ITEM_BEHAVIOR) {
|
||||
+ if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != this) { // Paper - fix possible StackOverflowError
|
||||
idispensebehavior.dispense(pointer, eventStack);
|
||||
return stack;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ArmorItem.java b/src/main/java/net/minecraft/world/item/ArmorItem.java
|
||||
index fb518f87cc4ccd810fb32cade2fdd7e09ab0abfc..647a4601deace52f8d855f512a73671f82b4762a 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ArmorItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ArmorItem.java
|
||||
@@ -39,14 +39,20 @@ public class ArmorItem extends Item implements Equipable {
|
||||
public static final DispenseItemBehavior DISPENSE_ITEM_BEHAVIOR = new DefaultDispenseItemBehavior() {
|
||||
@Override
|
||||
protected ItemStack execute(BlockSource pointer, ItemStack stack) {
|
||||
- return ArmorItem.dispenseArmor(pointer, stack) ? stack : super.execute(pointer, stack);
|
||||
+ return ArmorItem.dispenseArmor(pointer, stack, this) ? stack : super.execute(pointer, stack); // Paper - fix possible StackOverflowError
|
||||
}
|
||||
};
|
||||
protected final ArmorItem.Type type;
|
||||
protected final Holder<ArmorMaterial> material;
|
||||
private final Supplier<ItemAttributeModifiers> defaultModifiers;
|
||||
|
||||
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
|
||||
public static boolean dispenseArmor(BlockSource pointer, ItemStack armor) {
|
||||
+ // Paper start
|
||||
+ return dispenseArmor(pointer, armor, null);
|
||||
+ }
|
||||
+ public static boolean dispenseArmor(BlockSource pointer, ItemStack armor, @javax.annotation.Nullable DispenseItemBehavior currentBehavior) {
|
||||
+ // Paper end
|
||||
BlockPos blockposition = pointer.pos().relative((Direction) pointer.state().getValue(DispenserBlock.FACING));
|
||||
List<LivingEntity> list = pointer.level().getEntitiesOfClass(LivingEntity.class, new AABB(blockposition), EntitySelector.NO_SPECTATORS.and(new EntitySelector.MobCanWearArmorEntitySelector(armor)));
|
||||
|
||||
@@ -77,7 +83,7 @@ public class ArmorItem extends Item implements Equipable {
|
||||
// Chain to handler for new item
|
||||
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
- if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != ArmorItem.DISPENSE_ITEM_BEHAVIOR) {
|
||||
+ if (idispensebehavior != DispenseItemBehavior.NOOP && (currentBehavior == null || idispensebehavior != currentBehavior)) { // Paper - fix possible StackOverflowError
|
||||
idispensebehavior.dispense(pointer, eventStack);
|
||||
return true;
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: DungeonDev <dungeondevtn@gmail.com>
|
||||
Date: Sun, 2 Jul 2023 02:34:54 +0100
|
||||
Subject: [PATCH] Fix tripwire disarming not working as intended
|
||||
|
||||
Fixes MC-129055
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
index 8614fad5b3df7a6030384b108b1689bf6b9f1209..76aca266d3f3222502ff4c196228f08fcd88c5f8 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
@@ -202,9 +202,8 @@ public class TripWireHookBlock extends Block {
|
||||
BlockState iblockdata4 = aiblockdata[l];
|
||||
|
||||
if (iblockdata4 != null) {
|
||||
+ if (world.getBlockState(blockposition2).is(Blocks.TRIPWIRE) || io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowTripwireDisarmingExploits) { // Paper - Fix tripwire disarming not working as intended
|
||||
world.setBlock(blockposition2, (BlockState) iblockdata4.trySetValue(TripWireHookBlock.ATTACHED, flag4), 3);
|
||||
- if (!world.getBlockState(blockposition2).isAir()) {
|
||||
- ;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user