mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Implement bed explosion options
This commit is contained in:
committed by
granny
parent
295d2c91db
commit
a4af6baa0d
@@ -1,60 +0,0 @@
|
|||||||
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/net/minecraft/world/level/block/BedBlock.java b/net/minecraft/world/level/block/BedBlock.java
|
|
||||||
index be700995c3e7f63e0471712c3cd6fd83db583491..db79ef24ea01db5f619ab29700d3d391438fb742 100644
|
|
||||||
--- a/net/minecraft/world/level/block/BedBlock.java
|
|
||||||
+++ b/net/minecraft/world/level/block/BedBlock.java
|
|
||||||
@@ -106,7 +106,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
|
|
||||||
|
|
||||||
Vec3 vec3d = pos.getCenter();
|
|
||||||
|
|
||||||
- world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK);
|
|
||||||
+ if (world.purpurConfig.bedExplode) world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d), (ExplosionDamageCalculator) null, vec3d, (float) world.purpurConfig.bedExplosionPower, world.purpurConfig.bedExplosionFire, world.purpurConfig.bedExplosionEffect); // Purpur
|
|
||||||
return InteractionResult.SUCCESS_SERVER;
|
|
||||||
} else if ((Boolean) state.getValue(BedBlock.OCCUPIED)) {
|
|
||||||
if (!BedBlock.canSetSpawn(world)) return this.explodeBed(state, world, pos); // Paper - check explode first
|
|
||||||
@@ -159,7 +159,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
|
|
||||||
|
|
||||||
Vec3 vec3d = blockposition.getCenter();
|
|
||||||
|
|
||||||
- world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, blockState), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK); // CraftBukkit - add state
|
|
||||||
+ if (world.purpurConfig.bedExplode) world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, blockState), (ExplosionDamageCalculator) null, vec3d, (float) world.purpurConfig.bedExplosionPower, world.purpurConfig.bedExplosionFire, world.purpurConfig.bedExplosionEffect); // CraftBukkit - add state // Purpur
|
|
||||||
return InteractionResult.SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
||||||
index 8aebaf667907aa61355ae3a0846b4ee67f204382..6ffef28deee0a1dfb8c59a9c4d2d2427f8b5eacc 100644
|
|
||||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
||||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
||||||
@@ -279,6 +279,27 @@ public class PurpurWorldConfig {
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
+ public boolean bedExplode = true;
|
|
||||||
+ public double bedExplosionPower = 5.0D;
|
|
||||||
+ public boolean bedExplosionFire = true;
|
|
||||||
+ public net.minecraft.world.level.Level.ExplosionInteraction bedExplosionEffect = net.minecraft.world.level.Level.ExplosionInteraction.BLOCK;
|
|
||||||
+ private void bedSettings() {
|
|
||||||
+ if (PurpurConfig.version < 31) {
|
|
||||||
+ if ("DESTROY".equals(getString("blocks.bed.explosion-effect", bedExplosionEffect.name()))) {
|
|
||||||
+ set("blocks.bed.explosion-effect", "BLOCK");
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ bedExplode = getBoolean("blocks.bed.explode", bedExplode);
|
|
||||||
+ bedExplosionPower = getDouble("blocks.bed.explosion-power", bedExplosionPower);
|
|
||||||
+ bedExplosionFire = getBoolean("blocks.bed.explosion-fire", bedExplosionFire);
|
|
||||||
+ try {
|
|
||||||
+ bedExplosionEffect = net.minecraft.world.level.Level.ExplosionInteraction.valueOf(getString("blocks.bed.explosion-effect", bedExplosionEffect.name()));
|
|
||||||
+ } catch (IllegalArgumentException e) {
|
|
||||||
+ log(Level.SEVERE, "Unknown value for `blocks.bed.explosion-effect`! Using default of `BLOCK`");
|
|
||||||
+ bedExplosionEffect = net.minecraft.world.level.Level.ExplosionInteraction.BLOCK;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
public boolean dispenserApplyCursedArmor = true;
|
|
||||||
private void dispenserSettings() {
|
|
||||||
dispenserApplyCursedArmor = getBoolean("blocks.dispenser.apply-cursed-to-armor-slots", dispenserApplyCursedArmor);
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
--- a/net/minecraft/world/level/block/BedBlock.java
|
||||||
|
+++ b/net/minecraft/world/level/block/BedBlock.java
|
||||||
|
@@ -100,7 +_,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
Vec3 center = pos.getCenter();
|
||||||
|
- level.explode(null, level.damageSources().badRespawnPointExplosion(center), null, center, 5.0F, true, Level.ExplosionInteraction.BLOCK);
|
||||||
|
+ if (level.purpurConfig.bedExplode) level.explode(null, level.damageSources().badRespawnPointExplosion(center), null, center, (float) level.purpurConfig.bedExplosionPower, level.purpurConfig.bedExplosionFire, level.purpurConfig.bedExplosionEffect); // Purpur - Implement bed explosion options
|
||||||
|
return InteractionResult.SUCCESS_SERVER;
|
||||||
|
} else if (state.getValue(OCCUPIED)) {
|
||||||
|
if (!BedBlock.canSetSpawn(level)) return this.explodeBed(state, level, pos); // Paper - check explode first
|
||||||
|
@@ -152,7 +_,7 @@
|
||||||
|
|
||||||
|
Vec3 vec3d = blockposition.getCenter();
|
||||||
|
|
||||||
|
- world.explode(null, world.damageSources().badRespawnPointExplosion(vec3d, blockState), null, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK); // CraftBukkit - add state
|
||||||
|
+ if (world.purpurConfig.bedExplode) world.explode(null, world.damageSources().badRespawnPointExplosion(vec3d, blockState), null, vec3d, (float) world.purpurConfig.bedExplosionPower, world.purpurConfig.bedExplosionFire, world.purpurConfig.bedExplosionEffect); // CraftBukkit - add state // Purpur - Implement bed explosion options
|
||||||
|
return InteractionResult.SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package org.purpurmc.purpur;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.logging.Level;
|
||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
@@ -267,6 +268,27 @@ public class PurpurWorldConfig {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean bedExplode = true;
|
||||||
|
public double bedExplosionPower = 5.0D;
|
||||||
|
public boolean bedExplosionFire = true;
|
||||||
|
public net.minecraft.world.level.Level.ExplosionInteraction bedExplosionEffect = net.minecraft.world.level.Level.ExplosionInteraction.BLOCK;
|
||||||
|
private void bedSettings() {
|
||||||
|
if (PurpurConfig.version < 31) {
|
||||||
|
if ("DESTROY".equals(getString("blocks.bed.explosion-effect", bedExplosionEffect.name()))) {
|
||||||
|
set("blocks.bed.explosion-effect", "BLOCK");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bedExplode = getBoolean("blocks.bed.explode", bedExplode);
|
||||||
|
bedExplosionPower = getDouble("blocks.bed.explosion-power", bedExplosionPower);
|
||||||
|
bedExplosionFire = getBoolean("blocks.bed.explosion-fire", bedExplosionFire);
|
||||||
|
try {
|
||||||
|
bedExplosionEffect = net.minecraft.world.level.Level.ExplosionInteraction.valueOf(getString("blocks.bed.explosion-effect", bedExplosionEffect.name()));
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
log(Level.SEVERE, "Unknown value for `blocks.bed.explosion-effect`! Using default of `BLOCK`");
|
||||||
|
bedExplosionEffect = net.minecraft.world.level.Level.ExplosionInteraction.BLOCK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean dispenserApplyCursedArmor = true;
|
public boolean dispenserApplyCursedArmor = true;
|
||||||
private void dispenserSettings() {
|
private void dispenserSettings() {
|
||||||
dispenserApplyCursedArmor = getBoolean("blocks.dispenser.apply-cursed-to-armor-slots", dispenserApplyCursedArmor);
|
dispenserApplyCursedArmor = getBoolean("blocks.dispenser.apply-cursed-to-armor-slots", dispenserApplyCursedArmor);
|
||||||
|
|||||||
Reference in New Issue
Block a user