3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00
Dieser Commit ist enthalten in:
Shane Freeder 2024-10-24 19:40:24 +01:00
Ursprung 9047541397
Commit d67e55d367
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: A3F61EA5A085289C
9 geänderte Dateien mit 120 neuen und 126 gelöschten Zeilen

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] disable forced empty world ticks
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 24d5e741aed1677d0df59c1455fbfc60a29e8e3c..c2189752a422f39428b2c0f1408f359f20c388e5 100644 index 2aa4437a76d29cdd793680734a36a41c6133ab91..03b07f36b32ad8239f82a9536a4c1b08ed12e9ca 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -686,7 +686,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. @@ -519,7 +519,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.handlingTick = false; this.handlingTick = false;
gameprofilerfiller.pop(); gameprofilerfiller.pop();

Datei anzeigen

@ -12,7 +12,7 @@ Replace all calls to the new place to the unnecessary forward.
Optimize getType and getBlockData to manually inline and optimize the calls Optimize getType and getBlockData to manually inline and optimize the calls
diff --git a/src/main/java/net/minecraft/core/Vec3i.java b/src/main/java/net/minecraft/core/Vec3i.java diff --git a/src/main/java/net/minecraft/core/Vec3i.java b/src/main/java/net/minecraft/core/Vec3i.java
index 02367ef1371dde94ff6c4cd40bd32e800d6ccaaf..7b0fc7135bc107103dcaed6dc0707b1829928fae 100644 index 2f2bcc1b9b32e58bf70ae6c171177ceb333ed6cd..d7afddd1d961495f0b50302a8da0a70fcd3ba1b0 100644
--- a/src/main/java/net/minecraft/core/Vec3i.java --- a/src/main/java/net/minecraft/core/Vec3i.java
+++ b/src/main/java/net/minecraft/core/Vec3i.java +++ b/src/main/java/net/minecraft/core/Vec3i.java
@@ -28,6 +28,12 @@ public class Vec3i implements Comparable<Vec3i> { @@ -28,6 +28,12 @@ public class Vec3i implements Comparable<Vec3i> {
@ -29,10 +29,10 @@ index 02367ef1371dde94ff6c4cd40bd32e800d6ccaaf..7b0fc7135bc107103dcaed6dc0707b18
this.x = x; this.x = x;
this.y = y; this.y = y;
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 347334130e99dbf938d570bd36440a96f92d475a..c69ed3e899fc8d48afeb731bb3b2d97b5969e6e3 100644 index 1b899473c6deeaa1aef9007d8b7bcec98580e61c..8adf12491e01830464b07e7a795db995d31f7a31 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -824,7 +824,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @@ -341,7 +341,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Paper end // Paper end
public boolean isInWorldBounds(BlockPos pos) { public boolean isInWorldBounds(BlockPos pos) {
@ -42,10 +42,10 @@ index 347334130e99dbf938d570bd36440a96f92d475a..c69ed3e899fc8d48afeb731bb3b2d97b
public static boolean isInSpawnableBounds(BlockPos pos) { public static boolean isInSpawnableBounds(BlockPos pos) {
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
index fba548c4e6d589323ec3ea5f6b269a6fe9faf6a1..a7fc4b027cee8e1ed2678be7060040494a65682a 100644 index 37795b9e264c571efe9c718fa9996197dca4ed54..a846dd210ed1de0dc3e8b686663ee346bff33dc8 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java --- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
@@ -189,6 +189,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom @@ -128,6 +128,7 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh
return GameEventListenerRegistry.NOOP; return GameEventListenerRegistry.NOOP;
} }
@ -54,10 +54,10 @@ index fba548c4e6d589323ec3ea5f6b269a6fe9faf6a1..a7fc4b027cee8e1ed2678be706004049
public abstract BlockState setBlockState(BlockPos pos, BlockState state, boolean moved); public abstract BlockState setBlockState(BlockPos pos, BlockState state, boolean moved);
diff --git a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
index 4af698930712389881601069a921f054c07935f2..d7d332d8ba3442887e80d2c3d7bddb9de2674c2d 100644 index 7cce66d4c6efe6fd3cc22a6acf72878c964c61ae..f38700e5fbeeb8a913272d4464b8aa325d511dac 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
@@ -99,6 +99,12 @@ public class ImposterProtoChunk extends ProtoChunk implements ca.spottedleaf.moo @@ -56,6 +56,12 @@ public class ImposterProtoChunk extends ProtoChunk {
public BlockState getBlockState(BlockPos pos) { public BlockState getBlockState(BlockPos pos) {
return this.wrapped.getBlockState(pos); return this.wrapped.getBlockState(pos);
} }
@ -71,7 +71,7 @@ index 4af698930712389881601069a921f054c07935f2..d7d332d8ba3442887e80d2c3d7bddb9d
@Override @Override
public FluidState getFluidState(BlockPos pos) { public FluidState getFluidState(BlockPos pos) {
diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
index 207dc31afcf5ca5a59ab27ee263aa10f94a79559..082eae7032d5a8055a0f67b8a5583bbbf6fa9916 100644 index 5321109ca638036572df9a7e17eafcef2b4f5112..4d5704df4a7ac6e148774f1a986d46bfb7e95f95 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
@@ -97,14 +97,18 @@ public class ProtoChunk extends ChunkAccess { @@ -97,14 +97,18 @@ public class ProtoChunk extends ChunkAccess {

Datei anzeigen

@ -13,10 +13,10 @@ custom renderers are in use, defaulting to the much simpler Vanilla system.
Additionally, numerous issues to player position tracking on maps has been fixed. Additionally, numerous issues to player position tracking on maps has been fixed.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 376443dfc846f7511c60125cb7714757d15590ea..81eb2d57045dd9d692109b33fc10804ff3d68d54 100644 index 03b07f36b32ad8239f82a9536a4c1b08ed12e9ca..e3085b4d106d5985078ab3820dd12bdb58ab5889 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2496,6 +2496,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. @@ -2358,6 +2358,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
{ {
if ( iter.next().player == entity ) if ( iter.next().player == entity )
{ {
@ -24,14 +24,14 @@ index 376443dfc846f7511c60125cb7714757d15590ea..81eb2d57045dd9d692109b33fc10804f
iter.remove(); iter.remove();
} }
} }
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index d0b51d96d6795b5fa03bc195b90324680545b752..09bcbc0ae36e4e69fee87a7e0c49acf496117a39 100644 index 52b18f2c333b7535929bb4e52e65cf5fb0f5692f..b0cec2132c21abac64420e0d9a23b5346dfd9ee4 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -808,6 +808,14 @@ public abstract class Player extends LivingEntity { @@ -2811,6 +2811,14 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
return null; this.awardStat(Stats.DROP);
} }
// CraftBukkit end
+ // Paper start - remove player from map on drop + // Paper start - remove player from map on drop
+ if (itemstack.getItem() == Items.FILLED_MAP) { + if (itemstack.getItem() == Items.FILLED_MAP) {
+ net.minecraft.world.level.saveddata.maps.MapItemSavedData worldmap = net.minecraft.world.item.MapItem.getSavedData(itemstack, this.level()); + net.minecraft.world.level.saveddata.maps.MapItemSavedData worldmap = net.minecraft.world.item.MapItem.getSavedData(itemstack, this.level());
@ -40,14 +40,14 @@ index d0b51d96d6795b5fa03bc195b90324680545b752..09bcbc0ae36e4e69fee87a7e0c49acf4
+ } + }
+ } + }
+ // Paper end + // Paper end
return entityitem; return entityitem;
} }
}
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
index a43544704109f21bab230dd9bf0401e28f878582..6794466051dd4b725d579b2136c37844995a648e 100644 index 2d5e7380e8a14cbc01ba48cd05deccc0c7f53430..ae321b3b8d98e42ef07fd1f0f738c1a2b428f6db 100644
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java --- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java +++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
@@ -79,6 +79,7 @@ public class MapItemSavedData extends SavedData { @@ -80,6 +80,7 @@ public class MapItemSavedData extends SavedData {
public final Map<String, MapDecoration> decorations = Maps.newLinkedHashMap(); public final Map<String, MapDecoration> decorations = Maps.newLinkedHashMap();
private final Map<String, MapFrame> frameMarkers = Maps.newHashMap(); private final Map<String, MapFrame> frameMarkers = Maps.newHashMap();
private int trackedDecorationCount; private int trackedDecorationCount;
@ -69,9 +69,9 @@ index a43544704109f21bab230dd9bf0401e28f878582..6794466051dd4b725d579b2136c37844
} }
+ worldmap.vanillaRender.buffer = abyte; // Paper + worldmap.vanillaRender.buffer = abyte; // Paper
RegistryOps<Tag> registryops = registryLookup.createSerializationContext(NbtOps.INSTANCE); RegistryOps<Tag> registryops = registries.createSerializationContext(NbtOps.INSTANCE);
List<MapBanner> list = (List) MapBanner.LIST_CODEC.parse(registryops, nbt.get("banners")).resultOrPartial((s) -> { List<MapBanner> list = (List) MapBanner.LIST_CODEC.parse(registryops, nbt.get("banners")).resultOrPartial((s) -> {
@@ -348,7 +351,7 @@ public class MapItemSavedData extends SavedData { @@ -367,7 +370,7 @@ public class MapItemSavedData extends SavedData {
--this.trackedDecorationCount; --this.trackedDecorationCount;
} }
@ -80,7 +80,7 @@ index a43544704109f21bab230dd9bf0401e28f878582..6794466051dd4b725d579b2136c37844
} }
public static void addTargetDecoration(ItemStack stack, BlockPos pos, String id, Holder<MapDecorationType> decorationType) { public static void addTargetDecoration(ItemStack stack, BlockPos pos, String id, Holder<MapDecorationType> decorationType) {
@@ -588,6 +591,21 @@ public class MapItemSavedData extends SavedData { @@ -621,6 +624,21 @@ public class MapItemSavedData extends SavedData {
public class HoldingPlayer { public class HoldingPlayer {
@ -102,10 +102,10 @@ index a43544704109f21bab230dd9bf0401e28f878582..6794466051dd4b725d579b2136c37844
public final Player player; public final Player player;
private boolean dirtyData = true; private boolean dirtyData = true;
private int minDirtyX; private int minDirtyX;
@@ -621,7 +639,9 @@ public class MapItemSavedData extends SavedData { @@ -654,7 +672,9 @@ public class MapItemSavedData extends SavedData {
@Nullable @Nullable
Packet<?> nextUpdatePacket(MapId mapId) { Packet<?> nextUpdatePacket(MapId mapId) {
MapItemSavedData.MapPatch worldmap_b; MapItemSavedData.MapPatch worldmap_c;
- org.bukkit.craftbukkit.map.RenderData render = MapItemSavedData.this.mapView.render((org.bukkit.craftbukkit.entity.CraftPlayer) this.player.getBukkitEntity()); // CraftBukkit - org.bukkit.craftbukkit.map.RenderData render = MapItemSavedData.this.mapView.render((org.bukkit.craftbukkit.entity.CraftPlayer) this.player.getBukkitEntity()); // CraftBukkit
+ if (!this.dirtyData && this.tick % 5 != 0) { this.tick++; return null; } // Paper - this won't end up sending, so don't render it! + if (!this.dirtyData && this.tick % 5 != 0) { this.tick++; return null; } // Paper - this won't end up sending, so don't render it!
+ boolean vanillaMaps = shouldUseVanillaMap(); // Paper + boolean vanillaMaps = shouldUseVanillaMap(); // Paper
@ -113,7 +113,7 @@ index a43544704109f21bab230dd9bf0401e28f878582..6794466051dd4b725d579b2136c37844
if (this.dirtyData) { if (this.dirtyData) {
this.dirtyData = false; this.dirtyData = false;
@@ -637,6 +657,8 @@ public class MapItemSavedData extends SavedData { @@ -670,6 +690,8 @@ public class MapItemSavedData extends SavedData {
// CraftBukkit start // CraftBukkit start
java.util.Collection<MapDecoration> icons = new java.util.ArrayList<MapDecoration>(); java.util.Collection<MapDecoration> icons = new java.util.ArrayList<MapDecoration>();

Datei anzeigen

@ -134,11 +134,11 @@ index e858436bcf1b234d4bc6e6a117f5224d5c2d9f90..e761b63eebc1e76b2bb1cb887d83d0b6
private final ChunkPos pos; private final ChunkPos pos;
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index 18054304e08c8a6346c0135a0e6a68e77fe5c37c..0615fd82b71efb9a397de01615050e6d906c2844 100644 index 4c1212c6ef48594e766fa9e35a6e15916602d587..2a0f7ab0b616fe07baac437372e3933186064dd5 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -144,6 +144,43 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise @@ -55,6 +55,43 @@ public final class RegionFileStorage implements AutoCloseable {
// Paper end - rewrite chunk system }
} }
+ // Paper start + // Paper start
@ -181,7 +181,7 @@ index 18054304e08c8a6346c0135a0e6a68e77fe5c37c..0615fd82b71efb9a397de01615050e6d
@Nullable @Nullable
public CompoundTag read(ChunkPos pos) throws IOException { public CompoundTag read(ChunkPos pos) throws IOException {
// CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing
@@ -154,6 +191,12 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise @@ -65,6 +102,12 @@ public final class RegionFileStorage implements AutoCloseable {
// CraftBukkit end // CraftBukkit end
DataInputStream datainputstream = regionfile.getChunkDataInputStream(pos); DataInputStream datainputstream = regionfile.getChunkDataInputStream(pos);
@ -194,7 +194,7 @@ index 18054304e08c8a6346c0135a0e6a68e77fe5c37c..0615fd82b71efb9a397de01615050e6d
CompoundTag nbttagcompound; CompoundTag nbttagcompound;
label43: label43:
{ {
@@ -242,6 +285,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise @@ -147,6 +190,7 @@ public final class RegionFileStorage implements AutoCloseable {
try { try {
NbtIo.write(nbt, (DataOutput) dataoutputstream); NbtIo.write(nbt, (DataOutput) dataoutputstream);

Datei anzeigen

@ -105,10 +105,10 @@ index 0000000000000000000000000000000000000000..b5580727eef106fa193e450038d1b20d
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java
index 061c89b985dafc79c808dd5f0e296b9fbac2fdfc..8c2f9f549b5155b8d8fecbc22164b334805381e2 100644 index 4840893082cbcd9b00f79149df1a7805af279dcb..ffca3a7df1c5b344dbd77e1db997c76d22a31021 100644
--- a/src/main/java/net/minecraft/server/Bootstrap.java --- a/src/main/java/net/minecraft/server/Bootstrap.java
+++ b/src/main/java/net/minecraft/server/Bootstrap.java +++ b/src/main/java/net/minecraft/server/Bootstrap.java
@@ -76,6 +76,7 @@ public class Bootstrap { @@ -77,6 +77,7 @@ public class Bootstrap {
CauldronInteraction.bootStrap(); CauldronInteraction.bootStrap();
// Paper start // Paper start
BuiltInRegistries.bootStrap(() -> { BuiltInRegistries.bootStrap(() -> {
@ -117,7 +117,7 @@ index 061c89b985dafc79c808dd5f0e296b9fbac2fdfc..8c2f9f549b5155b8d8fecbc22164b334
// Paper end // Paper end
CreativeModeTabs.validate(); CreativeModeTabs.validate();
diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
index 996899cb18e6c29665b9de7a1cc97c9a4187924b..68be0d51aa64b5d917fb53dbbbdf8966d4f4abd8 100644 index 44e64d716eee71492f9a8d813934bb96463ece45..1fcc2b287ed723cf51720f80e68f18f4a15cf429 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java --- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
@@ -206,7 +206,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { @@ -206,7 +206,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
@ -127,7 +127,7 @@ index 996899cb18e6c29665b9de7a1cc97c9a4187924b..68be0d51aa64b5d917fb53dbbbdf8966
- WorldGenerationContext worldgenerationcontext = new WorldGenerationContext(this, region); - WorldGenerationContext worldgenerationcontext = new WorldGenerationContext(this, region);
+ WorldGenerationContext worldgenerationcontext = new WorldGenerationContext(this, region, region.getMinecraftWorld()); // Paper - Flat bedrock generator settings + WorldGenerationContext worldgenerationcontext = new WorldGenerationContext(this, region, region.getMinecraftWorld()); // Paper - Flat bedrock generator settings
this.buildSurface(chunk, worldgenerationcontext, noiseConfig, structures, region.getBiomeManager(), region.registryAccess().registryOrThrow(Registries.BIOME), Blender.of(region)); this.buildSurface(chunk, worldgenerationcontext, noiseConfig, structures, region.getBiomeManager(), region.registryAccess().lookupOrThrow(Registries.BIOME), Blender.of(region));
} }
@@ -234,7 +234,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { @@ -234,7 +234,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
return this.createNoiseChunk(ichunkaccess1, structureAccessor, Blender.of(chunkRegion), noiseConfig); return this.createNoiseChunk(ichunkaccess1, structureAccessor, Blender.of(chunkRegion), noiseConfig);
@ -135,11 +135,11 @@ index 996899cb18e6c29665b9de7a1cc97c9a4187924b..68be0d51aa64b5d917fb53dbbbdf8966
Aquifer aquifer = noisechunk.aquifer(); Aquifer aquifer = noisechunk.aquifer();
- CarvingContext carvingcontext = new CarvingContext(this, chunkRegion.registryAccess(), chunk.getHeightAccessorForGeneration(), noisechunk, noiseConfig, ((NoiseGeneratorSettings) this.settings.value()).surfaceRule()); - CarvingContext carvingcontext = new CarvingContext(this, chunkRegion.registryAccess(), chunk.getHeightAccessorForGeneration(), noisechunk, noiseConfig, ((NoiseGeneratorSettings) this.settings.value()).surfaceRule());
+ CarvingContext carvingcontext = new CarvingContext(this, chunkRegion.registryAccess(), chunk.getHeightAccessorForGeneration(), noisechunk, noiseConfig, ((NoiseGeneratorSettings) this.settings.value()).surfaceRule(), chunkRegion.getMinecraftWorld()); // Paper - Flat bedrock generator settings + CarvingContext carvingcontext = new CarvingContext(this, chunkRegion.registryAccess(), chunk.getHeightAccessorForGeneration(), noisechunk, noiseConfig, ((NoiseGeneratorSettings) this.settings.value()).surfaceRule(), chunkRegion.getMinecraftWorld()); // Paper - Flat bedrock generator settings
CarvingMask carvingmask = ((ProtoChunk) chunk).getOrCreateCarvingMask(carverStep); CarvingMask carvingmask = ((ProtoChunk) chunk).getOrCreateCarvingMask();
for (int j = -8; j <= 8; ++j) { for (int j = -8; j <= 8; ++j) {
diff --git a/src/main/java/net/minecraft/world/level/levelgen/WorldGenerationContext.java b/src/main/java/net/minecraft/world/level/levelgen/WorldGenerationContext.java diff --git a/src/main/java/net/minecraft/world/level/levelgen/WorldGenerationContext.java b/src/main/java/net/minecraft/world/level/levelgen/WorldGenerationContext.java
index b99283c31193e2110f6e3f39c23dbfc2442bab2b..a34e53249668d917c9d77c6837b91360a2349bbc 100644 index e3360e0a19b610586a6194df1880f15799400fc5..aeee3ea1a3aff45febed1bc7f15ea56570620a6c 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/WorldGenerationContext.java --- a/src/main/java/net/minecraft/world/level/levelgen/WorldGenerationContext.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/WorldGenerationContext.java +++ b/src/main/java/net/minecraft/world/level/levelgen/WorldGenerationContext.java
@@ -6,10 +6,13 @@ import net.minecraft.world.level.chunk.ChunkGenerator; @@ -6,10 +6,13 @@ import net.minecraft.world.level.chunk.ChunkGenerator;
@ -151,7 +151,7 @@ index b99283c31193e2110f6e3f39c23dbfc2442bab2b..a34e53249668d917c9d77c6837b91360
- public WorldGenerationContext(ChunkGenerator generator, LevelHeightAccessor world) { - public WorldGenerationContext(ChunkGenerator generator, LevelHeightAccessor world) {
+ public WorldGenerationContext(ChunkGenerator generator, LevelHeightAccessor world) { this(generator, world, null); } // Paper - Flat bedrock generator settings + public WorldGenerationContext(ChunkGenerator generator, LevelHeightAccessor world) { this(generator, world, null); } // Paper - Flat bedrock generator settings
+ public WorldGenerationContext(ChunkGenerator generator, LevelHeightAccessor world, @org.jetbrains.annotations.Nullable net.minecraft.world.level.Level level) { // Paper - Flat bedrock generator settings + public WorldGenerationContext(ChunkGenerator generator, LevelHeightAccessor world, @org.jetbrains.annotations.Nullable net.minecraft.world.level.Level level) { // Paper - Flat bedrock generator settings
this.minY = Math.max(world.getMinBuildHeight(), generator.getMinY()); this.minY = Math.max(world.getMinY(), generator.getMinY());
this.height = Math.min(world.getHeight(), generator.getGenDepth()); this.height = Math.min(world.getHeight(), generator.getGenDepth());
+ this.level = level; // Paper - Flat bedrock generator settings + this.level = level; // Paper - Flat bedrock generator settings
} }
@ -188,10 +188,10 @@ index 390bcf9c302effd9db42d7a0e65b5433cc2eadd6..b9e919d31e442f49300744395af3cf94
this.noiseChunk = chunkNoiseSampler; this.noiseChunk = chunkNoiseSampler;
this.randomState = noiseConfig; this.randomState = noiseConfig;
diff --git a/src/main/java/net/minecraft/world/level/levelgen/placement/PlacementContext.java b/src/main/java/net/minecraft/world/level/levelgen/placement/PlacementContext.java diff --git a/src/main/java/net/minecraft/world/level/levelgen/placement/PlacementContext.java b/src/main/java/net/minecraft/world/level/levelgen/placement/PlacementContext.java
index 640c2683c842655bbaee8f293f1c2613ef44844e..c7dfd844c7846281ceff0d443c0160054fd36c5c 100644 index 298cedb398cc0dc362e02a2bd9db170a9595407f..4e7aa581c9afc20820b659bb1804f7cf460f0b97 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/placement/PlacementContext.java --- a/src/main/java/net/minecraft/world/level/levelgen/placement/PlacementContext.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/placement/PlacementContext.java +++ b/src/main/java/net/minecraft/world/level/levelgen/placement/PlacementContext.java
@@ -18,7 +18,7 @@ public class PlacementContext extends WorldGenerationContext { @@ -17,7 +17,7 @@ public class PlacementContext extends WorldGenerationContext {
private final Optional<PlacedFeature> topFeature; private final Optional<PlacedFeature> topFeature;
public PlacementContext(WorldGenLevel world, ChunkGenerator generator, Optional<PlacedFeature> placedFeature) { public PlacementContext(WorldGenLevel world, ChunkGenerator generator, Optional<PlacedFeature> placedFeature) {

Datei anzeigen

@ -17,7 +17,7 @@ Adds villagers as separate config
public net.minecraft.world.entity.Entity isInsidePortal public net.minecraft.world.entity.Entity isInsidePortal
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index dec865affbaaa71d09806143d13a854100b98f23..eadbf175c69b6bb2d0df723afac96a517ebf0d83 100644 index e3085b4d106d5985078ab3820dd12bdb58ab5889..104827e5ca729d7d2f1ad4bda3a5b87fbb939db5 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2,7 +2,6 @@ package net.minecraft.server.level; @@ -2,7 +2,6 @@ package net.minecraft.server.level;
@ -28,7 +28,7 @@ index dec865affbaaa71d09806143d13a854100b98f23..eadbf175c69b6bb2d0df723afac96a51
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.mojang.datafixers.DataFixer; import com.mojang.datafixers.DataFixer;
import com.mojang.datafixers.util.Pair; import com.mojang.datafixers.util.Pair;
@@ -1192,17 +1191,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. @@ -980,17 +979,17 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
++TimingHistory.entityTicks; // Paper - timings ++TimingHistory.entityTicks; // Paper - timings
// Spigot start // Spigot start
co.aikar.timings.Timing timer; // Paper co.aikar.timings.Timing timer; // Paper
@ -50,41 +50,35 @@ index dec865affbaaa71d09806143d13a854100b98f23..eadbf175c69b6bb2d0df723afac96a51
try { try {
// Paper end - timings // Paper end - timings
entity.setOldPosAndRot(); entity.setOldPosAndRot();
@@ -1213,9 +1212,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. @@ -1001,21 +1000,24 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString(); return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString();
}); });
gameprofilerfiller.incrementCounter("tickNonPassenger"); gameprofilerfiller.incrementCounter("tickNonPassenger");
+ if (isActive) { // Paper - EAR 2 + if (isActive) { // Paper - EAR 2
+ TimingHistory.activatedEntityTicks++;
entity.tick(); entity.tick();
entity.postTick(); // CraftBukkit entity.postTick(); // CraftBukkit
+ } else { entity.inactiveTick(); } // Paper - EAR 2 + } else { entity.inactiveTick(); } // Paper - EAR 2
this.getProfiler().pop(); gameprofilerfiller.pop();
+ } finally { timer.stopTiming(); } // Paper - timings + } finally { timer.stopTiming(); } // Paper - timings // EAR 2
Iterator iterator = entity.getPassengers().iterator(); Iterator iterator = entity.getPassengers().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@@ -1223,13 +1226,18 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. Entity entity1 = (Entity) iterator.next();
this.tickPassenger(entity, entity1); - this.tickPassenger(entity, entity1);
+ this.tickPassenger(entity, entity1, isActive); // Paper - EAR 2
} }
- } finally { timer.stopTiming(); } // Paper - timings - } finally { timer.stopTiming(); } // Paper - timings
+ // } finally { timer.stopTiming(); } // Paper - timings - move up + // } finally { timer.stopTiming(); } // Paper - timings // EAR 2
} }
private void tickPassenger(Entity vehicle, Entity passenger) { - private void tickPassenger(Entity vehicle, Entity passenger) {
+ private void tickPassenger(Entity vehicle, Entity passenger, boolean isActive) { // Paper - EAR 2
if (!passenger.isRemoved() && passenger.getVehicle() == vehicle) { if (!passenger.isRemoved() && passenger.getVehicle() == vehicle) {
if (passenger instanceof Player || this.entityTickList.contains(passenger)) { if (passenger instanceof Player || this.entityTickList.contains(passenger)) {
+ // Paper - EAR 2
+ final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(passenger);
+ co.aikar.timings.Timing timer = isActive ? passenger.getType().passengerTickTimer.startTiming() : passenger.getType().passengerInactiveTickTimer.startTiming(); // Paper
+ try {
+ // Paper end
passenger.setOldPosAndRot(); passenger.setOldPosAndRot();
++passenger.tickCount; @@ -1026,15 +1028,24 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
ProfilerFiller gameprofilerfiller = this.getProfiler();
@@ -1238,8 +1246,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
return BuiltInRegistries.ENTITY_TYPE.getKey(passenger.getType()).toString(); return BuiltInRegistries.ENTITY_TYPE.getKey(passenger.getType()).toString();
}); });
gameprofilerfiller.incrementCounter("tickPassenger"); gameprofilerfiller.incrementCounter("tickPassenger");
@ -102,19 +96,19 @@ index dec865affbaaa71d09806143d13a854100b98f23..eadbf175c69b6bb2d0df723afac96a51
gameprofilerfiller.pop(); gameprofilerfiller.pop();
Iterator iterator = passenger.getPassengers().iterator(); Iterator iterator = passenger.getPassengers().iterator();
@@ -1249,6 +1266,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. while (iterator.hasNext()) {
this.tickPassenger(passenger, entity2); Entity entity2 = (Entity) iterator.next();
- this.tickPassenger(passenger, entity2);
+ this.tickPassenger(passenger, entity2, isActive); // Paper - EAR 2
} }
+ } finally { timer.stopTiming(); }// Paper - EAR2 timings
} }
} else {
passenger.stopRiding();
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index eda8a591033885c5dcb95f5ff651b12529f479ba..242d9213d22cb552e48beee03aa2db141e39d1c4 100644 index 3d4bb855dec45685d6e336d913903341f0ca4a11..f4b1a773bf809bde8cea919a418700f3d6850389 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -418,6 +418,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -420,6 +420,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
// Spigot end // Spigot end
protected int numCollisions = 0; // Paper - Cap entity collisions protected int numCollisions = 0; // Paper - Cap entity collisions
public boolean fromNetherPortal; // Paper - Add option to nerf pigmen from nether portals public boolean fromNetherPortal; // Paper - Add option to nerf pigmen from nether portals
@ -123,34 +117,34 @@ index eda8a591033885c5dcb95f5ff651b12529f479ba..242d9213d22cb552e48beee03aa2db14
public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one
// Paper start - Entity origin API // Paper start - Entity origin API
@javax.annotation.Nullable @javax.annotation.Nullable
@@ -1058,6 +1060,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -992,6 +994,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} else { } else {
this.wasOnFire = this.isOnFire(); this.wasOnFire = this.isOnFire();
if (movementType == MoverType.PISTON) { if (type == MoverType.PISTON) {
+ this.activatedTick = Math.max(this.activatedTick, MinecraftServer.currentTick + 20); // Paper + this.activatedTick = Math.max(this.activatedTick, MinecraftServer.currentTick + 20); // Paper - EAR 2
+ this.activatedImmunityTick = Math.max(this.activatedImmunityTick, MinecraftServer.currentTick + 20); // Paper + this.activatedImmunityTick = Math.max(this.activatedImmunityTick, MinecraftServer.currentTick + 20); // Paper - EAR 2
movement = this.limitPistonMovement(movement); movement = this.limitPistonMovement(movement);
if (movement.equals(Vec3.ZERO)) { if (movement.equals(Vec3.ZERO)) {
return; return;
@@ -1070,6 +1074,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -1006,6 +1010,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.stuckSpeedMultiplier = Vec3.ZERO; this.stuckSpeedMultiplier = Vec3.ZERO;
this.setDeltaMovement(Vec3.ZERO); this.setDeltaMovement(Vec3.ZERO);
} }
+ // Paper start - ignore movement changes while inactive. + // Paper start - ignore movement changes while inactive.
+ if (isTemporarilyActive && !(this instanceof ItemEntity) && movement == getDeltaMovement() && movementType == MoverType.SELF) { + if (isTemporarilyActive && !(this instanceof ItemEntity) && movement == getDeltaMovement() && type == MoverType.SELF) {
+ setDeltaMovement(Vec3.ZERO); + setDeltaMovement(Vec3.ZERO);
+ this.level.getProfiler().pop(); + gameprofilerfiller.pop();
+ return; + return;
+ } + }
+ // Paper end + // Paper end
movement = this.maybeBackOffFromEdge(movement, movementType); movement = this.maybeBackOffFromEdge(movement, type);
Vec3 vec3d1 = this.collide(movement); Vec3 vec3d1 = this.collide(movement);
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 58ff5b4df2124901df757315e42b2490a7da7415..763abeea3f14f15c27d600e0bdae44b387687bb4 100644 index aad63549d7c4f501b683b8dead4938eac27895eb..dbd321f3dc3cc80737830db63aed47a6935e8e89 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -232,6 +232,19 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @@ -235,6 +235,19 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
return this.lookControl; return this.lookControl;
} }
@ -171,7 +165,7 @@ index 58ff5b4df2124901df757315e42b2490a7da7415..763abeea3f14f15c27d600e0bdae44b3
Entity entity = this.getControlledVehicle(); Entity entity = this.getControlledVehicle();
diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
index 812aecb88641c09fb5030d145620b95aff19c9cb..ec9e76c548393235dcc6658c29e72e07e5d3510b 100644 index 7c69c9145eff938ce4615e3058d3d12edfc8bdd2..da1be210a41c3a2fbfa132326a623f1e748f8b77 100644
--- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java --- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java
+++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java +++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
@@ -22,6 +22,8 @@ public abstract class PathfinderMob extends Mob { @@ -22,6 +22,8 @@ public abstract class PathfinderMob extends Mob {
@ -184,22 +178,22 @@ index 812aecb88641c09fb5030d145620b95aff19c9cb..ec9e76c548393235dcc6658c29e72e07
return this.getWalkTargetValue(pos, this.level()); return this.getWalkTargetValue(pos, this.level());
} }
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
index 89b8a304fe9fae4b57640afbab04b6764ce9aab8..074ef807258139f818e30494126585262c2f33c0 100644 index 8775ce55654e4b99e287acd4a113cd72b9df4ff6..d871975f943a04b49644dc6eb18314d65a7836dc 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java --- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
@@ -26,6 +26,7 @@ public class GoalSelector { @@ -25,6 +25,7 @@ public class GoalSelector {
private final Map<Goal.Flag, WrappedGoal> lockedFlags = new EnumMap<>(Goal.Flag.class);
private final Set<WrappedGoal> availableGoals = new ObjectLinkedOpenHashSet<>(); private final Set<WrappedGoal> availableGoals = new ObjectLinkedOpenHashSet<>();
private final Supplier<ProfilerFiller> profiler;
private final EnumSet<Goal.Flag> disabledFlags = EnumSet.noneOf(Goal.Flag.class); private final EnumSet<Goal.Flag> disabledFlags = EnumSet.noneOf(Goal.Flag.class);
+ private int curRate; + private int curRate; // Paper - EAR 2
public GoalSelector(Supplier<ProfilerFiller> profiler) { public void addGoal(int priority, Goal goal) {
this.profiler = profiler; this.availableGoals.add(new WrappedGoal(priority, goal));
@@ -40,6 +41,20 @@ public class GoalSelector { @@ -35,6 +36,20 @@ public class GoalSelector {
this.availableGoals.removeIf(goal -> predicate.test(goal.getGoal())); this.availableGoals.removeIf(goal -> predicate.test(goal.getGoal()));
} }
+ // Paper start + // Paper start - EAR 2
+ public boolean inactiveTick() { + public boolean inactiveTick() {
+ this.curRate++; + this.curRate++;
+ return this.curRate % 3 == 0; // TODO newGoalRate was already unused in 1.20.4, check if this is correct + return this.curRate % 3 == 0; // TODO newGoalRate was already unused in 1.20.4, check if this is correct
@ -212,7 +206,7 @@ index 89b8a304fe9fae4b57640afbab04b6764ce9aab8..074ef807258139f818e3049412658526
+ } + }
+ return false; + return false;
+ } + }
+ // Paper end + // Paper end - EAR 2
public void removeGoal(Goal goal) { public void removeGoal(Goal goal) {
for (WrappedGoal wrappedGoal : this.availableGoals) { for (WrappedGoal wrappedGoal : this.availableGoals) {
if (wrappedGoal.getGoal() == goal && wrappedGoal.isRunning()) { if (wrappedGoal.getGoal() == goal && wrappedGoal.isRunning()) {
@ -244,69 +238,69 @@ index 6d8ea05e5e86e9f6359b560043bb55a10784e952..aee0147649d458b87d92496eda0c1723
} }
} }
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index 393588661c41b490ee6bce2f687962f7ddeff7d4..7e1871401ec5e3e9a85232053490259f132aec0a 100644 index a573aa4d387ad3a4e1017890f2b50b83a3c27ff4..b7a34f1c4d7b5ef3f7a843d152e33c839dcdedd5 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -228,17 +228,34 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @@ -228,19 +228,34 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@Override @Override
public void inactiveTick() { public void inactiveTick() {
// SPIGOT-3874, SPIGOT-3894, SPIGOT-3846, SPIGOT-5286 :( // SPIGOT-3874, SPIGOT-3894, SPIGOT-3846, SPIGOT-5286 :(
- if (this.level().spigotConfig.tickInactiveVillagers && this.isEffectiveAi()) { - if (this.level().spigotConfig.tickInactiveVillagers && this.isEffectiveAi()) {
- this.customServerAiStep(); - this.customServerAiStep((ServerLevel) this.level());
+ // Paper start + // Paper start
+ if (this.getUnhappyCounter() > 0) { + if (this.getUnhappyCounter() > 0) {
+ this.setUnhappyCounter(this.getUnhappyCounter() - 1); + this.setUnhappyCounter(this.getUnhappyCounter() - 1);
} + }
+ if (this.isEffectiveAi()) { + if (this.isEffectiveAi()) {
+ if (this.level().spigotConfig.tickInactiveVillagers) { + if (this.level().spigotConfig.tickInactiveVillagers) {
+ this.customServerAiStep(); + this.customServerAiStep(this.level().getMinecraftWorld());
+ } else { + } else {
+ this.customServerAiStep(true); + this.customServerAiStep(this.level().getMinecraftWorld(), true);
+ }
+ } + }
}
+ maybeDecayGossip(); + maybeDecayGossip();
+ // Paper end + // Paper end
+
super.inactiveTick(); super.inactiveTick();
} }
// Spigot End // Spigot End
@Override @Override
+ @Deprecated // Paper protected void customServerAiStep(ServerLevel world) {
protected void customServerAiStep() { + // Paper start - EAR 2
+ // Paper start + this.customServerAiStep(world, false);
+ this.customServerAiStep(false);
+ } + }
+ protected void customServerAiStep(final boolean inactive) { + protected void customServerAiStep(ServerLevel world, final boolean inactive) {
+ // Paper end + // Paper end - EAR 2
this.level().getProfiler().push("villagerBrain"); ProfilerFiller gameprofilerfiller = Profiler.get();
- this.getBrain().tick((ServerLevel) this.level(), this);
+ if (!inactive) this.getBrain().tick((ServerLevel) this.level(), this); // Paper gameprofilerfiller.push("villagerBrain");
this.level().getProfiler().pop(); - this.getBrain().tick(world, this);
+ if (!inactive) this.getBrain().tick(world, this);
gameprofilerfiller.pop();
if (this.assignProfessionWhenSpawned) { if (this.assignProfessionWhenSpawned) {
this.assignProfessionWhenSpawned = false; this.assignProfessionWhenSpawned = false;
@@ -262,7 +279,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @@ -264,7 +279,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
this.lastTradedPlayer = null; this.lastTradedPlayer = null;
} }
- if (!this.isNoAi() && this.random.nextInt(100) == 0) { - if (!this.isNoAi() && this.random.nextInt(100) == 0) {
+ if (!inactive && !this.isNoAi() && this.random.nextInt(100) == 0) { // Paper + if (!inactive && !this.isNoAi() && this.random.nextInt(100) == 0) { // Paper - EAR 2
Raid raid = ((ServerLevel) this.level()).getRaidAt(this.blockPosition()); Raid raid = world.getRaidAt(this.blockPosition());
if (raid != null && raid.isActive() && !raid.isOver()) { if (raid != null && raid.isActive() && !raid.isOver()) {
@@ -273,6 +290,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @@ -275,6 +290,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
if (this.getVillagerData().getProfession() == VillagerProfession.NONE && this.isTrading()) { if (this.getVillagerData().getProfession() == VillagerProfession.NONE && this.isTrading()) {
this.stopTrading(); this.stopTrading();
} }
+ if (inactive) return; // Paper + if (inactive) return; // Paper - EAR 2
super.customServerAiStep(); super.customServerAiStep(world);
} }
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java b/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java diff --git a/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java b/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java
index 0b7f52021441d633c37543e8ae485e81c292b747..d7f8464bf3eed0e42a5fc7f14a5b243d171f8b5e 100644 index f0a005724ab64a3b0cbc44d8f430716f7958461c..d81a6874e8b25f098df619f84c359e146c7f64de 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java --- a/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java
@@ -52,6 +52,7 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper @@ -47,6 +47,7 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper
if (bl != this.isEnabled()) { if (bl != this.isEnabled()) {
this.setEnabled(bl); this.setEnabled(bl);
} }
@ -314,7 +308,7 @@ index 0b7f52021441d633c37543e8ae485e81c292b747..d7f8464bf3eed0e42a5fc7f14a5b243d
} }
public boolean isEnabled() { public boolean isEnabled() {
@@ -92,11 +93,13 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper @@ -100,11 +101,13 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper
public boolean suckInItems() { public boolean suckInItems() {
if (HopperBlockEntity.suckInItems(this.level(), this)) { if (HopperBlockEntity.suckInItems(this.level(), this)) {
@ -328,7 +322,7 @@ index 0b7f52021441d633c37543e8ae485e81c292b747..d7f8464bf3eed0e42a5fc7f14a5b243d
return true; return true;
} }
} }
@@ -126,4 +129,11 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper @@ -139,4 +142,11 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper
public AbstractContainerMenu createMenu(int syncId, Inventory playerInventory) { public AbstractContainerMenu createMenu(int syncId, Inventory playerInventory) {
return new HopperMenu(syncId, playerInventory, this); return new HopperMenu(syncId, playerInventory, this);
} }
@ -341,10 +335,10 @@ index 0b7f52021441d633c37543e8ae485e81c292b747..d7f8464bf3eed0e42a5fc7f14a5b243d
+ +
} }
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 574175449af5b767f28e95ff8708ed37fedf4c7d..ce9350ed3c5c5fbbd9b2ade9ae2880e03305c787 100644 index 8adf12491e01830464b07e7a795db995d31f7a31..cef07ec3dfc8db3f3206fa2f5c2acf64c4b4aa65 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -157,6 +157,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @@ -157,6 +157,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public Map<BlockPos, BlockEntity> capturedTileEntities = new java.util.LinkedHashMap<>(); // Paper - Retain block place order when capturing blockstates public Map<BlockPos, BlockEntity> capturedTileEntities = new java.util.LinkedHashMap<>(); // Paper - Retain block place order when capturing blockstates
public List<ItemEntity> captureDrops; public List<ItemEntity> captureDrops;
public final it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<SpawnCategory> ticksPerSpawnCategory = new it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<>(); public final it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<SpawnCategory> ticksPerSpawnCategory = new it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<>();
@ -358,10 +352,10 @@ index 574175449af5b767f28e95ff8708ed37fedf4c7d..ce9350ed3c5c5fbbd9b2ade9ae2880e0
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
// Paper start - add paper world config // Paper start - add paper world config
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
index d7b963571c900f0f68005d6954bcd9ef1d9e0b7c..b35f476e26a020cf75e53a5eb488717d996a6935 100644 index 46afba838cf12eeb1bbccaa260131a76f090364b..e1c9a961064887070b29207efd7af47884f8dc29 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
@@ -148,6 +148,10 @@ public class PistonMovingBlockEntity extends BlockEntity { @@ -149,6 +149,10 @@ public class PistonMovingBlockEntity extends BlockEntity {
} }
entity.setDeltaMovement(e, g, h); entity.setDeltaMovement(e, g, h);
@ -373,7 +367,7 @@ index d7b963571c900f0f68005d6954bcd9ef1d9e0b7c..b35f476e26a020cf75e53a5eb488717d
} }
} }
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 9fb9fa62c32445ac3c3883a6433759c86dcfc428..bf2d18f74b0f0da7c3c30310c74224a1c0853564 100644 index ad15c7db36bdeadaa8f2ec8f15f41d6f3395bd55..e4252c5a6aec351a4a0a8be372d3b63f7fb771e7 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java --- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -1,33 +1,43 @@ @@ -1,33 +1,43 @@
@ -606,7 +600,7 @@ index 9fb9fa62c32445ac3c3883a6433759c86dcfc428..bf2d18f74b0f0da7c3c30310c74224a1
- return true; - return true;
+ return 10; // Paper + return 10; // Paper
} }
} else if ( !( (AbstractArrow) entity ).inGround ) } else if ( !( (AbstractArrow) entity ).isInGround() )
{ {
- return true; - return true;
+ return 1; // Paper + return 1; // Paper