@@ -0,0 +1,54 @@
|
||||
--- a/net/minecraft/server/EntityArrow.java
|
||||
+++ b/net/minecraft/server/EntityArrow.java
|
||||
@@ -8,6 +8,11 @@
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
||||
+import org.bukkit.event.player.PlayerPickupArrowEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class EntityArrow extends IProjectile {
|
||||
|
||||
private static final DataWatcherObject<Byte> f = DataWatcher.a(EntityArrow.class, DataWatcherRegistry.a);
|
||||
@@ -291,7 +296,13 @@
|
||||
int k = entity.getFireTicks();
|
||||
|
||||
if (this.isBurning() && !flag) {
|
||||
- entity.setOnFire(5);
|
||||
+ // CraftBukkit start
|
||||
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5);
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
|
||||
+ if (!combustEvent.isCancelled()) {
|
||||
+ entity.setOnFire(combustEvent.getDuration(), false);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
if (entity.damageEntity(damagesource, (float) i)) {
|
||||
@@ -458,9 +469,23 @@
|
||||
@Override
|
||||
public void pickup(EntityHuman entityhuman) {
|
||||
if (!this.world.isClientSide && (this.inGround || this.t()) && this.shake <= 0) {
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack = this.getItemStack();
|
||||
+ if (this.fromPlayer == PickupStatus.ALLOWED && !itemstack.isEmpty() && entityhuman.inventory.canHold(itemstack) > 0) {
|
||||
+ EntityItem item = new EntityItem(this.world, this.locX(), this.locY(), this.locZ(), itemstack);
|
||||
+ PlayerPickupArrowEvent event = new PlayerPickupArrowEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.world.getServer(), this, item), (org.bukkit.entity.AbstractArrow) this.getBukkitEntity());
|
||||
+ // event.setCancelled(!entityhuman.canPickUpLoot); TODO
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ itemstack = item.getItemStack();
|
||||
+ }
|
||||
boolean flag = this.fromPlayer == EntityArrow.PickupStatus.ALLOWED || this.fromPlayer == EntityArrow.PickupStatus.CREATIVE_ONLY && entityhuman.abilities.canInstantlyBuild || this.t() && this.getShooter().getUniqueID() == entityhuman.getUniqueID();
|
||||
|
||||
- if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(this.getItemStack())) {
|
||||
+ if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(itemstack)) {
|
||||
+ // CraftBukkit end
|
||||
flag = false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
--- a/net/minecraft/server/EntityEgg.java
|
||||
+++ b/net/minecraft/server/EntityEgg.java
|
||||
@@ -1,5 +1,12 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.entity.Ageable;
|
||||
+import org.bukkit.entity.EntityType;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.player.PlayerEggThrowEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityEgg extends EntityProjectileThrowable {
|
||||
|
||||
public EntityEgg(EntityTypes<? extends EntityEgg> entitytypes, World world) {
|
||||
@@ -24,20 +31,40 @@
|
||||
protected void a(MovingObjectPosition movingobjectposition) {
|
||||
super.a(movingobjectposition);
|
||||
if (!this.world.isClientSide) {
|
||||
- if (this.random.nextInt(8) == 0) {
|
||||
+ boolean hatching = this.random.nextInt(8) == 0; // CraftBukkit
|
||||
+ if (true) {
|
||||
byte b0 = 1;
|
||||
|
||||
if (this.random.nextInt(32) == 0) {
|
||||
b0 = 4;
|
||||
}
|
||||
|
||||
- for (int i = 0; i < b0; ++i) {
|
||||
- EntityChicken entitychicken = (EntityChicken) EntityTypes.CHICKEN.a(this.world);
|
||||
+ // CraftBukkit start
|
||||
+ if (!hatching) {
|
||||
+ b0 = 0;
|
||||
+ }
|
||||
+ EntityType hatchingType = EntityType.CHICKEN;
|
||||
+
|
||||
+ Entity shooter = this.getShooter();
|
||||
+ if (shooter instanceof EntityPlayer) {
|
||||
+ PlayerEggThrowEvent event = new PlayerEggThrowEvent((Player) shooter.getBukkitEntity(), (org.bukkit.entity.Egg) this.getBukkitEntity(), hatching, b0, hatchingType);
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ b0 = event.getNumHatches();
|
||||
+ hatching = event.isHatching();
|
||||
+ hatchingType = event.getHatchingType();
|
||||
+ }
|
||||
|
||||
- entitychicken.setAgeRaw(-24000);
|
||||
- entitychicken.setPositionRotation(this.locX(), this.locY(), this.locZ(), this.yaw, 0.0F);
|
||||
- this.world.addEntity(entitychicken);
|
||||
+ if (hatching) {
|
||||
+ for (int i = 0; i < b0; ++i) {
|
||||
+ Entity entity = world.getWorld().createEntity(new org.bukkit.Location(world.getWorld(), this.locX(), this.locY(), this.locZ(), this.yaw, 0.0F), hatchingType.getEntityClass());
|
||||
+ if (entity.getBukkitEntity() instanceof Ageable) {
|
||||
+ ((Ageable) entity.getBukkitEntity()).setBaby();
|
||||
+ }
|
||||
+ world.getWorld().addEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG);
|
||||
+ }
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
this.world.broadcastEntityEffect(this, (byte) 3);
|
||||
@@ -0,0 +1,72 @@
|
||||
--- a/net/minecraft/server/EntityEnderPearl.java
|
||||
+++ b/net/minecraft/server/EntityEnderPearl.java
|
||||
@@ -2,6 +2,13 @@
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityEnderPearl extends EntityProjectileThrowable {
|
||||
|
||||
public EntityEnderPearl(EntityTypes<? extends EntityEnderPearl> entitytypes, World world) {
|
||||
@@ -37,21 +44,35 @@
|
||||
EntityPlayer entityplayer = (EntityPlayer) entity;
|
||||
|
||||
if (entityplayer.playerConnection.a().isConnected() && entityplayer.world == this.world && !entityplayer.isSleeping()) {
|
||||
- if (this.random.nextFloat() < 0.05F && this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING)) {
|
||||
- EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.a(this.world);
|
||||
+ // CraftBukkit start - Fire PlayerTeleportEvent
|
||||
+ org.bukkit.craftbukkit.entity.CraftPlayer player = entityplayer.getBukkitEntity();
|
||||
+ org.bukkit.Location location = getBukkitEntity().getLocation();
|
||||
+ location.setPitch(player.getLocation().getPitch());
|
||||
+ location.setYaw(player.getLocation().getYaw());
|
||||
+
|
||||
+ PlayerTeleportEvent teleEvent = new PlayerTeleportEvent(player, player.getLocation(), location, PlayerTeleportEvent.TeleportCause.ENDER_PEARL);
|
||||
+ Bukkit.getPluginManager().callEvent(teleEvent);
|
||||
+
|
||||
+ if (!teleEvent.isCancelled() && !entityplayer.playerConnection.isDisconnected()) {
|
||||
+ if (this.random.nextFloat() < 0.05F && this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING)) {
|
||||
+ EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.a(this.world);
|
||||
|
||||
- entityendermite.setPlayerSpawned(true);
|
||||
+ entityendermite.setPlayerSpawned(true);
|
||||
entityendermite.setPositionRotation(entity.locX(), entity.locY(), entity.locZ(), entity.yaw, entity.pitch);
|
||||
- this.world.addEntity(entityendermite);
|
||||
- }
|
||||
+ this.world.addEntity(entityendermite, CreatureSpawnEvent.SpawnReason.ENDER_PEARL);
|
||||
+ }
|
||||
|
||||
- if (entity.isPassenger()) {
|
||||
- entity.stopRiding();
|
||||
+ if (entity.isPassenger()) {
|
||||
+ entity.stopRiding();
|
||||
+ }
|
||||
+
|
||||
+ entityplayer.playerConnection.teleport(teleEvent.getTo());
|
||||
+ entity.fallDistance = 0.0F;
|
||||
+ CraftEventFactory.entityDamage = this;
|
||||
+ entity.damageEntity(DamageSource.FALL, 5.0F);
|
||||
+ CraftEventFactory.entityDamage = null;
|
||||
}
|
||||
-
|
||||
- entity.enderTeleportTo(this.locX(), this.locY(), this.locZ());
|
||||
- entity.fallDistance = 0.0F;
|
||||
- entity.damageEntity(DamageSource.FALL, 5.0F);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
} else if (entity != null) {
|
||||
entity.enderTeleportTo(this.locX(), this.locY(), this.locZ());
|
||||
@@ -80,7 +101,7 @@
|
||||
public Entity b(WorldServer worldserver) {
|
||||
Entity entity = this.getShooter();
|
||||
|
||||
- if (entity != null && entity.world.getDimensionKey() != worldserver.getDimensionKey()) {
|
||||
+ if (entity != null && worldserver != null && entity.world.getDimensionKey() != worldserver.getDimensionKey()) { // CraftBukkit - SPIGOT-6113
|
||||
this.setShooter((Entity) null);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--- a/net/minecraft/server/EntityEnderSignal.java
|
||||
+++ b/net/minecraft/server/EntityEnderSignal.java
|
||||
@@ -20,8 +20,8 @@
|
||||
}
|
||||
|
||||
public void setItem(ItemStack itemstack) {
|
||||
- if (itemstack.getItem() != Items.ENDER_EYE || itemstack.hasTag()) {
|
||||
- this.getDataWatcher().set(EntityEnderSignal.b, SystemUtils.a((Object) itemstack.cloneItemStack(), (itemstack1) -> {
|
||||
+ if (true || itemstack.getItem() != Items.ENDER_EYE || itemstack.hasTag()) { // CraftBukkit - always allow item changing
|
||||
+ this.getDataWatcher().set(EntityEnderSignal.b, SystemUtils.a(itemstack.cloneItemStack(), (itemstack1) -> { // CraftBukkit - decompile error
|
||||
itemstack1.setCount(1);
|
||||
}));
|
||||
}
|
||||
@@ -137,7 +137,7 @@
|
||||
public void loadData(NBTTagCompound nbttagcompound) {
|
||||
ItemStack itemstack = ItemStack.a(nbttagcompound.getCompound("Item"));
|
||||
|
||||
- this.setItem(itemstack);
|
||||
+ if (!itemstack.isEmpty()) this.setItem(itemstack); // CraftBukkit - SPIGOT-6103 summon, see also SPIGOT-5474
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +1,12 @@
|
||||
--- a/net/minecraft/server/EntityEvokerFangs.java
|
||||
+++ b/net/minecraft/server/EntityEvokerFangs.java
|
||||
@@ -114,7 +114,9 @@
|
||||
|
||||
if (entityliving.isAlive() && !entityliving.isInvulnerable() && entityliving != entityliving1) {
|
||||
if (entityliving1 == null) {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = this; // CraftBukkit
|
||||
entityliving.damageEntity(DamageSource.MAGIC, 6.0F);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = null; // CraftBukkit
|
||||
} else {
|
||||
if (entityliving1.r(entityliving)) {
|
||||
return;
|
||||
@@ -0,0 +1,55 @@
|
||||
--- a/net/minecraft/server/EntityFireball.java
|
||||
+++ b/net/minecraft/server/EntityFireball.java
|
||||
@@ -1,10 +1,14 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
+
|
||||
public abstract class EntityFireball extends IProjectile {
|
||||
|
||||
public double dirX;
|
||||
public double dirY;
|
||||
public double dirZ;
|
||||
+ public float bukkitYield = 1; // CraftBukkit
|
||||
+ public boolean isIncendiary = true; // CraftBukkit
|
||||
|
||||
protected EntityFireball(EntityTypes<? extends EntityFireball> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -14,6 +18,12 @@
|
||||
this(entitytypes, world);
|
||||
this.setPositionRotation(d0, d1, d2, this.yaw, this.pitch);
|
||||
this.af();
|
||||
+ // CraftBukkit start - Added setDirection method
|
||||
+ this.setDirection(d3, d4, d5);
|
||||
+ }
|
||||
+
|
||||
+ public void setDirection(double d3, double d4, double d5) {
|
||||
+ // CraftBukkit end
|
||||
double d6 = (double) MathHelper.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
|
||||
|
||||
if (d6 != 0.0D) {
|
||||
@@ -49,6 +59,12 @@
|
||||
|
||||
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
|
||||
this.a(movingobjectposition);
|
||||
+
|
||||
+ // CraftBukkit start - Fire ProjectileHitEvent
|
||||
+ if (this.dead) {
|
||||
+ CraftEventFactory.callProjectileHitEvent(this, movingobjectposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
this.checkBlockCollisions();
|
||||
@@ -133,6 +149,11 @@
|
||||
Entity entity = damagesource.getEntity();
|
||||
|
||||
if (entity != null) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
Vec3D vec3d = entity.getLookDirection();
|
||||
|
||||
this.setMot(vec3d);
|
||||
@@ -0,0 +1,19 @@
|
||||
--- a/net/minecraft/server/EntityFireballFireball.java
|
||||
+++ b/net/minecraft/server/EntityFireballFireball.java
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
public void setItem(ItemStack itemstack) {
|
||||
if (itemstack.getItem() != Items.FIRE_CHARGE || itemstack.hasTag()) {
|
||||
- this.getDataWatcher().set(EntityFireballFireball.e, SystemUtils.a((Object) itemstack.cloneItemStack(), (itemstack1) -> {
|
||||
+ this.getDataWatcher().set(EntityFireballFireball.e, SystemUtils.a(itemstack.cloneItemStack(), (itemstack1) -> { // CraftBukkit - decompile error
|
||||
itemstack1.setCount(1);
|
||||
}));
|
||||
}
|
||||
@@ -50,6 +50,6 @@
|
||||
super.loadData(nbttagcompound);
|
||||
ItemStack itemstack = ItemStack.a(nbttagcompound.getCompound("Item"));
|
||||
|
||||
- this.setItem(itemstack);
|
||||
+ if (!itemstack.isEmpty()) this.setItem(itemstack); // CraftBukkit - SPIGOT-5474 probably came from bugged earlier versions
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
--- a/net/minecraft/server/EntityFireworks.java
|
||||
+++ b/net/minecraft/server/EntityFireworks.java
|
||||
@@ -5,6 +5,8 @@
|
||||
import java.util.OptionalInt;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
+
|
||||
public class EntityFireworks extends IProjectile {
|
||||
|
||||
public static final DataWatcherObject<ItemStack> FIREWORK_ITEM = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.g);
|
||||
@@ -121,7 +123,11 @@
|
||||
}
|
||||
|
||||
if (!this.world.isClientSide && this.ticksFlown > this.expectedLifespan) {
|
||||
- this.explode();
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
|
||||
+ this.explode();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -136,7 +142,11 @@
|
||||
protected void a(MovingObjectPositionEntity movingobjectpositionentity) {
|
||||
super.a(movingobjectpositionentity);
|
||||
if (!this.world.isClientSide) {
|
||||
- this.explode();
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
|
||||
+ this.explode();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +156,11 @@
|
||||
|
||||
this.world.getType(blockposition).a(this.world, blockposition, (Entity) this);
|
||||
if (!this.world.s_() && this.hasExplosions()) {
|
||||
- this.explode();
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
|
||||
+ this.explode();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
super.a(movingobjectpositionblock);
|
||||
@@ -172,7 +186,9 @@
|
||||
|
||||
if (f > 0.0F) {
|
||||
if (this.ridingEntity != null) {
|
||||
+ CraftEventFactory.entityDamage = this; // CraftBukkit
|
||||
this.ridingEntity.damageEntity(DamageSource.a(this, this.getShooter()), 5.0F + (float) (nbttaglist.size() * 2));
|
||||
+ CraftEventFactory.entityDamage = null; // CraftBukkit
|
||||
}
|
||||
|
||||
double d0 = 5.0D;
|
||||
@@ -199,7 +215,9 @@
|
||||
if (flag) {
|
||||
float f1 = f * (float) Math.sqrt((5.0D - (double) this.g((Entity) entityliving)) / 5.0D);
|
||||
|
||||
+ CraftEventFactory.entityDamage = this; // CraftBukkit
|
||||
entityliving.damageEntity(DamageSource.a(this, this.getShooter()), f1);
|
||||
+ CraftEventFactory.entityDamage = null; // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
--- a/net/minecraft/server/EntityFishingHook.java
|
||||
+++ b/net/minecraft/server/EntityFishingHook.java
|
||||
@@ -7,6 +7,12 @@
|
||||
import java.util.Random;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.entity.FishHook;
|
||||
+import org.bukkit.event.player.PlayerFishEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityFishingHook extends IProjectile {
|
||||
|
||||
private final Random b;
|
||||
@@ -25,6 +31,12 @@
|
||||
private final int an;
|
||||
private final int lureLevel;
|
||||
|
||||
+ // CraftBukkit start - Extra variables to enable modification of fishing wait time, values are minecraft defaults
|
||||
+ public int minWaitTime = 100;
|
||||
+ public int maxWaitTime = 600;
|
||||
+ public boolean applyLure = true;
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
private EntityFishingHook(World world, EntityHuman entityhuman, int i, int j) {
|
||||
super(EntityTypes.FISHING_BOBBER, world);
|
||||
this.b = new Random();
|
||||
@@ -253,6 +265,10 @@
|
||||
this.waitTime = 0;
|
||||
this.ai = 0;
|
||||
this.getDataWatcher().set(EntityFishingHook.f, false);
|
||||
+ // CraftBukkit start
|
||||
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.getOwner().getBukkitEntity(), null, (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.FAILED_ATTEMPT);
|
||||
+ this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
} else {
|
||||
float f;
|
||||
@@ -286,6 +302,13 @@
|
||||
worldserver.a(Particles.FISHING, d0, d1, d2, 0, (double) (-f4), 0.01D, (double) f3, 1.0D);
|
||||
}
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.getOwner().getBukkitEntity(), null, (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.BITE);
|
||||
+ this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
+ if (playerFishEvent.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.playSound(SoundEffects.ENTITY_FISHING_BOBBER_SPLASH, 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
|
||||
double d3 = this.locY() + 0.5D;
|
||||
|
||||
@@ -322,8 +345,10 @@
|
||||
this.ai = MathHelper.nextInt(this.random, 20, 80);
|
||||
}
|
||||
} else {
|
||||
- this.waitTime = MathHelper.nextInt(this.random, 100, 600);
|
||||
- this.waitTime -= this.lureLevel * 20 * 5;
|
||||
+ // CraftBukkit start - logic to modify fishing wait time
|
||||
+ this.waitTime = MathHelper.nextInt(this.random, this.minWaitTime, this.maxWaitTime);
|
||||
+ this.waitTime -= (this.applyLure) ? this.lureLevel * 20 * 5 : 0;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,6 +415,14 @@
|
||||
int i = 0;
|
||||
|
||||
if (this.hooked != null) {
|
||||
+ // CraftBukkit start
|
||||
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), this.hooked.getBukkitEntity(), (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_ENTITY);
|
||||
+ this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
+
|
||||
+ if (playerFishEvent.isCancelled()) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.reel();
|
||||
CriterionTriggers.D.a((EntityPlayer) entityhuman, itemstack, this, (Collection) Collections.emptyList());
|
||||
this.world.broadcastEntityEffect(this, (byte) 31);
|
||||
@@ -405,6 +438,15 @@
|
||||
while (iterator.hasNext()) {
|
||||
ItemStack itemstack1 = (ItemStack) iterator.next();
|
||||
EntityItem entityitem = new EntityItem(this.world, this.locX(), this.locY(), this.locZ(), 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);
|
||||
+ this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
+
|
||||
+ if (playerFishEvent.isCancelled()) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
double d0 = entityhuman.locX() - this.locX();
|
||||
double d1 = entityhuman.locY() - this.locY();
|
||||
double d2 = entityhuman.locZ() - this.locZ();
|
||||
@@ -412,7 +454,11 @@
|
||||
|
||||
entityitem.setMot(d0 * 0.1D, d1 * 0.1D + Math.sqrt(Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2)) * 0.08D, d2 * 0.1D);
|
||||
this.world.addEntity(entityitem);
|
||||
- entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX(), entityhuman.locY() + 0.5D, entityhuman.locZ() + 0.5D, this.random.nextInt(6) + 1));
|
||||
+ // CraftBukkit start - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop()
|
||||
+ if (playerFishEvent.getExpToDrop() > 0) {
|
||||
+ entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX(), entityhuman.locY() + 0.5D, entityhuman.locZ() + 0.5D, playerFishEvent.getExpToDrop()));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (itemstack1.getItem().a((Tag) TagsItem.FISHES)) {
|
||||
entityhuman.a(StatisticList.FISH_CAUGHT, 1);
|
||||
}
|
||||
@@ -422,8 +468,25 @@
|
||||
}
|
||||
|
||||
if (this.onGround) {
|
||||
+ // CraftBukkit start
|
||||
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), null, (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.IN_GROUND);
|
||||
+ this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
+
|
||||
+ if (playerFishEvent.isCancelled()) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
i = 2;
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ if (i == 0) {
|
||||
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), null, (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.REEL_IN);
|
||||
+ this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
+ if (playerFishEvent.isCancelled()) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
this.die();
|
||||
return i;
|
||||
@@ -0,0 +1,49 @@
|
||||
--- a/net/minecraft/server/EntityLargeFireball.java
|
||||
+++ b/net/minecraft/server/EntityLargeFireball.java
|
||||
@@ -1,15 +1,19 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
|
||||
+
|
||||
public class EntityLargeFireball extends EntityFireballFireball {
|
||||
|
||||
public int yield = 1;
|
||||
|
||||
public EntityLargeFireball(EntityTypes<? extends EntityLargeFireball> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
+ isIncendiary = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING); // CraftBukkit
|
||||
}
|
||||
|
||||
public EntityLargeFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) {
|
||||
super(EntityTypes.FIREBALL, entityliving, d0, d1, d2, world);
|
||||
+ isIncendiary = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -18,7 +22,15 @@
|
||||
if (!this.world.isClientSide) {
|
||||
boolean flag = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING);
|
||||
|
||||
- this.world.createExplosion((Entity) null, this.locX(), this.locY(), this.locZ(), (float) this.yield, flag, flag ? Explosion.Effect.DESTROY : Explosion.Effect.NONE);
|
||||
+ // CraftBukkit start - fire ExplosionPrimeEvent
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity());
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ // give 'this' instead of (Entity) null so we know what causes the damage
|
||||
+ this.world.createExplosion(this, this.locX(), this.locY(), this.locZ(), event.getRadius(), event.getFire(), flag ? Explosion.Effect.DESTROY : Explosion.Effect.NONE);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.die();
|
||||
}
|
||||
|
||||
@@ -49,7 +61,8 @@
|
||||
public void loadData(NBTTagCompound nbttagcompound) {
|
||||
super.loadData(nbttagcompound);
|
||||
if (nbttagcompound.hasKeyOfType("ExplosionPower", 99)) {
|
||||
- this.yield = nbttagcompound.getInt("ExplosionPower");
|
||||
+ // CraftBukkit - set bukkitYield when setting explosionpower
|
||||
+ bukkitYield = this.yield = nbttagcompound.getInt("ExplosionPower");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
--- a/net/minecraft/server/EntityPotion.java
|
||||
+++ b/net/minecraft/server/EntityPotion.java
|
||||
@@ -5,6 +5,14 @@
|
||||
import java.util.function.Predicate;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.HashMap;
|
||||
+import java.util.Map;
|
||||
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityPotion extends EntityProjectileThrowable {
|
||||
|
||||
public static final Predicate<EntityLiving> b = EntityLiving::dO;
|
||||
@@ -69,7 +77,7 @@
|
||||
|
||||
if (flag) {
|
||||
this.splash();
|
||||
- } else if (!list.isEmpty()) {
|
||||
+ } else if (true || !list.isEmpty()) { // CraftBukkit - Call event even if no effects to apply
|
||||
if (this.isLingering()) {
|
||||
this.a(itemstack, potionregistry);
|
||||
} else {
|
||||
@@ -106,6 +114,7 @@
|
||||
private void a(List<MobEffect> list, @Nullable Entity entity) {
|
||||
AxisAlignedBB axisalignedbb = this.getBoundingBox().grow(4.0D, 2.0D, 4.0D);
|
||||
List<EntityLiving> list1 = this.world.a(EntityLiving.class, axisalignedbb);
|
||||
+ Map<LivingEntity, Double> affected = new HashMap<LivingEntity, Double>(); // CraftBukkit
|
||||
|
||||
if (!list1.isEmpty()) {
|
||||
Iterator iterator = list1.iterator();
|
||||
@@ -123,21 +132,46 @@
|
||||
d1 = 1.0D;
|
||||
}
|
||||
|
||||
- Iterator iterator1 = list.iterator();
|
||||
+ // CraftBukkit start
|
||||
+ affected.put((LivingEntity) entityliving.getBukkitEntity(), d1);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ org.bukkit.event.entity.PotionSplashEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPotionSplashEvent(this, affected);
|
||||
+ if (!event.isCancelled() && list != null && !list.isEmpty()) { // do not process effects if there are no effects to process
|
||||
+ for (LivingEntity victim : event.getAffectedEntities()) {
|
||||
+ if (!(victim instanceof CraftLivingEntity)) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ EntityLiving entityliving = ((CraftLivingEntity) victim).getHandle();
|
||||
+ double d1 = event.getIntensity(victim);
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ Iterator iterator1 = list.iterator();
|
||||
+
|
||||
+ while (iterator1.hasNext()) {
|
||||
+ MobEffect mobeffect = (MobEffect) iterator1.next();
|
||||
+ MobEffectList mobeffectlist = mobeffect.getMobEffect();
|
||||
+ // CraftBukkit start - Abide by PVP settings - for players only!
|
||||
+ if (!this.world.pvpMode && this.getShooter() instanceof EntityPlayer && entityliving instanceof EntityPlayer && entityliving != this.getShooter()) {
|
||||
+ int i = MobEffectList.getId(mobeffectlist);
|
||||
+ // Block SLOWER_MOVEMENT, SLOWER_DIG, HARM, BLINDNESS, HUNGER, WEAKNESS and POISON potions
|
||||
+ if (i == 2 || i == 4 || i == 7 || i == 15 || i == 17 || i == 18 || i == 19) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ if (mobeffectlist.isInstant()) {
|
||||
+ mobeffectlist.applyInstantEffect(this, this.getShooter(), entityliving, mobeffect.getAmplifier(), d1);
|
||||
+ } else {
|
||||
+ int i = (int) (d1 * (double) mobeffect.getDuration() + 0.5D);
|
||||
|
||||
- while (iterator1.hasNext()) {
|
||||
- MobEffect mobeffect = (MobEffect) iterator1.next();
|
||||
- MobEffectList mobeffectlist = mobeffect.getMobEffect();
|
||||
-
|
||||
- if (mobeffectlist.isInstant()) {
|
||||
- mobeffectlist.applyInstantEffect(this, this.getShooter(), entityliving, mobeffect.getAmplifier(), d1);
|
||||
- } else {
|
||||
- int i = (int) (d1 * (double) mobeffect.getDuration() + 0.5D);
|
||||
-
|
||||
- if (i > 20) {
|
||||
- entityliving.addEffect(new MobEffect(mobeffectlist, i, mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isShowParticles()));
|
||||
- }
|
||||
- }
|
||||
+ if (i > 20) {
|
||||
+ entityliving.addEffect(new MobEffect(mobeffectlist, i, mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isShowParticles()), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.POTION_SPLASH); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -173,7 +207,14 @@
|
||||
entityareaeffectcloud.setColor(nbttagcompound.getInt("CustomPotionColor"));
|
||||
}
|
||||
|
||||
- this.world.addEntity(entityareaeffectcloud);
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.LingeringPotionSplashEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callLingeringPotionSplashEvent(this, entityareaeffectcloud);
|
||||
+ if (!(event.isCancelled() || entityareaeffectcloud.dead)) {
|
||||
+ this.world.addEntity(entityareaeffectcloud);
|
||||
+ } else {
|
||||
+ entityareaeffectcloud.dead = true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public boolean isLingering() {
|
||||
@@ -184,11 +225,19 @@
|
||||
IBlockData iblockdata = this.world.getType(blockposition);
|
||||
|
||||
if (iblockdata.a((Tag) TagsBlock.FIRE)) {
|
||||
- this.world.a(blockposition, false);
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ this.world.a(blockposition, false);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else if (BlockCampfire.g(iblockdata)) {
|
||||
- this.world.a((EntityHuman) null, 1009, blockposition, 0);
|
||||
- BlockCampfire.c((GeneratorAccess) this.world, blockposition, iblockdata);
|
||||
- this.world.setTypeUpdate(blockposition, (IBlockData) iblockdata.set(BlockCampfire.LIT, false));
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, iblockdata.set(BlockCampfire.LIT, false)).isCancelled()) {
|
||||
+ this.world.a((EntityHuman) null, 1009, blockposition, 0);
|
||||
+ BlockCampfire.c((GeneratorAccess) this.world, blockposition, iblockdata);
|
||||
+ this.world.setTypeUpdate(blockposition, (IBlockData) iblockdata.set(BlockCampfire.LIT, false));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
--- a/net/minecraft/server/EntityProjectileThrowable.java
|
||||
+++ b/net/minecraft/server/EntityProjectileThrowable.java
|
||||
@@ -18,8 +18,8 @@
|
||||
|
||||
public void setItem(ItemStack itemstack) {
|
||||
if (itemstack.getItem() != this.getDefaultItem() || itemstack.hasTag()) {
|
||||
- this.getDataWatcher().set(EntityProjectileThrowable.b, SystemUtils.a((Object) itemstack.cloneItemStack(), (itemstack1) -> {
|
||||
- itemstack1.setCount(1);
|
||||
+ this.getDataWatcher().set(EntityProjectileThrowable.b, SystemUtils.a(itemstack.cloneItemStack(), (itemstack1) -> { // CraftBukkit - decompile error
|
||||
+ if (!itemstack1.isEmpty()) itemstack1.setCount(1); // CraftBukkit
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -27,6 +27,12 @@
|
||||
|
||||
protected abstract Item getDefaultItem();
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public Item getDefaultItemPublic() {
|
||||
+ return getDefaultItem();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public ItemStack getItem() {
|
||||
return (ItemStack) this.getDataWatcher().get(EntityProjectileThrowable.b);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
--- a/net/minecraft/server/EntityShulkerBullet.java
|
||||
+++ b/net/minecraft/server/EntityShulkerBullet.java
|
||||
@@ -34,8 +34,21 @@
|
||||
this.target = entity;
|
||||
this.dir = EnumDirection.UP;
|
||||
this.a(enumdirection_enumaxis);
|
||||
+ projectileSource = (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public Entity getTarget() {
|
||||
+ return this.target;
|
||||
+ }
|
||||
+
|
||||
+ public void setTarget(Entity e) {
|
||||
+ this.target = e;
|
||||
+ this.dir = EnumDirection.UP;
|
||||
+ this.a(EnumDirection.EnumAxis.X);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@Override
|
||||
public SoundCategory getSoundCategory() {
|
||||
return SoundCategory.HOSTILE;
|
||||
@@ -256,7 +269,7 @@
|
||||
if (flag) {
|
||||
this.a(entityliving, entity);
|
||||
if (entity instanceof EntityLiving) {
|
||||
- ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.LEVITATION, 200));
|
||||
+ ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.LEVITATION, 200), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,6 +295,11 @@
|
||||
|
||||
@Override
|
||||
public boolean damageEntity(DamageSource damagesource, float f) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, false)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (!this.world.isClientSide) {
|
||||
this.playSound(SoundEffects.ENTITY_SHULKER_BULLET_HURT, 1.0F, 1.0F);
|
||||
((WorldServer) this.world).a(Particles.CRIT, this.locX(), this.locY(), this.locZ(), 15, 0.2D, 0.2D, 0.2D, 0.0D);
|
||||
@@ -0,0 +1,51 @@
|
||||
--- a/net/minecraft/server/EntitySmallFireball.java
|
||||
+++ b/net/minecraft/server/EntitySmallFireball.java
|
||||
@@ -1,5 +1,7 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+import org.bukkit.event.entity.EntityCombustByEntityEvent; // CraftBukkit
|
||||
+
|
||||
public class EntitySmallFireball extends EntityFireballFireball {
|
||||
|
||||
public EntitySmallFireball(EntityTypes<? extends EntitySmallFireball> entitytypes, World world) {
|
||||
@@ -8,6 +10,11 @@
|
||||
|
||||
public EntitySmallFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) {
|
||||
super(EntityTypes.SMALL_FIREBALL, entityliving, d0, d1, d2, world);
|
||||
+ // CraftBukkit start
|
||||
+ if (this.getShooter() != null && this.getShooter() instanceof EntityInsentient) {
|
||||
+ isIncendiary = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public EntitySmallFireball(World world, double d0, double d1, double d2, double d3, double d4, double d5) {
|
||||
@@ -24,7 +31,14 @@
|
||||
Entity entity1 = this.getShooter();
|
||||
int i = entity.getFireTicks();
|
||||
|
||||
- entity.setOnFire(5);
|
||||
+ // CraftBukkit start - Entity damage by entity event + combust event
|
||||
+ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), entity.getBukkitEntity(), 5);
|
||||
+ entity.world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ entity.setOnFire(event.getDuration(), false);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
boolean flag = entity.damageEntity(DamageSource.fireball(this, entity1), 5.0F);
|
||||
|
||||
if (!flag) {
|
||||
@@ -43,10 +57,10 @@
|
||||
if (!this.world.isClientSide) {
|
||||
Entity entity = this.getShooter();
|
||||
|
||||
- if (entity == null || !(entity instanceof EntityInsentient) || this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) {
|
||||
+ if (isIncendiary) { // CraftBukkit
|
||||
BlockPosition blockposition = movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection());
|
||||
|
||||
- if (this.world.isEmpty(blockposition)) {
|
||||
+ if (this.world.isEmpty(blockposition) && !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, this).isCancelled()) { // CraftBukkit
|
||||
this.world.setTypeUpdate(blockposition, BlockFireAbstract.a((IBlockAccess) this.world, blockposition));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/server/EntitySpectralArrow.java
|
||||
+++ b/net/minecraft/server/EntitySpectralArrow.java
|
||||
@@ -35,7 +35,7 @@
|
||||
super.a(entityliving);
|
||||
MobEffect mobeffect = new MobEffect(MobEffects.GLOWING, this.duration, 0);
|
||||
|
||||
- entityliving.addEffect(mobeffect);
|
||||
+ entityliving.addEffect(mobeffect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +1,22 @@
|
||||
--- a/net/minecraft/server/EntityThrownExpBottle.java
|
||||
+++ b/net/minecraft/server/EntityThrownExpBottle.java
|
||||
@@ -28,9 +28,18 @@
|
||||
protected void a(MovingObjectPosition movingobjectposition) {
|
||||
super.a(movingobjectposition);
|
||||
if (!this.world.isClientSide) {
|
||||
- this.world.triggerEffect(2002, this.getChunkCoordinates(), PotionUtil.a(Potions.WATER));
|
||||
+ // CraftBukkit - moved to after event
|
||||
+ // this.world.triggerEffect(2002, this.getChunkCoordinates(), PotionUtil.a(Potions.WATER));
|
||||
int i = 3 + this.world.random.nextInt(5) + this.world.random.nextInt(5);
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.ExpBottleEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callExpBottleEvent(this, i);
|
||||
+ i = event.getExperience();
|
||||
+ if (event.getShowEffect()) {
|
||||
+ this.world.triggerEffect(2002, this.getChunkCoordinates(), PotionUtil.a(Potions.WATER));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
while (i > 0) {
|
||||
int j = EntityExperienceOrb.getOrbValue(i);
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/server/EntityThrownTrident.java
|
||||
+++ b/net/minecraft/server/EntityThrownTrident.java
|
||||
@@ -132,7 +132,7 @@
|
||||
|
||||
entitylightning.d(Vec3D.c((BaseBlockPosition) blockposition));
|
||||
entitylightning.d(entity1 instanceof EntityPlayer ? (EntityPlayer) entity1 : null);
|
||||
- this.world.addEntity(entitylightning);
|
||||
+ ((WorldServer) this.world).strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRIDENT); // CraftBukkit
|
||||
soundeffect = SoundEffects.ITEM_TRIDENT_THUNDER;
|
||||
f1 = 5.0F;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
--- a/net/minecraft/server/EntityTippedArrow.java
|
||||
+++ b/net/minecraft/server/EntityTippedArrow.java
|
||||
@@ -122,6 +122,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start accessor methods
|
||||
+ public void refreshEffects() {
|
||||
+ this.getDataWatcher().set(EntityTippedArrow.COLOR, PotionUtil.a((Collection) PotionUtil.a(this.potionRegistry, (Collection) this.effects)));
|
||||
+ }
|
||||
+
|
||||
+ public String getType() {
|
||||
+ return IRegistry.POTION.getKey(this.potionRegistry).toString();
|
||||
+ }
|
||||
+
|
||||
+ public void setType(String string) {
|
||||
+ this.potionRegistry = IRegistry.POTION.get(new MinecraftKey(string));
|
||||
+ this.getDataWatcher().set(EntityTippedArrow.COLOR, PotionUtil.a((Collection) PotionUtil.a(this.potionRegistry, (Collection) this.effects)));
|
||||
+ }
|
||||
+
|
||||
+ public boolean isTipped() {
|
||||
+ return !(this.effects.isEmpty() && this.potionRegistry == Potions.EMPTY);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public int getColor() {
|
||||
return (Integer) this.datawatcher.get(EntityTippedArrow.COLOR);
|
||||
}
|
||||
@@ -189,7 +208,7 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
mobeffect = (MobEffect) iterator.next();
|
||||
- entityliving.addEffect(new MobEffect(mobeffect.getMobEffect(), Math.max(mobeffect.getDuration() / 8, 1), mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isShowParticles()));
|
||||
+ entityliving.addEffect(new MobEffect(mobeffect.getMobEffect(), Math.max(mobeffect.getDuration() / 8, 1), mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isShowParticles()), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
|
||||
}
|
||||
|
||||
if (!this.effects.isEmpty()) {
|
||||
@@ -197,7 +216,7 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
mobeffect = (MobEffect) iterator.next();
|
||||
- entityliving.addEffect(mobeffect);
|
||||
+ entityliving.addEffect(mobeffect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
--- a/net/minecraft/server/EntityWitherSkull.java
|
||||
+++ b/net/minecraft/server/EntityWitherSkull.java
|
||||
@@ -1,5 +1,7 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
|
||||
+
|
||||
public class EntityWitherSkull extends EntityFireball {
|
||||
|
||||
private static final DataWatcherObject<Boolean> e = DataWatcher.a(EntityWitherSkull.class, DataWatcherRegistry.i);
|
||||
@@ -43,7 +45,7 @@
|
||||
if (entity.isAlive()) {
|
||||
this.a(entityliving, entity);
|
||||
} else {
|
||||
- entityliving.heal(5.0F);
|
||||
+ entityliving.heal(5.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER); // CraftBukkit
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -60,7 +62,7 @@
|
||||
}
|
||||
|
||||
if (b0 > 0) {
|
||||
- ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.WITHER, 20 * b0, 1));
|
||||
+ ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.WITHER, 20 * b0, 1), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +75,15 @@
|
||||
if (!this.world.isClientSide) {
|
||||
Explosion.Effect explosion_effect = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
|
||||
|
||||
- this.world.createExplosion(this, this.locX(), this.locY(), this.locZ(), 1.0F, false, explosion_effect);
|
||||
+ // CraftBukkit start
|
||||
+ // this.world.createExplosion(this, this.locX(), this.locY(), this.locZ(), 1.0F, false, explosion_effect);
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 1.0F, false);
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.world.createExplosion(this, this.locX(), this.locY(), this.locZ(), event.getRadius(), event.getFire(), explosion_effect);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.die();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
--- a/net/minecraft/server/IProjectile.java
|
||||
+++ b/net/minecraft/server/IProjectile.java
|
||||
@@ -4,6 +4,10 @@
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.projectiles.ProjectileSource;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class IProjectile extends Entity {
|
||||
|
||||
private UUID shooter;
|
||||
@@ -19,6 +23,7 @@
|
||||
this.shooter = entity.getUniqueID();
|
||||
this.c = entity.getId();
|
||||
}
|
||||
+ this.projectileSource = (entity != null && entity.getBukkitEntity() instanceof ProjectileSource) ? (ProjectileSource) entity.getBukkitEntity() : null; // CraftBukkit
|
||||
|
||||
}
|
||||
|
||||
@@ -101,6 +106,7 @@
|
||||
}
|
||||
|
||||
protected void a(MovingObjectPosition movingobjectposition) {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this, movingobjectposition); // CraftBukkit - Call event
|
||||
MovingObjectPosition.EnumMovingObjectType movingobjectposition_enummovingobjecttype = movingobjectposition.getType();
|
||||
|
||||
if (movingobjectposition_enummovingobjecttype == MovingObjectPosition.EnumMovingObjectType.ENTITY) {
|
||||
Reference in New Issue
Block a user