Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package io.papermc.paper.event.entity;

import org.bukkit.entity.Entity;
import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.EntityEvent;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;

/**
* Called when a registered entity moves to another chunk section.
*/
@NullMarked
public final class EntityChangeChunkSectionEvent extends EntityEvent {

private static final HandlerList HANDLER_LIST = new HandlerList();

private final int previousX;
private final int previousY;
private final int previousZ;

@ApiStatus.Internal
public EntityChangeChunkSectionEvent(Entity entity, int previousX, int previousY, int previousZ) {
super(entity);
this.previousX = previousX;
this.previousY = previousY;
this.previousZ = previousZ;
}

/**
* Gets the {@code X} coordinate of the previous chunk section.
*
* @return the {@code X} coordinate
*/
public int getPreviousX() {
return this.previousX;
}

/**
* Gets the {@code Y} coordinate of the previous chunk section.
*
* @return the {@code Y} coordinate
*/
public int getPreviousY() {
return this.previousY;
}

/**
* Gets the {@code Z} coordinate of the previous chunk section.
*
* @return the {@code Z} coordinate
*/
public int getPreviousZ() {
return this.previousZ;
}

@Override
public HandlerList getHandlers() {
return HANDLER_LIST;
}

public static HandlerList getHandlerList() {
return HANDLER_LIST;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34050,10 +34050,10 @@ index 0000000000000000000000000000000000000000..863a9785c84af6e0c961ae32f0102b5d
+ }
+}
diff --git a/ca/spottedleaf/moonrise/paper/PaperHooks.java b/ca/spottedleaf/moonrise/paper/PaperHooks.java
index 7050fd6efb6fec16ba5657e254c54de1c671c9a0..aa14dd369d5d2c5c843839f289afdc39c200f0c3 100644
index dd7210ad012bc555941c876dbbfc0a7963b2f1e6..733738c9d8ac9df0ec8260a37b33ad576c9dadea 100644
--- a/ca/spottedleaf/moonrise/paper/PaperHooks.java
+++ b/ca/spottedleaf/moonrise/paper/PaperHooks.java
@@ -216,6 +216,11 @@ public final class PaperHooks extends BaseChunkSystemHooks implements PlatformHo
@@ -223,6 +223,11 @@ public final class PaperHooks extends BaseChunkSystemHooks implements PlatformHo
@Override
public CompoundTag convertNBT(final DSL.TypeReference type, final DataFixer dataFixer, final CompoundTag nbt,
final int fromVersion, final int toVersion) {
Expand All @@ -34065,7 +34065,7 @@ index 7050fd6efb6fec16ba5657e254c54de1c671c9a0..aa14dd369d5d2c5c843839f289afdc39
return (CompoundTag)dataFixer.update(
type, new Dynamic<>(NbtOps.INSTANCE, nbt), fromVersion, toVersion
).getValue();
@@ -257,4 +262,4 @@ public final class PaperHooks extends BaseChunkSystemHooks implements PlatformHo
@@ -264,4 +269,4 @@ public final class PaperHooks extends BaseChunkSystemHooks implements PlatformHo
public boolean addTicketForEnderPearls(final ServerLevel world) {
return !world.paperConfig().misc.legacyEnderPearlBehavior;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ index 0000000000000000000000000000000000000000..fff7a796a61542213bdaa417d44e25cd
+ }
+}
diff --git a/ca/spottedleaf/moonrise/paper/PaperHooks.java b/ca/spottedleaf/moonrise/paper/PaperHooks.java
index aa14dd369d5d2c5c843839f289afdc39c200f0c3..76f990f150f040b1ad6d7d5b91cfb34ebd6f436a 100644
index 733738c9d8ac9df0ec8260a37b33ad576c9dadea..dc0cb8025405f17139acf62b35a66a8ac1176069 100644
--- a/ca/spottedleaf/moonrise/paper/PaperHooks.java
+++ b/ca/spottedleaf/moonrise/paper/PaperHooks.java
@@ -13,6 +13,7 @@ import net.minecraft.server.level.ChunkHolder;
Expand All @@ -311,7 +311,7 @@ index aa14dd369d5d2c5c843839f289afdc39c200f0c3..76f990f150f040b1ad6d7d5b91cfb34e
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.boss.enderdragon.EnderDragonPart;
import net.minecraft.world.level.BlockGetter;
@@ -150,7 +151,15 @@ public final class PaperHooks extends BaseChunkSystemHooks implements PlatformHo
@@ -157,7 +158,15 @@ public final class PaperHooks extends BaseChunkSystemHooks implements PlatformHo

@Override
public long[] getCounterTypesUncached(final net.minecraft.server.level.TicketType type) {
Expand All @@ -328,7 +328,7 @@ index aa14dd369d5d2c5c843839f289afdc39c200f0c3..76f990f150f040b1ad6d7d5b91cfb34e
}

@Override
@@ -249,7 +258,7 @@ public final class PaperHooks extends BaseChunkSystemHooks implements PlatformHo
@@ -256,7 +265,7 @@ public final class PaperHooks extends BaseChunkSystemHooks implements PlatformHo
@Override
public void postLoadProtoChunk(final ServerLevel world, final ProtoChunk chunk) {
try (final net.minecraft.util.ProblemReporter.ScopedCollector scopedCollector = new net.minecraft.util.ProblemReporter.ScopedCollector(chunk.problemPath(), LOGGER)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- /dev/null
+++ b/ca/spottedleaf/moonrise/paper/PaperHooks.java
@@ -1,0 +_,260 @@
@@ -1,0 +_,267 @@
+package ca.spottedleaf.moonrise.paper;
+
+import ca.spottedleaf.moonrise.common.PlatformHooks;
Expand Down Expand Up @@ -143,7 +143,14 @@
+
+ @Override
+ public void entityMove(final Entity entity, final long oldSection, final long newSection) {
+
+ // Paper start - Add EntityChangeChunkSectionEvent
+ new io.papermc.paper.event.entity.EntityChangeChunkSectionEvent(
+ entity.getBukkitEntity(),
+ ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkSectionX(oldSection),
+ ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkSectionY(oldSection),
+ ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkSectionZ(oldSection)
+ ).callEvent();
+ // Paper end - Add EntityChangeChunkSectionEvent
+ }
+
+ @Override
Expand Down
Loading