Remap CraftBukkit to Mojang+Yarn Mappings
By: Initial Source <noreply+automated@papermc.io>
This commit is contained in:
@@ -1,55 +1,85 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityArrow.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityArrow.java
|
||||
@@ -51,6 +51,13 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
--- a/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
+++ b/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
@@ -36,6 +36,7 @@
|
||||
import net.minecraft.world.entity.OminousItemSpawner;
|
||||
import net.minecraft.world.entity.SlotAccess;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
+import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
@@ -50,6 +51,10 @@
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.world.entity.item.EntityItem;
|
||||
+import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+import org.bukkit.event.player.PlayerPickupArrowEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class EntityArrow extends IProjectile {
|
||||
|
||||
private static final double ARROW_BASE_DAMAGE = 2.0D;
|
||||
@@ -88,7 +95,14 @@
|
||||
public abstract class AbstractArrow extends Projectile {
|
||||
|
||||
@@ -88,23 +93,30 @@
|
||||
}
|
||||
|
||||
protected EntityArrow(EntityTypes<? extends EntityArrow> entitytypes, double d0, double d1, double d2, World world, ItemStack itemstack, @Nullable ItemStack itemstack1) {
|
||||
protected AbstractArrow(EntityType<? extends AbstractArrow> type, double x, double y, double z, Level world, ItemStack stack, @Nullable ItemStack weapon) {
|
||||
- this(type, world);
|
||||
- this.pickupItemStack = stack.copy();
|
||||
- this.setCustomName((Component) stack.get(DataComponents.CUSTOM_NAME));
|
||||
- Unit unit = (Unit) stack.remove(DataComponents.INTANGIBLE_PROJECTILE);
|
||||
+ // CraftBukkit start - handle the owner before the rest of things
|
||||
+ this(entitytypes, d0, d1, d2, world, itemstack, itemstack1, null);
|
||||
+ this(type, x, y, z, world, stack, weapon, null);
|
||||
+ }
|
||||
+
|
||||
+ protected EntityArrow(EntityTypes<? extends EntityArrow> entitytypes, double d0, double d1, double d2, World world, ItemStack itemstack, @Nullable ItemStack itemstack1, @Nullable EntityLiving ownerEntity) {
|
||||
this(entitytypes, world);
|
||||
|
||||
+ protected AbstractArrow(EntityType<? extends AbstractArrow> entitytypes, double d0, double d1, double d2, Level world, ItemStack itemstack, @Nullable ItemStack itemstack1, @Nullable LivingEntity ownerEntity) {
|
||||
+ this(entitytypes, world);
|
||||
+ this.setOwner(ownerEntity);
|
||||
+ // CraftBukkit end
|
||||
this.pickupItemStack = itemstack.copy();
|
||||
this.setCustomName((IChatBaseComponent) itemstack.get(DataComponents.CUSTOM_NAME));
|
||||
Unit unit = (Unit) itemstack.remove(DataComponents.INTANGIBLE_PROJECTILE);
|
||||
@@ -114,8 +128,8 @@
|
||||
+ this.pickupItemStack = itemstack.copy();
|
||||
+ this.setCustomName((Component) itemstack.get(DataComponents.CUSTOM_NAME));
|
||||
+ Unit unit = (Unit) itemstack.remove(DataComponents.INTANGIBLE_PROJECTILE);
|
||||
+
|
||||
if (unit != null) {
|
||||
this.pickup = AbstractArrow.Pickup.CREATIVE_ONLY;
|
||||
}
|
||||
|
||||
- this.setPos(x, y, z);
|
||||
- if (weapon != null && world instanceof ServerLevel worldserver) {
|
||||
- if (weapon.isEmpty()) {
|
||||
+ this.setPos(d0, d1, d2);
|
||||
+ if (itemstack1 != null && world instanceof ServerLevel worldserver) {
|
||||
+ if (itemstack1.isEmpty()) {
|
||||
throw new IllegalArgumentException("Invalid weapon firing an arrow");
|
||||
}
|
||||
|
||||
- this.firedFromWeapon = weapon.copy();
|
||||
- int i = EnchantmentHelper.getPiercingCount(worldserver, weapon, this.pickupItemStack);
|
||||
+ this.firedFromWeapon = itemstack1.copy();
|
||||
+ int i = EnchantmentHelper.getPiercingCount(worldserver, itemstack1, this.pickupItemStack);
|
||||
|
||||
if (i > 0) {
|
||||
this.setPierceLevel((byte) i);
|
||||
@@ -114,8 +126,8 @@
|
||||
}
|
||||
|
||||
protected EntityArrow(EntityTypes<? extends EntityArrow> entitytypes, EntityLiving entityliving, World world, ItemStack itemstack, @Nullable ItemStack itemstack1) {
|
||||
- this(entitytypes, entityliving.getX(), entityliving.getEyeY() - 0.10000000149011612D, entityliving.getZ(), world, itemstack, itemstack1);
|
||||
- this.setOwner(entityliving);
|
||||
+ this(entitytypes, entityliving.getX(), entityliving.getEyeY() - 0.10000000149011612D, entityliving.getZ(), world, itemstack, itemstack1, entityliving); // CraftBukkit
|
||||
protected AbstractArrow(EntityType<? extends AbstractArrow> type, LivingEntity owner, Level world, ItemStack stack, @Nullable ItemStack shotFrom) {
|
||||
- this(type, owner.getX(), owner.getEyeY() - 0.10000000149011612D, owner.getZ(), world, stack, shotFrom);
|
||||
- this.setOwner(owner);
|
||||
+ this(type, owner.getX(), owner.getEyeY() - 0.10000000149011612D, owner.getZ(), world, stack, shotFrom, owner); // CraftBukkit
|
||||
+ // this.setOwner(entityliving); // SPIGOT-7744 - Moved to the above constructor
|
||||
}
|
||||
|
||||
public void setSoundEvent(SoundEffect soundeffect) {
|
||||
@@ -282,7 +296,7 @@
|
||||
public void setSoundEvent(SoundEvent sound) {
|
||||
@@ -282,7 +294,7 @@
|
||||
|
||||
if (movingobjectpositionentity == null) {
|
||||
if (this.isAlive() && movingobjectpositionblock.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
|
||||
- this.hitTargetOrDeflectSelf(movingobjectpositionblock);
|
||||
+ this.preHitTargetOrDeflectSelf(movingobjectpositionblock); // CraftBukkit - projectile hit event
|
||||
if (this.isAlive() && blockHitResult.getType() != HitResult.Type.MISS) {
|
||||
- this.hitTargetOrDeflectSelf(blockHitResult);
|
||||
+ this.preHitTargetOrDeflectSelf(blockHitResult); // CraftBukkit - projectile hit event
|
||||
this.hasImpulse = true;
|
||||
}
|
||||
} else {
|
||||
@@ -290,7 +304,7 @@
|
||||
@@ -290,7 +302,7 @@
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -58,7 +88,7 @@
|
||||
|
||||
this.hasImpulse = true;
|
||||
if (this.getPierceLevel() > 0 && projectiledeflection == ProjectileDeflection.NONE) {
|
||||
@@ -357,7 +371,7 @@
|
||||
@@ -357,7 +369,7 @@
|
||||
protected void tickDespawn() {
|
||||
++this.life;
|
||||
if (this.life >= 1200) {
|
||||
@@ -67,7 +97,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -423,7 +437,7 @@
|
||||
@@ -423,7 +435,7 @@
|
||||
}
|
||||
|
||||
if (this.piercingIgnoreEntityIds.size() >= this.getPierceLevel() + 1) {
|
||||
@@ -76,7 +106,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -444,7 +458,13 @@
|
||||
@@ -444,7 +456,13 @@
|
||||
int k = entity.getRemainingFireTicks();
|
||||
|
||||
if (this.isOnFire() && !flag) {
|
||||
@@ -91,7 +121,7 @@
|
||||
}
|
||||
|
||||
if (entity.hurtOrSimulate(damagesource, (float) i)) {
|
||||
@@ -490,7 +510,7 @@
|
||||
@@ -490,7 +508,7 @@
|
||||
|
||||
this.playSound(this.soundEvent, 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
|
||||
if (this.getPierceLevel() <= 0) {
|
||||
@@ -100,7 +130,7 @@
|
||||
}
|
||||
} else {
|
||||
entity.setRemainingFireTicks(k);
|
||||
@@ -506,7 +526,7 @@
|
||||
@@ -506,7 +524,7 @@
|
||||
this.spawnAtLocation(worldserver2, this.getPickupItem(), 0.1F);
|
||||
}
|
||||
|
||||
@@ -109,16 +139,16 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -675,7 +695,7 @@
|
||||
@@ -675,7 +693,7 @@
|
||||
}
|
||||
|
||||
if (nbttagcompound.contains("weapon", 10)) {
|
||||
- this.firedFromWeapon = (ItemStack) ItemStack.parse(this.registryAccess(), nbttagcompound.getCompound("weapon")).orElse((Object) null);
|
||||
+ this.firedFromWeapon = (ItemStack) ItemStack.parse(this.registryAccess(), nbttagcompound.getCompound("weapon")).orElse(null); // CraftBukkit - decompile error
|
||||
if (nbt.contains("weapon", 10)) {
|
||||
- this.firedFromWeapon = (ItemStack) ItemStack.parse(this.registryAccess(), nbt.getCompound("weapon")).orElse((Object) null);
|
||||
+ this.firedFromWeapon = (ItemStack) ItemStack.parse(this.registryAccess(), nbt.getCompound("weapon")).orElse(null); // CraftBukkit - decompile error
|
||||
} else {
|
||||
this.firedFromWeapon = null;
|
||||
}
|
||||
@@ -688,34 +708,31 @@
|
||||
@@ -688,34 +706,31 @@
|
||||
Entity entity1 = entity;
|
||||
byte b0 = 0;
|
||||
|
||||
@@ -165,16 +195,16 @@
|
||||
}
|
||||
|
||||
this.pickup = entityarrow_pickupstatus;
|
||||
@@ -724,9 +741,24 @@
|
||||
@@ -724,9 +739,24 @@
|
||||
@Override
|
||||
public void playerTouch(EntityHuman entityhuman) {
|
||||
public void playerTouch(Player player) {
|
||||
if (!this.level().isClientSide && (this.isInGround() || this.isNoPhysics()) && this.shakeTime <= 0) {
|
||||
- if (this.tryPickup(entityhuman)) {
|
||||
- if (this.tryPickup(player)) {
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack = this.getPickupItem();
|
||||
+ if (this.pickup == PickupStatus.ALLOWED && !itemstack.isEmpty() && entityhuman.getInventory().canHold(itemstack) > 0) {
|
||||
+ EntityItem item = new EntityItem(this.level(), this.getX(), this.getY(), this.getZ(), itemstack);
|
||||
+ PlayerPickupArrowEvent event = new PlayerPickupArrowEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.level().getCraftServer(), item), (org.bukkit.entity.AbstractArrow) this.getBukkitEntity());
|
||||
+ if (this.pickup == Pickup.ALLOWED && !itemstack.isEmpty() && player.getInventory().canHold(itemstack) > 0) {
|
||||
+ ItemEntity item = new ItemEntity(this.level(), this.getX(), this.getY(), this.getZ(), itemstack);
|
||||
+ PlayerPickupArrowEvent event = new PlayerPickupArrowEvent((org.bukkit.entity.Player) player.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.level().getCraftServer(), item), (org.bukkit.entity.AbstractArrow) this.getBukkitEntity());
|
||||
+ // event.setCancelled(!entityhuman.canPickUpLoot); TODO
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
@@ -184,9 +214,9 @@
|
||||
+ itemstack = item.getItem();
|
||||
+ }
|
||||
+
|
||||
+ if ((this.pickup == EntityArrow.PickupStatus.ALLOWED && entityhuman.getInventory().add(itemstack)) || (this.pickup == EntityArrow.PickupStatus.CREATIVE_ONLY && entityhuman.getAbilities().instabuild)) {
|
||||
+ if ((this.pickup == AbstractArrow.Pickup.ALLOWED && player.getInventory().add(itemstack)) || (this.pickup == AbstractArrow.Pickup.CREATIVE_ONLY && player.getAbilities().instabuild)) {
|
||||
+ // CraftBukkit end
|
||||
entityhuman.take(this, 1);
|
||||
player.take(this, 1);
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.PICKUP); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityFireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityFireball.java
|
||||
@@ -15,11 +15,17 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
--- a/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
||||
+++ b/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
||||
@@ -14,12 +14,17 @@
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class EntityFireball extends IProjectile {
|
||||
|
||||
public abstract class AbstractHurtingProjectile extends Projectile {
|
||||
|
||||
public static final double INITAL_ACCELERATION_POWER = 0.1D;
|
||||
public static final double DEFLECTION_SCALE = 0.5D;
|
||||
@@ -16,21 +16,21 @@
|
||||
+ public float bukkitYield = 1; // CraftBukkit
|
||||
+ public boolean isIncendiary = true; // CraftBukkit
|
||||
|
||||
protected EntityFireball(EntityTypes<? extends EntityFireball> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -69,7 +75,7 @@
|
||||
protected AbstractHurtingProjectile(EntityType<? extends AbstractHurtingProjectile> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -69,7 +74,7 @@
|
||||
|
||||
this.applyInertia();
|
||||
if (!this.level().isClientSide && (entity != null && entity.isRemoved() || !this.level().hasChunkAt(this.blockPosition()))) {
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
||||
} else {
|
||||
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResultOnMoveVector(this, this::canHitEntity, this.getClipType());
|
||||
Vec3D vec3d;
|
||||
@@ -89,7 +95,7 @@
|
||||
HitResult movingobjectposition = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity, this.getClipType());
|
||||
Vec3 vec3d;
|
||||
@@ -89,7 +94,7 @@
|
||||
}
|
||||
|
||||
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS && this.isAlive()) {
|
||||
if (movingobjectposition.getType() != HitResult.Type.MISS && this.isAlive()) {
|
||||
- this.hitTargetOrDeflectSelf(movingobjectposition);
|
||||
+ this.preHitTargetOrDeflectSelf(movingobjectposition); // CraftBukkit - projectile hit event
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
--- a/net/minecraft/world/entity/projectile/Arrow.java
|
||||
+++ b/net/minecraft/world/entity/projectile/Arrow.java
|
||||
@@ -119,7 +119,7 @@
|
||||
mobeffect = (MobEffectInstance) iterator.next();
|
||||
target.addEffect(new MobEffectInstance(mobeffect.getEffect(), Math.max(mobeffect.mapDuration((i) -> {
|
||||
return i / 8;
|
||||
- }), 1), mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible()), entity);
|
||||
+ }), 1), mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible()), entity, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
mobeffect = (MobEffectInstance) iterator.next();
|
||||
- target.addEffect(mobeffect, entity);
|
||||
+ target.addEffect(mobeffect, entity, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,17 +1,16 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityDragonFireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityDragonFireball.java
|
||||
@@ -15,6 +15,10 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
--- a/net/minecraft/world/entity/projectile/DragonFireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/DragonFireball.java
|
||||
@@ -14,6 +14,9 @@
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityDragonFireball extends EntityFireball {
|
||||
|
||||
public static final float SPLASH_RANGE = 4.0F;
|
||||
@@ -61,7 +65,7 @@
|
||||
public class DragonFireball extends AbstractHurtingProjectile {
|
||||
|
||||
@@ -61,7 +64,7 @@
|
||||
|
||||
this.level().levelEvent(2006, this.blockPosition(), this.isSilent() ? -1 : 1);
|
||||
this.level().addFreshEntity(entityareaeffectcloud);
|
||||
@@ -1,31 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
|
||||
@@ -17,6 +17,10 @@
|
||||
import net.minecraft.world.item.enchantment.EnchantmentManager;
|
||||
import net.minecraft.world.level.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityEvokerFangs extends Entity implements TraceableEntity {
|
||||
|
||||
public static final int ATTACK_DURATION = 20;
|
||||
@@ -121,7 +125,7 @@
|
||||
}
|
||||
|
||||
if (--this.lifeTicks < 0) {
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +136,7 @@
|
||||
|
||||
if (entityliving.isAlive() && !entityliving.isInvulnerable() && entityliving != entityliving1) {
|
||||
if (entityliving1 == null) {
|
||||
- entityliving.hurt(this.damageSources().magic(), 6.0F);
|
||||
+ entityliving.hurt(this.damageSources().magic().customEntityDamager(this), 6.0F); // CraftBukkit
|
||||
} else {
|
||||
if (entityliving1.isAlliedTo((Entity) entityliving)) {
|
||||
return;
|
||||
@@ -1,16 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityFireballFireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityFireballFireball.java
|
||||
@@ -61,7 +61,12 @@
|
||||
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
if (nbttagcompound.contains("Item", 10)) {
|
||||
- this.setItem((ItemStack) ItemStack.parse(this.registryAccess(), nbttagcompound.getCompound("Item")).orElse(this.getDefaultItem()));
|
||||
+ // CraftBukkit start - SPIGOT-5474 probably came from bugged earlier versions
|
||||
+ ItemStack itemstack = (ItemStack) ItemStack.parse(this.registryAccess(), nbttagcompound.getCompound("Item")).orElse(this.getDefaultItem());
|
||||
+ if (!itemstack.isEmpty()) {
|
||||
+ this.setItem(itemstack);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
this.setItem(this.getDefaultItem());
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityLargeFireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityLargeFireball.java
|
||||
@@ -13,17 +13,24 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityLargeFireball extends EntityFireballFireball {
|
||||
|
||||
public int explosionPower = 1;
|
||||
|
||||
public EntityLargeFireball(EntityTypes<? extends EntityLargeFireball> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
+ isIncendiary = (world instanceof WorldServer worldserver) && worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // CraftBukkit
|
||||
}
|
||||
|
||||
public EntityLargeFireball(World world, EntityLiving entityliving, Vec3D vec3d, int i) {
|
||||
super(EntityTypes.FIREBALL, entityliving, vec3d, world);
|
||||
this.explosionPower = i;
|
||||
+ isIncendiary = (world instanceof WorldServer worldserver) && worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -34,8 +41,16 @@
|
||||
if (world instanceof WorldServer worldserver) {
|
||||
boolean flag = worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
|
||||
- this.level().explode(this, this.getX(), this.getY(), this.getZ(), (float) this.explosionPower, flag, World.a.MOB);
|
||||
- this.discard();
|
||||
+ // 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(), World.a.MOB);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
|
||||
}
|
||||
@@ -65,7 +80,8 @@
|
||||
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
if (nbttagcompound.contains("ExplosionPower", 99)) {
|
||||
- this.explosionPower = nbttagcompound.getByte("ExplosionPower");
|
||||
+ // CraftBukkit - set bukkitYield when setting explosionpower
|
||||
+ bukkitYield = this.explosionPower = nbttagcompound.getByte("ExplosionPower");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,178 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityPotion.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityPotion.java
|
||||
@@ -35,6 +35,18 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.HashMap;
|
||||
+import java.util.Map;
|
||||
+import net.minecraft.server.level.EntityPlayer;
|
||||
+import net.minecraft.world.effect.MobEffects;
|
||||
+import net.minecraft.world.level.block.Blocks;
|
||||
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityPotion extends EntityProjectileThrowable {
|
||||
|
||||
public static final double SPLASH_RANGE = 4.0D;
|
||||
@@ -101,18 +113,18 @@
|
||||
|
||||
if (potioncontents.is(Potions.WATER)) {
|
||||
this.applyWater(worldserver);
|
||||
- } else if (potioncontents.hasEffects()) {
|
||||
+ } else if (true || potioncontents.hasEffects()) { // CraftBukkit - Call event even if no effects to apply
|
||||
if (this.isLingering()) {
|
||||
- this.makeAreaOfEffectCloud(potioncontents);
|
||||
+ this.makeAreaOfEffectCloud(potioncontents, movingobjectposition); // CraftBukkit - Pass MovingObjectPosition
|
||||
} else {
|
||||
- this.applySplash(worldserver, potioncontents.getAllEffects(), movingobjectposition.getType() == MovingObjectPosition.EnumMovingObjectType.ENTITY ? ((MovingObjectPositionEntity) movingobjectposition).getEntity() : null);
|
||||
+ this.applySplash(worldserver, potioncontents.getAllEffects(), movingobjectposition.getType() == MovingObjectPosition.EnumMovingObjectType.ENTITY ? ((MovingObjectPositionEntity) movingobjectposition).getEntity() : null, movingobjectposition); // CraftBukkit - Pass MovingObjectPosition
|
||||
}
|
||||
}
|
||||
|
||||
int i = potioncontents.potion().isPresent() && ((PotionRegistry) ((Holder) potioncontents.potion().get()).value()).hasInstantEffects() ? 2007 : 2002;
|
||||
|
||||
worldserver.levelEvent(i, this.blockPosition(), potioncontents.getColor());
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,9 +159,10 @@
|
||||
|
||||
}
|
||||
|
||||
- private void applySplash(WorldServer worldserver, Iterable<MobEffect> iterable, @Nullable Entity entity) {
|
||||
+ private void applySplash(WorldServer worldserver, Iterable<MobEffect> iterable, @Nullable Entity entity, MovingObjectPosition position) { // CraftBukkit - Pass MovingObjectPosition
|
||||
AxisAlignedBB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D);
|
||||
List<EntityLiving> list = worldserver.getEntitiesOfClass(EntityLiving.class, axisalignedbb);
|
||||
+ Map<LivingEntity, Double> affected = new HashMap<LivingEntity, Double>(); // CraftBukkit
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
Entity entity1 = this.getEffectSource();
|
||||
@@ -170,24 +183,50 @@
|
||||
d1 = 1.0D - Math.sqrt(d0) / 4.0D;
|
||||
}
|
||||
|
||||
- Iterator iterator1 = iterable.iterator();
|
||||
+ // CraftBukkit start
|
||||
+ affected.put((LivingEntity) entityliving.getBukkitEntity(), d1);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- while (iterator1.hasNext()) {
|
||||
- MobEffect mobeffect = (MobEffect) iterator1.next();
|
||||
- Holder<MobEffectList> holder = mobeffect.getEffect();
|
||||
+ org.bukkit.event.entity.PotionSplashEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPotionSplashEvent(this, position, affected);
|
||||
+ if (!event.isCancelled() && list != null && !list.isEmpty()) { // do not process effects if there are no effects to process
|
||||
+ Entity entity1 = this.getEffectSource();
|
||||
+ for (LivingEntity victim : event.getAffectedEntities()) {
|
||||
+ if (!(victim instanceof CraftLivingEntity)) {
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
- if (((MobEffectList) holder.value()).isInstantenous()) {
|
||||
- ((MobEffectList) holder.value()).applyInstantenousEffect(worldserver, this, this.getOwner(), entityliving, mobeffect.getAmplifier(), d1);
|
||||
- } else {
|
||||
- int i = mobeffect.mapDuration((j) -> {
|
||||
- return (int) (d1 * (double) j + 0.5D);
|
||||
- });
|
||||
- MobEffect mobeffect1 = new MobEffect(holder, i, mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible());
|
||||
+ EntityLiving entityliving = ((CraftLivingEntity) victim).getHandle();
|
||||
+ double d1 = event.getIntensity(victim);
|
||||
+ // CraftBukkit end
|
||||
|
||||
- if (!mobeffect1.endsWithin(20)) {
|
||||
- entityliving.addEffect(mobeffect1, entity1);
|
||||
- }
|
||||
- }
|
||||
+ Iterator iterator1 = iterable.iterator();
|
||||
+
|
||||
+ while (iterator1.hasNext()) {
|
||||
+ MobEffect mobeffect = (MobEffect) iterator1.next();
|
||||
+ Holder<MobEffectList> holder = mobeffect.getEffect();
|
||||
+ // CraftBukkit start - Abide by PVP settings - for players only!
|
||||
+ if (!this.level().pvpMode && this.getOwner() instanceof EntityPlayer && entityliving instanceof EntityPlayer && entityliving != this.getOwner()) {
|
||||
+ MobEffectList mobeffectlist = (MobEffectList) holder.value();
|
||||
+ if (mobeffectlist == MobEffects.MOVEMENT_SLOWDOWN || mobeffectlist == MobEffects.DIG_SLOWDOWN || mobeffectlist == MobEffects.HARM || mobeffectlist == MobEffects.BLINDNESS
|
||||
+ || mobeffectlist == MobEffects.HUNGER || mobeffectlist == MobEffects.WEAKNESS || mobeffectlist == MobEffects.POISON) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ if (((MobEffectList) holder.value()).isInstantenous()) {
|
||||
+ ((MobEffectList) holder.value()).applyInstantenousEffect(worldserver, this, this.getOwner(), entityliving, mobeffect.getAmplifier(), d1);
|
||||
+ } else {
|
||||
+ int i = mobeffect.mapDuration((j) -> {
|
||||
+ return (int) (d1 * (double) j + 0.5D);
|
||||
+ });
|
||||
+ MobEffect mobeffect1 = new MobEffect(holder, i, mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible());
|
||||
+
|
||||
+ if (!mobeffect1.endsWithin(20)) {
|
||||
+ entityliving.addEffect(mobeffect1, entity1, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.POTION_SPLASH); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -196,7 +235,7 @@
|
||||
|
||||
}
|
||||
|
||||
- private void makeAreaOfEffectCloud(PotionContents potioncontents) {
|
||||
+ private void makeAreaOfEffectCloud(PotionContents potioncontents, MovingObjectPosition position) { // CraftBukkit - Pass MovingObjectPosition
|
||||
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ());
|
||||
Entity entity = this.getOwner();
|
||||
|
||||
@@ -209,7 +248,14 @@
|
||||
entityareaeffectcloud.setWaitTime(10);
|
||||
entityareaeffectcloud.setRadiusPerTick(-entityareaeffectcloud.getRadius() / (float) entityareaeffectcloud.getDuration());
|
||||
entityareaeffectcloud.setPotionContents(potioncontents);
|
||||
- this.level().addFreshEntity(entityareaeffectcloud);
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.LingeringPotionSplashEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callLingeringPotionSplashEvent(this, position, entityareaeffectcloud);
|
||||
+ if (!(event.isCancelled() || entityareaeffectcloud.isRemoved())) {
|
||||
+ this.level().addFreshEntity(entityareaeffectcloud);
|
||||
+ } else {
|
||||
+ entityareaeffectcloud.discard(null); // CraftBukkit - add Bukkit remove cause
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public boolean isLingering() {
|
||||
@@ -220,13 +266,25 @@
|
||||
IBlockData iblockdata = this.level().getBlockState(blockposition);
|
||||
|
||||
if (iblockdata.is(TagsBlock.FIRE)) {
|
||||
- this.level().destroyBlock(blockposition, false, this);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.defaultBlockState())) {
|
||||
+ this.level().destroyBlock(blockposition, false, this);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else if (AbstractCandleBlock.isLit(iblockdata)) {
|
||||
- AbstractCandleBlock.extinguish((EntityHuman) null, iblockdata, this.level(), blockposition);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, iblockdata.setValue(AbstractCandleBlock.LIT, false))) {
|
||||
+ AbstractCandleBlock.extinguish((EntityHuman) null, iblockdata, this.level(), blockposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else if (BlockCampfire.isLitCampfire(iblockdata)) {
|
||||
- this.level().levelEvent((EntityHuman) null, 1009, blockposition, 0);
|
||||
- BlockCampfire.dowse(this.getOwner(), this.level(), blockposition, iblockdata);
|
||||
- this.level().setBlockAndUpdate(blockposition, (IBlockData) iblockdata.setValue(BlockCampfire.LIT, false));
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, iblockdata.setValue(BlockCampfire.LIT, false))) {
|
||||
+ this.level().levelEvent((EntityHuman) null, 1009, blockposition, 0);
|
||||
+ BlockCampfire.dowse(this.getOwner(), this.level(), blockposition, iblockdata);
|
||||
+ this.level().setBlockAndUpdate(blockposition, (IBlockData) iblockdata.setValue(BlockCampfire.LIT, false));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityProjectileThrowable.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityProjectileThrowable.java
|
||||
@@ -34,6 +34,12 @@
|
||||
|
||||
protected abstract Item getDefaultItem();
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public Item getDefaultItemPublic() {
|
||||
+ return getDefaultItem();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@Override
|
||||
public ItemStack getItem() {
|
||||
return (ItemStack) this.getEntityData().get(EntityProjectileThrowable.DATA_ITEM_STACK);
|
||||
@@ -1,101 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityShulkerBullet.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityShulkerBullet.java
|
||||
@@ -32,6 +32,10 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityShulkerBullet extends IProjectile {
|
||||
|
||||
private static final double SPEED = 0.15D;
|
||||
@@ -60,8 +64,21 @@
|
||||
this.finalTarget = entity;
|
||||
this.currentMoveDirection = EnumDirection.UP;
|
||||
this.selectNextMoveDirection(enumdirection_enumaxis);
|
||||
+ projectileSource = (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public Entity getTarget() {
|
||||
+ return this.finalTarget;
|
||||
}
|
||||
|
||||
+ public void setTarget(Entity e) {
|
||||
+ this.finalTarget = e;
|
||||
+ this.currentMoveDirection = EnumDirection.UP;
|
||||
+ this.selectNextMoveDirection(EnumDirection.EnumAxis.X);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@Override
|
||||
public SoundCategory getSoundSource() {
|
||||
return SoundCategory.HOSTILE;
|
||||
@@ -194,7 +211,7 @@
|
||||
@Override
|
||||
public void checkDespawn() {
|
||||
if (this.level().getDifficulty() == EnumDifficulty.PEACEFUL) {
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
|
||||
}
|
||||
@@ -239,7 +256,7 @@
|
||||
}
|
||||
|
||||
if (movingobjectposition != null && this.isAlive() && movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
|
||||
- this.hitTargetOrDeflectSelf(movingobjectposition);
|
||||
+ this.preHitTargetOrDeflectSelf(movingobjectposition); // CraftBukkit - projectile hit event
|
||||
}
|
||||
|
||||
ProjectileHelper.rotateTowardsMovement(this, 0.5F);
|
||||
@@ -312,7 +329,7 @@
|
||||
if (entity instanceof EntityLiving) {
|
||||
EntityLiving entityliving1 = (EntityLiving) entity;
|
||||
|
||||
- entityliving1.addEffect(new MobEffect(MobEffects.LEVITATION, 200), (Entity) MoreObjects.firstNonNull(entity1, this));
|
||||
+ entityliving1.addEffect(new MobEffect(MobEffects.LEVITATION, 200), (Entity) MoreObjects.firstNonNull(entity1, this), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,14 +343,20 @@
|
||||
}
|
||||
|
||||
private void destroy() {
|
||||
- this.discard();
|
||||
+ // CraftBukkit start - add Bukkit remove cause
|
||||
+ this.destroy(null);
|
||||
+ }
|
||||
+
|
||||
+ private void destroy(EntityRemoveEvent.Cause cause) {
|
||||
+ this.discard(cause);
|
||||
+ // CraftBukkit end
|
||||
this.level().gameEvent((Holder) GameEvent.ENTITY_DAMAGE, this.position(), GameEvent.a.of((Entity) this));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onHit(MovingObjectPosition movingobjectposition) {
|
||||
super.onHit(movingobjectposition);
|
||||
- this.destroy();
|
||||
+ this.destroy(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -348,9 +371,14 @@
|
||||
|
||||
@Override
|
||||
public boolean hurtServer(WorldServer worldserver, DamageSource damagesource, float f) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, false)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.playSound(SoundEffects.SHULKER_BULLET_HURT, 1.0F, 1.0F);
|
||||
worldserver.sendParticles(Particles.CRIT, this.getX(), this.getY(), this.getZ(), 15, 0.2D, 0.2D, 0.2D, 0.0D);
|
||||
- this.destroy();
|
||||
+ this.destroy(EntityRemoveEvent.Cause.DEATH); // CraftBukkit - add Bukkit remove cause
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntitySnowball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntitySnowball.java
|
||||
@@ -14,6 +14,10 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntitySnowball extends EntityProjectileThrowable {
|
||||
|
||||
public EntitySnowball(EntityTypes<? extends EntitySnowball> entitytypes, World world) {
|
||||
@@ -65,7 +69,7 @@
|
||||
super.onHit(movingobjectposition);
|
||||
if (!this.level().isClientSide) {
|
||||
this.level().broadcastEntityEvent(this, (byte) 3);
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntitySpectralArrow.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntitySpectralArrow.java
|
||||
@@ -41,7 +41,7 @@
|
||||
super.doPostHurtEffects(entityliving);
|
||||
MobEffect mobeffect = new MobEffect(MobEffects.GLOWING, this.duration, 0);
|
||||
|
||||
- entityliving.addEffect(mobeffect, this.getEffectSource());
|
||||
+ entityliving.addEffect(mobeffect, this.getEffectSource(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,35 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityThrownTrident.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityThrownTrident.java
|
||||
@@ -24,6 +24,10 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityThrownTrident extends EntityArrow {
|
||||
|
||||
private static final DataWatcherObject<Byte> ID_LOYALTY = DataWatcher.defineId(EntityThrownTrident.class, DataWatcherRegistry.BYTE);
|
||||
@@ -76,10 +80,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.DROP); // CraftBukkit - add Bukkit remove cause
|
||||
} else {
|
||||
if (!(entity instanceof EntityHuman) && this.position().distanceTo(entity.getEyePosition()) < (double) entity.getBbWidth() + 1.0D) {
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -137,7 +141,7 @@
|
||||
|
||||
world = this.level();
|
||||
if (world instanceof WorldServer) {
|
||||
- worldserver = (WorldServer) world;
|
||||
+ WorldServer worldserver = (WorldServer) world; // CraftBukkit - decompile error
|
||||
EnchantmentManager.doPostAttackEffectsWithItemSourceOnBreak(worldserver, entity, damagesource, this.getWeaponItem(), (item) -> {
|
||||
this.kill(worldserver);
|
||||
});
|
||||
@@ -1,20 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityTippedArrow.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityTippedArrow.java
|
||||
@@ -119,7 +119,7 @@
|
||||
mobeffect = (MobEffect) iterator.next();
|
||||
entityliving.addEffect(new MobEffect(mobeffect.getEffect(), Math.max(mobeffect.mapDuration((i) -> {
|
||||
return i / 8;
|
||||
- }), 1), mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible()), entity);
|
||||
+ }), 1), mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible()), entity, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
mobeffect = (MobEffect) iterator.next();
|
||||
- entityliving.addEffect(mobeffect, entity);
|
||||
+ entityliving.addEffect(mobeffect, entity, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EvokerFangs.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EvokerFangs.java
|
||||
@@ -16,6 +16,9 @@
|
||||
import net.minecraft.world.entity.TraceableEntity;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.world.level.Level;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+// CraftBukkit end
|
||||
|
||||
public class EvokerFangs extends Entity implements TraceableEntity {
|
||||
|
||||
@@ -121,7 +124,7 @@
|
||||
}
|
||||
|
||||
if (--this.lifeTicks < 0) {
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +135,7 @@
|
||||
|
||||
if (target.isAlive() && !target.isInvulnerable() && target != entityliving1) {
|
||||
if (entityliving1 == null) {
|
||||
- target.hurt(this.damageSources().magic(), 6.0F);
|
||||
+ target.hurt(this.damageSources().magic().customEntityDamager(this), 6.0F); // CraftBukkit
|
||||
} else {
|
||||
if (entityliving1.isAlliedTo((Entity) target)) {
|
||||
return;
|
||||
@@ -1,32 +1,31 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityEnderSignal.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityEnderSignal.java
|
||||
@@ -18,6 +18,10 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
--- a/net/minecraft/world/entity/projectile/EyeOfEnder.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EyeOfEnder.java
|
||||
@@ -17,6 +17,9 @@
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityEnderSignal extends Entity implements ItemSupplier {
|
||||
|
||||
private static final float MIN_CAMERA_DISTANCE_SQUARED = 12.25F;
|
||||
@@ -153,7 +157,7 @@
|
||||
public class EyeOfEnder extends Entity implements ItemSupplier {
|
||||
|
||||
@@ -153,7 +156,7 @@
|
||||
++this.life;
|
||||
if (this.life > 80 && !this.level().isClientSide) {
|
||||
this.playSound(SoundEffects.ENDER_EYE_DEATH, 1.0F, 1.0F);
|
||||
this.playSound(SoundEvents.ENDER_EYE_DEATH, 1.0F, 1.0F);
|
||||
- this.discard();
|
||||
+ this.discard(this.surviveAfterDeath ? EntityRemoveEvent.Cause.DROP : EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
||||
if (this.surviveAfterDeath) {
|
||||
this.level().addFreshEntity(new EntityItem(this.level(), this.getX(), this.getY(), this.getZ(), this.getItem()));
|
||||
this.level().addFreshEntity(new ItemEntity(this.level(), this.getX(), this.getY(), this.getZ(), this.getItem()));
|
||||
} else {
|
||||
@@ -174,7 +178,12 @@
|
||||
@@ -174,7 +177,12 @@
|
||||
@Override
|
||||
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
if (nbttagcompound.contains("Item", 10)) {
|
||||
- this.setItem((ItemStack) ItemStack.parse(this.registryAccess(), nbttagcompound.getCompound("Item")).orElse(this.getDefaultItem()));
|
||||
public void readAdditionalSaveData(CompoundTag nbt) {
|
||||
if (nbt.contains("Item", 10)) {
|
||||
- this.setItem((ItemStack) ItemStack.parse(this.registryAccess(), nbt.getCompound("Item")).orElse(this.getDefaultItem()));
|
||||
+ // CraftBukkit start - SPIGOT-6103 summon, see also SPIGOT-5474
|
||||
+ ItemStack itemstack = (ItemStack) ItemStack.parse(this.registryAccess(), nbttagcompound.getCompound("Item")).orElse(this.getDefaultItem());
|
||||
+ ItemStack itemstack = (ItemStack) ItemStack.parse(this.registryAccess(), nbt.getCompound("Item")).orElse(this.getDefaultItem());
|
||||
+ if (!itemstack.isEmpty()) {
|
||||
+ this.setItem(itemstack);
|
||||
+ }
|
||||
@@ -0,0 +1,16 @@
|
||||
--- a/net/minecraft/world/entity/projectile/Fireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/Fireball.java
|
||||
@@ -61,7 +61,12 @@
|
||||
public void readAdditionalSaveData(CompoundTag nbt) {
|
||||
super.readAdditionalSaveData(nbt);
|
||||
if (nbt.contains("Item", 10)) {
|
||||
- this.setItem((ItemStack) ItemStack.parse(this.registryAccess(), nbt.getCompound("Item")).orElse(this.getDefaultItem()));
|
||||
+ // CraftBukkit start - SPIGOT-5474 probably came from bugged earlier versions
|
||||
+ ItemStack itemstack = (ItemStack) ItemStack.parse(this.registryAccess(), nbt.getCompound("Item")).orElse(this.getDefaultItem());
|
||||
+ if (!itemstack.isEmpty()) {
|
||||
+ this.setItem(itemstack);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
this.setItem(this.getDefaultItem());
|
||||
}
|
||||
@@ -1,28 +1,27 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityFireworks.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityFireworks.java
|
||||
@@ -33,6 +33,10 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
--- a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
|
||||
+++ b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
|
||||
@@ -32,6 +32,9 @@
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityFireworks extends IProjectile implements ItemSupplier {
|
||||
|
||||
public static final DataWatcherObject<ItemStack> DATA_ID_FIREWORKS_ITEM = DataWatcher.defineId(EntityFireworks.class, DataWatcherRegistry.ITEM_STACK);
|
||||
@@ -152,7 +156,7 @@
|
||||
public class FireworkRocketEntity extends Projectile implements ItemSupplier {
|
||||
|
||||
@@ -152,7 +155,7 @@
|
||||
}
|
||||
|
||||
if (!this.noPhysics && this.isAlive() && movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
|
||||
if (!this.noPhysics && this.isAlive() && movingobjectposition.getType() != HitResult.Type.MISS) {
|
||||
- this.hitTargetOrDeflectSelf(movingobjectposition);
|
||||
+ this.preHitTargetOrDeflectSelf(movingobjectposition); // CraftBukkit - projectile hit event
|
||||
this.hasImpulse = true;
|
||||
}
|
||||
|
||||
@@ -172,7 +176,11 @@
|
||||
if (world instanceof WorldServer) {
|
||||
WorldServer worldserver = (WorldServer) world;
|
||||
@@ -172,7 +175,11 @@
|
||||
if (world instanceof ServerLevel) {
|
||||
ServerLevel worldserver = (ServerLevel) world;
|
||||
|
||||
- this.explode(worldserver);
|
||||
+ // CraftBukkit start
|
||||
@@ -33,19 +32,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +190,7 @@
|
||||
worldserver.broadcastEntityEvent(this, (byte) 17);
|
||||
@@ -182,7 +189,7 @@
|
||||
world.broadcastEntityEvent(this, (byte) 17);
|
||||
this.gameEvent(GameEvent.EXPLODE, this.getOwner());
|
||||
this.dealExplosionDamage(worldserver);
|
||||
this.dealExplosionDamage(world);
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -191,7 +199,11 @@
|
||||
World world = this.level();
|
||||
@@ -191,7 +198,11 @@
|
||||
Level world = this.level();
|
||||
|
||||
if (world instanceof WorldServer worldserver) {
|
||||
if (world instanceof ServerLevel worldserver) {
|
||||
- this.explode(worldserver);
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
|
||||
@@ -55,9 +54,9 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -205,7 +217,11 @@
|
||||
@@ -205,7 +216,11 @@
|
||||
|
||||
if (world instanceof WorldServer worldserver) {
|
||||
if (world instanceof ServerLevel worldserver) {
|
||||
if (this.hasExplosion()) {
|
||||
- this.explode(worldserver);
|
||||
+ // CraftBukkit start
|
||||
@@ -1,7 +1,15 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityFishingHook.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityFishingHook.java
|
||||
@@ -47,6 +47,13 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
--- a/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
+++ b/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
@@ -29,7 +29,6 @@
|
||||
import net.minecraft.world.entity.ExperienceOrb;
|
||||
import net.minecraft.world.entity.MoverType;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
-import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.Level;
|
||||
@@ -47,6 +46,13 @@
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
@@ -11,10 +19,10 @@
|
||||
+import org.bukkit.event.player.PlayerFishEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityFishingHook extends IProjectile {
|
||||
public class FishingHook extends Projectile {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -68,6 +75,18 @@
|
||||
@@ -68,6 +74,18 @@
|
||||
private final int luck;
|
||||
private final int lureSpeed;
|
||||
|
||||
@@ -30,11 +38,24 @@
|
||||
+ public boolean skyInfluenced = true;
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
private EntityFishingHook(EntityTypes<? extends EntityFishingHook> entitytypes, World world, int i, int j) {
|
||||
super(entitytypes, world);
|
||||
private FishingHook(EntityType<? extends FishingHook> type, Level world, int luckBonus, int waitTimeReductionTicks) {
|
||||
super(type, world);
|
||||
this.syncronizedRandom = RandomSource.create();
|
||||
@@ -152,12 +171,12 @@
|
||||
EntityHuman entityhuman = this.getPlayerOwner();
|
||||
@@ -81,7 +99,7 @@
|
||||
this(type, world, 0, 0);
|
||||
}
|
||||
|
||||
- public FishingHook(Player thrower, Level world, int luckBonus, int waitTimeReductionTicks) {
|
||||
+ public FishingHook(net.minecraft.world.entity.player.Player thrower, Level world, int luckBonus, int waitTimeReductionTicks) {
|
||||
this(EntityType.FISHING_BOBBER, world, luckBonus, waitTimeReductionTicks);
|
||||
this.setOwner(thrower);
|
||||
float f = thrower.getXRot();
|
||||
@@ -149,15 +167,15 @@
|
||||
public void tick() {
|
||||
this.syncronizedRandom.setSeed(this.getUUID().getLeastSignificantBits() ^ this.level().getGameTime());
|
||||
super.tick();
|
||||
- Player entityhuman = this.getPlayerOwner();
|
||||
+ net.minecraft.world.entity.player.Player entityhuman = this.getPlayerOwner();
|
||||
|
||||
if (entityhuman == null) {
|
||||
- this.discard();
|
||||
@@ -48,8 +69,17 @@
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@@ -259,7 +278,7 @@
|
||||
if (!entityhuman.isRemoved() && entityhuman.isAlive() && (flag || flag1) && this.distanceToSqr((Entity) entityhuman) <= 1024.0D) {
|
||||
@@ -250,7 +268,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- private boolean shouldStopFishing(Player player) {
|
||||
+ private boolean shouldStopFishing(net.minecraft.world.entity.player.Player player) {
|
||||
ItemStack itemstack = player.getMainHandItem();
|
||||
ItemStack itemstack1 = player.getOffhandItem();
|
||||
boolean flag = itemstack.is(Items.FISHING_ROD);
|
||||
@@ -259,7 +277,7 @@
|
||||
if (!player.isRemoved() && player.isAlive() && (flag || flag1) && this.distanceToSqr((Entity) player) <= 1024.0D) {
|
||||
return false;
|
||||
} else {
|
||||
- this.discard();
|
||||
@@ -57,18 +87,18 @@
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -267,7 +286,7 @@
|
||||
@@ -267,7 +285,7 @@
|
||||
private void checkCollision() {
|
||||
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResultOnMoveVector(this, this::canHitEntity);
|
||||
HitResult movingobjectposition = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity);
|
||||
|
||||
- this.hitTargetOrDeflectSelf(movingobjectposition);
|
||||
+ this.preHitTargetOrDeflectSelf(movingobjectposition); // CraftBukkit - projectile hit event
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -300,11 +319,11 @@
|
||||
@@ -300,11 +318,11 @@
|
||||
int i = 1;
|
||||
BlockPosition blockposition1 = blockposition.above();
|
||||
BlockPos blockposition1 = pos.above();
|
||||
|
||||
- if (this.random.nextFloat() < 0.25F && this.level().isRainingAt(blockposition1)) {
|
||||
+ if (this.rainInfluenced && this.random.nextFloat() < 0.25F && this.level().isRainingAt(blockposition1)) { // CraftBukkit
|
||||
@@ -80,10 +110,10 @@
|
||||
--i;
|
||||
}
|
||||
|
||||
@@ -314,6 +333,10 @@
|
||||
@@ -314,6 +332,10 @@
|
||||
this.timeUntilLured = 0;
|
||||
this.timeUntilHooked = 0;
|
||||
this.getEntityData().set(EntityFishingHook.DATA_BITING, false);
|
||||
this.getEntityData().set(FishingHook.DATA_BITING, false);
|
||||
+ // CraftBukkit start
|
||||
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.getPlayerOwner().getBukkitEntity(), null, (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.FAILED_ATTEMPT);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(playerFishEvent);
|
||||
@@ -91,8 +121,8 @@
|
||||
}
|
||||
} else {
|
||||
float f;
|
||||
@@ -347,6 +370,13 @@
|
||||
worldserver.sendParticles(Particles.FISHING, d0, d1, d2, 0, (double) (-f4), 0.01D, (double) f3, 1.0D);
|
||||
@@ -347,6 +369,13 @@
|
||||
worldserver.sendParticles(ParticleTypes.FISHING, d0, d1, d2, 0, (double) (-f4), 0.01D, (double) f3, 1.0D);
|
||||
}
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
@@ -102,31 +132,38 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.playSound(SoundEffects.FISHING_BOBBER_SPLASH, 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
|
||||
this.playSound(SoundEvents.FISHING_BOBBER_SPLASH, 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
|
||||
double d3 = this.getY() + 0.5D;
|
||||
|
||||
@@ -379,12 +409,16 @@
|
||||
@@ -379,12 +408,16 @@
|
||||
}
|
||||
|
||||
if (this.timeUntilLured <= 0) {
|
||||
- this.fishAngle = MathHelper.nextFloat(this.random, 0.0F, 360.0F);
|
||||
- this.timeUntilHooked = MathHelper.nextInt(this.random, 20, 80);
|
||||
- this.fishAngle = Mth.nextFloat(this.random, 0.0F, 360.0F);
|
||||
- this.timeUntilHooked = Mth.nextInt(this.random, 20, 80);
|
||||
+ // CraftBukkit start - logic to modify fishing wait time, lure time, and lure angle
|
||||
+ this.fishAngle = MathHelper.nextFloat(this.random, this.minLureAngle, this.maxLureAngle);
|
||||
+ this.timeUntilHooked = MathHelper.nextInt(this.random, this.minLureTime, this.maxLureTime);
|
||||
+ this.fishAngle = Mth.nextFloat(this.random, this.minLureAngle, this.maxLureAngle);
|
||||
+ this.timeUntilHooked = Mth.nextInt(this.random, this.minLureTime, this.maxLureTime);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
} else {
|
||||
- this.timeUntilLured = MathHelper.nextInt(this.random, 100, 600);
|
||||
- this.timeUntilLured = Mth.nextInt(this.random, 100, 600);
|
||||
- this.timeUntilLured -= this.lureSpeed;
|
||||
+ // CraftBukkit start - logic to modify fishing wait time
|
||||
+ this.timeUntilLured = MathHelper.nextInt(this.random, this.minWaitTime, this.maxWaitTime);
|
||||
+ this.timeUntilLured = Mth.nextInt(this.random, this.minWaitTime, this.maxWaitTime);
|
||||
+ this.timeUntilLured -= (this.applyLure) ? this.lureSpeed : 0;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -452,6 +486,14 @@
|
||||
@@ -446,12 +479,20 @@
|
||||
public void readAdditionalSaveData(CompoundTag nbt) {}
|
||||
|
||||
public int retrieve(ItemStack usedItem) {
|
||||
- Player entityhuman = this.getPlayerOwner();
|
||||
+ net.minecraft.world.entity.player.Player entityhuman = this.getPlayerOwner();
|
||||
|
||||
if (!this.level().isClientSide && entityhuman != null && !this.shouldStopFishing(entityhuman)) {
|
||||
int i = 0;
|
||||
|
||||
if (this.hookedIn != null) {
|
||||
@@ -139,12 +176,12 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.pullEntity(this.hookedIn);
|
||||
CriterionTriggers.FISHING_ROD_HOOKED.trigger((EntityPlayer) entityhuman, itemstack, this, Collections.emptyList());
|
||||
CriteriaTriggers.FISHING_ROD_HOOKED.trigger((ServerPlayer) entityhuman, usedItem, this, Collections.emptyList());
|
||||
this.level().broadcastEntityEvent(this, (byte) 31);
|
||||
@@ -467,6 +509,15 @@
|
||||
@@ -467,6 +508,15 @@
|
||||
while (iterator.hasNext()) {
|
||||
ItemStack itemstack1 = (ItemStack) iterator.next();
|
||||
EntityItem entityitem = new EntityItem(this.level(), this.getX(), this.getY(), this.getZ(), itemstack1);
|
||||
ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), this.getY(), this.getZ(), itemstack1);
|
||||
+ // CraftBukkit start
|
||||
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), entityitem.getBukkitEntity(), (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH);
|
||||
+ playerFishEvent.setExpToDrop(this.random.nextInt(6) + 1);
|
||||
@@ -157,20 +194,20 @@
|
||||
double d0 = entityhuman.getX() - this.getX();
|
||||
double d1 = entityhuman.getY() - this.getY();
|
||||
double d2 = entityhuman.getZ() - this.getZ();
|
||||
@@ -474,7 +525,11 @@
|
||||
@@ -474,7 +524,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);
|
||||
- entityhuman.level().addFreshEntity(new EntityExperienceOrb(entityhuman.level(), entityhuman.getX(), entityhuman.getY() + 0.5D, entityhuman.getZ() + 0.5D, this.random.nextInt(6) + 1));
|
||||
- entityhuman.level().addFreshEntity(new ExperienceOrb(entityhuman.level(), entityhuman.getX(), entityhuman.getY() + 0.5D, entityhuman.getZ() + 0.5D, this.random.nextInt(6) + 1));
|
||||
+ // CraftBukkit start - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop()
|
||||
+ if (playerFishEvent.getExpToDrop() > 0) {
|
||||
+ entityhuman.level().addFreshEntity(new EntityExperienceOrb(entityhuman.level(), entityhuman.getX(), entityhuman.getY() + 0.5D, entityhuman.getZ() + 0.5D, playerFishEvent.getExpToDrop()));
|
||||
+ entityhuman.level().addFreshEntity(new ExperienceOrb(entityhuman.level(), entityhuman.getX(), entityhuman.getY() + 0.5D, entityhuman.getZ() + 0.5D, playerFishEvent.getExpToDrop()));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (itemstack1.is(TagsItem.FISHES)) {
|
||||
entityhuman.awardStat(StatisticList.FISH_CAUGHT, 1);
|
||||
if (itemstack1.is(ItemTags.FISHES)) {
|
||||
entityhuman.awardStat(Stats.FISH_CAUGHT, 1);
|
||||
}
|
||||
@@ -484,10 +539,27 @@
|
||||
@@ -484,10 +538,27 @@
|
||||
}
|
||||
|
||||
if (this.onGround()) {
|
||||
@@ -199,27 +236,58 @@
|
||||
return i;
|
||||
} else {
|
||||
return 0;
|
||||
@@ -520,8 +592,15 @@
|
||||
@@ -496,7 +567,7 @@
|
||||
|
||||
@Override
|
||||
public void remove(Entity.RemovalReason entity_removalreason) {
|
||||
public void handleEntityEvent(byte status) {
|
||||
- if (status == 31 && this.level().isClientSide && this.hookedIn instanceof Player && ((Player) this.hookedIn).isLocalPlayer()) {
|
||||
+ if (status == 31 && this.level().isClientSide && this.hookedIn instanceof net.minecraft.world.entity.player.Player && ((net.minecraft.world.entity.player.Player) this.hookedIn).isLocalPlayer()) {
|
||||
this.pullEntity(this.hookedIn);
|
||||
}
|
||||
|
||||
@@ -520,8 +591,15 @@
|
||||
|
||||
@Override
|
||||
public void remove(Entity.RemovalReason reason) {
|
||||
+ // CraftBukkit start - add Bukkit remove cause
|
||||
+ this.remove(entity_removalreason, null);
|
||||
+ this.remove(reason, null);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void remove(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) {
|
||||
+ // CraftBukkit end
|
||||
this.updateOwnerInfo((EntityFishingHook) null);
|
||||
- super.remove(entity_removalreason);
|
||||
this.updateOwnerInfo((FishingHook) null);
|
||||
- super.remove(reason);
|
||||
+ super.remove(entity_removalreason, cause); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -575,7 +654,7 @@
|
||||
int i = packetplayoutspawnentity.getData();
|
||||
@@ -536,7 +614,7 @@
|
||||
}
|
||||
|
||||
EntityFishingHook.LOGGER.error("Failed to recreate fishing hook on client. {} (id: {}) is not a valid owner.", this.level().getEntity(i), i);
|
||||
private void updateOwnerInfo(@Nullable FishingHook fishingBobber) {
|
||||
- Player entityhuman = this.getPlayerOwner();
|
||||
+ net.minecraft.world.entity.player.Player entityhuman = this.getPlayerOwner();
|
||||
|
||||
if (entityhuman != null) {
|
||||
entityhuman.fishing = fishingBobber;
|
||||
@@ -545,10 +623,10 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
- public Player getPlayerOwner() {
|
||||
+ public net.minecraft.world.entity.player.Player getPlayerOwner() {
|
||||
Entity entity = this.getOwner();
|
||||
|
||||
- return entity instanceof Player ? (Player) entity : null;
|
||||
+ return entity instanceof net.minecraft.world.entity.player.Player ? (net.minecraft.world.entity.player.Player) entity : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -575,7 +653,7 @@
|
||||
int i = packet.getData();
|
||||
|
||||
FishingHook.LOGGER.error("Failed to recreate fishing hook on client. {} (id: {}) is not a valid owner.", this.level().getEntity(i), i);
|
||||
- this.discard();
|
||||
+ this.discard(null); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/projectile/IProjectile.java
|
||||
+++ b/net/minecraft/world/entity/projectile/IProjectile.java
|
||||
@@ -36,6 +36,10 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.projectiles.ProjectileSource;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class IProjectile extends Entity implements TraceableEntity {
|
||||
|
||||
@Nullable
|
||||
@@ -47,6 +51,10 @@
|
||||
@Nullable
|
||||
private Entity lastDeflectedBy;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ private boolean hitCancelled = false;
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
IProjectile(EntityTypes<? extends IProjectile> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
}
|
||||
@@ -56,6 +64,7 @@
|
||||
this.ownerUUID = entity.getUUID();
|
||||
this.cachedOwner = entity;
|
||||
}
|
||||
+ this.projectileSource = (entity != null && entity.getBukkitEntity() instanceof ProjectileSource) ? (ProjectileSource) entity.getBukkitEntity() : null; // CraftBukkit
|
||||
|
||||
}
|
||||
|
||||
@@ -213,7 +222,7 @@
|
||||
|
||||
public static <T extends IProjectile> T spawnProjectile(T t0, WorldServer worldserver, ItemStack itemstack, Consumer<T> consumer) {
|
||||
consumer.accept(t0);
|
||||
- worldserver.addFreshEntity(t0);
|
||||
+ if (worldserver.addFreshEntity(t0)) // CraftBukkit
|
||||
t0.applyOnProjectileSpawned(worldserver, itemstack);
|
||||
return t0;
|
||||
}
|
||||
@@ -232,6 +241,17 @@
|
||||
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - call projectile hit event
|
||||
+ protected ProjectileDeflection preHitTargetOrDeflectSelf(MovingObjectPosition movingobjectposition) {
|
||||
+ org.bukkit.event.entity.ProjectileHitEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this, movingobjectposition);
|
||||
+ this.hitCancelled = event != null && event.isCancelled();
|
||||
+ if (movingobjectposition.getType() == MovingObjectPosition.EnumMovingObjectType.BLOCK || !this.hitCancelled) {
|
||||
+ return this.hitTargetOrDeflectSelf(movingobjectposition);
|
||||
+ }
|
||||
+ return ProjectileDeflection.NONE;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
protected ProjectileDeflection hitTargetOrDeflectSelf(MovingObjectPosition movingobjectposition) {
|
||||
if (movingobjectposition.getType() == MovingObjectPosition.EnumMovingObjectType.ENTITY) {
|
||||
MovingObjectPositionEntity movingobjectpositionentity = (MovingObjectPositionEntity) movingobjectposition;
|
||||
@@ -309,6 +329,11 @@
|
||||
protected void onHitEntity(MovingObjectPositionEntity movingobjectpositionentity) {}
|
||||
|
||||
protected void onHitBlock(MovingObjectPositionBlock movingobjectpositionblock) {
|
||||
+ // CraftBukkit start - cancellable hit event
|
||||
+ if (hitCancelled) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
IBlockData iblockdata = this.level().getBlockState(movingobjectpositionblock.getBlockPos());
|
||||
|
||||
iblockdata.onProjectileHit(this.level(), iblockdata, movingobjectpositionblock, this);
|
||||
@@ -0,0 +1,56 @@
|
||||
--- a/net/minecraft/world/entity/projectile/LargeFireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/LargeFireball.java
|
||||
@@ -12,6 +12,10 @@
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
+// CraftBukkit end
|
||||
|
||||
public class LargeFireball extends Fireball {
|
||||
|
||||
@@ -19,11 +23,13 @@
|
||||
|
||||
public LargeFireball(EntityType<? extends LargeFireball> type, Level world) {
|
||||
super(type, world);
|
||||
+ this.isIncendiary = (world instanceof ServerLevel worldserver) && worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // CraftBukkit
|
||||
}
|
||||
|
||||
public LargeFireball(Level world, LivingEntity owner, Vec3 velocity, int explosionPower) {
|
||||
super(EntityType.FIREBALL, owner, velocity, world);
|
||||
this.explosionPower = explosionPower;
|
||||
+ this.isIncendiary = (world instanceof ServerLevel worldserver) && worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -34,8 +40,16 @@
|
||||
if (world instanceof ServerLevel worldserver) {
|
||||
boolean flag = worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
|
||||
- this.level().explode(this, this.getX(), this.getY(), this.getZ(), (float) this.explosionPower, flag, Level.ExplosionInteraction.MOB);
|
||||
- this.discard();
|
||||
+ // 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(), Level.ExplosionInteraction.MOB);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
|
||||
}
|
||||
@@ -65,7 +79,8 @@
|
||||
public void readAdditionalSaveData(CompoundTag nbt) {
|
||||
super.readAdditionalSaveData(nbt);
|
||||
if (nbt.contains("ExplosionPower", 99)) {
|
||||
- this.explosionPower = nbt.getByte("ExplosionPower");
|
||||
+ // CraftBukkit - set bukkitYield when setting explosionpower
|
||||
+ this.bukkitYield = this.explosionPower = nbt.getByte("ExplosionPower");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +1,28 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityLlamaSpit.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityLlamaSpit.java
|
||||
@@ -18,6 +18,10 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
--- a/net/minecraft/world/entity/projectile/LlamaSpit.java
|
||||
+++ b/net/minecraft/world/entity/projectile/LlamaSpit.java
|
||||
@@ -17,6 +17,9 @@
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityLlamaSpit extends IProjectile {
|
||||
|
||||
public EntityLlamaSpit(EntityTypes<? extends EntityLlamaSpit> entitytypes, World world) {
|
||||
@@ -41,7 +45,7 @@
|
||||
Vec3D vec3d = this.getDeltaMovement();
|
||||
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResultOnMoveVector(this, this::canHitEntity);
|
||||
public class LlamaSpit extends Projectile {
|
||||
|
||||
@@ -41,7 +44,7 @@
|
||||
Vec3 vec3d = this.getDeltaMovement();
|
||||
HitResult movingobjectposition = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity);
|
||||
|
||||
- this.hitTargetOrDeflectSelf(movingobjectposition);
|
||||
+ this.preHitTargetOrDeflectSelf(movingobjectposition); // CraftBukkit - projectile hit event
|
||||
double d0 = this.getX() + vec3d.x;
|
||||
double d1 = this.getY() + vec3d.y;
|
||||
double d2 = this.getZ() + vec3d.z;
|
||||
@@ -50,9 +54,9 @@
|
||||
@@ -50,9 +53,9 @@
|
||||
float f = 0.99F;
|
||||
|
||||
if (this.level().getBlockStates(this.getBoundingBox()).noneMatch(BlockBase.BlockData::isAir)) {
|
||||
if (this.level().getBlockStates(this.getBoundingBox()).noneMatch(BlockBehaviour.BlockStateBase::isAir)) {
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
||||
} else if (this.isInWaterOrBubble()) {
|
||||
@@ -32,9 +31,9 @@
|
||||
} else {
|
||||
this.setDeltaMovement(vec3d.scale(0.9900000095367432D));
|
||||
this.applyGravity();
|
||||
@@ -83,7 +87,7 @@
|
||||
protected void onHitBlock(MovingObjectPositionBlock movingobjectpositionblock) {
|
||||
super.onHitBlock(movingobjectpositionblock);
|
||||
@@ -83,7 +86,7 @@
|
||||
protected void onHitBlock(BlockHitResult blockHitResult) {
|
||||
super.onHitBlock(blockHitResult);
|
||||
if (!this.level().isClientSide) {
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
||||
@@ -0,0 +1,71 @@
|
||||
--- a/net/minecraft/world/entity/projectile/Projectile.java
|
||||
+++ b/net/minecraft/world/entity/projectile/Projectile.java
|
||||
@@ -35,6 +35,9 @@
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.projectiles.ProjectileSource;
|
||||
+// CraftBukkit end
|
||||
|
||||
public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
|
||||
@@ -47,6 +50,10 @@
|
||||
@Nullable
|
||||
private Entity lastDeflectedBy;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ protected boolean hitCancelled = false;
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
Projectile(EntityType<? extends Projectile> type, Level world) {
|
||||
super(type, world);
|
||||
}
|
||||
@@ -56,6 +63,7 @@
|
||||
this.ownerUUID = entity.getUUID();
|
||||
this.cachedOwner = entity;
|
||||
}
|
||||
+ this.projectileSource = (entity != null && entity.getBukkitEntity() instanceof ProjectileSource) ? (ProjectileSource) entity.getBukkitEntity() : null; // CraftBukkit
|
||||
|
||||
}
|
||||
|
||||
@@ -213,7 +221,7 @@
|
||||
|
||||
public static <T extends Projectile> T spawnProjectile(T projectile, ServerLevel world, ItemStack projectileStack, Consumer<T> beforeSpawn) {
|
||||
beforeSpawn.accept(projectile);
|
||||
- world.addFreshEntity(projectile);
|
||||
+ if (world.addFreshEntity(projectile)) // CraftBukkit
|
||||
projectile.applyOnProjectileSpawned(world, projectileStack);
|
||||
return projectile;
|
||||
}
|
||||
@@ -230,7 +238,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start - call projectile hit event
|
||||
+ protected ProjectileDeflection preHitTargetOrDeflectSelf(HitResult movingobjectposition) {
|
||||
+ org.bukkit.event.entity.ProjectileHitEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this, movingobjectposition);
|
||||
+ this.hitCancelled = event != null && event.isCancelled();
|
||||
+ if (movingobjectposition.getType() == HitResult.Type.BLOCK || !this.hitCancelled) {
|
||||
+ return this.hitTargetOrDeflectSelf(movingobjectposition);
|
||||
+ }
|
||||
+ return ProjectileDeflection.NONE;
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
protected ProjectileDeflection hitTargetOrDeflectSelf(HitResult hitResult) {
|
||||
if (hitResult.getType() == HitResult.Type.ENTITY) {
|
||||
@@ -309,6 +328,11 @@
|
||||
protected void onHitEntity(EntityHitResult entityHitResult) {}
|
||||
|
||||
protected void onHitBlock(BlockHitResult blockHitResult) {
|
||||
+ // CraftBukkit start - cancellable hit event
|
||||
+ if (this.hitCancelled) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
BlockState iblockdata = this.level().getBlockState(blockHitResult.getBlockPos());
|
||||
|
||||
iblockdata.onProjectileHit(this.level(), iblockdata, blockHitResult, this);
|
||||
@@ -0,0 +1,100 @@
|
||||
--- a/net/minecraft/world/entity/projectile/ShulkerBullet.java
|
||||
+++ b/net/minecraft/world/entity/projectile/ShulkerBullet.java
|
||||
@@ -31,6 +31,9 @@
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+// CraftBukkit end
|
||||
|
||||
public class ShulkerBullet extends Projectile {
|
||||
|
||||
@@ -60,8 +63,21 @@
|
||||
this.finalTarget = target;
|
||||
this.currentMoveDirection = Direction.UP;
|
||||
this.selectNextMoveDirection(axis);
|
||||
+ this.projectileSource = (org.bukkit.entity.LivingEntity) owner.getBukkitEntity(); // CraftBukkit
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public Entity getTarget() {
|
||||
+ return this.finalTarget;
|
||||
+ }
|
||||
+
|
||||
+ public void setTarget(Entity e) {
|
||||
+ this.finalTarget = e;
|
||||
+ this.currentMoveDirection = Direction.UP;
|
||||
+ this.selectNextMoveDirection(Direction.Axis.X);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@Override
|
||||
public SoundSource getSoundSource() {
|
||||
return SoundSource.HOSTILE;
|
||||
@@ -194,7 +210,7 @@
|
||||
@Override
|
||||
public void checkDespawn() {
|
||||
if (this.level().getDifficulty() == Difficulty.PEACEFUL) {
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
|
||||
}
|
||||
@@ -239,7 +255,7 @@
|
||||
}
|
||||
|
||||
if (movingobjectposition != null && this.isAlive() && movingobjectposition.getType() != HitResult.Type.MISS) {
|
||||
- this.hitTargetOrDeflectSelf(movingobjectposition);
|
||||
+ this.preHitTargetOrDeflectSelf(movingobjectposition); // CraftBukkit - projectile hit event
|
||||
}
|
||||
|
||||
ProjectileUtil.rotateTowardsMovement(this, 0.5F);
|
||||
@@ -312,7 +328,7 @@
|
||||
if (entity instanceof LivingEntity) {
|
||||
LivingEntity entityliving1 = (LivingEntity) entity;
|
||||
|
||||
- entityliving1.addEffect(new MobEffectInstance(MobEffects.LEVITATION, 200), (Entity) MoreObjects.firstNonNull(entity1, this));
|
||||
+ entityliving1.addEffect(new MobEffectInstance(MobEffects.LEVITATION, 200), (Entity) MoreObjects.firstNonNull(entity1, this), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,14 +342,20 @@
|
||||
}
|
||||
|
||||
private void destroy() {
|
||||
- this.discard();
|
||||
+ // CraftBukkit start - add Bukkit remove cause
|
||||
+ this.destroy(null);
|
||||
+ }
|
||||
+
|
||||
+ private void destroy(EntityRemoveEvent.Cause cause) {
|
||||
+ this.discard(cause);
|
||||
+ // CraftBukkit end
|
||||
this.level().gameEvent((Holder) GameEvent.ENTITY_DAMAGE, this.position(), GameEvent.Context.of((Entity) this));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onHit(HitResult hitResult) {
|
||||
super.onHit(hitResult);
|
||||
- this.destroy();
|
||||
+ this.destroy(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -348,9 +370,14 @@
|
||||
|
||||
@Override
|
||||
public boolean hurtServer(ServerLevel world, DamageSource source, float amount) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, source, amount, false)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.playSound(SoundEvents.SHULKER_BULLET_HURT, 1.0F, 1.0F);
|
||||
world.sendParticles(ParticleTypes.CRIT, this.getX(), this.getY(), this.getZ(), 15, 0.2D, 0.2D, 0.2D, 0.0D);
|
||||
- this.destroy();
|
||||
+ this.destroy(EntityRemoveEvent.Cause.DEATH); // CraftBukkit - add Bukkit remove cause
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,30 +1,29 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntitySmallFireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntitySmallFireball.java
|
||||
@@ -16,6 +16,11 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
--- a/net/minecraft/world/entity/projectile/SmallFireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/SmallFireball.java
|
||||
@@ -15,6 +15,10 @@
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntitySmallFireball extends EntityFireballFireball {
|
||||
|
||||
public EntitySmallFireball(EntityTypes<? extends EntitySmallFireball> entitytypes, World world) {
|
||||
@@ -24,6 +29,11 @@
|
||||
public class SmallFireball extends Fireball {
|
||||
|
||||
public EntitySmallFireball(World world, EntityLiving entityliving, Vec3D vec3d) {
|
||||
super(EntityTypes.SMALL_FIREBALL, entityliving, vec3d, world);
|
||||
@@ -24,6 +28,11 @@
|
||||
|
||||
public SmallFireball(Level world, LivingEntity owner, Vec3 velocity) {
|
||||
super(EntityType.SMALL_FIREBALL, owner, velocity, world);
|
||||
+ // CraftBukkit start
|
||||
+ if (this.getOwner() != null && this.getOwner() instanceof EntityInsentient) {
|
||||
+ isIncendiary = (world instanceof WorldServer worldserver) && worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
+ if (this.getOwner() != null && this.getOwner() instanceof Mob) {
|
||||
+ this.isIncendiary = (world instanceof ServerLevel worldserver) && worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public EntitySmallFireball(World world, double d0, double d1, double d2, Vec3D vec3d) {
|
||||
@@ -40,7 +50,14 @@
|
||||
public SmallFireball(Level world, double x, double y, double z, Vec3 velocity) {
|
||||
@@ -40,7 +49,14 @@
|
||||
Entity entity1 = this.getOwner();
|
||||
int i = entity.getRemainingFireTicks();
|
||||
|
||||
@@ -40,22 +39,22 @@
|
||||
DamageSource damagesource = this.damageSources().fireball(this, entity1);
|
||||
|
||||
if (!entity.hurtServer(worldserver, damagesource, 5.0F)) {
|
||||
@@ -60,10 +77,10 @@
|
||||
if (world instanceof WorldServer worldserver) {
|
||||
@@ -60,10 +76,10 @@
|
||||
if (world instanceof ServerLevel worldserver) {
|
||||
Entity entity = this.getOwner();
|
||||
|
||||
- if (!(entity instanceof EntityInsentient) || worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ if (isIncendiary) { // CraftBukkit
|
||||
BlockPosition blockposition = movingobjectpositionblock.getBlockPos().relative(movingobjectpositionblock.getDirection());
|
||||
- if (!(entity instanceof Mob) || worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ if (this.isIncendiary) { // CraftBukkit
|
||||
BlockPos blockposition = blockHitResult.getBlockPos().relative(blockHitResult.getDirection());
|
||||
|
||||
- if (this.level().isEmptyBlock(blockposition)) {
|
||||
+ if (this.level().isEmptyBlock(blockposition) && !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.level(), blockposition, this).isCancelled()) { // CraftBukkit
|
||||
this.level().setBlockAndUpdate(blockposition, BlockFireAbstract.getState(this.level(), blockposition));
|
||||
this.level().setBlockAndUpdate(blockposition, BaseFireBlock.getState(this.level(), blockposition));
|
||||
}
|
||||
}
|
||||
@@ -75,7 +92,7 @@
|
||||
protected void onHit(MovingObjectPosition movingobjectposition) {
|
||||
super.onHit(movingobjectposition);
|
||||
@@ -75,7 +91,7 @@
|
||||
protected void onHit(HitResult hitResult) {
|
||||
super.onHit(hitResult);
|
||||
if (!this.level().isClientSide) {
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
||||
@@ -0,0 +1,21 @@
|
||||
--- a/net/minecraft/world/entity/projectile/Snowball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/Snowball.java
|
||||
@@ -13,6 +13,9 @@
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+// CraftBukkit end
|
||||
|
||||
public class Snowball extends ThrowableItemProjectile {
|
||||
|
||||
@@ -65,7 +68,7 @@
|
||||
super.onHit(hitResult);
|
||||
if (!this.level().isClientSide) {
|
||||
this.level().broadcastEntityEvent(this, (byte) 3);
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/projectile/SpectralArrow.java
|
||||
+++ b/net/minecraft/world/entity/projectile/SpectralArrow.java
|
||||
@@ -41,7 +41,7 @@
|
||||
super.doPostHurtEffects(target);
|
||||
MobEffectInstance mobeffect = new MobEffectInstance(MobEffects.GLOWING, this.duration, 0);
|
||||
|
||||
- target.addEffect(mobeffect, this.getEffectSource());
|
||||
+ target.addEffect(mobeffect, this.getEffectSource(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +1,15 @@
|
||||
--- a/net/minecraft/world/entity/projectile/ThrowableItemProjectile.java
|
||||
+++ b/net/minecraft/world/entity/projectile/ThrowableItemProjectile.java
|
||||
@@ -34,6 +34,12 @@
|
||||
|
||||
protected abstract Item getDefaultItem();
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public Item getDefaultItemPublic() {
|
||||
+ return this.getDefaultItem();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@Override
|
||||
public ItemStack getItem() {
|
||||
return (ItemStack) this.getEntityData().get(ThrowableItemProjectile.DATA_ITEM_STACK);
|
||||
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityProjectile.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityProjectile.java
|
||||
--- a/net/minecraft/world/entity/projectile/ThrowableProjectile.java
|
||||
+++ b/net/minecraft/world/entity/projectile/ThrowableProjectile.java
|
||||
@@ -63,7 +63,7 @@
|
||||
this.applyEffectsFromBlocks();
|
||||
super.tick();
|
||||
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS && this.isAlive()) {
|
||||
if (movingobjectposition.getType() != HitResult.Type.MISS && this.isAlive()) {
|
||||
- this.hitTargetOrDeflectSelf(movingobjectposition);
|
||||
+ this.preHitTargetOrDeflectSelf(movingobjectposition); // CraftBukkit - projectile hit event
|
||||
}
|
||||
@@ -1,25 +1,56 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityEgg.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityEgg.java
|
||||
@@ -14,6 +14,16 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
--- a/net/minecraft/world/entity/projectile/ThrownEgg.java
|
||||
+++ b/net/minecraft/world/entity/projectile/ThrownEgg.java
|
||||
@@ -1,33 +1,39 @@
|
||||
package net.minecraft.world.entity.projectile;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.server.level.EntityPlayer;
|
||||
-import net.minecraft.core.particles.ItemParticleOption;
|
||||
-import net.minecraft.core.particles.ParticleTypes;
|
||||
-import net.minecraft.world.entity.EntityDimensions;
|
||||
import net.minecraft.world.entity.EntitySpawnReason;
|
||||
-import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
-import net.minecraft.world.entity.animal.Chicken;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
+import net.minecraft.core.particles.ItemParticleOption;
|
||||
+import net.minecraft.core.particles.ParticleTypes;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import net.minecraft.world.entity.Entity;
|
||||
+import net.minecraft.world.entity.EntityDimensions;
|
||||
+import org.bukkit.entity.Ageable;
|
||||
+import org.bukkit.entity.EntityType;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+import org.bukkit.event.player.PlayerEggThrowEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityEgg extends EntityProjectileThrowable {
|
||||
|
||||
private static final EntitySize ZERO_SIZED_DIMENSIONS = EntitySize.fixed(0.0F, 0.0F);
|
||||
@@ -52,30 +62,58 @@
|
||||
protected void onHit(MovingObjectPosition movingobjectposition) {
|
||||
super.onHit(movingobjectposition);
|
||||
public class ThrownEgg extends ThrowableItemProjectile {
|
||||
|
||||
private static final EntityDimensions ZERO_SIZED_DIMENSIONS = EntityDimensions.fixed(0.0F, 0.0F);
|
||||
|
||||
- public ThrownEgg(EntityType<? extends ThrownEgg> type, Level world) {
|
||||
+ public ThrownEgg(net.minecraft.world.entity.EntityType<? extends ThrownEgg> type, Level world) {
|
||||
super(type, world);
|
||||
}
|
||||
|
||||
public ThrownEgg(Level world, LivingEntity owner, ItemStack stack) {
|
||||
- super(EntityType.EGG, owner, world, stack);
|
||||
+ super(net.minecraft.world.entity.EntityType.EGG, owner, world, stack);
|
||||
}
|
||||
|
||||
public ThrownEgg(Level world, double x, double y, double z, ItemStack stack) {
|
||||
- super(EntityType.EGG, x, y, z, world, stack);
|
||||
+ super(net.minecraft.world.entity.EntityType.EGG, x, y, z, world, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -52,30 +58,58 @@
|
||||
protected void onHit(HitResult hitResult) {
|
||||
super.onHit(hitResult);
|
||||
if (!this.level().isClientSide) {
|
||||
- if (this.random.nextInt(8) == 0) {
|
||||
+ // CraftBukkit start
|
||||
@@ -39,7 +70,7 @@
|
||||
+ if (!hatching) {
|
||||
+ b0 = 0;
|
||||
+ }
|
||||
+ if (shooter instanceof EntityPlayer) {
|
||||
+ if (shooter instanceof ServerPlayer) {
|
||||
+ PlayerEggThrowEvent event = new PlayerEggThrowEvent((Player) shooter.getBukkitEntity(), (org.bukkit.entity.Egg) this.getBukkitEntity(), hatching, b0, hatchingType);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
@@ -54,7 +85,7 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
for (int i = 0; i < b0; ++i) {
|
||||
- EntityChicken entitychicken = (EntityChicken) EntityTypes.CHICKEN.create(this.level(), EntitySpawnReason.TRIGGERED);
|
||||
- Chicken entitychicken = (Chicken) EntityType.CHICKEN.create(this.level(), EntitySpawnReason.TRIGGERED);
|
||||
+ Entity entitychicken = this.level().getWorld().makeEntity(new org.bukkit.Location(this.level().getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F), hatchingType.getEntityClass()); // CraftBukkit
|
||||
|
||||
if (entitychicken != null) {
|
||||
@@ -65,7 +96,7 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entitychicken.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F);
|
||||
if (!entitychicken.fudgePositionAfterSizeChange(EntityEgg.ZERO_SIZED_DIMENSIONS)) {
|
||||
if (!entitychicken.fudgePositionAfterSizeChange(ThrownEgg.ZERO_SIZED_DIMENSIONS)) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,32 +1,34 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityEnderPearl.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityEnderPearl.java
|
||||
@@ -29,6 +29,13 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.world.level.dimension.WorldDimension;
|
||||
--- a/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
|
||||
+++ b/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
|
||||
@@ -24,10 +24,15 @@
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
+import net.minecraft.world.level.dimension.LevelStem;
|
||||
import net.minecraft.world.level.portal.TeleportTransition;
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityEnderPearl extends EntityProjectileThrowable {
|
||||
|
||||
private long ticketTimer = 0L;
|
||||
@@ -140,12 +147,19 @@
|
||||
EntityPlayer entityplayer = (EntityPlayer) entity;
|
||||
public class ThrownEnderpearl extends ThrowableItemProjectile {
|
||||
|
||||
@@ -140,12 +145,19 @@
|
||||
ServerPlayer entityplayer = (ServerPlayer) entity;
|
||||
|
||||
if (entityplayer.connection.isAcceptingMessages()) {
|
||||
+ // CraftBukkit start
|
||||
+ EntityPlayer entityplayer1 = entityplayer.teleport(new TeleportTransition(worldserver, vec3d, Vec3D.ZERO, 0.0F, 0.0F, Relative.union(Relative.ROTATION, Relative.DELTA), TeleportTransition.DO_NOTHING, PlayerTeleportEvent.TeleportCause.ENDER_PEARL));
|
||||
+ ServerPlayer entityplayer1 = entityplayer.teleport(new TeleportTransition(worldserver, vec3d, Vec3.ZERO, 0.0F, 0.0F, Relative.union(Relative.ROTATION, Relative.DELTA), TeleportTransition.DO_NOTHING, PlayerTeleportEvent.TeleportCause.ENDER_PEARL));
|
||||
+ if (entityplayer1 == null) {
|
||||
+ this.discard(EntityRemoveEvent.Cause.HIT);
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (this.random.nextFloat() < 0.05F && worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) {
|
||||
EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.create(worldserver, EntitySpawnReason.TRIGGERED);
|
||||
Endermite entityendermite = (Endermite) EntityType.ENDERMITE.create(worldserver, EntitySpawnReason.TRIGGERED);
|
||||
|
||||
if (entityendermite != null) {
|
||||
entityendermite.moveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot());
|
||||
@@ -35,11 +37,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,12 +167,12 @@
|
||||
@@ -153,12 +165,12 @@
|
||||
entity.setPortalCooldown();
|
||||
}
|
||||
|
||||
- EntityPlayer entityplayer1 = entityplayer.teleport(new TeleportTransition(worldserver, vec3d, Vec3D.ZERO, 0.0F, 0.0F, Relative.union(Relative.ROTATION, Relative.DELTA), TeleportTransition.DO_NOTHING));
|
||||
- ServerPlayer entityplayer1 = entityplayer.teleport(new TeleportTransition(worldserver, vec3d, Vec3.ZERO, 0.0F, 0.0F, Relative.union(Relative.ROTATION, Relative.DELTA), TeleportTransition.DO_NOTHING));
|
||||
+ // EntityPlayer entityplayer1 = entityplayer.teleport(new TeleportTransition(worldserver, vec3d, Vec3D.ZERO, 0.0F, 0.0F, Relative.union(Relative.ROTATION, Relative.DELTA), TeleportTransition.DO_NOTHING)); // CraftBukkit - moved up
|
||||
|
||||
if (entityplayer1 != null) {
|
||||
@@ -50,7 +52,7 @@
|
||||
}
|
||||
|
||||
this.playSound(worldserver, vec3d);
|
||||
@@ -173,11 +187,11 @@
|
||||
@@ -173,11 +185,11 @@
|
||||
this.playSound(worldserver, vec3d);
|
||||
}
|
||||
|
||||
@@ -64,21 +66,21 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -210,7 +224,7 @@
|
||||
@@ -210,7 +222,7 @@
|
||||
entity = this.getOwner();
|
||||
if (entity instanceof EntityPlayer entityplayer) {
|
||||
if (entity instanceof ServerPlayer entityplayer) {
|
||||
if (!entity.isAlive() && entityplayer.serverLevel().getGameRules().getBoolean(GameRules.RULE_ENDER_PEARLS_VANISH_ON_DEATH)) {
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
||||
break label30;
|
||||
}
|
||||
}
|
||||
@@ -248,7 +262,7 @@
|
||||
@@ -248,7 +260,7 @@
|
||||
|
||||
@Override
|
||||
public boolean canTeleport(World world, World world1) {
|
||||
- if (world.dimension() == World.END && world1.dimension() == World.OVERWORLD) {
|
||||
+ if (world.getTypeKey() == WorldDimension.END && world1.getTypeKey() == WorldDimension.OVERWORLD) { // CraftBukkit
|
||||
public boolean canTeleport(Level from, Level to) {
|
||||
- if (from.dimension() == Level.END && to.dimension() == Level.OVERWORLD) {
|
||||
+ if (from.getTypeKey() == LevelStem.END && to.getTypeKey() == LevelStem.OVERWORLD) { // CraftBukkit
|
||||
Entity entity = this.getOwner();
|
||||
|
||||
if (entity instanceof EntityPlayer) {
|
||||
if (entity instanceof ServerPlayer) {
|
||||
@@ -1,34 +1,33 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityThrownExpBottle.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityThrownExpBottle.java
|
||||
@@ -10,6 +10,10 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
|
||||
--- a/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java
|
||||
+++ b/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java
|
||||
@@ -9,6 +9,9 @@
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityThrownExpBottle extends EntityProjectileThrowable {
|
||||
|
||||
public EntityThrownExpBottle(EntityTypes<? extends EntityThrownExpBottle> entitytypes, World world) {
|
||||
@@ -38,11 +42,20 @@
|
||||
protected void onHit(MovingObjectPosition movingobjectposition) {
|
||||
super.onHit(movingobjectposition);
|
||||
if (this.level() instanceof WorldServer) {
|
||||
public class ThrownExperienceBottle extends ThrowableItemProjectile {
|
||||
|
||||
@@ -38,11 +41,20 @@
|
||||
protected void onHit(HitResult hitResult) {
|
||||
super.onHit(hitResult);
|
||||
if (this.level() instanceof ServerLevel) {
|
||||
- this.level().levelEvent(2002, this.blockPosition(), -13083194);
|
||||
+ // CraftBukkit - moved to after event
|
||||
+ // this.level().levelEvent(2002, this.blockPosition(), -13083194);
|
||||
int i = 3 + this.level().random.nextInt(5) + this.level().random.nextInt(5);
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.ExpBottleEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callExpBottleEvent(this, movingobjectposition, i);
|
||||
+ org.bukkit.event.entity.ExpBottleEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callExpBottleEvent(this, hitResult, i);
|
||||
+ i = event.getExperience();
|
||||
+ if (event.getShowEffect()) {
|
||||
+ this.level().levelEvent(2002, this.blockPosition(), -13083194);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
EntityExperienceOrb.award((WorldServer) this.level(), this.position(), i);
|
||||
ExperienceOrb.award((ServerLevel) this.level(), this.position(), i);
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
@@ -0,0 +1,250 @@
|
||||
--- a/net/minecraft/world/entity/projectile/ThrownPotion.java
|
||||
+++ b/net/minecraft/world/entity/projectile/ThrownPotion.java
|
||||
@@ -10,6 +10,7 @@
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
@@ -17,7 +18,6 @@
|
||||
import net.minecraft.world.entity.AreaEffectCloud;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
-import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.animal.axolotl.Axolotl;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
@@ -28,18 +28,28 @@
|
||||
import net.minecraft.world.item.alchemy.Potions;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.AbstractCandleBlock;
|
||||
+// CraftBukkit start
|
||||
+import java.util.HashMap;
|
||||
+import java.util.Map;
|
||||
+import net.minecraft.world.effect.MobEffects;
|
||||
+import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.CampfireBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+// CraftBukkit end
|
||||
|
||||
public class ThrownPotion extends ThrowableItemProjectile {
|
||||
|
||||
public static final double SPLASH_RANGE = 4.0D;
|
||||
private static final double SPLASH_RANGE_SQ = 16.0D;
|
||||
- public static final Predicate<LivingEntity> WATER_SENSITIVE_OR_ON_FIRE = (entityliving) -> {
|
||||
+ public static final Predicate<net.minecraft.world.entity.LivingEntity> WATER_SENSITIVE_OR_ON_FIRE = (entityliving) -> {
|
||||
return entityliving.isSensitiveToWater() || entityliving.isOnFire();
|
||||
};
|
||||
|
||||
@@ -47,7 +57,7 @@
|
||||
super(type, world);
|
||||
}
|
||||
|
||||
- public ThrownPotion(Level world, LivingEntity owner, ItemStack stack) {
|
||||
+ public ThrownPotion(Level world, net.minecraft.world.entity.LivingEntity owner, ItemStack stack) {
|
||||
super(EntityType.POTION, owner, world, stack);
|
||||
}
|
||||
|
||||
@@ -101,28 +111,28 @@
|
||||
|
||||
if (potioncontents.is(Potions.WATER)) {
|
||||
this.applyWater(worldserver);
|
||||
- } else if (potioncontents.hasEffects()) {
|
||||
+ } else if (true || potioncontents.hasEffects()) { // CraftBukkit - Call event even if no effects to apply
|
||||
if (this.isLingering()) {
|
||||
- this.makeAreaOfEffectCloud(potioncontents);
|
||||
+ this.makeAreaOfEffectCloud(potioncontents, hitResult); // CraftBukkit - Pass MovingObjectPosition
|
||||
} else {
|
||||
- this.applySplash(worldserver, potioncontents.getAllEffects(), hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null);
|
||||
+ this.applySplash(worldserver, potioncontents.getAllEffects(), hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition
|
||||
}
|
||||
}
|
||||
|
||||
int i = potioncontents.potion().isPresent() && ((Potion) ((Holder) potioncontents.potion().get()).value()).hasInstantEffects() ? 2007 : 2002;
|
||||
|
||||
worldserver.levelEvent(i, this.blockPosition(), potioncontents.getColor());
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
}
|
||||
|
||||
private void applyWater(ServerLevel world) {
|
||||
AABB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D);
|
||||
- List<LivingEntity> list = this.level().getEntitiesOfClass(LivingEntity.class, axisalignedbb, ThrownPotion.WATER_SENSITIVE_OR_ON_FIRE);
|
||||
+ List<net.minecraft.world.entity.LivingEntity> list = this.level().getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb, ThrownPotion.WATER_SENSITIVE_OR_ON_FIRE);
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
- LivingEntity entityliving = (LivingEntity) iterator.next();
|
||||
+ net.minecraft.world.entity.LivingEntity entityliving = (net.minecraft.world.entity.LivingEntity) iterator.next();
|
||||
double d0 = this.distanceToSqr((Entity) entityliving);
|
||||
|
||||
if (d0 < 16.0D) {
|
||||
@@ -147,16 +157,17 @@
|
||||
|
||||
}
|
||||
|
||||
- private void applySplash(ServerLevel world, Iterable<MobEffectInstance> effects, @Nullable Entity entity) {
|
||||
+ private void applySplash(ServerLevel worldserver, Iterable<MobEffectInstance> iterable, @Nullable Entity entity, HitResult position) { // CraftBukkit - Pass MovingObjectPosition
|
||||
AABB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D);
|
||||
- List<LivingEntity> list = world.getEntitiesOfClass(LivingEntity.class, axisalignedbb);
|
||||
+ List<net.minecraft.world.entity.LivingEntity> list = worldserver.getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb);
|
||||
+ Map<LivingEntity, Double> affected = new HashMap<LivingEntity, Double>(); // CraftBukkit
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
Entity entity1 = this.getEffectSource();
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
- LivingEntity entityliving = (LivingEntity) iterator.next();
|
||||
+ net.minecraft.world.entity.LivingEntity entityliving = (net.minecraft.world.entity.LivingEntity) iterator.next();
|
||||
|
||||
if (entityliving.isAffectedByPotions()) {
|
||||
double d0 = this.distanceToSqr((Entity) entityliving);
|
||||
@@ -170,37 +181,63 @@
|
||||
d1 = 1.0D - Math.sqrt(d0) / 4.0D;
|
||||
}
|
||||
|
||||
- Iterator iterator1 = effects.iterator();
|
||||
+ // CraftBukkit start
|
||||
+ affected.put((LivingEntity) entityliving.getBukkitEntity(), d1);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- while (iterator1.hasNext()) {
|
||||
- MobEffectInstance mobeffect = (MobEffectInstance) iterator1.next();
|
||||
- Holder<MobEffect> holder = mobeffect.getEffect();
|
||||
+ org.bukkit.event.entity.PotionSplashEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPotionSplashEvent(this, position, affected);
|
||||
+ if (!event.isCancelled() && list != null && !list.isEmpty()) { // do not process effects if there are no effects to process
|
||||
+ Entity entity1 = this.getEffectSource();
|
||||
+ for (LivingEntity victim : event.getAffectedEntities()) {
|
||||
+ if (!(victim instanceof CraftLivingEntity)) {
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
- if (((MobEffect) holder.value()).isInstantenous()) {
|
||||
- ((MobEffect) holder.value()).applyInstantenousEffect(world, this, this.getOwner(), entityliving, mobeffect.getAmplifier(), d1);
|
||||
- } else {
|
||||
- int i = mobeffect.mapDuration((j) -> {
|
||||
- return (int) (d1 * (double) j + 0.5D);
|
||||
- });
|
||||
- MobEffectInstance mobeffect1 = new MobEffectInstance(holder, i, mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible());
|
||||
+ net.minecraft.world.entity.LivingEntity entityliving = ((CraftLivingEntity) victim).getHandle();
|
||||
+ double d1 = event.getIntensity(victim);
|
||||
+ // CraftBukkit end
|
||||
|
||||
- if (!mobeffect1.endsWithin(20)) {
|
||||
- entityliving.addEffect(mobeffect1, entity1);
|
||||
- }
|
||||
- }
|
||||
+ Iterator iterator1 = iterable.iterator();
|
||||
+
|
||||
+ while (iterator1.hasNext()) {
|
||||
+ MobEffectInstance mobeffect = (MobEffectInstance) iterator1.next();
|
||||
+ Holder<MobEffect> holder = mobeffect.getEffect();
|
||||
+ // CraftBukkit start - Abide by PVP settings - for players only!
|
||||
+ if (!this.level().pvpMode && this.getOwner() instanceof ServerPlayer && entityliving instanceof ServerPlayer && entityliving != this.getOwner()) {
|
||||
+ MobEffect mobeffectlist = (MobEffect) holder.value();
|
||||
+ if (mobeffectlist == MobEffects.MOVEMENT_SLOWDOWN || mobeffectlist == MobEffects.DIG_SLOWDOWN || mobeffectlist == MobEffects.HARM || mobeffectlist == MobEffects.BLINDNESS
|
||||
+ || mobeffectlist == MobEffects.HUNGER || mobeffectlist == MobEffects.WEAKNESS || mobeffectlist == MobEffects.POISON) {
|
||||
+ continue;
|
||||
}
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ if (((MobEffect) holder.value()).isInstantenous()) {
|
||||
+ ((MobEffect) holder.value()).applyInstantenousEffect(worldserver, this, this.getOwner(), entityliving, mobeffect.getAmplifier(), d1);
|
||||
+ } else {
|
||||
+ int i = mobeffect.mapDuration((j) -> {
|
||||
+ return (int) (d1 * (double) j + 0.5D);
|
||||
+ });
|
||||
+ MobEffectInstance mobeffect1 = new MobEffectInstance(holder, i, mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible());
|
||||
+
|
||||
+ if (!mobeffect1.endsWithin(20)) {
|
||||
+ entityliving.addEffect(mobeffect1, entity1, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.POTION_SPLASH); // CraftBukkit
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- private void makeAreaOfEffectCloud(PotionContents potion) {
|
||||
+ private void makeAreaOfEffectCloud(PotionContents potioncontents, HitResult position) { // CraftBukkit - Pass MovingObjectPosition
|
||||
AreaEffectCloud entityareaeffectcloud = new AreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ());
|
||||
Entity entity = this.getOwner();
|
||||
|
||||
- if (entity instanceof LivingEntity entityliving) {
|
||||
+ if (entity instanceof net.minecraft.world.entity.LivingEntity entityliving) {
|
||||
entityareaeffectcloud.setOwner(entityliving);
|
||||
}
|
||||
|
||||
@@ -208,8 +245,15 @@
|
||||
entityareaeffectcloud.setRadiusOnUse(-0.5F);
|
||||
entityareaeffectcloud.setWaitTime(10);
|
||||
entityareaeffectcloud.setRadiusPerTick(-entityareaeffectcloud.getRadius() / (float) entityareaeffectcloud.getDuration());
|
||||
- entityareaeffectcloud.setPotionContents(potion);
|
||||
- this.level().addFreshEntity(entityareaeffectcloud);
|
||||
+ entityareaeffectcloud.setPotionContents(potioncontents);
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.LingeringPotionSplashEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callLingeringPotionSplashEvent(this, position, entityareaeffectcloud);
|
||||
+ if (!(event.isCancelled() || entityareaeffectcloud.isRemoved())) {
|
||||
+ this.level().addFreshEntity(entityareaeffectcloud);
|
||||
+ } else {
|
||||
+ entityareaeffectcloud.discard(null); // CraftBukkit - add Bukkit remove cause
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public boolean isLingering() {
|
||||
@@ -220,19 +264,31 @@
|
||||
BlockState iblockdata = this.level().getBlockState(pos);
|
||||
|
||||
if (iblockdata.is(BlockTags.FIRE)) {
|
||||
- this.level().destroyBlock(pos, false, this);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, pos, Blocks.AIR.defaultBlockState())) {
|
||||
+ this.level().destroyBlock(pos, false, this);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else if (AbstractCandleBlock.isLit(iblockdata)) {
|
||||
- AbstractCandleBlock.extinguish((Player) null, iblockdata, this.level(), pos);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, pos, iblockdata.setValue(AbstractCandleBlock.LIT, false))) {
|
||||
+ AbstractCandleBlock.extinguish((Player) null, iblockdata, this.level(), pos);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else if (CampfireBlock.isLitCampfire(iblockdata)) {
|
||||
- this.level().levelEvent((Player) null, 1009, pos, 0);
|
||||
- CampfireBlock.dowse(this.getOwner(), this.level(), pos, iblockdata);
|
||||
- this.level().setBlockAndUpdate(pos, (BlockState) iblockdata.setValue(CampfireBlock.LIT, false));
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, pos, iblockdata.setValue(CampfireBlock.LIT, false))) {
|
||||
+ this.level().levelEvent((Player) null, 1009, pos, 0);
|
||||
+ CampfireBlock.dowse(this.getOwner(), this.level(), pos, iblockdata);
|
||||
+ this.level().setBlockAndUpdate(pos, (BlockState) iblockdata.setValue(CampfireBlock.LIT, false));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
- public DoubleDoubleImmutablePair calculateHorizontalHurtKnockbackDirection(LivingEntity target, DamageSource source) {
|
||||
+ public DoubleDoubleImmutablePair calculateHorizontalHurtKnockbackDirection(net.minecraft.world.entity.LivingEntity target, DamageSource source) {
|
||||
double d0 = target.position().x - this.position().x;
|
||||
double d1 = target.position().z - this.position().z;
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
--- a/net/minecraft/world/entity/projectile/ThrownTrident.java
|
||||
+++ b/net/minecraft/world/entity/projectile/ThrownTrident.java
|
||||
@@ -23,6 +23,9 @@
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+// CraftBukkit end
|
||||
|
||||
public class ThrownTrident extends AbstractArrow {
|
||||
|
||||
@@ -76,10 +79,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.DROP); // CraftBukkit - add Bukkit remove cause
|
||||
} else {
|
||||
if (!(entity instanceof Player) && this.position().distanceTo(entity.getEyePosition()) < (double) entity.getBbWidth() + 1.0D) {
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -137,7 +140,7 @@
|
||||
|
||||
world = this.level();
|
||||
if (world instanceof ServerLevel) {
|
||||
- worldserver = (ServerLevel) world;
|
||||
+ ServerLevel worldserver = (ServerLevel) world; // CraftBukkit - decompile error
|
||||
EnchantmentHelper.doPostAttackEffectsWithItemSourceOnBreak(worldserver, entity, damagesource, this.getWeaponItem(), (item) -> {
|
||||
this.kill(worldserver);
|
||||
});
|
||||
@@ -1,40 +1,39 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityWitherSkull.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityWitherSkull.java
|
||||
@@ -24,6 +24,11 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
--- a/net/minecraft/world/entity/projectile/WitherSkull.java
|
||||
+++ b/net/minecraft/world/entity/projectile/WitherSkull.java
|
||||
@@ -23,6 +23,10 @@
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityWitherSkull extends EntityFireball {
|
||||
|
||||
private static final DataWatcherObject<Boolean> DATA_DANGEROUS = DataWatcher.defineId(EntityWitherSkull.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -69,7 +74,7 @@
|
||||
public class WitherSkull extends AbstractHurtingProjectile {
|
||||
|
||||
@@ -69,7 +73,7 @@
|
||||
if (entity.isAlive()) {
|
||||
EnchantmentManager.doPostAttackEffects(worldserver, entity, damagesource);
|
||||
EnchantmentHelper.doPostAttackEffects(worldserver, entity, damagesource);
|
||||
} else {
|
||||
- entityliving.heal(5.0F);
|
||||
+ entityliving.heal(5.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER); // CraftBukkit
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -86,7 +91,7 @@
|
||||
@@ -86,7 +90,7 @@
|
||||
}
|
||||
|
||||
if (b0 > 0) {
|
||||
- entityliving.addEffect(new MobEffect(MobEffects.WITHER, 20 * b0, 1), this.getEffectSource());
|
||||
+ entityliving.addEffect(new MobEffect(MobEffects.WITHER, 20 * b0, 1), this.getEffectSource(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
- entityliving.addEffect(new MobEffectInstance(MobEffects.WITHER, 20 * b0, 1), this.getEffectSource());
|
||||
+ entityliving.addEffect(new MobEffectInstance(MobEffects.WITHER, 20 * b0, 1), this.getEffectSource(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,8 +102,16 @@
|
||||
protected void onHit(MovingObjectPosition movingobjectposition) {
|
||||
super.onHit(movingobjectposition);
|
||||
@@ -97,8 +101,16 @@
|
||||
protected void onHit(HitResult hitResult) {
|
||||
super.onHit(hitResult);
|
||||
if (!this.level().isClientSide) {
|
||||
- this.level().explode(this, this.getX(), this.getY(), this.getZ(), 1.0F, false, World.a.MOB);
|
||||
- this.level().explode(this, this.getX(), this.getY(), this.getZ(), 1.0F, false, Level.ExplosionInteraction.MOB);
|
||||
- this.discard();
|
||||
+ // CraftBukkit start
|
||||
+ // this.level().explode(this, this.getX(), this.getY(), this.getZ(), 1.0F, false, World.a.MOB);
|
||||
@@ -42,7 +41,7 @@
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.level().explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.MOB);
|
||||
+ this.level().explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
||||
@@ -1,18 +1,17 @@
|
||||
--- a/net/minecraft/world/entity/projectile/windcharge/AbstractWindCharge.java
|
||||
+++ b/net/minecraft/world/entity/projectile/windcharge/AbstractWindCharge.java
|
||||
@@ -25,6 +25,10 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class AbstractWindCharge extends EntityFireball implements ItemSupplier {
|
||||
|
||||
public static final ExplosionDamageCalculator EXPLOSION_DAMAGE_CALCULATOR = new SimpleExplosionDamageCalculator(true, false, Optional.empty(), BuiltInRegistries.BLOCK.get(TagsBlock.BLOCKS_WIND_CHARGE_EXPLOSIONS).map(Function.identity()));
|
||||
@@ -111,7 +115,7 @@
|
||||
Vec3D vec3d1 = movingobjectpositionblock.getLocation().add(vec3d);
|
||||
public abstract class AbstractWindCharge extends AbstractHurtingProjectile implements ItemSupplier {
|
||||
|
||||
@@ -111,7 +114,7 @@
|
||||
Vec3 vec3d1 = blockHitResult.getLocation().add(vec3d);
|
||||
|
||||
this.explode(vec3d1);
|
||||
- this.discard();
|
||||
@@ -20,16 +19,16 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -120,7 +124,7 @@
|
||||
protected void onHit(MovingObjectPosition movingobjectposition) {
|
||||
super.onHit(movingobjectposition);
|
||||
@@ -120,7 +123,7 @@
|
||||
protected void onHit(HitResult hitResult) {
|
||||
super.onHit(hitResult);
|
||||
if (!this.level().isClientSide) {
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
|
||||
}
|
||||
@@ -155,7 +159,7 @@
|
||||
@@ -155,7 +158,7 @@
|
||||
public void tick() {
|
||||
if (!this.level().isClientSide && this.getBlockY() > this.level().getMaxY() + 30) {
|
||||
this.explode(this.position());
|
||||
Reference in New Issue
Block a user