This commit is contained in:
luk
2026-02-19 01:57:13 +00:00
parent 428f3171e5
commit fa97cfa130
5 changed files with 69 additions and 70 deletions

View File

@@ -55,7 +55,7 @@ val hytaleServer: Configuration by configurations.creating
val patchedJar = rootDir.resolve("repo/applications/HytaleServerPatched.jar") val patchedJar = rootDir.resolve("repo/applications/HytaleServerPatched.jar")
dependencies { dependencies {
hytaleServer("com.hypixel.hytale:Server:2026.02.17-255364b8e") hytaleServer("com.hypixel.hytale:Server:2026.02.18-f3b8fff9")
} }
configurations { configurations {

View File

@@ -128,15 +128,14 @@ public class MemoriesPlugin extends JavaPlugin {
@Override @Override
protected void start() { protected void start() {
try {
Path path = Constants.UNIVERSE_PATH.resolve("memories.json"); Path path = Constants.UNIVERSE_PATH.resolve("memories.json");
if (Files.exists(path)) { if (Files.exists(path)) {
this.recordedMemories = RawJsonReader.readSync(path, MemoriesPlugin.RecordedMemories.CODEC, this.getLogger()); this.recordedMemories = RawJsonReader.readSyncWithBak(path, MemoriesPlugin.RecordedMemories.CODEC, this.getLogger());
} else { if (this.recordedMemories == null) {
this.recordedMemories = new MemoriesPlugin.RecordedMemories(); this.recordedMemories = new MemoriesPlugin.RecordedMemories();
} }
} catch (IOException var2) { } else {
throw new RuntimeException(var2); this.recordedMemories = new MemoriesPlugin.RecordedMemories();
} }
this.hasInitializedMemories = true; this.hasInitializedMemories = true;

View File

@@ -232,7 +232,6 @@ public class ArchetypeChunk<ECS_TYPE> {
@Nonnull IntObjectConsumer<Ref<ECS_TYPE>> referenceConsumer @Nonnull IntObjectConsumer<Ref<ECS_TYPE>> referenceConsumer
) { ) {
int firstTransfered = Integer.MIN_VALUE; int firstTransfered = Integer.MIN_VALUE;
int lastTransfered = Integer.MIN_VALUE;
Component<ECS_TYPE>[] entityComponents = new Component[this.archetype.length()]; Component<ECS_TYPE>[] entityComponents = new Component[this.archetype.length()];
for (int entityIndex = 0; entityIndex < this.entitiesSize; entityIndex++) { for (int entityIndex = 0; entityIndex < this.entitiesSize; entityIndex++) {
@@ -241,7 +240,6 @@ public class ArchetypeChunk<ECS_TYPE> {
firstTransfered = entityIndex; firstTransfered = entityIndex;
} }
lastTransfered = entityIndex;
Ref<ECS_TYPE> ref = this.refs[entityIndex]; Ref<ECS_TYPE> ref = this.refs[entityIndex];
this.refs[entityIndex] = null; this.refs[entityIndex] = null;
@@ -263,29 +261,31 @@ public class ArchetypeChunk<ECS_TYPE> {
} }
if (firstTransfered != Integer.MIN_VALUE) { if (firstTransfered != Integer.MIN_VALUE) {
if (lastTransfered == this.entitiesSize - 1) { int writeIndex = firstTransfered;
this.entitiesSize = firstTransfered;
return; for (int readIndex = firstTransfered + 1; readIndex < this.entitiesSize; readIndex++) {
if (this.refs[readIndex] != null) {
if (writeIndex != readIndex) {
this.fillEmptyIndex(writeIndex, readIndex);
} }
int newSize = this.entitiesSize - (lastTransfered - firstTransfered + 1); writeIndex++;
for (int entityIndexx = firstTransfered; entityIndexx <= lastTransfered; entityIndexx++) {
if (this.refs[entityIndexx] == null) {
int lastIndex = this.entitiesSize - 1;
if (lastIndex == lastTransfered) {
break;
}
if (entityIndexx != lastIndex) {
this.fillEmptyIndex(entityIndexx, lastIndex);
}
this.entitiesSize--;
} }
} }
this.entitiesSize = newSize; for (int ix = writeIndex; ix < this.entitiesSize; ix++) {
this.refs[ix] = null;
for (int j = this.archetype.getMinIndex(); j < this.archetype.length(); j++) {
ComponentType<ECS_TYPE, ? extends Component<ECS_TYPE>> componentType = (ComponentType<ECS_TYPE, ? extends Component<ECS_TYPE>>)this.archetype
.get(j);
if (componentType != null) {
this.components[componentType.getIndex()][ix] = null;
}
}
}
this.entitiesSize = writeIndex;
} }
} }

View File

@@ -157,7 +157,7 @@ public class PluginClassLoader extends URLClassLoader {
public static boolean isFromThirdPartyPlugin(@Nullable Throwable throwable) { public static boolean isFromThirdPartyPlugin(@Nullable Throwable throwable) {
while (throwable != null) { while (throwable != null) {
for (StackTraceElement element : throwable.getStackTrace()) { for (StackTraceElement element : throwable.getStackTrace()) {
if ("ThirdParty".equals(element.getClassLoaderName())) { if (element.getClassLoaderName() != null && element.getClassLoaderName().startsWith("ThirdParty")) {
return true; return true;
} }
} }

View File

@@ -249,14 +249,11 @@ public class WorldSpawningSystem extends TickingSystem<ChunkStore> {
boolean fullyPopulated = true; boolean fullyPopulated = true;
if (wasFullyPopulated) { if (wasFullyPopulated) {
for (Ref<ChunkStore> chunkRef : chunkRefSet) { for (Ref<ChunkStore> chunkRef : chunkRefSet) {
if (chunkRef.isValid()) {
ChunkSpawnData chunkSpawnDataComponent = store.getComponent(chunkRef, this.chunkSpawnDataComponentType); ChunkSpawnData chunkSpawnDataComponent = store.getComponent(chunkRef, this.chunkSpawnDataComponentType);
if (chunkSpawnDataComponent != null) {
assert chunkSpawnDataComponent != null;
ChunkSpawnedNPCData chunkSpawnedNPCDataComponent = store.getComponent(chunkRef, this.chunkSpawnedNPCDataComponentType); ChunkSpawnedNPCData chunkSpawnedNPCDataComponent = store.getComponent(chunkRef, this.chunkSpawnedNPCDataComponentType);
if (chunkSpawnedNPCDataComponent != null) {
assert chunkSpawnedNPCDataComponent != null;
ChunkEnvironmentSpawnData chunkEnvironmentSpawnData = chunkSpawnDataComponent.getEnvironmentSpawnData(environmentIndex); ChunkEnvironmentSpawnData chunkEnvironmentSpawnData = chunkSpawnDataComponent.getEnvironmentSpawnData(environmentIndex);
fullyPopulated = fullyPopulated fullyPopulated = fullyPopulated
&& chunkEnvironmentSpawnData.isFullyPopulated(chunkSpawnedNPCDataComponent.getEnvironmentSpawnCount(environmentIndex)); && chunkEnvironmentSpawnData.isFullyPopulated(chunkSpawnedNPCDataComponent.getEnvironmentSpawnCount(environmentIndex));
@@ -267,34 +264,37 @@ public class WorldSpawningSystem extends TickingSystem<ChunkStore> {
: 0.0; : 0.0;
} }
} }
}
}
}
} else { } else {
for (Ref<ChunkStore> chunkRef : chunkRefSet) { for (Ref<ChunkStore> chunkRefx : chunkRefSet) {
ChunkSpawnData chunkSpawnDataComponentx = store.getComponent(chunkRef, this.chunkSpawnDataComponentType); if (chunkRefx.isValid()) {
ChunkSpawnData chunkSpawnDataComponent = store.getComponent(chunkRefx, this.chunkSpawnDataComponentType);
assert chunkSpawnDataComponentx != null; if (chunkSpawnDataComponent != null) {
ChunkSpawnedNPCData chunkSpawnedNPCDataComponent = store.getComponent(chunkRefx, this.chunkSpawnedNPCDataComponentType);
ChunkSpawnedNPCData chunkSpawnedNPCDataComponentx = store.getComponent(chunkRef, this.chunkSpawnedNPCDataComponentType); if (chunkSpawnedNPCDataComponent != null) {
ChunkEnvironmentSpawnData chunkEnvironmentSpawnData = chunkSpawnDataComponent.getEnvironmentSpawnData(environmentIndex);
assert chunkSpawnedNPCDataComponentx != null; double spawnCount = chunkSpawnedNPCDataComponent.getEnvironmentSpawnCount(environmentIndex);
ChunkEnvironmentSpawnData chunkEnvironmentSpawnData = chunkSpawnDataComponentx.getEnvironmentSpawnData(environmentIndex);
double spawnCount = chunkSpawnedNPCDataComponentx.getEnvironmentSpawnCount(environmentIndex);
fullyPopulated = fullyPopulated && chunkEnvironmentSpawnData.isFullyPopulated(spawnCount); fullyPopulated = fullyPopulated && chunkEnvironmentSpawnData.isFullyPopulated(spawnCount);
if (chunkEnvironmentSpawnData.isRoleSpawnable(roleIndex)) { if (chunkEnvironmentSpawnData.isRoleSpawnable(roleIndex)) {
spawnable = true; spawnable = true;
weight += store.getComponent(chunkRef, this.spawnJobDataComponentType) == null && !getAndUpdateSpawnCooldown(chunkSpawnDataComponentx) weight += store.getComponent(chunkRefx, this.spawnJobDataComponentType) == null && !getAndUpdateSpawnCooldown(chunkSpawnDataComponent)
? chunkEnvironmentSpawnData.getWeight(spawnCount) ? chunkEnvironmentSpawnData.getWeight(spawnCount)
: 0.0; : 0.0;
} }
} }
} }
}
}
}
spawnData.setFullyPopulated(fullyPopulated); spawnData.setFullyPopulated(fullyPopulated);
if (spawnable) { if (spawnable) {
return RandomExtra.randomWeightedElement( return RandomExtra.randomWeightedElement(
chunkRefSet, chunkRefSet,
(chunkRefx, index) -> { (chunkRefxx, index) -> {
ChunkSpawnData chunkSpawnDataComponent = store.getComponent(chunkRefx, this.chunkSpawnDataComponentType); ChunkSpawnData chunkSpawnDataComponent = store.getComponent(chunkRefxx, this.chunkSpawnDataComponentType);
assert chunkSpawnDataComponent != null; assert chunkSpawnDataComponent != null;
@@ -302,24 +302,24 @@ public class WorldSpawningSystem extends TickingSystem<ChunkStore> {
return chunkEnvironmentSpawnDatax.isRoleSpawnable(index); return chunkEnvironmentSpawnDatax.isRoleSpawnable(index);
}, },
wasFullyPopulated wasFullyPopulated
? (chunkRefx, index) -> { ? (chunkRefxx, index) -> {
ChunkSpawnData spawnChunkDataComponent = store.getComponent(chunkRefx, this.chunkSpawnDataComponentType); ChunkSpawnData spawnChunkDataComponent = store.getComponent(chunkRefxx, this.chunkSpawnDataComponentType);
assert spawnChunkDataComponent != null; assert spawnChunkDataComponent != null;
return store.getComponent(chunkRefx, this.spawnJobDataComponentType) == null && !spawnChunkDataComponent.isOnSpawnCooldown() ? 1.0 : 0.0; return store.getComponent(chunkRefxx, this.spawnJobDataComponentType) == null && !spawnChunkDataComponent.isOnSpawnCooldown() ? 1.0 : 0.0;
} }
: (chunkRefx, index) -> { : (chunkRefxx, index) -> {
ChunkSpawnData chunkSpawnDataComponent = store.getComponent(chunkRefx, this.chunkSpawnDataComponentType); ChunkSpawnData chunkSpawnDataComponent = store.getComponent(chunkRefxx, this.chunkSpawnDataComponentType);
assert chunkSpawnDataComponent != null; assert chunkSpawnDataComponent != null;
ChunkSpawnedNPCData chunkSpawnedNPCDataComponentx = store.getComponent(chunkRefx, this.chunkSpawnedNPCDataComponentType); ChunkSpawnedNPCData chunkSpawnedNPCDataComponentx = store.getComponent(chunkRefxx, this.chunkSpawnedNPCDataComponentType);
assert chunkSpawnedNPCDataComponentx != null; assert chunkSpawnedNPCDataComponentx != null;
ChunkEnvironmentSpawnData chunkEnvironmentSpawnDatax = chunkSpawnDataComponent.getEnvironmentSpawnData(environmentIndex); ChunkEnvironmentSpawnData chunkEnvironmentSpawnDatax = chunkSpawnDataComponent.getEnvironmentSpawnData(environmentIndex);
return store.getComponent(chunkRefx, this.spawnJobDataComponentType) == null && !chunkSpawnDataComponent.isOnSpawnCooldown() return store.getComponent(chunkRefxx, this.spawnJobDataComponentType) == null && !chunkSpawnDataComponent.isOnSpawnCooldown()
? chunkEnvironmentSpawnDatax.getWeight(chunkSpawnedNPCDataComponentx.getEnvironmentSpawnCount(environmentIndex)) ? chunkEnvironmentSpawnDatax.getWeight(chunkSpawnedNPCDataComponentx.getEnvironmentSpawnCount(environmentIndex))
: 0.0; : 0.0;
}, },