Merge branch 'dev/1.21.4-hardfork' of https://github.com/LuminolMC/Luminol into dev/1.21.4-hardfork

This commit is contained in:
Bacteriawa
2025-05-23 23:00:16 +08:00
60 changed files with 80 additions and 27 deletions

View File

@@ -0,0 +1,27 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Wed, 21 May 2025 13:04:00 +0800
Subject: [PATCH] Add config to disable end crystal check
diff --git a/net/minecraft/world/level/dimension/end/EndDragonFight.java b/net/minecraft/world/level/dimension/end/EndDragonFight.java
index 2e156694b337760be986fdf1cbf863b0d896ef2d..b55ac3c0d19cf9117368c17687fa34099bfe3533 100644
--- a/net/minecraft/world/level/dimension/end/EndDragonFight.java
+++ b/net/minecraft/world/level/dimension/end/EndDragonFight.java
@@ -546,6 +546,8 @@ public class EndDragonFight {
blockPos = this.portalLocation;
}
+ // Luminol start - Disable end crystal check
+ if (!me.earthme.luminol.config.modules.misc.DisableEndCrystalCheckConfig.disableEndCrystalCheck) {
// Paper start - Perf: Do crystal-portal proximity check before entity lookup
if (placedEndCrystalPos != null) {
// The end crystal must be 0 or 1 higher than the portal origin
@@ -561,6 +563,7 @@ public class EndDragonFight {
}
}
// Paper end - Perf: Do crystal-portal proximity check before entity lookup
+ } // Luminol end - Disable end crystal check
List<EndCrystal> list = Lists.newArrayList();

View File

