mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
79 lines
4.5 KiB
Diff
79 lines
4.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Encode42 <me@encode42.dev>
|
|
Date: Sun, 8 Aug 2021 18:14:31 -0400
|
|
Subject: [PATCH] Conduit behavior configuration
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ConduitBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ConduitBlockEntity.java
|
|
index 05eab04e4aec4151018f25b59f92ddbbb4c09f87..8db906e021ca57c7f2a1e7002647e5c50be180aa 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/ConduitBlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/ConduitBlockEntity.java
|
|
@@ -172,7 +172,7 @@ public class ConduitBlockEntity extends BlockEntity {
|
|
if ((l > 1 || i1 > 1 || j1 > 1) && (i == 0 && (i1 == 2 || j1 == 2) || j == 0 && (l == 2 || j1 == 2) || k == 0 && (l == 2 || i1 == 2))) {
|
|
BlockPos blockposition2 = pos.offset(i, j, k);
|
|
BlockState iblockdata = world.getBlockState(blockposition2);
|
|
- Block[] ablock = ConduitBlockEntity.VALID_BLOCKS;
|
|
+ Block[] ablock = world.purpurConfig.conduitBlocks; // Purpur
|
|
int k1 = ablock.length;
|
|
|
|
for (int l1 = 0; l1 < k1; ++l1) {
|
|
@@ -192,7 +192,7 @@ public class ConduitBlockEntity extends BlockEntity {
|
|
|
|
private static void applyEffects(Level world, BlockPos pos, List<BlockPos> activatingBlocks) {
|
|
int i = activatingBlocks.size();
|
|
- int j = i / 7 * 16;
|
|
+ int j = i / 7 * world.purpurConfig.conduitDistance; // Purpur
|
|
int k = pos.getX();
|
|
int l = pos.getY();
|
|
int i1 = pos.getZ();
|
|
@@ -230,14 +230,14 @@ public class ConduitBlockEntity extends BlockEntity {
|
|
if (!list1.isEmpty()) {
|
|
blockEntity.destroyTarget = (LivingEntity) list1.get(world.random.nextInt(list1.size()));
|
|
}
|
|
- } else if (!blockEntity.destroyTarget.isAlive() || !pos.closerThan(blockEntity.destroyTarget.blockPosition(), 8.0D)) {
|
|
+ } else if (!blockEntity.destroyTarget.isAlive() || !pos.closerThan(blockEntity.destroyTarget.blockPosition(), world.purpurConfig.conduitDamageDistance)) { // Purpur
|
|
blockEntity.destroyTarget = null;
|
|
}
|
|
|
|
if (blockEntity.destroyTarget != null) {
|
|
// CraftBukkit start
|
|
CraftEventFactory.blockDamage = CraftBlock.at(world, pos);
|
|
- if (blockEntity.destroyTarget.hurt(DamageSource.MAGIC, 4.0F)) {
|
|
+ if (blockEntity.destroyTarget.hurt(DamageSource.MAGIC, world.purpurConfig.conduitDamageAmount)) { // Purpur
|
|
world.playSound((Player) null, blockEntity.destroyTarget.getX(), blockEntity.destroyTarget.getY(), blockEntity.destroyTarget.getZ(), SoundEvents.CONDUIT_ATTACK_TARGET, SoundSource.BLOCKS, 1.0F, 1.0F);
|
|
}
|
|
CraftEventFactory.blockDamage = null;
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index 6b8b067c2554250049563c008dcf7f9b73ed89a8..660c326237efdb06d1610a9110fe3890f3f3e52c 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -2720,5 +2720,28 @@ public class PurpurWorldConfig {
|
|
private void hungerSettings() {
|
|
hungerStarvationDamage = (float) getDouble("hunger.starvation-damage", hungerStarvationDamage);
|
|
}
|
|
+
|
|
+ public int conduitDistance = 16;
|
|
+ public double conduitDamageDistance = 8;
|
|
+ public float conduitDamageAmount = 4;
|
|
+ public Block[] conduitBlocks;
|
|
+ private void conduitSettings() {
|
|
+ conduitDistance = getInt("blocks.conduit.effect-distance", conduitDistance);
|
|
+ conduitDamageDistance = getDouble("blocks.conduit.mob-damage.distance", conduitDamageDistance);
|
|
+ conduitDamageAmount = (float) getDouble("blocks.conduit.mob-damage.damage-amount", conduitDamageAmount);
|
|
+ List<Block> conduitBlockList = new ArrayList<>();
|
|
+ getList("blocks.conduit.valid-ring-blocks", new ArrayList<String>(){{
|
|
+ add("minecraft:prismarine");
|
|
+ add("minecraft:prismarine_bricks");
|
|
+ add("minecraft:sea_lantern");
|
|
+ add("minecraft:dark_prismarine");
|
|
+ }}).forEach(key -> {
|
|
+ Block block = Registry.BLOCK.get(new ResourceLocation(key.toString()));
|
|
+ if (!block.defaultBlockState().isAir()) {
|
|
+ conduitBlockList.add(block);
|
|
+ }
|
|
+ });
|
|
+ conduitBlocks = conduitBlockList.toArray(Block[]::new);
|
|
+ }
|
|
}
|
|
|