mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
3 more patches
This commit is contained in:
62
patches/server/0078-Implement-bed-explosion-options.patch
Normal file
62
patches/server/0078-Implement-bed-explosion-options.patch
Normal file
@@ -0,0 +1,62 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 4 Jul 2020 13:12:43 -0500
|
||||
Subject: [PATCH] Implement bed explosion options
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
||||
index 163a7861f987c3832aac51cc6df950c768546731..cfe4cdbd28ff11ea2781d47fe6d8c2de7912a3f6 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
||||
@@ -97,7 +97,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
|
||||
world.removeBlock(blockposition1, false);
|
||||
}
|
||||
|
||||
- world.explode((Entity) null, DamageSource.badRespawnPointExplosion(), (ExplosionDamageCalculator) null, (double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, 5.0F, true, Explosion.BlockInteraction.DESTROY);
|
||||
+ if (world.purpurConfig.bedExplode) world.explode((Entity) null, DamageSource.badRespawnPointExplosion(), null, (double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (float) world.purpurConfig.bedExplosionPower, world.purpurConfig.bedExplosionFire, world.purpurConfig.bedExplosionEffect); // Purpur
|
||||
return InteractionResult.SUCCESS;
|
||||
} else if ((Boolean) state.getValue(BedBlock.OCCUPIED)) {
|
||||
if (!this.kickVillagerOutOfBed(world, pos)) {
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 891b0ef41e57e95ab3aa7b14891ba53abd135171..d232768e789ea6a7790cada4a4ad2624cd32e4b2 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.Items;
|
||||
+import net.minecraft.world.level.Explosion;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
@@ -12,6 +13,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
+import java.util.logging.Level;
|
||||
|
||||
import static net.pl3x.purpur.PurpurConfig.log;
|
||||
|
||||
@@ -258,6 +260,22 @@ public class PurpurWorldConfig {
|
||||
});
|
||||
}
|
||||
|
||||
+ public boolean bedExplode = true;
|
||||
+ public double bedExplosionPower = 5.0D;
|
||||
+ public boolean bedExplosionFire = true;
|
||||
+ public Explosion.BlockInteraction bedExplosionEffect = Explosion.BlockInteraction.DESTROY;
|
||||
+ private void bedSettings() {
|
||||
+ bedExplode = getBoolean("blocks.bed.explode", bedExplode);
|
||||
+ bedExplosionPower = getDouble("blocks.bed.explosion-power", bedExplosionPower);
|
||||
+ bedExplosionFire = getBoolean("blocks.bed.explosion-fire", bedExplosionFire);
|
||||
+ try {
|
||||
+ bedExplosionEffect = Explosion.BlockInteraction.valueOf(getString("blocks.bed.explosion-effect", bedExplosionEffect.name()));
|
||||
+ } catch (IllegalArgumentException e) {
|
||||
+ log(Level.SEVERE, "Unknown value for `blocks.bed.explosion-effect`! Using default of `DESTROY`");
|
||||
+ bedExplosionEffect = Explosion.BlockInteraction.DESTROY;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
public boolean dispenserApplyCursedArmor = true;
|
||||
private void dispenserSettings() {
|
||||
dispenserApplyCursedArmor = getBoolean("blocks.dispenser.apply-cursed-to-armor-slots", dispenserApplyCursedArmor);
|
||||
Reference in New Issue
Block a user