Update to Minecraft 1.18-pre5

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2021-11-22 09:00:00 +11:00
parent a852b81a69
commit 43702a9e10
700 changed files with 10286 additions and 10098 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityWolf.java
+++ b/net/minecraft/world/entity/animal/EntityWolf.java
@@ -63,6 +63,11 @@
@@ -68,6 +68,11 @@
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.phys.Vec3D;
@@ -11,27 +11,18 @@
+
public class EntityWolf extends EntityTameableAnimal implements IEntityAngerable {
private static final DataWatcherObject<Boolean> DATA_INTERESTED_ID = DataWatcher.a(EntityWolf.class, DataWatcherRegistry.BOOLEAN);
@@ -104,7 +109,7 @@
this.goalSelector.a(10, new PathfinderGoalRandomLookaround(this));
this.targetSelector.a(1, new PathfinderGoalOwnerHurtByTarget(this));
this.targetSelector.a(2, new PathfinderGoalOwnerHurtTarget(this));
- this.targetSelector.a(3, (new PathfinderGoalHurtByTarget(this, new Class[0])).a());
+ this.targetSelector.a(3, (new PathfinderGoalHurtByTarget(this, new Class[0])).a(new Class[0])); // CraftBukkit - decompile error
this.targetSelector.a(4, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, this::a_));
this.targetSelector.a(5, new PathfinderGoalRandomTargetNonTamed<>(this, EntityAnimal.class, false, EntityWolf.PREY_SELECTOR));
this.targetSelector.a(6, new PathfinderGoalRandomTargetNonTamed<>(this, EntityTurtle.class, false, EntityTurtle.BABY_ON_LAND_SELECTOR));
@@ -116,6 +121,24 @@
return EntityInsentient.w().a(GenericAttributes.MOVEMENT_SPEED, 0.30000001192092896D).a(GenericAttributes.MAX_HEALTH, 8.0D).a(GenericAttributes.ATTACK_DAMAGE, 2.0D);
private static final DataWatcherObject<Boolean> DATA_INTERESTED_ID = DataWatcher.defineId(EntityWolf.class, DataWatcherRegistry.BOOLEAN);
@@ -122,6 +127,24 @@
return EntityInsentient.createMobAttributes().add(GenericAttributes.MOVEMENT_SPEED, 0.30000001192092896D).add(GenericAttributes.MAX_HEALTH, 8.0D).add(GenericAttributes.ATTACK_DAMAGE, 2.0D);
}
+ // CraftBukkit - add overriden version
+ @Override
+ public boolean setGoalTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fire) {
+ if (!super.setGoalTarget(entityliving, reason, fire)) {
+ public boolean setTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fire) {
+ if (!super.setTarget(entityliving, reason, fire)) {
+ return false;
+ }
+ entityliving = getGoalTarget();
+ entityliving = getTarget();
+ /* // PAIL
+ if (entityliving == null) {
+ this.setAngry(false);
@@ -44,51 +35,51 @@
+ // CraftBukkit end
+
@Override
protected void initDatawatcher() {
super.initDatawatcher();
@@ -287,7 +310,7 @@
protected void defineSynchedData() {
super.defineSynchedData();
@@ -293,7 +316,7 @@
} else {
Entity entity = damagesource.getEntity();
- this.setWillSit(false);
- this.setOrderedToSit(false);
+ // this.setWillSit(false); // CraftBukkit - moved into EntityLiving.damageEntity(DamageSource, float)
if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
f = (f + 1.0F) / 2.0F;
}
@@ -312,7 +335,7 @@
super.setTamed(flag);
@@ -318,7 +341,7 @@
super.setTame(flag);
if (flag) {
this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(20.0D);
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(20.0D);
- this.setHealth(20.0F);
+ this.setHealth(this.getMaxHealth()); // CraftBukkit - 20.0 -> getMaxHealth()
} else {
this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(8.0D);
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(8.0D);
}
@@ -336,7 +359,7 @@
itemstack.subtract(1);
@@ -342,7 +365,7 @@
itemstack.shrink(1);
}
- this.heal((float) item.getFoodInfo().getNutrition());
+ this.heal((float) item.getFoodInfo().getNutrition(), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // CraftBukkit
this.a(GameEvent.MOB_INTERACT, this.cT());
- this.heal((float) item.getFoodProperties().getNutrition());
+ this.heal((float) item.getFoodProperties().getNutrition(), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // CraftBukkit
this.gameEvent(GameEvent.MOB_INTERACT, this.eyeBlockPosition());
return EnumInteractionResult.SUCCESS;
}
@@ -348,7 +371,7 @@
this.setWillSit(!this.isWillSit());
@@ -354,7 +377,7 @@
this.setOrderedToSit(!this.isOrderedToSit());
this.jumping = false;
this.navigation.o();
- this.setGoalTarget((EntityLiving) null);
+ this.setGoalTarget((EntityLiving) null, TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason
this.navigation.stop();
- this.setTarget((EntityLiving) null);
+ this.setTarget((EntityLiving) null, TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason
return EnumInteractionResult.SUCCESS;
}
@@ -370,7 +393,8 @@
itemstack.subtract(1);
@@ -376,7 +399,8 @@
itemstack.shrink(1);
}
- if (this.random.nextInt(3) == 0) {
+ // CraftBukkit - added event call and isCancelled check.
+ if (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
this.tame(entityhuman);
this.navigation.o();
this.setGoalTarget((EntityLiving) null);
this.navigation.stop();
this.setTarget((EntityLiving) null);