Update to Minecraft 1.21.2

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2024-10-23 02:15:00 +11:00
parent 2c4beb962b
commit d3a23f42c3
522 changed files with 8501 additions and 6477 deletions

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/animal/EntitySnowman.java
+++ b/net/minecraft/world/entity/animal/EntitySnowman.java
@@ -40,6 +40,10 @@
import net.minecraft.world.level.gameevent.GameEvent;
@@ -43,6 +43,10 @@
import net.minecraft.world.level.storage.loot.LootTables;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
@@ -11,16 +11,16 @@
public class EntitySnowman extends EntityGolem implements IShearable, IRangedEntity {
private static final DataWatcherObject<Byte> DATA_PUMPKIN_ID = DataWatcher.defineId(EntitySnowman.class, DataWatcherRegistry.BYTE);
@@ -95,7 +99,7 @@
super.aiStep();
if (!this.level().isClientSide) {
@@ -100,7 +104,7 @@
if (world instanceof WorldServer worldserver) {
if (this.level().getBiome(this.blockPosition()).is(BiomeTags.SNOW_GOLEM_MELTS)) {
- this.hurt(this.damageSources().onFire(), 1.0F);
+ this.hurt(this.damageSources().melting(), 1.0F); // CraftBukkit - DamageSources.ON_FIRE -> CraftEventFactory.MELTING
- this.hurtServer(worldserver, this.damageSources().onFire(), 1.0F);
+ this.hurtServer(worldserver, this.damageSources().melting(), 1.0F); // CraftBukkit - DamageSources.ON_FIRE -> CraftEventFactory.MELTING
}
if (!this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
@@ -111,7 +115,11 @@
if (!worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
@@ -116,7 +120,11 @@
BlockPosition blockposition = new BlockPosition(j, k, l);
if (this.level().getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level(), blockposition)) {
@@ -33,25 +33,25 @@
this.level().gameEvent((Holder) GameEvent.BLOCK_PLACE, blockposition, GameEvent.a.of(this, iblockdata));
}
}
@@ -138,6 +146,11 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
@@ -153,6 +161,11 @@
if (world instanceof WorldServer) {
WorldServer worldserver = (WorldServer) world;
if (itemstack.is(Items.SHEARS) && this.readyForShearing()) {
+ // CraftBukkit start
+ if (!CraftEventFactory.handlePlayerShearEntityEvent(entityhuman, this, itemstack, enumhand)) {
+ return EnumInteractionResult.PASS;
+ }
+ // CraftBukkit end
this.shear(SoundCategory.PLAYERS);
this.gameEvent(GameEvent.SHEAR, entityhuman);
if (!this.level().isClientSide) {
@@ -155,7 +168,9 @@
this.level().playSound((EntityHuman) null, (Entity) this, SoundEffects.SNOW_GOLEM_SHEAR, soundcategory, 1.0F, 1.0F);
if (!this.level().isClientSide()) {
this.setPumpkin(false);
+ // CraftBukkit start
+ if (!CraftEventFactory.handlePlayerShearEntityEvent(entityhuman, this, itemstack, enumhand)) {
+ return EnumInteractionResult.PASS;
+ }
+ // CraftBukkit end
this.shear(worldserver, SoundCategory.PLAYERS, itemstack);
this.gameEvent(GameEvent.SHEAR, entityhuman);
itemstack.hurtAndBreak(1, entityhuman, getSlotForHand(enumhand));
@@ -169,7 +182,9 @@
worldserver.playSound((EntityHuman) null, (Entity) this, SoundEffects.SNOW_GOLEM_SHEAR, soundcategory, 1.0F, 1.0F);
this.setPumpkin(false);
this.dropFromShearingLootTable(worldserver, LootTables.SHEAR_SNOW_GOLEM, itemstack, (worldserver1, itemstack1) -> {
+ this.forceDrops = true; // CraftBukkit
this.spawnAtLocation(new ItemStack(Items.CARVED_PUMPKIN), this.getEyeHeight());
this.spawnAtLocation(worldserver1, itemstack1, this.getEyeHeight());
+ this.forceDrops = false; // CraftBukkit
}
});
}