mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 02:20:01 +03:00
68 lines
2.7 KiB
Diff
68 lines
2.7 KiB
Diff
--- ../src-base/minecraft/net/minecraft/entity/item/EntityFireworkRocket.java
|
|
+++ ../src-work/minecraft/net/minecraft/entity/item/EntityFireworkRocket.java
|
|
@@ -23,13 +23,14 @@
|
|
import net.minecraft.world.World;
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
|
|
public class EntityFireworkRocket extends Entity
|
|
{
|
|
- private static final DataParameter<ItemStack> FIREWORK_ITEM = EntityDataManager.<ItemStack>createKey(EntityFireworkRocket.class, DataSerializers.ITEM_STACK);
|
|
+ public static final DataParameter<ItemStack> FIREWORK_ITEM = EntityDataManager.<ItemStack>createKey(EntityFireworkRocket.class, DataSerializers.ITEM_STACK);
|
|
private static final DataParameter<Integer> BOOSTED_ENTITY_ID = EntityDataManager.<Integer>createKey(EntityFireworkRocket.class, DataSerializers.VARINT);
|
|
private int fireworkAge;
|
|
- private int lifetime;
|
|
+ public int lifetime;
|
|
private EntityLivingBase boostedEntity;
|
|
|
|
public EntityFireworkRocket(World worldIn)
|
|
@@ -38,6 +39,14 @@
|
|
this.setSize(0.25F, 0.25F);
|
|
}
|
|
|
|
+ // Spigot Start
|
|
+ @Override
|
|
+ public void inactiveTick() {
|
|
+ this.fireworkAge += 1;
|
|
+ super.inactiveTick();
|
|
+ }
|
|
+ // Spigot End
|
|
+
|
|
protected void entityInit()
|
|
{
|
|
this.dataManager.register(FIREWORK_ITEM, ItemStack.EMPTY);
|
|
@@ -187,8 +196,10 @@
|
|
|
|
if (!this.world.isRemote && this.fireworkAge > this.lifetime)
|
|
{
|
|
- this.world.setEntityState(this, (byte)17);
|
|
- this.dealExplosionDamage();
|
|
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
|
|
+ this.world.setEntityState(this, (byte) 17);
|
|
+ this.dealExplosionDamage();
|
|
+ }
|
|
this.setDead();
|
|
}
|
|
}
|
|
@@ -209,7 +220,9 @@
|
|
{
|
|
if (this.boostedEntity != null)
|
|
{
|
|
+ CraftEventFactory.entityDamage = this;
|
|
this.boostedEntity.attackEntityFrom(DamageSource.FIREWORKS, (float)(5 + nbttaglist.tagCount() * 2));
|
|
+ CraftEventFactory.entityDamage = null;
|
|
}
|
|
|
|
double d0 = 5.0D;
|
|
@@ -235,7 +248,9 @@
|
|
if (flag)
|
|
{
|
|
float f1 = f * (float)Math.sqrt((5.0D - (double)this.getDistance(entitylivingbase)) / 5.0D);
|
|
+ CraftEventFactory.entityDamage = this;
|
|
entitylivingbase.attackEntityFrom(DamageSource.FIREWORKS, f1);
|
|
+ CraftEventFactory.entityDamage = null;
|
|
}
|
|
}
|
|
}
|