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

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityArrow.java
+++ b/net/minecraft/world/entity/projectile/EntityArrow.java
@@ -45,6 +45,12 @@
@@ -46,6 +46,12 @@
import net.minecraft.world.phys.Vec3D;
import net.minecraft.world.phys.shapes.VoxelShape;
@@ -13,7 +13,7 @@
public abstract class EntityArrow extends IProjectile {
private static final double ARROW_BASE_DAMAGE = 2.0D;
@@ -211,7 +217,7 @@
@@ -212,7 +218,7 @@
}
if (object != null && !flag) {
@@ -22,7 +22,7 @@
this.hasImpulse = true;
}
@@ -358,7 +364,13 @@
@@ -359,7 +365,13 @@
int k = entity.getRemainingFireTicks();
if (this.isOnFire() && !flag) {
@@ -37,7 +37,7 @@
}
if (entity.hurt(damagesource, (float) i)) {
@@ -521,7 +533,22 @@
@@ -522,7 +534,22 @@
@Override
public void playerTouch(EntityHuman entityhuman) {
if (!this.level.isClientSide && (this.inGround || this.isNoPhysics()) && this.shakeTime <= 0) {

View File

@@ -16,7 +16,7 @@
public class EntityEgg extends EntityProjectileThrowable {
public EntityEgg(EntityTypes<? extends EntityEgg> entitytypes, World world) {
@@ -48,20 +57,40 @@
@@ -48,22 +57,42 @@
protected void onHit(MovingObjectPosition movingobjectposition) {
super.onHit(movingobjectposition);
if (!this.level.isClientSide) {
@@ -47,17 +47,20 @@
+ hatchingType = event.getHatchingType();
+ }
- entitychicken.setAge(-24000);
- entitychicken.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F);
- this.level.addFreshEntity(entitychicken);
- if (entitychicken != null) {
- entitychicken.setAge(-24000);
- entitychicken.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F);
- this.level.addFreshEntity(entitychicken);
+ if (hatching) {
+ for (int i = 0; i < b0; ++i) {
+ Entity entity = level.getWorld().createEntity(new org.bukkit.Location(level.getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F), hatchingType.getEntityClass());
+ if (entity.getBukkitEntity() instanceof Ageable) {
+ ((Ageable) entity.getBukkitEntity()).setBaby();
+ if (entity != null) {
+ if (entity.getBukkitEntity() instanceof Ageable) {
+ ((Ageable) entity.getBukkitEntity()).setBaby();
+ }
+ level.getWorld().addEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG);
+ }
+ level.getWorld().addEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG);
+ }
}
}
+ // CraftBukkit end
}

View File

@@ -14,15 +14,12 @@
public class EntityEnderPearl extends EntityProjectileThrowable {
public EntityEnderPearl(EntityTypes<? extends EntityEnderPearl> entitytypes, World world) {
@@ -53,21 +60,34 @@
@@ -53,23 +60,36 @@
EntityPlayer entityplayer = (EntityPlayer) entity;
if (entityplayer.connection.getConnection().isConnected() && entityplayer.level == this.level && !entityplayer.isSleeping()) {
- if (this.random.nextFloat() < 0.05F && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) {
- EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.create(this.level);
-
- entityendermite.moveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot());
- this.level.addFreshEntity(entityendermite);
+ // CraftBukkit start - Fire PlayerTeleportEvent
+ org.bukkit.craftbukkit.entity.CraftPlayer player = entityplayer.getBukkitEntity();
+ org.bukkit.Location location = getBukkitEntity().getLocation();
@@ -36,14 +33,24 @@
+ if (this.random.nextFloat() < 0.05F && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) {
+ EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.create(this.level);
+
+ entityendermite.moveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot());
+ this.level.addFreshEntity(entityendermite, CreatureSpawnEvent.SpawnReason.ENDER_PEARL);
+ if (entityendermite != null) {
+ entityendermite.moveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot());
+ this.level.addFreshEntity(entityendermite, CreatureSpawnEvent.SpawnReason.ENDER_PEARL);
+ }
+ }
+
- if (entityendermite != null) {
- entityendermite.moveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot());
- this.level.addFreshEntity(entityendermite);
+ if (entity.isPassenger()) {
+ entity.stopRiding();
+ }
+
}
- }
- if (entity.isPassenger()) {
- entityplayer.dismountTo(this.getX(), this.getY(), this.getZ());
- } else {
- entity.teleportTo(this.getX(), this.getY(), this.getZ());
+ entityplayer.connection.teleport(teleEvent.getTo());
+ entity.resetFallDistance();
+ CraftEventFactory.entityDamage = this;
@@ -51,19 +58,13 @@
+ CraftEventFactory.entityDamage = null;
}
-
- if (entity.isPassenger()) {
- entityplayer.dismountTo(this.getX(), this.getY(), this.getZ());
- } else {
- entity.teleportTo(this.getX(), this.getY(), this.getZ());
- }
-
- entity.resetFallDistance();
- entity.hurt(DamageSource.FALL, 5.0F);
+ // CraftBukkit end
}
} else if (entity != null) {
entity.teleportTo(this.getX(), this.getY(), this.getZ());
@@ -96,7 +116,7 @@
@@ -98,7 +118,7 @@
public Entity changeDimension(WorldServer worldserver) {
Entity entity = this.getOwner();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityEnderSignal.java
+++ b/net/minecraft/world/entity/projectile/EntityEnderSignal.java
@@ -38,7 +38,7 @@
@@ -36,7 +36,7 @@
}
public void setItem(ItemStack itemstack) {
@@ -9,7 +9,7 @@
this.getEntityData().set(EntityEnderSignal.DATA_ITEM_STACK, (ItemStack) SystemUtils.make(itemstack.copy(), (itemstack1) -> {
itemstack1.setCount(1);
}));
@@ -182,7 +182,7 @@
@@ -180,7 +180,7 @@
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
ItemStack itemstack = ItemStack.of(nbttagcompound.getCompound("Item"));

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
+++ b/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
@@ -130,7 +130,9 @@
@@ -128,7 +128,9 @@
if (entityliving.isAlive() && !entityliving.isInvulnerable() && entityliving != entityliving1) {
if (entityliving1 == null) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityFireball.java
+++ b/net/minecraft/world/entity/projectile/EntityFireball.java
@@ -14,11 +14,15 @@
@@ -15,11 +15,15 @@
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.Vec3D;
@@ -16,7 +16,7 @@
protected EntityFireball(EntityTypes<? extends EntityFireball> entitytypes, World world) {
super(entitytypes, world);
@@ -28,6 +32,12 @@
@@ -29,6 +33,12 @@
this(entitytypes, world);
this.moveTo(d0, d1, d2, this.getYRot(), this.getXRot());
this.reapplyPosition();
@@ -29,7 +29,7 @@
double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
if (d6 != 0.0D) {
@@ -74,7 +84,13 @@
@@ -75,7 +85,13 @@
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity);
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
@@ -44,7 +44,7 @@
}
this.checkInsideBlocks();
@@ -160,6 +176,11 @@
@@ -161,6 +177,11 @@
if (entity != null) {
if (!this.level.isClientSide) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityFireworks.java
+++ b/net/minecraft/world/entity/projectile/EntityFireworks.java
@@ -29,15 +29,17 @@
@@ -29,6 +29,8 @@
import net.minecraft.world.phys.MovingObjectPositionEntity;
import net.minecraft.world.phys.Vec3D;
@@ -9,17 +9,6 @@
public class EntityFireworks extends IProjectile implements ItemSupplier {
public static final DataWatcherObject<ItemStack> DATA_ID_FIREWORKS_ITEM = DataWatcher.defineId(EntityFireworks.class, DataWatcherRegistry.ITEM_STACK);
private static final DataWatcherObject<OptionalInt> DATA_ATTACHED_TO_TARGET = DataWatcher.defineId(EntityFireworks.class, DataWatcherRegistry.OPTIONAL_UNSIGNED_INT);
public static final DataWatcherObject<Boolean> DATA_SHOT_AT_ANGLE = DataWatcher.defineId(EntityFireworks.class, DataWatcherRegistry.BOOLEAN);
- private int life;
+ public int life; // PAIL private -> public
public int lifetime;
@Nullable
- private EntityLiving attachedToEntity;
+ public EntityLiving attachedToEntity; // PAIL private -> public
public EntityFireworks(EntityTypes<? extends EntityFireworks> entitytypes, World world) {
super(entitytypes, world);
@@ -144,7 +146,7 @@
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityFishingHook.java
+++ b/net/minecraft/world/entity/projectile/EntityFishingHook.java
@@ -45,6 +45,12 @@
@@ -46,6 +46,12 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
@@ -13,7 +13,7 @@
public class EntityFishingHook extends IProjectile {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -66,6 +72,12 @@
@@ -67,6 +73,12 @@
private final int luck;
private final int lureSpeed;
@@ -26,7 +26,7 @@
private EntityFishingHook(EntityTypes<? extends EntityFishingHook> entitytypes, World world, int i, int j) {
super(entitytypes, world);
this.syncronizedRandom = RandomSource.create();
@@ -260,7 +272,7 @@
@@ -261,7 +273,7 @@
private void checkCollision() {
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity);
@@ -35,7 +35,7 @@
}
@Override
@@ -307,6 +319,10 @@
@@ -308,6 +320,10 @@
this.timeUntilLured = 0;
this.timeUntilHooked = 0;
this.getEntityData().set(EntityFishingHook.DATA_BITING, false);
@@ -46,7 +46,7 @@
}
} else {
float f;
@@ -340,6 +356,13 @@
@@ -341,6 +357,13 @@
worldserver.sendParticles(Particles.FISHING, d0, d1, d2, 0, (double) (-f4), 0.01D, (double) f3, 1.0D);
}
} else {
@@ -60,7 +60,7 @@
this.playSound(SoundEffects.FISHING_BOBBER_SPLASH, 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
double d3 = this.getY() + 0.5D;
@@ -376,8 +399,10 @@
@@ -377,8 +400,10 @@
this.timeUntilHooked = MathHelper.nextInt(this.random, 20, 80);
}
} else {
@@ -73,7 +73,7 @@
}
}
@@ -444,6 +469,14 @@
@@ -445,6 +470,14 @@
int i = 0;
if (this.hookedIn != null) {
@@ -88,7 +88,7 @@
this.pullEntity(this.hookedIn);
CriterionTriggers.FISHING_ROD_HOOKED.trigger((EntityPlayer) entityhuman, itemstack, this, Collections.emptyList());
this.level.broadcastEntityEvent(this, (byte) 31);
@@ -459,6 +492,15 @@
@@ -460,6 +493,15 @@
while (iterator.hasNext()) {
ItemStack itemstack1 = (ItemStack) iterator.next();
EntityItem entityitem = new EntityItem(this.level, this.getX(), this.getY(), this.getZ(), itemstack1);
@@ -104,7 +104,7 @@
double d0 = entityhuman.getX() - this.getX();
double d1 = entityhuman.getY() - this.getY();
double d2 = entityhuman.getZ() - this.getZ();
@@ -466,7 +508,11 @@
@@ -467,7 +509,11 @@
entityitem.setDeltaMovement(d0 * 0.1D, d1 * 0.1D + Math.sqrt(Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2)) * 0.08D, d2 * 0.1D);
this.level.addFreshEntity(entityitem);
@@ -117,7 +117,7 @@
if (itemstack1.is(TagsItem.FISHES)) {
entityhuman.awardStat(StatisticList.FISH_CAUGHT, 1);
}
@@ -476,8 +522,25 @@
@@ -477,8 +523,25 @@
}
if (this.onGround) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityLargeFireball.java
+++ b/net/minecraft/world/entity/projectile/EntityLargeFireball.java
@@ -11,17 +11,21 @@
@@ -10,17 +10,21 @@
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.MovingObjectPositionEntity;
@@ -22,24 +22,24 @@
}
@Override
@@ -30,7 +34,15 @@
@@ -29,7 +33,15 @@
if (!this.level.isClientSide) {
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
- this.level.explode((Entity) null, this.getX(), this.getY(), this.getZ(), (float) this.explosionPower, flag, flag ? Explosion.Effect.DESTROY : Explosion.Effect.NONE);
- this.level.explode(this, this.getX(), this.getY(), this.getZ(), (float) this.explosionPower, flag, World.a.MOB);
+ // CraftBukkit start - fire ExplosionPrimeEvent
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity());
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ // give 'this' instead of (Entity) null so we know what causes the damage
+ this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), flag ? Explosion.Effect.DESTROY : Explosion.Effect.NONE);
+ this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.MOB);
+ }
+ // CraftBukkit end
this.discard();
}
@@ -61,7 +73,8 @@
@@ -60,7 +72,8 @@
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.readAdditionalSaveData(nbttagcompound);
if (nbttagcompound.contains("ExplosionPower", 99)) {

View File

@@ -17,7 +17,7 @@
public class EntityPotion extends EntityProjectileThrowable implements ItemSupplier {
public static final double SPLASH_RANGE = 4.0D;
@@ -98,7 +108,7 @@
@@ -100,7 +110,7 @@
if (flag) {
this.applyWater();
@@ -26,7 +26,7 @@
if (this.isLingering()) {
this.makeAreaOfEffectCloud(itemstack, potionregistry);
} else {
@@ -144,6 +154,7 @@
@@ -149,6 +159,7 @@
private void applySplash(List<MobEffect> list, @Nullable Entity entity) {
AxisAlignedBB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D);
List<EntityLiving> list1 = this.level.getEntitiesOfClass(EntityLiving.class, axisalignedbb);
@@ -34,7 +34,7 @@
if (!list1.isEmpty()) {
Entity entity1 = this.getEffectSource();
@@ -162,21 +173,47 @@
@@ -167,21 +178,47 @@
d1 = 1.0D;
}
@@ -96,7 +96,7 @@
}
}
}
@@ -212,7 +249,14 @@
@@ -217,7 +254,14 @@
entityareaeffectcloud.setFixedColor(nbttagcompound.getInt("CustomPotionColor"));
}
@@ -112,7 +112,7 @@
}
public boolean isLingering() {
@@ -223,13 +267,25 @@
@@ -228,13 +272,25 @@
IBlockData iblockdata = this.level.getBlockState(blockposition);
if (iblockdata.is(TagsBlock.FIRE)) {

View File

@@ -1,11 +1,11 @@
--- a/net/minecraft/world/entity/projectile/EntityThrownTrident.java
+++ b/net/minecraft/world/entity/projectile/EntityThrownTrident.java
@@ -156,7 +156,7 @@
entitylightning.moveTo(Vec3D.atBottomCenterOf(blockposition));
entitylightning.setCause(entity1 instanceof EntityPlayer ? (EntityPlayer) entity1 : null);
- this.level.addFreshEntity(entitylightning);
+ ((WorldServer) this.level).strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRIDENT); // CraftBukkit
soundeffect = SoundEffects.TRIDENT_THUNDER;
f1 = 5.0F;
}
@@ -157,7 +157,7 @@
if (entitylightning != null) {
entitylightning.moveTo(Vec3D.atBottomCenterOf(blockposition));
entitylightning.setCause(entity1 instanceof EntityPlayer ? (EntityPlayer) entity1 : null);
- this.level.addFreshEntity(entitylightning);
+ ((WorldServer) this.level).strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRIDENT); // CraftBukkit
soundeffect = SoundEffects.TRIDENT_THUNDER;
f1 = 5.0F;
}

