fix lots of levels

This commit is contained in:
Ben Kerllenevich
2023-06-09 00:49:22 -04:00
parent d20403a6d0
commit 1cfcb9f28e
43 changed files with 301 additions and 248 deletions

View File

@@ -5,7 +5,7 @@ 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 b90cedad282e95a067aca176fafa9f72a726f520..c29c849d6b61d23e86e8af949561c00e889d2e9d 100644
index b90cedad282e95a067aca176fafa9f72a726f520..9a8a1e773f247f4c4af4e9789deb70cd5b7889c5 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Snowball.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Snowball.java
@@ -57,6 +57,36 @@ public class Snowball extends ThrowableItemProjectile {
@@ -17,25 +17,25 @@ index b90cedad282e95a067aca176fafa9f72a726f520..c29c849d6b61d23e86e8af949561c00e
+ protected void onHitBlock(net.minecraft.world.phys.BlockHitResult blockHitResult) {
+ super.onHitBlock(blockHitResult);
+
+ if (!this.level.isClientSide) {
+ 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);
+ 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 (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);
+ 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);
+ 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));
+ 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));
+ }
+ }
+ }
@@ -46,7 +46,7 @@ index b90cedad282e95a067aca176fafa9f72a726f520..c29c849d6b61d23e86e8af949561c00e
protected void onHit(HitResult hitResult) {
super.onHit(hitResult);
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index a1151c789644d992fa1ee7ddd967a45b5426c1dd..3d73b18ca2c06250839982ccda9d30c5350a14eb 100644
index e2120e4b3872067f1559c558d3af31c03f0305fc..c04957b14a4e1c2397bedfeeefab7306f94529c1 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -237,6 +237,9 @@ public class PurpurWorldConfig {