This commit is contained in:
BillyGalbreath 2022-09-19 19:24:47 -05:00
parent a448748b1a
commit 3d026d9a11
No known key found for this signature in database
GPG Key ID: 1968A5C4D57BB3FA

View File

@ -5,10 +5,18 @@ 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
index 05eab04e4aec4151018f25b59f92ddbbb4c09f87..8720ff5c7a1a05b8c7093bb618278685b29b2872 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 {
@@ -9,6 +9,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
+import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
@@ -172,7 +173,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);
@ -17,7 +25,7 @@ index 05eab04e4aec4151018f25b59f92ddbbb4c09f87..8db906e021ca57c7f2a1e7002647e5c5
int k1 = ablock.length;
for (int l1 = 0; l1 < k1; ++l1) {
@@ -192,7 +192,7 @@ public class ConduitBlockEntity extends BlockEntity {
@@ -192,7 +193,7 @@ public class ConduitBlockEntity extends BlockEntity {
private static void applyEffects(Level world, BlockPos pos, List<BlockPos> activatingBlocks) {
int i = activatingBlocks.size();
@ -26,7 +34,15 @@ index 05eab04e4aec4151018f25b59f92ddbbb4c09f87..8db906e021ca57c7f2a1e7002647e5c5
int k = pos.getX();
int l = pos.getY();
int i1 = pos.getZ();
@@ -230,14 +230,14 @@ public class ConduitBlockEntity extends BlockEntity {
@@ -223,21 +224,21 @@ public class ConduitBlockEntity extends BlockEntity {
blockEntity.destroyTarget = ConduitBlockEntity.findDestroyTarget(world, pos, blockEntity.destroyTargetUUID);
blockEntity.destroyTargetUUID = null;
} else if (blockEntity.destroyTarget == null) {
- List<LivingEntity> list1 = world.getEntitiesOfClass(LivingEntity.class, ConduitBlockEntity.getDestroyRangeAABB(pos), (entityliving1) -> {
+ List<LivingEntity> list1 = world.getEntitiesOfClass(LivingEntity.class, ConduitBlockEntity.getDestroyRangeAABB(pos, world), (entityliving1) -> { // Purpur
return entityliving1 instanceof Enemy && entityliving1.isInWaterOrRain();
});
if (!list1.isEmpty()) {
blockEntity.destroyTarget = (LivingEntity) list1.get(world.random.nextInt(list1.size()));
}
@ -43,8 +59,33 @@ index 05eab04e4aec4151018f25b59f92ddbbb4c09f87..8db906e021ca57c7f2a1e7002647e5c5
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;
@@ -263,16 +264,22 @@ public class ConduitBlockEntity extends BlockEntity {
}
private static AABB getDestroyRangeAABB(BlockPos pos) {
+ // Purpur start
+ return getDestroyRangeAABB(pos, null);
+ }
+
+ private static AABB getDestroyRangeAABB(BlockPos pos, Level level) {
+ // Purpur end
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
- return (new AABB((double) i, (double) j, (double) k, (double) (i + 1), (double) (j + 1), (double) (k + 1))).inflate(8.0D);
+ return (new AABB((double) i, (double) j, (double) k, (double) (i + 1), (double) (j + 1), (double) (k + 1))).inflate(level == null ? 8.0D : level.purpurConfig.conduitDamageDistance); // Purpur
}
@Nullable
private static LivingEntity findDestroyTarget(Level world, BlockPos pos, UUID uuid) {
- List<LivingEntity> list = world.getEntitiesOfClass(LivingEntity.class, ConduitBlockEntity.getDestroyRangeAABB(pos), (entityliving) -> {
+ List<LivingEntity> list = world.getEntitiesOfClass(LivingEntity.class, ConduitBlockEntity.getDestroyRangeAABB(pos, world), (entityliving) -> { // Purpur
return entityliving.getUUID().equals(uuid);
});
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 25ac97095cf7099f78426c56d48864299d33e96c..48ad9e06f7f035dce6c294647bfeb9a579b37a5b 100644
index dec852113a8f359a3e37b42916df46957edcd98a..1489a5d5985271665aa55720b0ffdc3e94636f48 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -2773,5 +2773,28 @@ public class PurpurWorldConfig {