mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-12-03 16:13:21 +01:00
51 lines
2.2 KiB
Diff
51 lines
2.2 KiB
Diff
From 63c2c696840bb4c5b970664baa21c4d6f6f20d22 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 dee55c5de..9d1cfae9e 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
|
|
|