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,6 +1,6 @@
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalBreakDoor.java
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalBreakDoor.java
@@ -71,6 +71,12 @@
@@ -72,6 +72,12 @@
}
if (this.breakTime == this.getDoorBreakTime() && this.isValidDifficulty(this.mob.level().getDifficulty())) {

View File

@@ -15,8 +15,8 @@
BlockPosition blockposition = this.mob.blockPosition();
if (PathfinderGoalEatTile.IS_TALL_GRASS.test(this.level.getBlockState(blockposition))) {
- if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
+ if (CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, Blocks.AIR.defaultBlockState(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit
- if (getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
+ if (CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, Blocks.AIR.defaultBlockState(), !getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit
this.level.destroyBlock(blockposition, false);
}
@@ -24,8 +24,8 @@
BlockPosition blockposition1 = blockposition.below();
if (this.level.getBlockState(blockposition1).is(Blocks.GRASS_BLOCK)) {
- if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
+ if (CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition1, Blocks.AIR.defaultBlockState(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit
- if (getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
+ if (CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition1, Blocks.AIR.defaultBlockState(), !getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit
this.level.levelEvent(2001, blockposition1, Block.getId(Blocks.GRASS_BLOCK.defaultBlockState()));
this.level.setBlock(blockposition1, Blocks.DIRT.defaultBlockState(), 2);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalRemoveBlock.java
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalRemoveBlock.java
@@ -21,6 +21,11 @@
@@ -22,6 +22,11 @@
import net.minecraft.world.level.chunk.status.ChunkStatus;
import net.minecraft.world.phys.Vec3D;
@@ -12,7 +12,7 @@
public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget {
private final Block blockToRemove;
@@ -96,6 +101,11 @@
@@ -97,6 +102,11 @@
}
if (this.ticksSinceReachedGoal > 60) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalTempt.java
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalTempt.java
@@ -10,6 +10,13 @@
@@ -11,6 +11,13 @@
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.item.ItemStack;
@@ -13,8 +13,8 @@
+
public class PathfinderGoalTempt extends PathfinderGoal {
private static final PathfinderTargetCondition TEMP_TARGETING = PathfinderTargetCondition.forNonCombat().range(10.0D).ignoreLineOfSight();
@@ -22,7 +29,7 @@
private static final PathfinderTargetCondition TEMPT_TARGETING = PathfinderTargetCondition.forNonCombat().ignoreLineOfSight();
@@ -23,7 +30,7 @@
private double pRotX;
private double pRotY;
@Nullable
@@ -23,10 +23,10 @@
private int calmDown;
private boolean isRunning;
private final Predicate<ItemStack> items;
@@ -44,6 +51,15 @@
@@ -47,6 +54,15 @@
return false;
} else {
this.player = this.mob.level().getNearestPlayer(this.targetingConditions, this.mob);
this.player = getServerLevel((Entity) this.mob).getNearestPlayer(this.targetingConditions.range(this.mob.getAttributeValue(GenericAttributes.TEMPT_RANGE)), this.mob);
+ // CraftBukkit start
+ if (this.player != null) {
+ EntityTargetLivingEntityEvent event = CraftEventFactory.callEntityTargetLivingEvent(this.mob, this.player, EntityTargetEvent.TargetReason.TEMPT);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ai/goal/target/PathfinderGoalDefendVillage.java
+++ b/net/minecraft/world/entity/ai/goal/target/PathfinderGoalDefendVillage.java
@@ -58,7 +58,7 @@
@@ -61,7 +61,7 @@
@Override
public void start() {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ai/goal/target/PathfinderGoalNearestAttackableTarget.java
+++ b/net/minecraft/world/entity/ai/goal/target/PathfinderGoalNearestAttackableTarget.java
@@ -67,7 +67,7 @@
@@ -70,7 +70,7 @@
@Override
public void start() {