mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 05:19:55 +03:00
49 lines
1.9 KiB
Diff
49 lines
1.9 KiB
Diff
--- ../src-base/minecraft/net/minecraft/entity/passive/EntityPig.java
|
|
+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityPig.java
|
|
@@ -37,6 +37,7 @@
|
|
import net.minecraft.util.math.MathHelper;
|
|
import net.minecraft.world.World;
|
|
import net.minecraft.world.storage.loot.LootTableList;
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
|
|
public class EntityPig extends EntityAnimal
|
|
{
|
|
@@ -188,7 +189,7 @@
|
|
|
|
public void onDeath(DamageSource cause)
|
|
{
|
|
- super.onDeath(cause);
|
|
+ // super.onDeath(cause); // CraftBukkit - Moved to end
|
|
|
|
if (!this.world.isRemote)
|
|
{
|
|
@@ -197,6 +198,7 @@
|
|
this.dropItem(Items.SADDLE, 1);
|
|
}
|
|
}
|
|
+ super.onDeath(cause);
|
|
}
|
|
|
|
@Nullable
|
|
@@ -226,7 +228,11 @@
|
|
{
|
|
if (!this.world.isRemote && !this.isDead)
|
|
{
|
|
+ if (lightningBolt == null) lightningBolt = new EntityLightningBolt(this.world, this.posX, this.posY, this.posZ, true); // CatServer - if null, create EntityLightningBolt for Bukkit
|
|
EntityPigZombie entitypigzombie = new EntityPigZombie(this.world);
|
|
+ if (CraftEventFactory.callPigZapEvent(this, lightningBolt, entitypigzombie).isCancelled()) {
|
|
+ return;
|
|
+ }
|
|
entitypigzombie.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Items.GOLDEN_SWORD));
|
|
entitypigzombie.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
|
|
entitypigzombie.setNoAI(this.isAIDisabled());
|
|
@@ -237,7 +243,7 @@
|
|
entitypigzombie.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
|
|
}
|
|
|
|
- this.world.spawnEntity(entitypigzombie);
|
|
+ this.world.addEntity(entitypigzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
|
|
this.setDead();
|
|
}
|
|
}
|