@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityArrow.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityArrow.java
|
||||
@@ -45,6 +45,12 @@
|
||||
@@ -44,6 +44,12 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
@@ -12,17 +12,17 @@
|
||||
+
|
||||
public abstract class EntityArrow extends IProjectile {
|
||||
|
||||
private static final DataWatcherObject<Byte> f = DataWatcher.a(EntityArrow.class, DataWatcherRegistry.a);
|
||||
@@ -181,7 +187,7 @@
|
||||
private static final double ARROW_BASE_DAMAGE = 2.0D;
|
||||
@@ -210,7 +216,7 @@
|
||||
}
|
||||
|
||||
if (object != null && !flag) {
|
||||
- this.a((MovingObjectPosition) object);
|
||||
+ this.preOnHit((MovingObjectPosition) object); // CraftBukkit - projectile hit event
|
||||
this.impulse = true;
|
||||
this.hasImpulse = true;
|
||||
}
|
||||
|
||||
@@ -328,7 +334,13 @@
|
||||
@@ -357,7 +363,13 @@
|
||||
int k = entity.getFireTicks();
|
||||
|
||||
if (this.isBurning() && !flag) {
|
||||
@@ -37,28 +37,27 @@
|
||||
}
|
||||
|
||||
if (entity.damageEntity(damagesource, (float) i)) {
|
||||
@@ -495,9 +507,23 @@
|
||||
@@ -519,7 +531,22 @@
|
||||
@Override
|
||||
public void pickup(EntityHuman entityhuman) {
|
||||
if (!this.world.isClientSide && (this.inGround || this.t()) && this.shake <= 0) {
|
||||
if (!this.level.isClientSide && (this.inGround || this.t()) && this.shakeTime <= 0) {
|
||||
- if (this.a(entityhuman)) {
|
||||
+ // 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());
|
||||
+ if (this.pickup == PickupStatus.ALLOWED && !itemstack.isEmpty() && entityhuman.getInventory().canHold(itemstack) > 0) {
|
||||
+ EntityItem item = new EntityItem(this.level, this.locX(), this.locY(), this.locZ(), itemstack);
|
||||
+ PlayerPickupArrowEvent event = new PlayerPickupArrowEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.level.getServer(), this, item), (org.bukkit.entity.AbstractArrow) this.getBukkitEntity());
|
||||
+ // event.setCancelled(!entityhuman.canPickUpLoot); TODO
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+ this.level.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)) {
|
||||
+
|
||||
+ if ((this.pickup == EntityArrow.PickupStatus.ALLOWED && entityhuman.getInventory().pickup(itemstack)) || (this.pickup == EntityArrow.PickupStatus.CREATIVE_ONLY && entityhuman.getAbilities().instabuild)) {
|
||||
+ // CraftBukkit end
|
||||
flag = false;
|
||||
entityhuman.receive(this, 1);
|
||||
this.die();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityEgg.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityEgg.java
|
||||
@@ -10,6 +10,15 @@
|
||||
@@ -12,6 +12,15 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
public class EntityEgg extends EntityProjectileThrowable {
|
||||
|
||||
public EntityEgg(EntityTypes<? extends EntityEgg> entitytypes, World world) {
|
||||
@@ -34,20 +43,40 @@
|
||||
@@ -48,20 +57,40 @@
|
||||
protected void a(MovingObjectPosition movingobjectposition) {
|
||||
super.a(movingobjectposition);
|
||||
if (!this.world.isClientSide) {
|
||||
if (!this.level.isClientSide) {
|
||||
- if (this.random.nextInt(8) == 0) {
|
||||
+ boolean hatching = this.random.nextInt(8) == 0; // CraftBukkit
|
||||
+ if (true) {
|
||||
@@ -30,7 +30,7 @@
|
||||
}
|
||||
|
||||
- for (int i = 0; i < b0; ++i) {
|
||||
- EntityChicken entitychicken = (EntityChicken) EntityTypes.CHICKEN.a(this.world);
|
||||
- EntityChicken entitychicken = (EntityChicken) EntityTypes.CHICKEN.a(this.level);
|
||||
+ // CraftBukkit start
|
||||
+ if (!hatching) {
|
||||
+ b0 = 0;
|
||||
@@ -40,7 +40,7 @@
|
||||
+ 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);
|
||||
+ this.level.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ b0 = event.getNumHatches();
|
||||
+ hatching = event.isHatching();
|
||||
@@ -48,18 +48,18 @@
|
||||
+ }
|
||||
|
||||
- entitychicken.setAgeRaw(-24000);
|
||||
- entitychicken.setPositionRotation(this.locX(), this.locY(), this.locZ(), this.yaw, 0.0F);
|
||||
- this.world.addEntity(entitychicken);
|
||||
- entitychicken.setPositionRotation(this.locX(), this.locY(), this.locZ(), this.getYRot(), 0.0F);
|
||||
- this.level.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());
|
||||
+ Entity entity = level.getWorld().createEntity(new org.bukkit.Location(level.getWorld(), this.locX(), this.locY(), this.locZ(), this.getYRot(), 0.0F), hatchingType.getEntityClass());
|
||||
+ if (entity.getBukkitEntity() instanceof Ageable) {
|
||||
+ ((Ageable) entity.getBukkitEntity()).setBaby();
|
||||
+ }
|
||||
+ world.getWorld().addEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG);
|
||||
+ level.getWorld().addEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG);
|
||||
+ }
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
this.world.broadcastEntityEffect(this, (byte) 3);
|
||||
this.level.broadcastEntityEffect(this, (byte) 3);
|
||||
|
||||
@@ -14,12 +14,15 @@
|
||||
public class EntityEnderPearl extends EntityProjectileThrowable {
|
||||
|
||||
public EntityEnderPearl(EntityTypes<? extends EntityEnderPearl> entitytypes, World world) {
|
||||
@@ -52,21 +59,35 @@
|
||||
@@ -53,21 +60,34 @@
|
||||
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);
|
||||
if (entityplayer.connection.a().isConnected() && entityplayer.level == this.level && !entityplayer.isSleeping()) {
|
||||
- if (this.random.nextFloat() < 0.05F && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) {
|
||||
- EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.a(this.level);
|
||||
-
|
||||
- entityendermite.setPositionRotation(entity.locX(), entity.locY(), entity.locZ(), entity.getYRot(), entity.getXRot());
|
||||
- this.level.addEntity(entityendermite);
|
||||
+ // CraftBukkit start - Fire PlayerTeleportEvent
|
||||
+ org.bukkit.craftbukkit.entity.CraftPlayer player = entityplayer.getBukkitEntity();
|
||||
+ org.bukkit.Location location = getBukkitEntity().getLocation();
|
||||
@@ -29,44 +32,43 @@
|
||||
+ 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 (!teleEvent.isCancelled() && !entityplayer.connection.isDisconnected()) {
|
||||
+ if (this.random.nextFloat() < 0.05F && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) {
|
||||
+ EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.a(this.level);
|
||||
+
|
||||
+ entityendermite.setPositionRotation(entity.locX(), entity.locY(), entity.locZ(), entity.getYRot(), entity.getXRot());
|
||||
+ this.level.addEntity(entityendermite, CreatureSpawnEvent.SpawnReason.ENDER_PEARL);
|
||||
+ }
|
||||
|
||||
- if (entity.isPassenger()) {
|
||||
- entity.stopRiding();
|
||||
+
|
||||
+ if (entity.isPassenger()) {
|
||||
+ entity.stopRiding();
|
||||
+ }
|
||||
+
|
||||
+ entityplayer.playerConnection.teleport(teleEvent.getTo());
|
||||
+ entityplayer.connection.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());
|
||||
- if (entity.isPassenger()) {
|
||||
- entityplayer.a(this.locX(), this.locY(), this.locZ());
|
||||
- } else {
|
||||
- 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());
|
||||
@@ -95,7 +116,7 @@
|
||||
@@ -96,7 +116,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
|
||||
- if (entity != null && entity.level.getDimensionKey() != worldserver.getDimensionKey()) {
|
||||
+ if (entity != null && worldserver != null && entity.level.getDimensionKey() != worldserver.getDimensionKey()) { // CraftBukkit - SPIGOT-6113
|
||||
this.setShooter((Entity) null);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityEnderSignal.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityEnderSignal.java
|
||||
@@ -39,8 +39,8 @@
|
||||
@@ -38,8 +38,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
|
||||
- if (!itemstack.a(Items.ENDER_EYE) || itemstack.hasTag()) {
|
||||
- this.getDataWatcher().set(EntityEnderSignal.DATA_ITEM_STACK, (ItemStack) SystemUtils.a((Object) itemstack.cloneItemStack(), (itemstack1) -> {
|
||||
+ if (true || !itemstack.a(Items.ENDER_EYE) || itemstack.hasTag()) { // CraftBukkit - always allow item changing
|
||||
+ this.getDataWatcher().set(EntityEnderSignal.DATA_ITEM_STACK, (ItemStack) SystemUtils.a(itemstack.cloneItemStack(), (itemstack1) -> { // CraftBukkit - decompile error
|
||||
itemstack1.setCount(1);
|
||||
}));
|
||||
}
|
||||
@@ -156,7 +156,7 @@
|
||||
@@ -182,7 +182,7 @@
|
||||
public void loadData(NBTTagCompound nbttagcompound) {
|
||||
ItemStack itemstack = ItemStack.a(nbttagcompound.getCompound("Item"));
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
|
||||
@@ -124,7 +124,9 @@
|
||||
@@ -130,7 +130,9 @@
|
||||
|
||||
if (entityliving.isAlive() && !entityliving.isInvulnerable() && entityliving != entityliving1) {
|
||||
if (entityliving1 == null) {
|
||||
@@ -8,5 +8,5 @@
|
||||
entityliving.damageEntity(DamageSource.MAGIC, 6.0F);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = null; // CraftBukkit
|
||||
} else {
|
||||
if (entityliving1.r(entityliving)) {
|
||||
if (entityliving1.p(entityliving)) {
|
||||
return;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityFireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityFireball.java
|
||||
@@ -15,11 +15,15 @@
|
||||
@@ -14,11 +14,15 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -8,28 +8,28 @@
|
||||
+
|
||||
public abstract class EntityFireball extends IProjectile {
|
||||
|
||||
public double dirX;
|
||||
public double dirY;
|
||||
public double dirZ;
|
||||
public double xPower;
|
||||
public double yPower;
|
||||
public double zPower;
|
||||
+ public float bukkitYield = 1; // CraftBukkit
|
||||
+ public boolean isIncendiary = true; // CraftBukkit
|
||||
|
||||
protected EntityFireball(EntityTypes<? extends EntityFireball> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -29,6 +33,12 @@
|
||||
@@ -28,6 +32,12 @@
|
||||
this(entitytypes, world);
|
||||
this.setPositionRotation(d0, d1, d2, this.yaw, this.pitch);
|
||||
this.af();
|
||||
this.setPositionRotation(d0, d1, d2, this.getYRot(), this.getXRot());
|
||||
this.ah();
|
||||
+ // 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);
|
||||
double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
|
||||
|
||||
if (d6 != 0.0D) {
|
||||
@@ -63,7 +73,13 @@
|
||||
@@ -74,7 +84,13 @@
|
||||
MovingObjectPosition movingobjectposition = ProjectileHelper.a((Entity) this, this::a);
|
||||
|
||||
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
|
||||
@@ -37,14 +37,14 @@
|
||||
+ this.preOnHit(movingobjectposition); // CraftBukkit - projectile hit event
|
||||
+
|
||||
+ // CraftBukkit start - Fire ProjectileHitEvent
|
||||
+ if (this.dead) {
|
||||
+ if (this.isRemoved()) {
|
||||
+ CraftEventFactory.callProjectileHitEvent(this, movingobjectposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
this.checkBlockCollisions();
|
||||
@@ -148,6 +164,11 @@
|
||||
@@ -159,6 +175,11 @@
|
||||
Entity entity = damagesource.getEntity();
|
||||
|
||||
if (entity != null) {
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
@@ -29,7 +29,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
|
||||
if (!itemstack.a(Items.FIRE_CHARGE) || itemstack.hasTag()) {
|
||||
- this.getDataWatcher().set(EntityFireballFireball.DATA_ITEM_STACK, (ItemStack) SystemUtils.a((Object) itemstack.cloneItemStack(), (itemstack1) -> {
|
||||
+ this.getDataWatcher().set(EntityFireballFireball.DATA_ITEM_STACK, (ItemStack) SystemUtils.a(itemstack.cloneItemStack(), (itemstack1) -> { // CraftBukkit - decompile error
|
||||
itemstack1.setCount(1);
|
||||
}));
|
||||
}
|
||||
@@ -61,6 +61,6 @@
|
||||
@@ -68,6 +68,6 @@
|
||||
super.loadData(nbttagcompound);
|
||||
ItemStack itemstack = ItemStack.a(nbttagcompound.getCompound("Item"));
|
||||
|
||||
|
||||
@@ -6,22 +6,22 @@
|
||||
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
+
|
||||
public class EntityFireworks extends IProjectile {
|
||||
public class EntityFireworks extends IProjectile implements ItemSupplier {
|
||||
|
||||
public static final DataWatcherObject<ItemStack> FIREWORK_ITEM = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.g);
|
||||
@@ -130,7 +132,7 @@
|
||||
public static final DataWatcherObject<ItemStack> DATA_ID_FIREWORKS_ITEM = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.ITEM_STACK);
|
||||
@@ -141,7 +143,7 @@
|
||||
MovingObjectPosition movingobjectposition = ProjectileHelper.a((Entity) this, this::a);
|
||||
|
||||
if (!this.noclip) {
|
||||
if (!this.noPhysics) {
|
||||
- this.a(movingobjectposition);
|
||||
+ this.preOnHit(movingobjectposition); // CraftBukkit - projectile hit event
|
||||
this.impulse = true;
|
||||
this.hasImpulse = true;
|
||||
}
|
||||
|
||||
@@ -145,7 +147,11 @@
|
||||
@@ -156,7 +158,11 @@
|
||||
}
|
||||
|
||||
if (!this.world.isClientSide && this.ticksFlown > this.expectedLifespan) {
|
||||
if (!this.level.isClientSide && this.life > this.lifetime) {
|
||||
- this.explode();
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
|
||||
@@ -31,10 +31,10 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -160,7 +166,11 @@
|
||||
@@ -172,7 +178,11 @@
|
||||
protected void a(MovingObjectPositionEntity movingobjectpositionentity) {
|
||||
super.a(movingobjectpositionentity);
|
||||
if (!this.world.isClientSide) {
|
||||
if (!this.level.isClientSide) {
|
||||
- this.explode();
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
|
||||
@@ -44,10 +44,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +180,11 @@
|
||||
@@ -182,7 +192,11 @@
|
||||
|
||||
this.world.getType(blockposition).a(this.world, blockposition, (Entity) this);
|
||||
if (!this.world.s_() && this.hasExplosions()) {
|
||||
this.level.getType(blockposition).a(this.level, blockposition, (Entity) this);
|
||||
if (!this.level.isClientSide() && this.hasExplosions()) {
|
||||
- this.explode();
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
|
||||
@@ -57,19 +57,19 @@
|
||||
}
|
||||
|
||||
super.a(movingobjectpositionblock);
|
||||
@@ -196,7 +210,9 @@
|
||||
@@ -208,7 +222,9 @@
|
||||
|
||||
if (f > 0.0F) {
|
||||
if (this.ridingEntity != null) {
|
||||
if (this.attachedToEntity != null) {
|
||||
+ CraftEventFactory.entityDamage = this; // CraftBukkit
|
||||
this.ridingEntity.damageEntity(DamageSource.a(this, this.getShooter()), 5.0F + (float) (nbttaglist.size() * 2));
|
||||
this.attachedToEntity.damageEntity(DamageSource.a(this, this.getShooter()), 5.0F + (float) (nbttaglist.size() * 2));
|
||||
+ CraftEventFactory.entityDamage = null; // CraftBukkit
|
||||
}
|
||||
|
||||
double d0 = 5.0D;
|
||||
@@ -223,7 +239,9 @@
|
||||
@@ -235,7 +251,9 @@
|
||||
if (flag) {
|
||||
float f1 = f * (float) Math.sqrt((5.0D - (double) this.g((Entity) entityliving)) / 5.0D);
|
||||
float f1 = f * (float) Math.sqrt((5.0D - (double) this.e((Entity) entityliving)) / 5.0D);
|
||||
|
||||
+ CraftEventFactory.entityDamage = this; // CraftBukkit
|
||||
entityliving.damageEntity(DamageSource.a(this, this.getShooter()), f1);
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
+
|
||||
public class EntityFishingHook extends IProjectile {
|
||||
|
||||
private final Random b;
|
||||
@@ -63,6 +69,12 @@
|
||||
private final int an;
|
||||
private final int lureLevel;
|
||||
private final Random syncronizedRandom;
|
||||
@@ -65,6 +71,12 @@
|
||||
private final int luck;
|
||||
private final int lureSpeed;
|
||||
|
||||
+ // CraftBukkit start - Extra variables to enable modification of fishing wait time, values are minecraft defaults
|
||||
+ public int minWaitTime = 100;
|
||||
@@ -23,11 +23,11 @@
|
||||
+ 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();
|
||||
@@ -244,7 +256,7 @@
|
||||
private void m() {
|
||||
private EntityFishingHook(EntityTypes<? extends EntityFishingHook> entitytypes, World world, int i, int j) {
|
||||
super(entitytypes, world);
|
||||
this.syncronizedRandom = new Random();
|
||||
@@ -259,7 +271,7 @@
|
||||
private void l() {
|
||||
MovingObjectPosition movingobjectposition = ProjectileHelper.a((Entity) this, this::a);
|
||||
|
||||
- this.a(movingobjectposition);
|
||||
@@ -35,67 +35,67 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -291,6 +303,10 @@
|
||||
this.waitTime = 0;
|
||||
this.ai = 0;
|
||||
this.getDataWatcher().set(EntityFishingHook.f, false);
|
||||
@@ -306,6 +318,10 @@
|
||||
this.timeUntilLured = 0;
|
||||
this.timeUntilHooked = 0;
|
||||
this.getDataWatcher().set(EntityFishingHook.DATA_BITING, 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);
|
||||
+ this.level.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
} else {
|
||||
float f;
|
||||
@@ -324,6 +340,13 @@
|
||||
@@ -339,6 +355,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);
|
||||
+ this.level.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);
|
||||
this.playSound(SoundEffects.FISHING_BOBBER_SPLASH, 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
|
||||
double d3 = this.locY() + 0.5D;
|
||||
|
||||
@@ -360,8 +383,10 @@
|
||||
this.ai = MathHelper.nextInt(this.random, 20, 80);
|
||||
@@ -375,8 +398,10 @@
|
||||
this.timeUntilHooked = MathHelper.nextInt(this.random, 20, 80);
|
||||
}
|
||||
} else {
|
||||
- this.waitTime = MathHelper.nextInt(this.random, 100, 600);
|
||||
- this.waitTime -= this.lureLevel * 20 * 5;
|
||||
- this.timeUntilLured = MathHelper.nextInt(this.random, 100, 600);
|
||||
- this.timeUntilLured -= this.lureSpeed * 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;
|
||||
+ this.timeUntilLured = MathHelper.nextInt(this.random, this.minWaitTime, this.maxWaitTime);
|
||||
+ this.timeUntilLured -= (this.applyLure) ? this.lureSpeed * 20 * 5 : 0;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,6 +453,14 @@
|
||||
@@ -443,6 +468,14 @@
|
||||
int i = 0;
|
||||
|
||||
if (this.hooked != null) {
|
||||
if (this.hookedIn != 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);
|
||||
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), this.hookedIn.getBukkitEntity(), (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_ENTITY);
|
||||
+ this.level.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);
|
||||
@@ -443,6 +476,15 @@
|
||||
this.reel(this.hookedIn);
|
||||
CriterionTriggers.FISHING_ROD_HOOKED.a((EntityPlayer) entityhuman, itemstack, this, (Collection) Collections.emptyList());
|
||||
this.level.broadcastEntityEffect(this, (byte) 31);
|
||||
@@ -458,6 +491,15 @@
|
||||
while (iterator.hasNext()) {
|
||||
ItemStack itemstack1 = (ItemStack) iterator.next();
|
||||
EntityItem entityitem = new EntityItem(this.world, this.locX(), this.locY(), this.locZ(), itemstack1);
|
||||
EntityItem entityitem = new EntityItem(this.level, 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);
|
||||
+ this.level.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
+
|
||||
+ if (playerFishEvent.isCancelled()) {
|
||||
+ return 0;
|
||||
@@ -104,26 +104,26 @@
|
||||
double d0 = entityhuman.locX() - this.locX();
|
||||
double d1 = entityhuman.locY() - this.locY();
|
||||
double d2 = entityhuman.locZ() - this.locZ();
|
||||
@@ -450,7 +492,11 @@
|
||||
@@ -465,7 +507,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));
|
||||
this.level.addEntity(entityitem);
|
||||
- entityhuman.level.addEntity(new EntityExperienceOrb(entityhuman.level, 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()));
|
||||
+ entityhuman.level.addEntity(new EntityExperienceOrb(entityhuman.level, entityhuman.locX(), entityhuman.locY() + 0.5D, entityhuman.locZ() + 0.5D, playerFishEvent.getExpToDrop()));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (itemstack1.getItem().a((Tag) TagsItem.FISHES)) {
|
||||
if (itemstack1.a((Tag) TagsItem.FISHES)) {
|
||||
entityhuman.a(StatisticList.FISH_CAUGHT, 1);
|
||||
}
|
||||
@@ -460,8 +506,25 @@
|
||||
@@ -475,8 +521,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);
|
||||
+ this.level.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
+
|
||||
+ if (playerFishEvent.isCancelled()) {
|
||||
+ return 0;
|
||||
@@ -134,7 +134,7 @@
|
||||
+ // 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);
|
||||
+ this.level.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
+ if (playerFishEvent.isCancelled()) {
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityLargeFireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityLargeFireball.java
|
||||
@@ -11,16 +11,20 @@
|
||||
@@ -11,17 +11,21 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
|
||||
@@ -8,43 +8,44 @@
|
||||
+
|
||||
public class EntityLargeFireball extends EntityFireballFireball {
|
||||
|
||||
public int yield = 1;
|
||||
public int explosionPower = 1;
|
||||
|
||||
public EntityLargeFireball(EntityTypes<? extends EntityLargeFireball> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
+ isIncendiary = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING); // CraftBukkit
|
||||
+ isIncendiary = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // CraftBukkit
|
||||
}
|
||||
|
||||
public EntityLargeFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) {
|
||||
public EntityLargeFireball(World world, EntityLiving entityliving, double d0, double d1, double d2, int i) {
|
||||
super(EntityTypes.FIREBALL, entityliving, d0, d1, d2, world);
|
||||
+ isIncendiary = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING); // CraftBukkit
|
||||
this.explosionPower = i;
|
||||
+ isIncendiary = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -29,7 +33,15 @@
|
||||
if (!this.world.isClientSide) {
|
||||
boolean flag = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING);
|
||||
@@ -30,7 +34,15 @@
|
||||
if (!this.level.isClientSide) {
|
||||
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
|
||||
- this.world.createExplosion((Entity) null, this.locX(), this.locY(), this.locZ(), (float) this.yield, flag, flag ? Explosion.Effect.DESTROY : Explosion.Effect.NONE);
|
||||
- this.level.createExplosion((Entity) null, this.locX(), this.locY(), this.locZ(), (float) this.explosionPower, 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);
|
||||
+ this.level.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);
|
||||
+ this.level.createExplosion(this, this.locX(), this.locY(), this.locZ(), event.getRadius(), event.getFire(), flag ? Explosion.Effect.DESTROY : Explosion.Effect.NONE);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.die();
|
||||
}
|
||||
|
||||
@@ -60,7 +72,8 @@
|
||||
@@ -61,7 +73,8 @@
|
||||
public void loadData(NBTTagCompound nbttagcompound) {
|
||||
super.loadData(nbttagcompound);
|
||||
if (nbttagcompound.hasKeyOfType("ExplosionPower", 99)) {
|
||||
- this.yield = nbttagcompound.getInt("ExplosionPower");
|
||||
- this.explosionPower = nbttagcompound.getByte("ExplosionPower");
|
||||
+ // CraftBukkit - set bukkitYield when setting explosionpower
|
||||
+ bukkitYield = this.yield = nbttagcompound.getInt("ExplosionPower");
|
||||
+ bukkitYield = this.explosionPower = nbttagcompound.getByte("ExplosionPower");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityLlamaSpit.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityLlamaSpit.java
|
||||
@@ -34,7 +34,7 @@
|
||||
@@ -33,7 +33,7 @@
|
||||
Vec3D vec3d = this.getMot();
|
||||
MovingObjectPosition movingobjectposition = ProjectileHelper.a((Entity) this, this::a);
|
||||
|
||||
if (movingobjectposition != null) {
|
||||
- this.a(movingobjectposition);
|
||||
+ this.preOnHit(movingobjectposition); // CraftBukkit - projectile hit event
|
||||
}
|
||||
|
||||
- this.a(movingobjectposition);
|
||||
+ this.preOnHit(movingobjectposition); // CraftBukkit - projectile hit event
|
||||
double d0 = this.locX() + vec3d.x;
|
||||
double d1 = this.locY() + vec3d.y;
|
||||
double d2 = this.locZ() + vec3d.z;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityPotion.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityPotion.java
|
||||
@@ -32,6 +32,16 @@
|
||||
@@ -34,6 +34,16 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityPotion extends EntityProjectileThrowable {
|
||||
public class EntityPotion extends EntityProjectileThrowable implements ItemSupplier {
|
||||
|
||||
public static final Predicate<EntityLiving> b = EntityLiving::dO;
|
||||
@@ -96,7 +106,7 @@
|
||||
public static final double SPLASH_RANGE = 4.0D;
|
||||
@@ -100,7 +110,7 @@
|
||||
|
||||
if (flag) {
|
||||
this.splash();
|
||||
@@ -26,15 +26,15 @@
|
||||
if (this.isLingering()) {
|
||||
this.a(itemstack, potionregistry);
|
||||
} else {
|
||||
@@ -133,6 +143,7 @@
|
||||
@@ -146,6 +156,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);
|
||||
List<EntityLiving> list1 = this.level.a(EntityLiving.class, axisalignedbb);
|
||||
+ Map<LivingEntity, Double> affected = new HashMap<LivingEntity, Double>(); // CraftBukkit
|
||||
|
||||
if (!list1.isEmpty()) {
|
||||
Iterator iterator = list1.iterator();
|
||||
@@ -150,21 +161,46 @@
|
||||
Entity entity1 = this.x();
|
||||
@@ -164,21 +175,47 @@
|
||||
d1 = 1.0D;
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
+
|
||||
+ 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
|
||||
+ Entity entity1 = this.x();
|
||||
+ for (LivingEntity victim : event.getAffectedEntities()) {
|
||||
+ if (!(victim instanceof CraftLivingEntity)) {
|
||||
+ continue;
|
||||
@@ -63,7 +64,7 @@
|
||||
+ 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()) {
|
||||
+ if (!this.level.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) {
|
||||
@@ -87,49 +88,56 @@
|
||||
- int i = (int) (d1 * (double) mobeffect.getDuration() + 0.5D);
|
||||
-
|
||||
- if (i > 20) {
|
||||
- entityliving.addEffect(new MobEffect(mobeffectlist, i, mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isShowParticles()));
|
||||
- entityliving.addEffect(new MobEffect(mobeffectlist, i, mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isShowParticles()), entity1);
|
||||
- }
|
||||
- }
|
||||
+ if (i > 20) {
|
||||
+ entityliving.addEffect(new MobEffect(mobeffectlist, i, mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isShowParticles()), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.POTION_SPLASH); // CraftBukkit
|
||||
+ entityliving.addEffect(new MobEffect(mobeffectlist, i, mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isShowParticles()), entity1, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.POTION_SPLASH); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -200,7 +236,14 @@
|
||||
@@ -214,7 +251,14 @@
|
||||
entityareaeffectcloud.setColor(nbttagcompound.getInt("CustomPotionColor"));
|
||||
}
|
||||
|
||||
- this.world.addEntity(entityareaeffectcloud);
|
||||
- this.level.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);
|
||||
+ if (!(event.isCancelled() || entityareaeffectcloud.isRemoved())) {
|
||||
+ this.level.addEntity(entityareaeffectcloud);
|
||||
+ } else {
|
||||
+ entityareaeffectcloud.dead = true;
|
||||
+ entityareaeffectcloud.die();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public boolean isLingering() {
|
||||
@@ -211,11 +254,19 @@
|
||||
IBlockData iblockdata = this.world.getType(blockposition);
|
||||
@@ -225,13 +269,25 @@
|
||||
IBlockData iblockdata = this.level.getType(blockposition);
|
||||
|
||||
if (iblockdata.a((Tag) TagsBlock.FIRE)) {
|
||||
- this.world.a(blockposition, false);
|
||||
- this.level.a(blockposition, false);
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ this.world.a(blockposition, false);
|
||||
+ this.level.a(blockposition, false);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else if (AbstractCandleBlock.b(iblockdata)) {
|
||||
- AbstractCandleBlock.a((EntityHuman) null, iblockdata, (GeneratorAccess) this.level, blockposition);
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, iblockdata.set(AbstractCandleBlock.LIT, false)).isCancelled()) {
|
||||
+ AbstractCandleBlock.a((EntityHuman) null, iblockdata, (GeneratorAccess) this.level, blockposition);
|
||||
+ }
|
||||
+ // 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));
|
||||
- this.level.a((EntityHuman) null, 1009, blockposition, 0);
|
||||
- BlockCampfire.a(this.getShooter(), (GeneratorAccess) this.level, blockposition, iblockdata);
|
||||
- this.level.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));
|
||||
+ this.level.a((EntityHuman) null, 1009, blockposition, 0);
|
||||
+ BlockCampfire.a(this.getShooter(), (GeneratorAccess) this.level, blockposition, iblockdata);
|
||||
+ this.level.setTypeUpdate(blockposition, (IBlockData) iblockdata.set(BlockCampfire.LIT, false));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityProjectile.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityProjectile.java
|
||||
@@ -57,7 +57,7 @@
|
||||
@@ -67,7 +67,7 @@
|
||||
}
|
||||
|
||||
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS && !flag) {
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
@@ -29,8 +29,8 @@
|
||||
|
||||
public void setItem(ItemStack itemstack) {
|
||||
if (itemstack.getItem() != this.getDefaultItem() || itemstack.hasTag()) {
|
||||
- this.getDataWatcher().set(EntityProjectileThrowable.b, SystemUtils.a((Object) itemstack.cloneItemStack(), (itemstack1) -> {
|
||||
if (!itemstack.a(this.getDefaultItem()) || itemstack.hasTag()) {
|
||||
- this.getDataWatcher().set(EntityProjectileThrowable.DATA_ITEM_STACK, (ItemStack) SystemUtils.a((Object) itemstack.cloneItemStack(), (itemstack1) -> {
|
||||
- itemstack1.setCount(1);
|
||||
+ this.getDataWatcher().set(EntityProjectileThrowable.b, SystemUtils.a(itemstack.cloneItemStack(), (itemstack1) -> { // CraftBukkit - decompile error
|
||||
+ this.getDataWatcher().set(EntityProjectileThrowable.DATA_ITEM_STACK, (ItemStack) SystemUtils.a(itemstack.cloneItemStack(), (itemstack1) -> { // CraftBukkit - decompile error
|
||||
+ if (!itemstack1.isEmpty()) itemstack1.setCount(1); // CraftBukkit
|
||||
}));
|
||||
}
|
||||
@@ -22,5 +22,5 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public ItemStack getItem() {
|
||||
return (ItemStack) this.getDataWatcher().get(EntityProjectileThrowable.b);
|
||||
return (ItemStack) this.getDataWatcher().get(EntityProjectileThrowable.DATA_ITEM_STACK);
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityShulkerBullet.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityShulkerBullet.java
|
||||
@@ -58,8 +58,21 @@
|
||||
this.target = entity;
|
||||
this.dir = EnumDirection.UP;
|
||||
@@ -60,8 +60,21 @@
|
||||
this.finalTarget = entity;
|
||||
this.currentMoveDirection = EnumDirection.UP;
|
||||
this.a(enumdirection_enumaxis);
|
||||
+ projectileSource = (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public Entity getTarget() {
|
||||
+ return this.target;
|
||||
+ return this.finalTarget;
|
||||
+ }
|
||||
+
|
||||
+ public void setTarget(Entity e) {
|
||||
+ this.target = e;
|
||||
+ this.dir = EnumDirection.UP;
|
||||
+ this.finalTarget = e;
|
||||
+ this.currentMoveDirection = EnumDirection.UP;
|
||||
+ this.a(EnumDirection.EnumAxis.X);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
@@ -22,7 +22,7 @@
|
||||
@Override
|
||||
public SoundCategory getSoundCategory() {
|
||||
return SoundCategory.HOSTILE;
|
||||
@@ -218,7 +231,7 @@
|
||||
@@ -225,7 +238,7 @@
|
||||
MovingObjectPosition movingobjectposition = ProjectileHelper.a((Entity) this, this::a);
|
||||
|
||||
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
|
||||
@@ -31,16 +31,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,7 +293,7 @@
|
||||
@@ -292,7 +305,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
|
||||
- ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.LEVITATION, 200), (Entity) MoreObjects.firstNonNull(entity1, this));
|
||||
+ ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.LEVITATION, 200), (Entity) MoreObjects.firstNonNull(entity1, this), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,6 +319,11 @@
|
||||
@@ -318,6 +331,11 @@
|
||||
|
||||
@Override
|
||||
public boolean damageEntity(DamageSource damagesource, float f) {
|
||||
@@ -49,6 +49,6 @@
|
||||
+ 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);
|
||||
if (!this.level.isClientSide) {
|
||||
this.playSound(SoundEffects.SHULKER_BULLET_HURT, 1.0F, 1.0F);
|
||||
((WorldServer) this.level).a(Particles.CRIT, this.locX(), this.locY(), this.locZ(), 15, 0.2D, 0.2D, 0.2D, 0.0D);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
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);
|
||||
+ isIncendiary = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
@@ -28,7 +28,7 @@
|
||||
- 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);
|
||||
+ entity.level.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ entity.setOnFire(event.getDuration(), false);
|
||||
@@ -38,15 +38,15 @@
|
||||
|
||||
if (!flag) {
|
||||
@@ -57,10 +71,10 @@
|
||||
if (!this.world.isClientSide) {
|
||||
if (!this.level.isClientSide) {
|
||||
Entity entity = this.getShooter();
|
||||
|
||||
- if (entity == null || !(entity instanceof EntityInsentient) || this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) {
|
||||
- if (!(entity instanceof EntityInsentient) || this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ 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));
|
||||
- if (this.level.isEmpty(blockposition)) {
|
||||
+ if (this.level.isEmpty(blockposition) && !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(level, blockposition, this).isCancelled()) { // CraftBukkit
|
||||
this.level.setTypeUpdate(blockposition, BlockFireAbstract.a((IBlockAccess) this.level, blockposition));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
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
|
||||
- entityliving.addEffect(mobeffect, this.x());
|
||||
+ entityliving.addEffect(mobeffect, this.x(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityThrownExpBottle.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityThrownExpBottle.java
|
||||
@@ -38,9 +38,18 @@
|
||||
@@ -39,9 +39,18 @@
|
||||
protected void a(MovingObjectPosition movingobjectposition) {
|
||||
super.a(movingobjectposition);
|
||||
if (!this.world.isClientSide) {
|
||||
- this.world.triggerEffect(2002, this.getChunkCoordinates(), PotionUtil.a(Potions.WATER));
|
||||
if (this.level instanceof WorldServer) {
|
||||
- this.level.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);
|
||||
+ // this.level.triggerEffect(2002, this.getChunkCoordinates(), PotionUtil.a(Potions.WATER));
|
||||
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, i);
|
||||
+ i = event.getExperience();
|
||||
+ if (event.getShowEffect()) {
|
||||
+ this.world.triggerEffect(2002, this.getChunkCoordinates(), PotionUtil.a(Potions.WATER));
|
||||
+ this.level.triggerEffect(2002, this.getChunkCoordinates(), PotionUtil.a(Potions.WATER));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
while (i > 0) {
|
||||
int j = EntityExperienceOrb.getOrbValue(i);
|
||||
|
||||
EntityExperienceOrb.a((WorldServer) this.level, this.getPositionVector(), i);
|
||||
this.die();
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityThrownTrident.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityThrownTrident.java
|
||||
@@ -154,7 +154,7 @@
|
||||
@@ -157,7 +157,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;
|
||||
entitylightning.b(entity1 instanceof EntityPlayer ? (EntityPlayer) entity1 : null);
|
||||
- this.level.addEntity(entitylightning);
|
||||
+ ((WorldServer) this.level).strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRIDENT); // CraftBukkit
|
||||
soundeffect = SoundEffects.TRIDENT_THUNDER;
|
||||
f1 = 5.0F;
|
||||
}
|
||||
|
||||
@@ -1,46 +1,46 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityTippedArrow.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityTippedArrow.java
|
||||
@@ -138,6 +138,25 @@
|
||||
@@ -142,6 +142,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start accessor methods
|
||||
+ public void refreshEffects() {
|
||||
+ this.getDataWatcher().set(EntityTippedArrow.COLOR, PotionUtil.a((Collection) PotionUtil.a(this.potionRegistry, (Collection) this.effects)));
|
||||
+ this.getDataWatcher().set(EntityTippedArrow.ID_EFFECT_COLOR, PotionUtil.a((Collection) PotionUtil.a(this.potion, (Collection) this.effects)));
|
||||
+ }
|
||||
+
|
||||
+ public String getType() {
|
||||
+ return IRegistry.POTION.getKey(this.potionRegistry).toString();
|
||||
+ return IRegistry.POTION.getKey(this.potion).toString();
|
||||
+ }
|
||||
+
|
||||
+ public void setType(String string) {
|
||||
+ this.potionRegistry = IRegistry.POTION.get(new net.minecraft.resources.MinecraftKey(string));
|
||||
+ this.getDataWatcher().set(EntityTippedArrow.COLOR, PotionUtil.a((Collection) PotionUtil.a(this.potionRegistry, (Collection) this.effects)));
|
||||
+ this.potion = IRegistry.POTION.get(new net.minecraft.resources.MinecraftKey(string));
|
||||
+ this.getDataWatcher().set(EntityTippedArrow.ID_EFFECT_COLOR, PotionUtil.a((Collection) PotionUtil.a(this.potion, (Collection) this.effects)));
|
||||
+ }
|
||||
+
|
||||
+ public boolean isTipped() {
|
||||
+ return !(this.effects.isEmpty() && this.potionRegistry == Potions.EMPTY);
|
||||
+ return !(this.effects.isEmpty() && this.potion == Potions.EMPTY);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public int getColor() {
|
||||
return (Integer) this.datawatcher.get(EntityTippedArrow.COLOR);
|
||||
return (Integer) this.entityData.get(EntityTippedArrow.ID_EFFECT_COLOR);
|
||||
}
|
||||
@@ -205,7 +224,7 @@
|
||||
@@ -210,7 +229,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
|
||||
- entityliving.addEffect(new MobEffect(mobeffect.getMobEffect(), Math.max(mobeffect.getDuration() / 8, 1), mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isShowParticles()), entity);
|
||||
+ entityliving.addEffect(new MobEffect(mobeffect.getMobEffect(), Math.max(mobeffect.getDuration() / 8, 1), mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isShowParticles()), entity, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
|
||||
}
|
||||
|
||||
if (!this.effects.isEmpty()) {
|
||||
@@ -213,7 +232,7 @@
|
||||
@@ -218,7 +237,7 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
mobeffect = (MobEffect) iterator.next();
|
||||
- entityliving.addEffect(mobeffect);
|
||||
+ entityliving.addEffect(mobeffect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
|
||||
- entityliving.addEffect(mobeffect, entity);
|
||||
+ entityliving.addEffect(mobeffect, entity, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
+
|
||||
public class EntityWitherSkull extends EntityFireball {
|
||||
|
||||
private static final DataWatcherObject<Boolean> e = DataWatcher.a(EntityWitherSkull.class, DataWatcherRegistry.i);
|
||||
private static final DataWatcherObject<Boolean> DATA_DANGEROUS = DataWatcher.a(EntityWitherSkull.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -64,7 +66,7 @@
|
||||
if (entity.isAlive()) {
|
||||
this.a(entityliving, entity);
|
||||
@@ -22,23 +22,23 @@
|
||||
}
|
||||
|
||||
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
|
||||
- ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.WITHER, 20 * b0, 1), this.x());
|
||||
+ ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.WITHER, 20 * b0, 1), this.x(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +96,15 @@
|
||||
if (!this.world.isClientSide) {
|
||||
Explosion.Effect explosion_effect = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
|
||||
if (!this.level.isClientSide) {
|
||||
Explosion.Effect explosion_effect = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
|
||||
|
||||
- this.world.createExplosion(this, this.locX(), this.locY(), this.locZ(), 1.0F, false, explosion_effect);
|
||||
- this.level.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);
|
||||
+ // this.level.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);
|
||||
+ this.level.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.world.createExplosion(this, this.locX(), this.locY(), this.locZ(), event.getRadius(), event.getFire(), explosion_effect);
|
||||
+ this.level.createExplosion(this, this.locX(), this.locY(), this.locZ(), event.getRadius(), event.getFire(), explosion_effect);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.die();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/IProjectile.java
|
||||
+++ b/net/minecraft/world/entity/projectile/IProjectile.java
|
||||
@@ -15,12 +15,20 @@
|
||||
@@ -22,6 +22,10 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -10,9 +10,10 @@
|
||||
+
|
||||
public abstract class IProjectile extends Entity {
|
||||
|
||||
private UUID shooter;
|
||||
private int c;
|
||||
private boolean d;
|
||||
@Nullable
|
||||
@@ -31,6 +35,10 @@
|
||||
private boolean leftOwner;
|
||||
private boolean hasBeenShot;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ private boolean hitCancelled = false;
|
||||
@@ -21,15 +22,15 @@
|
||||
IProjectile(EntityTypes<? extends IProjectile> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
}
|
||||
@@ -30,6 +38,7 @@
|
||||
this.shooter = entity.getUniqueID();
|
||||
this.c = entity.getId();
|
||||
@@ -40,6 +48,7 @@
|
||||
this.ownerUUID = entity.getUniqueID();
|
||||
this.cachedOwner = entity;
|
||||
}
|
||||
+ this.projectileSource = (entity != null && entity.getBukkitEntity() instanceof ProjectileSource) ? (ProjectileSource) entity.getBukkitEntity() : null; // CraftBukkit
|
||||
|
||||
}
|
||||
|
||||
@@ -111,6 +120,16 @@
|
||||
@@ -143,6 +152,16 @@
|
||||
this.setMot(this.getMot().add(vec3d.x, entity.isOnGround() ? 0.0D : vec3d.y, vec3d.z));
|
||||
}
|
||||
|
||||
@@ -46,7 +47,7 @@
|
||||
protected void a(MovingObjectPosition movingobjectposition) {
|
||||
MovingObjectPosition.EnumMovingObjectType movingobjectposition_enummovingobjecttype = movingobjectposition.getType();
|
||||
|
||||
@@ -125,6 +144,11 @@
|
||||
@@ -161,6 +180,11 @@
|
||||
protected void a(MovingObjectPositionEntity movingobjectpositionentity) {}
|
||||
|
||||
protected void a(MovingObjectPositionBlock movingobjectpositionblock) {
|
||||
@@ -55,6 +56,6 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
IBlockData iblockdata = this.world.getType(movingobjectpositionblock.getBlockPosition());
|
||||
IBlockData iblockdata = this.level.getType(movingobjectpositionblock.getBlockPosition());
|
||||
|
||||
iblockdata.a(this.world, iblockdata, movingobjectpositionblock, this);
|
||||
iblockdata.a(this.level, iblockdata, movingobjectpositionblock, this);
|
||||
|
||||
Reference in New Issue
Block a user