aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/entity/projectile/SmallFireball.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/entity/projectile/SmallFireball.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/entity/projectile/SmallFireball.java.patch109
1 files changed, 109 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/entity/projectile/SmallFireball.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/entity/projectile/SmallFireball.java.patch
new file mode 100644
index 0000000000..1a86ad36f4
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/entity/projectile/SmallFireball.java.patch
@@ -0,0 +1,109 @@
+--- a/net/minecraft/world/entity/projectile/SmallFireball.java
++++ b/net/minecraft/world/entity/projectile/SmallFireball.java
+@@ -12,31 +12,43 @@
+ import net.minecraft.world.phys.BlockHitResult;
+ import net.minecraft.world.phys.EntityHitResult;
+ import net.minecraft.world.phys.HitResult;
++import org.bukkit.event.entity.EntityCombustByEntityEvent; // CraftBukkit
+
+ public class SmallFireball extends Fireball {
+
+- public SmallFireball(EntityType<? extends SmallFireball> entitytype, Level level) {
+- super(entitytype, level);
++ public SmallFireball(EntityType<? extends SmallFireball> entityType, Level level) {
++ super(entityType, level);
+ }
+
+- public SmallFireball(Level level, LivingEntity livingentity, double d0, double d1, double d2) {
+- super(EntityType.SMALL_FIREBALL, livingentity, d0, d1, d2, level);
++ public SmallFireball(Level level, LivingEntity shooter, double offsetX, double d1, double offsetY) {
++ super(EntityType.SMALL_FIREBALL, shooter, offsetX, d1, offsetY, level);
++ // CraftBukkit start
++ if (this.getOwner() != null && this.getOwner() instanceof Mob) {
++ isIncendiary = this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
++ }
++ // CraftBukkit end
+ }
+
+- public SmallFireball(Level level, double d0, double d1, double d2, double d3, double d4, double d5) {
+- super(EntityType.SMALL_FIREBALL, d0, d1, d2, d3, d4, d5, level);
++ public SmallFireball(Level level, double x, double d1, double y, double d3, double z, double d5) {
++ super(EntityType.SMALL_FIREBALL, x, d1, y, d3, z, d5, level);
+ }
+
+ @Override
+- @Override
+- protected void onHitEntity(EntityHitResult entityhitresult) {
+- super.onHitEntity(entityhitresult);
++ protected void onHitEntity(EntityHitResult result) {
++ super.onHitEntity(result);
+ if (!this.level().isClientSide) {
+- Entity entity = entityhitresult.getEntity();
++ Entity entity = result.getEntity();
+ Entity entity1 = this.getOwner();
+ int i = entity.getRemainingFireTicks();
+
+- entity.setSecondsOnFire(5);
++ // CraftBukkit start - Entity damage by entity event + combust event
++ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), entity.getBukkitEntity(), 5);
++ entity.level().getCraftServer().getPluginManager().callEvent(event);
++
++ if (!event.isCancelled()) {
++ entity.setSecondsOnFire(event.getDuration(), false);
++ }
++ // CraftBukkit end
+ if (!entity.hurt(this.damageSources().fireball(this, entity1), 5.0F)) {
+ entity.setRemainingFireTicks(i);
+ } else if (entity1 instanceof LivingEntity) {
+@@ -47,17 +59,16 @@
+ }
+
+ @Override
+- @Override
+- protected void onHitBlock(BlockHitResult blockhitresult) {
+- super.onHitBlock(blockhitresult);
++ protected void onHitBlock(BlockHitResult result) {
++ super.onHitBlock(result);
+ if (!this.level().isClientSide) {
+ Entity entity = this.getOwner();
+
+- if (!(entity instanceof Mob) || this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
+- BlockPos blockpos = blockhitresult.getBlockPos().relative(blockhitresult.getDirection());
++ if (isIncendiary) { // CraftBukkit
++ BlockPos blockposition = result.getBlockPos().relative(result.getDirection());
+
+- if (this.level().isEmptyBlock(blockpos)) {
+- this.level().setBlockAndUpdate(blockpos, BaseFireBlock.getState(this.level(), blockpos));
++ if (this.level().isEmptyBlock(blockposition) && !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.level(), blockposition, this).isCancelled()) { // CraftBukkit
++ this.level().setBlockAndUpdate(blockposition, BaseFireBlock.getState(this.level(), blockposition));
+ }
+ }
+
+@@ -65,9 +76,8 @@
+ }
+
+ @Override
+- @Override
+- protected void onHit(HitResult hitresult) {
+- super.onHit(hitresult);
++ protected void onHit(HitResult result) {
++ super.onHit(result);
+ if (!this.level().isClientSide) {
+ this.discard();
+ }
+@@ -75,14 +85,12 @@
+ }
+
+ @Override
+- @Override
+ public boolean isPickable() {
+ return false;
+ }
+
+ @Override
+- @Override
+- public boolean hurt(DamageSource damagesource, float f) {
++ public boolean hurt(DamageSource source, float amount) {
+ return false;
+ }
+ }