craftbukkit/nms-patches/net/minecraft/world/entity/projectile/EntitySmallFireball.patch

65 lines
3 KiB
Diff
Raw Normal View History

2021-03-16 09:00:00 +11:00
--- a/net/minecraft/world/entity/projectile/EntitySmallFireball.java
+++ b/net/minecraft/world/entity/projectile/EntitySmallFireball.java
2024-06-14 01:05:00 +10:00
@@ -16,6 +16,11 @@
2021-03-16 09:00:00 +11:00
import net.minecraft.world.phys.MovingObjectPositionEntity;
2024-06-14 01:05:00 +10:00
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
+import org.bukkit.event.entity.EntityCombustByEntityEvent;
+import org.bukkit.event.entity.EntityRemoveEvent;
+// CraftBukkit end
+
2019-04-23 12:00:00 +10:00
public class EntitySmallFireball extends EntityFireballFireball {
2019-04-23 12:00:00 +10:00
public EntitySmallFireball(EntityTypes<? extends EntitySmallFireball> entitytypes, World world) {
2024-06-14 01:05:00 +10:00
@@ -24,6 +29,11 @@
2018-07-15 10:00:00 +10:00
2024-06-14 01:05:00 +10:00
public EntitySmallFireball(World world, EntityLiving entityliving, Vec3D vec3d) {
super(EntityTypes.SMALL_FIREBALL, entityliving, vec3d, world);
+ // CraftBukkit start
2021-11-22 09:00:00 +11:00
+ if (this.getOwner() != null && this.getOwner() instanceof EntityInsentient) {
2023-06-08 01:30:00 +10:00
+ isIncendiary = this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
+ }
+ // CraftBukkit end
}
2024-06-14 01:05:00 +10:00
public EntitySmallFireball(World world, double d0, double d1, double d2, Vec3D vec3d) {
@@ -40,7 +50,14 @@
2022-06-08 02:00:00 +10:00
Entity entity1 = this.getOwner();
int i = entity.getRemainingFireTicks();
2024-06-14 01:05:00 +10:00
- entity.igniteForSeconds(5.0F);
2022-06-08 02:00:00 +10:00
+ // CraftBukkit start - Entity damage by entity event + combust event
2024-06-14 01:05:00 +10:00
+ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), entity.getBukkitEntity(), 5.0F);
2023-06-08 01:30:00 +10:00
+ entity.level().getCraftServer().getPluginManager().callEvent(event);
+
2022-06-08 02:00:00 +10:00
+ if (!event.isCancelled()) {
2024-04-24 01:15:00 +10:00
+ entity.igniteForSeconds(event.getDuration(), false);
2022-06-08 02:00:00 +10:00
+ }
+ // CraftBukkit end
2024-06-14 01:05:00 +10:00
DamageSource damagesource = this.damageSources().fireball(this, entity1);
if (!entity.hurt(damagesource, 5.0F)) {
@@ -58,10 +75,10 @@
2023-06-08 01:30:00 +10:00
if (!this.level().isClientSide) {
2021-11-22 09:00:00 +11:00
Entity entity = this.getOwner();
2020-06-25 10:00:00 +10:00
2023-06-08 01:30:00 +10:00
- if (!(entity instanceof EntityInsentient) || this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
2020-06-25 10:00:00 +10:00
+ if (isIncendiary) { // CraftBukkit
2021-11-22 09:00:00 +11:00
BlockPosition blockposition = movingobjectpositionblock.getBlockPos().relative(movingobjectpositionblock.getDirection());
2023-06-08 01:30:00 +10:00
- if (this.level().isEmptyBlock(blockposition)) {
+ if (this.level().isEmptyBlock(blockposition) && !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.level(), blockposition, this).isCancelled()) { // CraftBukkit
this.level().setBlockAndUpdate(blockposition, BlockFireAbstract.getState(this.level(), blockposition));
}
}
2024-06-14 01:05:00 +10:00
@@ -73,7 +90,7 @@
protected void onHit(MovingObjectPosition movingobjectposition) {
super.onHit(movingobjectposition);
if (!this.level().isClientSide) {
- this.discard();
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
}
}