Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
aromaa committed Apr 29, 2024
1 parent c9ce8da commit bdf3f4b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion SpongeAPI
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
package org.spongepowered.common.world.level.chunk.storage;

import com.google.common.collect.ImmutableList;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.Tuple;
import net.minecraft.world.level.Level;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.spongepowered.api.data.persistence.DataContainer;
Expand Down Expand Up @@ -55,9 +55,9 @@
import java.util.function.Predicate;
import java.util.stream.Stream;

public final class SpongeChunkEntities implements EntityChunk {
public final class SpongeEntityChunk implements EntityChunk {

private final Level level;
private final ServerLevel level;
private final Vector3i chunkPosition;
private final Stream<net.minecraft.world.entity.Entity> entities;

Expand All @@ -66,8 +66,8 @@ public final class SpongeChunkEntities implements EntityChunk {
private @MonotonicNonNull Vector3i blockMax;
private @MonotonicNonNull List<net.minecraft.world.entity.Entity> newEntities;

public SpongeChunkEntities(final Level chunkLayout, final Vector3i chunkPosition, final Stream<net.minecraft.world.entity.Entity> entities) {
this.level = chunkLayout;
public SpongeEntityChunk(final ServerLevel level, final Vector3i chunkPosition, final Stream<net.minecraft.world.entity.Entity> entities) {
this.level = level;
this.chunkPosition = chunkPosition;
this.entities = entities;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
import org.spongepowered.common.event.ShouldFire;
import org.spongepowered.common.event.tracking.PhaseTracker;
import org.spongepowered.common.util.VecHelper;
import org.spongepowered.common.world.level.chunk.storage.SpongeChunkEntities;
import org.spongepowered.common.world.level.chunk.storage.SpongeEntityChunk;
import org.spongepowered.common.world.level.chunk.storage.SpongeIOWorkerType;
import org.spongepowered.math.vector.Vector3i;

Expand All @@ -75,9 +75,9 @@ public abstract class EntityStorageMixin {
}

final Vector3i chunkPos = VecHelper.toVector3i($$0x);
final SpongeChunkEntities entities = new SpongeChunkEntities(this.level, chunkPos, cir.getReturnValue().getEntities());
final SpongeEntityChunk entities = new SpongeEntityChunk(this.level, chunkPos, cir.getReturnValue().getEntities());
final ChunkEvent.Entities.Load loadEvent = SpongeEventFactory.createChunkEventEntitiesLoad(PhaseTracker.getInstance().currentCause(),
chunkPos, entities, (ResourceKey) (Object) this.level.dimension().location());
entities, chunkPos, (ResourceKey) (Object) this.level.dimension().location());

SpongeCommon.post(loadEvent);

Expand All @@ -95,9 +95,9 @@ public abstract class EntityStorageMixin {

final Vector3i chunkPos = VecHelper.toVector3i($$0.getPos());

final SpongeChunkEntities entities = new SpongeChunkEntities(this.level, chunkPos, $$0.getEntities());
final SpongeEntityChunk entities = new SpongeEntityChunk(this.level, chunkPos, $$0.getEntities());
final ChunkEvent.Entities.Save.Pre saveEvent = SpongeEventFactory.createChunkEventEntitiesSavePre(PhaseTracker.getInstance().currentCause(),
chunkPos, entities, (ResourceKey) (Object) this.level.dimension().location());
entities, chunkPos, (ResourceKey) (Object) this.level.dimension().location());

if (SpongeCommon.post(saveEvent)) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,11 @@ public void onChunkBlocksSavePost(final ChunkEvent.Blocks.Save.Post event) {
@Listener
public void onChunkEntitiesLoad(final ChunkEvent.Entities.Load event) {
ChunkEventTest.this.addEntityLoad.forEach(e -> {
final Entity entity = event.entityVolume().createEntity(e, event.entityVolume().min().add(8, event.entityVolume().size().y() / 2, 8));
final Entity entity = event.chunk().createEntity(e, event.chunk().min().add(8, event.chunk().size().y() / 2, 8));
entity.offer(Keys.TRANSIENT, true);
entity.offer(Keys.IS_GRAVITY_AFFECTED, false);
entity.offer(Keys.IS_AI_ENABLED, false);
event.entityVolume().spawnEntity(entity);
event.chunk().spawnEntity(entity);
});
if (ChunkEventTest.this.logEvents) {
Sponge.game().systemSubject().sendMessage(Component.text("Load Chunk Entities " + event.chunkPosition() + " in " + event.worldKey().asString()));
Expand All @@ -259,7 +259,7 @@ public void onChunkEntitiesSavePre(final ChunkEvent.Entities.Save.Pre event) {
return;
}
if (!ChunkEventTest.this.filterEntitySave.isEmpty()) {
event.entityVolume().entities().forEach(e -> {
event.chunk().entities().forEach(e -> {
if (ChunkEventTest.this.filterEntitySave.contains(e.type())) {
e.remove();
}
Expand Down

0 comments on commit bdf3f4b

Please sign in to comment.