mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@9f1fa0b Fix item gravity on inactive items, remove dumb active skipping PaperMC/Paper@1a1d0cf Use target pitch in teleport (generally the same thing) PaperMC/Paper@8ba3073 fix "is_freezing" damage type tag PaperMC/Paper@1523212 don't resend effects when PlayerItemConsumeEvent is cancelled PaperMC/Paper@1330880 Add Friction API to minecarts PaperMC/Paper@580a610 Allow using old ender pearl behavior & apply ender pearl exploit patch (#11524) PaperMC/Paper@40a960d Rebuild patches PaperMC/Paper@dfedf79 Correctly cancel consumption of consumable PaperMC/Paper@147b796 get previous redstone level from the right state for experimental wires PaperMC/Paper@ad9c58e Only expose velocity relative tp flags to API (#11532) PaperMC/Paper@f273e6e Set updatingMinecraft to false PaperMC/Paper@c5c1250 [ci skip] Remove leftover todo file (#11540) PaperMC/Paper@7ee4835 Correctly clear explosion density cache(#11541) PaperMC/Paper@52a0590 Updated Upstream (Bukkit/CraftBukkit) (#11543) PaperMC/Paper@5c0930d Fix fix recipe iterator patch PaperMC/Paper@1de0130 re-add a dispense fix patch PaperMC/Paper@16d7d73 bunch more general fixes PaperMC/Paper@a5d7426 Correctly support RecipeChoice.empty (#11550) PaperMC/Paper@85c870e Correct update cursor (#11554) PaperMC/Paper@d19be64 Fix NPE with spark when CraftServer is not init yet (#11558) PaperMC/Paper@92131ad Decrease dead entity teleport warning (#11559)
This commit is contained in:
130
patches/server/0195-Conduit-behavior-configuration.patch
Normal file
130
patches/server/0195-Conduit-behavior-configuration.patch
Normal file
@@ -0,0 +1,130 @@
|
||||
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 d354c2ad41533ec8d52f7c5f63f8f74a0b1ce235..a43c41a26c1e34a2f4eda1c498a562664a783c77 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
|
||||
@@ -169,7 +169,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) {
|
||||
@@ -189,13 +189,13 @@ public class ConduitBlockEntity extends BlockEntity {
|
||||
|
||||
private static void applyEffects(Level world, BlockPos pos, List<BlockPos> activatingBlocks) {
|
||||
// CraftBukkit start
|
||||
- ConduitBlockEntity.applyEffects(world, pos, ConduitBlockEntity.getRange(activatingBlocks));
|
||||
+ ConduitBlockEntity.applyEffects(world, pos, ConduitBlockEntity.getRange(activatingBlocks, world)); // Purpur
|
||||
}
|
||||
|
||||
- public static int getRange(List<BlockPos> list) {
|
||||
+ public static int getRange(List<BlockPos> list, Level world) { // Purpur
|
||||
// CraftBukkit end
|
||||
int i = list.size();
|
||||
- int j = i / 7 * 16;
|
||||
+ int j = i / 7 * world.purpurConfig.conduitDistance; // Purpur
|
||||
// CraftBukkit start
|
||||
return j;
|
||||
}
|
||||
@@ -238,20 +238,20 @@ public class ConduitBlockEntity extends BlockEntity {
|
||||
tileentityconduit.destroyTarget = ConduitBlockEntity.findDestroyTarget(world, blockposition, tileentityconduit.destroyTargetUUID);
|
||||
tileentityconduit.destroyTargetUUID = null;
|
||||
} else if (tileentityconduit.destroyTarget == null) {
|
||||
- List<LivingEntity> list1 = world.getEntitiesOfClass(LivingEntity.class, ConduitBlockEntity.getDestroyRangeAABB(blockposition), (entityliving1) -> {
|
||||
+ List<LivingEntity> list1 = world.getEntitiesOfClass(LivingEntity.class, ConduitBlockEntity.getDestroyRangeAABB(blockposition, world), (entityliving1) -> { // Purpur
|
||||
return entityliving1 instanceof Enemy && entityliving1.isInWaterOrRain();
|
||||
});
|
||||
|
||||
if (!list1.isEmpty()) {
|
||||
tileentityconduit.destroyTarget = (LivingEntity) list1.get(world.random.nextInt(list1.size()));
|
||||
}
|
||||
- } else if (!tileentityconduit.destroyTarget.isAlive() || !blockposition.closerThan(tileentityconduit.destroyTarget.blockPosition(), 8.0D)) {
|
||||
+ } else if (!tileentityconduit.destroyTarget.isAlive() || !blockposition.closerThan(tileentityconduit.destroyTarget.blockPosition(), world.purpurConfig.conduitDamageDistance)) { // Purpur
|
||||
tileentityconduit.destroyTarget = null;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
if (damageTarget && tileentityconduit.destroyTarget != null) {
|
||||
- if (tileentityconduit.destroyTarget.hurtServer((ServerLevel) world, world.damageSources().magic().directBlock(world, blockposition), 4.0F)) {
|
||||
+ if (tileentityconduit.destroyTarget.hurtServer((ServerLevel) world, world.damageSources().magic().directBlock(world, blockposition), world.purpurConfig.conduitDamageAmount)) { // Purpur
|
||||
world.playSound(null, tileentityconduit.destroyTarget.getX(), tileentityconduit.destroyTarget.getY(), tileentityconduit.destroyTarget.getZ(), SoundEvents.CONDUIT_ATTACK_TARGET, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -276,16 +276,22 @@ public class ConduitBlockEntity extends BlockEntity {
|
||||
}
|
||||
|
||||
public 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/bukkit/craftbukkit/block/CraftConduit.java b/src/main/java/org/bukkit/craftbukkit/block/CraftConduit.java
|
||||
index c1759aeb3e6ad0e4eb66cba3da1b120dd1dce812..1a91bc2e422db0eba65694ac046f1b362c6b0cd6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftConduit.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftConduit.java
|
||||
@@ -73,7 +73,7 @@ public class CraftConduit extends CraftBlockEntityState<ConduitBlockEntity> impl
|
||||
public int getRange() {
|
||||
this.ensureNoWorldGeneration();
|
||||
ConduitBlockEntity conduit = (ConduitBlockEntity) this.getTileEntityFromWorld();
|
||||
- return (conduit != null) ? ConduitBlockEntity.getRange(conduit.effectBlocks) : 0;
|
||||
+ return (conduit != null) ? ConduitBlockEntity.getRange(conduit.effectBlocks, this.world.getHandle()) : 0; // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index eb09366f743a2f471f126259e2ef608d14639377..b8be7d5fb350a7a782404abbae295e313f9948ed 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -3013,4 +3013,27 @@ 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 = BuiltInRegistries.BLOCK.getValue(ResourceLocation.parse(key.toString()));
|
||||
+ if (!block.defaultBlockState().isAir()) {
|
||||
+ conduitBlockList.add(block);
|
||||
+ }
|
||||
+ });
|
||||
+ conduitBlocks = conduitBlockList.toArray(Block[]::new);
|
||||
+ }
|
||||
}
|
||||
Reference in New Issue
Block a user