Update to Minecraft 1.19.3

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2022-12-08 03:00:00 +11:00
parent a13136ada2
commit 8b26bb8f3e
305 changed files with 3331 additions and 2864 deletions

View File

@@ -31,7 +31,7 @@
+ if (playerBucketFishEvent.isCancelled()) {
+ ((EntityPlayer) entityhuman).containerMenu.sendAllDataToRemote(); // We need to update inventory to resync client's bucket
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutSpawnEntity(t0)); // We need to play out these packets as the client assumes the fish is gone
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutEntityMetadata(t0.getId(), t0.getEntityData(), true)); // Need to send data such as the display name to client
+ t0.getEntityData().refresh((EntityPlayer) entityhuman); // Need to send data such as the display name to client
+ return Optional.of(EnumInteractionResult.FAIL);
+ }
+ t0.playSound(((Bucketable) t0).getPickupSound(), 1.0F, 1.0F);

View File

@@ -9,7 +9,7 @@
}
}
@@ -643,11 +643,15 @@
@@ -646,11 +646,15 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else {
@@ -27,7 +27,7 @@
}
}
@@ -1223,7 +1227,7 @@
@@ -1226,7 +1230,7 @@
}
}
@@ -36,7 +36,7 @@
EntityBee.this.level.levelEvent(2005, blockposition, 0);
EntityBee.this.level.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.setValue(blockstateinteger, (Integer) iblockdata.getValue(blockstateinteger) + 1));
EntityBee.this.incrementNumCropsGrownSincePollination();
@@ -1296,7 +1300,7 @@
@@ -1299,7 +1303,7 @@
@Override
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
if (entityinsentient instanceof EntityBee && this.mob.hasLineOfSight(entityliving)) {
@@ -45,7 +45,7 @@
}
}
@@ -1305,7 +1309,7 @@
@@ -1308,7 +1312,7 @@
private static class c extends PathfinderGoalNearestAttackableTarget<EntityHuman> {
c(EntityBee entitybee) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityCat.java
+++ b/net/minecraft/world/entity/animal/EntityCat.java
@@ -410,7 +410,7 @@
@@ -415,7 +415,7 @@
}
} else if (this.isFood(itemstack)) {
this.usePlayerItem(entityhuman, enumhand, itemstack);
@@ -9,7 +9,7 @@
this.tame(entityhuman);
this.setOrderedToSit(true);
this.level.broadcastEntityEvent(this, (byte) 7);
@@ -467,7 +467,7 @@
@@ -472,7 +472,7 @@
private static class PathfinderGoalTemptChance extends PathfinderGoalTempt {
@Nullable
@@ -18,7 +18,7 @@
private final EntityCat cat;
public PathfinderGoalTemptChance(EntityCat entitycat, double d0, RecipeItemStack recipeitemstack, boolean flag) {
@@ -608,7 +608,15 @@
@@ -613,7 +613,15 @@
while (iterator.hasNext()) {
ItemStack itemstack = (ItemStack) iterator.next();
@@ -35,7 +35,7 @@
}
}
@@ -640,10 +648,10 @@
@@ -645,10 +653,10 @@
private final EntityCat cat;
public a(EntityCat entitycat, Class<T> oclass, float f, double d0, double d1) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityChicken.java
+++ b/net/minecraft/world/entity/animal/EntityChicken.java
@@ -95,7 +95,9 @@
@@ -96,7 +96,9 @@
this.flap += this.flapping * 2.0F;
if (!this.level.isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggTime <= 0) {
this.playSound(SoundEffects.CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityCow.java
+++ b/net/minecraft/world/entity/animal/EntityCow.java
@@ -30,6 +30,11 @@
@@ -31,6 +31,11 @@
import net.minecraft.world.level.World;
import net.minecraft.world.level.block.state.IBlockData;
@@ -12,7 +12,7 @@
public class EntityCow extends EntityAnimal {
public EntityCow(EntityTypes<? extends EntityCow> entitytypes, World world) {
@@ -82,8 +87,16 @@
@@ -83,8 +88,16 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.is(Items.BUCKET) && !this.isBaby()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityFox.java
+++ b/net/minecraft/world/entity/animal/EntityFox.java
@@ -511,7 +511,8 @@
@@ -516,7 +516,8 @@
protected void pickUpItem(EntityItem entityitem) {
ItemStack itemstack = entityitem.getItem();
@@ -10,7 +10,7 @@
int i = itemstack.getCount();
if (i > 1) {
@@ -866,6 +867,16 @@
@@ -871,6 +872,16 @@
if (entityplayer1 != null && entityplayer != entityplayer1) {
entityfox.addTrustedUUID(entityplayer1.getUUID());
}
@@ -27,7 +27,7 @@
if (entityplayer2 != null) {
entityplayer2.awardStat(StatisticList.ANIMALS_BRED);
@@ -876,12 +887,14 @@
@@ -881,12 +892,14 @@
this.partner.setAge(6000);
this.animal.resetLove();
this.partner.resetLove();
@@ -46,7 +46,7 @@
}
}
@@ -1272,13 +1285,18 @@
@@ -1277,13 +1290,18 @@
}
private void pickGlowBerry(IBlockData iblockdata) {
@@ -66,7 +66,7 @@
int j = 1 + EntityFox.this.level.random.nextInt(2) + (i == 3 ? 1 : 0);
ItemStack itemstack = EntityFox.this.getItemBySlot(EnumItemSlot.MAINHAND);
@@ -1435,7 +1453,7 @@
@@ -1440,7 +1458,7 @@
private EntityLiving trustedLastHurt;
private int timestamp;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityMushroomCow.java
+++ b/net/minecraft/world/entity/animal/EntityMushroomCow.java
@@ -43,6 +43,13 @@
@@ -42,6 +42,13 @@
import net.minecraft.world.level.gameevent.GameEvent;
import org.apache.commons.lang3.tuple.Pair;
@@ -11,10 +11,10 @@
+import org.bukkit.event.entity.EntityTransformEvent;
+// CraftBukkit end
+
public class EntityMushroomCow extends EntityCow implements IShearable {
public class EntityMushroomCow extends EntityCow implements IShearable, VariantHolder<EntityMushroomCow.Type> {
private static final DataWatcherObject<String> DATA_TYPE = DataWatcher.defineId(EntityMushroomCow.class, DataWatcherRegistry.STRING);
@@ -116,6 +123,11 @@
@@ -115,6 +122,11 @@
this.playSound(soundeffect, 1.0F, 1.0F);
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
} else if (itemstack.is(Items.SHEARS) && this.readyForShearing()) {
@@ -26,40 +26,40 @@
this.shear(SoundCategory.PLAYERS);
this.gameEvent(GameEvent.SHEAR, entityhuman);
if (!this.level.isClientSide) {
@@ -163,7 +175,7 @@
this.level.playSound((EntityHuman) null, (Entity) this, SoundEffects.MOOSHROOM_SHEAR, soundcategory, 1.0F, 1.0F);
if (!this.level.isClientSide()) {
((WorldServer) this.level).sendParticles(Particles.EXPLOSION, this.getX(), this.getY(0.5D), this.getZ(), 1, 0.0D, 0.0D, 0.0D, 0.0D);
- this.discard();
+ // this.discard(); // CraftBukkit - moved down
EntityCow entitycow = (EntityCow) EntityTypes.COW.create(this.level);
@@ -165,7 +177,7 @@
entitycow.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
if (entitycow != null) {
((WorldServer) this.level).sendParticles(Particles.EXPLOSION, this.getX(), this.getY(0.5D), this.getZ(), 1, 0.0D, 0.0D, 0.0D, 0.0D);
- this.discard();
+ // this.discard(); // CraftBukkit - moved down
entitycow.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
entitycow.setHealth(this.getHealth());
entitycow.yBodyRot = this.yBodyRot;
@@ -179,10 +191,25 @@
}
}
entitycow.setInvulnerable(this.isInvulnerable());
- this.level.addFreshEntity(entitycow);
+ // CraftBukkit start
+ if (CraftEventFactory.callEntityTransformEvent(this, entitycow, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) {
+ return;
+ }
+ this.level.addFreshEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED);
+
+ this.discard(); // CraftBukkit - from above
+ // CraftBukkit end
for (int i = 0; i < 5; ++i) {
- this.level.addFreshEntity(new EntityItem(this.level, this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getMushroomType().blockState.getBlock())));
entitycow.setInvulnerable(this.isInvulnerable());
- this.level.addFreshEntity(entitycow);
+ // CraftBukkit start
+ EntityItem entityitem = new EntityItem(this.level, this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getMushroomType().blockState.getBlock()));
+ EntityDropItemEvent event = new EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
+ Bukkit.getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ continue;
+ if (CraftEventFactory.callEntityTransformEvent(this, entitycow, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) {
+ return;
+ }
+ this.level.addFreshEntity(entityitem);
+ this.level.addFreshEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED);
+
+ this.discard(); // CraftBukkit - from above
+ // CraftBukkit end
for (int i = 0; i < 5; ++i) {
- this.level.addFreshEntity(new EntityItem(this.level, this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getVariant().blockState.getBlock())));
+ // CraftBukkit start
+ EntityItem entityitem = new EntityItem(this.level, this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getVariant().blockState.getBlock()));
+ EntityDropItemEvent event = new EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
+ Bukkit.getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ continue;
+ }
+ this.level.addFreshEntity(entityitem);
+ // CraftBukkit end
}
}
}

View File

@@ -10,7 +10,7 @@
this.setTrusting(true);
this.spawnTrustingParticles(true);
this.level.broadcastEntityEvent(this, (byte) 41);
@@ -312,10 +313,10 @@
@@ -313,10 +314,10 @@
private final EntityOcelot ocelot;
public a(EntityOcelot entityocelot, Class<T> oclass, float f, double d0, double d1) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityPanda.java
+++ b/net/minecraft/world/entity/animal/EntityPanda.java
@@ -64,6 +64,8 @@
@@ -65,6 +65,8 @@
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.phys.Vec3D;
@@ -9,7 +9,7 @@
public class EntityPanda extends EntityAnimal {
private static final DataWatcherObject<Integer> UNHAPPY_COUNTER = DataWatcher.defineId(EntityPanda.class, DataWatcherRegistry.INT);
@@ -526,7 +528,7 @@
@@ -532,7 +534,7 @@
@Override
protected void pickUpItem(EntityItem entityitem) {
@@ -18,7 +18,7 @@
this.onItemPickup(entityitem);
ItemStack itemstack = entityitem.getItem();
@@ -872,10 +874,10 @@
@@ -863,10 +865,10 @@
private final EntityPanda panda;
public c(EntityPanda entitypanda, Class<T> oclass, float f, double d0, double d1) {
@@ -32,7 +32,7 @@
this.panda = entitypanda;
}
@@ -1114,7 +1116,7 @@
@@ -1105,7 +1107,7 @@
@Override
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
if (entityinsentient instanceof EntityPanda && ((EntityPanda) entityinsentient).isAggressive()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityParrot.java
+++ b/net/minecraft/world/entity/animal/EntityParrot.java
@@ -257,7 +257,7 @@
@@ -261,7 +261,7 @@
}
if (!this.level.isClientSide) {
@@ -9,7 +9,7 @@
this.tame(entityhuman);
this.level.broadcastEntityEvent(this, (byte) 7);
} else {
@@ -271,7 +271,7 @@
@@ -275,7 +275,7 @@
itemstack.shrink(1);
}
@@ -18,7 +18,7 @@
if (entityhuman.isCreative() || !this.isInvulnerable()) {
this.hurt(DamageSource.playerAttack(entityhuman), Float.MAX_VALUE);
}
@@ -383,7 +383,7 @@
@@ -387,7 +387,7 @@
@Override
public boolean isPushable() {
@@ -27,7 +27,7 @@
}
@Override
@@ -399,7 +399,7 @@
@@ -403,7 +403,7 @@
return false;
} else {
if (!this.level.isClientSide) {

View File

@@ -11,18 +11,18 @@
public class EntityPig extends EntityAnimal implements ISteerable, ISaddleable {
private static final DataWatcherObject<Boolean> DATA_SADDLE_ID = DataWatcher.defineId(EntityPig.class, DataWatcherRegistry.BOOLEAN);
@@ -249,7 +253,13 @@
}
@@ -250,7 +254,13 @@
}
entitypigzombie.setPersistenceRequired();
- worldserver.addFreshEntity(entitypigzombie);
+ // CraftBukkit start
+ if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
+ return;
+ }
+ // CraftBukkit - added a reason for spawning this creature
+ worldserver.addFreshEntity(entitypigzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
+ // CraftBukkit end
this.discard();
} else {
super.thunderHit(worldserver, entitylightning);
entitypigzombie.setPersistenceRequired();
- worldserver.addFreshEntity(entitypigzombie);
+ // CraftBukkit start
+ if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
+ return;
+ }
+ // CraftBukkit - added a reason for spawning this creature
+ worldserver.addFreshEntity(entitypigzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
+ // CraftBukkit end
this.discard();
} else {
super.thunderHit(worldserver, entitylightning);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityRabbit.java
+++ b/net/minecraft/world/entity/animal/EntityRabbit.java
@@ -90,8 +90,14 @@
@@ -88,8 +88,14 @@
super(entitytypes, world);
this.jumpControl = new EntityRabbit.ControllerJumpRabbit(this);
this.moveControl = new EntityRabbit.ControllerMoveRabbit(this);
@@ -15,7 +15,7 @@
@Override
public void registerGoals() {
@@ -559,9 +565,23 @@
@@ -570,9 +576,23 @@
int i = (Integer) iblockdata.getValue(BlockCarrots.AGE);
if (i == 0) {

View File

@@ -15,7 +15,7 @@
public class EntitySheep extends EntityAnimal implements IShearable {
private static final int EAT_ANIMATION_TICKS = 40;
@@ -222,6 +230,11 @@
@@ -243,6 +251,11 @@
if (itemstack.is(Items.SHEARS)) {
if (!this.level.isClientSide && this.readyForShearing()) {
@@ -27,7 +27,7 @@
this.shear(SoundCategory.PLAYERS);
this.gameEvent(GameEvent.SHEAR, entityhuman);
itemstack.hurtAndBreak(1, entityhuman, (entityhuman1) -> {
@@ -243,7 +256,9 @@
@@ -264,7 +277,9 @@
int i = 1 + this.random.nextInt(3);
for (int j = 0; j < i; ++j) {
@@ -37,7 +37,7 @@
if (entityitem != null) {
entityitem.setDeltaMovement(entityitem.getDeltaMovement().add((double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (this.random.nextFloat() * 0.05F), (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F)));
@@ -333,6 +348,12 @@
@@ -357,6 +372,12 @@
@Override
public void ate() {
@@ -50,7 +50,7 @@
super.ate();
this.setSheared(false);
if (this.isBaby()) {
@@ -352,7 +373,7 @@
@@ -376,7 +397,7 @@
EnumColor enumcolor = ((EntitySheep) entityanimal).getColor();
EnumColor enumcolor1 = ((EntitySheep) entityanimal1).getColor();
InventoryCrafting inventorycrafting = makeContainer(enumcolor, enumcolor1);
@@ -59,7 +59,7 @@
return recipecrafting.assemble(inventorycrafting);
}).map(ItemStack::getItem);
@@ -375,10 +396,18 @@
@@ -399,10 +420,18 @@
public boolean stillValid(EntityHuman entityhuman) {
return false;
}

View File

@@ -20,7 +20,7 @@
}
private static class e extends ControllerMove {
@@ -480,8 +484,12 @@
@@ -482,8 +486,12 @@
} else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
World world = this.turtle.level;

View File

@@ -48,7 +48,7 @@
}
if (this.isDancing() && this.shouldStopDancing() && this.tickCount % 20 == 0) {
@@ -303,7 +310,12 @@
@@ -306,7 +313,12 @@
ItemStack itemstack1 = this.getItemInHand(EnumHand.MAIN_HAND);
if (this.isDancing() && this.isDuplicationItem(itemstack) && this.canDuplicate()) {
@@ -62,7 +62,7 @@
this.level.broadcastEntityEvent(this, (byte) 18);
this.level.playSound(entityhuman, (Entity) this, SoundEffects.AMETHYST_BLOCK_CHIME, SoundCategory.NEUTRAL, 2.0F, 1.0F);
this.removeInteractionItem(entityhuman, itemstack);
@@ -315,7 +327,7 @@
@@ -318,7 +330,7 @@
this.setItemInHand(EnumHand.MAIN_HAND, itemstack2);
this.removeInteractionItem(entityhuman, itemstack);
this.level.playSound(entityhuman, (Entity) this, SoundEffects.ALLAY_ITEM_GIVEN, SoundCategory.NEUTRAL, 2.0F, 1.0F);
@@ -71,7 +71,7 @@
return EnumInteractionResult.SUCCESS;
} else if (!itemstack1.isEmpty() && enumhand == EnumHand.MAIN_HAND && itemstack.isEmpty()) {
this.setItemSlot(EnumItemSlot.MAINHAND, ItemStack.EMPTY);
@@ -407,6 +419,7 @@
@@ -439,6 +451,7 @@
}
private boolean shouldStopDancing() {
@@ -79,25 +79,25 @@
return this.jukeboxPos == null || !this.jukeboxPos.closerToCenterThan(this.position(), (double) GameEvent.JUKEBOX_PLAY.getNotificationRadius()) || !this.level.getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX);
}
@@ -446,7 +459,7 @@
@@ -483,7 +496,7 @@
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
nbttagcompound.put("Inventory", this.inventory.createTag());
this.writeInventoryToTag(nbttagcompound);
- DataResult dataresult = VibrationListener.codec(this.vibrationListenerConfig).encodeStart(DynamicOpsNBT.INSTANCE, (VibrationListener) this.dynamicVibrationListener.getListener());
+ DataResult<net.minecraft.nbt.NBTBase> dataresult = VibrationListener.codec(this.vibrationListenerConfig).encodeStart(DynamicOpsNBT.INSTANCE, (VibrationListener) this.dynamicVibrationListener.getListener()); // CraftBukkit - decompile error
Logger logger = Allay.LOGGER;
Objects.requireNonNull(logger);
@@ -462,7 +475,7 @@
@@ -499,7 +512,7 @@
super.readAdditionalSaveData(nbttagcompound);
this.inventory.fromTag(nbttagcompound.getList("Inventory", 10));
this.readInventoryFromTag(nbttagcompound);
if (nbttagcompound.contains("listener", 10)) {
- DataResult dataresult = VibrationListener.codec(this.vibrationListenerConfig).parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("listener")));
+ DataResult<VibrationListener> dataresult = VibrationListener.codec(this.vibrationListenerConfig).parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("listener"))); // CraftBukkit - decompile error
Logger logger = Allay.LOGGER;
Objects.requireNonNull(logger);
@@ -508,7 +521,7 @@
@@ -532,7 +545,7 @@
return Allay.DUPLICATION_ITEM.test(itemstack);
}
@@ -106,7 +106,7 @@
Allay allay = (Allay) EntityTypes.ALLAY.create(this.level);
if (allay != null) {
@@ -516,17 +529,17 @@
@@ -540,17 +553,17 @@
allay.setPersistenceRequired();
allay.resetDuplicationCooldown();
this.resetDuplicationCooldown();

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java
+++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
@@ -66,10 +66,17 @@
@@ -68,9 +68,16 @@
public class Axolotl extends EntityAnimal implements LerpingModel, Bucketable {
public class Axolotl extends EntityAnimal implements LerpingModel, VariantHolder<Axolotl.Variant>, Bucketable {
+ // CraftBukkit start - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
+ @Override
@@ -10,7 +10,6 @@
+ return AXOLOTL_TOTAL_AIR_SUPPLY;
+ }
+ // CraftBukkit end
private static final Logger LOGGER = LogUtils.getLogger();
public static final int TOTAL_PLAYDEAD_TIME = 200;
protected static final ImmutableList<? extends SensorType<? extends Sensor<? super Axolotl>>> SENSOR_TYPES = ImmutableList.of(SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_ADULT, SensorType.HURT_BY, SensorType.AXOLOTL_ATTACKABLES, SensorType.AXOLOTL_TEMPTATIONS);
- protected static final ImmutableList<? extends MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.BREED_TARGET, MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.LOOK_TARGET, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.PATH, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.NEAREST_VISIBLE_ADULT, new MemoryModuleType[]{MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.PLAY_DEAD_TICKS, MemoryModuleType.NEAREST_ATTACKABLE, MemoryModuleType.TEMPTING_PLAYER, MemoryModuleType.TEMPTATION_COOLDOWN_TICKS, MemoryModuleType.IS_TEMPTED, MemoryModuleType.HAS_HUNTING_COOLDOWN, MemoryModuleType.IS_PANICKING});
@@ -19,7 +18,7 @@
private static final DataWatcherObject<Integer> DATA_VARIANT = DataWatcher.defineId(Axolotl.class, DataWatcherRegistry.INT);
private static final DataWatcherObject<Boolean> DATA_PLAYING_DEAD = DataWatcher.defineId(Axolotl.class, DataWatcherRegistry.BOOLEAN);
private static final DataWatcherObject<Boolean> FROM_BUCKET = DataWatcher.defineId(Axolotl.class, DataWatcherRegistry.BOOLEAN);
@@ -187,7 +194,7 @@
@@ -188,7 +195,7 @@
@Override
public int getMaxAirSupply() {
@@ -27,8 +26,8 @@
+ return maxAirTicks; // CraftBukkit - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
}
public Axolotl.Variant getVariant() {
@@ -423,7 +430,7 @@
@Override
@@ -418,7 +425,7 @@
if (i < 2400) {
i = Math.min(2400, 100 + i);
@@ -37,7 +36,7 @@
}
entityhuman.removeEffect(MobEffects.DIG_SLOWDOWN);
@@ -473,7 +480,7 @@
@@ -468,7 +475,7 @@
@Override
public BehaviorController<Axolotl> getBrain() {

View File

@@ -9,19 +9,19 @@
}
@Override
@@ -232,8 +232,14 @@
@@ -233,8 +233,14 @@
}
frog.setPersistenceRequired();
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTransformEvent(this, frog, org.bukkit.event.entity.EntityTransformEvent.TransformReason.METAMORPHOSIS).isCancelled()) {
+ this.setAge(0); // Sets the age to 0 for avoid a loop if the event is canceled
+ return;
+ }
+ // CraftBukkit end
this.playSound(SoundEffects.TADPOLE_GROW_UP, 0.15F, 1.0F);
- worldserver.addFreshEntityWithPassengers(frog);
+ worldserver.addFreshEntityWithPassengers(frog, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.METAMORPHOSIS); // CraftBukkit - add SpawnReason
this.discard();
}
frog.setPersistenceRequired();
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTransformEvent(this, frog, org.bukkit.event.entity.EntityTransformEvent.TransformReason.METAMORPHOSIS).isCancelled()) {
+ this.setAge(0); // Sets the age to 0 for avoid a loop if the event is canceled
+ return;
+ }
+ // CraftBukkit end
this.playSound(SoundEffects.TADPOLE_GROW_UP, 0.15F, 1.0F);
- worldserver.addFreshEntityWithPassengers(frog);
+ worldserver.addFreshEntityWithPassengers(frog, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.METAMORPHOSIS); // CraftBukkit - add SpawnReason
this.discard();
}

View File

@@ -12,7 +12,7 @@
public class Goat extends EntityAnimal {
public static final EntitySize LONG_JUMPING_DIMENSIONS = EntitySize.scalable(0.9F, 1.3F).scale(0.7F);
@@ -156,7 +161,7 @@
@@ -181,7 +186,7 @@
@Override
public BehaviorController<Goat> getBrain() {
@@ -21,7 +21,7 @@
}
@Override
@@ -194,8 +199,15 @@
@@ -219,8 +224,15 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.is(Items.BUCKET) && !this.isBaby()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java
+++ b/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java
@@ -72,6 +72,8 @@
@@ -74,6 +74,8 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
@@ -9,7 +9,7 @@
public abstract class EntityHorseAbstract extends EntityAnimal implements IInventoryListener, HasCustomInventoryScreen, IJumpable, ISaddleable {
public static final int EQUIPMENT_SLOT_OFFSET = 400;
@@ -111,6 +113,7 @@
@@ -113,6 +115,7 @@
private float mouthAnimO;
protected boolean canGallop = true;
protected int gallopSoundCounter;
@@ -17,7 +17,7 @@
protected EntityHorseAbstract(EntityTypes<? extends EntityHorseAbstract> entitytypes, World world) {
super(entitytypes, world);
@@ -296,7 +299,7 @@
@@ -312,7 +315,7 @@
public void createInventory() {
InventorySubcontainer inventorysubcontainer = this.inventory;
@@ -26,7 +26,7 @@
if (inventorysubcontainer != null) {
inventorysubcontainer.removeListener(this);
int i = Math.min(inventorysubcontainer.getContainerSize(), this.inventory.getContainerSize());
@@ -412,7 +415,7 @@
@@ -416,7 +419,7 @@
}
public int getMaxTemper() {
@@ -35,7 +35,7 @@
}
@Override
@@ -483,7 +486,7 @@
@@ -487,7 +490,7 @@
}
if (this.getHealth() < this.getMaxHealth() && f > 0.0F) {
@@ -44,7 +44,7 @@
flag = true;
}
@@ -560,7 +563,7 @@
@@ -564,7 +567,7 @@
super.aiStep();
if (!this.level.isClientSide && this.isAlive()) {
if (this.random.nextInt(900) == 0 && this.deathTime == 0) {
@@ -53,7 +53,7 @@
}
if (this.canEatGrass()) {
@@ -791,6 +794,7 @@
@@ -838,6 +841,7 @@
if (this.getOwnerUUID() != null) {
nbttagcompound.putUUID("Owner", this.getOwnerUUID());
}
@@ -61,7 +61,7 @@
if (!this.inventory.getItem(0).isEmpty()) {
nbttagcompound.put("SaddleItem", this.inventory.getItem(0).save(new NBTTagCompound()));
@@ -818,6 +822,11 @@
@@ -865,6 +869,11 @@
if (uuid != null) {
this.setOwnerUUID(uuid);
}
@@ -73,7 +73,7 @@
if (nbttagcompound.contains("SaddleItem", 10)) {
ItemStack itemstack = ItemStack.of(nbttagcompound.getCompound("SaddleItem"));
@@ -895,6 +904,18 @@
@@ -942,6 +951,18 @@
@Override
public void handleStartJump(int i) {
@@ -90,5 +90,5 @@
+ }
+ // CraftBukkit end
this.allowStandSliding = true;
this.stand();
this.standIfPossible();
this.playJumpSound();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/horse/EntityLlama.java
+++ b/net/minecraft/world/entity/animal/horse/EntityLlama.java
@@ -77,6 +77,12 @@
@@ -82,6 +82,12 @@
return false;
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/horse/EntityLlamaTrader.java
+++ b/net/minecraft/world/entity/animal/horse/EntityLlamaTrader.java
@@ -152,7 +152,7 @@
@@ -153,7 +153,7 @@
@Override
public void start() {

View File

@@ -1,28 +1,26 @@
--- a/net/minecraft/world/entity/animal/horse/PathfinderGoalHorseTrap.java
+++ b/net/minecraft/world/entity/animal/horse/PathfinderGoalHorseTrap.java
@@ -39,19 +39,20 @@
@@ -41,12 +41,12 @@
if (entitylightning != null) {
entitylightning.moveTo(this.horse.getX(), this.horse.getY(), this.horse.getZ());
entitylightning.setVisualOnly(true);
- worldserver.addFreshEntity(entitylightning);
+ worldserver.strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRAP); // CraftBukkit
EntitySkeleton entityskeleton = this.createSkeleton(difficultydamagescaler, this.horse);
entitylightning.moveTo(this.horse.getX(), this.horse.getY(), this.horse.getZ());
entitylightning.setVisualOnly(true);
- worldserver.addFreshEntity(entitylightning);
+ worldserver.strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRAP); // CraftBukkit
EntitySkeleton entityskeleton = this.createSkeleton(difficultydamagescaler, this.horse);
if (entityskeleton != null) {
entityskeleton.startRiding(this.horse);
- worldserver.addFreshEntityWithPassengers(entityskeleton);
+ worldserver.addFreshEntityWithPassengers(entityskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.TRAP); // CraftBukkit
- entityskeleton.startRiding(this.horse);
- worldserver.addFreshEntityWithPassengers(entityskeleton);
+ if (entityskeleton != null) entityskeleton.startRiding(this.horse); // CraftBukkit
+ worldserver.addFreshEntityWithPassengers(entityskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.TRAP); // CraftBukkit
for (int i = 0; i < 3; ++i) {
EntityHorseAbstract entityhorseabstract = this.createHorse(difficultydamagescaler);
+ if (entityhorseabstract == null) continue; // CraftBukkit
EntitySkeleton entityskeleton1 = this.createSkeleton(difficultydamagescaler, entityhorseabstract);
- entityskeleton1.startRiding(entityhorseabstract);
+ if (entityskeleton1 != null) entityskeleton1.startRiding(entityhorseabstract); // CraftBukkit
entityhorseabstract.push(this.horse.getRandom().triangle(0.0D, 1.1485D), 0.0D, this.horse.getRandom().triangle(0.0D, 1.1485D));
- worldserver.addFreshEntityWithPassengers(entityhorseabstract);
+ worldserver.addFreshEntityWithPassengers(entityhorseabstract, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.JOCKEY); // CraftBukkit
}
}
for (int i = 0; i < 3; ++i) {
EntityHorseAbstract entityhorseabstract = this.createHorse(difficultydamagescaler);
@@ -57,7 +57,7 @@
if (entityskeleton1 != null) {
entityskeleton1.startRiding(entityhorseabstract);
entityhorseabstract.push(this.horse.getRandom().triangle(0.0D, 1.1485D), 0.0D, this.horse.getRandom().triangle(0.0D, 1.1485D));
- worldserver.addFreshEntityWithPassengers(entityhorseabstract);
+ worldserver.addFreshEntityWithPassengers(entityhorseabstract, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.JOCKEY); // CraftBukkit
}
}
}