View File

@@ -10,11 +10,11 @@
+ }
+
+ public String getPotionType() {
+ return IRegistry.POTION.getKey(this.potion).toString();
+ return BuiltInRegistries.POTION.getKey(this.potion).toString();
+ }
+
+ public void setPotionType(String string) {
+ this.potion = IRegistry.POTION.get(new net.minecraft.resources.MinecraftKey(string));
+ this.potion = BuiltInRegistries.POTION.get(new net.minecraft.resources.MinecraftKey(string));
+ this.getEntityData().set(EntityTippedArrow.ID_EFFECT_COLOR, PotionUtil.getColor((Collection) PotionUtil.getAllEffects(this.potion, (Collection) this.effects)));
+ }
+

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityWitherSkull.java
+++ b/net/minecraft/world/entity/projectile/EntityWitherSkull.java
@@ -21,6 +21,8 @@
@@ -20,6 +20,8 @@
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.MovingObjectPositionEntity;
@@ -9,7 +9,7 @@
public class EntityWitherSkull extends EntityFireball {
private static final DataWatcherObject<Boolean> DATA_DANGEROUS = DataWatcher.defineId(EntityWitherSkull.class, DataWatcherRegistry.BOOLEAN);
@@ -64,7 +66,7 @@
@@ -63,7 +65,7 @@
if (entity.isAlive()) {
this.doEnchantDamageEffects(entityliving, entity);
} else {
@@ -18,7 +18,7 @@
}
}
} else {
@@ -81,7 +83,7 @@
@@ -80,7 +82,7 @@
}
if (b0 > 0) {
@@ -27,18 +27,18 @@
}
}
@@ -94,7 +96,15 @@
@@ -91,7 +93,15 @@
protected void onHit(MovingObjectPosition movingobjectposition) {
super.onHit(movingobjectposition);
if (!this.level.isClientSide) {
Explosion.Effect explosion_effect = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
- this.level.explode(this, this.getX(), this.getY(), this.getZ(), 1.0F, false, explosion_effect);
- this.level.explode(this, this.getX(), this.getY(), this.getZ(), 1.0F, false, World.a.MOB);
+ // CraftBukkit start
+ // this.level.createExplosion(this, this.locX(), this.locY(), this.locZ(), 1.0F, false, explosion_effect);
+ // this.level.explode(this, this.getX(), this.getY(), this.getZ(), 1.0F, false, World.a.MOB);
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 1.0F, false);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), explosion_effect);
+ this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.MOB);
+ }
+ // CraftBukkit end
this.discard();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/IProjectile.java
+++ b/net/minecraft/world/entity/projectile/IProjectile.java
@@ -22,6 +22,10 @@
@@ -23,6 +23,10 @@
import net.minecraft.world.phys.MovingObjectPositionEntity;
import net.minecraft.world.phys.Vec3D;
@@ -11,7 +11,7 @@
public abstract class IProjectile extends Entity {
@Nullable
@@ -31,6 +35,10 @@
@@ -32,6 +36,10 @@
private boolean leftOwner;
private boolean hasBeenShot;
@@ -22,7 +22,7 @@
IProjectile(EntityTypes<? extends IProjectile> entitytypes, World world) {
super(entitytypes, world);
}
@@ -40,6 +48,7 @@
@@ -41,6 +49,7 @@
this.ownerUUID = entity.getUUID();
this.cachedOwner = entity;
}
@@ -30,7 +30,7 @@
}
@@ -143,6 +152,16 @@
@@ -144,6 +153,16 @@
this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, entity.isOnGround() ? 0.0D : vec3d.y, vec3d.z));
}
@@ -47,7 +47,7 @@
protected void onHit(MovingObjectPosition movingobjectposition) {
MovingObjectPosition.EnumMovingObjectType movingobjectposition_enummovingobjecttype = movingobjectposition.getType();
@@ -163,6 +182,11 @@
@@ -164,6 +183,11 @@
protected void onHitEntity(MovingObjectPositionEntity movingobjectpositionentity) {}
protected void onHitBlock(MovingObjectPositionBlock movingobjectpositionblock) {