mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
@@ -6,7 +6,7 @@ Subject: [PATCH] Stackable ShulkerBoxes
|
|||||||
This patch is Powered by fabric-carpet(https://github.com/gnembon/fabric-carpet) and plusls-carpet-addition(https://github.com/plusls/plusls-carpet-addition)
|
This patch is Powered by fabric-carpet(https://github.com/gnembon/fabric-carpet) and plusls-carpet-addition(https://github.com/plusls/plusls-carpet-addition)
|
||||||
|
|
||||||
diff --git a/net/minecraft/commands/arguments/item/ItemInput.java b/net/minecraft/commands/arguments/item/ItemInput.java
|
diff --git a/net/minecraft/commands/arguments/item/ItemInput.java b/net/minecraft/commands/arguments/item/ItemInput.java
|
||||||
index 643797124fe5a4489d0b7419b7e600c04f283ef2..44c10be00cc4265ea6688f9a1093ee7c9f6f50f1 100644
|
index 643797124fe5a4489d0b7419b7e600c04f283ef2..51971a4ef18ab048dc576c26652982d57e440dc0 100644
|
||||||
--- a/net/minecraft/commands/arguments/item/ItemInput.java
|
--- a/net/minecraft/commands/arguments/item/ItemInput.java
|
||||||
+++ b/net/minecraft/commands/arguments/item/ItemInput.java
|
+++ b/net/minecraft/commands/arguments/item/ItemInput.java
|
||||||
@@ -39,11 +39,13 @@ public class ItemInput {
|
@@ -39,11 +39,13 @@ public class ItemInput {
|
||||||
|
|||||||
@@ -20,6 +20,93 @@ index 80f17f33f670018240c854df589cf90cdeab6e70..4c6ce6a4a730033802651b0c0052fc46
|
|||||||
Raid raidAt = level.getRaidAt(serverPlayer.blockPosition());
|
Raid raidAt = level.getRaidAt(serverPlayer.blockPosition());
|
||||||
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
|
||||||
|
index 41b0db439b425b052bd1469daa6620a435ca852b..4e2b73ad91b4fc12da123b22910a7e3a78b23d1d 100644
|
||||||
|
--- a/net/minecraft/world/entity/raid/Raid.java
|
||||||
|
+++ b/net/minecraft/world/entity/raid/Raid.java
|
||||||
|
@@ -318,7 +318,20 @@ public class Raid {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flag1) {
|
||||||
|
- this.waveSpawnPos = this.getValidSpawnPos();
|
||||||
|
+ // Leaves Start - old FindSpawnPosition
|
||||||
|
+ if (!org.leavesmc.leaves.LeavesConfig.modify.oldMC.raid.useOldFindSpawnPosition) {
|
||||||
|
+ this.waveSpawnPos = this.getValidSpawnPos();
|
||||||
|
+ } else {
|
||||||
|
+ int n4 = 0;
|
||||||
|
+ if (this.raidCooldownTicks < 100) {
|
||||||
|
+ n4 = 1;
|
||||||
|
+ }
|
||||||
|
+ if (this.raidCooldownTicks < 40) {
|
||||||
|
+ n4 = 2;
|
||||||
|
+ }
|
||||||
|
+ this.waveSpawnPos = this.getValidSpawnPos(n4);
|
||||||
|
+ }
|
||||||
|
+ // Leaves End - old FindSpawnPosition
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.raidCooldownTicks == 300 || this.raidCooldownTicks % 20 == 0) {
|
||||||
|
@@ -353,7 +366,14 @@ public class Raid {
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
while (this.shouldSpawnGroup()) {
|
||||||
|
- BlockPos blockPos = this.waveSpawnPos.orElseGet(() -> this.findRandomSpawnPos(20));
|
||||||
|
+ // Leaves Start - old FindSpawnPosition
|
||||||
|
+ BlockPos blockPos;
|
||||||
|
+ if (!org.leavesmc.leaves.LeavesConfig.modify.oldMC.raid.useOldFindSpawnPosition) {
|
||||||
|
+ blockPos = this.waveSpawnPos.orElseGet(() -> this.findRandomSpawnPos(20));
|
||||||
|
+ } else {
|
||||||
|
+ blockPos = this.waveSpawnPos.isPresent() ? this.waveSpawnPos.get() : this.findRandomSpawnPos(i, 20);
|
||||||
|
+ }
|
||||||
|
+ // Leaves End - old FindSpawnPosition
|
||||||
|
if (blockPos != null) {
|
||||||
|
this.started = true;
|
||||||
|
this.spawnGroup(blockPos);
|
||||||
|
@@ -365,7 +385,7 @@ public class Raid {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (i > 5) {
|
||||||
|
+ if (i > (org.leavesmc.leaves.LeavesConfig.modify.oldMC.raid.useOldFindSpawnPosition ? 3 : 5)) { // Leaves - old FindSpawnPosition
|
||||||
|
org.bukkit.craftbukkit.event.CraftEventFactory.callRaidStopEvent(this, org.bukkit.event.raid.RaidStopEvent.Reason.UNSPAWNABLE); // CraftBukkit
|
||||||
|
this.stop();
|
||||||
|
break;
|
||||||
|
@@ -680,6 +700,35 @@ public class Raid {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Leaves Start - old FindSpawnPosition
|
||||||
|
+ @Nullable
|
||||||
|
+ private BlockPos findRandomSpawnPos(int n, int n2) {
|
||||||
|
+ int n3 = 2 - n;
|
||||||
|
+ BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
|
||||||
|
+ SpawnPlacementType spawnPlacementType = SpawnPlacements.getPlacementType(EntityType.RAVAGER);
|
||||||
|
+ for (int i = 0; i < n2; ++i) {
|
||||||
|
+ float f = this.level.random.nextFloat() * ((float)Math.PI * 2);
|
||||||
|
+ int n4 = this.center.getX() + Mth.floor(Mth.cos(f) * 32.0f * (float)n3) + this.level.random.nextInt(5);
|
||||||
|
+ int n5 = this.center.getZ() + Mth.floor(Mth.sin(f) * 32.0f * (float)n3) + this.level.random.nextInt(5);
|
||||||
|
+ int n6 = this.level.getHeight(Heightmap.Types.WORLD_SURFACE, n4, n5);
|
||||||
|
+ mutableBlockPos.set(n4, n6, n5);
|
||||||
|
+ if (this.level.isVillage(mutableBlockPos) && n < 2) continue;
|
||||||
|
+ if (!this.level.hasChunksAt(mutableBlockPos.getX() - 10, mutableBlockPos.getZ() - 10, mutableBlockPos.getX() + 10, mutableBlockPos.getZ() + 10) || !this.level.isPositionEntityTicking(mutableBlockPos) || !spawnPlacementType.isSpawnPositionOk(this.level, mutableBlockPos, EntityType.RAVAGER) && (!this.level.getBlockState((BlockPos)mutableBlockPos.below()).is(Blocks.SNOW) || !this.level.getBlockState(mutableBlockPos).isAir())) continue;
|
||||||
|
+ return mutableBlockPos;
|
||||||
|
+ }
|
||||||
|
+ return null;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private Optional<BlockPos> getValidSpawnPos(int n) {
|
||||||
|
+ for (int i = 0; i < 3; ++i) {
|
||||||
|
+ BlockPos blockPos = this.findRandomSpawnPos(n, 1);
|
||||||
|
+ if (blockPos == null) continue;
|
||||||
|
+ return Optional.of(blockPos);
|
||||||
|
+ }
|
||||||
|
+ return Optional.empty();
|
||||||
|
+ }
|
||||||
|
+ // Leaves End - old FindSpawnPosition
|
||||||
|
+
|
||||||
|
private boolean addWaveMob(int wave, Raider raider) {
|
||||||
|
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 f58a20e7dd6b8dc3fc431d4aba9f91a7c25f2c33..ce692698260d4751b13d5b26f7d9403c72b413c6 100644
|
index f58a20e7dd6b8dc3fc431d4aba9f91a7c25f2c33..ce692698260d4751b13d5b26f7d9403c72b413c6 100644
|
||||||
--- a/net/minecraft/world/entity/raid/Raider.java
|
--- a/net/minecraft/world/entity/raid/Raider.java
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Skippable raid height check
|
|||||||
|
|
||||||
|
|
||||||
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 41b0db439b425b052bd1469daa6620a435ca852b..f14cdeb3d63b5b8e5bd0074aa245f1b5bd7ef0d3 100644
|
index 9712dc3da64e5c5f653eef353c0247805ccca685..e24260e808b50ad0eb7e2d2e41d11e20d0067a69 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
|
||||||
@@ -660,7 +660,7 @@ public class Raid {
|
@@ -680,7 +680,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);
|
||||||
|
|||||||
@@ -293,6 +293,9 @@ public final class LeavesConfig {
|
|||||||
@GlobalConfig("give-bad-omen-when-kill-patrol-leader")
|
@GlobalConfig("give-bad-omen-when-kill-patrol-leader")
|
||||||
public boolean giveBadOmenWhenKillPatrolLeader = false;
|
public boolean giveBadOmenWhenKillPatrolLeader = false;
|
||||||
|
|
||||||
|
@GlobalConfig("use-old-find-spawn-position")
|
||||||
|
public boolean useOldFindSpawnPosition = false;
|
||||||
|
|
||||||
@GlobalConfig("skip-height-check")
|
@GlobalConfig("skip-height-check")
|
||||||
public boolean skipHeightCheck = false;
|
public boolean skipHeightCheck = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user