Files
Purpur/patches/server/0255-options-to-extinguish-fire-blocks-with-snowballs.patch
Encode42 d5d756bc32 Updated Upstream (Paper & Airplane)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@c1b4899 Fix dupe uuid check on entity add (#6735)
PaperMC/Paper@3f043f7 Async catch modifications to critical entity state
PaperMC/Paper@bc43f40 Update jline and TCA (#6829)
PaperMC/Paper@d9e2817 Update paperweight to 1.1.13 (#6866)
PaperMC/Paper@3e310e0 Remove redundant and unneeded repos, reorder repos (#6867)
PaperMC/Paper@485d15f Update paperweight to 1.1.14 (#6868)
PaperMC/Paper@09d50a9 Added missing mappings (#6810)
PaperMC/Paper@0968cdd Move async catches back to where they were (#6869)
PaperMC/Paper@6f71b7c Deduplicate strings in ObfHelper (#6841)
PaperMC/Paper@ada930b Updated Upstream (Bukkit/CraftBukkit) (#6872)
PaperMC/Paper@06d82e0 Cache palette array (#6767)
PaperMC/Paper@70fe58d Expose the potential player cause of a lightning (#6782)
PaperMC/Paper@c20c9d3 Fix CraftNamespacedKey shenanigans (#6825)
PaperMC/Paper@29bb5a9 Add PlayerDeathEvent#getPlayer for clarity (#6859)
PaperMC/Paper@124d079 Fix issues with mob conversion (#6831)
PaperMC/Paper@22b0238 Add API for checking if a zombie has the option to break doors (#6855)
PaperMC/Paper@5af80b0 Add isCollidable methods to various places (#6870)
PaperMC/Paper@32ba088 Fix setPatternColor on tropical fish bucket meta (#6877)
PaperMC/Paper@87121ce Move `getTrackedPlayers` up from Player to Entity (#6569)
PaperMC/Paper@a923e33 Make despawn distance configs per-category, improve per category spawn limit config (#6717)
PaperMC/Paper@3f17694 Goat ram API (#6336)
PaperMC/Paper@cc2ecbc Add Raw Byte Entity Serialization (#6826)

Airplane Changes:
TECHNOVE/Airplane@e47949b Ty Penple <3
TECHNOVE/Airplane@86fee6b Update upstream
2021-11-11 02:03:29 -05:00

72 lines
4.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: granny <granny@pl3x.net>
Date: Thu, 14 Oct 2021 02:05:52 -0700
Subject: [PATCH] options to extinguish fire blocks with snowballs
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Snowball.java b/src/main/java/net/minecraft/world/entity/projectile/Snowball.java
index d5d84893c77b4e60a19032d765d76bfd24cbbb2b..ef265cec066ef3b84c2b3a4929af518308a409c3 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Snowball.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Snowball.java
@@ -58,6 +58,36 @@ public class Snowball extends ThrowableItemProjectile {
entity.hurt(DamageSource.thrown(this, this.getOwner()), (float)i);
}
+ // Purpur start - borrowed and modified code from ThrownPotion#onHitBlock and ThrownPotion#dowseFire
+ @Override
+ protected void onHitBlock(net.minecraft.world.phys.BlockHitResult blockHitResult) {
+ super.onHitBlock(blockHitResult);
+
+ if (!this.level.isClientSide) {
+ net.minecraft.core.BlockPos blockposition = blockHitResult.getBlockPos();
+ net.minecraft.core.BlockPos blockposition1 = blockposition.relative(blockHitResult.getDirection());
+
+ net.minecraft.world.level.block.state.BlockState iblockdata = this.level.getBlockState(blockposition);
+
+ if (this.level.purpurConfig.snowballExtinguishesFire && this.level.getBlockState(blockposition1).is(net.minecraft.world.level.block.Blocks.FIRE)) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, blockposition1, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState()).isCancelled()) {
+ this.level.removeBlock(blockposition1, false);
+ }
+ } else if (this.level.purpurConfig.snowballExtinguishesCandles && net.minecraft.world.level.block.AbstractCandleBlock.isLit(iblockdata)) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, iblockdata.setValue(net.minecraft.world.level.block.AbstractCandleBlock.LIT, false)).isCancelled()) {
+ net.minecraft.world.level.block.AbstractCandleBlock.extinguish(null, iblockdata, this.level, blockposition);
+ }
+ } else if (this.level.purpurConfig.snowballExtinguishesCampfires && net.minecraft.world.level.block.CampfireBlock.isLitCampfire(iblockdata)) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, iblockdata.setValue(net.minecraft.world.level.block.CampfireBlock.LIT, false)).isCancelled()) {
+ this.level.levelEvent(null, 1009, blockposition, 0);
+ net.minecraft.world.level.block.CampfireBlock.dowse(this.getOwner(), this.level, blockposition, iblockdata);
+ this.level.setBlockAndUpdate(blockposition, iblockdata.setValue(net.minecraft.world.level.block.CampfireBlock.LIT, false));
+ }
+ }
+ }
+ }
+ // Purpur end
+
@Override
protected void onHit(HitResult hitResult) {
super.onHit(hitResult);
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 0f7e1de894b10d109a7ce020995128cfda3fa7be..d31fba4f062e9fe4e3f52827936edbb3f81f234b 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -179,6 +179,9 @@ public class PurpurWorldConfig {
public int glowBerriesEatGlowDuration = 0;
public boolean shulkerBoxItemDropContentsWhenDestroyed = true;
public boolean compassItemShowsBossBar = false;
+ public boolean snowballExtinguishesFire = false;
+ public boolean snowballExtinguishesCandles = false;
+ public boolean snowballExtinguishesCampfires = false;
private void itemSettings() {
itemImmuneToCactus.clear();
getList("gameplay-mechanics.item.immune.cactus", new ArrayList<>()).forEach(key -> {
@@ -225,6 +228,9 @@ public class PurpurWorldConfig {
glowBerriesEatGlowDuration = getInt("gameplay-mechanics.item.glow_berries.eat-glow-duration", glowBerriesEatGlowDuration);
shulkerBoxItemDropContentsWhenDestroyed = getBoolean("gameplay-mechanics.item.shulker_box.drop-contents-when-destroyed", shulkerBoxItemDropContentsWhenDestroyed);
compassItemShowsBossBar = getBoolean("gameplay-mechanics.item.compass.holding-shows-bossbar", compassItemShowsBossBar);
+ snowballExtinguishesFire = getBoolean("gameplay-mechanics.item.snowball.extinguish.fire", snowballExtinguishesFire);
+ snowballExtinguishesCandles = getBoolean("gameplay-mechanics.item.snowball.extinguish.candles", snowballExtinguishesCandles);
+ snowballExtinguishesCampfires = getBoolean("gameplay-mechanics.item.snowball.extinguish.campfires", snowballExtinguishesCampfires);
}
public double minecartMaxSpeed = 0.4D;