Co-authored-by: Bjarne Koll <git@lynxplay.dev>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
Co-authored-by: MiniDigger | Martin <admin@minidigger.dev>
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Co-authored-by: Shane Freeder <theboyetronic@gmail.com>
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
Co-authored-by: Tamion <70228790+notTamion@users.noreply.github.com>
Co-authored-by: Warrior <50800980+Warriorrrr@users.noreply.github.com>
This commit is contained in:
Nassim Jahnke
2025-04-12 17:26:44 +02:00
parent 0767902699
commit f00727c57e
2092 changed files with 50551 additions and 48729 deletions

View File

@@ -1,15 +1,17 @@
--- a/net/minecraft/world/level/entity/EntityAccess.java
+++ b/net/minecraft/world/level/entity/EntityAccess.java
@@ -23,6 +_,12 @@
@@ -18,7 +_,13 @@
void setRemoved(Entity.RemovalReason removalReason);
Stream<? extends EntityAccess> getPassengersAndSelf();
- void setRemoved(Entity.RemovalReason removalReason);
+ // CraftBukkit start - add Bukkit remove cause
+ default void setRemoved(Entity.RemovalReason removalReason, org.bukkit.event.entity.EntityRemoveEvent.Cause eventCause) {
+ this.setRemoved(removalReason);
+ default void setRemoved(Entity.RemovalReason removalReason) {
+ this.setRemoved(removalReason, null);
+ }
+ // CraftBukkit end
+
+ void setRemoved(Entity.RemovalReason removalReason, @javax.annotation.Nullable org.bukkit.event.entity.EntityRemoveEvent.Cause eventCause);
+ // CraftBukkit end - add Bukkit remove cause
boolean shouldBeSaved();
boolean isAlwaysTicking();

View File

@@ -43,7 +43,7 @@
if (!this.addEntityUuid(entity)) {
return false;
} else {
@@ -109,19 +_,23 @@
@@ -113,19 +_,23 @@
}
void startTicking(T entity) {
@@ -67,7 +67,7 @@
this.callbacks.onTrackingEnd(entity);
this.visibleEntityStorage.remove(entity);
}
@@ -132,6 +_,7 @@
@@ -136,6 +_,7 @@
}
public void updateChunkStatus(ChunkPos pos, Visibility visibility) {
@@ -75,7 +75,7 @@
long packedChunkPos = pos.toLong();
if (visibility == Visibility.HIDDEN) {
this.chunkVisibility.remove(packedChunkPos);
@@ -165,6 +_,7 @@
@@ -169,6 +_,7 @@
}
public void ensureChunkQueuedForLoad(long chunkPosValue) {
@@ -83,7 +83,7 @@
PersistentEntitySectionManager.ChunkLoadStatus chunkLoadStatus = this.chunkLoadStatuses.get(chunkPosValue);
if (chunkLoadStatus == PersistentEntitySectionManager.ChunkLoadStatus.FRESH) {
this.requestChunkLoad(chunkPosValue);
@@ -172,6 +_,11 @@
@@ -176,6 +_,11 @@
}
private boolean storeChunkSections(long chunkPosValue, Consumer<T> entityAction) {
@@ -95,7 +95,7 @@
PersistentEntitySectionManager.ChunkLoadStatus chunkLoadStatus = this.chunkLoadStatuses.get(chunkPosValue);
if (chunkLoadStatus == PersistentEntitySectionManager.ChunkLoadStatus.PENDING) {
return false;
@@ -182,6 +_,7 @@
@@ -186,6 +_,7 @@
.collect(Collectors.toList());
if (list.isEmpty()) {
if (chunkLoadStatus == PersistentEntitySectionManager.ChunkLoadStatus.LOADED) {
@@ -103,7 +103,7 @@
this.permanentStorage.storeEntities(new ChunkEntities<>(new ChunkPos(chunkPosValue), ImmutableList.of()));
}
@@ -190,6 +_,7 @@
@@ -194,6 +_,7 @@
this.requestChunkLoad(chunkPosValue);
return false;
} else {
@@ -111,7 +111,7 @@
this.permanentStorage.storeEntities(new ChunkEntities<>(new ChunkPos(chunkPosValue), list));
list.forEach(entityAction);
return true;
@@ -198,6 +_,7 @@
@@ -202,6 +_,7 @@
}
private void requestChunkLoad(long chunkPosValue) {
@@ -119,7 +119,7 @@
this.chunkLoadStatuses.put(chunkPosValue, PersistentEntitySectionManager.ChunkLoadStatus.PENDING);
ChunkPos chunkPos = new ChunkPos(chunkPosValue);
this.permanentStorage.loadEntities(chunkPos).thenAccept(this.loadingInbox::add).exceptionally(throwable -> {
@@ -207,7 +_,8 @@
@@ -211,7 +_,8 @@
}
private boolean processChunkUnload(long chunkPosValue) {
@@ -129,7 +129,7 @@
if (!flag) {
return false;
} else {
@@ -217,7 +_,7 @@
@@ -221,7 +_,7 @@
}
private void unloadEntity(EntityAccess entity) {
@@ -138,7 +138,7 @@
entity.setLevelCallback(EntityInLevelCallback.NULL);
}
@@ -227,14 +_,20 @@
@@ -231,14 +_,20 @@
}
private void processPendingLoads() {
@@ -159,7 +159,7 @@
this.processPendingLoads();
this.processUnloads();
}
@@ -252,6 +_,7 @@
@@ -256,6 +_,7 @@
}
public void autoSave() {
@@ -167,7 +167,7 @@
this.getAllChunksToSave().forEach(packedChunkPos -> {
boolean flag = this.chunkVisibility.get(packedChunkPos) == Visibility.HIDDEN;
if (flag) {
@@ -263,6 +_,7 @@
@@ -267,6 +_,7 @@
}
public void saveAll() {
@@ -175,7 +175,7 @@
LongSet allChunksToSave = this.getAllChunksToSave();
while (!allChunksToSave.isEmpty()) {
@@ -279,7 +_,13 @@
@@ -283,7 +_,13 @@
@Override
public void close() throws IOException {
@@ -190,7 +190,7 @@
this.permanentStorage.close();
}
@@ -380,6 +_,7 @@
@@ -384,6 +_,7 @@
BlockPos blockPos = this.entity.blockPosition();
long packedSectionPos = SectionPos.asLong(blockPos);
if (packedSectionPos != this.currentSectionKey) {
@@ -198,7 +198,7 @@
Visibility status = this.currentSection.getStatus();
if (!this.currentSection.remove(this.entity)) {
PersistentEntitySectionManager.LOGGER
@@ -427,6 +_,7 @@
@@ -431,6 +_,7 @@
@Override
public void onRemove(Entity.RemovalReason reason) {