From ec47e791bda2be9e172e841fbfd50f0e40fcaaf4 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 12 Jun 2017 07:27:34 +1000 Subject: SPIGOT-3328: EntityTameEvent for Parrots --- nms-patches/EntityParrot.patch | 93 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 nms-patches/EntityParrot.patch (limited to 'nms-patches/EntityParrot.patch') diff --git a/nms-patches/EntityParrot.patch b/nms-patches/EntityParrot.patch new file mode 100644 index 00000000..5362bafa --- /dev/null +++ b/nms-patches/EntityParrot.patch @@ -0,0 +1,93 @@ +--- a/net/minecraft/server/EntityParrot.java ++++ b/net/minecraft/server/EntityParrot.java +@@ -15,7 +15,7 @@ + private static final DataWatcherObject bG = DataWatcher.a(EntityParrot.class, DataWatcherRegistry.b); + private static final Predicate bH = new Predicate() { + public boolean a(@Nullable EntityInsentient entityinsentient) { +- return entityinsentient != null && EntityParrot.bK.containsKey(EntityTypes.b.a((Object) entityinsentient.getClass())); ++ return entityinsentient != null && EntityParrot.bK.containsKey(EntityTypes.b.a(entityinsentient.getClass())); // CraftBukkit - decompile error + } + + public boolean apply(@Nullable Object object) { +@@ -114,7 +114,7 @@ + EntityInsentient entityinsentient = (EntityInsentient) list.get(world.random.nextInt(list.size())); + + if (!entityinsentient.isSilent()) { +- SoundEffect soundeffect = g(EntityTypes.b.a((Object) entityinsentient.getClass())); ++ SoundEffect soundeffect = g(EntityTypes.b.a(entityinsentient.getClass())); // CraftBukkit - decompile error + + world.a((EntityHuman) null, entity.locX, entity.locY, entity.locZ, soundeffect, entity.bK(), 0.7F, b(world.random)); + return true; +@@ -140,7 +140,7 @@ + } + + if (!this.world.isClientSide) { +- if (this.random.nextInt(10) == 0) { ++ if (this.random.nextInt(10) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) { // CraftBukkit + this.c(entityhuman); + this.p(true); + this.world.broadcastEntityEffect(this, (byte) 7); +@@ -316,33 +316,35 @@ + } + + static { +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntityBlaze.class), SoundEffects.eM); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntityCaveSpider.class), SoundEffects.fc); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntityCreeper.class), SoundEffects.eN); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntityGuardianElder.class), SoundEffects.eO); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntityEnderDragon.class), SoundEffects.eP); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntityEnderman.class), SoundEffects.eQ); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntityEndermite.class), SoundEffects.eR); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntityEvoker.class), SoundEffects.eS); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntityGhast.class), SoundEffects.eT); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntityZombieHusk.class), SoundEffects.eU); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntityIllagerIllusioner.class), SoundEffects.eV); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntityMagmaCube.class), SoundEffects.eW); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntityPigZombie.class), SoundEffects.fl); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntityPolarBear.class), SoundEffects.eX); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntityShulker.class), SoundEffects.eY); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntitySilverfish.class), SoundEffects.eZ); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntitySkeleton.class), SoundEffects.fa); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntitySlime.class), SoundEffects.fb); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntitySpider.class), SoundEffects.fc); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntitySkeletonStray.class), SoundEffects.fd); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntityVex.class), SoundEffects.fe); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntityVindicator.class), SoundEffects.ff); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntityWitch.class), SoundEffects.fg); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntityWither.class), SoundEffects.fh); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntitySkeletonWither.class), SoundEffects.fi); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntityWolf.class), SoundEffects.fj); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntityZombie.class), SoundEffects.fk); +- EntityParrot.bK.put(EntityTypes.b.a((Object) EntityZombieVillager.class), SoundEffects.fm); ++ // CraftBukkit start ++ EntityParrot.bK.put(EntityTypes.b.a(EntityBlaze.class), SoundEffects.eM); ++ EntityParrot.bK.put(EntityTypes.b.a(EntityCaveSpider.class), SoundEffects.fc); ++ EntityParrot.bK.put(EntityTypes.b.a(EntityCreeper.class), SoundEffects.eN); ++ EntityParrot.bK.put(EntityTypes.b.a(EntityGuardianElder.class), SoundEffects.eO); ++ EntityParrot.bK.put(EntityTypes.b.a(EntityEnderDragon.class), SoundEffects.eP); ++ EntityParrot.bK.put(EntityTypes.b.a(EntityEnderman.class), SoundEffects.eQ); ++ EntityParrot.bK.put(EntityTypes.b.a(EntityEndermite.class), SoundEffects.eR); ++ EntityParrot.bK.put(EntityTypes.b.a(EntityEvoker.class), SoundEffects.eS); ++ EntityParrot.bK.put(EntityTypes.b.a(EntityGhast.class), SoundEffects.eT); ++ EntityParrot.bK.put(EntityTypes.b.a(EntityZombieHusk.class), SoundEffects.eU); ++ EntityParrot.bK.put(EntityTypes.b.a(EntityIllagerIllusioner.class), SoundEffects.eV); ++ EntityParrot.bK.put(EntityTypes.b.a(EntityMagmaCube.class), SoundEffects.eW); ++ EntityParrot.bK.put(EntityTypes.b.a(EntityPigZombie.class), SoundEffects.fl); ++ EntityParrot.bK.put(EntityTypes.b.a(EntityPolarBear.class), SoundEffects.eX); ++ EntityParrot.bK.put(EntityTypes.b.a(EntityShulker.class), SoundEffects.eY); ++ EntityParrot.bK.put(EntityTypes.b.a(EntitySilverfish.class), SoundEffects.eZ); ++ EntityParrot.bK.put(EntityTypes.b.a(EntitySkeleton.class), SoundEffects.fa); ++ EntityParrot.bK.put(EntityTypes.b.a(EntitySlime.class), SoundEffects.fb); ++ EntityParrot.bK.put(EntityTypes.b.a(EntitySpider.class), SoundEffects.fc); ++ EntityParrot.bK.put(EntityTypes.b.a(EntitySkeletonStray.class), SoundEffects.fd); ++ EntityParrot.bK.put(EntityTypes.b.a(EntityVex.class), SoundEffects.fe); ++ EntityParrot.bK.put(EntityTypes.b.a(EntityVindicator.class), SoundEffects.ff); ++ EntityParrot.bK.put(EntityTypes.b.a(EntityWitch.class), SoundEffects.fg); ++ EntityParrot.bK.put(EntityTypes.b.a(EntityWither.class), SoundEffects.fh); ++ EntityParrot.bK.put(EntityTypes.b.a(EntitySkeletonWither.class), SoundEffects.fi); ++ EntityParrot.bK.put(EntityTypes.b.a(EntityWolf.class), SoundEffects.fj); ++ EntityParrot.bK.put(EntityTypes.b.a(EntityZombie.class), SoundEffects.fk); ++ EntityParrot.bK.put(EntityTypes.b.a(EntityZombieVillager.class), SoundEffects.fm); ++ // CraftBukkit end + } + } -- cgit v1.2.3