summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntityFishingHook.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nms-patches/EntityFishingHook.patch')
-rw-r--r--nms-patches/EntityFishingHook.patch91
1 files changed, 11 insertions, 80 deletions
diff --git a/nms-patches/EntityFishingHook.patch b/nms-patches/EntityFishingHook.patch
index cf4c5727..99516880 100644
--- a/nms-patches/EntityFishingHook.patch
+++ b/nms-patches/EntityFishingHook.patch
@@ -1,5 +1,5 @@
---- ../work/decompile-8eb82bde//net/minecraft/server/EntityFishingHook.java 2014-11-28 17:43:43.093707435 +0000
-+++ src/main/java/net/minecraft/server/EntityFishingHook.java 2014-11-28 17:38:20.000000000 +0000
+--- /home/matt/mc-dev-private//net/minecraft/server/EntityFishingHook.java 2015-02-26 22:40:22.543608140 +0000
++++ src/main/java/net/minecraft/server/EntityFishingHook.java 2015-02-26 22:40:22.543608140 +0000
@@ -3,6 +3,12 @@
import java.util.Arrays;
import java.util.List;
@@ -12,16 +12,7 @@
+
public class EntityFishingHook extends Entity {
- private static final List d = Arrays.asList(new PossibleFishingResult[] { (new PossibleFishingResult(new ItemStack(Items.LEATHER_BOOTS), 10)).a(0.9F), new PossibleFishingResult(new ItemStack(Items.LEATHER), 10), new PossibleFishingResult(new ItemStack(Items.BONE), 10), new PossibleFishingResult(new ItemStack(Items.POTION), 10), new PossibleFishingResult(new ItemStack(Items.STRING), 5), (new PossibleFishingResult(new ItemStack(Items.FISHING_ROD), 2)).a(0.9F), new PossibleFishingResult(new ItemStack(Items.BOWL), 10), new PossibleFishingResult(new ItemStack(Items.STICK), 5), new PossibleFishingResult(new ItemStack(Items.DYE, 10, EnumColor.BLACK.getInvColorIndex()), 1), new PossibleFishingResult(new ItemStack(Blocks.TRIPWIRE_HOOK), 10), new PossibleFishingResult(new ItemStack(Items.ROTTEN_FLESH), 10)});
-@@ -168,7 +174,7 @@
- MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
-
- if (movingobjectposition1 != null) {
-- d6 = vec3d.f(movingobjectposition1.pos);
-+ d6 = vec3d.distanceSquared(movingobjectposition1.pos); // CraftBukkit - distance efficiency
- if (d6 < d5 || d5 == 0.0D) {
- entity = entity1;
- d5 = d6;
+ private static final List<PossibleFishingResult> d = Arrays.asList(new PossibleFishingResult[] { (new PossibleFishingResult(new ItemStack(Items.LEATHER_BOOTS), 10)).a(0.9F), new PossibleFishingResult(new ItemStack(Items.LEATHER), 10), new PossibleFishingResult(new ItemStack(Items.BONE), 10), new PossibleFishingResult(new ItemStack(Items.POTION), 10), new PossibleFishingResult(new ItemStack(Items.STRING), 5), (new PossibleFishingResult(new ItemStack(Items.FISHING_ROD), 2)).a(0.9F), new PossibleFishingResult(new ItemStack(Items.BOWL), 10), new PossibleFishingResult(new ItemStack(Items.STICK), 5), new PossibleFishingResult(new ItemStack(Items.DYE, 10, EnumColor.BLACK.getInvColorIndex()), 1), new PossibleFishingResult(new ItemStack(Blocks.TRIPWIRE_HOOK), 10), new PossibleFishingResult(new ItemStack(Items.ROTTEN_FLESH), 10)});
@@ -182,6 +188,7 @@
}
@@ -30,67 +21,7 @@
if (movingobjectposition.entity != null) {
if (movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.owner), 0.0F)) {
this.hooked = movingobjectposition.entity;
-@@ -261,8 +268,8 @@
- } else {
- float f3;
- float f4;
-- double d11;
- float f5;
-+ double d11;
- double d12;
-
- if (this.av > 0) {
-@@ -277,20 +284,20 @@
- } else {
- this.aw = (float) ((double) this.aw + this.random.nextGaussian() * 4.0D);
- f3 = this.aw * 0.017453292F;
-- f5 = MathHelper.sin(f3);
-- f4 = MathHelper.cos(f3);
-- d8 = this.locX + (double) (f5 * (float) this.av * 0.1F);
-- d12 = (double) ((float) MathHelper.floor(this.getBoundingBox().b) + 1.0F);
-- d11 = this.locZ + (double) (f4 * (float) this.av * 0.1F);
-+ f4 = MathHelper.sin(f3);
-+ f5 = MathHelper.cos(f3);
-+ d8 = this.locX + (double) (f4 * (float) this.av * 0.1F);
-+ d11 = (double) ((float) MathHelper.floor(this.getBoundingBox().b) + 1.0F);
-+ d12 = this.locZ + (double) (f5 * (float) this.av * 0.1F);
- if (this.random.nextFloat() < 0.15F) {
-- worldserver.a(EnumParticle.WATER_BUBBLE, d8, d12 - 0.10000000149011612D, d11, 1, (double) f5, 0.1D, (double) f4, 0.0D, new int[0]);
-+ worldserver.a(EnumParticle.WATER_BUBBLE, d8, d11 - 0.10000000149011612D, d12, 1, (double) f4, 0.1D, (double) f5, 0.0D, new int[0]);
- }
-
-- float f6 = f5 * 0.04F;
-- float f7 = f4 * 0.04F;
-+ float f6 = f4 * 0.04F;
-+ float f7 = f5 * 0.04F;
-
-- worldserver.a(EnumParticle.WATER_WAKE, d8, d12, d11, 0, (double) f7, 0.01D, (double) (-f6), 1.0D, new int[0]);
-- worldserver.a(EnumParticle.WATER_WAKE, d8, d12, d11, 0, (double) (-f7), 0.01D, (double) f6, 1.0D, new int[0]);
-+ worldserver.a(EnumParticle.WATER_WAKE, d8, d11, d12, 0, (double) f7, 0.01D, (double) (-f6), 1.0D, new int[0]);
-+ worldserver.a(EnumParticle.WATER_WAKE, d8, d11, d12, 0, (double) (-f7), 0.01D, (double) f6, 1.0D, new int[0]);
- }
- } else if (this.au > 0) {
- this.au -= k;
-@@ -304,12 +311,12 @@
- }
-
- if (this.random.nextFloat() < f3) {
-- f5 = MathHelper.a(this.random, 0.0F, 360.0F) * 0.017453292F;
-- f4 = MathHelper.a(this.random, 25.0F, 60.0F);
-- d8 = this.locX + (double) (MathHelper.sin(f5) * f4 * 0.1F);
-- d12 = (double) ((float) MathHelper.floor(this.getBoundingBox().b) + 1.0F);
-- d11 = this.locZ + (double) (MathHelper.cos(f5) * f4 * 0.1F);
-- worldserver.a(EnumParticle.WATER_SPLASH, d8, d12, d11, 2 + this.random.nextInt(2), 0.10000000149011612D, 0.0D, 0.10000000149011612D, 0.0D, new int[0]);
-+ f4 = MathHelper.a(this.random, 0.0F, 360.0F) * 0.017453292F;
-+ f5 = MathHelper.a(this.random, 25.0F, 60.0F);
-+ d8 = this.locX + (double) (MathHelper.sin(f4) * f5 * 0.1F);
-+ d11 = (double) ((float) MathHelper.floor(this.getBoundingBox().b) + 1.0F);
-+ d12 = this.locZ + (double) (MathHelper.cos(f4) * f5 * 0.1F);
-+ worldserver.a(EnumParticle.WATER_SPLASH, d8, d11, d12, 2 + this.random.nextInt(2), 0.10000000149011612D, 0.0D, 0.10000000149011612D, 0.0D, new int[0]);
- }
-
- if (this.au <= 0) {
-@@ -374,6 +381,15 @@
+@@ -381,6 +388,15 @@
byte b0 = 0;
if (this.hooked != null) {
@@ -106,9 +37,9 @@
double d0 = this.owner.locX - this.locX;
double d1 = this.owner.locY - this.locY;
double d2 = this.owner.locZ - this.locZ;
-@@ -386,6 +402,16 @@
+@@ -393,6 +409,15 @@
b0 = 3;
- } else if (this.at > 0) {
+ } else if (this.av > 0) {
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, this.m());
+ // CraftBukkit start
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), entityitem.getBukkitEntity(), (Fish) this.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH);
@@ -119,11 +50,10 @@
+ return 0;
+ }
+ // CraftBukkit end
-+
double d5 = this.owner.locX - this.locX;
double d6 = this.owner.locY - this.locY;
double d7 = this.owner.locZ - this.locZ;
-@@ -396,13 +422,32 @@
+@@ -403,14 +428,33 @@
entityitem.motY = d6 * d9 + (double) MathHelper.sqrt(d8) * 0.08D;
entityitem.motZ = d7 * d9;
this.world.addEntity(entityitem);
@@ -133,7 +63,7 @@
b0 = 1;
}
- if (this.aq) {
+ if (this.as) {
+ // CraftBukkit start
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, (Fish) this.getBukkitEntity(), PlayerFishEvent.State.IN_GROUND);
+ this.world.getServer().getPluginManager().callEvent(playerFishEvent);
@@ -144,7 +74,7 @@
+ // CraftBukkit end
b0 = 2;
}
-+
+
+ // CraftBukkit start
+ if (b0 == 0) {
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, (Fish) this.getBukkitEntity(), PlayerFishEvent.State.FAILED_ATTEMPT);
@@ -154,6 +84,7 @@
+ }
+ }
+ // CraftBukkit end
-
++
this.die();
this.owner.hookedFish = null;
+ return b0;