9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-22 08:29:28 +00:00

Updated Upstream (Purpur)

This commit is contained in:
Dreeam
2023-08-08 19:53:19 +08:00
parent e0765e16ab
commit 7e1210f224
2 changed files with 44 additions and 27 deletions

View File

@@ -718,7 +718,7 @@ index ac9a28922f8a556944a4c3649d74c32c622f0cb0..e43d0e0a2c5edfcc82a677b6c4db9314
if (target.timings == null) {
target.timings = co.aikar.timings.TimingsManager.getCommandTiming(null, target);
diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
index fd5d9881abfd930bb883120f018f76dc78b62b14..eefba8c812a7adc012d75d97c0a31ce8ef7ddf0c 100644
index fd5d9881abfd930bb883120f018f76dc78b62b14..d3dadad49df09e85c724c93e8cc88da2c985e9b4 100644
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
@@ -214,7 +214,7 @@ public class VersionCommand extends BukkitCommand {
@@ -726,7 +726,7 @@ index fd5d9881abfd930bb883120f018f76dc78b62b14..eefba8c812a7adc012d75d97c0a31ce8
// Paper start
if (version.startsWith("null")) { // running from ide?
- setVersionMessage(Component.text("Unknown version, custom build?", NamedTextColor.YELLOW));
+ setVersionMessage(net.kyori.adventure.text.Component.text("* Unknown version, custom build?", net.kyori.adventure.text.format.NamedTextColor.RED)); // Purpur
+ setVersionMessage(Component.text("* Unknown version, custom build?", NamedTextColor.RED)); // Purpur
return;
}
setVersionMessage(getVersionFetcher().getVersionMessage(version));
@@ -739,7 +739,7 @@ index fd5d9881abfd930bb883120f018f76dc78b62b14..eefba8c812a7adc012d75d97c0a31ce8
- Component.newline(),
+ // Purpur start
+ int distance = getVersionFetcher().distance();
+ final net.kyori.adventure.text.Component message = net.kyori.adventure.text.Component.join(net.kyori.adventure.text.JoinConfiguration.separator(net.kyori.adventure.text.Component.newline()),
+ final Component message = Component.join(net.kyori.adventure.text.JoinConfiguration.separator(Component.newline()),
+ ChatColor.parseMM("<grey>Current: %s%s*", distance == 0 ? "<green>" : distance > 0 ? "<yellow>" : "<red>", Bukkit.getVersion()),
+ // Purpur end
msg

View File

@@ -4723,7 +4723,7 @@ index 0263acf81330ada1bb8ae7d52a3b04e08d0c4dcb..3cee7d5656b2df2997ceaee3489c02ce
+ // Purpur end
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
index 8448c5d778998390cf2b683f36e4e18ca7ffdc34..91e9a872b0282f50e2389ab21798fc06da8dbd6a 100644
index 8448c5d778998390cf2b683f36e4e18ca7ffdc34..4c9c07d470357c35bd5ba3c21437a2c44c52811e 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
@@ -82,19 +82,104 @@ public class Dolphin extends WaterAnimal {
@@ -4876,16 +4876,14 @@ index 8448c5d778998390cf2b683f36e4e18ca7ffdc34..91e9a872b0282f50e2389ab21798fc06
if (this.isNoAi()) {
this.setAirSupply(this.getMaxAirSupply());
} else {
@@ -405,7 +499,8 @@ public class Dolphin extends WaterAnimal {
@@ -405,6 +499,7 @@ public class Dolphin extends WaterAnimal {
@Override
public boolean canUse() {
- return this.dolphin.gotFish() && this.dolphin.getAirSupply() >= 100;
+ if (this.dolphin.level().purpurConfig.dolphinDisableTreasureSearching) return false; // Purpur
+ return this.dolphin.gotFish() && this.dolphin.getAirSupply() >= 100 && this.dolphin.level().getWorld().canGenerateStructures(); // MC-151364, SPIGOT-5494: hangs if generate-structures=false
return this.dolphin.gotFish() && this.dolphin.getAirSupply() >= 100;
}
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main/java/net/minecraft/world/entity/animal/Fox.java
index 62604ed2e82afd3603ccac5d9c6e285c431542b1..ca3096abbd54745af591101c7b306ed87f212954 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Fox.java
@@ -16320,7 +16318,7 @@ index 936d844a5a246138c9f9ae4ae6e318242b8f1420..d58dc4aa02fe371deaf879df8692dbe9
int i = 15 + worldserver.random.nextInt(15) + worldserver.random.nextInt(15);
diff --git a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
index 4bce895268542531598a01a1bccd8ac1ed703b7d..179131f4149ec5ee38d07a7a87b0536b54a337a4 100644
index 4bce895268542531598a01a1bccd8ac1ed703b7d..8333a3565e43b6b2a99b4ba92bbf296e5c89e112 100644
--- a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
@@ -48,7 +48,7 @@ public class SpongeBlock extends Block {
@@ -16328,7 +16326,7 @@ index 4bce895268542531598a01a1bccd8ac1ed703b7d..179131f4149ec5ee38d07a7a87b0536b
private boolean removeWaterBreadthFirstSearch(Level world, BlockPos pos) {
BlockStateListPopulator blockList = new BlockStateListPopulator(world); // CraftBukkit - Use BlockStateListPopulator
- BlockPos.breadthFirstTraversal(pos, 6, 65, (blockposition1, consumer) -> {
+ BlockPos.breadthFirstTraversal(pos, world.purpurConfig.spongeAbsorptionRadius, 65, (blockposition1, consumer) -> { // Purpur
+ BlockPos.breadthFirstTraversal(pos, world.purpurConfig.spongeAbsorptionRadius, world.purpurConfig.spongeAbsorptionArea, (blockposition1, consumer) -> { // Purpur
Direction[] aenumdirection = SpongeBlock.ALL_DIRECTIONS;
int i = aenumdirection.length;
@@ -18610,10 +18608,10 @@ index 2959f713ce75a1df9c6c7cf5e021690cfcb6e1e7..3fa9539cfb2c35beeba6d44fa05cee97
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..b974b59d421cf97bc9547ea75fe4643d89639bc1
index 0000000000000000000000000000000000000000..fc2d05b44cfe1db4bddb6073caeb729a6aec7034
--- /dev/null
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -0,0 +1,634 @@
@@ -0,0 +1,653 @@
+package org.purpurmc.purpur;
+
+import com.google.common.base.Throwables;
@@ -19121,6 +19119,17 @@ index 0000000000000000000000000000000000000000..b974b59d421cf97bc9547ea75fe4643d
+ config.addDefault("settings.food-properties", new HashMap<>());
+ return;
+ }
+
+ Map<MobEffect, Map<String, Object>> effectDefaults = new HashMap<>();
+ Map<String, Object> EFFECT_DEFAULT = Map.of(
+ "chance", 0.0F,
+ "duration", 0,
+ "amplifier", 0,
+ "ambient", false,
+ "visible", true,
+ "show-icon", true
+ );
+
+ properties.getKeys(false).forEach(foodKey -> {
+ FoodProperties food = Foods.ALL_PROPERTIES.get(foodKey);
+ if (food == null) {
@@ -19135,15 +19144,17 @@ index 0000000000000000000000000000000000000000..b974b59d421cf97bc9547ea75fe4643d
+ food.setFastFood(properties.getBoolean(foodKey + ".fast-food", foodDefaults.isFastFood()));
+ ConfigurationSection effects = properties.getConfigurationSection(foodKey + ".effects");
+ if (effects != null) {
+ Map<String, Object> effectDefaults = new HashMap<>();
+ effectDefaults.clear();
+ foodDefaults.getEffects().forEach(pair -> {
+ effectDefaults.put("chance", pair.getSecond());
+ MobEffectInstance effect = pair.getFirst();
+ effectDefaults.put("duration", effect.getDuration());
+ effectDefaults.put("amplifier", effect.getAmplifier());
+ effectDefaults.put("ambient", effect.isAmbient());
+ effectDefaults.put("visible", effect.isVisible());
+ effectDefaults.put("show-icon", effect.showIcon());
+ effectDefaults.put(effect.getEffect(), Map.of(
+ "chance", pair.getSecond(),
+ "duration", effect.getDuration(),
+ "amplifier", effect.getAmplifier(),
+ "ambient", effect.isAmbient(),
+ "visible", effect.isVisible(),
+ "show-icon", effect.showIcon()
+ ));
+ });
+ effects.getKeys(false).forEach(effectKey -> {
+ MobEffect effect = BuiltInRegistries.MOB_EFFECT.get(new ResourceLocation(effectKey));
@@ -19151,16 +19162,22 @@ index 0000000000000000000000000000000000000000..b974b59d421cf97bc9547ea75fe4643d
+ PurpurConfig.log(Level.SEVERE, "Invalid food property effect for " + foodKey + ": " + effectKey);
+ return;
+ }
+
+ Map<String, Object> effectDefault = effectDefaults.get(effect);
+ if (effectDefault == null) {
+ effectDefault = EFFECT_DEFAULT;
+ }
+
+ food.getEffects().removeIf(pair -> pair.getFirst().getEffect() == effect);
+ float chance = (float) effects.getDouble(effectKey + ".chance", ((Float) effectDefaults.get("chance")).doubleValue());
+ int duration = effects.getInt(effectKey + ".duration", (int) effectDefaults.get("duration"));
+ float chance = (float) effects.getDouble(effectKey + ".chance", ((Float) effectDefault.get("chance")).doubleValue());
+ int duration = effects.getInt(effectKey + ".duration", (int) effectDefault.get("duration"));
+ if (chance <= 0.0F || duration < 0) {
+ return;
+ }
+ int amplifier = effects.getInt(effectKey + ".amplifier", (int) effectDefaults.get("amplifier"));
+ boolean ambient = effects.getBoolean(effectKey + ".ambient", (boolean) effectDefaults.get("ambient"));
+ boolean visible = effects.getBoolean(effectKey + ".visible", (boolean) effectDefaults.get("visible"));
+ boolean showIcon = effects.getBoolean(effectKey + ".show-icon", (boolean) effectDefaults.get("show-icon"));
+ int amplifier = effects.getInt(effectKey + ".amplifier", (int) effectDefault.get("amplifier"));
+ boolean ambient = effects.getBoolean(effectKey + ".ambient", (boolean) effectDefault.get("ambient"));
+ boolean visible = effects.getBoolean(effectKey + ".visible", (boolean) effectDefault.get("visible"));
+ boolean showIcon = effects.getBoolean(effectKey + ".show-icon", (boolean) effectDefault.get("show-icon"));
+ food.getEffects().add(Pair.of(new MobEffectInstance(effect, duration, amplifier, ambient, visible, showIcon), chance));
+ });
+ }
@@ -19250,7 +19267,7 @@ index 0000000000000000000000000000000000000000..b974b59d421cf97bc9547ea75fe4643d
+}
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..b70b9609671ae8bc9504cef48d7531b5ad5fe65f
index 0000000000000000000000000000000000000000..f90c7ad885b3cf1246fb711dd670d143a0b324bc
--- /dev/null
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -0,0 +1,3210 @@
@@ -20297,7 +20314,7 @@ index 0000000000000000000000000000000000000000..b70b9609671ae8bc9504cef48d7531b5
+ spawnerFixMC238526 = getBoolean("blocks.spawner.fix-mc-238526", spawnerFixMC238526);
+ }
+
+ public int spongeAbsorptionArea = 64;
+ public int spongeAbsorptionArea = 65;
+ public int spongeAbsorptionRadius = 6;
+ public boolean spongeAbsorbsLava = false;
+ private void spongeSettings() {