mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-08-24 14:52:50 +02:00
51 lines
2.2 KiB
Diff
51 lines
2.2 KiB
Diff
From f5f5651fb06870655bb7245642b1dfce8d9e5c1c Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Mon, 21 Dec 2015 13:33:00 -0500
|
|
Subject: [PATCH] EMC SnowmanThrowSnowballEvent
|
|
|
|
---
|
|
.../net/minecraft/server/EntitySnowman.java | 20 +++++++++++++++++++
|
|
1 file changed, 20 insertions(+)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntitySnowman.java b/src/main/java/net/minecraft/server/EntitySnowman.java
|
|
index dee55c5dea..9d1cfae9e0 100644
|
|
--- a/src/main/java/net/minecraft/server/EntitySnowman.java
|
|
+++ b/src/main/java/net/minecraft/server/EntitySnowman.java
|
|
@@ -9,6 +9,25 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
|
|
|
|
private static final DataWatcherObject<Byte> b = DataWatcher.a(EntitySnowman.class, DataWatcherRegistry.a);
|
|
|
|
+ // EMC start
|
|
+ public static boolean fireEvent(EntitySnowman snowman, EntitySnowball snowball, EntityLiving target) {
|
|
+ org.bukkit.entity.Snowman bukkitSnowman = (org.bukkit.entity.Snowman) snowman.getBukkitEntity();
|
|
+ org.bukkit.entity.Snowball bukkitSnowball = (org.bukkit.entity.Snowball) snowball.getBukkitEntity();
|
|
+ snowball.projectileSource = bukkitSnowman;
|
|
+
|
|
+ if (!(new org.bukkit.event.entity.ProjectileLaunchEvent(bukkitSnowball).callEvent())) {
|
|
+ return false;
|
|
+ }
|
|
+
|
|
+ com.empireminecraft.customevents.SnowmanThrowSnowballEvent event = new com.empireminecraft.customevents.SnowmanThrowSnowballEvent(
|
|
+ bukkitSnowman,
|
|
+ bukkitSnowball,
|
|
+ target.getBukkitLivingEntity()
|
|
+ );
|
|
+ return event.callEvent();
|
|
+ }
|
|
+ // EMC end
|
|
+
|
|
public EntitySnowman(EntityTypes<? extends EntitySnowman> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
}
|
|
@@ -98,6 +117,7 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
|
|
float f1 = MathHelper.sqrt(d1 * d1 + d3 * d3) * 0.2F;
|
|
|
|
entitysnowball.shoot(d1, d2 + (double) f1, d3, 1.6F, 12.0F);
|
|
+ if (!fireEvent(this, entitysnowball, entityliving)) return; // EMC
|
|
this.a(SoundEffects.ENTITY_SNOW_GOLEM_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
|
|
this.world.addEntity(entitysnowball);
|
|
}
|
|
--
|
|
2.25.1.windows.1
|
|
|