@@ -31,7 +31,7 @@ index 9aace993c6c18f1a50610e4766225485984b8167..419c1c7e14691a472b70ed548ecb928c
} }
} }
diff --git a/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java b/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java diff --git a/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java b/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
index f96fc1391167dea48cac1caa464b9026657df89a..ba2da205b046d7d3aab8fb21e116f9be73b13eb3 100644 index f96fc1391167dea48cac1caa464b9026657df89a..29b286386546db9d809f1b1b5c98571d3058a0f5 100644
--- a/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java --- a/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
+++ b/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java +++ b/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
@@ -27,6 +27,11 @@ public class EndPlatformFeature extends Feature<NoneFeatureConfiguration> { @@ -27,6 +27,11 @@ public class EndPlatformFeature extends Feature<NoneFeatureConfiguration> {
@@ -84,7 +84,7 @@ index f96fc1391167dea48cac1caa464b9026657df89a..ba2da205b046d7d3aab8fb21e116f9be
- // SPIGOT-7856: End platform not dropping items after replacing blocks - // SPIGOT-7856: End platform not dropping items after replacing blocks
- if (dropBlocks) { - if (dropBlocks) {
- blockList.getList().forEach((state) -> level.destroyBlock(state.getPosition(), true, null)); - blockList.getList().forEach((state) -> level.destroyBlock(state.getPosition(), true, null));
+ if (flag21 && !me.earthme.luminol.config.modules.misc.AllowTripwireDupe.enabled) { + if (flag21 || !me.earthme.luminol.config.modules.misc.AllowTripwireDupe.enabled) {
+ // Luminol start - When updated replace it with newer code + // Luminol start - When updated replace it with newer code
+ if (dropBlocks) { + if (dropBlocks) {
+ java.util.function.Consumer<? super org.bukkit.craftbukkit.block.CraftBlockState> beforeRun = state -> level.destroyBlock(state.getPosition(), !blockList1.contains(state.getPosition()), null); + java.util.function.Consumer<? super org.bukkit.craftbukkit.block.CraftBlockState> beforeRun = state -> level.destroyBlock(state.getPosition(), !blockList1.contains(state.getPosition()), null);

View File

@@ -21,7 +21,7 @@ index 80f17f33f670018240c854df589cf90cdeab6e70..8672757a4d5fb5c247599782fece6b8d
if (raidAt == null || raidAt.getRaidOmenLevel() < raidAt.getMaxRaidOmenLevel()) { if (raidAt == null || raidAt.getRaidOmenLevel() < raidAt.getMaxRaidOmenLevel()) {
serverPlayer.addEffect(new MobEffectInstance(MobEffects.RAID_OMEN, 600, amplifier)); serverPlayer.addEffect(new MobEffectInstance(MobEffects.RAID_OMEN, 600, amplifier));
diff --git a/net/minecraft/world/entity/raid/Raid.java b/net/minecraft/world/entity/raid/Raid.java diff --git a/net/minecraft/world/entity/raid/Raid.java b/net/minecraft/world/entity/raid/Raid.java
index 2f45befbb50645f1bfb5961ad725f3670ff0d592..0d91ae860a5c506c634e88341d958618996cc5bc 100644 index 2f45befbb50645f1bfb5961ad725f3670ff0d592..190b9f46029ba0a0d69f68db2c56301f4ea21c94 100644
--- a/net/minecraft/world/entity/raid/Raid.java --- a/net/minecraft/world/entity/raid/Raid.java
+++ b/net/minecraft/world/entity/raid/Raid.java +++ b/net/minecraft/world/entity/raid/Raid.java
@@ -325,7 +325,20 @@ public class Raid { @@ -325,7 +325,20 @@ public class Raid {
@@ -30,7 +30,7 @@ index 2f45befbb50645f1bfb5961ad725f3670ff0d592..0d91ae860a5c506c634e88341d958618
if (flag1) { if (flag1) {
- this.waveSpawnPos = this.getValidSpawnPos(); - this.waveSpawnPos = this.getValidSpawnPos();
+ // Luminol Start - Raid revert + // Luminol Start - Raid revert
+ if (!me.earthme.luminol.config.modules.misc.RaidChangesConfig.pos_revert) { + if (!me.earthme.luminol.config.modules.misc.RaidChangesConfig.posRevert) {
+ this.waveSpawnPos = this.getValidSpawnPos(); + this.waveSpawnPos = this.getValidSpawnPos();
+ } else { + } else {
+ int n4 = 0; + int n4 = 0;
@@ -53,7 +53,7 @@ index 2f45befbb50645f1bfb5961ad725f3670ff0d592..0d91ae860a5c506c634e88341d958618
- BlockPos blockPos = this.waveSpawnPos.orElseGet(() -> this.findRandomSpawnPos(20)); - BlockPos blockPos = this.waveSpawnPos.orElseGet(() -> this.findRandomSpawnPos(20));
+ // Luminol Start - Raid revert + // Luminol Start - Raid revert
+ BlockPos blockPos; + BlockPos blockPos;
+ if (!me.earthme.luminol.config.modules.misc.RaidChangesConfig.pos_revert) { + if (!me.earthme.luminol.config.modules.misc.RaidChangesConfig.posRevert) {
+ blockPos = this.waveSpawnPos.orElseGet(() -> this.findRandomSpawnPos(20)); + blockPos = this.waveSpawnPos.orElseGet(() -> this.findRandomSpawnPos(20));
+ } else { + } else {
+ blockPos = this.waveSpawnPos.isPresent() ? this.waveSpawnPos.get() : this.findRandomSpawnPos(i, 20); + blockPos = this.waveSpawnPos.isPresent() ? this.waveSpawnPos.get() : this.findRandomSpawnPos(i, 20);
@@ -67,7 +67,7 @@ index 2f45befbb50645f1bfb5961ad725f3670ff0d592..0d91ae860a5c506c634e88341d958618
} }
- if (i > 5) { - if (i > 5) {
+ if (i > (me.earthme.luminol.config.modules.misc.RaidChangesConfig.pos_revert ? 3 : 5)) { // Luminol - Raid revert + if (i > (me.earthme.luminol.config.modules.misc.RaidChangesConfig.posRevert ? 3 : 5)) { // Luminol - Raid revert
org.bukkit.craftbukkit.event.CraftEventFactory.callRaidStopEvent(this, org.bukkit.event.raid.RaidStopEvent.Reason.UNSPAWNABLE); // CraftBukkit org.bukkit.craftbukkit.event.CraftEventFactory.callRaidStopEvent(this, org.bukkit.event.raid.RaidStopEvent.Reason.UNSPAWNABLE); // CraftBukkit
this.stop(); this.stop();
break; break;
@@ -94,7 +94,7 @@ index 2f45befbb50645f1bfb5961ad725f3670ff0d592..0d91ae860a5c506c634e88341d958618
int i3 = this.center.getZ() + Mth.floor(Mth.sin(f2) * 32.0F * f) + this.level.random.nextInt(3) * Mth.floor(f); int i3 = this.center.getZ() + Mth.floor(Mth.sin(f2) * 32.0F * f) + this.level.random.nextInt(3) * Mth.floor(f);
int height = this.level.getHeight(Heightmap.Types.WORLD_SURFACE, i2, i3); int height = this.level.getHeight(Heightmap.Types.WORLD_SURFACE, i2, i3);
- if (Mth.abs(height - this.center.getY()) <= 96) { - if (Mth.abs(height - this.center.getY()) <= 96) {
+ if (me.earthme.luminol.config.modules.misc.RaidChangesConfig.height_check || Mth.abs(height - this.center.getY()) <= 96) { // Leaves - Disable height check + if (me.earthme.luminol.config.modules.misc.RaidChangesConfig.heightCheck || Mth.abs(height - this.center.getY()) <= 96) { // Leaves - Disable height check
mutableBlockPos.set(i2, height, i3); mutableBlockPos.set(i2, height, i3);
if (!this.level.isVillage(mutableBlockPos) || i <= 7) { if (!this.level.isVillage(mutableBlockPos) || i <= 7) {
int i4 = 10; int i4 = 10;
@@ -126,7 +126,7 @@ index 2f45befbb50645f1bfb5961ad725f3670ff0d592..0d91ae860a5c506c634e88341d958618
return this.addWaveMob(wave, raider, true); return this.addWaveMob(wave, raider, true);
} }
diff --git a/net/minecraft/world/entity/raid/Raider.java b/net/minecraft/world/entity/raid/Raider.java diff --git a/net/minecraft/world/entity/raid/Raider.java b/net/minecraft/world/entity/raid/Raider.java
index 7c385baae81b9a987c0e1e4deb017884600331bc..75a8e0602c249df4b587a454e35f4cd7eab2a25c 100644 index 7c385baae81b9a987c0e1e4deb017884600331bc..075563d83fadd85191117685fa3b97a9fad14488 100644
--- a/net/minecraft/world/entity/raid/Raider.java --- a/net/minecraft/world/entity/raid/Raider.java
+++ b/net/minecraft/world/entity/raid/Raider.java +++ b/net/minecraft/world/entity/raid/Raider.java
@@ -125,6 +125,43 @@ public abstract class Raider extends PatrollingMonster { @@ -125,6 +125,43 @@ public abstract class Raider extends PatrollingMonster {
@@ -178,7 +178,7 @@ index 7c385baae81b9a987c0e1e4deb017884600331bc..75a8e0602c249df4b587a454e35f4cd7
public boolean hasRaid() { public boolean hasRaid() {
- return this.level() instanceof ServerLevel serverLevel && (this.getCurrentRaid() != null || serverLevel.getRaidAt(this.blockPosition()) != null); - return this.level() instanceof ServerLevel serverLevel && (this.getCurrentRaid() != null || serverLevel.getRaidAt(this.blockPosition()) != null);
+ return !me.earthme.luminol.config.modules.misc.RaidChangesConfig.self_check && (this.level() instanceof ServerLevel serverLevel && (this.getCurrentRaid() != null || serverLevel.getRaidAt(this.blockPosition()) != null)); // Leaves - Disable raid self check + return !me.earthme.luminol.config.modules.misc.RaidChangesConfig.selfCheck && (this.level() instanceof ServerLevel serverLevel && (this.getCurrentRaid() != null || serverLevel.getRaidAt(this.blockPosition()) != null)); // Leaves - Disable raid self check
} }
public boolean hasActiveRaid() { public boolean hasActiveRaid() {

View File

@@ -1,9 +1,9 @@
--- /dev/null --- /dev/null
+++ b/src/main/java/me/earthme/luminol/config/DefaultTransferLogic.java +++ b/src/main/java/me/earthme/luminol/config/DefaultTransformLogic.java
@@ -1,0 +_,7 @@ @@ -1,0 +_,7 @@
+package me.earthme.luminol.config; +package me.earthme.luminol.config;
+ +
+public class DefaultTransferLogic { +public class DefaultTransformLogic {
+ public Object transform(Object obj) { + public Object transform(Object obj) {
+ return obj; + return obj;
+ } + }

View File

@@ -131,24 +131,24 @@
+ boolean removed = fullConfigKeyName.equals("removed.removed_config.removed"); + boolean removed = fullConfigKeyName.equals("removed.removed_config.removed");
+ +
+ if (!configFileInstance.contains(fullConfigKeyName) || removed) { + if (!configFileInstance.contains(fullConfigKeyName) || removed) {
+ for (TransferringConfig transferringConfig : field.getAnnotationsByType(TransferringConfig.class)) { + for (TransformedConfig transformedConfig : field.getAnnotationsByType(TransformedConfig.class)) {
+ final String oldConfigKeyName = String.join(".", transferringConfig.category()) + "." + transferringConfig.name(); + final String oldConfigKeyName = String.join(".", transformedConfig.category()) + "." + transformedConfig.name();
+ Object oldValue = configFileInstance.get(oldConfigKeyName); + Object oldValue = configFileInstance.get(oldConfigKeyName);
+ if (oldValue != null) { + if (oldValue != null) {
+ boolean success = true; + boolean success = true;
+ if (transferringConfig.transfer() && !removed) { + if (transformedConfig.transform() && !removed) {
+ try { + try {
+ for (Class<? extends DefaultTransferLogic> logic : transferringConfig.transferLogic()) { + for (Class<? extends DefaultTransformLogic> logic : transformedConfig.transformLogic()) {
+ oldValue = logic.getDeclaredConstructor().newInstance().transform(oldValue); + oldValue = logic.getDeclaredConstructor().newInstance().transform(oldValue);
+ } + }
+ configFileInstance.add(fullConfigKeyName, oldValue); + configFileInstance.add(fullConfigKeyName, oldValue);
+ } catch (Exception e) { + } catch (Exception e) {
+ success = false; + success = false;
+ logger.error("Failed to transfer removed config {}!", transferringConfig.name()); + logger.error("Failed to transform removed config {}!", transformedConfig.name());
+ } + }
+ } + }
+ +
+ if (success) removeConfig(oldConfigKeyName, transferringConfig.category()); + if (success) removeConfig(oldConfigKeyName, transformedConfig.category());
+ final String comments = configInfo.comments(); + final String comments = configInfo.comments();
+ +
+ if (!comments.isBlank()) configFileInstance.setComment(fullConfigKeyName, comments); + if (!comments.isBlank()) configFileInstance.setComment(fullConfigKeyName, comments);

View File

@@ -1,5 +1,5 @@
--- /dev/null --- /dev/null
+++ b/src/main/java/me/earthme/luminol/config/TransferringConfig.java +++ b/src/main/java/me/earthme/luminol/config/TransformedConfig.java
@@ -1,0 +_,22 @@ @@ -1,0 +_,22 @@
+package me.earthme.luminol.config; +package me.earthme.luminol.config;
+ +
@@ -8,18 +8,18 @@
+import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.RetentionPolicy;
+ +
+@Retention(RetentionPolicy.RUNTIME) +@Retention(RetentionPolicy.RUNTIME)
+@Repeatable(TransferringConfig.List.class) +@Repeatable(TransformedConfig.List.class)
+public @interface TransferringConfig { +public @interface TransformedConfig {
+ String name() default ""; + String name() default "";
+ +
+ String[] category() default ""; + String[] category() default "";
+ +
+ boolean transfer() default true; + boolean transform() default true;
+ +
+ Class<? extends DefaultTransferLogic>[] transferLogic() default {DefaultTransferLogic.class}; + Class<? extends DefaultTransformLogic>[] transformLogic() default {DefaultTransformLogic.class};
+ +
+ @Retention(RetentionPolicy.RUNTIME) + @Retention(RetentionPolicy.RUNTIME)
+ @interface List { + @interface List {
+ TransferringConfig[] value(); + TransformedConfig[] value();
+ } + }
+} +}

View File

@@ -0,0 +1,26 @@
--- /dev/null
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/DisableEndCrystalCheckConfig.java
@@ -1,0 +_,23 @@
+package me.earthme.luminol.config.modules.misc;
+
+import me.earthme.luminol.config.ConfigInfo;
+import me.earthme.luminol.config.EnumConfigCategory;
+import me.earthme.luminol.config.IConfigModule;
+
+public class DisableEndCrystalCheckConfig implements IConfigModule {
+ @ConfigInfo(baseName = "disable_end_crystal_check", comments =
+ """
+ Disable paper's End Crystal position check.
+ It reverts to vanilla respawn dragon logic.""")
+ public static boolean disableEndCrystalCheck = false;
+
+ @Override
+ public EnumConfigCategory getCategory() {
+ return EnumConfigCategory.MISC;
+ }
+
+ @Override
+ public String getBaseName() {
+ return "end_crystal";
+ }
+}

View File

@@ -31,19 +31,19 @@
+ Disable y <= 96 check. + Disable y <= 96 check.
+ If you enabled revert_274911, this config will useless + If you enabled revert_274911, this config will useless
+ and always behavior of enabled""") + and always behavior of enabled""")
+ public static boolean height_check = false; + public static boolean heightCheck = false;
+ +
+ @ConfigInfo(baseName = "skip-self-raid-check", comments = + @ConfigInfo(baseName = "skip-self-raid-check", comments =
+ """ + """
+ Disable raid self check\s + Disable raid self check\s
+ --- this config is not old version's function""") + --- this config is not old version's function""")
+ public static boolean self_check = false; + public static boolean selfCheck = false;
+ +
+ @ConfigInfo(baseName = "revert-274911", comments = + @ConfigInfo(baseName = "revert-274911", comments =
+ """ + """
+ Revert Old raid's find spawn position logic + Revert Old raid's find spawn position logic
+ --- This revert MC-274911""") + --- This revert MC-274911""")
+ public static boolean pos_revert = false; + public static boolean posRevert = false;
+ +
+ @Override + @Override
+ public EnumConfigCategory getCategory() { + public EnumConfigCategory getCategory() {

View File

@@ -6,7 +6,7 @@
+import me.earthme.luminol.config.*; +import me.earthme.luminol.config.*;
+ +
+public class RemovedConfig implements IConfigModule { +public class RemovedConfig implements IConfigModule {
+ @TransferringConfig(name = "example", category = {"removed", "example"}, transfer = false) + @TransformedConfig(name = "example", category = {"removed", "example"}, transform = false)
+ @DoNotLoad + @DoNotLoad
+ @ConfigInfo(baseName = "removed", comments = + @ConfigInfo(baseName = "removed", comments =
+ """ + """