Merge pull request #76 from Suisuroru/dev/1.21.4-hardfork-raid-fix-250419
Raid revert | MC-274911
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
|
||||||
|
Date: Sun, 13 Apr 2025 11:07:04 +0800
|
||||||
|
Subject: [PATCH] Disable Heightmap Warning
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/net/minecraft/world/level/levelgen/Heightmap.java b/net/minecraft/world/level/levelgen/Heightmap.java
|
||||||
|
index 3b27bcfbbe0529d1526adc30760c846b4011645f..95747ae41cea0d4b577c58ef44959a18e0a46672 100644
|
||||||
|
--- a/net/minecraft/world/level/levelgen/Heightmap.java
|
||||||
|
+++ b/net/minecraft/world/level/levelgen/Heightmap.java
|
||||||
|
@@ -123,7 +123,8 @@ public class Heightmap {
|
||||||
|
if (raw.length == data.length) {
|
||||||
|
System.arraycopy(data, 0, raw, 0, data.length);
|
||||||
|
} else {
|
||||||
|
- LOGGER.warn("Ignoring heightmap data for chunk " + chunk.getPos() + ", size does not match; expected: " + raw.length + ", got: " + data.length);
|
||||||
|
+ if (!me.earthme.luminol.config.modules.misc.DisableHeightmapWarnConfig.enabled)
|
||||||
|
+ LOGGER.warn("Ignoring heightmap data for chunk " + chunk.getPos() + ", size does not match; expected: " + raw.length + ", got: " + data.length);
|
||||||
|
primeHeightmaps(chunk, EnumSet.of(type));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,10 +21,83 @@ 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..84c6eb2c27510938f590f6c6baa5a94c4c08c4ad 100644
|
index 2f45befbb50645f1bfb5961ad725f3670ff0d592..4e2ec7f7946a70b676393f090c5ce6219314c3da 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
|
||||||
@@ -674,7 +674,7 @@ public class Raid {
|
@@ -109,6 +109,12 @@ public class Raid {
|
||||||
|
private static final org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry PDC_TYPE_REGISTRY = new org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry();
|
||||||
|
public final org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer(PDC_TYPE_REGISTRY);
|
||||||
|
// Paper end
|
||||||
|
+ // Luminol Start - Raid revert
|
||||||
|
+ private boolean flagForceWin = false;
|
||||||
|
+ private boolean flag274911 = false;
|
||||||
|
+ private int freshTick = 0;
|
||||||
|
+ private int retryTimes = 0;
|
||||||
|
+ // Luminol End - Raid revert
|
||||||
|
|
||||||
|
// Folia start - make raids thread-safe
|
||||||
|
public boolean ownsRaid() {
|
||||||
|
@@ -270,7 +276,36 @@ public class Raid {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void tick() {
|
||||||
|
- if (!this.isStopped()) {
|
||||||
|
+ // Luminol Start - Raid revert
|
||||||
|
+ if (this.flag274911) {
|
||||||
|
+ if (this.freshTick == 20) {
|
||||||
|
+ if (this.waveSpawnPos.isPresent() && !this.level.isPositionEntityTicking(this.waveSpawnPos.get())) {
|
||||||
|
+ this.waveSpawnPos = this.getValidSpawnPos();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ BlockPos blockPos = this.waveSpawnPos.orElseGet(() -> this.findRandomSpawnPos(20));
|
||||||
|
+ if (blockPos != null && retryTimes < 3) {
|
||||||
|
+ this.started = true;
|
||||||
|
+ this.spawnGroup(blockPos);
|
||||||
|
+ this.retryTimes = 0;
|
||||||
|
+ } else if (retryTimes == 3) {
|
||||||
|
+ this.waveSpawnPos = Optional.empty();
|
||||||
|
+ this.groupsSpawned++;
|
||||||
|
+ this.retryTimes = 0;
|
||||||
|
+ } else {
|
||||||
|
+ this.retryTimes++;
|
||||||
|
+ }
|
||||||
|
+ if (!this.hasMoreWaves()) {
|
||||||
|
+ this.flag274911 = false;
|
||||||
|
+ this.flagForceWin = true;
|
||||||
|
+ }
|
||||||
|
+ this.freshTick = 0;
|
||||||
|
+ } else {
|
||||||
|
+ this.freshTick++;
|
||||||
|
+ }
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ if (!this.isStopped() || this.flagForceWin) { // Luminol End - Raid revert
|
||||||
|
if (this.status == Raid.RaidStatus.ONGOING) {
|
||||||
|
boolean flag = this.active;
|
||||||
|
this.active = this.level.hasChunkAt(this.center);
|
||||||
|
@@ -288,6 +323,12 @@ public class Raid {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Luminol Start - Raid revert
|
||||||
|
+ if (me.earthme.luminol.config.modules.misc.RaidChangesConfig.revert_274911 && this.waveSpawnPos.isPresent() && this.center.distSqr(this.waveSpawnPos.get()) >= 12544) {
|
||||||
|
+ this.flag274911 = true;
|
||||||
|
+ }
|
||||||
|
+ // Luminol End - Raid revert
|
||||||
|
+
|
||||||
|
if (!this.level.isVillage(this.center)) {
|
||||||
|
this.moveRaidCenterToNearbyVillageSection();
|
||||||
|
}
|
||||||
|
@@ -379,7 +420,7 @@ public class Raid {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (this.isStarted() && !this.hasMoreWaves() && totalRaidersAlive == 0) {
|
||||||
|
+ if (this.flagForceWin || (this.isStarted() && !this.hasMoreWaves() && totalRaidersAlive == 0)) { // Luminol - Raid revert
|
||||||
|
if (this.postRaidTicks < 40) {
|
||||||
|
this.postRaidTicks++;
|
||||||
|
} else {
|
||||||
|
@@ -674,7 +715,7 @@ public class Raid {
|
||||||
int i2 = this.center.getX() + Mth.floor(Mth.cos(f2) * 32.0F * f) + this.level.random.nextInt(3) * Mth.floor(f);
|
int i2 = this.center.getX() + Mth.floor(Mth.cos(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 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);
|
||||||
@@ -34,7 +107,7 @@ index 2f45befbb50645f1bfb5961ad725f3670ff0d592..84c6eb2c27510938f590f6c6baa5a94c
|
|||||||
if (!this.level.isVillage(mutableBlockPos) || i <= 7) {
|
if (!this.level.isVillage(mutableBlockPos) || i <= 7) {
|
||||||
int i4 = 10;
|
int i4 = 10;
|
||||||
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..a0d86c3cc86da734a3cd10d554aaecb5c0b82e59 100644
|
index 7c385baae81b9a987c0e1e4deb017884600331bc..262291eaeb9bc250affeda67957588d14ec1eebc 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 {
|
||||||
@@ -81,6 +154,15 @@ index 7c385baae81b9a987c0e1e4deb017884600331bc..a0d86c3cc86da734a3cd10d554aaecb5
|
|||||||
}
|
}
|
||||||
|
|
||||||
super.die(cause);
|
super.die(cause);
|
||||||
|
@@ -153,7 +190,7 @@ public abstract class Raider extends PatrollingMonster {
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasRaid() {
|
||||||
|
- 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
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasActiveRaid() {
|
||||||
diff --git a/net/minecraft/world/item/component/OminousBottleAmplifier.java b/net/minecraft/world/item/component/OminousBottleAmplifier.java
|
diff --git a/net/minecraft/world/item/component/OminousBottleAmplifier.java b/net/minecraft/world/item/component/OminousBottleAmplifier.java
|
||||||
index 318f24d67be4daf6993ba547da0540be9c221a75..9a6820fce3977419fd81d802720c318ac15d07c4 100644
|
index 318f24d67be4daf6993ba547da0540be9c221a75..9a6820fce3977419fd81d802720c318ac15d07c4 100644
|
||||||
--- a/net/minecraft/world/item/component/OminousBottleAmplifier.java
|
--- a/net/minecraft/world/item/component/OminousBottleAmplifier.java
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/DisableHeightmapWarnConfig.java
|
||||||
|
@@ -1,0 +_,22 @@
|
||||||
|
+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 DisableHeightmapWarnConfig implements IConfigModule {
|
||||||
|
+ @ConfigInfo(baseName = "enabled", comments =
|
||||||
|
+ """
|
||||||
|
+ Disable heightmap-check's warning""")
|
||||||
|
+ public static boolean enabled = false;
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public EnumConfigCategory getCategory() {
|
||||||
|
+ return EnumConfigCategory.MISC;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public String getBaseName() {
|
||||||
|
+ return "heightmap_warn_disable";
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/RaidChangesConfig.java
|
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/RaidChangesConfig.java
|
||||||
@@ -1,0 +_,41 @@
|
@@ -1,0 +_,52 @@
|
||||||
+package me.earthme.luminol.config.modules.misc;
|
+package me.earthme.luminol.config.modules.misc;
|
||||||
+
|
+
|
||||||
+import me.earthme.luminol.config.ConfigInfo;
|
+import me.earthme.luminol.config.ConfigInfo;
|
||||||
@@ -10,28 +10,39 @@
|
|||||||
+public class RaidChangesConfig implements IConfigModule {
|
+public class RaidChangesConfig implements IConfigModule {
|
||||||
+ @ConfigInfo(baseName = "allow-bad-omen-trigger-raid", comments =
|
+ @ConfigInfo(baseName = "allow-bad-omen-trigger-raid", comments =
|
||||||
+ """
|
+ """
|
||||||
+ Allow players with ominous signs to\s
|
+ Allow players with ominous signs to skip a\s
|
||||||
+ skip a 30-second cooldown and trigger\s
|
+ 30-second cooldown and trigger attacks directly""")
|
||||||
+ attacks directly""")
|
|
||||||
+ public static boolean trigger = false;
|
+ public static boolean trigger = false;
|
||||||
+
|
+
|
||||||
+ @ConfigInfo(baseName = "give-bad-omen-when-kill-patrol-leader", comments =
|
+ @ConfigInfo(baseName = "give-bad-omen-when-kill-patrol-leader", comments =
|
||||||
+ """
|
+ """
|
||||||
+ Enable players to obtain an ominous\s
|
+ Enable players to obtain an ominous omen\s
|
||||||
+ omen effect when killing the patrol\s
|
+ effect when killing the patrol team captain""")
|
||||||
+ team captain""")
|
|
||||||
+ public static boolean effect = false;
|
+ public static boolean effect = false;
|
||||||
+
|
+
|
||||||
+ @ConfigInfo(baseName = "bad-omen-infinite", comments =
|
+ @ConfigInfo(baseName = "bad-omen-infinite", comments =
|
||||||
+ """
|
+ """
|
||||||
+ Enable bad omen effect infinite time.""")
|
+ Enable bad omen effect infinite time
|
||||||
|
+ --- this config is not old version's function""")
|
||||||
+ public static boolean infinite = false;
|
+ public static boolean infinite = false;
|
||||||
+
|
+
|
||||||
+ @ConfigInfo(baseName = "skip-height-check", comments =
|
+ @ConfigInfo(baseName = "skip-height-check", comments =
|
||||||
+ """
|
+ """
|
||||||
+ disable y <= 96 check.""")
|
+ Disable y <= 96 check""")
|
||||||
+ public static boolean height_check = false;
|
+ public static boolean height_check = false;
|
||||||
+
|
+
|
||||||
|
+ @ConfigInfo(baseName = "skip-self-raid-check", comments =
|
||||||
|
+ """
|
||||||
|
+ Disable raid self check\s
|
||||||
|
+ --- this config is not old version's function""")
|
||||||
|
+ public static boolean self_check = false;
|
||||||
|
+
|
||||||
|
+ @ConfigInfo(baseName = "revert-274911", comments =
|
||||||
|
+ """
|
||||||
|
+ Revert MC-274911(hard-revert)
|
||||||
|
+ --- maybe have some bugs""")
|
||||||
|
+ public static boolean revert_274911 = false;
|
||||||
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public EnumConfigCategory getCategory() {
|
+ public EnumConfigCategory getCategory() {
|
||||||
+ return EnumConfigCategory.MISC;
|
+ return EnumConfigCategory.MISC;
|
||||||
|
|||||||
Reference in New Issue
Block a user