Updated Upstream (Paper, Purpur)

This commit is contained in:
AlphaKR93
2024-05-04 18:13:25 +09:00
parent 4815251655
commit 491c491ba6
8 changed files with 223 additions and 60 deletions

View File

@@ -5,7 +5,7 @@ plugins {
java
`maven-publish`
`kotlin-dsl`
// `always-up-to-date` // TODO: Temporary change
`always-up-to-date`
alias(libs.plugins.shadow) apply false
alias(libs.plugins.paperweight)
}
@@ -122,7 +122,6 @@ paperweight {
}
}
/* // TODO: Temporary change
alwaysUpToDate {
paperRepoName.set("org.plazmamc.alwaysuptodate.paper.repository")
@@ -138,7 +137,6 @@ alwaysUpToDate {
pufferfishToggleName.set("usePufferfish")
}
*/ // TODO: Temporary change
tasks {
applyPatches {

View File

@@ -116,8 +116,7 @@ abstract class PurpurUpdateTask : Task() {
val paper = purpur.resolve(".gradle/caches/paperweight/upstreams/paper/Paper-Server")
copySource(paper)
Git(paper)("add", ".").executeOut()
Git(paper)("commit", "-m", "Vanilla Sources", "--author=Vanilla <auto@mated.null>").executeOut()
Git(paper).addCommit("Vanilla Sources", "--author=Vanilla <auto@mated.null>")
Thread.sleep(1_000)
paper.resolve(".git").toFile().copyRecursively(dotGit, overwrite = true)
Git(it).addCommit("Purpur Server Changes\n\n$purpurCommit", "--author=granny <contact@granny.dev>")
@@ -128,9 +127,6 @@ abstract class PurpurUpdateTask : Task() {
dotGit.deleteRecursively()
val paper = purpur.resolve(".gradle/caches/paperweight/upstreams/paper/Paper-API")
Git(paper)("add", ".").executeOut()
Git(paper)("commit", "-m", "Vanilla Sources", "--author=Vanilla <auto@mated.null>").executeOut()
Thread.sleep(1_000)
paper.resolve(".git").toFile().copyRecursively(dotGit, overwrite = true)
Git(it).addCommit("Purpur API Changes\n\n$purpurCommit", "--author=granny <contact@granny.dev>")
}
@@ -215,8 +211,7 @@ abstract class PurpurUpdateTask : Task() {
val paper = pufferfish.resolve(".gradle/caches/paperweight/upstreams/paper/Paper-Server")
copySource(paper)
Git(paper)("add", ".").executeOut()
Git(paper)("commit", "-m", "Vanilla Sources", "--author=Vanilla <auto@mated.null>").executeOut()
Git(paper).addCommit("Vanilla Sources", "--author=Vanilla <auto@mated.null>")
Thread.sleep(1_000)
paper.resolve(".git").toFile().copyRecursively(dotGit, overwrite = true)

View File

@@ -13,6 +13,6 @@ fun Git.clone(name: String, uri: String, branch: String, dir: Path): Path {
}
fun Git.addCommit(vararg args: String) {
this("add", ".").executeSilently(silenceErr = true)
this("commit", "-m", *args).executeSilently(silenceErr = true)
this("add", ".").executeOut()
this("commit", "-m", *args).executeOut()
}

View File

@@ -17,5 +17,5 @@ purpurBranch = ver/1.20.6
pufferfishBranch = ver/1.20
usePufferfish = false
paperCommit = 4ea67abd46ecbfb501ed2e0f13d494635972bfa0
purpurCommit = b02dc7ac072ffbffa0e47c78b20cc51e752c68a6
paperCommit = 0db72ac19e735d398e85b2152d5a32317bb03dc8
purpurCommit = 1ddead8ef8f0d1e2fcfb32e30c8dbe18792a53d7

View File

@@ -1,8 +1,28 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Tue, 30 Apr 2024 23:08:38 +0900
Subject: [PATCH] Purpur API Patches
From: granny <contact@granny.dev>
Date: Sat, 4 May 2024 18:10:29 +0900
Subject: [PATCH] Purpur API Changes
PurpurMC
Copyright (C) 2024 PurpurMC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
diff --git a/build.gradle.kts b/build.gradle.kts
index 65e67b8726f1e19a6bcb1fe2f448e4ab68df11d1..892e78b1d2d29dc54def03fcb6d85a93ad56d84c 100644

View File

@@ -1,8 +1,28 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Tue, 30 Apr 2024 23:09:48 +0900
Subject: [PATCH] Purpur Server Patches
From: granny <contact@granny.dev>
Date: Sat, 4 May 2024 18:10:28 +0900
Subject: [PATCH] Purpur Server Changes
PurpurMC
Copyright (C) 2024 PurpurMC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
diff --git a/build.gradle.kts b/build.gradle.kts
index 5d448d8a7cf6626a11791f30ad52baf41a099272..81996f00384674b29368e8bea944bdd14d631da3 100644
@@ -3862,7 +3882,7 @@ index 359a2f0492a9b938a4f015c546e100e0092ae1d4..25e614be19b2b29b36af136b823f27f8
return this.type().msgId();
}
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSources.java b/src/main/java/net/minecraft/world/damagesource/DamageSources.java
index 349d1683458ec5d641c9823aa7a68dec8820a664..f0568c3d731afaf610ac2f45db53148d38338cdf 100644
index a1c53f04c2dd505e6af72e512e111d7994786035..5ffe772e29dfd422b664e8123e7f5cf396158674 100644
--- a/src/main/java/net/minecraft/world/damagesource/DamageSources.java
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSources.java
@@ -44,11 +44,15 @@ public class DamageSources {
@@ -4524,7 +4544,7 @@ index 09fdea983772612ef3fff6b2da3cf469a34e4ec0..3e2ea26c23e88c395856b65001f2895d
protected ParticleOptions getInkParticle() {
return ParticleTypes.GLOW_SQUID_INK;
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 6e043457a29a890bcefd27fc5bb07c1a7e4e30f7..fa698cfefccdddf5e5e9938a2959004c70f743a7 100644
index 6e043457a29a890bcefd27fc5bb07c1a7e4e30f7..53ff232129443ba3242cfc57fc57026bf76d96e8 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -229,9 +229,9 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -4751,9 +4771,9 @@ index 6e043457a29a890bcefd27fc5bb07c1a7e4e30f7..fa698cfefccdddf5e5e9938a2959004c
+ double attackDamage;
+ net.minecraft.world.item.component.ItemAttributeModifiers itemattributemodifiers = player.getMainHandItem().getOrDefault(DataComponents.ATTRIBUTE_MODIFIERS, net.minecraft.world.item.component.ItemAttributeModifiers.EMPTY);
+
+ attackDamage = itemattributemodifiers.compute(this.getAttributeBaseValue(Attributes.ATTACK_DAMAGE), EquipmentSlot.MAINHAND);
+ attackDamage = itemattributemodifiers.compute(player.getAttributeBaseValue(Attributes.ATTACK_DAMAGE), EquipmentSlot.MAINHAND);
+
+ if (attackDamage == 0) {
+ if (attackDamage == 1.0D) {
+ this.setHealth(0);
+ }
+ }
@@ -5872,7 +5892,7 @@ index d2f0c3b26d4beedb49d86e0242d843590d469d02..7463eefb7d09ea55fe8780210e7e967c
if (baseEntity == null) {
if (this.isCombat && (!targetEntity.canBeSeenAsEnemy() || targetEntity.level().getDifficulty() == Difficulty.PEACEFUL)) {
diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
index dc27ddf5131e7398a5390a5187261d4c7fb6ccaa..274db35be501d1dd0c5407d350a37b04bf4fbb7e 100644
index dc27ddf5131e7398a5390a5187261d4c7fb6ccaa..47a7c7f9527e1c4ea457eeafe0e11145653a871f 100644
--- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java
+++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
@@ -44,12 +44,59 @@ public class Bat extends AmbientCreature {
@@ -5888,7 +5908,7 @@ index dc27ddf5131e7398a5390a5187261d4c7fb6ccaa..274db35be501d1dd0c5407d350a37b04
+ // Purpur start
+ @Override
+ public boolean shouldSendAttribute(net.minecraft.world.entity.ai.attributes.Attribute attribute) { return attribute != Attributes.FLYING_SPEED; } // Fixes log spam on clients
+ public boolean shouldSendAttribute(net.minecraft.world.entity.ai.attributes.Attribute attribute) { return attribute != Attributes.FLYING_SPEED.value(); } // Fixes log spam on clients
+
+ @Override
+ public boolean isRidable() {
@@ -16097,10 +16117,28 @@ index 9fd2d97ff0e05578a3e6a0b86dc1974691845c5d..58343722399404530d497648155dbc25
return optional3;
} else {
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
index 96fb69ec6db2e7c8c728435f0c537b076259b2fb..2649188930653610b8aaaeb18797c80879cd572a 100644
index 96fb69ec6db2e7c8c728435f0c537b076259b2fb..7572c289758001c7417a192f0e6e994ffa8408b3 100644
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
@@ -219,6 +219,7 @@ public class BlockItem extends Item {
@@ -157,7 +157,16 @@ public class BlockItem extends Item {
}
protected boolean updateCustomBlockEntityTag(BlockPos pos, Level world, @Nullable Player player, ItemStack stack, BlockState state) {
- return BlockItem.updateCustomBlockEntityTag(world, player, pos, stack);
+ // Purpur start
+ boolean handled = updateCustomBlockEntityTag(world, player, pos, stack);
+ if (world.purpurConfig.persistentTileEntityLore) {
+ BlockEntity blockEntity1 = world.getBlockEntity(pos);
+ if (blockEntity1 != null) {
+ blockEntity1.setPersistentLore(stack.getOrDefault(DataComponents.LORE, net.minecraft.world.item.component.ItemLore.EMPTY));
+ }
+ }
+ return handled;
+ // Purpur end
}
@Nullable
@@ -219,6 +228,7 @@ public class BlockItem extends Item {
if (tileentity != null) {
if (!world.isClientSide && tileentity.onlyOpCanSetNbt() && (player == null || !(player.canUseGameMasterBlocks() || (player.getAbilities().instabuild && player.getBukkitEntity().hasPermission("minecraft.nbt.place"))))) { // Spigot - add permission
@@ -16108,7 +16146,7 @@ index 96fb69ec6db2e7c8c728435f0c537b076259b2fb..2649188930653610b8aaaeb18797c808
return false;
}
@@ -259,6 +260,7 @@ public class BlockItem extends Item {
@@ -259,6 +269,7 @@ public class BlockItem extends Item {
ItemContainerContents itemcontainercontents = (ItemContainerContents) entity.getItem().set(DataComponents.CONTAINER, ItemContainerContents.EMPTY);
if (itemcontainercontents != null) {
@@ -17130,7 +17168,7 @@ index ce9f189bdafec26360bfadd0f36a8bc2726e132b..d5465b48531fd4b4094874c135274abf
return true;
} else {
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 f726c3839ab93cc81fee26bfeb821bead3533b5e..a4bae9631acfc363d22b89fb76965183d9dc79f1 100644
index 4459685d1fb655f93a523ae50b62d6b97785ed90..a4a988ab1399702b943019e9c4e2cde3652b4e85 100644
--- a/src/main/java/net/minecraft/world/level/block/BedBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java
@@ -104,7 +104,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
@@ -17142,16 +17180,16 @@ index f726c3839ab93cc81fee26bfeb821bead3533b5e..a4bae9631acfc363d22b89fb76965183
return InteractionResult.SUCCESS;
} else if ((Boolean) state.getValue(BedBlock.OCCUPIED)) {
if (!BedBlock.canSetSpawn(world)) return this.explodeBed(state, world, pos); // Paper - check explode first
@@ -156,7 +156,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
@@ -157,7 +157,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
Vec3 vec3d = blockposition.getCenter();
- world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, world, iblockdata, blockposition), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK); // CraftBukkit - add state
+ if (world.purpurConfig.bedExplode) world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, world, iblockdata, blockposition), (ExplosionDamageCalculator) null, vec3d, (float) world.purpurConfig.bedExplosionPower, world.purpurConfig.bedExplosionFire, world.purpurConfig.bedExplosionEffect); // CraftBukkit - add state // Purpur
- world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, world, iblockdata, blockposition, blockEntity), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK); // CraftBukkit - add state // Paper - add BlockEntity
+ if (world.purpurConfig.bedExplode) world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, world, iblockdata, blockposition, blockEntity), (ExplosionDamageCalculator) null, vec3d, (float) world.purpurConfig.bedExplosionPower, world.purpurConfig.bedExplosionFire, world.purpurConfig.bedExplosionEffect); // CraftBukkit - add state // Paper - add BlockEntity // Purpur
return InteractionResult.SUCCESS;
}
}
@@ -180,7 +180,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
@@ -181,7 +181,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
@Override
public void fallOn(Level world, BlockState state, BlockPos pos, Entity entity, float fallDistance) {
@@ -17174,7 +17212,7 @@ index 8240c32d676a88aa23dcd052ee0136767e54fb0d..372c4ab9d390d5afd98947f21c79aae0
if (i != -1) {
world.scheduleTick(blockposition, (Block) this, i);
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
index cf8b8c8efd1c9c81eb5f02d75bd75875eb66771f..c6ed00f89127a2857dfb9ce9e04513e5cf510dfb 100644
index cf8b8c8efd1c9c81eb5f02d75bd75875eb66771f..5ae3decf100d21f7d4a471c155eaf5e00e996580 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -89,6 +89,10 @@ public class Block extends BlockBehaviour implements ItemLike {
@@ -17188,7 +17226,59 @@ index cf8b8c8efd1c9c81eb5f02d75bd75875eb66771f..c6ed00f89127a2857dfb9ce9e04513e5
// Paper start
public final boolean isDestroyable() {
return io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowPermanentBlockBreakExploits ||
@@ -438,7 +442,17 @@ public class Block extends BlockBehaviour implements ItemLike {
@@ -312,7 +316,7 @@ public class Block extends BlockBehaviour implements ItemLike {
public static void dropResources(BlockState state, LevelAccessor world, BlockPos pos, @Nullable BlockEntity blockEntity) {
if (world instanceof ServerLevel) {
Block.getDrops(state, (ServerLevel) world, pos, blockEntity).forEach((itemstack) -> {
- Block.popResource((ServerLevel) world, pos, itemstack);
+ Block.popResource((ServerLevel) world, pos, applyLoreFromTile(itemstack, blockEntity)); // Purpur
});
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY, true);
}
@@ -331,7 +335,7 @@ public class Block extends BlockBehaviour implements ItemLike {
event.setExpToDrop(block.getExpDrop(state, serverLevel, pos, net.minecraft.world.item.ItemStack.EMPTY, true)); // Paper - Properly handle xp dropping
event.callEvent();
for (org.bukkit.inventory.ItemStack drop : event.getDrops()) {
- popResource(serverLevel, pos, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(drop));
+ popResource(serverLevel, pos, applyLoreFromTile(org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(drop), blockEntity)); // Purpur
}
state.spawnAfterBreak(serverLevel, pos, ItemStack.EMPTY, false); // Paper - Properly handle xp dropping
block.popExperience(serverLevel, pos, event.getExpToDrop()); // Paper - Properly handle xp dropping
@@ -348,13 +352,32 @@ public class Block extends BlockBehaviour implements ItemLike {
// Paper end - Properly handle xp dropping
if (world instanceof ServerLevel) {
Block.getDrops(state, (ServerLevel) world, pos, blockEntity, entity, tool).forEach((itemstack1) -> {
- Block.popResource(world, pos, itemstack1);
+ Block.popResource(world, pos, applyLoreFromTile(itemstack1, blockEntity)); // Purpur
});
state.spawnAfterBreak((ServerLevel) world, pos, tool, dropExperience); // Paper - Properly handle xp dropping
}
}
+ // Purpur start
+ private static ItemStack applyLoreFromTile(ItemStack stack, @Nullable BlockEntity blockEntity) {
+ if (stack.getItem() instanceof BlockItem) {
+ if (blockEntity != null && blockEntity.getLevel() instanceof ServerLevel) {
+ net.minecraft.world.item.component.ItemLore lore = blockEntity.getPersistentLore();
+ net.minecraft.core.component.DataComponentPatch.Builder builder = net.minecraft.core.component.DataComponentPatch.builder();
+ if (blockEntity.getLevel().purpurConfig.persistentTileEntityLore && lore != null) {
+ builder.set(net.minecraft.core.component.DataComponents.LORE, lore);
+ }
+ if (!blockEntity.getLevel().purpurConfig.persistentTileEntityDisplayName) {
+ builder.remove(net.minecraft.core.component.DataComponents.CUSTOM_NAME);
+ }
+ stack.applyComponents(builder.build());
+ }
+ }
+ return stack;
+ }
+ // Purpur end
+
public static void popResource(Level world, BlockPos pos, ItemStack stack) {
double d0 = (double) EntityType.ITEM.getHeight() / 2.0D;
double d1 = (double) pos.getX() + 0.5D + Mth.nextDouble(world.random, -0.25D, 0.25D);
@@ -438,7 +461,17 @@ public class Block extends BlockBehaviour implements ItemLike {
} // Paper - fix drops not preventing stats/food exhaustion
}
@@ -17207,7 +17297,7 @@ index cf8b8c8efd1c9c81eb5f02d75bd75875eb66771f..c6ed00f89127a2857dfb9ce9e04513e5
public boolean isPossibleToRespawnInThis(BlockState state) {
return !state.isSolid() && !state.liquid();
@@ -457,7 +471,7 @@ public class Block extends BlockBehaviour implements ItemLike {
@@ -457,7 +490,7 @@ public class Block extends BlockBehaviour implements ItemLike {
}
public void fallOn(Level world, BlockState state, BlockPos pos, Entity entity, float fallDistance) {
@@ -18033,15 +18123,15 @@ index 9603d8c84ff483030dc08e82d3579b89e5c1f6e9..8fc65c32a3c6e6842a76b36f45e1b1c2
} else {
int j = pos.getX();
diff --git a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
index be85535767bc79875c38da78a209d33d4be87c8a..2b840a5516073da46207552688428d86fc99975b 100644
index 0699211428f182d8d56a2ba019d89ce05c920430..351fb74d2cccd7f63c2efee197a2968f822eda42 100644
--- a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
@@ -149,7 +149,7 @@ public class RespawnAnchorBlock extends Block {
};
Vec3 vec3d = explodedPos.getCenter();
- world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, world, state, explodedPos), explosiondamagecalculator, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK); // CraftBukkit - add state
+ if (world.purpurConfig.respawnAnchorExplode)world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, world, state, explodedPos), explosiondamagecalculator, vec3d, (float) world.purpurConfig.respawnAnchorExplosionPower, world.purpurConfig.respawnAnchorExplosionFire, world.purpurConfig.respawnAnchorExplosionEffect);// CraftBukkit - add state // Purpur
- world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, world, state, explodedPos, null), explosiondamagecalculator, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK); // CraftBukkit - add state // Paper
+ if (world.purpurConfig.respawnAnchorExplode) world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, world, state, explodedPos, null), explosiondamagecalculator, vec3d, (float) world.purpurConfig.respawnAnchorExplosionPower, world.purpurConfig.respawnAnchorExplosionFire, world.purpurConfig.respawnAnchorExplosionEffect); // CraftBukkit - add state // Paper // Purpur
}
public static boolean canSetSpawn(Level world) {
@@ -18604,6 +18694,56 @@ index 7b263fab4f0014400b3b8e7e33db32f9a125f6ba..f7a6ab35c95ffda73f17843916ddb624
private int exitTickCounter; // Paper - Fix bees aging inside hives; separate counter for checking if bee should exit to reduce exit attempts
private int ticksInHive;
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
index 7963afff4b32a0e46be9bdeb413657718cfc14f5..5168e8e9ebb54b6c00acb7f2939262eb06a7426d 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
@@ -87,6 +87,12 @@ public abstract class BlockEntity {
if (persistentDataTag instanceof CompoundTag) {
this.persistentDataContainer.putAll((CompoundTag) persistentDataTag);
}
+ // Purpur start
+ if (nbt.contains("Purpur.persistentLore")) {
+ net.minecraft.world.item.component.ItemLore.CODEC.decode(net.minecraft.nbt.NbtOps.INSTANCE, nbt.getCompound("Purpur.persistentLore")).result()
+ .ifPresent(tag -> this.persistentLore = tag.getFirst());
+ }
+ // Purpur end
}
// CraftBukkit end
@@ -103,6 +109,15 @@ public abstract class BlockEntity {
this.loadAdditional(nbt, registryLookup);
}
+ // Purpur start
+ protected void saveAdditional(CompoundTag nbt) {
+ if (this.persistentLore != null) {
+ net.minecraft.world.item.component.ItemLore.CODEC.encodeStart(net.minecraft.nbt.NbtOps.INSTANCE, this.persistentLore).result()
+ .ifPresent(tag -> nbt.put("Purpur.persistentLore", tag));
+ }
+ }
+ // Purpur end
+
protected void saveAdditional(CompoundTag nbt, HolderLookup.Provider registryLookup) {}
public final CompoundTag saveWithFullMetadata(HolderLookup.Provider registryLookup) {
@@ -397,4 +412,16 @@ public abstract class BlockEntity {
<T> T getOrDefault(DataComponentType<? extends T> type, T fallback);
}
+ // Purpur start
+ @Nullable
+ private net.minecraft.world.item.component.ItemLore persistentLore = null;
+
+ public void setPersistentLore(net.minecraft.world.item.component.ItemLore lore) {
+ this.persistentLore = lore;
+ }
+
+ public @org.jetbrains.annotations.Nullable net.minecraft.world.item.component.ItemLore getPersistentLore() {
+ return this.persistentLore;
+ }
+ // Purpur end
}
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 73e532dc998e5701c1a73da846da3d3a79871b81..ff6fea842ca80c2ba51693fe62e5b74f9affdc19 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/ConduitBlockEntity.java
@@ -19573,7 +19713,7 @@ index f2b20ed5063a293f0b464548f590d652170cd1d8..226ff7c6048b510be2e71ecc5d5ff358
public Collection<GeneratedStructure> getStructures(int x, int z) {
return this.getStructures(x, z, struct -> true);
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index c097f5d5fbd51cbbc01bbd54101905c59b3f3a4c..222865a3cee62f244a566092a7d814efe478ee01 100644
index c988afa496d25314451435eedd64079a0d87cef0..a0a7bfe8f5a40b945b83096de1efd650adeb9ee3 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -175,6 +175,14 @@ public class Main {
@@ -19957,7 +20097,7 @@ index 0ad16ee7b33582d214dab41eeee378d52c8e38ed..16bd1294c219f15ada653ef810bc2d74
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index eddbbd0e9be3cb81d1030c0c9da829b9193ebc16..90338017ebcb2a690dff7dad57aa6fbb95e0ff93 100644
index 0ff9bb5f5d312503ec4b3cf3bf8c532b09a8f08b..1c1159867c78a54984219a9d56a3838c630c58d8 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -565,10 +565,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -20458,7 +20598,7 @@ index 52649f82351ab4f675c3cc3cd6640956b0f76b91..eb51c88c7a0658190d3a8bfd5d18dca7
DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "seed", "Allows the user to view the seed of the world", PermissionDefault.OP, commands);
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..046304d9149472eaffb3ff5f4fa22a230969de86
index 0000000000000000000000000000000000000000..f49108ed94f7787347c5e0a721646083d6dffafc
--- /dev/null
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -0,0 +1,589 @@
@@ -20539,8 +20679,8 @@ index 0000000000000000000000000000000000000000..046304d9149472eaffb3ff5f4fa22a23
+ commands = new HashMap<>();
+ commands.put("purpur", new PurpurCommand("purpur"));
+
+ version = getInt("config-version", 34);
+ set("config-version", 34);
+ version = getInt("config-version", 35);
+ set("config-version", 35);
+
+ readConfig(PurpurConfig.class, null);
+
@@ -21053,10 +21193,10 @@ index 0000000000000000000000000000000000000000..046304d9149472eaffb3ff5f4fa22a23
+}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..8704cc621937beda692bf484cf5ef11b2d7d7e4c
index 0000000000000000000000000000000000000000..7a9a5985b1429c25467db732678d0658aafcfafa
--- /dev/null
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -0,0 +1,3289 @@
@@ -0,0 +1,3299 @@
+package org.purpurmc.purpur;
+
+import net.minecraft.core.registries.BuiltInRegistries;
@@ -21191,6 +21331,8 @@ index 0000000000000000000000000000000000000000..8704cc621937beda692bf484cf5ef11b
+ public boolean milkClearsBeneficialEffects = true;
+ public boolean noteBlockIgnoreAbove = false;
+ public boolean persistentDroppableEntityDisplayNames = true;
+ public boolean persistentTileEntityLore = false;
+ public boolean persistentTileEntityDisplayName = true;
+ public boolean projectilesBypassMobGriefing = false;
+ public boolean tickFluids = true;
+ public double mobsBlindnessMultiplier = 1;
@@ -21218,6 +21360,14 @@ index 0000000000000000000000000000000000000000..8704cc621937beda692bf484cf5ef11b
+ milkCuresBadOmen = getBoolean("gameplay-mechanics.milk-cures-bad-omen", milkCuresBadOmen);
+ milkClearsBeneficialEffects = getBoolean("gameplay-mechanics.milk-clears-beneficial-effects", milkClearsBeneficialEffects);
+ noteBlockIgnoreAbove = getBoolean("gameplay-mechanics.note-block-ignore-above", noteBlockIgnoreAbove);
+ if (PurpurConfig.version < 35) {
+ boolean oldVal = getBoolean("gameplay-mechanics.persistent-tileentity-display-names-and-lore", persistentTileEntityLore);
+ set("gameplay-mechanics.persistent-tileentity-display-names-and-lore", null);
+ set("gameplay-mechanics.persistent-tileentity-lore", oldVal);
+ set("gameplay-mechanics.persistent-tileentity-display-name", !oldVal);
+ }
+ persistentTileEntityLore = getBoolean("gameplay-mechanics.persistent-tileentity-lore", persistentTileEntityLore);
+ persistentTileEntityDisplayName = getBoolean("gameplay-mechanics.persistent-tileentity-display-name", persistentTileEntityDisplayName);
+ persistentDroppableEntityDisplayNames = getBoolean("gameplay-mechanics.persistent-droppable-entity-display-names", persistentDroppableEntityDisplayNames);
+ projectilesBypassMobGriefing = getBoolean("gameplay-mechanics.projectiles-bypass-mob-griefing", projectilesBypassMobGriefing);
+ tickFluids = getBoolean("gameplay-mechanics.tick-fluids", tickFluids);

View File

@@ -9,7 +9,7 @@ Subject: [PATCH] Optimize default configurations
- YouHaveTrouble/minecraft-exploits-and-how-to-fix-them
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index b8a89bf8a7a0ef25f00ccc0e84ca64f4524fdc3e..08a3a1ea71fb5e3702ceec518de4871840e36930 100644
index 2874bc3001c4e7d9191e47ba512c5a68369c21f1..750dd556123f3f912f8463ca3018256aaca5a2cb 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -156,7 +156,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -348,7 +348,7 @@ index b02a0dddd99df1691c125660828a61cc4a5a4d02..739bcbb7388b948982202b35a7087531
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 79456fab220fc797f0f28fc9657f3a406d751900..2a9573ea2b9b01aa78270440ccb8238dbbd221f9 100644
index 9311fcb675d20ee77d225e3cffe1d6ce56601963..f9779f8cf0399e434ebe9e49e7bae5386ce01410 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -49,6 +49,7 @@ public class PurpurConfig {
@@ -378,10 +378,10 @@ index 79456fab220fc797f0f28fc9657f3a406d751900..2a9573ea2b9b01aa78270440ccb8238d
private static void networkSettings() {
useUPnP = getBoolean("settings.network.upnp-port-forwarding", useUPnP);
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 8704cc621937beda692bf484cf5ef11b2d7d7e4c..6928d9e09e3591e457d760d81d112ae82c543b53 100644
index 7a9a5985b1429c25467db732678d0658aafcfafa..25c9a5b9b22a8680be8140f8c2dfd255dbab1bf7 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -423,7 +423,7 @@ public class PurpurWorldConfig {
@@ -433,7 +433,7 @@ public class PurpurWorldConfig {
public boolean idleTimeoutTargetPlayer = true;
public String playerDeathExpDropEquation = "expLevel * 7";
public int playerDeathExpDropMax = 100;
@@ -390,7 +390,7 @@ index 8704cc621937beda692bf484cf5ef11b2d7d7e4c..6928d9e09e3591e457d760d81d112ae8
public boolean teleportOnNetherCeilingDamage = false;
public boolean totemOfUndyingWorksInInventory = false;
public boolean playerFixStuckPortal = false;
@@ -3118,7 +3118,7 @@ public class PurpurWorldConfig {
@@ -3128,7 +3128,7 @@ public class PurpurWorldConfig {
public boolean zombieJockeyOnlyBaby = true;
public double zombieJockeyChance = 0.05D;
public boolean zombieJockeyTryExistingChickens = true;

View File

@@ -191,7 +191,7 @@ index b04f7ce0805453f6c737fa9dc11c4129ca64e934..9840678549e25c6da00aea222a585e7f
@Override
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 2a9573ea2b9b01aa78270440ccb8238dbbd221f9..545abffcd9289f135a89f1d5d05f8ebe01154594 100644
index f9779f8cf0399e434ebe9e49e7bae5386ce01410..c5cfda1a1f0bd434efcf32e253c87738eee92def 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -329,6 +329,7 @@ public class PurpurConfig {
@@ -211,10 +211,10 @@ index 2a9573ea2b9b01aa78270440ccb8238dbbd221f9..545abffcd9289f135a89f1d5d05f8ebe
org.bukkit.event.inventory.InventoryType.ENDER_CHEST.setDefaultSize(enderChestSixRows ? 54 : 27);
enderChestPermissionRows = getBoolean("settings.blocks.ender_chest.use-permissions-for-rows", enderChestPermissionRows);
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 6928d9e09e3591e457d760d81d112ae82c543b53..ecd5ba092ba7334da6dc1b97b74b33700788252a 100644
index 25c9a5b9b22a8680be8140f8c2dfd255dbab1bf7..08815190bbeb52cb7a006727aab76f59678dba81 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -1163,7 +1163,15 @@ public class PurpurWorldConfig {
@@ -1173,7 +1173,15 @@ public class PurpurWorldConfig {
public boolean allayRidable = false;
public boolean allayRidableInWater = true;
public boolean allayControllable = true;
@@ -230,7 +230,7 @@ index 6928d9e09e3591e457d760d81d112ae82c543b53..ecd5ba092ba7334da6dc1b97b74b3370
allayRidable = getBoolean("mobs.allay.ridable", allayRidable);
allayRidableInWater = getBoolean("mobs.allay.ridable-in-water", allayRidableInWater);
allayControllable = getBoolean("mobs.allay.controllable", allayControllable);
@@ -1280,7 +1288,13 @@ public class PurpurWorldConfig {
@@ -1290,7 +1298,13 @@ public class PurpurWorldConfig {
public double camelMovementSpeedMin = 0.09D;
public double camelMovementSpeedMax = 0.09D;
public int camelBreedingTicks = 6000;
@@ -244,7 +244,7 @@ index 6928d9e09e3591e457d760d81d112ae82c543b53..ecd5ba092ba7334da6dc1b97b74b3370
camelRidableInWater = getBoolean("mobs.camel.ridable-in-water", camelRidableInWater);
camelMaxHealthMin = getDouble("mobs.camel.attributes.max_health.min", camelMaxHealthMin);
camelMaxHealthMax = getDouble("mobs.camel.attributes.max_health.max", camelMaxHealthMax);
@@ -1708,7 +1722,15 @@ public class PurpurWorldConfig {
@@ -1718,7 +1732,15 @@ public class PurpurWorldConfig {
public boolean frogControllable = true;
public float frogRidableJumpHeight = 0.65F;
public int frogBreedingTicks = 6000;
@@ -260,7 +260,7 @@ index 6928d9e09e3591e457d760d81d112ae82c543b53..ecd5ba092ba7334da6dc1b97b74b3370
frogRidable = getBoolean("mobs.frog.ridable", frogRidable);
frogRidableInWater = getBoolean("mobs.frog.ridable-in-water", frogRidableInWater);
frogControllable = getBoolean("mobs.frog.controllable", frogControllable);
@@ -2659,7 +2681,13 @@ public class PurpurWorldConfig {
@@ -2669,7 +2691,13 @@ public class PurpurWorldConfig {
public boolean snifferControllable = true;
public double snifferMaxHealth = 14.0D;
public int snifferBreedingTicks = 6000;
@@ -274,7 +274,7 @@ index 6928d9e09e3591e457d760d81d112ae82c543b53..ecd5ba092ba7334da6dc1b97b74b3370
snifferRidable = getBoolean("mobs.sniffer.ridable", snifferRidable);
snifferRidableInWater = getBoolean("mobs.sniffer.ridable-in-water", snifferRidableInWater);
snifferControllable = getBoolean("mobs.sniffer.controllable", snifferControllable);
@@ -2758,7 +2786,15 @@ public class PurpurWorldConfig {
@@ -2768,7 +2796,15 @@ public class PurpurWorldConfig {
public boolean tadpoleRidable = false;
public boolean tadpoleRidableInWater = true;
public boolean tadpoleControllable = true;
@@ -290,7 +290,7 @@ index 6928d9e09e3591e457d760d81d112ae82c543b53..ecd5ba092ba7334da6dc1b97b74b3370
tadpoleRidable = getBoolean("mobs.tadpole.ridable", tadpoleRidable);
tadpoleRidableInWater = getBoolean("mobs.tadpole.ridable-in-water", tadpoleRidableInWater);
tadpoleControllable = getBoolean("mobs.tadpole.controllable", tadpoleControllable);
@@ -2974,7 +3010,15 @@ public class PurpurWorldConfig {
@@ -2984,7 +3020,15 @@ public class PurpurWorldConfig {
public boolean wardenRidable = false;
public boolean wardenRidableInWater = true;
public boolean wardenControllable = true;