Compare commits
2 Commits
v0.4.0-bet
...
mc/1.21.6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a33ac1dc01 | ||
|
|
da21aeca85 |
@@ -273,7 +273,7 @@ public final class FabricHooks extends BaseChunkSystemHooks implements PlatformH
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addTicketForEnderPearls() {
|
||||
public boolean addTicketForEnderPearls(final ServerLevel world) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,6 @@ junit_version=5.11.3
|
||||
fabric_lithium_version=nhc57Td2
|
||||
neo_lithium_version=P5VT33Jo
|
||||
# Mod Properties
|
||||
mod_version=0.4.0-beta.2
|
||||
mod_version=0.4.0-SNAPSHOT
|
||||
maven_group=ca.spottedleaf.moonrise
|
||||
archives_base_name=moonrise
|
||||
|
||||
@@ -288,7 +288,7 @@ public final class NeoForgeHooks extends BaseChunkSystemHooks implements Platfor
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addTicketForEnderPearls() {
|
||||
public boolean addTicketForEnderPearls(final ServerLevel world) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public interface PlatformHooks extends ChunkSystemHooks {
|
||||
|
||||
public int modifyEntityTrackingRange(final Entity entity, final int currentRange);
|
||||
|
||||
public boolean addTicketForEnderPearls();
|
||||
public boolean addTicketForEnderPearls(final ServerLevel world);
|
||||
|
||||
public static final class Holder {
|
||||
private Holder() {
|
||||
|
||||
@@ -30,10 +30,12 @@ public final class ServerEntityLookup extends EntityLookup {
|
||||
// been implemented, but I don't think Vanilla has proper entity add/remove hooks like we do. Fixes MC-297591
|
||||
private static final TicketType ENDER_PEARL_TICKER = ChunkSystemTicketType.create("chunk_system:ender_pearl_ticker", null);
|
||||
private final Long2IntOpenHashMap enderPearlChunkCount = new Long2IntOpenHashMap();
|
||||
private final boolean keepEnderPearlsTicking;
|
||||
|
||||
public ServerEntityLookup(final ServerLevel world, final LevelCallback<Entity> worldCallback) {
|
||||
super(world, worldCallback);
|
||||
this.serverWorld = world;
|
||||
this.keepEnderPearlsTicking = PlatformHooks.get().addTicketForEnderPearls(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -136,6 +138,10 @@ public final class ServerEntityLookup extends EntityLookup {
|
||||
}
|
||||
|
||||
private void addEnderPearl(final long coordinate) {
|
||||
if (!this.keepEnderPearlsTicking) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int oldCount = this.enderPearlChunkCount.addTo(coordinate, 1);
|
||||
if (oldCount != 0) {
|
||||
return;
|
||||
@@ -145,6 +151,10 @@ public final class ServerEntityLookup extends EntityLookup {
|
||||
}
|
||||
|
||||
private void removeEnderPearl(final long coordinate) {
|
||||
if (!this.keepEnderPearlsTicking) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int oldCount = this.enderPearlChunkCount.addTo(coordinate, -1);
|
||||
if (oldCount != 1) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user