update nms file patches

This commit is contained in:
granny
2025-03-24 22:23:34 -07:00
parent cb8448ffe7
commit 48131f7f20
234 changed files with 856 additions and 875 deletions

View File

@@ -1,10 +0,0 @@
--- a/net/minecraft/stats/ServerRecipeBook.java
+++ b/net/minecraft/stats/ServerRecipeBook.java
@@ -138,6 +_,7 @@
try {
ResourceKey<Recipe<?>> resourceKey = ResourceKey.create(Registries.RECIPE, ResourceLocation.parse(string));
if (!isRecognized.test(resourceKey)) {
+ if (!org.purpurmc.purpur.PurpurConfig.loggerSuppressUnrecognizedRecipeErrors) // Purpur - Logger settings (suppressing pointless logs)
LOGGER.error("Tried to load unrecognized recipe: {} removed now.", resourceKey);
} else {
output.accept(resourceKey);

View File

@@ -1,11 +0,0 @@
--- a/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
+++ b/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
@@ -86,7 +_,7 @@
};
// Paper start - optimise POI access
final java.util.List<Pair<Holder<PoiType>, BlockPos>> poiposes = new java.util.ArrayList<>();
- io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, acquirablePois, predicate1, mob.blockPosition(), 48, 48*48, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes);
+ io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, acquirablePois, predicate1, mob.blockPosition(), level.purpurConfig.villagerAcquirePoiSearchRadius, level.purpurConfig.villagerAcquirePoiSearchRadius*level.purpurConfig.villagerAcquirePoiSearchRadius, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes); // Purpur - Configurable villager search radius
final Set<Pair<Holder<PoiType>, BlockPos>> set = new java.util.HashSet<>(poiposes.size());
for (final Pair<Holder<PoiType>, BlockPos> poiPose : poiposes) {
if (predicate.test(level, poiPose.getSecond())) {

View File

@@ -1,11 +0,0 @@
--- a/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
+++ b/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
@@ -56,7 +_,7 @@
// Paper start - optimise POI access
java.util.List<Pair<Holder<PoiType>, BlockPos>> poiposes = new java.util.ArrayList<>();
// don't ask me why it's unbounded. ask mojang.
- io.papermc.paper.util.PoiAccess.findAnyPoiPositions(poiManager, type -> type.is(PoiTypes.HOME), predicate, entity.blockPosition(), 48, PoiManager.Occupancy.ANY, false, Integer.MAX_VALUE, poiposes);
+ io.papermc.paper.util.PoiAccess.findAnyPoiPositions(poiManager, type -> type.is(PoiTypes.HOME), predicate, entity.blockPosition(), level.purpurConfig.villagerNearestBedSensorSearchRadius, PoiManager.Occupancy.ANY, false, Integer.MAX_VALUE, poiposes); // Purpur - Configurable villager search radius
Path path = AcquirePoi.findPathToPois(entity, new java.util.HashSet<>(poiposes));
// Paper end - optimise POI access
if (path != null && path.canReach()) {

View File

@@ -1,20 +0,0 @@
--- a/net/minecraft/world/entity/monster/ZombifiedPiglin.java
+++ b/net/minecraft/world/entity/monster/ZombifiedPiglin.java
@@ -112,7 +_,7 @@
this.maybeAlertOthers();
}
- if (this.isAngry()) {
+ if (this.isAngry() && this.level().purpurConfig.zombifiedPiglinCountAsPlayerKillWhenAngry) { // Purpur - Toggle for Zombified Piglin death always counting as player kill when angry
this.lastHurtByPlayerTime = this.tickCount;
}
@@ -163,7 +_,7 @@
this.ticksUntilNextAlert = ALERT_INTERVAL.sample(this.random);
}
- if (livingEntity instanceof Player) {
+ if (livingEntity instanceof Player && this.level().purpurConfig.zombifiedPiglinCountAsPlayerKillWhenAngry) { // Purpur - Toggle for Zombified Piglin death always counting as player kill when angry
this.setLastHurtByPlayer((Player)livingEntity);
}

View File

@@ -1,39 +0,0 @@
--- a/net/minecraft/world/entity/npc/CatSpawner.java
+++ b/net/minecraft/world/entity/npc/CatSpawner.java
@@ -27,7 +_,7 @@
if (this.nextTick > 0) {
return 0;
} else {
- this.nextTick = 1200;
+ this.nextTick = level.purpurConfig.catSpawnDelay; // Purpur - Cat spawning options
Player randomPlayer = level.getRandomPlayer();
if (randomPlayer == null) {
return 0;
@@ -61,8 +_,12 @@
private int spawnInVillage(ServerLevel serverLevel, BlockPos pos) {
int i = 48;
- if (serverLevel.getPoiManager().getCountInRange(holder -> holder.is(PoiTypes.HOME), pos, 48, PoiManager.Occupancy.IS_OCCUPIED) > 4L) {
- List<Cat> entitiesOfClass = serverLevel.getEntitiesOfClass(Cat.class, new AABB(pos).inflate(48.0, 8.0, 48.0));
+ // Purpur start - Cat spawning options
+ int range = serverLevel.purpurConfig.catSpawnVillageScanRange;
+ if (range <= 0) return 0;
+ if (serverLevel.getPoiManager().getCountInRange(holder -> holder.is(PoiTypes.HOME), pos, range, PoiManager.Occupancy.IS_OCCUPIED) > 4L) {
+ List<Cat> entitiesOfClass = serverLevel.getEntitiesOfClass(Cat.class, new AABB(pos).inflate(range, 8.0, range));
+ // Purpur end - Cat spawning options
if (entitiesOfClass.size() < 5) {
return this.spawnCat(pos, serverLevel);
}
@@ -73,7 +_,11 @@
private int spawnInHut(ServerLevel serverLevel, BlockPos pos) {
int i = 16;
- List<Cat> entitiesOfClass = serverLevel.getEntitiesOfClass(Cat.class, new AABB(pos).inflate(16.0, 8.0, 16.0));
+ // Purpur start - Cat spawning options
+ int range = serverLevel.purpurConfig.catSpawnSwampHutScanRange;
+ if (range <= 0) return 0;
+ List<Cat> entitiesOfClass = serverLevel.getEntitiesOfClass(Cat.class, new AABB(pos).inflate(range, 8.0, range));
+ // Purpur end - Cat spawning options
return entitiesOfClass.size() < 1 ? this.spawnCat(pos, serverLevel) : 0;
}

View File

@@ -1,42 +0,0 @@
--- a/net/minecraft/world/entity/raid/Raids.java
+++ b/net/minecraft/world/entity/raid/Raids.java
@@ -25,6 +_,7 @@
public class Raids extends SavedData {
private static final String RAID_FILE_ID = "raids";
+ public final Map<java.util.UUID, Integer> playerCooldowns = Maps.newHashMap(); // Purpur - Raid cooldown setting
public final Map<Integer, Raid> raidMap = Maps.newHashMap();
private final ServerLevel level;
private int nextAvailableID;
@@ -46,6 +_,17 @@
public void tick() {
this.tick++;
+ // Purpur start - Raid cooldown setting
+ if (level.purpurConfig.raidCooldownSeconds != 0 && this.tick % 20 == 0) {
+ com.google.common.collect.ImmutableMap.copyOf(playerCooldowns).forEach((uuid, i) -> {
+ if (i < 1) {
+ playerCooldowns.remove(uuid);
+ } else {
+ playerCooldowns.put(uuid, i - 1);
+ }
+ });
+ }
+ // Purpur end - Raid cooldown setting
Iterator<Raid> iterator = this.raidMap.values().iterator();
while (iterator.hasNext()) {
@@ -119,11 +_,13 @@
*/
if (!raid.isStarted() || (raid.isInProgress() && raid.getRaidOmenLevel() < raid.getMaxRaidOmenLevel())) { // CraftBukkit - fixed a bug with raid: players could add up Bad Omen level even when the raid had finished
+ if (level.purpurConfig.raidCooldownSeconds != 0 && playerCooldowns.containsKey(player.getUUID())) return null; // Purpur - Raid cooldown setting
// CraftBukkit start
if (!org.bukkit.craftbukkit.event.CraftEventFactory.callRaidTriggerEvent(raid, player)) {
player.removeEffect(net.minecraft.world.effect.MobEffects.RAID_OMEN);
return null;
}
+ if (level.purpurConfig.raidCooldownSeconds != 0) playerCooldowns.put(player.getUUID(), level.purpurConfig.raidCooldownSeconds); // Purpur - Raid cooldown setting
if (!raid.isStarted() && !this.raidMap.containsKey(raid.getId())) {
this.raidMap.put(raid.getId(), raid);

View File

@@ -1,11 +0,0 @@
--- a/net/minecraft/world/item/EggItem.java
+++ b/net/minecraft/world/item/EggItem.java
@@ -26,7 +_,7 @@
if (level instanceof ServerLevel serverLevel) {
// CraftBukkit start
// Paper start - PlayerLaunchProjectileEvent
- final Projectile.Delayed<ThrownEgg> thrownEgg = Projectile.spawnProjectileFromRotationDelayed(ThrownEgg::new, serverLevel, itemInHand, player, 0.0F, EggItem.PROJECTILE_SHOOT_POWER, 1.0F);
+ final Projectile.Delayed<ThrownEgg> thrownEgg = Projectile.spawnProjectileFromRotationDelayed(ThrownEgg::new, serverLevel, itemInHand, player, 0.0F, EggItem.PROJECTILE_SHOOT_POWER, (float) serverLevel.purpurConfig.eggProjectileOffset); // Purpur - Projectile offset config
com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) player.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemInHand), (org.bukkit.entity.Projectile) thrownEgg.projectile().getBukkitEntity());
if (event.callEvent() && thrownEgg.attemptSpawn()) {
if (event.shouldConsume()) {

View File

@@ -1,15 +0,0 @@
--- a/net/minecraft/world/level/block/BubbleColumnBlock.java
+++ b/net/minecraft/world/level/block/BubbleColumnBlock.java
@@ -124,10 +_,10 @@
if (blockState.is(Blocks.BUBBLE_COLUMN)) {
return blockState;
} else if (blockState.is(Blocks.SOUL_SAND)) {
- return Blocks.BUBBLE_COLUMN.defaultBlockState().setValue(DRAG_DOWN, Boolean.valueOf(false));
+ return Blocks.BUBBLE_COLUMN.defaultBlockState().setValue(DRAG_DOWN, Boolean.valueOf(org.purpurmc.purpur.PurpurConfig.soulSandBlockReverseBubbleColumnFlow)); // Purpur - Config to reverse bubble column flow
} else {
return blockState.is(Blocks.MAGMA_BLOCK)
- ? Blocks.BUBBLE_COLUMN.defaultBlockState().setValue(DRAG_DOWN, Boolean.valueOf(true))
+ ? Blocks.BUBBLE_COLUMN.defaultBlockState().setValue(DRAG_DOWN, Boolean.valueOf(!org.purpurmc.purpur.PurpurConfig.magmaBlockReverseBubbleColumnFlow)) // Purpur - Config to reverse bubble column flow
: Blocks.WATER.defaultBlockState();
}
}

View File

@@ -1,11 +0,0 @@
--- a/net/minecraft/world/level/block/CampfireBlock.java
+++ b/net/minecraft/world/level/block/CampfireBlock.java
@@ -141,7 +_,7 @@
return this.defaultBlockState()
.setValue(WATERLOGGED, Boolean.valueOf(flag))
.setValue(SIGNAL_FIRE, Boolean.valueOf(this.isSmokeSource(level.getBlockState(clickedPos.below()))))
- .setValue(LIT, Boolean.valueOf(!flag))
+ .setValue(LIT, Boolean.valueOf(level.getMinecraftWorld().purpurConfig.campFireLitWhenPlaced && !flag)) // Purpur - Campfire option for lit when placed
.setValue(FACING, context.getHorizontalDirection());
}

View File

@@ -1,11 +0,0 @@
--- a/net/minecraft/world/level/block/SculkShriekerBlock.java
+++ b/net/minecraft/world/level/block/SculkShriekerBlock.java
@@ -134,7 +_,7 @@
@Override
public BlockState getStateForPlacement(BlockPlaceContext context) {
return this.defaultBlockState()
- .setValue(WATERLOGGED, Boolean.valueOf(context.getLevel().getFluidState(context.getClickedPos()).getType() == Fluids.WATER));
+ .setValue(WATERLOGGED, Boolean.valueOf(context.getLevel().getFluidState(context.getClickedPos()).getType() == Fluids.WATER)).setValue(SculkShriekerBlock.CAN_SUMMON, context.getLevel().purpurConfig.sculkShriekerCanSummonDefault); // Purpur - Config for sculk shrieker can_summon state
}
@Override

View File

@@ -1,32 +0,0 @@
--- a/net/minecraft/world/level/levelgen/PhantomSpawner.java
+++ b/net/minecraft/world/level/levelgen/PhantomSpawner.java
@@ -43,7 +_,7 @@
int spawnAttemptMaxSeconds = level.paperConfig().entities.behavior.phantomsSpawnAttemptMaxSeconds;
this.nextTick += (spawnAttemptMinSeconds + randomSource.nextInt(spawnAttemptMaxSeconds - spawnAttemptMinSeconds + 1)) * 20;
// Paper end - Ability to control player's insomnia and phantoms
- if (level.getSkyDarken() < 5 && level.dimensionType().hasSkyLight()) {
+ if (level.getSkyDarken() < level.purpurConfig.phantomSpawnMinSkyDarkness && level.dimensionType().hasSkyLight()) { // Purpur - Add phantom spawning options
return 0;
} else {
int i = 0;
@@ -51,9 +_,9 @@
for (ServerPlayer serverPlayer : level.players()) {
if (!serverPlayer.isSpectator() && (!level.paperConfig().entities.behavior.phantomsDoNotSpawnOnCreativePlayers || !serverPlayer.isCreative())) { // Paper - Add phantom creative and insomniac controls
BlockPos blockPos = serverPlayer.blockPosition();
- if (!level.dimensionType().hasSkyLight() || blockPos.getY() >= level.getSeaLevel() && level.canSeeSky(blockPos)) {
+ if (!level.dimensionType().hasSkyLight() || (!level.purpurConfig.phantomSpawnOnlyAboveSeaLevel || blockPos.getY() >= level.getSeaLevel()) && (!level.purpurConfig.phantomSpawnOnlyWithVisibleSky || level.canSeeSky(blockPos))) { // Purpur - Add phantom spawning options
DifficultyInstance currentDifficultyAt = level.getCurrentDifficultyAt(blockPos);
- if (currentDifficultyAt.isHarderThan(randomSource.nextFloat() * 3.0F)) {
+ if (currentDifficultyAt.isHarderThan(randomSource.nextFloat() * (float) level.purpurConfig.phantomSpawnLocalDifficultyChance)) { // Purpur - Add phantom spawning options
ServerStatsCounter stats = serverPlayer.getStats();
int i1 = Mth.clamp(stats.getValue(Stats.CUSTOM.get(Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE);
int i2 = 24000;
@@ -65,7 +_,7 @@
FluidState fluidState = level.getFluidState(blockPos1);
if (NaturalSpawner.isValidEmptySpawnBlock(level, blockPos1, blockState, fluidState, EntityType.PHANTOM)) {
SpawnGroupData spawnGroupData = null;
- int i3 = 1 + randomSource.nextInt(currentDifficultyAt.getDifficulty().getId() + 1);
+ int i3 = level.purpurConfig.phantomSpawnMinPerAttempt + level.random.nextInt((level.purpurConfig.phantomSpawnMaxPerAttempt < 0 ? currentDifficultyAt.getDifficulty().getId() : level.purpurConfig.phantomSpawnMaxPerAttempt - level.purpurConfig.phantomSpawnMinPerAttempt) + 1); // Purpur - Add phantom spawning options
for (int i4 = 0; i4 < i3; i4++) {
// Paper start - PhantomPreSpawnEvent

View File

@@ -20,7 +20,7 @@
public Vec3 getPosition() { public Vec3 getPosition() {
return this.worldPosition; return this.worldPosition;
} }
@@ -540,6 +_,30 @@ @@ -539,6 +_,30 @@
} }
} }
} }

View File

@@ -1,13 +1,11 @@
--- a/net/minecraft/commands/Commands.java --- a/net/minecraft/commands/Commands.java
+++ b/net/minecraft/commands/Commands.java +++ b/net/minecraft/commands/Commands.java
@@ -221,8 +_,8 @@ @@ -222,7 +_,7 @@
JfrCommand.register(this.dispatcher); JfrCommand.register(this.dispatcher);
} }
- if (SharedConstants.IS_RUNNING_IN_IDE) { - if (SharedConstants.IS_RUNNING_IN_IDE) {
- TestCommand.register(this.dispatcher);
+ if (org.purpurmc.purpur.PurpurConfig.registerMinecraftDebugCommands || SharedConstants.IS_RUNNING_IN_IDE) { // Purpur - register minecraft debug commands + if (org.purpurmc.purpur.PurpurConfig.registerMinecraftDebugCommands || SharedConstants.IS_RUNNING_IN_IDE) { // Purpur - register minecraft debug commands
+ if (!org.purpurmc.purpur.PurpurConfig.registerMinecraftDebugCommands) TestCommand.register(this.dispatcher); // Purpur - register minecraft debug commands
RaidCommand.register(this.dispatcher, context); RaidCommand.register(this.dispatcher, context);
DebugPathCommand.register(this.dispatcher); DebugPathCommand.register(this.dispatcher);
DebugMobSpawningCommand.register(this.dispatcher); DebugMobSpawningCommand.register(this.dispatcher);
@@ -26,7 +24,7 @@
} }
if (selection.includeIntegrated) { if (selection.includeIntegrated) {
@@ -503,6 +_,7 @@ @@ -502,6 +_,7 @@
private void runSync(ServerPlayer player, java.util.Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootCommandNode) { private void runSync(ServerPlayer player, java.util.Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootCommandNode) {
// Paper end - Perf: Async command map building // Paper end - Perf: Async command map building
new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent<CommandSourceStack>(player.getBukkitEntity(), (RootCommandNode) rootCommandNode, true).callEvent(); // Paper - Brigadier API new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent<CommandSourceStack>(player.getBukkitEntity(), (RootCommandNode) rootCommandNode, true).callEvent(); // Paper - Brigadier API
@@ -34,7 +32,7 @@
org.bukkit.event.player.PlayerCommandSendEvent event = new org.bukkit.event.player.PlayerCommandSendEvent(player.getBukkitEntity(), new java.util.LinkedHashSet<>(bukkit)); org.bukkit.event.player.PlayerCommandSendEvent event = new org.bukkit.event.player.PlayerCommandSendEvent(player.getBukkitEntity(), new java.util.LinkedHashSet<>(bukkit));
event.getPlayer().getServer().getPluginManager().callEvent(event); event.getPlayer().getServer().getPluginManager().callEvent(event);
@@ -513,6 +_,7 @@ @@ -512,6 +_,7 @@
} }
} }
// CraftBukkit end // CraftBukkit end

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/core/BlockPos.java --- a/net/minecraft/core/BlockPos.java
+++ b/net/minecraft/core/BlockPos.java +++ b/net/minecraft/core/BlockPos.java
@@ -63,6 +_,12 @@ @@ -61,6 +_,12 @@
public static final int MAX_HORIZONTAL_COORDINATE = 33554431; private static final int X_OFFSET = PACKED_Y_LENGTH + PACKED_HORIZONTAL_LENGTH;
// Paper end - Optimize Bit Operations by inlining public static final int MAX_HORIZONTAL_COORDINATE = (1 << PACKED_HORIZONTAL_LENGTH) / 2 - 1;
+ // Purpur start - Ridables + // Purpur start - Ridables
+ public BlockPos(net.minecraft.world.entity.Entity entity) { + public BlockPos(net.minecraft.world.entity.Entity entity) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/core/dispenser/DispenseItemBehavior.java --- a/net/minecraft/core/dispenser/DispenseItemBehavior.java
+++ b/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/net/minecraft/core/dispenser/DispenseItemBehavior.java
@@ -892,5 +_,22 @@ @@ -735,5 +_,22 @@
DispenserBlock.registerBehavior(Items.TNT_MINECART, new MinecartDispenseItemBehavior(EntityType.TNT_MINECART)); DispenserBlock.registerBehavior(Items.TNT_MINECART, new MinecartDispenseItemBehavior(EntityType.TNT_MINECART));
DispenserBlock.registerBehavior(Items.HOPPER_MINECART, new MinecartDispenseItemBehavior(EntityType.HOPPER_MINECART)); DispenserBlock.registerBehavior(Items.HOPPER_MINECART, new MinecartDispenseItemBehavior(EntityType.HOPPER_MINECART));
DispenserBlock.registerBehavior(Items.COMMAND_BLOCK_MINECART, new MinecartDispenseItemBehavior(EntityType.COMMAND_BLOCK_MINECART)); DispenserBlock.registerBehavior(Items.COMMAND_BLOCK_MINECART, new MinecartDispenseItemBehavior(EntityType.COMMAND_BLOCK_MINECART));

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java --- a/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java
+++ b/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java +++ b/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java
@@ -31,7 +_,7 @@ @@ -32,7 +_,7 @@
return false; return false;
} else { } else {
LivingEntity livingEntity = entitiesOfClass.getFirst(); LivingEntity livingEntity = entitiesOfClass.getFirst();

View File

@@ -1,11 +1,11 @@
--- a/net/minecraft/gametest/framework/GameTestHelper.java --- a/net/minecraft/gametest/framework/GameTestHelper.java
+++ b/net/minecraft/gametest/framework/GameTestHelper.java +++ b/net/minecraft/gametest/framework/GameTestHelper.java
@@ -279,6 +_,8 @@ @@ -292,6 +_,8 @@
return gameType.isCreative(); return gameType;
} }
+ public void setAfk(final boolean afk) {} // Purpur - AFK API + public void setAfk(final boolean afk) {} // Purpur - AFK API
+ +
@Override @Override
public boolean isLocalPlayer() { public boolean isClientAuthoritative() {
return true; return false;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/MinecraftServer.java --- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java
@@ -284,6 +_,7 @@ @@ -283,6 +_,7 @@
public joptsimple.OptionSet options; public joptsimple.OptionSet options;
public org.bukkit.command.ConsoleCommandSender console; public org.bukkit.command.ConsoleCommandSender console;
public static int currentTick; // Paper - improve tick loop public static int currentTick; // Paper - improve tick loop
@@ -8,7 +8,7 @@
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>(); public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
public int autosavePeriod; public int autosavePeriod;
// Paper - don't store the vanilla dispatcher // Paper - don't store the vanilla dispatcher
@@ -294,7 +_,7 @@ @@ -293,7 +_,7 @@
public static final int TICK_TIME = 1000000000 / MinecraftServer.TPS; public static final int TICK_TIME = 1000000000 / MinecraftServer.TPS;
private static final int SAMPLE_INTERVAL = 20; // Paper - improve server tick loop private static final int SAMPLE_INTERVAL = 20; // Paper - improve server tick loop
@Deprecated(forRemoval = true) // Paper @Deprecated(forRemoval = true) // Paper
@@ -17,17 +17,16 @@
// Spigot end // Spigot end
public volatile boolean hasFullyShutdown; // Paper - Improved watchdog support public volatile boolean hasFullyShutdown; // Paper - Improved watchdog support
public volatile boolean abnormalExit; // Paper - Improved watchdog support public volatile boolean abnormalExit; // Paper - Improved watchdog support
@@ -302,7 +_,9 @@ @@ -302,6 +_,8 @@
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; // Paper - add paper configuration files
public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
private final Set<String> pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping private final Set<String> pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping
+ public boolean lagging = false; // Purpur - Lagging threshold
public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation
+ public boolean lagging = false; // Purpur - Lagging threshold
+ protected boolean upnp = false; // Purpur - UPnP Port Forwarding + protected boolean upnp = false; // Purpur - UPnP Port Forwarding
public static <S extends MinecraftServer> S spin(Function<Thread, S> threadFunction) { public static <S extends MinecraftServer> S spin(Function<Thread, S> threadFunction) {
ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system AtomicReference<S> atomicReference = new AtomicReference<>();
@@ -1001,6 +_,15 @@ @@ -917,6 +_,15 @@
LOGGER.info("Stopping server"); LOGGER.info("Stopping server");
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
@@ -43,7 +42,7 @@
// CraftBukkit start // CraftBukkit start
if (this.server != null) { if (this.server != null) {
this.server.spark.disable(); // Paper - spark this.server.spark.disable(); // Paper - spark
@@ -1093,6 +_,8 @@ @@ -1011,6 +_,8 @@
this.safeShutdown(waitForServer, false); this.safeShutdown(waitForServer, false);
} }
public void safeShutdown(boolean waitForServer, boolean isRestarting) { public void safeShutdown(boolean waitForServer, boolean isRestarting) {
@@ -52,7 +51,7 @@
this.isRestarting = isRestarting; this.isRestarting = isRestarting;
this.hasLoggedStop = true; // Paper - Debugging this.hasLoggedStop = true; // Paper - Debugging
if (isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper - Debugging if (isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper - Debugging
@@ -1112,6 +_,7 @@ @@ -1030,6 +_,7 @@
private static final long MAX_CATCHUP_BUFFER = TICK_TIME * TPS * 60L; private static final long MAX_CATCHUP_BUFFER = TICK_TIME * TPS * 60L;
private long lastTick = 0; private long lastTick = 0;
private long catchupTime = 0; private long catchupTime = 0;
@@ -60,7 +59,7 @@
public final RollingAverage tps1 = new RollingAverage(60); public final RollingAverage tps1 = new RollingAverage(60);
public final RollingAverage tps5 = new RollingAverage(60 * 5); public final RollingAverage tps5 = new RollingAverage(60 * 5);
public final RollingAverage tps15 = new RollingAverage(60 * 15); public final RollingAverage tps15 = new RollingAverage(60 * 15);
@@ -1197,6 +_,16 @@ @@ -1115,6 +_,16 @@
} }
// Paper end - Add onboarding message for initial server start // Paper end - Add onboarding message for initial server start
@@ -77,7 +76,7 @@
while (this.running) { while (this.running) {
long l; long l;
if (!this.isPaused() && this.tickRateManager.isSprinting() && this.tickRateManager.checkShouldSprintThisTick()) { if (!this.isPaused() && this.tickRateManager.isSprinting() && this.tickRateManager.checkShouldSprintThisTick()) {
@@ -1221,14 +_,19 @@ @@ -1139,14 +_,19 @@
if (++MinecraftServer.currentTick % MinecraftServer.SAMPLE_INTERVAL == 0) { if (++MinecraftServer.currentTick % MinecraftServer.SAMPLE_INTERVAL == 0) {
final long diff = currentTime - tickSection; final long diff = currentTime - tickSection;
final java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP); final java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP);
@@ -100,7 +99,7 @@
tickSection = currentTime; tickSection = currentTime;
} }
// Paper end - further improve server tick loop // Paper end - further improve server tick loop
@@ -1260,6 +_,12 @@ @@ -1171,6 +_,12 @@
profilerFiller.popPush("nextTickWait"); profilerFiller.popPush("nextTickWait");
this.mayHaveDelayedTasks = true; this.mayHaveDelayedTasks = true;
this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + l, this.nextTickTimeNanos); this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + l, this.nextTickTimeNanos);
@@ -113,7 +112,7 @@
this.startMeasuringTaskExecutionTime(); this.startMeasuringTaskExecutionTime();
this.waitUntilNextTick(); this.waitUntilNextTick();
this.finishMeasuringTaskExecutionTime(); this.finishMeasuringTaskExecutionTime();
@@ -1690,7 +_,7 @@ @@ -1580,7 +_,7 @@
long worldTime = level.getGameTime(); long worldTime = level.getGameTime();
final ClientboundSetTimePacket worldPacket = new ClientboundSetTimePacket(worldTime, dayTime, doDaylight); final ClientboundSetTimePacket worldPacket = new ClientboundSetTimePacket(worldTime, dayTime, doDaylight);
for (Player entityhuman : level.players()) { for (Player entityhuman : level.players()) {
@@ -122,7 +121,7 @@
continue; continue;
} }
ServerPlayer entityplayer = (ServerPlayer) entityhuman; ServerPlayer entityplayer = (ServerPlayer) entityhuman;
@@ -1855,7 +_,7 @@ @@ -1744,7 +_,7 @@
@DontObfuscate @DontObfuscate
public String getServerModName() { public String getServerModName() {

View File

@@ -9,7 +9,7 @@
throw ERROR_LEVEL_TOO_HIGH.create(level, enchantment1.getMaxLevel()); throw ERROR_LEVEL_TOO_HIGH.create(level, enchantment1.getMaxLevel());
} else { } else {
int i = 0; int i = 0;
@@ -81,7 +_,7 @@ @@ -80,7 +_,7 @@
ItemStack mainHandItem = livingEntity.getMainHandItem(); ItemStack mainHandItem = livingEntity.getMainHandItem();
if (!mainHandItem.isEmpty()) { if (!mainHandItem.isEmpty()) {
if (enchantment1.canEnchant(mainHandItem) if (enchantment1.canEnchant(mainHandItem)

View File

@@ -6,5 +6,5 @@
boolean flag = serverPlayer.getInventory().add(itemStack1); boolean flag = serverPlayer.getInventory().add(itemStack1);
+ if (org.purpurmc.purpur.PurpurConfig.disableGiveCommandDrops) continue; // Purpur - add config option for toggling give command dropping + if (org.purpurmc.purpur.PurpurConfig.disableGiveCommandDrops) continue; // Purpur - add config option for toggling give command dropping
if (flag && itemStack1.isEmpty()) { if (flag && itemStack1.isEmpty()) {
ItemEntity itemEntity = serverPlayer.drop(itemStack, false, false, false); // CraftBukkit - SPIGOT-2942: Add boolean to call event ItemEntity itemEntity = serverPlayer.drop(itemStack, false);
if (itemEntity != null) { if (itemEntity != null) {

View File

@@ -1,14 +1,14 @@
--- a/net/minecraft/server/dedicated/DedicatedServer.java --- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java
@@ -106,6 +_,7 @@ @@ -105,6 +_,7 @@
// CraftBukkit start public void run() {
if (!org.bukkit.craftbukkit.Main.useConsole) return; if (!org.bukkit.craftbukkit.Main.useConsole) return; // CraftBukkit
// Paper start - Use TerminalConsoleAppender // Paper start - Use TerminalConsoleAppender
+ if (DedicatedServer.this.gui == null || System.console() != null) // Purpur - GUI Improvements - has no GUI or has console (did not double-click) + if (DedicatedServer.this.gui == null || System.console() != null) // Purpur - GUI Improvements - has no GUI or has console (did not double-click)
new com.destroystokyo.paper.console.PaperConsole(DedicatedServer.this).start(); new com.destroystokyo.paper.console.PaperConsole(DedicatedServer.this).start();
/* /*
jline.console.ConsoleReader bufferedreader = DedicatedServer.this.reader; BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8));
@@ -224,6 +_,15 @@ @@ -183,6 +_,15 @@
io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
this.server.spark.registerCommandBeforePlugins(this.server); // Paper - spark this.server.spark.registerCommandBeforePlugins(this.server); // Paper - spark
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
@@ -24,7 +24,7 @@
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
this.setPvpAllowed(properties.pvp); this.setPvpAllowed(properties.pvp);
@@ -271,6 +_,30 @@ @@ -230,6 +_,30 @@
if (true) throw new IllegalStateException("Failed to bind to port", var10); // Paper - Propagate failed to bind to port error if (true) throw new IllegalStateException("Failed to bind to port", var10); // Paper - Propagate failed to bind to port error
return false; return false;
} }
@@ -54,8 +54,8 @@
+ // Purpur end - UPnP Port Forwarding + // Purpur end - UPnP Port Forwarding
// CraftBukkit start // CraftBukkit start
// this.setPlayerList(new DedicatedPlayerList(this, this.registries(), this.playerDataStorage)); // Spigot - moved up this.server.loadPlugins();
@@ -350,6 +_,8 @@ @@ -308,6 +_,8 @@
LOGGER.info("JMX monitoring enabled"); LOGGER.info("JMX monitoring enabled");
} }

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/ServerLevel.java --- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java
@@ -207,6 +_,8 @@ @@ -203,6 +_,8 @@
private final StructureManager structureManager; private final StructureManager structureManager;
private final StructureCheck structureCheck; private final StructureCheck structureCheck;
private final boolean tickTime; private final boolean tickTime;
@@ -9,7 +9,7 @@
private final RandomSequences randomSequences; private final RandomSequences randomSequences;
// CraftBukkit start // CraftBukkit start
@@ -595,7 +_,24 @@ @@ -350,7 +_,24 @@
// CraftBukkit end // CraftBukkit end
this.tickTime = tickTime; this.tickTime = tickTime;
this.server = server; this.server = server;
@@ -35,15 +35,15 @@
this.serverLevelData = serverLevelData; this.serverLevelData = serverLevelData;
ChunkGenerator chunkGenerator = levelStem.generator(); ChunkGenerator chunkGenerator = levelStem.generator();
// CraftBukkit start // CraftBukkit start
@@ -681,6 +_,7 @@ @@ -431,6 +_,7 @@
this.chunkDataController = new ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.ChunkDataController((ServerLevel)(Object)this, this.chunkTaskScheduler); this.gameEventDispatcher = new GameEventDispatcher(this);
// Paper end - rewrite chunk system this.randomSequences = Objects.requireNonNullElseGet(randomSequences, () -> this.getDataStorage().computeIfAbsent(RandomSequences.TYPE));
this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
+ this.preciseTime = this.serverLevelData.getDayTime(); // Purpur - Configurable daylight cycle + this.preciseTime = this.serverLevelData.getDayTime(); // Purpur - Configurable daylight cycle
} }
// Paper start // Paper start
@@ -727,7 +_,7 @@ @@ -477,7 +_,7 @@
} }
int _int = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); int _int = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
@@ -52,7 +52,7 @@
// Paper start - create time skip event - move up calculations // Paper start - create time skip event - move up calculations
final long newDayTime = this.levelData.getDayTime() + 24000L; final long newDayTime = this.levelData.getDayTime() + 24000L;
org.bukkit.event.world.TimeSkipEvent event = new org.bukkit.event.world.TimeSkipEvent( org.bukkit.event.world.TimeSkipEvent event = new org.bukkit.event.world.TimeSkipEvent(
@@ -846,6 +_,13 @@ @@ -594,6 +_,13 @@
this.serverLevelData.getScheduledEvents().tick(this.server, l); this.serverLevelData.getScheduledEvents().tick(this.server, l);
Profiler.get().pop(); Profiler.get().pop();
if (this.serverLevelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) { if (this.serverLevelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) {
@@ -66,7 +66,7 @@
this.setDayTime(this.levelData.getDayTime() + 1L); this.setDayTime(this.levelData.getDayTime() + 1L);
} }
} }
@@ -853,7 +_,21 @@ @@ -601,7 +_,21 @@
public void setDayTime(long time) { public void setDayTime(long time) {
this.serverLevelData.setDayTime(time); this.serverLevelData.setDayTime(time);
@@ -89,7 +89,7 @@
public void tickCustomSpawners(boolean spawnEnemies, boolean spawnFriendlies) { public void tickCustomSpawners(boolean spawnEnemies, boolean spawnFriendlies) {
for (CustomSpawner customSpawner : this.customSpawners) { for (CustomSpawner customSpawner : this.customSpawners) {
@@ -934,9 +_,17 @@ @@ -678,9 +_,17 @@
&& this.random.nextDouble() < currentDifficultyAt.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01) // Paper - Configurable spawn chances for skeleton horses && this.random.nextDouble() < currentDifficultyAt.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01) // Paper - Configurable spawn chances for skeleton horses
&& !this.getBlockState(blockPos.below()).is(Blocks.LIGHTNING_ROD); && !this.getBlockState(blockPos.below()).is(Blocks.LIGHTNING_ROD);
if (flag) { if (flag) {
@@ -109,7 +109,7 @@
skeletonHorse.setAge(0); skeletonHorse.setAge(0);
skeletonHorse.setPos(blockPos.getX(), blockPos.getY(), blockPos.getZ()); skeletonHorse.setPos(blockPos.getX(), blockPos.getY(), blockPos.getZ());
this.addFreshEntity(skeletonHorse, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit this.addFreshEntity(skeletonHorse, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
@@ -1009,7 +_,7 @@ @@ -738,7 +_,7 @@
pointOfInterestType -> pointOfInterestType.is(PoiTypes.LIGHTNING_ROD), pointOfInterestType -> pointOfInterestType.is(PoiTypes.LIGHTNING_ROD),
blockPos -> blockPos.getY() == this.getHeight(Heightmap.Types.WORLD_SURFACE, blockPos.getX(), blockPos.getZ()) - 1, blockPos -> blockPos.getY() == this.getHeight(Heightmap.Types.WORLD_SURFACE, blockPos.getX(), blockPos.getZ()) - 1,
pos, pos,
@@ -118,7 +118,7 @@
PoiManager.Occupancy.ANY PoiManager.Occupancy.ANY
); );
return optional.map(blockPos -> blockPos.above(1)); return optional.map(blockPos -> blockPos.above(1));
@@ -1057,8 +_,26 @@ @@ -787,8 +_,26 @@
int _int = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); int _int = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
Component component; Component component;
if (this.sleepStatus.areEnoughSleeping(_int)) { if (this.sleepStatus.areEnoughSleeping(_int)) {
@@ -145,7 +145,7 @@
component = Component.translatable("sleep.players_sleeping", this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(_int)); component = Component.translatable("sleep.players_sleeping", this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(_int));
} }
@@ -1191,6 +_,7 @@ @@ -921,6 +_,7 @@
@VisibleForTesting @VisibleForTesting
public void resetWeatherCycle() { public void resetWeatherCycle() {
// CraftBukkit start // CraftBukkit start
@@ -153,7 +153,7 @@
this.serverLevelData.setRaining(false, org.bukkit.event.weather.WeatherChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents this.serverLevelData.setRaining(false, org.bukkit.event.weather.WeatherChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents
// If we stop due to everyone sleeping we should reset the weather duration to some other random value. // If we stop due to everyone sleeping we should reset the weather duration to some other random value.
// Not that everyone ever manages to get the whole server to sleep at the same time.... // Not that everyone ever manages to get the whole server to sleep at the same time....
@@ -1198,6 +_,7 @@ @@ -928,6 +_,7 @@
this.serverLevelData.setRainTime(0); this.serverLevelData.setRainTime(0);
} }
// CraftBukkit end // CraftBukkit end
@@ -161,7 +161,7 @@
this.serverLevelData.setThundering(false, org.bukkit.event.weather.ThunderChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents this.serverLevelData.setThundering(false, org.bukkit.event.weather.ThunderChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents
// CraftBukkit start // CraftBukkit start
// If we stop due to everyone sleeping we should reset the weather duration to some other random value. // If we stop due to everyone sleeping we should reset the weather duration to some other random value.
@@ -2679,7 +_,7 @@ @@ -2331,7 +_,7 @@
// Spigot start // Spigot start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
// Paper start - Fix merchant inventory not closing on entity removal // Paper start - Fix merchant inventory not closing on entity removal

View File

@@ -1,38 +1,38 @@
--- a/net/minecraft/server/level/ServerPlayer.java --- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java
@@ -400,6 +_,10 @@ @@ -422,6 +_,10 @@
public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent public @Nullable com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
public @Nullable String clientBrandName = null; // Paper - Brand support public @Nullable String clientBrandName = null; // Paper - Brand support
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - Add API for quit reason; there are a lot of changes to do if we change all methods leading to the event public @Nullable org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - Add API for quit reason; there are a lot of changes to do if we change all methods leading to the event
+ public boolean purpurClient = false; // Purpur - Purpur client support + public boolean purpurClient = false; // Purpur - Purpur client support
+ private boolean tpsBar = false; // Purpur - Implement TPSBar + private boolean tpsBar = false; // Purpur - Implement TPSBar
+ private boolean compassBar = false; // Purpur - Add compass command + private boolean compassBar = false; // Purpur - Add compass command
+ private boolean ramBar = false; // Purpur - Implement rambar commands + private boolean ramBar = false; // Purpur - Implement rambar commands
// Paper start - rewrite chunk system public ServerPlayer(MinecraftServer server, ServerLevel level, GameProfile gameProfile, ClientInformation clientInformation) {
private ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader; super(level, level.getSharedSpawnPos(), level.getSharedSpawnAngle(), gameProfile);
@@ -568,6 +_,10 @@ @@ -525,6 +_,10 @@
if (tag != null) { this.respawnConfig = compound.read("respawn", ServerPlayer.RespawnConfig.CODEC).orElse(null);
BlockPos.CODEC.parse(NbtOps.INSTANCE, tag).resultOrPartial(LOGGER::error).ifPresent(pos -> this.raidOmenPosition = pos); this.spawnExtraParticlesOnFall = compound.getBooleanOr("spawn_extra_particles_on_fall", false);
} this.raidOmenPosition = compound.read("raid_omen_position", BlockPos.CODEC).orElse(null);
+ +
+ if (compound.contains("Purpur.TPSBar")) { this.tpsBar = compound.getBoolean("Purpur.TPSBar"); } // Purpur - Implement TPSBar + this.tpsBar = compound.getBooleanOr("Purpur.TPSBar", false); // Purpur - Implement TPSBar
+ if (compound.contains("Purpur.CompassBar")) { this.compassBar = compound.getBoolean("Purpur.CompassBar"); } // Purpur - Add compass command + this.compassBar = compound.getBooleanOr("Purpur.CompassBar", false); // Purpur - Add compass command
+ if (compound.contains("Purpur.RamBar")) { this.ramBar = compound.getBoolean("Purpur.RamBar"); } // Purpur - Implement rambar command + this.ramBar = compound.getBooleanOr("Purpur.RamBar", false); // Purpur - Implement rambar command
} }
@Override @Override
@@ -612,6 +_,9 @@ @@ -542,6 +_,9 @@
} compound.storeNullable("raid_omen_position", BlockPos.CODEC, this.raidOmenPosition);
this.saveEnderPearls(compound); this.saveEnderPearls(compound);
this.getBukkitEntity().setExtraData(compound); // CraftBukkit
+ compound.putBoolean("Purpur.TPSBar", this.tpsBar); // Purpur - Implement TPSBar + compound.putBoolean("Purpur.TPSBar", this.tpsBar); // Purpur - Implement TPSBar
+ compound.putBoolean("Purpur.CompassBar", this.compassBar); // Purpur - Add compass command + compound.putBoolean("Purpur.CompassBar", this.compassBar); // Purpur - Add compass command
+ compound.putBoolean("Purpur.RamBar", this.ramBar); // Purpur - Add rambar command + compound.putBoolean("Purpur.RamBar", this.ramBar); // Purpur - Add rambar command
} }
private void saveParentVehicle(CompoundTag tag) { private void saveParentVehicle(CompoundTag tag) {
@@ -1131,6 +_,7 @@ @@ -1029,6 +_,7 @@
) )
); );
Team team = this.getTeam(); Team team = this.getTeam();
@@ -40,7 +40,7 @@
if (team == null || team.getDeathMessageVisibility() == Team.Visibility.ALWAYS) { if (team == null || team.getDeathMessageVisibility() == Team.Visibility.ALWAYS) {
this.server.getPlayerList().broadcastSystemMessage(deathMessage, false); this.server.getPlayerList().broadcastSystemMessage(deathMessage, false);
} else if (team.getDeathMessageVisibility() == Team.Visibility.HIDE_FOR_OTHER_TEAMS) { } else if (team.getDeathMessageVisibility() == Team.Visibility.HIDE_FOR_OTHER_TEAMS) {
@@ -1224,6 +_,13 @@ @@ -1126,6 +_,13 @@
if (this.isInvulnerableTo(level, damageSource)) { if (this.isInvulnerableTo(level, damageSource)) {
return false; return false;
} else { } else {
@@ -54,7 +54,7 @@
Entity entity = damageSource.getEntity(); Entity entity = damageSource.getEntity();
if (!( // Paper - split the if statement. If below statement is false, hurtServer would not have been evaluated. Return false. if (!( // Paper - split the if statement. If below statement is false, hurtServer would not have been evaluated. Return false.
!(entity instanceof Player player && !this.canHarmPlayer(player)) !(entity instanceof Player player && !this.canHarmPlayer(player))
@@ -1453,6 +_,7 @@ @@ -1356,6 +_,7 @@
serverLevel.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); serverLevel.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
this.unsetRemoved(); this.unsetRemoved();
// CraftBukkit end // CraftBukkit end
@@ -62,7 +62,7 @@
this.setServerLevel(level); this.setServerLevel(level);
this.connection.internalTeleport(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); // CraftBukkit - use internal teleport without event this.connection.internalTeleport(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); // CraftBukkit - use internal teleport without event
this.connection.resetPosition(); this.connection.resetPosition();
@@ -1571,7 +_,7 @@ @@ -1473,7 +_,7 @@
new AABB(vec3.x() - 8.0, vec3.y() - 5.0, vec3.z() - 8.0, vec3.x() + 8.0, vec3.y() + 5.0, vec3.z() + 8.0), new AABB(vec3.x() - 8.0, vec3.y() - 5.0, vec3.z() - 8.0, vec3.x() + 8.0, vec3.y() + 5.0, vec3.z() + 8.0),
monster -> monster.isPreventingPlayerRest(this.serverLevel(), this) monster -> monster.isPreventingPlayerRest(this.serverLevel(), this)
); );
@@ -71,7 +71,7 @@
return Either.left(Player.BedSleepingProblem.NOT_SAFE); return Either.left(Player.BedSleepingProblem.NOT_SAFE);
} }
} }
@@ -1608,7 +_,19 @@ @@ -1510,7 +_,19 @@
CriteriaTriggers.SLEPT_IN_BED.trigger(this); CriteriaTriggers.SLEPT_IN_BED.trigger(this);
}); });
if (!this.serverLevel().canSleepThroughNights()) { if (!this.serverLevel().canSleepThroughNights()) {
@@ -92,7 +92,7 @@
} }
((ServerLevel)this.level()).updateSleepingPlayerList(); ((ServerLevel)this.level()).updateSleepingPlayerList();
@@ -1716,6 +_,7 @@ @@ -1602,6 +_,7 @@
@Override @Override
public void openTextEdit(SignBlockEntity signEntity, boolean isFrontText) { public void openTextEdit(SignBlockEntity signEntity, boolean isFrontText) {
@@ -100,7 +100,7 @@
this.connection.send(new ClientboundBlockUpdatePacket(this.level(), signEntity.getBlockPos())); this.connection.send(new ClientboundBlockUpdatePacket(this.level(), signEntity.getBlockPos()));
this.connection.send(new ClientboundOpenSignEditorPacket(signEntity.getBlockPos(), isFrontText)); this.connection.send(new ClientboundOpenSignEditorPacket(signEntity.getBlockPos(), isFrontText));
} }
@@ -2021,6 +_,26 @@ @@ -1904,6 +_,26 @@
this.lastSentExp = -1; // CraftBukkit - Added to reset this.lastSentExp = -1; // CraftBukkit - Added to reset
} }
@@ -127,7 +127,7 @@
@Override @Override
public void displayClientMessage(Component chatComponent, boolean actionBar) { public void displayClientMessage(Component chatComponent, boolean actionBar) {
this.sendSystemMessage(chatComponent, actionBar); this.sendSystemMessage(chatComponent, actionBar);
@@ -2242,6 +_,20 @@ @@ -2121,6 +_,20 @@
); );
} }
@@ -148,7 +148,7 @@
public void sendSystemMessage(Component mesage) { public void sendSystemMessage(Component mesage) {
this.sendSystemMessage(mesage, false); this.sendSystemMessage(mesage, false);
} }
@@ -2380,7 +_,67 @@ @@ -2259,7 +_,67 @@
public void resetLastActionTime() { public void resetLastActionTime() {
this.lastActionTime = Util.getMillis(); this.lastActionTime = Util.getMillis();
@@ -217,7 +217,7 @@
public ServerStatsCounter getStats() { public ServerStatsCounter getStats() {
return this.stats; return this.stats;
@@ -3085,4 +_,56 @@ @@ -2887,4 +_,56 @@
return (org.bukkit.craftbukkit.entity.CraftPlayer) super.getBukkitEntity(); return (org.bukkit.craftbukkit.entity.CraftPlayer) super.getBukkitEntity();
} }
// CraftBukkit end // CraftBukkit end

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/ServerPlayerGameMode.java --- a/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -351,6 +_,7 @@ @@ -347,6 +_,7 @@
} }
return false; return false;
} }
@@ -8,7 +8,7 @@
} }
// CraftBukkit end // CraftBukkit end
@@ -464,6 +_,7 @@ @@ -460,6 +_,7 @@
public InteractionHand interactHand; public InteractionHand interactHand;
public ItemStack interactItemStack; public ItemStack interactItemStack;
public InteractionResult useItemOn(ServerPlayer player, Level level, ItemStack stack, InteractionHand hand, BlockHitResult hitResult) { public InteractionResult useItemOn(ServerPlayer player, Level level, ItemStack stack, InteractionHand hand, BlockHitResult hitResult) {
@@ -16,7 +16,7 @@
BlockPos blockPos = hitResult.getBlockPos(); BlockPos blockPos = hitResult.getBlockPos();
BlockState blockState = level.getBlockState(blockPos); BlockState blockState = level.getBlockState(blockPos);
boolean cancelledBlock = false; boolean cancelledBlock = false;
@@ -506,7 +_,7 @@ @@ -502,7 +_,7 @@
boolean flag = !player.getMainHandItem().isEmpty() || !player.getOffhandItem().isEmpty(); boolean flag = !player.getMainHandItem().isEmpty() || !player.getOffhandItem().isEmpty();
boolean flag1 = player.isSecondaryUseActive() && flag; boolean flag1 = player.isSecondaryUseActive() && flag;
ItemStack itemStack = stack.copy(); ItemStack itemStack = stack.copy();
@@ -25,7 +25,7 @@
InteractionResult interactionResult = blockState.useItemOn(player.getItemInHand(hand), level, player, hand, hitResult); InteractionResult interactionResult = blockState.useItemOn(player.getItemInHand(hand), level, player, hand, hitResult);
if (interactionResult.consumesAction()) { if (interactionResult.consumesAction()) {
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(player, blockPos, itemStack); CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(player, blockPos, itemStack);
@@ -552,4 +_,18 @@ @@ -548,4 +_,18 @@
public void setLevel(ServerLevel serverLevel) { public void setLevel(ServerLevel serverLevel) {
this.level = serverLevel; this.level = serverLevel;
} }

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/WorldGenRegion.java --- a/net/minecraft/server/level/WorldGenRegion.java
+++ b/net/minecraft/server/level/WorldGenRegion.java +++ b/net/minecraft/server/level/WorldGenRegion.java
@@ -312,6 +_,7 @@ @@ -284,6 +_,7 @@
return true; return true;
} else { } else {
// Paper start - Buffer OOB setBlock calls // Paper start - Buffer OOB setBlock calls

View File

@@ -33,20 +33,17 @@
if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) { if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) {
int i = (int)(Util.getMillis() - this.keepAliveTime); int i = (int)(Util.getMillis() - this.keepAliveTime);
this.latency = (this.latency * 3 + i) / 4; this.latency = (this.latency * 3 + i) / 4;
@@ -159,6 +_,13 @@ @@ -159,6 +_,10 @@
ServerGamePacketListenerImpl.LOGGER.error("Couldn't register custom payload", ex); ServerGamePacketListenerImpl.LOGGER.error("Couldn't register custom payload", ex);
this.disconnect(Component.literal("Invalid payload REGISTER!"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause this.disconnect(Component.literal("Invalid payload REGISTER!"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
} }
+ // Purpur start - Purpur client support + // Purpur start - Purpur client support
+ } else if (identifier.equals(PURPUR_CLIENT)) { + } else if (identifier.equals(PURPUR_CLIENT)) {
+ try { + player.purpurClient = true;
+ player.purpurClient = true;
+ } catch (Exception ignore) {
+ }
+ // Purpur end - Purpur client support + // Purpur end - Purpur client support
} else if (identifier.equals(ServerCommonPacketListenerImpl.CUSTOM_UNREGISTER)) { } else if (identifier.equals(ServerCommonPacketListenerImpl.CUSTOM_UNREGISTER)) {
try { try {
String channels = payload.toString(com.google.common.base.Charsets.UTF_8); String channels = payload.toString(java.nio.charset.StandardCharsets.UTF_8);
@@ -238,6 +_,22 @@ @@ -238,6 +_,22 @@
// Paper start - give clients a longer time to respond to pings as per pre 1.12.2 timings // Paper start - give clients a longer time to respond to pings as per pre 1.12.2 timings
// This should effectively place the keepalive handling back to "as it was" before 1.12.2 // This should effectively place the keepalive handling back to "as it was" before 1.12.2

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -328,6 +_,20 @@ @@ -321,6 +_,20 @@
this.tickEndEvent = new io.papermc.paper.event.packet.ClientTickEndEvent(player.getBukkitEntity()); // Paper - add client tick end event this.tickEndEvent = new io.papermc.paper.event.packet.ClientTickEndEvent(player.getBukkitEntity()); // Paper - add client tick end event
} }
@@ -21,7 +21,7 @@
@Override @Override
public void tick() { public void tick() {
if (this.ackBlockChangesUpTo > -1) { if (this.ackBlockChangesUpTo > -1) {
@@ -386,6 +_,12 @@ @@ -379,6 +_,12 @@
if (this.player.getLastActionTime() > 0L if (this.player.getLastActionTime() > 0L
&& this.server.getPlayerIdleTimeout() > 0 && this.server.getPlayerIdleTimeout() > 0
&& Util.getMillis() - this.player.getLastActionTime() > this.server.getPlayerIdleTimeout() * 1000L * 60L && !this.player.wonGame) { // Paper - Prevent AFK kick while watching end credits && Util.getMillis() - this.player.getLastActionTime() > this.server.getPlayerIdleTimeout() * 1000L * 60L && !this.player.wonGame) { // Paper - Prevent AFK kick while watching end credits
@@ -34,7 +34,7 @@
this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854 this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
this.disconnect(Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause this.disconnect(Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause
} }
@@ -631,6 +_,8 @@ @@ -615,6 +_,8 @@
this.lastYaw = to.getYaw(); this.lastYaw = to.getYaw();
this.lastPitch = to.getPitch(); this.lastPitch = to.getPitch();
@@ -43,7 +43,7 @@
Location oldTo = to.clone(); Location oldTo = to.clone();
PlayerMoveEvent event = new PlayerMoveEvent(player, from, to); PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
this.cserver.getPluginManager().callEvent(event); this.cserver.getPluginManager().callEvent(event);
@@ -711,6 +_,7 @@ @@ -671,6 +_,7 @@
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (packet.getId() == this.awaitingTeleport) { if (packet.getId() == this.awaitingTeleport) {
if (this.awaitingPositionFromClient == null) { if (this.awaitingPositionFromClient == null) {
@@ -51,7 +51,7 @@
this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause
return; return;
} }
@@ -1179,6 +_,10 @@ @@ -1199,6 +_,10 @@
final int maxBookPageSize = pageMax.intValue(); final int maxBookPageSize = pageMax.intValue();
final double multiplier = Math.clamp(io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.totalMultiplier, 0.3D, 1D); final double multiplier = Math.clamp(io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.totalMultiplier, 0.3D, 1D);
long byteAllowed = maxBookPageSize; long byteAllowed = maxBookPageSize;
@@ -62,7 +62,7 @@
for (final String page : pageList) { for (final String page : pageList) {
final int byteLength = page.getBytes(java.nio.charset.StandardCharsets.UTF_8).length; final int byteLength = page.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
byteTotal += byteLength; byteTotal += byteLength;
@@ -1203,7 +_,8 @@ @@ -1223,7 +_,8 @@
} }
if (byteTotal > byteAllowed) { if (byteTotal > byteAllowed) {
@@ -72,7 +72,7 @@
this.disconnectAsync(Component.literal("Book too large!"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause // Paper - add proper async disconnect this.disconnectAsync(Component.literal("Book too large!"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause // Paper - add proper async disconnect
return; return;
} }
@@ -1222,31 +_,45 @@ @@ -1242,31 +_,45 @@
Optional<String> optional = packet.title(); Optional<String> optional = packet.title();
optional.ifPresent(list::add); optional.ifPresent(list::add);
list.addAll(packet.pages()); list.addAll(packet.pages());
@@ -82,9 +82,9 @@
+ // Purpur end - Allow color codes in books + // Purpur end - Allow color codes in books
Consumer<List<FilteredText>> consumer = optional.isPresent() Consumer<List<FilteredText>> consumer = optional.isPresent()
- ? texts -> this.signBook(texts.get(0), texts.subList(1, texts.size()), slot) - ? texts -> this.signBook(texts.get(0), texts.subList(1, texts.size()), slot)
- : texts -> this.updateBookContents(texts, slot); - : list1 -> this.updateBookContents(list1, slot);
+ ? texts -> this.signBook(texts.get(0), texts.subList(1, texts.size()), slot, hasSignPerm) // Purpur - Allow color codes in books + ? texts -> this.signBook(texts.get(0), texts.subList(1, texts.size()), slot, hasSignPerm) // Purpur - Allow color codes in books
+ : texts -> this.updateBookContents(texts, slot, hasEditPerm); // Purpur - Allow color codes in books + : list1 -> this.updateBookContents(list1, slot, hasEditPerm); // Purpur - Allow color codes in books
this.filterTextPacket(list).thenAcceptAsync(consumer, this.server); this.filterTextPacket(list).thenAcceptAsync(consumer, this.server);
} }
} }
@@ -122,7 +122,7 @@
itemStack.set( itemStack.set(
DataComponents.WRITTEN_BOOK_CONTENT, DataComponents.WRITTEN_BOOK_CONTENT,
new WrittenBookContent(this.filterableFromOutgoing(title), this.player.getName().getString(), 0, list, true) new WrittenBookContent(this.filterableFromOutgoing(title), this.player.getName().getString(), 0, list, true)
@@ -1260,6 +_,16 @@ @@ -1280,6 +_,16 @@
return this.player.isTextFilteringEnabled() ? Filterable.passThrough(filteredText.filteredOrEmpty()) : Filterable.from(filteredText); return this.player.isTextFilteringEnabled() ? Filterable.passThrough(filteredText.filteredOrEmpty()) : Filterable.from(filteredText);
} }
@@ -139,7 +139,7 @@
@Override @Override
public void handleEntityTagQuery(ServerboundEntityTagQueryPacket packet) { public void handleEntityTagQuery(ServerboundEntityTagQueryPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@@ -1295,7 +_,15 @@ @@ -1315,7 +_,15 @@
@Override @Override
public void handleMovePlayer(ServerboundMovePlayerPacket packet) { public void handleMovePlayer(ServerboundMovePlayerPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@@ -156,39 +156,39 @@
this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause
} else { } else {
ServerLevel serverLevel = this.player.serverLevel(); ServerLevel serverLevel = this.player.serverLevel();
@@ -1470,7 +_,7 @@ @@ -1496,7 +_,7 @@
movedWrongly = true; movedWrongly = true;
if (event.getLogWarning()) if (event.getLogWarning())
// Paper end // Paper end
- LOGGER.warn("{} moved wrongly!", this.player.getName().getString()); - LOGGER.warn("{} moved wrongly!", this.player.getName().getString());
+ LOGGER.warn("{} moved wrongly!, ({})", this.player.getName().getString(), verticalDelta); // Purpur - AFK API + LOGGER.warn("{} moved wrongly!, ({})", this.player.getName().getString(), verticalDelta); // Purpur - AFK API
} // Paper } // Paper
}
@@ -1536,6 +_,8 @@
this.lastYaw = to.getYaw();
this.lastPitch = to.getPitch();
+ if (!to.getWorld().getUID().equals(from.getWorld().getUID()) || to.getBlockX() != from.getBlockX() || to.getBlockY() != from.getBlockY() || to.getBlockZ() != from.getBlockZ() || to.getYaw() != from.getYaw() || to.getPitch() != from.getPitch()) this.player.resetLastActionTime(); // Purpur - AFK API
+
Location oldTo = to.clone();
PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
this.cserver.getPluginManager().callEvent(event);
@@ -1592,6 +_,13 @@
this.player.tryResetCurrentImpulseContext();
} }
+ // Purpur start - Dont run with scissors! @@ -1552,6 +_,8 @@
+ if (this.player.serverLevel().purpurConfig.dontRunWithScissors && this.player.isSprinting() && !(this.player.serverLevel().purpurConfig.ignoreScissorsInWater && this.player.isInWater()) && !(this.player.serverLevel().purpurConfig.ignoreScissorsInLava && this.player.isInLava()) && (isScissors(this.player.getItemInHand(InteractionHand.MAIN_HAND)) || isScissors(this.player.getItemInHand(InteractionHand.OFF_HAND))) && (int) (Math.random() * 10) == 0) { this.lastYaw = to.getYaw();
+ this.player.hurtServer(this.player.serverLevel(), this.player.damageSources().scissors(), (float) this.player.serverLevel().purpurConfig.scissorsRunningDamage); this.lastPitch = to.getPitch();
+ if (!org.purpurmc.purpur.PurpurConfig.dontRunWithScissors.isBlank()) this.player.sendActionBarMessage(org.purpurmc.purpur.PurpurConfig.dontRunWithScissors);
+ } + if (!to.getWorld().getUID().equals(from.getWorld().getUID()) || to.getBlockX() != from.getBlockX() || to.getBlockY() != from.getBlockY() || to.getBlockZ() != from.getBlockZ() || to.getYaw() != from.getYaw() || to.getPitch() != from.getPitch()) this.player.resetLastActionTime(); // Purpur - AFK API
+ // Purpur end - Dont run with scissors!
+ +
this.player.checkMovementStatistics(this.player.getX() - x, this.player.getY() - y, this.player.getZ() - z); Location oldTo = to.clone();
this.lastGoodX = this.player.getX(); PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
this.lastGoodY = this.player.getY(); this.cserver.getPluginManager().callEvent(event);
@@ -1640,6 +_,17 @@ @@ -1607,6 +_,13 @@
this.player.tryResetCurrentImpulseContext();
}
+ // Purpur start - Dont run with scissors!
+ if (this.player.serverLevel().purpurConfig.dontRunWithScissors && this.player.isSprinting() && !(this.player.serverLevel().purpurConfig.ignoreScissorsInWater && this.player.isInWater()) && !(this.player.serverLevel().purpurConfig.ignoreScissorsInLava && this.player.isInLava()) && (isScissors(this.player.getItemInHand(InteractionHand.MAIN_HAND)) || isScissors(this.player.getItemInHand(InteractionHand.OFF_HAND))) && (int) (Math.random() * 10) == 0) {
+ this.player.hurtServer(this.player.serverLevel(), this.player.damageSources().scissors(), (float) this.player.serverLevel().purpurConfig.scissorsRunningDamage);
+ if (!org.purpurmc.purpur.PurpurConfig.dontRunWithScissors.isBlank()) this.player.sendActionBarMessage(org.purpurmc.purpur.PurpurConfig.dontRunWithScissors);
+ }
+ // Purpur end - Dont run with scissors!
+
this.player.checkMovementStatistics(this.player.getX() - x, this.player.getY() - y, this.player.getZ() - z);
this.lastGoodX = this.player.getX();
this.lastGoodY = this.player.getY();
@@ -1657,6 +_,17 @@
} }
} }
@@ -203,10 +203,10 @@
+ } + }
+ // Purpur end - Dont run with scissors! + // Purpur end - Dont run with scissors!
+ +
// Paper start - optimise out extra getCubes private boolean isPlayerCollidingWithAnythingNew(LevelReader level, AABB box, double x, double y, double z) {
private boolean hasNewCollision(final ServerLevel level, final Entity entity, final AABB oldBox, final AABB newBox) { AABB aabb = this.player.getBoundingBox().move(x - this.player.getX(), y - this.player.getY(), z - this.player.getZ());
final List<AABB> collisionsBB = new java.util.ArrayList<>(); Iterable<VoxelShape> collisions = level.getCollisions(this.player, aabb.deflate(1.0E-5F));
@@ -2010,6 +_,7 @@ @@ -2000,6 +_,7 @@
boolean cancelled; boolean cancelled;
if (hitResult == null || hitResult.getType() != HitResult.Type.BLOCK) { if (hitResult == null || hitResult.getType() != HitResult.Type.BLOCK) {
@@ -214,7 +214,7 @@
org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_AIR, itemInHand, hand); org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_AIR, itemInHand, hand);
cancelled = event.useItemInHand() == Event.Result.DENY; cancelled = event.useItemInHand() == Event.Result.DENY;
} else { } else {
@@ -2751,6 +_,7 @@ @@ -2672,6 +_,7 @@
AABB boundingBox = target.getBoundingBox(); AABB boundingBox = target.getBoundingBox();
if (this.player.canInteractWithEntity(boundingBox, io.papermc.paper.configuration.GlobalConfiguration.get().misc.clientInteractionLeniencyDistance.or(3.0))) { // Paper - configurable lenience value for interact range if (this.player.canInteractWithEntity(boundingBox, io.papermc.paper.configuration.GlobalConfiguration.get().misc.clientInteractionLeniencyDistance.or(3.0))) { // Paper - configurable lenience value for interact range

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java --- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -307,7 +_,7 @@ @@ -308,7 +_,7 @@
ServerLoginPacketListenerImpl.LOGGER.warn("Failed to verify username but will let them in anyway!"); ServerLoginPacketListenerImpl.LOGGER.warn("Failed to verify username but will let them in anyway!");
ServerLoginPacketListenerImpl.this.startClientVerification(ServerLoginPacketListenerImpl.this.createOfflineProfile(string1)); // Spigot ServerLoginPacketListenerImpl.this.startClientVerification(ServerLoginPacketListenerImpl.this.createOfflineProfile(string1)); // Spigot
} else { } else {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/players/PlayerList.java --- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java
@@ -396,6 +_,7 @@ @@ -400,6 +_,7 @@
scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam); scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam);
} }
// Paper end - Configurable player collision // Paper end - Configurable player collision
@@ -8,15 +8,15 @@
PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", player.getName().getString(), loggableAddress, player.getId(), serverLevel.serverLevelData.getLevelName(), player.getX(), player.getY(), player.getZ()); PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", player.getName().getString(), loggableAddress, player.getId(), serverLevel.serverLevelData.getLevelName(), player.getX(), player.getY(), player.getZ());
// Paper start - Send empty chunk, so players aren't stuck in the world loading screen with our chunk system not sending chunks when dead // Paper start - Send empty chunk, so players aren't stuck in the world loading screen with our chunk system not sending chunks when dead
if (player.isDeadOrDying()) { if (player.isDeadOrDying()) {
@@ -501,6 +_,7 @@ @@ -504,6 +_,7 @@
} }
public net.kyori.adventure.text.Component remove(ServerPlayer player, net.kyori.adventure.text.Component leaveMessage) { public @Nullable net.kyori.adventure.text.Component remove(ServerPlayer player, net.kyori.adventure.text.Component leaveMessage) {
// Paper end - Fix kick event leave message not being sent // Paper end - Fix kick event leave message not being sent
+ org.purpurmc.purpur.task.BossBarTask.removeFromAll(player.getBukkitEntity()); // Purpur - Implement TPSBar + org.purpurmc.purpur.task.BossBarTask.removeFromAll(player.getBukkitEntity()); // Purpur - Implement TPSBar
ServerLevel serverLevel = player.serverLevel(); ServerLevel serverLevel = player.serverLevel();
player.awardStat(Stats.LEAVE_GAME); player.awardStat(Stats.LEAVE_GAME);
// CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it // CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it
@@ -665,7 +_,7 @@ @@ -662,7 +_,7 @@
// return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameProfile) // return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameProfile)
// ? Component.translatable("multiplayer.disconnect.server_full") // ? Component.translatable("multiplayer.disconnect.server_full")
// : null; // : null;
@@ -25,7 +25,7 @@
event.disallow(org.bukkit.event.player.PlayerLoginEvent.Result.KICK_FULL, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.serverFullMessage)); // Spigot // Paper - Adventure event.disallow(org.bukkit.event.player.PlayerLoginEvent.Result.KICK_FULL, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.serverFullMessage)); // Spigot // Paper - Adventure
} }
} }
@@ -919,6 +_,20 @@ @@ -920,6 +_,20 @@
} }
} }
@@ -46,7 +46,7 @@
public void broadcastAll(Packet<?> packet, ResourceKey<Level> dimension) { public void broadcastAll(Packet<?> packet, ResourceKey<Level> dimension) {
for (ServerPlayer serverPlayer : this.players) { for (ServerPlayer serverPlayer : this.players) {
if (serverPlayer.level().dimension() == dimension) { if (serverPlayer.level().dimension() == dimension) {
@@ -1002,6 +_,7 @@ @@ -1004,6 +_,7 @@
} else { } else {
b = (byte)(24 + permLevel); b = (byte)(24 + permLevel);
} }

View File

@@ -0,0 +1,10 @@
--- a/net/minecraft/stats/ServerRecipeBook.java
+++ b/net/minecraft/stats/ServerRecipeBook.java
@@ -133,6 +_,7 @@
private void loadRecipes(List<ResourceKey<Recipe<?>>> recipes, Consumer<ResourceKey<Recipe<?>>> output, Predicate<ResourceKey<Recipe<?>>> isRecognized) {
for (ResourceKey<Recipe<?>> resourceKey : recipes) {
if (!isRecognized.test(resourceKey)) {
+ if (!org.purpurmc.purpur.PurpurConfig.loggerSuppressUnrecognizedRecipeErrors) // Purpur - Logger settings (suppressing pointless logs)
LOGGER.error("Tried to load unrecognized recipe: {} removed now.", resourceKey);
} else {
output.accept(resourceKey);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/damagesource/CombatTracker.java --- a/net/minecraft/world/damagesource/CombatTracker.java
+++ b/net/minecraft/world/damagesource/CombatTracker.java +++ b/net/minecraft/world/damagesource/CombatTracker.java
@@ -54,7 +_,7 @@ @@ -55,7 +_,7 @@
private Component getMessageForAssistedFall(Entity entity, Component entityDisplayName, String hasWeaponTranslationKey, String noWeaponTranslationKey) { private Component getMessageForAssistedFall(Entity entity, Component entityDisplayName, String hasWeaponTranslationKey, String noWeaponTranslationKey) {
ItemStack itemStack = entity instanceof LivingEntity livingEntity ? livingEntity.getMainHandItem() : ItemStack.EMPTY; ItemStack itemStack = entity instanceof LivingEntity livingEntity ? livingEntity.getMainHandItem() : ItemStack.EMPTY;
@@ -9,7 +9,7 @@
? Component.translatable(hasWeaponTranslationKey, this.mob.getDisplayName(), entityDisplayName, itemStack.getDisplayName()) ? Component.translatable(hasWeaponTranslationKey, this.mob.getDisplayName(), entityDisplayName, itemStack.getDisplayName())
: Component.translatable(noWeaponTranslationKey, this.mob.getDisplayName(), entityDisplayName); : Component.translatable(noWeaponTranslationKey, this.mob.getDisplayName(), entityDisplayName);
} }
@@ -98,6 +_,15 @@ @@ -99,6 +_,15 @@
Component component = ComponentUtils.wrapInSquareBrackets(Component.translatable(string + ".link")).withStyle(INTENTIONAL_GAME_DESIGN_STYLE); Component component = ComponentUtils.wrapInSquareBrackets(Component.translatable(string + ".link")).withStyle(INTENTIONAL_GAME_DESIGN_STYLE);
return Component.translatable(string + ".message", this.mob.getDisplayName(), component); return Component.translatable(string + ".message", this.mob.getDisplayName(), component);
} else { } else {

View File

@@ -1,27 +1,25 @@
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java
@@ -136,7 +_,7 @@ @@ -141,6 +_,7 @@
import org.slf4j.Logger; import org.jetbrains.annotations.Contract;
public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, ScoreHolder, ca.spottedleaf.moonrise.patches.chunk_system.entity.ChunkSystemEntity, ca.spottedleaf.moonrise.patches.entity_tracker.EntityTrackerEntity { // Paper - rewrite chunk system // Paper - optimise entity tracker public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, ScoreHolder, DataComponentGetter {
-
+ public static javax.script.ScriptEngine scriptEngine = new javax.script.ScriptEngineManager().getEngineByName("rhino"); // Purpur - Configurable entity base attributes + public static javax.script.ScriptEngine scriptEngine = new javax.script.ScriptEngineManager().getEngineByName("rhino"); // Purpur - Configurable entity base attributes
// CraftBukkit start // CraftBukkit start
private static final org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger();
private static final int CURRENT_LEVEL = 2; private static final int CURRENT_LEVEL = 2;
public boolean preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported; keep initial motion on first setPositionRotation @@ -303,8 +_,9 @@
@@ -253,9 +_,10 @@
public double xOld; public double xOld;
public double yOld; public double yOld;
public double zOld; public double zOld;
+ public float maxUpStep; // Purpur - Add option to set armorstand step height + public float maxUpStep; // Purpur - Add option to set armorstand step height
public boolean noPhysics; public boolean noPhysics;
private boolean wasOnFire;
- public final RandomSource random = SHARED_RANDOM; // Paper - Share random for entities to make them more random - public final RandomSource random = SHARED_RANDOM; // Paper - Share random for entities to make them more random
+ public final RandomSource random; // Paper - Share random for entities to make them more random // Add toggle for RNG manipulation + public final RandomSource random; // Paper - Share random for entities to make them more random // Add toggle for RNG manipulation
public int tickCount; public int tickCount;
private int remainingFireTicks = -this.getFireImmuneTicks(); private int remainingFireTicks = -this.getFireImmuneTicks();
public boolean wasTouchingWater; public boolean wasTouchingWater;
@@ -289,8 +_,8 @@ @@ -338,8 +_,8 @@
public PortalProcessor portalProcess; public PortalProcessor portalProcess;
public int portalCooldown; public int portalCooldown;
private boolean invulnerable; private boolean invulnerable;
@@ -32,7 +30,7 @@
private boolean hasGlowingTag; private boolean hasGlowingTag;
private final Set<String> tags = new io.papermc.paper.util.SizeLimitedSet<>(new it.unimi.dsi.fastutil.objects.ObjectOpenHashSet<>(), MAX_ENTITY_TAG_COUNT); // Paper - fully limit tag size - replace set impl private final Set<String> tags = new io.papermc.paper.util.SizeLimitedSet<>(new it.unimi.dsi.fastutil.objects.ObjectOpenHashSet<>(), MAX_ENTITY_TAG_COUNT); // Paper - fully limit tag size - replace set impl
private final double[] pistonDeltas = new double[]{0.0, 0.0, 0.0}; private final double[] pistonDeltas = new double[]{0.0, 0.0, 0.0};
@@ -343,6 +_,7 @@ @@ -393,6 +_,7 @@
public long activatedTick = Integer.MIN_VALUE; public long activatedTick = Integer.MIN_VALUE;
public boolean isTemporarilyActive; public boolean isTemporarilyActive;
public long activatedImmunityTick = Integer.MIN_VALUE; public long activatedImmunityTick = Integer.MIN_VALUE;
@@ -40,9 +38,9 @@
public void inactiveTick() { public void inactiveTick() {
} }
@@ -523,10 +_,21 @@ @@ -405,10 +_,21 @@
} }
// Paper end - optimise entity tracker // Paper end
+ // Purpur start - Add canSaveToDisk to Entity + // Purpur start - Add canSaveToDisk to Entity
+ public boolean canSaveToDisk() { + public boolean canSaveToDisk() {
@@ -62,7 +60,7 @@
this.position = Vec3.ZERO; this.position = Vec3.ZERO;
this.blockPosition = BlockPos.ZERO; this.blockPosition = BlockPos.ZERO;
this.chunkPosition = ChunkPos.ZERO; this.chunkPosition = ChunkPos.ZERO;
@@ -905,6 +_,7 @@ @@ -778,6 +_,7 @@
&& this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> this.getY() >= v) && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> this.getY() >= v)
&& (!(this instanceof Player player) || !player.getAbilities().invulnerable))) { && (!(this instanceof Player player) || !player.getAbilities().invulnerable))) {
// Paper end - Configurable nether ceiling damage // Paper end - Configurable nether ceiling damage
@@ -70,7 +68,7 @@
this.onBelowWorld(); this.onBelowWorld();
} }
} }
@@ -1827,7 +_,7 @@ @@ -1681,7 +_,7 @@
} }
public boolean fireImmune() { public boolean fireImmune() {
@@ -78,8 +76,8 @@
+ return this.immuneToFire != null ? immuneToFire : this.getType().fireImmune(); // Purpur - add fire immune API + return this.immuneToFire != null ? immuneToFire : this.getType().fireImmune(); // Purpur - add fire immune API
} }
public boolean causeFallDamage(float fallDistance, float multiplier, DamageSource source) { public boolean causeFallDamage(double fallDistance, float damageMultiplier, DamageSource damageSource) {
@@ -1896,7 +_,7 @@ @@ -1747,7 +_,7 @@
return this.isInWater() || flag; return this.isInWater() || flag;
} }
@@ -88,7 +86,7 @@
if (this.getVehicle() instanceof AbstractBoat abstractBoat && !abstractBoat.isUnderWater()) { if (this.getVehicle() instanceof AbstractBoat abstractBoat && !abstractBoat.isUnderWater()) {
this.wasTouchingWater = false; this.wasTouchingWater = false;
} else if (this.updateFluidHeightAndDoFluidPushing(FluidTags.WATER, 0.014)) { } else if (this.updateFluidHeightAndDoFluidPushing(FluidTags.WATER, 0.014)) {
@@ -2522,6 +_,13 @@ @@ -2369,6 +_,13 @@
compound.putBoolean("Paper.FreezeLock", true); compound.putBoolean("Paper.FreezeLock", true);
} }
// Paper end // Paper end
@@ -100,10 +98,10 @@
+ // Purpur end - Fire immune API + // Purpur end - Fire immune API
+ +
return compound; return compound;
} catch (Throwable var9) { } catch (Throwable var8) {
CrashReport crashReport = CrashReport.forThrowable(var9, "Saving entity NBT"); CrashReport crashReport = CrashReport.forThrowable(var8, "Saving entity NBT");
@@ -2671,6 +_,13 @@ @@ -2486,6 +_,13 @@
freezeLocked = compound.getBoolean("Paper.FreezeLock"); freezeLocked = compound.getBooleanOr("Paper.FreezeLock", false);
} }
// Paper end // Paper end
+ +
@@ -113,10 +111,10 @@
+ } + }
+ // Purpur end - Fire immune API + // Purpur end - Fire immune API
+ +
} catch (Throwable var17) { } catch (Throwable var8) {
CrashReport crashReport = CrashReport.forThrowable(var17, "Loading entity NBT"); CrashReport crashReport = CrashReport.forThrowable(var8, "Loading entity NBT");
CrashReportCategory crashReportCategory = crashReport.addCategory("Entity being loaded"); CrashReportCategory crashReportCategory = crashReport.addCategory("Entity being loaded");
@@ -2917,6 +_,7 @@ @@ -2625,6 +_,7 @@
if (this.isAlive() && this instanceof Leashable leashable) { if (this.isAlive() && this instanceof Leashable leashable) {
if (leashable.getLeashHolder() == player) { if (leashable.getLeashHolder() == player) {
if (!this.level().isClientSide()) { if (!this.level().isClientSide()) {
@@ -124,7 +122,7 @@
// CraftBukkit start - fire PlayerUnleashEntityEvent // CraftBukkit start - fire PlayerUnleashEntityEvent
// Paper start - Expand EntityUnleashEvent // Paper start - Expand EntityUnleashEvent
org.bukkit.event.player.PlayerUnleashEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerUnleashEntityEvent(this, player, hand, !player.hasInfiniteMaterials()); org.bukkit.event.player.PlayerUnleashEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerUnleashEntityEvent(this, player, hand, !player.hasInfiniteMaterials());
@@ -3242,15 +_,18 @@ @@ -2941,15 +_,18 @@
return Vec3.directionFromRotation(this.getRotationVector()); return Vec3.directionFromRotation(this.getRotationVector());
} }
@@ -144,7 +142,7 @@
} }
} }
} }
@@ -3455,7 +_,7 @@ @@ -3154,7 +_,7 @@
} }
public int getMaxAirSupply() { public int getMaxAirSupply() {
@@ -153,7 +151,7 @@
} }
public int getAirSupply() { public int getAirSupply() {
@@ -3950,7 +_,7 @@ @@ -3682,7 +_,7 @@
// CraftBukkit end // CraftBukkit end
public boolean canUsePortal(boolean allowPassengers) { public boolean canUsePortal(boolean allowPassengers) {
@@ -162,7 +160,7 @@
} }
public boolean canTeleport(Level fromLevel, Level toLevel) { public boolean canTeleport(Level fromLevel, Level toLevel) {
@@ -4482,6 +_,12 @@ @@ -4217,6 +_,12 @@
return Mth.lerp(partialTick, this.yRotO, this.yRot); return Mth.lerp(partialTick, this.yRotO, this.yRot);
} }
@@ -172,10 +170,10 @@
+ } + }
+ // Purpur end - Stop squids floating on top of water + // Purpur end - Stop squids floating on top of water
+ +
// Paper start - optimise collisions public boolean updateFluidHeightAndDoFluidPushing(TagKey<Fluid> fluidTag, double motionScale) {
public boolean updateFluidHeightAndDoFluidPushing(final TagKey<Fluid> fluid, final double flowScale) {
if (this.touchingUnloadedChunk()) { if (this.touchingUnloadedChunk()) {
@@ -4880,7 +_,7 @@ return false;
@@ -4557,7 +_,7 @@
} }
public float maxUpStep() { public float maxUpStep() {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/EntityType.java --- a/net/minecraft/world/entity/EntityType.java
+++ b/net/minecraft/world/entity/EntityType.java +++ b/net/minecraft/world/entity/EntityType.java
@@ -1083,6 +_,16 @@ @@ -1095,6 +_,16 @@
return register(vanillaEntityId(key), builder); return register(vanillaEntityId(key), builder);
} }
@@ -17,7 +17,7 @@
public static ResourceLocation getKey(EntityType<?> entityType) { public static ResourceLocation getKey(EntityType<?> entityType) {
return BuiltInRegistries.ENTITY_TYPE.getKey(entityType); return BuiltInRegistries.ENTITY_TYPE.getKey(entityType);
} }
@@ -1312,6 +_,16 @@ @@ -1325,6 +_,16 @@
return this.category; return this.category;
} }
@@ -34,17 +34,14 @@
public String getDescriptionId() { public String getDescriptionId() {
return this.descriptionId; return this.descriptionId;
} }
@@ -1370,7 +_,14 @@ @@ -1384,7 +_,11 @@
entity.load(tag); entity.load(tag);
}, },
// Paper end - Don't fire sync event during generation // Paper end - Don't fire sync event during generation
- () -> LOGGER.warn("Skipping Entity with id {}", tag.getString("id")) - () -> LOGGER.warn("Skipping Entity with id {}", tag.getStringOr("id", "[invalid]"))
+ // Purpur start - log skipped entity's position + // Purpur start - log skipped entity's position
+ () -> {LOGGER.warn("Skipping Entity with id {}", tag.getString("id")); + () -> {LOGGER.warn("Skipping Entity with id {}", tag.getStringOr("id", "[invalid]"));
+ try { + EntityType.LOGGER.warn("Location: {} {}", level.getWorld().getName(), tag.read("Pos", net.minecraft.world.phys.Vec3.CODEC).orElse(net.minecraft.world.phys.Vec3.ZERO));
+ ListTag pos = tag.getList("Pos", 6);
+ EntityType.LOGGER.warn("Location: {} {},{},{}", level.getWorld().getName(), pos.getDouble(0), pos.getDouble(1), pos.getDouble(2));
+ } catch (Throwable ignore) {}
+ } + }
+ // Purpur end - log skipped entity's position + // Purpur end - log skipped entity's position
); );

View File

@@ -1,15 +1,15 @@
--- a/net/minecraft/world/entity/ExperienceOrb.java --- a/net/minecraft/world/entity/ExperienceOrb.java
+++ b/net/minecraft/world/entity/ExperienceOrb.java +++ b/net/minecraft/world/entity/ExperienceOrb.java
@@ -323,7 +_,7 @@ @@ -328,7 +_,7 @@
public void playerTouch(Player entity) { public void playerTouch(Player entity) {
if (entity instanceof ServerPlayer serverPlayer) { if (entity instanceof ServerPlayer serverPlayer) {
if (entity.takeXpDelay == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(serverPlayer.getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper - PlayerPickupExperienceEvent if (entity.takeXpDelay == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(serverPlayer.getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper - PlayerPickupExperienceEvent
- entity.takeXpDelay = CraftEventFactory.callPlayerXpCooldownEvent(entity, 2, PlayerExpCooldownChangeEvent.ChangeReason.PICKUP_ORB).getNewCooldown(); // CraftBukkit - entityhuman.takeXpDelay = 2; - entity.takeXpDelay = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerXpCooldownEvent(entity, 2, org.bukkit.event.player.PlayerExpCooldownChangeEvent.ChangeReason.PICKUP_ORB).getNewCooldown(); // CraftBukkit - entityhuman.takeXpDelay = 2;
+ entity.takeXpDelay = CraftEventFactory.callPlayerXpCooldownEvent(entity, this.level().purpurConfig.playerExpPickupDelay, PlayerExpCooldownChangeEvent.ChangeReason.PICKUP_ORB).getNewCooldown(); // CraftBukkit - entityhuman.takeXpDelay = 2; // Purpur - Configurable player pickup exp delay + entity.takeXpDelay = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerXpCooldownEvent(entity, this.level().purpurConfig.playerExpPickupDelay, org.bukkit.event.player.PlayerExpCooldownChangeEvent.ChangeReason.PICKUP_ORB).getNewCooldown(); // CraftBukkit - entityhuman.takeXpDelay = 2; // Purpur - Configurable player pickup exp delay
entity.take(this, 1); entity.take(this, 1);
int i = this.repairPlayerItems(serverPlayer, this.value); int i = this.repairPlayerItems(serverPlayer, this.getValue());
if (i > 0) { if (i > 0) {
@@ -339,7 +_,7 @@ @@ -344,7 +_,7 @@
} }
private int repairPlayerItems(ServerPlayer player, int value) { private int repairPlayerItems(ServerPlayer player, int value) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/GlowSquid.java --- a/net/minecraft/world/entity/GlowSquid.java
+++ b/net/minecraft/world/entity/GlowSquid.java +++ b/net/minecraft/world/entity/GlowSquid.java
@@ -25,6 +_,13 @@ @@ -26,6 +_,13 @@
super(entityType, level); super(entityType, level);
} }

View File

@@ -1,37 +1,32 @@
--- a/net/minecraft/world/entity/LivingEntity.java --- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java
@@ -459,6 +_,12 @@ @@ -430,6 +_,12 @@
if (d < 0.0) { if (d < 0.0) {
double damagePerBlock = this.level().getWorldBorder().getDamagePerBlock(); double damagePerBlock = serverLevel1.getWorldBorder().getDamagePerBlock();
if (damagePerBlock > 0.0) { if (damagePerBlock > 0.0) {
+ // Purpur start - Add option to teleport to spawn if outside world border + // Purpur start - Add option to teleport to spawn if outside world border
+ if (this.level().purpurConfig.teleportIfOutsideBorder && this instanceof ServerPlayer serverPlayer) { + if (this.level().purpurConfig.teleportIfOutsideBorder && this instanceof ServerPlayer serverPlayer) {
+ serverPlayer.teleport(io.papermc.paper.util.MCUtil.toLocation(this.level(), this.level().getSharedSpawnPos())); + serverPlayer.teleport(io.papermc.paper.util.MCUtil.toLocation(this.level(), this.level().getSharedSpawnPos()));
+ return; + return;
+ } + }
+ // Purpur end - Add option to teleport to spawn if outside world border + // Purpur end - Add option to teleport to spawn if outside world border
this.hurtServer(serverLevel1, this.damageSources().outOfBorder(), Math.max(1, Mth.floor(-d * damagePerBlock))); this.hurtServer(serverLevel1, this.damageSources().outOfBorder(), Math.max(1, Mth.floor(-d * damagePerBlock)));
}
} }
@@ -472,7 +_,7 @@ }
@@ -442,10 +_,10 @@
&& (!flag || !((Player)this).getAbilities().invulnerable); && (!flag || !((Player)this).getAbilities().invulnerable);
if (flag1) { if (flag1) {
this.setAirSupply(this.decreaseAirSupply(this.getAirSupply())); this.setAirSupply(this.decreaseAirSupply(this.getAirSupply()));
- if (this.getAirSupply() == -20) { - if (this.getAirSupply() == -20) {
+ if (this.getAirSupply() == -this.level().purpurConfig.drowningDamageInterval) { // Purpur - Drowning Settings + if (this.getAirSupply() == -this.level().purpurConfig.drowningDamageInterval) { // Purpur - Drowning Settings
this.setAirSupply(0); this.setAirSupply(0);
Vec3 deltaMovement = this.getDeltaMovement(); serverLevel1.broadcastEntityEvent(this, (byte)67);
- this.hurtServer(serverLevel1, this.damageSources().drown(), 2.0F);
@@ -492,7 +_,7 @@ + this.hurtServer(serverLevel1, this.damageSources().drown(), (float) this.level().purpurConfig.damageFromDrowning); // Purpur - Drowning Settings
);
}
- this.hurt(this.damageSources().drown(), 2.0F);
+ this.hurt(this.damageSources().drown(), (float) this.level().purpurConfig.damageFromDrowning); // Purpur - Drowning Settings
} }
} else if (this.getAirSupply() < this.getMaxAirSupply()) { } else if (this.getAirSupply() < this.getMaxAirSupply()) {
this.setAirSupply(this.increaseAirSupply(this.getAirSupply())); this.setAirSupply(this.increaseAirSupply(this.getAirSupply()));
@@ -1009,14 +_,32 @@ @@ -1014,14 +_,32 @@
if (lookingEntity != null) { if (lookingEntity != null) {
ItemStack itemBySlot = this.getItemBySlot(EquipmentSlot.HEAD); ItemStack itemBySlot = this.getItemBySlot(EquipmentSlot.HEAD);
EntityType<?> type = lookingEntity.getType(); EntityType<?> type = lookingEntity.getType();
@@ -72,7 +67,7 @@
return d; return d;
} }
@@ -1063,6 +_,7 @@ @@ -1068,6 +_,7 @@
Iterator<MobEffectInstance> iterator = this.activeEffects.values().iterator(); Iterator<MobEffectInstance> iterator = this.activeEffects.values().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
MobEffectInstance effect = iterator.next(); MobEffectInstance effect = iterator.next();
@@ -80,7 +75,7 @@
EntityPotionEffectEvent event = CraftEventFactory.callEntityPotionEffectChangeEvent(this, effect, null, cause, EntityPotionEffectEvent.Action.CLEARED); EntityPotionEffectEvent event = CraftEventFactory.callEntityPotionEffectChangeEvent(this, effect, null, cause, EntityPotionEffectEvent.Action.CLEARED);
if (event.isCancelled()) { if (event.isCancelled()) {
continue; continue;
@@ -1372,6 +_,24 @@ @@ -1385,6 +_,24 @@
this.stopSleeping(); this.stopSleeping();
} }
@@ -105,27 +100,26 @@
this.noActionTime = 0; this.noActionTime = 0;
if (amount < 0.0F) { if (amount < 0.0F) {
amount = 0.0F; amount = 0.0F;
@@ -1536,11 +_,11 @@ @@ -1647,10 +_,10 @@
protected Player resolvePlayerResponsibleForDamage(DamageSource damageSource) { protected Player resolvePlayerResponsibleForDamage(DamageSource damageSource) {
Entity entity = damageSource.getEntity(); Entity entity = damageSource.getEntity();
if (entity instanceof Player player) { if (entity instanceof Player player) {
- this.lastHurtByPlayerTime = 100; - this.setLastHurtByPlayer(player, 100);
+ this.lastHurtByPlayerTime = this.level().purpurConfig.mobLastHurtByPlayerTime; // Purpur - Config for mob last hurt by player time + this.setLastHurtByPlayer(player, this.level().purpurConfig.mobLastHurtByPlayerTime); // Purpur - Config for mob last hurt by player time
this.lastHurtByPlayer = player;
return player;
} else if (entity instanceof Wolf wolf && wolf.isTame()) { } else if (entity instanceof Wolf wolf && wolf.isTame()) {
- this.lastHurtByPlayerTime = 100; if (wolf.getOwnerReference() != null) {
+ this.lastHurtByPlayerTime = this.level().purpurConfig.mobLastHurtByPlayerTime; // Purpur - Config for mob last hurt by player time - this.setLastHurtByPlayer(wolf.getOwnerReference().getUUID(), 100);
if (wolf.getOwner() instanceof Player player1) { + this.setLastHurtByPlayer(wolf.getOwnerReference().getUUID(), this.level().purpurConfig.mobLastHurtByPlayerTime); // Purpur - Config for mob last hurt by player time
this.lastHurtByPlayer = player1;
} else { } else {
@@ -1594,6 +_,18 @@ this.lastHurtByPlayer = null;
this.lastHurtByPlayerMemoryTime = 0;
@@ -1701,6 +_,18 @@
} }
} }
+ // Purpur start - Totems work in inventory + // Purpur start - Totems work in inventory
+ if (level().purpurConfig.totemOfUndyingWorksInInventory && this instanceof ServerPlayer player && (itemStack == null || itemStack.getItem() != Items.TOTEM_OF_UNDYING) && player.getBukkitEntity().hasPermission("purpur.inventory_totem")) { + if (level().purpurConfig.totemOfUndyingWorksInInventory && this instanceof ServerPlayer player && (itemStack == null || itemStack.getItem() != Items.TOTEM_OF_UNDYING) && player.getBukkitEntity().hasPermission("purpur.inventory_totem")) {
+ for (ItemStack item : player.getInventory().items) { + for (ItemStack item : player.getInventory().getNonEquipmentItems()) {
+ if (item.getItem() == Items.TOTEM_OF_UNDYING) { + if (item.getItem() == Items.TOTEM_OF_UNDYING) {
+ itemInHand = item; + itemInHand = item;
+ itemStack = item.copy(); + itemStack = item.copy();
@@ -138,15 +132,15 @@
final org.bukkit.inventory.EquipmentSlot handSlot = (hand != null) ? org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand) : null; final org.bukkit.inventory.EquipmentSlot handSlot = (hand != null) ? org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand) : null;
final EntityResurrectEvent event = new EntityResurrectEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), handSlot); final EntityResurrectEvent event = new EntityResurrectEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), handSlot);
event.setCancelled(itemStack == null); event.setCancelled(itemStack == null);
@@ -1790,6 +_,7 @@ @@ -1876,6 +_,7 @@
boolean flag = this.lastHurtByPlayerTime > 0; boolean flag = this.lastHurtByPlayerMemoryTime > 0;
this.dropEquipment(level); // CraftBukkit - from below this.dropEquipment(level); // CraftBukkit - from below
if (this.shouldDropLoot() && level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { if (this.shouldDropLoot() && level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
+ if (!(damageSource.is(net.minecraft.world.damagesource.DamageTypes.CRAMMING) && level().purpurConfig.disableDropsOnCrammingDeath)) { // Purpur - Disable loot drops on death by cramming + if (!(damageSource.is(net.minecraft.world.damagesource.DamageTypes.CRAMMING) && level().purpurConfig.disableDropsOnCrammingDeath)) { // Purpur - Disable loot drops on death by cramming
this.dropFromLootTable(level, damageSource, flag); this.dropFromLootTable(level, damageSource, flag);
// Paper start // Paper start
final boolean prev = this.clearEquipmentSlots; final boolean prev = this.clearEquipmentSlots;
@@ -1798,6 +_,7 @@ @@ -1884,6 +_,7 @@
// Paper end // Paper end
this.dropCustomDeathLoot(level, damageSource, flag); this.dropCustomDeathLoot(level, damageSource, flag);
this.clearEquipmentSlots = prev; // Paper this.clearEquipmentSlots = prev; // Paper
@@ -154,7 +148,7 @@
} }
// CraftBukkit start - Call death event // Paper start - call advancement triggers with correct entity equipment // CraftBukkit start - Call death event // Paper start - call advancement triggers with correct entity equipment
@@ -2996,6 +_,7 @@ @@ -3058,6 +_,7 @@
float f = (float)(d * 10.0 - 3.0); float f = (float)(d * 10.0 - 3.0);
if (f > 0.0F) { if (f > 0.0F) {
this.playSound(this.getFallDamageSound((int)f), 1.0F, 1.0F); this.playSound(this.getFallDamageSound((int)f), 1.0F, 1.0F);
@@ -162,7 +156,7 @@
this.hurt(this.damageSources().flyIntoWall(), f); this.hurt(this.damageSources().flyIntoWall(), f);
} }
} }
@@ -4423,6 +_,12 @@ @@ -4452,6 +_,12 @@
? slot == EquipmentSlot.MAINHAND && this.canUseSlot(EquipmentSlot.MAINHAND) ? slot == EquipmentSlot.MAINHAND && this.canUseSlot(EquipmentSlot.MAINHAND)
: slot == equippable.slot() && this.canUseSlot(equippable.slot()) && equippable.canBeEquippedBy(this.getType()); : slot == equippable.slot() && this.canUseSlot(equippable.slot()) && equippable.canBeEquippedBy(this.getType());
} }

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/Mob.java --- a/net/minecraft/world/entity/Mob.java
+++ b/net/minecraft/world/entity/Mob.java +++ b/net/minecraft/world/entity/Mob.java
@@ -145,6 +_,7 @@ @@ -136,6 +_,7 @@
private BlockPos restrictCenter = BlockPos.ZERO; private BlockPos restrictCenter = BlockPos.ZERO;
private float restrictRadius = -1.0F; private float restrictRadius = -1.0F;
public boolean aware = true; // CraftBukkit public boolean aware = true; // CraftBukkit
@@ -8,7 +8,7 @@
protected Mob(EntityType<? extends Mob> entityType, Level level) { protected Mob(EntityType<? extends Mob> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -294,6 +_,7 @@ @@ -281,6 +_,7 @@
target = null; target = null;
} }
} }
@@ -16,7 +16,7 @@
this.target = target; this.target = target;
return true; return true;
// CraftBukkit end // CraftBukkit end
@@ -337,7 +_,27 @@ @@ -324,7 +_,27 @@
} }
profilerFiller.pop(); profilerFiller.pop();
@@ -45,7 +45,7 @@
@Override @Override
protected void playHurtSound(DamageSource source) { protected void playHurtSound(DamageSource source) {
@@ -486,6 +_,7 @@ @@ -420,6 +_,7 @@
compound.putBoolean("NoAI", this.isNoAi()); compound.putBoolean("NoAI", this.isNoAi());
} }
compound.putBoolean("Bukkit.Aware", this.aware); // CraftBukkit compound.putBoolean("Bukkit.Aware", this.aware); // CraftBukkit
@@ -53,19 +53,15 @@
} }
@Override @Override
@@ -568,6 +_,11 @@ @@ -443,6 +_,7 @@
this.aware = compound.getBoolean("Bukkit.Aware"); this.lootTableSeed = compound.getLongOr("DeathLootTableSeed", 0L);
} this.setNoAi(compound.getBooleanOr("NoAI", false));
// CraftBukkit end this.aware = compound.getBooleanOr("Bukkit.Aware", true); // CraftBukkit
+ // Purpur start - Entity lifespan + this.ticksSinceLastInteraction = compound.getIntOr("Purpur.ticksSinceLastInteraction", 0); // Purpur- Entity lifespan
+ if (compound.contains("Purpur.ticksSinceLastInteraction")) {
+ this.ticksSinceLastInteraction = compound.getInt("Purpur.ticksSinceLastInteraction");
+ }
+ // Purpur end - Entity lifespan
} }
@Override @Override
@@ -1282,7 +_,7 @@ @@ -1167,7 +_,7 @@
); );
} }
@@ -74,7 +70,7 @@
return spawnGroupData; return spawnGroupData;
} }
@@ -1621,6 +_,7 @@ @@ -1499,6 +_,7 @@
this.playAttackSound(); this.playAttackSound();
} }

View File

@@ -0,0 +1,11 @@
--- a/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
+++ b/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
@@ -85,7 +_,7 @@
}
};
Set<Pair<Holder<PoiType>, BlockPos>> set = poiManager.findAllClosestFirstWithType(
- acquirablePois, predicate1, mob.blockPosition(), 48, PoiManager.Occupancy.HAS_SPACE
+ acquirablePois, predicate1, mob.blockPosition(), level.purpurConfig.villagerAcquirePoiSearchRadius, PoiManager.Occupancy.HAS_SPACE // Purpur - Configurable villager search radius
)
.limit(5L)
.filter(pair1 -> predicate.test(level, pair1.getSecond()))

View File

@@ -0,0 +1,11 @@
--- a/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
+++ b/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
@@ -54,7 +_,7 @@
}
};
Set<Pair<Holder<PoiType>, BlockPos>> set = poiManager.findAllWithType(
- holder -> holder.is(PoiTypes.HOME), predicate, entity.blockPosition(), 48, PoiManager.Occupancy.ANY
+ holder -> holder.is(PoiTypes.HOME), predicate, entity.blockPosition(), level.purpurConfig.villagerNearestBedSensorSearchRadius, PoiManager.Occupancy.ANY // Purpur - Configurable villager search radius
)
.collect(Collectors.toSet());
Path path = AcquirePoi.findPathToPois(entity, set);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ambient/Bat.java --- a/net/minecraft/world/entity/ambient/Bat.java
+++ b/net/minecraft/world/entity/ambient/Bat.java +++ b/net/minecraft/world/entity/ambient/Bat.java
@@ -231,7 +_,7 @@ @@ -232,7 +_,7 @@
} else { } else {
int maxLocalRawBrightness = level.getMaxLocalRawBrightness(pos); int maxLocalRawBrightness = level.getMaxLocalRawBrightness(pos);
int i = 4; int i = 4;
@@ -9,7 +9,7 @@
i = 7; i = 7;
} else if (randomSource.nextBoolean()) { } else if (randomSource.nextBoolean()) {
return false; return false;
@@ -243,6 +_,11 @@ @@ -244,6 +_,11 @@
} }
} }

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/Cow.java --- a/net/minecraft/world/entity/animal/AbstractCow.java
+++ b/net/minecraft/world/entity/animal/Cow.java +++ b/net/minecraft/world/entity/animal/AbstractCow.java
@@ -43,7 +_,7 @@ @@ -39,7 +_,7 @@
this.goalSelector.addGoal(0, new FloatGoal(this)); this.goalSelector.addGoal(0, new FloatGoal(this));
this.goalSelector.addGoal(1, new PanicGoal(this, 2.0)); this.goalSelector.addGoal(1, new PanicGoal(this, 2.0));
this.goalSelector.addGoal(2, new BreedGoal(this, 1.0)); this.goalSelector.addGoal(2, new BreedGoal(this, 1.0));
@@ -9,7 +9,7 @@
this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.25)); this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 1.0)); this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F)); this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F));
@@ -99,6 +_,10 @@ @@ -95,6 +_,10 @@
ItemStack itemStack = ItemUtils.createFilledResult(itemInHand, player, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getItemStack())); // CraftBukkit ItemStack itemStack = ItemUtils.createFilledResult(itemInHand, player, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getItemStack())); // CraftBukkit
player.setItemInHand(hand, itemStack); player.setItemInHand(hand, itemStack);
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
@@ -20,7 +20,7 @@
} else { } else {
return super.mobInteract(player, hand); return super.mobInteract(player, hand);
} }
@@ -114,4 +_,67 @@ @@ -104,4 +_,67 @@
public EntityDimensions getDefaultDimensions(Pose pose) { public EntityDimensions getDefaultDimensions(Pose pose) {
return this.isBaby() ? BABY_DIMENSIONS : super.getDefaultDimensions(pose); return this.isBaby() ? BABY_DIMENSIONS : super.getDefaultDimensions(pose);
} }
@@ -50,7 +50,7 @@
+ } + }
+ return InteractionResult.CONSUME; // require 5 mushrooms to transform (prevents mushroom duping) + return InteractionResult.CONSUME; // require 5 mushrooms to transform (prevents mushroom duping)
+ } + }
+ MushroomCow mooshroom = EntityType.MOOSHROOM.create(level(), EntitySpawnReason.CONVERSION); + MushroomCow mooshroom = EntityType.MOOSHROOM.create(level(), net.minecraft.world.entity.EntitySpawnReason.CONVERSION);
+ if (mooshroom == null) { + if (mooshroom == null) {
+ return InteractionResult.PASS; + return InteractionResult.PASS;
+ } + }
@@ -59,7 +59,7 @@
+ } else { + } else {
+ mooshroom.setVariant(MushroomCow.Variant.RED); + mooshroom.setVariant(MushroomCow.Variant.RED);
+ } + }
+ mooshroom.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); + mooshroom.snapTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
+ mooshroom.setHealth(this.getHealth()); + mooshroom.setHealth(this.getHealth());
+ mooshroom.setAge(getAge()); + mooshroom.setAge(getAge());
+ mooshroom.copyPosition(this); + mooshroom.copyPosition(this);
@@ -79,7 +79,7 @@
+ stack.shrink(1); + stack.shrink(1);
+ } + }
+ for (int i = 0; i < 15; ++i) { + for (int i = 0; i < 15; ++i) {
+ ((ServerLevel) level()).sendParticlesSource(((ServerLevel) level()).players(), null, net.minecraft.core.particles.ParticleTypes.HAPPY_VILLAGER, + ((net.minecraft.server.level.ServerLevel) level()).sendParticlesSource(((net.minecraft.server.level.ServerLevel) level()).players(), null, net.minecraft.core.particles.ParticleTypes.HAPPY_VILLAGER,
+ false, true, + false, true,
+ getX() + random.nextFloat(), getY() + (random.nextFloat() * 2), getZ() + random.nextFloat(), 1, + getX() + random.nextFloat(), getY() + (random.nextFloat() * 2), getZ() + random.nextFloat(), 1,
+ random.nextGaussian() * 0.05D, random.nextGaussian() * 0.05D, random.nextGaussian() * 0.05D, 0); + random.nextGaussian() * 0.05D, random.nextGaussian() * 0.05D, random.nextGaussian() * 0.05D, 0);

View File

@@ -14,10 +14,10 @@
AgeableMob breedOffspring = this.getBreedOffspring(level, mate); AgeableMob breedOffspring = this.getBreedOffspring(level, mate);
if (breedOffspring != null) { if (breedOffspring != null) {
- breedOffspring.setBaby(true); - breedOffspring.setBaby(true);
- breedOffspring.moveTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F); - breedOffspring.snapTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F);
+ //breedOffspring.setBaby(true); // Purpur - Add adjustable breeding cooldown to config - moved down + //breedOffspring.setBaby(true); // Purpur - Add adjustable breeding cooldown to config - moved down
+ //breedOffspring.moveTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F); // Purpur - Add adjustable breeding cooldown to config - moved down + //breedOffspring.snapTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F); // Purpur - Add adjustable breeding cooldown to config - moved down
// CraftBukkit start - call EntityBreedEvent // CraftBukkit start - Call EntityBreedEvent
ServerPlayer breeder = Optional.ofNullable(this.getLoveCause()).or(() -> Optional.ofNullable(mate.getLoveCause())).orElse(null); ServerPlayer breeder = Optional.ofNullable(this.getLoveCause()).or(() -> Optional.ofNullable(mate.getLoveCause())).orElse(null);
+ // Purpur start - Add adjustable breeding cooldown to config + // Purpur start - Add adjustable breeding cooldown to config
+ if (breeder != null && level.purpurConfig.animalBreedingCooldownSeconds > 0) { + if (breeder != null && level.purpurConfig.animalBreedingCooldownSeconds > 0) {
@@ -27,7 +27,7 @@
+ level.addBreedingCooldown(breeder.getUUID(), this.getClass()); + level.addBreedingCooldown(breeder.getUUID(), this.getClass());
+ } + }
+ breedOffspring.setBaby(true); + breedOffspring.setBaby(true);
+ breedOffspring.moveTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F); + breedOffspring.snapTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F);
+ // Purpur end - Add adjustable breeding cooldown to config + // Purpur end - Add adjustable breeding cooldown to config
int experience = this.getRandom().nextInt(7) + 1; int experience = this.getRandom().nextInt(7) + 1;
org.bukkit.event.entity.EntityBreedEvent entityBreedEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(breedOffspring, this, mate, breeder, this.breedItem, experience); org.bukkit.event.entity.EntityBreedEvent entityBreedEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(breedOffspring, this, mate, breeder, this.breedItem, experience);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/Bee.java --- a/net/minecraft/world/entity/animal/Bee.java
+++ b/net/minecraft/world/entity/animal/Bee.java +++ b/net/minecraft/world/entity/animal/Bee.java
@@ -163,7 +_,7 @@ @@ -167,7 +_,7 @@
// Paper end - Fix MC-167279 // Paper end - Fix MC-167279
this.lookControl = new Bee.BeeLookControl(this); this.lookControl = new Bee.BeeLookControl(this);
this.setPathfindingMalus(PathType.DANGER_FIRE, -1.0F); this.setPathfindingMalus(PathType.DANGER_FIRE, -1.0F);
@@ -13,8 +13,8 @@
} }
public static boolean isNightOrRaining(Level level) { public static boolean isNightOrRaining(Level level) {
- return level.dimensionType().hasSkyLight() && (level.isNight() || level.isRaining()); - return level.dimensionType().hasSkyLight() && (level.isDarkOutside() || level.isRaining());
+ return level.dimensionType().hasSkyLight() && (level.isNight() && !level.purpurConfig.beeCanWorkAtNight || level.isRaining() && !level.purpurConfig.beeCanWorkInRain); // Purpur - Bee can work when raining or at night + return level.dimensionType().hasSkyLight() && (level.isDarkOutside() && !level.purpurConfig.beeCanWorkAtNight || level.isRaining() && !level.purpurConfig.beeCanWorkInRain); // Purpur - Bee can work when raining or at night
} }
public void setStayOutOfHiveCountdown(int stayOutOfHiveCountdown) { public void setStayOutOfHiveCountdown(int stayOutOfHiveCountdown) {
@@ -22,8 +22,8 @@
@Override @Override
protected void customServerAiStep(ServerLevel level) { protected void customServerAiStep(ServerLevel level) {
boolean hasStung = this.hasStung(); boolean hasStung = this.hasStung();
- if (this.isInWaterOrBubble()) { - if (this.isInWater()) {
+ if (this.level().purpurConfig.beeCanInstantlyStartDrowning && this.isInWaterOrBubble()) { // Purpur - bee can instantly start drowning in water option + if (this.level().purpurConfig.beeCanInstantlyStartDrowning && this.isInWater()) { // Purpur - bee can instantly start drowning in water option
this.underWaterTicks++; this.underWaterTicks++;
} else { } else {
this.underWaterTicks = 0; this.underWaterTicks = 0;
@@ -35,7 +35,7 @@
if (hasStung) { if (hasStung) {
this.timeSinceSting++; this.timeSinceSting++;
if (this.timeSinceSting % 5 == 0 && this.random.nextInt(Mth.clamp(1200 - this.timeSinceSting, 1, 1200)) == 0) { if (this.timeSinceSting % 5 == 0 && this.random.nextInt(Mth.clamp(1200 - this.timeSinceSting, 1, 1200)) == 0) {
@@ -1136,6 +_,7 @@ @@ -1135,6 +_,7 @@
Bee.this.savedFlowerPos = optional.get(); Bee.this.savedFlowerPos = optional.get();
Bee.this.navigation Bee.this.navigation
.moveTo(Bee.this.savedFlowerPos.getX() + 0.5, Bee.this.savedFlowerPos.getY() + 0.5, Bee.this.savedFlowerPos.getZ() + 0.5, 1.2F); .moveTo(Bee.this.savedFlowerPos.getX() + 0.5, Bee.this.savedFlowerPos.getY() + 0.5, Bee.this.savedFlowerPos.getZ() + 0.5, 1.2F);
@@ -43,7 +43,7 @@
return true; return true;
} else { } else {
Bee.this.remainingCooldownBeforeLocatingNewFlower = Mth.nextInt(Bee.this.random, 20, 60); Bee.this.remainingCooldownBeforeLocatingNewFlower = Mth.nextInt(Bee.this.random, 20, 60);
@@ -1182,6 +_,7 @@ @@ -1181,6 +_,7 @@
this.pollinating = false; this.pollinating = false;
Bee.this.navigation.stop(); Bee.this.navigation.stop();
Bee.this.remainingCooldownBeforeLocatingNewFlower = 200; Bee.this.remainingCooldownBeforeLocatingNewFlower = 200;
@@ -51,7 +51,7 @@
} }
@Override @Override
@@ -1228,6 +_,7 @@ @@ -1227,6 +_,7 @@
this.setWantedPos(); this.setWantedPos();
} }

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/Cat.java --- a/net/minecraft/world/entity/animal/Cat.java
+++ b/net/minecraft/world/entity/animal/Cat.java +++ b/net/minecraft/world/entity/animal/Cat.java
@@ -332,6 +_,14 @@ @@ -353,6 +_,14 @@
return this.isTame() && otherAnimal instanceof Cat cat && cat.isTame() && super.canMate(otherAnimal); return this.isTame() && otherAnimal instanceof Cat cat && cat.isTame() && super.canMate(otherAnimal);
} }
@@ -15,7 +15,7 @@
@Nullable @Nullable
@Override @Override
public SpawnGroupData finalizeSpawn( public SpawnGroupData finalizeSpawn(
@@ -438,7 +_,7 @@ @@ -451,7 +_,7 @@
} }
private void tryToTame(Player player) { private void tryToTame(Player player) {

View File

@@ -1,14 +1,14 @@
--- a/net/minecraft/world/entity/animal/Dolphin.java --- a/net/minecraft/world/entity/animal/Dolphin.java
+++ b/net/minecraft/world/entity/animal/Dolphin.java +++ b/net/minecraft/world/entity/animal/Dolphin.java
@@ -71,6 +_,7 @@ @@ -73,6 +_,7 @@
private static final int TOTAL_MOISTNESS_LEVEL = 2400; private static final boolean DEFAULT_GOT_FISH = false;
public static final Predicate<ItemEntity> ALLOWED_ITEMS = itemEntity -> !itemEntity.hasPickUpDelay() && itemEntity.isAlive() && itemEntity.isInWater(); @Nullable
public static final float BABY_SCALE = 0.65F; public BlockPos treasurePos;
+ private boolean isNaturallyAggressiveToPlayers; // Purpur - Dolphins naturally aggressive to players chance + private boolean isNaturallyAggressiveToPlayers; // Purpur - Dolphins naturally aggressive to players chance
public Dolphin(EntityType<? extends Dolphin> entityType, Level level) { public Dolphin(EntityType<? extends Dolphin> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -87,6 +_,7 @@ @@ -89,6 +_,7 @@
this.setAirSupply(this.getMaxAirSupply()); this.setAirSupply(this.getMaxAirSupply());
this.setXRot(0.0F); this.setXRot(0.0F);
SpawnGroupData spawnGroupData1 = Objects.requireNonNullElseGet(spawnGroupData, () -> new AgeableMob.AgeableMobGroupData(0.1F)); SpawnGroupData spawnGroupData1 = Objects.requireNonNullElseGet(spawnGroupData, () -> new AgeableMob.AgeableMobGroupData(0.1F));
@@ -16,7 +16,7 @@
return super.finalizeSpawn(level, difficulty, spawnReason, spawnGroupData1); return super.finalizeSpawn(level, difficulty, spawnReason, spawnGroupData1);
} }
@@ -169,17 +_,19 @@ @@ -155,17 +_,19 @@
protected void registerGoals() { protected void registerGoals() {
this.goalSelector.addGoal(0, new BreathAirGoal(this)); this.goalSelector.addGoal(0, new BreathAirGoal(this));
this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); this.goalSelector.addGoal(0, new TryFindWaterGoal(this));
@@ -37,7 +37,7 @@
} }
public static AttributeSupplier.Builder createAttributes() { public static AttributeSupplier.Builder createAttributes() {
@@ -412,6 +_,7 @@ @@ -398,6 +_,7 @@
@Override @Override
public boolean canUse() { public boolean canUse() {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/Fox.java --- a/net/minecraft/world/entity/animal/Fox.java
+++ b/net/minecraft/world/entity/animal/Fox.java +++ b/net/minecraft/world/entity/animal/Fox.java
@@ -335,6 +_,11 @@ @@ -345,6 +_,11 @@
} }
private void setTargetGoals() { private void setTargetGoals() {
@@ -12,15 +12,15 @@
if (this.getVariant() == Fox.Variant.RED) { if (this.getVariant() == Fox.Variant.RED) {
this.targetSelector.addGoal(4, this.landTargetGoal); this.targetSelector.addGoal(4, this.landTargetGoal);
this.targetSelector.addGoal(4, this.turtleEggTargetGoal); this.targetSelector.addGoal(4, this.turtleEggTargetGoal);
@@ -364,6 +_,7 @@ @@ -372,6 +_,7 @@
@Override
public void setVariant(Fox.Variant variant) { public void setVariant(Fox.Variant variant) {
this.entityData.set(DATA_TYPE_ID, variant.getId()); this.entityData.set(DATA_TYPE_ID, variant.getId());
+ this.setTargetGoals(); // Purpur - Tulips change fox type - fix API bug not updating pathfinders on type change + this.setTargetGoals(); // Purpur - Tulips change fox type - fix API bug not updating pathfinders on type change
} }
List<UUID> getTrustedUUIDs() { @Nullable
@@ -684,6 +_,29 @@ @@ -705,6 +_,29 @@
return slot == EquipmentSlot.MAINHAND; return slot == EquipmentSlot.MAINHAND;
} }
// Paper end // Paper end

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/IronGolem.java --- a/net/minecraft/world/entity/animal/IronGolem.java
+++ b/net/minecraft/world/entity/animal/IronGolem.java +++ b/net/minecraft/world/entity/animal/IronGolem.java
@@ -56,13 +_,26 @@ @@ -57,13 +_,26 @@
private int remainingPersistentAngerTime; private int remainingPersistentAngerTime;
@Nullable @Nullable
private UUID persistentAngerTarget; private UUID persistentAngerTarget;
@@ -27,23 +27,23 @@
this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.0, true)); this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.0, true));
this.goalSelector.addGoal(2, new MoveTowardsTargetGoal(this, 0.9, 32.0F)); this.goalSelector.addGoal(2, new MoveTowardsTargetGoal(this, 0.9, 32.0F));
this.goalSelector.addGoal(2, new MoveBackToVillageGoal(this, 0.6, false)); this.goalSelector.addGoal(2, new MoveBackToVillageGoal(this, 0.6, false));
@@ -140,6 +_,7 @@ @@ -141,6 +_,7 @@
public void addAdditionalSaveData(CompoundTag compound) { public void addAdditionalSaveData(CompoundTag compound) {
super.addAdditionalSaveData(compound); super.addAdditionalSaveData(compound);
compound.putBoolean("PlayerCreated", this.isPlayerCreated()); compound.putBoolean("PlayerCreated", this.isPlayerCreated());
+ if (getSummoner() != null) compound.putUUID("Purpur.Summoner", getSummoner()); // Purpur - Summoner API + compound.storeNullable("Purpur.Summoner", net.minecraft.core.UUIDUtil.CODEC, getSummoner()); // Purpur - Summoner API
this.addPersistentAngerSaveData(compound); this.addPersistentAngerSaveData(compound);
} }
@@ -147,6 +_,7 @@ @@ -148,6 +_,7 @@
public void readAdditionalSaveData(CompoundTag compound) { public void readAdditionalSaveData(CompoundTag compound) {
super.readAdditionalSaveData(compound); super.readAdditionalSaveData(compound);
this.setPlayerCreated(compound.getBoolean("PlayerCreated")); this.setPlayerCreated(compound.getBooleanOr("PlayerCreated", false));
+ if (compound.contains("Purpur.Summoner")) setSummoner(compound.getUUID("Purpur.Summoner")); // Purpur - Summoner API + this.setSummoner(compound.read("Purpur.Summoner", net.minecraft.core.UUIDUtil.CODEC).orElse(null)); // Purpur - Summoner API
this.readPersistentAngerSaveData(this.level(), compound); this.readPersistentAngerSaveData(this.level(), compound);
} }
@@ -266,6 +_,7 @@ @@ -267,6 +_,7 @@
float f = 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.2F; float f = 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.2F;
this.playSound(SoundEvents.IRON_GOLEM_REPAIR, 1.0F, f); this.playSound(SoundEvents.IRON_GOLEM_REPAIR, 1.0F, f);
itemInHand.consume(1, player); itemInHand.consume(1, player);

View File

@@ -1,15 +1,15 @@
--- a/net/minecraft/world/entity/animal/MushroomCow.java --- a/net/minecraft/world/entity/animal/MushroomCow.java
+++ b/net/minecraft/world/entity/animal/MushroomCow.java +++ b/net/minecraft/world/entity/animal/MushroomCow.java
@@ -192,6 +_,13 @@ @@ -198,6 +_,13 @@
level.playSound(null, this, SoundEvents.MOOSHROOM_SHEAR, soundSource, 1.0F, 1.0F); level.playSound(null, this, SoundEvents.MOOSHROOM_SHEAR, soundSource, 1.0F, 1.0F);
this.convertTo(EntityType.COW, ConversionParams.single(this, false, false), mob -> { this.convertTo(EntityType.COW, ConversionParams.single(this, false, false), cow -> {
level.sendParticles(ParticleTypes.EXPLOSION, this.getX(), this.getY(0.5), this.getZ(), 1, 0.0, 0.0, 0.0, 0.0); level.sendParticles(ParticleTypes.EXPLOSION, this.getX(), this.getY(0.5), this.getZ(), 1, 0.0, 0.0, 0.0, 0.0);
+ // Purpur start - Fix cow rotation when shearing mooshroom + // Purpur start - Fix cow rotation when shearing mooshroom
+ mob.copyPosition(this); + cow.copyPosition(this);
+ mob.yBodyRot = this.yBodyRot; + cow.yBodyRot = this.yBodyRot;
+ mob.setYHeadRot(this.getYHeadRot()); + cow.setYHeadRot(this.getYHeadRot());
+ mob.yRotO = this.yRotO; + cow.yRotO = this.yRotO;
+ mob.xRotO = this.xRotO; + cow.xRotO = this.xRotO;
+ // Purpur end - Fix cow rotation when shearing mooshroom + // Purpur end - Fix cow rotation when shearing mooshroom
// Paper start - custom shear drops; moved drop generation to separate method // Paper start - custom shear drops; moved drop generation to separate method
drops.forEach(drop -> { drops.forEach(drop -> {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/Ocelot.java --- a/net/minecraft/world/entity/animal/Ocelot.java
+++ b/net/minecraft/world/entity/animal/Ocelot.java +++ b/net/minecraft/world/entity/animal/Ocelot.java
@@ -232,7 +_,7 @@ @@ -233,7 +_,7 @@
public boolean checkSpawnObstruction(LevelReader level) { public boolean checkSpawnObstruction(LevelReader level) {
if (level.isUnobstructed(this) && !level.containsAnyLiquid(this.getBoundingBox())) { if (level.isUnobstructed(this) && !level.containsAnyLiquid(this.getBoundingBox())) {
BlockPos blockPos = this.blockPosition(); BlockPos blockPos = this.blockPosition();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/Parrot.java --- a/net/minecraft/world/entity/animal/Parrot.java
+++ b/net/minecraft/world/entity/animal/Parrot.java +++ b/net/minecraft/world/entity/animal/Parrot.java
@@ -152,6 +_,7 @@ @@ -157,6 +_,7 @@
protected void registerGoals() { protected void registerGoals() {
this.goalSelector.addGoal(0, new TamableAnimal.TamableAnimalPanicGoal(1.25)); this.goalSelector.addGoal(0, new TamableAnimal.TamableAnimalPanicGoal(1.25));
this.goalSelector.addGoal(0, new FloatGoal(this)); this.goalSelector.addGoal(0, new FloatGoal(this));
@@ -8,7 +8,7 @@
this.goalSelector.addGoal(1, new LookAtPlayerGoal(this, Player.class, 8.0F)); this.goalSelector.addGoal(1, new LookAtPlayerGoal(this, Player.class, 8.0F));
this.goalSelector.addGoal(2, new SitWhenOrderedToGoal(this)); this.goalSelector.addGoal(2, new SitWhenOrderedToGoal(this));
this.goalSelector.addGoal(2, new FollowOwnerGoal(this, 1.0, 5.0F, 1.0F)); this.goalSelector.addGoal(2, new FollowOwnerGoal(this, 1.0, 5.0F, 1.0F));
@@ -257,7 +_,7 @@ @@ -262,7 +_,7 @@
} }
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
@@ -17,7 +17,7 @@
this.tame(player); this.tame(player);
this.level().broadcastEntityEvent(this, (byte)7); this.level().broadcastEntityEvent(this, (byte)7);
} else { } else {
@@ -265,6 +_,7 @@ @@ -270,6 +_,7 @@
} }
} }
@@ -25,7 +25,7 @@
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
} else if (!itemInHand.is(ItemTags.PARROT_POISONOUS_FOOD)) { } else if (!itemInHand.is(ItemTags.PARROT_POISONOUS_FOOD)) {
if (!this.isFlying() && this.isTame() && this.isOwnedBy(player)) { if (!this.isFlying() && this.isTame() && this.isOwnedBy(player)) {
@@ -289,7 +_,7 @@ @@ -294,7 +_,7 @@
@Override @Override
public boolean isFood(ItemStack stack) { public boolean isFood(ItemStack stack) {
@@ -34,7 +34,7 @@
} }
public static boolean checkParrotSpawnRules( public static boolean checkParrotSpawnRules(
@@ -304,13 +_,13 @@ @@ -309,13 +_,13 @@
@Override @Override
public boolean canMate(Animal otherAnimal) { public boolean canMate(Animal otherAnimal) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/Pig.java --- a/net/minecraft/world/entity/animal/Pig.java
+++ b/net/minecraft/world/entity/animal/Pig.java +++ b/net/minecraft/world/entity/animal/Pig.java
@@ -132,6 +_,19 @@ @@ -141,6 +_,19 @@
@Override @Override
public InteractionResult mobInteract(Player player, InteractionHand hand) { public InteractionResult mobInteract(Player player, InteractionHand hand) {
boolean isFood = this.isFood(player.getItemInHand(hand)); boolean isFood = this.isFood(player.getItemInHand(hand));

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/Rabbit.java --- a/net/minecraft/world/entity/animal/Rabbit.java
+++ b/net/minecraft/world/entity/animal/Rabbit.java +++ b/net/minecraft/world/entity/animal/Rabbit.java
@@ -376,10 +_,23 @@ @@ -403,10 +_,23 @@
} }
this.setVariant(randomRabbitVariant); this.setVariant(randomRabbitVariant);

View File

@@ -1,9 +1,9 @@
--- a/net/minecraft/world/entity/animal/SnowGolem.java --- a/net/minecraft/world/entity/animal/SnowGolem.java
+++ b/net/minecraft/world/entity/animal/SnowGolem.java +++ b/net/minecraft/world/entity/animal/SnowGolem.java
@@ -44,15 +_,27 @@ @@ -45,15 +_,27 @@
public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackMob {
private static final EntityDataAccessor<Byte> DATA_PUMPKIN_ID = SynchedEntityData.defineId(SnowGolem.class, EntityDataSerializers.BYTE); private static final EntityDataAccessor<Byte> DATA_PUMPKIN_ID = SynchedEntityData.defineId(SnowGolem.class, EntityDataSerializers.BYTE);
private static final byte PUMPKIN_FLAG = 16; private static final byte PUMPKIN_FLAG = 16;
private static final boolean DEFAULT_PUMPKIN = true;
+ @Nullable private java.util.UUID summoner; // Purpur - Summoner API + @Nullable private java.util.UUID summoner; // Purpur - Summoner API
public SnowGolem(EntityType<? extends SnowGolem> entityType, Level level) { public SnowGolem(EntityType<? extends SnowGolem> entityType, Level level) {
@@ -30,23 +30,22 @@
this.goalSelector.addGoal(3, new LookAtPlayerGoal(this, Player.class, 6.0F)); this.goalSelector.addGoal(3, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); this.goalSelector.addGoal(4, new RandomLookAroundGoal(this));
this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Mob.class, 10, true, false, (entity, level) -> entity instanceof Enemy)); this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Mob.class, 10, true, false, (entity, level) -> entity instanceof Enemy));
@@ -72,6 +_,7 @@ @@ -73,12 +_,14 @@
public void addAdditionalSaveData(CompoundTag compound) { public void addAdditionalSaveData(CompoundTag compound) {
super.addAdditionalSaveData(compound); super.addAdditionalSaveData(compound);
compound.putBoolean("Pumpkin", this.hasPumpkin()); compound.putBoolean("Pumpkin", this.hasPumpkin());
+ if (getSummoner() != null) compound.putUUID("Purpur.Summoner", getSummoner()); // Purpur - Summoner API + compound.storeNullable("Purpur.Summoner", net.minecraft.core.UUIDUtil.CODEC, getSummoner()); // Purpur - Summoner API
} }
@Override @Override
@@ -80,6 +_,7 @@ public void readAdditionalSaveData(CompoundTag compound) {
if (compound.contains("Pumpkin")) { super.readAdditionalSaveData(compound);
this.setPumpkin(compound.getBoolean("Pumpkin")); this.setPumpkin(compound.getBooleanOr("Pumpkin", true));
} + this.setSummoner(compound.read("Purpur.Summoner", net.minecraft.core.UUIDUtil.CODEC).orElse(null)); // Purpur - Summoner API
+ if (compound.contains("Purpur.Summoner")) setSummoner(compound.getUUID("Purpur.Summoner")); // Purpur - Summoner API
} }
@Override @Override
@@ -153,6 +_,14 @@ @@ -152,6 +_,14 @@
} }
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;

View File

@@ -34,12 +34,12 @@
@@ -127,6 +_,7 @@ @@ -127,6 +_,7 @@
} }
if (this.isInWaterOrBubble()) { if (this.isInWater()) {
+ if (canFly()) setNoGravity(!wasTouchingWater); // Purpur - Flying squids! Oh my! + if (canFly()) setNoGravity(!wasTouchingWater); // Purpur - Flying squids! Oh my!
if (this.tentacleMovement < (float) Math.PI) { if (this.tentacleMovement < (float) Math.PI) {
float f = this.tentacleMovement / (float) Math.PI; float f = this.tentacleMovement / (float) Math.PI;
this.tentacleAngle = Mth.sin(f * f * (float) Math.PI) * (float) Math.PI * 0.25F; this.tentacleAngle = Mth.sin(f * f * (float) Math.PI) * (float) Math.PI * 0.25F;
@@ -310,7 +_,7 @@ @@ -308,7 +_,7 @@
int noActionTime = this.squid.getNoActionTime(); int noActionTime = this.squid.getNoActionTime();
if (noActionTime > 100) { if (noActionTime > 100) {
this.squid.movementVector = Vec3.ZERO; this.squid.movementVector = Vec3.ZERO;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/WaterAnimal.java --- a/net/minecraft/world/entity/animal/WaterAnimal.java
+++ b/net/minecraft/world/entity/animal/WaterAnimal.java +++ b/net/minecraft/world/entity/animal/WaterAnimal.java
@@ -74,8 +_,7 @@ @@ -76,8 +_,7 @@
seaLevel = level.getMinecraftWorld().paperConfig().entities.spawning.wateranimalSpawnHeight.maximum.or(seaLevel); seaLevel = level.getMinecraftWorld().paperConfig().entities.spawning.wateranimalSpawnHeight.maximum.or(seaLevel);
i = level.getMinecraftWorld().paperConfig().entities.spawning.wateranimalSpawnHeight.minimum.or(i); i = level.getMinecraftWorld().paperConfig().entities.spawning.wateranimalSpawnHeight.minimum.or(i);
// Paper end - Make water animal spawn height configurable // Paper end - Make water animal spawn height configurable

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/goat/Goat.java --- a/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/net/minecraft/world/entity/animal/goat/Goat.java +++ b/net/minecraft/world/entity/animal/goat/Goat.java
@@ -392,6 +_,7 @@ @@ -395,6 +_,7 @@
// Paper start - Goat ram API // Paper start - Goat ram API
public void ram(net.minecraft.world.entity.LivingEntity entity) { public void ram(net.minecraft.world.entity.LivingEntity entity) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/horse/Llama.java --- a/net/minecraft/world/entity/animal/horse/Llama.java
+++ b/net/minecraft/world/entity/animal/horse/Llama.java +++ b/net/minecraft/world/entity/animal/horse/Llama.java
@@ -72,6 +_,7 @@ @@ -77,6 +_,7 @@
private Llama caravanHead; private Llama caravanHead;
@Nullable @Nullable
public Llama caravanTail; // Paper public Llama caravanTail; // Paper
@@ -8,23 +8,23 @@
public Llama(EntityType<? extends Llama> entityType, Level level) { public Llama(EntityType<? extends Llama> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -106,6 +_,7 @@ @@ -111,6 +_,7 @@
super.addAdditionalSaveData(compound); super.addAdditionalSaveData(compound);
compound.putInt("Variant", this.getVariant().id); compound.store("Variant", Llama.Variant.LEGACY_CODEC, this.getVariant());
compound.putInt("Strength", this.getStrength()); compound.putInt("Strength", this.getStrength());
+ compound.putBoolean("Purpur.ShouldJoinCaravan", shouldJoinCaravan); // Purpur - Llama API + compound.putBoolean("Purpur.ShouldJoinCaravan", shouldJoinCaravan); // Purpur - Llama API
} }
@Override @Override
@@ -113,6 +_,7 @@ @@ -118,6 +_,7 @@
this.setStrength(compound.getInt("Strength")); this.setStrength(compound.getIntOr("Strength", 0));
super.readAdditionalSaveData(compound); super.readAdditionalSaveData(compound);
this.setVariant(Llama.Variant.byId(compound.getInt("Variant"))); this.setVariant(compound.read("Variant", Llama.Variant.LEGACY_CODEC).orElse(Llama.Variant.DEFAULT));
+ if (compound.contains("Purpur.ShouldJoinCaravan")) this.shouldJoinCaravan = compound.getBoolean("Purpur.ShouldJoinCaravan"); // Purpur - Llama API + this.shouldJoinCaravan = compound.getBooleanOr("Purpur.ShouldJoinCaravan", true); // Purpur - Llama API
} }
@Override @Override
@@ -386,6 +_,7 @@ @@ -399,6 +_,7 @@
public void leaveCaravan() { public void leaveCaravan() {
if (this.caravanHead != null) { if (this.caravanHead != null) {
@@ -32,7 +32,7 @@
this.caravanHead.caravanTail = null; this.caravanHead.caravanTail = null;
} }
@@ -393,6 +_,7 @@ @@ -406,6 +_,7 @@
} }
public void joinCaravan(Llama caravanHead) { public void joinCaravan(Llama caravanHead) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/Wolf.java --- a/net/minecraft/world/entity/animal/wolf/Wolf.java
+++ b/net/minecraft/world/entity/animal/Wolf.java +++ b/net/minecraft/world/entity/animal/wolf/Wolf.java
@@ -94,6 +_,37 @@ @@ -100,6 +_,37 @@
EntityType<?> type = entity.getType(); EntityType<?> type = entity.getType();
return type == EntityType.SHEEP || type == EntityType.RABBIT || type == EntityType.FOX; return type == EntityType.SHEEP || type == EntityType.RABBIT || type == EntityType.FOX;
}; };
@@ -38,7 +38,7 @@
private static final float START_HEALTH = 8.0F; private static final float START_HEALTH = 8.0F;
private static final float TAME_HEALTH = 40.0F; private static final float TAME_HEALTH = 40.0F;
private static final float ARMOR_REPAIR_UNIT = 0.125F; private static final float ARMOR_REPAIR_UNIT = 0.125F;
@@ -115,12 +_,47 @@ @@ -122,12 +_,47 @@
this.setPathfindingMalus(PathType.DANGER_POWDER_SNOW, -1.0F); this.setPathfindingMalus(PathType.DANGER_POWDER_SNOW, -1.0F);
} }
@@ -86,38 +86,38 @@
this.goalSelector.addGoal(4, new LeapAtTargetGoal(this, 0.4F)); this.goalSelector.addGoal(4, new LeapAtTargetGoal(this, 0.4F));
this.goalSelector.addGoal(5, new MeleeAttackGoal(this, 1.0, true)); this.goalSelector.addGoal(5, new MeleeAttackGoal(this, 1.0, true));
this.goalSelector.addGoal(6, new FollowOwnerGoal(this, 1.0, 10.0F, 2.0F)); this.goalSelector.addGoal(6, new FollowOwnerGoal(this, 1.0, 10.0F, 2.0F));
@@ -133,7 +_,7 @@ @@ -140,7 +_,7 @@
this.targetSelector.addGoal(2, new OwnerHurtTargetGoal(this)); this.targetSelector.addGoal(2, new OwnerHurtTargetGoal(this));
this.targetSelector.addGoal(3, new HurtByTargetGoal(this).setAlertOthers()); this.targetSelector.addGoal(3, new HurtByTargetGoal(this).setAlertOthers());
this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::isAngryAt)); this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::isAngryAt));
- this.targetSelector.addGoal(5, new NonTameRandomTargetGoal<>(this, Animal.class, false, PREY_SELECTOR)); - this.targetSelector.addGoal(5, new NonTameRandomTargetGoal<>(this, Animal.class, false, PREY_SELECTOR));
+ // this.targetSelector.addGoal(5, new NonTameRandomTargetGoal<>(this, Animal.class, false, PREY_SELECTOR)); // Purpur - Configurable chance for wolves to spawn rabid - moved to updatePathfinders() + //this.targetSelector.addGoal(5, new NonTameRandomTargetGoal<>(this, Animal.class, false, PREY_SELECTOR)); // Purpur - Configurable chance for wolves to spawn rabid - moved to updatePathfinders()
this.targetSelector.addGoal(6, new NonTameRandomTargetGoal<>(this, Turtle.class, false, Turtle.BABY_ON_LAND_SELECTOR)); this.targetSelector.addGoal(6, new NonTameRandomTargetGoal<>(this, Turtle.class, false, Turtle.BABY_ON_LAND_SELECTOR));
this.targetSelector.addGoal(7, new NearestAttackableTargetGoal<>(this, AbstractSkeleton.class, false)); this.targetSelector.addGoal(7, new NearestAttackableTargetGoal<>(this, AbstractSkeleton.class, false));
this.targetSelector.addGoal(8, new ResetUniversalAngerTargetGoal<>(this, true)); this.targetSelector.addGoal(8, new ResetUniversalAngerTargetGoal<>(this, true));
@@ -182,6 +_,7 @@ @@ -231,6 +_,7 @@
public void addAdditionalSaveData(CompoundTag compound) { public void addAdditionalSaveData(CompoundTag compound) {
super.addAdditionalSaveData(compound); super.addAdditionalSaveData(compound);
compound.putByte("CollarColor", (byte)this.getCollarColor().getId()); compound.store("CollarColor", DyeColor.LEGACY_ID_CODEC, this.getCollarColor());
+ compound.putBoolean("Purpur.IsRabid", this.isRabid); // Purpur - Configurable chance for wolves to spawn rabid + compound.putBoolean("Purpur.IsRabid", this.isRabid); // Purpur - Configurable chance for wolves to spawn rabid
this.getVariant().unwrapKey().ifPresent(resourceKey -> compound.putString("variant", resourceKey.location().toString())); VariantUtils.writeVariant(compound, this.getVariant());
this.addPersistentAngerSaveData(compound); this.addPersistentAngerSaveData(compound);
} this.getSoundVariant()
@@ -196,6 +_,10 @@ @@ -245,6 +_,10 @@
if (compound.contains("CollarColor", 99)) { super.readAdditionalSaveData(compound);
this.setCollarColor(DyeColor.byId(compound.getInt("CollarColor"))); VariantUtils.readVariant(compound, this.registryAccess(), Registries.WOLF_VARIANT).ifPresent(this::setVariant);
} this.setCollarColor(compound.read("CollarColor", DyeColor.LEGACY_ID_CODEC).orElse(DEFAULT_COLLAR_COLOR));
+ // Purpur start - Configurable chance for wolves to spawn rabid + // Purpur start - Configurable chance for wolves to spawn rabid
+ this.isRabid = compound.getBoolean("Purpur.IsRabid"); + this.isRabid = compound.getBooleanOr("Purpur.IsRabid", false);
+ this.updatePathfinders(false); + this.updatePathfinders(false);
+ // Purpur end - Configurable chance for wolves to spawn rabid + // Purpur end - Configurable chance for wolves to spawn rabid
this.readPersistentAngerSaveData(this.level(), compound); this.readPersistentAngerSaveData(this.level(), compound);
} compound.read("sound_variant", ResourceKey.codec(Registries.WOLF_SOUND_VARIANT))
@@ -215,6 +_,10 @@ .flatMap(resourceKey -> this.registryAccess().lookupOrThrow(Registries.WOLF_SOUND_VARIANT).get((ResourceKey<WolfSoundVariant>)resourceKey))
@@ -269,6 +_,10 @@
} }
this.setVariant(holder); this.setSoundVariant(WolfSoundVariants.pickRandomSoundVariant(this.registryAccess(), this.random));
+ // Purpur start - Configurable chance for wolves to spawn rabid + // Purpur start - Configurable chance for wolves to spawn rabid
+ this.isRabid = level.getLevel().purpurConfig.wolfNaturalRabid > 0.0D && random.nextDouble() <= level.getLevel().purpurConfig.wolfNaturalRabid; + this.isRabid = level.getLevel().purpurConfig.wolfNaturalRabid > 0.0D && random.nextDouble() <= level.getLevel().purpurConfig.wolfNaturalRabid;
+ this.updatePathfinders(false); + this.updatePathfinders(false);
@@ -125,7 +125,7 @@
return super.finalizeSpawn(level, difficulty, spawnReason, spawnGroupData); return super.finalizeSpawn(level, difficulty, spawnReason, spawnGroupData);
} }
@@ -263,6 +_,11 @@ @@ -319,6 +_,11 @@
public void tick() { public void tick() {
super.tick(); super.tick();
if (this.isAlive()) { if (this.isAlive()) {
@@ -137,7 +137,7 @@
this.interestedAngleO = this.interestedAngle; this.interestedAngleO = this.interestedAngle;
if (this.isInterested()) { if (this.isInterested()) {
this.interestedAngle = this.interestedAngle + (1.0F - this.interestedAngle) * 0.4F; this.interestedAngle = this.interestedAngle + (1.0F - this.interestedAngle) * 0.4F;
@@ -481,13 +_,27 @@ @@ -532,13 +_,27 @@
itemInHand.consume(1, player); itemInHand.consume(1, player);
this.tryToTame(player); this.tryToTame(player);
return InteractionResult.SUCCESS_SERVER; return InteractionResult.SUCCESS_SERVER;

View File

@@ -34,7 +34,7 @@
} }
@Override @Override
@@ -119,15 +_,17 @@ @@ -114,15 +_,17 @@
} }
// CraftBukkit end // CraftBukkit end
if (!damageSource.is(DamageTypeTags.IS_EXPLOSION)) { if (!damageSource.is(DamageTypeTags.IS_EXPLOSION)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java --- a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java +++ b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
@@ -974,6 +_,7 @@ @@ -960,6 +_,7 @@
@Override @Override
protected boolean canRide(Entity entity) { protected boolean canRide(Entity entity) {
@@ -8,8 +8,8 @@
return false; return false;
} }
@@ -1009,7 +_,7 @@ @@ -995,7 +_,7 @@
boolean flag = worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT); boolean flag = level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT);
int i = 500; int i = 500;
- if (this.dragonFight != null && !this.dragonFight.hasPreviouslyKilledDragon()) { - if (this.dragonFight != null && !this.dragonFight.hasPreviouslyKilledDragon()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/boss/wither/WitherBoss.java --- a/net/minecraft/world/entity/boss/wither/WitherBoss.java
+++ b/net/minecraft/world/entity/boss/wither/WitherBoss.java +++ b/net/minecraft/world/entity/boss/wither/WitherBoss.java
@@ -77,6 +_,7 @@ @@ -78,6 +_,7 @@
private static final TargetingConditions.Selector LIVING_ENTITY_SELECTOR = (entity, level) -> !entity.getType().is(EntityTypeTags.WITHER_FRIENDS) private static final TargetingConditions.Selector LIVING_ENTITY_SELECTOR = (entity, level) -> !entity.getType().is(EntityTypeTags.WITHER_FRIENDS)
&& entity.attackable(); && entity.attackable();
private static final TargetingConditions TARGETING_CONDITIONS = TargetingConditions.forCombat().range(20.0).selector(LIVING_ENTITY_SELECTOR); private static final TargetingConditions TARGETING_CONDITIONS = TargetingConditions.forCombat().range(20.0).selector(LIVING_ENTITY_SELECTOR);
@@ -8,7 +8,7 @@
public WitherBoss(EntityType<? extends WitherBoss> entityType, Level level) { public WitherBoss(EntityType<? extends WitherBoss> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -85,6 +_,17 @@ @@ -86,6 +_,17 @@
this.xpReward = 50; this.xpReward = 50;
} }
@@ -26,23 +26,23 @@
@Override @Override
protected PathNavigation createNavigation(Level level) { protected PathNavigation createNavigation(Level level) {
FlyingPathNavigation flyingPathNavigation = new FlyingPathNavigation(this, level); FlyingPathNavigation flyingPathNavigation = new FlyingPathNavigation(this, level);
@@ -117,6 +_,7 @@ @@ -118,6 +_,7 @@
public void addAdditionalSaveData(CompoundTag compound) { public void addAdditionalSaveData(CompoundTag compound) {
super.addAdditionalSaveData(compound); super.addAdditionalSaveData(compound);
compound.putInt("Invul", this.getInvulnerableTicks()); compound.putInt("Invul", this.getInvulnerableTicks());
+ if (getSummoner() != null) compound.putUUID("Purpur.Summoner", getSummoner()); // Purpur - Summoner API + compound.storeNullable("Purpur.Summoner", net.minecraft.core.UUIDUtil.CODEC, getSummoner()); // Purpur - Summoner API
} }
@Override @Override
@@ -126,6 +_,7 @@ @@ -127,6 +_,7 @@
if (this.hasCustomName()) { if (this.hasCustomName()) {
this.bossEvent.setName(this.getDisplayName()); this.bossEvent.setName(this.getDisplayName());
} }
+ if (compound.contains("Purpur.Summoner")) setSummoner(compound.getUUID("Purpur.Summoner")); // Purpur - Summoner API + this.setSummoner(compound.read("Purpur.Summoner", net.minecraft.core.UUIDUtil.CODEC).orElse(null)); // Purpur - Summoner API
} }
@Override @Override
@@ -269,7 +_,7 @@ @@ -270,7 +_,7 @@
level.explode(this, this.getX(), this.getEyeY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB); level.explode(this, this.getX(), this.getEyeY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB);
} }
// CraftBukkit end // CraftBukkit end
@@ -51,7 +51,7 @@
// CraftBukkit start - Use relative location for far away sounds // CraftBukkit start - Use relative location for far away sounds
// level.globalLevelEvent(1023, this.blockPosition(), 0); // level.globalLevelEvent(1023, this.blockPosition(), 0);
int viewDistance = level.getCraftServer().getViewDistance() * 16; int viewDistance = level.getCraftServer().getViewDistance() * 16;
@@ -376,8 +_,10 @@ @@ -377,8 +_,10 @@
} }
} }
@@ -64,7 +64,7 @@
} }
this.bossEvent.setProgress(this.getHealth() / this.getMaxHealth()); this.bossEvent.setProgress(this.getHealth() / this.getMaxHealth());
@@ -574,6 +_,7 @@ @@ -575,6 +_,7 @@
@Override @Override
protected boolean canRide(Entity entity) { protected boolean canRide(Entity entity) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/decoration/ArmorStand.java --- a/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -93,10 +_,13 @@ @@ -95,10 +_,13 @@
private boolean noTickPoseDirty = false; private boolean noTickPoseDirty = false;
private boolean noTickEquipmentDirty = false; private boolean noTickEquipmentDirty = false;
// Paper end - Allow ArmorStands not to tick // Paper end - Allow ArmorStands not to tick
@@ -14,7 +14,7 @@
} }
public ArmorStand(Level level, double x, double y, double z) { public ArmorStand(Level level, double x, double y, double z) {
@@ -620,6 +_,7 @@ @@ -538,6 +_,7 @@
@Override @Override
public void tick() { public void tick() {
@@ -22,7 +22,7 @@
// Paper start - Allow ArmorStands not to tick // Paper start - Allow ArmorStands not to tick
if (!this.canTick) { if (!this.canTick) {
if (this.noTickPoseDirty) { if (this.noTickPoseDirty) {
@@ -949,4 +_,18 @@ @@ -867,4 +_,18 @@
} }
} }
// Paper end // Paper end

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/item/ItemEntity.java --- a/net/minecraft/world/entity/item/ItemEntity.java
+++ b/net/minecraft/world/entity/item/ItemEntity.java +++ b/net/minecraft/world/entity/item/ItemEntity.java
@@ -52,6 +_,12 @@ @@ -59,6 +_,12 @@
public boolean canMobPickup = true; // Paper - Item#canEntityPickup public boolean canMobPickup = true; // Paper - Item#canEntityPickup
private int despawnRate = -1; // Paper - Alternative item-despawn-rate private int despawnRate = -1; // Paper - Alternative item-despawn-rate
public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API
@@ -13,7 +13,7 @@
public ItemEntity(EntityType<? extends ItemEntity> entityType, Level level) { public ItemEntity(EntityType<? extends ItemEntity> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -337,7 +_,16 @@ @@ -344,7 +_,16 @@
@Override @Override
public final boolean hurtServer(ServerLevel level, DamageSource damageSource, float amount) { public final boolean hurtServer(ServerLevel level, DamageSource damageSource, float amount) {
@@ -31,7 +31,7 @@
return false; return false;
} else if (!level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && damageSource.getEntity() instanceof Mob) { } else if (!level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && damageSource.getEntity() instanceof Mob) {
return false; return false;
@@ -539,6 +_,12 @@ @@ -528,6 +_,12 @@
public void setItem(ItemStack stack) { public void setItem(ItemStack stack) {
this.getEntityData().set(DATA_ITEM, stack); this.getEntityData().set(DATA_ITEM, stack);
this.despawnRate = this.level().paperConfig().entities.spawning.altItemDespawnRate.enabled ? this.level().paperConfig().entities.spawning.altItemDespawnRate.items.getOrDefault(stack.getItem(), this.level().spigotConfig.itemDespawnRate) : this.level().spigotConfig.itemDespawnRate; // Paper - Alternative item-despawn-rate this.despawnRate = this.level().paperConfig().entities.spawning.altItemDespawnRate.enabled ? this.level().paperConfig().entities.spawning.altItemDespawnRate.items.getOrDefault(stack.getItem(), this.level().spigotConfig.itemDespawnRate) : this.level().spigotConfig.itemDespawnRate; // Paper - Alternative item-despawn-rate

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/item/PrimedTnt.java --- a/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java
@@ -251,4 +_,32 @@ @@ -253,4 +_,32 @@
return !this.level().paperConfig().fixes.preventTntFromMovingInWater && super.isPushedByFluid(); return !this.level().paperConfig().fixes.preventTntFromMovingInWater && super.isPushedByFluid();
} }
// Paper end - Option to prevent TNT from moving in water // Paper end - Option to prevent TNT from moving in water

View File

@@ -10,7 +10,7 @@
- if (i1 == 10 && i == 31 && random.nextFloat() < 0.25F) { - if (i1 == 10 && i == 31 && random.nextFloat() < 0.25F) {
+ if (net.minecraft.world.entity.ambient.Bat.isHalloweenSeason(level.getMinecraftWorld()) && this.random.nextFloat() < this.level().purpurConfig.chanceHeadHalloweenOnEntity) { // Purpur - Halloween options and optimizations + if (net.minecraft.world.entity.ambient.Bat.isHalloweenSeason(level.getMinecraftWorld()) && this.random.nextFloat() < this.level().purpurConfig.chanceHeadHalloweenOnEntity) { // Purpur - Halloween options and optimizations
this.setItemSlot(EquipmentSlot.HEAD, new ItemStack(random.nextFloat() < 0.1F ? Blocks.JACK_O_LANTERN : Blocks.CARVED_PUMPKIN)); this.setItemSlot(EquipmentSlot.HEAD, new ItemStack(random.nextFloat() < 0.1F ? Blocks.JACK_O_LANTERN : Blocks.CARVED_PUMPKIN));
this.armorDropChances[EquipmentSlot.HEAD.getIndex()] = 0.0F; this.setDropChance(EquipmentSlot.HEAD, 0.0F);
} }
@@ -217,7 +_,7 @@ @@ -217,7 +_,7 @@
if (event.getProjectile() == arrow.getBukkitEntity()) { if (event.getProjectile() == arrow.getBukkitEntity()) {

View File

@@ -1,18 +1,19 @@
--- a/net/minecraft/world/entity/monster/Creeper.java --- a/net/minecraft/world/entity/monster/Creeper.java
+++ b/net/minecraft/world/entity/monster/Creeper.java +++ b/net/minecraft/world/entity/monster/Creeper.java
@@ -50,6 +_,7 @@ @@ -54,6 +_,7 @@
public int explosionRadius = 3; public int explosionRadius = 3;
private int droppedSkulls; private int droppedSkulls;
public Entity entityIgniter; // CraftBukkit public @Nullable Entity entityIgniter; // CraftBukkit
+ private boolean exploding = false; // Purpur - Config to make Creepers explode on death + private boolean exploding = false; // Purpur - Config to make Creepers explode on death
public Creeper(EntityType<? extends Creeper> entityType, Level level) { public Creeper(EntityType<? extends Creeper> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -161,6 +_,26 @@ @@ -157,6 +_,27 @@
} return false; // CraftBukkit
} }
+ // Purpur start - Special mobs naturally spawn + // Purpur start - Special mobs naturally spawn
+ @Override
+ public net.minecraft.world.entity.SpawnGroupData finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor world, net.minecraft.world.DifficultyInstance difficulty, net.minecraft.world.entity.EntitySpawnReason spawnReason, @Nullable net.minecraft.world.entity.SpawnGroupData entityData) { + public net.minecraft.world.entity.SpawnGroupData finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor world, net.minecraft.world.DifficultyInstance difficulty, net.minecraft.world.entity.EntitySpawnReason spawnReason, @Nullable net.minecraft.world.entity.SpawnGroupData entityData) {
+ double chance = world.getLevel().purpurConfig.creeperChargedChance; + double chance = world.getLevel().purpurConfig.creeperChargedChance;
+ if (chance > 0D && random.nextDouble() <= chance) { + if (chance > 0D && random.nextDouble() <= chance) {
@@ -33,9 +34,9 @@
+ // Purpur end - Config to make Creepers explode on death + // Purpur end - Config to make Creepers explode on death
+ +
@Override @Override
protected SoundEvent getHurtSound(DamageSource damageSource) { public SoundEvent getHurtSound(DamageSource damageSource) {
return SoundEvents.CREEPER_HURT; return SoundEvents.CREEPER_HURT;
@@ -243,14 +_,16 @@ @@ -239,14 +_,16 @@
} }
public void explodeCreeper() { public void explodeCreeper() {
@@ -54,7 +55,7 @@
this.spawnLingeringCloud(); this.spawnLingeringCloud();
this.triggerOnDeathMobEffects(serverLevel, Entity.RemovalReason.KILLED); this.triggerOnDeathMobEffects(serverLevel, Entity.RemovalReason.KILLED);
this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause
@@ -261,6 +_,7 @@ @@ -257,6 +_,7 @@
} }
// CraftBukkit end // CraftBukkit end
} }

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EnderMan.java --- a/net/minecraft/world/entity/monster/EnderMan.java
+++ b/net/minecraft/world/entity/monster/EnderMan.java +++ b/net/minecraft/world/entity/monster/EnderMan.java
@@ -102,7 +_,7 @@ @@ -103,7 +_,7 @@
this.goalSelector.addGoal(11, new EnderMan.EndermanTakeBlockGoal(this)); this.goalSelector.addGoal(11, new EnderMan.EndermanTakeBlockGoal(this));
this.targetSelector.addGoal(1, new EnderMan.EndermanLookForPlayerGoal(this, this::isAngryAt)); this.targetSelector.addGoal(1, new EnderMan.EndermanLookForPlayerGoal(this, this::isAngryAt));
this.targetSelector.addGoal(2, new HurtByTargetGoal(this)); this.targetSelector.addGoal(2, new HurtByTargetGoal(this));
@@ -9,32 +9,32 @@
this.targetSelector.addGoal(4, new ResetUniversalAngerTargetGoal<>(this, false)); this.targetSelector.addGoal(4, new ResetUniversalAngerTargetGoal<>(this, false));
} }
@@ -230,7 +_,7 @@ @@ -220,7 +_,7 @@
boolean isBeingStaredBy(Player player) { boolean isBeingStaredBy(Player player) {
// Paper start - EndermanAttackPlayerEvent // Paper start - EndermanAttackPlayerEvent
- final boolean shouldAttack = isBeingStaredBy0(player); - final boolean shouldAttack = this.isBeingStaredBy0(player);
+ final boolean shouldAttack = !this.level().purpurConfig.endermanDisableStareAggro && isBeingStaredBy0(player); // Purpur - Config to ignore Dragon Head wearers and stare aggro + final boolean shouldAttack = !this.level().purpurConfig.endermanDisableStareAggro && this.isBeingStaredBy0(player); // Purpur - Config to ignore Dragon Head wearers and stare aggro
final com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent event = new com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent((org.bukkit.entity.Enderman) getBukkitEntity(), (org.bukkit.entity.Player) player.getBukkitEntity()); final com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent event = new com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent((org.bukkit.entity.Enderman) getBukkitEntity(), (org.bukkit.entity.Player) player.getBukkitEntity());
event.setCancelled(!shouldAttack); event.setCancelled(!shouldAttack);
return event.callEvent(); return event.callEvent();
@@ -385,6 +_,7 @@ @@ -376,6 +_,7 @@
public boolean hurtServer(ServerLevel level, DamageSource damageSource, float amount) { public boolean hurtServer(ServerLevel level, DamageSource damageSource, float amount) {
if (this.isInvulnerableTo(level, damageSource)) { if (this.isInvulnerableTo(level, damageSource)) {
return false; return false;
+ } else if (org.purpurmc.purpur.PurpurConfig.endermanShortHeight && damageSource.is(net.minecraft.world.damagesource.DamageTypes.IN_WALL)) { return false; // Purpur - no suffocation damage if short height - Short enderman height + } else if (org.purpurmc.purpur.PurpurConfig.endermanShortHeight && damageSource.is(net.minecraft.world.damagesource.DamageTypes.IN_WALL)) { return false; // Purpur - no suffocation damage if short height - Short enderman height
} else { } else {
boolean flag = damageSource.getDirectEntity() instanceof ThrownPotion; AbstractThrownPotion abstractThrownPotion1 = damageSource.getDirectEntity() instanceof AbstractThrownPotion abstractThrownPotion
if (!damageSource.is(DamageTypeTags.IS_PROJECTILE) && !flag) { ? abstractThrownPotion
@@ -397,6 +_,7 @@ @@ -390,6 +_,7 @@
} else { } else {
boolean flag1 = flag && this.hurtWithCleanWater(level, damageSource, (ThrownPotion)damageSource.getDirectEntity(), amount); boolean flag = abstractThrownPotion1 != null && this.hurtWithCleanWater(level, damageSource, abstractThrownPotion1, amount);
+ if (!flag1 && level.purpurConfig.endermanIgnoreProjectiles) return super.hurtServer(level, damageSource, amount); // Purpur - Config to disable Enderman teleport on projectile hit + if (!flag && level.purpurConfig.endermanIgnoreProjectiles) return super.hurtServer(level, damageSource, amount); // Purpur - Config to disable Enderman teleport on projectile hit
if (this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.INDIRECT)) { // Paper - EndermanEscapeEvent if (this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.INDIRECT)) { // Paper - EndermanEscapeEvent
for (int i = 0; i < 64; i++) { for (int i = 0; i < 64; i++) {
if (this.teleport()) { if (this.teleport()) {
@@ -440,7 +_,7 @@ @@ -433,7 +_,7 @@
@Override @Override
public boolean requiresCustomPersistence() { public boolean requiresCustomPersistence() {
@@ -43,7 +43,7 @@
} }
static class EndermanFreezeWhenLookedAt extends Goal { static class EndermanFreezeWhenLookedAt extends Goal {
@@ -484,6 +_,7 @@ @@ -477,6 +_,7 @@
@Override @Override
public boolean canUse() { public boolean canUse() {
@@ -51,7 +51,7 @@
return this.enderman.getCarriedBlock() != null return this.enderman.getCarriedBlock() != null
&& getServerLevel(this.enderman).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && getServerLevel(this.enderman).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)
&& this.enderman.getRandom().nextInt(reducedTickDelay(2000)) == 0; && this.enderman.getRandom().nextInt(reducedTickDelay(2000)) == 0;
@@ -633,6 +_,7 @@ @@ -626,6 +_,7 @@
@Override @Override
public boolean canUse() { public boolean canUse() {

Some files were not shown because too many files have changed in this diff Show More