mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 10:27:44 +01:00
Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@4a903d81 Readd dropped diff PaperMC/Paper@4fe0ac24 Some more comments PaperMC/Paper@19a36413 Last per file patches PaperMC/Paper@e49b5e88 Fix compile issues: PaperMC/Paper@1b30919a Fix PaperMC/Paper@df964545 Fixup whatever happened here PaperMC/Paper@5933bd5b TrialSpawner compile fixes PaperMC/Paper@20136f71 Some initial adoption of ValueInput/Output PaperMC/Paper@a1bfc19a Some more compilation issues PaperMC/Paper@d16b93e6 Generator PaperMC/Paper@c34fb5f8 Test fixes PaperMC/Paper@f3bad8c8 Prepare work on feature patches PaperMC/Paper@ed3b39e9 14 first feature patches PaperMC/Paper@ff05a2df Hacky EAR 2.0 fixes
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/io/papermc/paper/entity/activation/ActivationRange.java b/io/papermc/paper/entity/activation/ActivationRange.java
|
||||
index 2ebee223085fe7926c7f3e555df19ae69f36157e..265f20fd771df850a0bb0029e699d3146d883837 100644
|
||||
--- a/io/papermc/paper/entity/activation/ActivationRange.java
|
||||
+++ b/io/papermc/paper/entity/activation/ActivationRange.java
|
||||
@@ -141,6 +141,8 @@ public final class ActivationRange {
|
||||
continue;
|
||||
}
|
||||
|
||||
+ if (!player.level().purpurConfig.idleTimeoutTickNearbyEntities && player.isAfk()) continue; // Purpur - AFK API
|
||||
+
|
||||
final int worldHeight = world.getHeight();
|
||||
ActivationRange.maxBB = player.getBoundingBox().inflate(maxRange, worldHeight, maxRange);
|
||||
ActivationType.MISC.boundingBox = player.getBoundingBox().inflate(miscActivationRange, worldHeight, miscActivationRange);
|
||||
@@ -282,6 +284,7 @@ public final class ActivationRange {
|
||||
* @return
|
||||
*/
|
||||
public static boolean checkIfActive(final Entity entity) {
|
||||
+ if (entity.level().purpurConfig.squidImmuneToEAR && entity instanceof net.minecraft.world.entity.animal.Squid) return true; // Purpur - Squid EAR immunity
|
||||
// Never safe to skip fireworks or item gravity
|
||||
if (entity instanceof FireworkRocketEntity || (entity instanceof ItemEntity && (entity.tickCount + entity.getId()) % 4 == 0)) { // Needed for item gravity, see ItemEntity tick
|
||||
return true;
|
||||
@@ -1,151 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/npc/Villager.java b/net/minecraft/world/entity/npc/Villager.java
|
||||
index e0e0d2ea7fc60e3142c675404d152eca60263240..49d43837b88d8f278baa5062aed83a297fe20ed8 100644
|
||||
--- a/net/minecraft/world/entity/npc/Villager.java
|
||||
+++ b/net/minecraft/world/entity/npc/Villager.java
|
||||
@@ -178,6 +178,8 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
MemoryModuleType.MEETING_POINT,
|
||||
(villager, poiType) -> poiType.is(PoiTypes.MEETING)
|
||||
);
|
||||
+ private boolean isLobotomized = false; public boolean isLobotomized() { return this.isLobotomized; } // Purpur - Lobotomize stuck villagers
|
||||
+ private int notLobotomizedCount = 0; // Purpur - Lobotomize stuck villagers
|
||||
|
||||
public Villager(EntityType<? extends Villager> entityType, Level level) {
|
||||
this(entityType, level, VillagerType.PLAINS);
|
||||
@@ -196,6 +198,57 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
this.setVillagerData(this.getVillagerData().withType(villagerType).withProfession(level.registryAccess(), VillagerProfession.NONE));
|
||||
}
|
||||
|
||||
+ // Purpur start - Allow leashing villagers
|
||||
+ @Override
|
||||
+ public boolean canBeLeashed() {
|
||||
+ return level().purpurConfig.villagerCanBeLeashed;
|
||||
+ }
|
||||
+ // Purpur end - Allow leashing villagers
|
||||
+
|
||||
+ // Purpur start - Lobotomize stuck villagers
|
||||
+ private boolean checkLobotomized() {
|
||||
+ int interval = this.level().purpurConfig.villagerLobotomizeCheckInterval;
|
||||
+ boolean shouldCheckForTradeLocked = this.level().purpurConfig.villagerLobotomizeWaitUntilTradeLocked;
|
||||
+ if (this.notLobotomizedCount > 3) {
|
||||
+ // check half as often if not lobotomized for the last 3+ consecutive checks
|
||||
+ interval *= 2;
|
||||
+ }
|
||||
+ if (this.level().getGameTime() % interval == 0) {
|
||||
+ // offset Y for short blocks like dirt_path/farmland
|
||||
+ this.isLobotomized = !(shouldCheckForTradeLocked && this.getVillagerXp() == 0) && !canTravelFrom(BlockPos.containing(this.position().x, this.getBoundingBox().minY + 0.0625D, this.position().z));
|
||||
+
|
||||
+ if (this.isLobotomized) {
|
||||
+ this.notLobotomizedCount = 0;
|
||||
+ } else {
|
||||
+ this.notLobotomizedCount++;
|
||||
+ }
|
||||
+ }
|
||||
+ return this.isLobotomized;
|
||||
+ }
|
||||
+
|
||||
+ private boolean canTravelFrom(BlockPos pos) {
|
||||
+ return canTravelTo(pos.east()) || canTravelTo(pos.west()) || canTravelTo(pos.north()) || canTravelTo(pos.south());
|
||||
+ }
|
||||
+
|
||||
+ private boolean canTravelTo(BlockPos pos) {
|
||||
+ net.minecraft.world.level.block.state.BlockState state = this.level().getBlockStateIfLoaded(pos);
|
||||
+ if (state == null) {
|
||||
+ // chunk not loaded
|
||||
+ return false;
|
||||
+ }
|
||||
+ net.minecraft.world.level.block.Block bottom = state.getBlock();
|
||||
+ if (bottom instanceof net.minecraft.world.level.block.FenceBlock ||
|
||||
+ bottom instanceof net.minecraft.world.level.block.FenceGateBlock ||
|
||||
+ bottom instanceof net.minecraft.world.level.block.WallBlock) {
|
||||
+ // bottom block is too tall to get over
|
||||
+ return false;
|
||||
+ }
|
||||
+ net.minecraft.world.level.block.Block top = level().getBlockState(pos.above()).getBlock();
|
||||
+ // only if both blocks have no collision
|
||||
+ return !bottom.hasCollision && !top.hasCollision;
|
||||
+ }
|
||||
+ // Purpur end - Lobotomize stuck villagers
|
||||
+
|
||||
@Override
|
||||
public Brain<Villager> getBrain() {
|
||||
return (Brain<Villager>)super.getBrain();
|
||||
@@ -292,11 +345,24 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
// Paper start - EAR 2
|
||||
this.customServerAiStep(level, false);
|
||||
}
|
||||
- protected void customServerAiStep(ServerLevel level, final boolean inactive) {
|
||||
+ protected void customServerAiStep(ServerLevel level, boolean inactive) { // Purpur - Lobotomize stuck villagers - not final
|
||||
// Paper end - EAR 2
|
||||
ProfilerFiller profilerFiller = Profiler.get();
|
||||
profilerFiller.push("villagerBrain");
|
||||
- if (!inactive) this.getBrain().tick(level, this); // Paper - EAR 2
|
||||
+ // Purpur start - Lobotomize stuck villagers
|
||||
+ if (this.level().purpurConfig.villagerLobotomizeEnabled) {
|
||||
+ // treat as inactive if lobotomized
|
||||
+ inactive = inactive || checkLobotomized();
|
||||
+ } else {
|
||||
+ this.isLobotomized = false;
|
||||
+ }
|
||||
+ // Purpur end - Lobotomize stuck villagers
|
||||
+ // Pufferfish start
|
||||
+ if (!inactive /*&& this.behaviorTick++ % this.activatedPriority == 0*/) {
|
||||
+ this.getBrain().tick(level, this); // Paper - EAR 2
|
||||
+ }
|
||||
+ else if (this.isLobotomized && shouldRestock()) restock(); // Purpur - Lobotomize stuck villagers
|
||||
+ // Pufferfish end
|
||||
profilerFiller.pop();
|
||||
if (this.assignProfessionWhenSpawned) {
|
||||
this.assignProfessionWhenSpawned = false;
|
||||
@@ -368,6 +434,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
return InteractionResult.CONSUME;
|
||||
}
|
||||
|
||||
+ if (this.level().purpurConfig.villagerAllowTrading) // Purpur - Add config for villager trading
|
||||
this.startTrading(player);
|
||||
}
|
||||
|
||||
@@ -504,7 +571,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
|
||||
private void updateDemand() {
|
||||
for (MerchantOffer merchantOffer : this.getOffers()) {
|
||||
- merchantOffer.updateDemand();
|
||||
+ merchantOffer.updateDemand(this.level().purpurConfig.villagerMinimumDemand); // Purpur - Configurable minimum demand for trades
|
||||
}
|
||||
}
|
||||
|
||||
@@ -697,7 +764,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
|
||||
@Override
|
||||
public boolean canBreed() {
|
||||
- return this.foodLevel + this.countFoodPointsInInventory() >= 12 && !this.isSleeping() && this.getAge() == 0;
|
||||
+ return this.level().purpurConfig.villagerCanBreed && this.foodLevel + this.countFoodPointsInInventory() >= 12 && !this.isSleeping() && this.getAge() == 0; // Purpur - Configurable villager breeding
|
||||
}
|
||||
|
||||
private boolean hungry() {
|
||||
@@ -919,6 +986,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
}
|
||||
|
||||
public void spawnGolemIfNeeded(ServerLevel serverLevel, long gameTime, int minVillagerAmount) {
|
||||
+ if (serverLevel.purpurConfig.villagerSpawnIronGolemRadius > 0 && serverLevel.getEntitiesOfClass(net.minecraft.world.entity.animal.IronGolem.class, getBoundingBox().inflate(serverLevel.purpurConfig.villagerSpawnIronGolemRadius)).size() > serverLevel.purpurConfig.villagerSpawnIronGolemLimit) return; // Purpur - Implement configurable search radius for villagers to spawn iron golems
|
||||
if (this.wantsToSpawnGolem(gameTime)) {
|
||||
AABB aabb = this.getBoundingBox().inflate(10.0, 10.0, 10.0);
|
||||
List<Villager> entitiesOfClass = serverLevel.getEntitiesOfClass(Villager.class, aabb);
|
||||
@@ -992,6 +1060,12 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
|
||||
@Override
|
||||
public void startSleeping(BlockPos pos) {
|
||||
+ // Purpur start - Option for beds to explode on villager sleep
|
||||
+ if (level().purpurConfig.bedExplodeOnVillagerSleep && this.level().getBlockState(pos).getBlock() instanceof net.minecraft.world.level.block.BedBlock) {
|
||||
+ this.level().explode(null, (double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (float) this.level().purpurConfig.bedExplosionPower, this.level().purpurConfig.bedExplosionFire, this.level().purpurConfig.bedExplosionEffect);
|
||||
+ return;
|
||||
+ }
|
||||
+ // Purpur end - Option for beds to explode on villager sleep
|
||||
super.startSleeping(pos);
|
||||
this.brain.setMemory(MemoryModuleType.LAST_SLEPT, this.level().getGameTime());
|
||||
this.brain.eraseMemory(MemoryModuleType.WALK_TARGET);
|
||||
@@ -1,19 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||
index 384f2cd090d6d23bd1308d6e82c24338f2bf55d1..77db68349aa73d33b86a867099c9395c96d5a02d 100644
|
||||
--- a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||
+++ b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||
@@ -308,7 +308,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
||||
|
||||
// Paper start
|
||||
private static void printOversizedLog(String msg, Path file, int x, int z) {
|
||||
- org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO PAPER - You may ask for help on Discord, but do not file an issue. These error messages can not be removed.");
|
||||
+ org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO PURPUR - You may ask for help on Discord, but do not file an issue. These error messages can not be removed."); // Purpur - Rebrand
|
||||
}
|
||||
|
||||
private static CompoundTag readOversizedChunk(RegionFile regionfile, ChunkPos chunkCoordinate) throws IOException {
|
||||
Reference in New Issue
Block a user