forked from xjboss/KCauldronX
Initial commit (Forge 1291).
This commit is contained in:
141
patches/net/minecraft/entity/projectile/EntityArrow.java.patch
Normal file
141
patches/net/minecraft/entity/projectile/EntityArrow.java.patch
Normal file
@ -0,0 +1,141 @@
|
||||
--- ../src-base/minecraft/net/minecraft/entity/projectile/EntityArrow.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityArrow.java
|
||||
@@ -23,6 +23,13 @@
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.entity.item.EntityItem;
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
||||
+import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityArrow extends Entity implements IProjectile
|
||||
{
|
||||
private int field_145791_d = -1;
|
||||
@@ -30,14 +37,14 @@
|
||||
private int field_145789_f = -1;
|
||||
private Block field_145790_g;
|
||||
private int inData;
|
||||
- private boolean inGround;
|
||||
+ public boolean inGround = false; // Spigot - private -> public
|
||||
public int canBePickedUp;
|
||||
public int arrowShake;
|
||||
public Entity shootingEntity;
|
||||
private int ticksInGround;
|
||||
private int ticksInAir;
|
||||
private double damage = 2.0D;
|
||||
- private int knockbackStrength;
|
||||
+ public int knockbackStrength; // CraftBukkit - private -> public
|
||||
private static final String __OBFID = "CL_00001715";
|
||||
|
||||
public EntityArrow(World p_i1753_1_)
|
||||
@@ -61,6 +68,7 @@
|
||||
super(p_i1755_1_);
|
||||
this.renderDistanceWeight = 10.0D;
|
||||
this.shootingEntity = p_i1755_2_;
|
||||
+ this.projectileSource = (LivingEntity) p_i1755_2_.getBukkitEntity(); // CraftBukkit
|
||||
|
||||
if (p_i1755_2_ instanceof EntityPlayer)
|
||||
{
|
||||
@@ -91,6 +99,7 @@
|
||||
super(p_i1756_1_);
|
||||
this.renderDistanceWeight = 10.0D;
|
||||
this.shootingEntity = p_i1756_2_;
|
||||
+ this.projectileSource = (LivingEntity) p_i1756_2_.getBukkitEntity(); // CraftBukkit
|
||||
|
||||
if (p_i1756_2_ instanceof EntityPlayer)
|
||||
{
|
||||
@@ -199,7 +208,7 @@
|
||||
{
|
||||
++this.ticksInGround;
|
||||
|
||||
- if (this.ticksInGround == 1200)
|
||||
+ if (this.ticksInGround == worldObj.getSpigotConfig().arrowDespawnRate) // Spigot // Cauldron
|
||||
{
|
||||
this.setDead();
|
||||
}
|
||||
@@ -246,7 +255,7 @@
|
||||
|
||||
if (movingobjectposition1 != null)
|
||||
{
|
||||
- double d1 = vec31.distanceTo(movingobjectposition1.hitVec);
|
||||
+ double d1 = vec31.squareDistanceTo(movingobjectposition1.hitVec); // CraftBukkit - distance efficiency
|
||||
|
||||
if (d1 < d0 || d0 == 0.0D)
|
||||
{
|
||||
@@ -277,6 +286,8 @@
|
||||
|
||||
if (movingobjectposition != null)
|
||||
{
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // CraftBukkit - Call event
|
||||
+
|
||||
if (movingobjectposition.entityHit != null)
|
||||
{
|
||||
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
|
||||
@@ -298,13 +309,23 @@
|
||||
damagesource = DamageSource.causeArrowDamage(this, this.shootingEntity);
|
||||
}
|
||||
|
||||
- if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman))
|
||||
+ // CraftBukkit start - Moved damage call
|
||||
+ if (movingobjectposition.entityHit.attackEntityFrom(damagesource, k))
|
||||
{
|
||||
- movingobjectposition.entityHit.setFire(5);
|
||||
- }
|
||||
+ if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman) && (!(movingobjectposition.entityHit instanceof EntityPlayerMP) || !(this.shootingEntity instanceof EntityPlayerMP) || this.worldObj.pvpMode)) // CraftBukkit - abide by pvp setting if destination is a player
|
||||
+ {
|
||||
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5);
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
|
||||
|
||||
- if (movingobjectposition.entityHit.attackEntityFrom(damagesource, (float)k))
|
||||
- {
|
||||
+ if (!combustEvent.isCancelled())
|
||||
+ {
|
||||
+ movingobjectposition.entityHit.setFire(combustEvent.getDuration());
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
+
|
||||
+ // if (movingobjectposition.entityHit.attackEntityFrom(damagesource, (float)k)) { // CraftBukkit - moved up
|
||||
if (movingobjectposition.entityHit instanceof EntityLivingBase)
|
||||
{
|
||||
EntityLivingBase entitylivingbase = (EntityLivingBase)movingobjectposition.entityHit;
|
||||
@@ -487,6 +508,23 @@
|
||||
{
|
||||
if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0)
|
||||
{
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack = new ItemStack(Items.arrow);
|
||||
+
|
||||
+ if (this.canBePickedUp == 1 && p_70100_1_.inventory.canHold(itemstack) > 0)
|
||||
+ {
|
||||
+ EntityItem item = new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, itemstack);
|
||||
+ PlayerPickupItemEvent event = new PlayerPickupItemEvent((org.bukkit.entity.Player) p_70100_1_.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.worldObj.getServer(), this, item), 0);
|
||||
+ // event.setCancelled(!entityplayer.canPickUpLoot); TODO
|
||||
+ this.worldObj.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled())
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2 && p_70100_1_.capabilities.isCreativeMode;
|
||||
|
||||
if (this.canBePickedUp == 1 && !p_70100_1_.inventory.addItemStackToInventory(new ItemStack(Items.arrow, 1)))
|
||||
@@ -553,4 +591,11 @@
|
||||
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
|
||||
return (b0 & 1) != 0;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public boolean isInGround()
|
||||
+ {
|
||||
+ return inGround;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
73
patches/net/minecraft/entity/projectile/EntityEgg.java.patch
Normal file
73
patches/net/minecraft/entity/projectile/EntityEgg.java.patch
Normal file
@ -0,0 +1,73 @@
|
||||
--- ../src-base/minecraft/net/minecraft/entity/projectile/EntityEgg.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityEgg.java
|
||||
@@ -6,6 +6,15 @@
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.entity.player.EntityPlayerMP;
|
||||
+import org.bukkit.entity.Ageable;
|
||||
+import org.bukkit.entity.EntityType;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.player.PlayerEggThrowEvent;
|
||||
+import net.minecraft.entity.Entity;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityEgg extends EntityThrowable
|
||||
{
|
||||
private static final String __OBFID = "CL_00001724";
|
||||
@@ -32,24 +41,43 @@
|
||||
p_70184_1_.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0.0F);
|
||||
}
|
||||
|
||||
- if (!this.worldObj.isRemote && this.rand.nextInt(8) == 0)
|
||||
+ // CraftBukkit start
|
||||
+ boolean hatching = !this.worldObj.isRemote && this.rand.nextInt(8) == 0;
|
||||
+ int numHatching = (this.rand.nextInt(32) == 0) ? 4 : 1;
|
||||
+
|
||||
+ if (!hatching)
|
||||
{
|
||||
- byte b0 = 1;
|
||||
+ numHatching = 0;
|
||||
+ }
|
||||
|
||||
- if (this.rand.nextInt(32) == 0)
|
||||
- {
|
||||
- b0 = 4;
|
||||
- }
|
||||
+ EntityType hatchingType = EntityType.CHICKEN;
|
||||
+ Entity shooter = this.getThrower();
|
||||
|
||||
- for (int i = 0; i < b0; ++i)
|
||||
+ if (shooter instanceof EntityPlayerMP)
|
||||
+ {
|
||||
+ Player player = (shooter == null) ? null : (Player) shooter.getBukkitEntity();
|
||||
+ PlayerEggThrowEvent event = new PlayerEggThrowEvent(player, (org.bukkit.entity.Egg) this.getBukkitEntity(), hatching, (byte) numHatching, hatchingType);
|
||||
+ this.worldObj.getServer().getPluginManager().callEvent(event);
|
||||
+ hatching = event.isHatching();
|
||||
+ numHatching = event.getNumHatches();
|
||||
+ hatchingType = event.getHatchingType();
|
||||
+ }
|
||||
+
|
||||
+ if (hatching)
|
||||
+ {
|
||||
+ for (int k = 0; k < numHatching; k++)
|
||||
{
|
||||
- EntityChicken entitychicken = new EntityChicken(this.worldObj);
|
||||
- entitychicken.setGrowingAge(-24000);
|
||||
- entitychicken.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
|
||||
- this.worldObj.spawnEntityInWorld(entitychicken);
|
||||
+ org.bukkit.entity.Entity entity = worldObj.getWorld().spawn(new org.bukkit.Location(worldObj.getWorld(), this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F), hatchingType.getEntityClass(), org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG);
|
||||
+
|
||||
+ if (entity instanceof Ageable)
|
||||
+ {
|
||||
+ ((Ageable) entity).setBaby();
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
for (int j = 0; j < 8; ++j)
|
||||
{
|
||||
this.worldObj.spawnParticle("snowballpoof", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
|
@ -0,0 +1,122 @@
|
||||
--- ../src-base/minecraft/net/minecraft/entity/projectile/EntityFireball.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityFireball.java
|
||||
@@ -3,6 +3,7 @@
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
+
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -15,6 +16,8 @@
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
+
|
||||
public abstract class EntityFireball extends Entity
|
||||
{
|
||||
private int field_145795_e = -1;
|
||||
@@ -28,6 +31,8 @@
|
||||
public double accelerationX;
|
||||
public double accelerationY;
|
||||
public double accelerationZ;
|
||||
+ public float bukkitYield = 1; // CraftBukkit
|
||||
+ public boolean isIncendiary = true; // CraftBukkit
|
||||
private static final String __OBFID = "CL_00001717";
|
||||
|
||||
public EntityFireball(World p_i1759_1_)
|
||||
@@ -62,11 +67,19 @@
|
||||
{
|
||||
super(p_i1761_1_);
|
||||
this.shootingEntity = p_i1761_2_;
|
||||
+ this.projectileSource = (org.bukkit.entity.LivingEntity) p_i1761_2_.getBukkitEntity(); // CraftBukkit
|
||||
this.setSize(1.0F, 1.0F);
|
||||
this.setLocationAndAngles(p_i1761_2_.posX, p_i1761_2_.posY, p_i1761_2_.posZ, p_i1761_2_.rotationYaw, p_i1761_2_.rotationPitch);
|
||||
this.setPosition(this.posX, this.posY, this.posZ);
|
||||
this.yOffset = 0.0F;
|
||||
this.motionX = this.motionY = this.motionZ = 0.0D;
|
||||
+ // CraftBukkit start - Added setDirection method
|
||||
+ this.setDirection(p_i1761_3_, p_i1761_5_, p_i1761_7_);
|
||||
+ }
|
||||
+
|
||||
+ public void setDirection(double p_i1761_3_, double p_i1761_5_, double p_i1761_7_)
|
||||
+ {
|
||||
+ // CraftBukkit end
|
||||
p_i1761_3_ += this.rand.nextGaussian() * 0.4D;
|
||||
p_i1761_5_ += this.rand.nextGaussian() * 0.4D;
|
||||
p_i1761_7_ += this.rand.nextGaussian() * 0.4D;
|
||||
@@ -140,7 +153,7 @@
|
||||
|
||||
if (movingobjectposition1 != null)
|
||||
{
|
||||
- double d1 = vec3.distanceTo(movingobjectposition1.hitVec);
|
||||
+ double d1 = vec3.squareDistanceTo(movingobjectposition1.hitVec); // CraftBukkit - distance efficiency
|
||||
|
||||
if (d1 < d0 || d0 == 0.0D)
|
||||
{
|
||||
@@ -159,6 +172,14 @@
|
||||
if (movingobjectposition != null)
|
||||
{
|
||||
this.onImpact(movingobjectposition);
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ if (this.isDead)
|
||||
+ {
|
||||
+ CraftEventFactory.callProjectileHitEvent(this);
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
this.posX += this.motionX;
|
||||
@@ -227,6 +248,8 @@
|
||||
p_70014_1_.setShort("zTile", (short)this.field_145794_g);
|
||||
p_70014_1_.setByte("inTile", (byte)Block.getIdFromBlock(this.field_145796_h));
|
||||
p_70014_1_.setByte("inGround", (byte)(this.inGround ? 1 : 0));
|
||||
+ // CraftBukkit - Fix direction being mismapped to invalid variables
|
||||
+ p_70014_1_.setTag("power", this.newDoubleNBTList(new double[] { this.accelerationX, this.accelerationY, this.accelerationZ}));
|
||||
p_70014_1_.setTag("direction", this.newDoubleNBTList(new double[] {this.motionX, this.motionY, this.motionZ}));
|
||||
}
|
||||
|
||||
@@ -238,8 +261,17 @@
|
||||
this.field_145796_h = Block.getBlockById(p_70037_1_.getByte("inTile") & 255);
|
||||
this.inGround = p_70037_1_.getByte("inGround") == 1;
|
||||
|
||||
- if (p_70037_1_.hasKey("direction", 9))
|
||||
+ // CraftBukkit start - direction -> power
|
||||
+ if (p_70037_1_.hasKey("power", 9))
|
||||
{
|
||||
+ NBTTagList nbttaglist = p_70037_1_.getTagList("power", 6);
|
||||
+ this.accelerationX = nbttaglist.func_150309_d(0);
|
||||
+ this.accelerationY = nbttaglist.func_150309_d(1);
|
||||
+ this.accelerationZ = nbttaglist.func_150309_d(2);
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
+ else if (p_70037_1_.hasKey("direction", 9))
|
||||
+ {
|
||||
NBTTagList nbttaglist = p_70037_1_.getTagList("direction", 6);
|
||||
this.motionX = nbttaglist.func_150309_d(0);
|
||||
this.motionY = nbttaglist.func_150309_d(1);
|
||||
@@ -273,6 +305,13 @@
|
||||
|
||||
if (p_70097_1_.getEntity() != null)
|
||||
{
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, p_70097_1_, p_70097_2_))
|
||||
+ {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
Vec3 vec3 = p_70097_1_.getEntity().getLookVec();
|
||||
|
||||
if (vec3 != null)
|
||||
@@ -288,6 +327,7 @@
|
||||
if (p_70097_1_.getEntity() instanceof EntityLivingBase)
|
||||
{
|
||||
this.shootingEntity = (EntityLivingBase)p_70097_1_.getEntity();
|
||||
+ this.projectileSource = (org.bukkit.projectiles.ProjectileSource) this.shootingEntity.getBukkitEntity(); // CraftBukkit
|
||||
}
|
||||
|
||||
return true;
|
@ -0,0 +1,119 @@
|
||||
--- ../src-base/minecraft/net/minecraft/entity/projectile/EntityFishHook.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityFishHook.java
|
||||
@@ -27,6 +27,12 @@
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.entity.Fish;
|
||||
+import org.bukkit.event.player.PlayerFishEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityFishHook extends Entity
|
||||
{
|
||||
public static final List field_146039_d = Arrays.asList(new WeightedRandomFishable[] {(new WeightedRandomFishable(new ItemStack(Items.leather_boots), 10)).func_150709_a(0.9F), new WeightedRandomFishable(new ItemStack(Items.leather), 10), new WeightedRandomFishable(new ItemStack(Items.bone), 10), new WeightedRandomFishable(new ItemStack(Items.potionitem), 10), new WeightedRandomFishable(new ItemStack(Items.string), 5), (new WeightedRandomFishable(new ItemStack(Items.fishing_rod), 2)).func_150709_a(0.9F), new WeightedRandomFishable(new ItemStack(Items.bowl), 10), new WeightedRandomFishable(new ItemStack(Items.stick), 5), new WeightedRandomFishable(new ItemStack(Items.dye, 10, 0), 1), new WeightedRandomFishable(new ItemStack(Blocks.tripwire_hook), 10), new WeightedRandomFishable(new ItemStack(Items.rotten_flesh), 10)});
|
||||
@@ -258,7 +264,7 @@
|
||||
|
||||
if (movingobjectposition1 != null)
|
||||
{
|
||||
- d2 = vec31.distanceTo(movingobjectposition1.hitVec);
|
||||
+ d2 = vec31.squareDistanceTo(movingobjectposition1.hitVec); // CraftBukkit - distance efficiency
|
||||
|
||||
if (d2 < d0 || d0 == 0.0D)
|
||||
{
|
||||
@@ -276,6 +282,8 @@
|
||||
|
||||
if (movingobjectposition != null)
|
||||
{
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // Craftbukkit - Call event
|
||||
+
|
||||
if (movingobjectposition.entityHit != null)
|
||||
{
|
||||
if (movingobjectposition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.field_146042_b), 0.0F))
|
||||
@@ -509,6 +517,18 @@
|
||||
|
||||
if (this.field_146043_c != null)
|
||||
{
|
||||
+ // CraftBukkit start
|
||||
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.field_146042_b.getBukkitEntity(), this.field_146043_c.getBukkitEntity(), (Fish) this.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_ENTITY);
|
||||
+ this.worldObj.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
+
|
||||
+ if (playerFishEvent.isCancelled())
|
||||
+ {
|
||||
+ this.setDead();
|
||||
+ this.field_146042_b.fishEntity = null;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
double d0 = this.field_146042_b.posX - this.posX;
|
||||
double d2 = this.field_146042_b.posY - this.posY;
|
||||
double d4 = this.field_146042_b.posZ - this.posZ;
|
||||
@@ -522,6 +542,19 @@
|
||||
else if (this.field_146045_ax > 0)
|
||||
{
|
||||
EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, this.func_146033_f());
|
||||
+ // CraftBukkit start
|
||||
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.field_146042_b.getBukkitEntity(), entityitem.getBukkitEntity(), (Fish) this.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH);
|
||||
+ playerFishEvent.setExpToDrop(this.rand.nextInt(6) + 1);
|
||||
+ this.worldObj.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
+
|
||||
+ if (playerFishEvent.isCancelled())
|
||||
+ {
|
||||
+ this.setDead();
|
||||
+ this.field_146042_b.fishEntity = null;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
double d1 = this.field_146042_b.posX - this.posX;
|
||||
double d3 = this.field_146042_b.posY - this.posY;
|
||||
double d5 = this.field_146042_b.posZ - this.posZ;
|
||||
@@ -531,15 +564,36 @@
|
||||
entityitem.motionY = d3 * d9 + (double)MathHelper.sqrt_double(d7) * 0.08D;
|
||||
entityitem.motionZ = d5 * d9;
|
||||
this.worldObj.spawnEntityInWorld(entityitem);
|
||||
- this.field_146042_b.worldObj.spawnEntityInWorld(new EntityXPOrb(this.field_146042_b.worldObj, this.field_146042_b.posX, this.field_146042_b.posY + 0.5D, this.field_146042_b.posZ + 0.5D, this.rand.nextInt(6) + 1));
|
||||
+ // CraftBukkit - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop()
|
||||
+ this.field_146042_b.worldObj.spawnEntityInWorld(new EntityXPOrb(this.field_146042_b.worldObj, this.field_146042_b.posX, this.field_146042_b.posY + 0.5D, this.field_146042_b.posZ + 0.5D, playerFishEvent.getExpToDrop()));
|
||||
b0 = 1;
|
||||
}
|
||||
|
||||
if (this.field_146051_au)
|
||||
{
|
||||
+ // CraftBukkit start
|
||||
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.field_146042_b.getBukkitEntity(), null, (Fish) this.getBukkitEntity(), PlayerFishEvent.State.IN_GROUND);
|
||||
+ this.worldObj.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
+
|
||||
+ if (playerFishEvent.isCancelled())
|
||||
+ {
|
||||
+ this.setDead();
|
||||
+ this.field_146042_b.fishEntity = null;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
b0 = 2;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (b0 == 0)
|
||||
+ {
|
||||
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.field_146042_b.getBukkitEntity(), null, (Fish) this.getBukkitEntity(), PlayerFishEvent.State.FAILED_ATTEMPT);
|
||||
+ this.worldObj.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
this.setDead();
|
||||
this.field_146042_b.fishEntity = null;
|
||||
return b0;
|
||||
@@ -580,7 +634,7 @@
|
||||
{
|
||||
float f3 = f - f2;
|
||||
this.field_146042_b.addStat(StatList.fishCaughtStat, 1);
|
||||
- return ((WeightedRandomFishable)WeightedRandom.getRandomItem(this.rand, field_146036_f)).func_150708_a(this.rand);
|
||||
+ return ((WeightedRandomFishable) WeightedRandom.getRandomItem(this.rand, EntityFishHook.field_146036_f)).func_150708_a(this.rand); // CraftBukkit - fix static reference to fish list
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
--- ../src-base/minecraft/net/minecraft/entity/projectile/EntityLargeFireball.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityLargeFireball.java
|
||||
@@ -9,6 +9,8 @@
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
|
||||
+
|
||||
public class EntityLargeFireball extends EntityFireball
|
||||
{
|
||||
public int field_92057_e = 1;
|
||||
@@ -39,7 +41,17 @@
|
||||
p_70227_1_.entityHit.attackEntityFrom(DamageSource.causeFireballDamage(this, this.shootingEntity), 6.0F);
|
||||
}
|
||||
|
||||
- this.worldObj.newExplosion((Entity)null, this.posX, this.posY, this.posZ, (float)this.field_92057_e, true, this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing"));
|
||||
+ // CraftBukkit start
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(this.worldObj.getServer(), this));
|
||||
+ this.worldObj.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled())
|
||||
+ {
|
||||
+ // give 'this' instead of (Entity) null so we know what causes the damage
|
||||
+ this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, event.getRadius(), event.getFire(), this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing"));
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
@@ -56,7 +68,8 @@
|
||||
|
||||
if (p_70037_1_.hasKey("ExplosionPower", 99))
|
||||
{
|
||||
- this.field_92057_e = p_70037_1_.getInteger("ExplosionPower");
|
||||
+ // CraftBukkit - set bukkitYield when setting explosionpower
|
||||
+ this.bukkitYield = this.field_92057_e = p_70037_1_.getInteger("ExplosionPower");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
--- ../src-base/minecraft/net/minecraft/entity/projectile/EntityPotion.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityPotion.java
|
||||
@@ -14,9 +14,16 @@
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.HashMap;
|
||||
+import net.minecraft.entity.player.EntityPlayerMP;
|
||||
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityPotion extends EntityThrowable
|
||||
{
|
||||
- private ItemStack potionDamage;
|
||||
+ public ItemStack potionDamage; // CraftBukkit private --> public
|
||||
private static final String __OBFID = "CL_00001727";
|
||||
|
||||
public EntityPotion(World p_i1788_1_)
|
||||
@@ -88,14 +95,16 @@
|
||||
{
|
||||
List list = Items.potionitem.getEffects(this.potionDamage);
|
||||
|
||||
- if (list != null && !list.isEmpty())
|
||||
+ if (true || list != null && !list.isEmpty()) // CraftBukkit - Call event even if no effects to apply
|
||||
{
|
||||
AxisAlignedBB axisalignedbb = this.boundingBox.expand(4.0D, 2.0D, 4.0D);
|
||||
List list1 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
|
||||
|
||||
- if (list1 != null && !list1.isEmpty())
|
||||
+ if (list1 != null) // CraftBukkit - Run code even if there are no entities around
|
||||
{
|
||||
Iterator iterator = list1.iterator();
|
||||
+ // CraftBukkit
|
||||
+ HashMap<LivingEntity, Double> affected = new HashMap<LivingEntity, Double>();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
@@ -111,6 +120,25 @@
|
||||
d1 = 1.0D;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ affected.put((LivingEntity) entitylivingbase.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;
|
||||
+ }
|
||||
+
|
||||
+ EntityLivingBase entitylivingbase = ((CraftLivingEntity) victim).getHandle();
|
||||
+ double d1 = event.getIntensity(victim);
|
||||
+ // CraftBukkit end
|
||||
Iterator iterator1 = list.iterator();
|
||||
|
||||
while (iterator1.hasNext())
|
||||
@@ -118,9 +146,22 @@
|
||||
PotionEffect potioneffect = (PotionEffect)iterator1.next();
|
||||
int i = potioneffect.getPotionID();
|
||||
|
||||
+ // CraftBukkit start - Abide by PVP settings - for players only!
|
||||
+ if (!this.worldObj.pvpMode && this.getThrower() instanceof EntityPlayerMP && entitylivingbase instanceof EntityPlayerMP && entitylivingbase != this.getThrower())
|
||||
+ {
|
||||
+ // 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 (Potion.potionTypes[i].isInstant())
|
||||
{
|
||||
- Potion.potionTypes[i].affectEntity(this.getThrower(), entitylivingbase, potioneffect.getAmplifier(), d1);
|
||||
+ // CraftBukkit - Added 'this'
|
||||
+ Potion.potionTypes[i].applyInstantEffect(this.getThrower(), entitylivingbase, potioneffect.getAmplifier(), d1, this);
|
||||
}
|
||||
else
|
||||
{
|
@ -0,0 +1,44 @@
|
||||
--- ../src-base/minecraft/net/minecraft/entity/projectile/EntitySmallFireball.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntitySmallFireball.java
|
||||
@@ -6,6 +6,8 @@
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+import org.bukkit.event.entity.EntityCombustByEntityEvent; // CraftBukkit
|
||||
+
|
||||
public class EntitySmallFireball extends EntityFireball
|
||||
{
|
||||
private static final String __OBFID = "CL_00001721";
|
||||
@@ -36,7 +38,16 @@
|
||||
{
|
||||
if (!p_70227_1_.entityHit.isImmuneToFire() && p_70227_1_.entityHit.attackEntityFrom(DamageSource.causeFireballDamage(this, this.shootingEntity), 5.0F))
|
||||
{
|
||||
- p_70227_1_.entityHit.setFire(5);
|
||||
+ // CraftBukkit start - Entity damage by entity event + combust event
|
||||
+ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), p_70227_1_.entityHit.getBukkitEntity(), 5);
|
||||
+ p_70227_1_.entityHit.worldObj.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled())
|
||||
+ {
|
||||
+ p_70227_1_.entityHit.setFire(event.getDuration());
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -68,7 +79,13 @@
|
||||
|
||||
if (this.worldObj.isAirBlock(i, j, k))
|
||||
{
|
||||
- this.worldObj.setBlock(i, j, k, Blocks.fire);
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(worldObj, i, j, k, this).isCancelled())
|
||||
+ {
|
||||
+ this.worldObj.setBlock(i, j, k, Blocks.fire);
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,45 @@
|
||||
--- ../src-base/minecraft/net/minecraft/entity/projectile/EntityThrowable.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityThrowable.java
|
||||
@@ -24,8 +24,8 @@
|
||||
private Block field_145785_f;
|
||||
protected boolean inGround;
|
||||
public int throwableShake;
|
||||
- private EntityLivingBase thrower;
|
||||
- private String throwerName;
|
||||
+ public EntityLivingBase thrower; // CraftBukkit - private -> public
|
||||
+ public String throwerName; // CraftBukkit - private -> public
|
||||
private int ticksInGround;
|
||||
private int ticksInAir;
|
||||
private static final String __OBFID = "CL_00001723";
|
||||
@@ -50,6 +50,7 @@
|
||||
{
|
||||
super(p_i1777_1_);
|
||||
this.thrower = p_i1777_2_;
|
||||
+ this.projectileSource = (org.bukkit.entity.LivingEntity) p_i1777_2_.getBukkitEntity(); // CraftBukkit
|
||||
this.setSize(0.25F, 0.25F);
|
||||
this.setLocationAndAngles(p_i1777_2_.posX, p_i1777_2_.posY + (double)p_i1777_2_.getEyeHeight(), p_i1777_2_.posZ, p_i1777_2_.rotationYaw, p_i1777_2_.rotationPitch);
|
||||
this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);
|
||||
@@ -187,7 +188,7 @@
|
||||
|
||||
if (movingobjectposition1 != null)
|
||||
{
|
||||
- double d1 = vec3.distanceTo(movingobjectposition1.hitVec);
|
||||
+ double d1 = vec3.squareDistanceTo(movingobjectposition1.hitVec); // CraftBukkit - distance efficiency
|
||||
|
||||
if (d1 < d0 || d0 == 0.0D)
|
||||
{
|
||||
@@ -213,6 +214,14 @@
|
||||
else
|
||||
{
|
||||
this.onImpact(movingobjectposition);
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ if (this.isDead)
|
||||
+ {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this);
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
--- ../src-base/minecraft/net/minecraft/entity/projectile/EntityWitherSkull.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityWitherSkull.java
|
||||
@@ -13,6 +13,8 @@
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
|
||||
+
|
||||
public class EntityWitherSkull extends EntityFireball
|
||||
{
|
||||
private static final String __OBFID = "CL_00001728";
|
||||
@@ -68,7 +70,7 @@
|
||||
{
|
||||
if (p_70227_1_.entityHit.attackEntityFrom(DamageSource.causeMobDamage(this.shootingEntity), 8.0F) && !p_70227_1_.entityHit.isEntityAlive())
|
||||
{
|
||||
- this.shootingEntity.heal(5.0F);
|
||||
+ this.shootingEntity.heal(5.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER); // CraftBukkit
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -96,7 +98,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
- this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, 1.0F, false, this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing"));
|
||||
+ // CraftBukkit start
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 1.0F, false);
|
||||
+ this.worldObj.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled())
|
||||
+ {
|
||||
+ this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, event.getRadius(), event.getFire(), this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing"));
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
this.setDead();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user