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
|
@Override
|
||||||
public boolean addTicketForEnderPearls() {
|
public boolean addTicketForEnderPearls(final ServerLevel world) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,6 @@ junit_version=5.11.3
|
|||||||
fabric_lithium_version=nhc57Td2
|
fabric_lithium_version=nhc57Td2
|
||||||
neo_lithium_version=P5VT33Jo
|
neo_lithium_version=P5VT33Jo
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=0.4.0-beta.2
|
mod_version=0.4.0-SNAPSHOT
|
||||||
maven_group=ca.spottedleaf.moonrise
|
maven_group=ca.spottedleaf.moonrise
|
||||||
archives_base_name=moonrise
|
archives_base_name=moonrise
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ public final class NeoForgeHooks extends BaseChunkSystemHooks implements Platfor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addTicketForEnderPearls() {
|
public boolean addTicketForEnderPearls(final ServerLevel world) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public interface PlatformHooks extends ChunkSystemHooks {
|
|||||||
|
|
||||||
public int modifyEntityTrackingRange(final Entity entity, final int currentRange);
|
public int modifyEntityTrackingRange(final Entity entity, final int currentRange);
|
||||||
|
|
||||||
public boolean addTicketForEnderPearls();
|
public boolean addTicketForEnderPearls(final ServerLevel world);
|
||||||
|
|
||||||
public static final class Holder {
|
public static final class Holder {
|
||||||
private 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
|
// 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 static final TicketType ENDER_PEARL_TICKER = ChunkSystemTicketType.create("chunk_system:ender_pearl_ticker", null);
|
||||||
private final Long2IntOpenHashMap enderPearlChunkCount = new Long2IntOpenHashMap();
|
private final Long2IntOpenHashMap enderPearlChunkCount = new Long2IntOpenHashMap();
|
||||||
|
private final boolean keepEnderPearlsTicking;
|
||||||
|
|
||||||
public ServerEntityLookup(final ServerLevel world, final LevelCallback<Entity> worldCallback) {
|
public ServerEntityLookup(final ServerLevel world, final LevelCallback<Entity> worldCallback) {
|
||||||
super(world, worldCallback);
|
super(world, worldCallback);
|
||||||
this.serverWorld = world;
|
this.serverWorld = world;
|
||||||
|
this.keepEnderPearlsTicking = PlatformHooks.get().addTicketForEnderPearls(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -136,6 +138,10 @@ public final class ServerEntityLookup extends EntityLookup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addEnderPearl(final long coordinate) {
|
private void addEnderPearl(final long coordinate) {
|
||||||
|
if (!this.keepEnderPearlsTicking) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final int oldCount = this.enderPearlChunkCount.addTo(coordinate, 1);
|
final int oldCount = this.enderPearlChunkCount.addTo(coordinate, 1);
|
||||||
if (oldCount != 0) {
|
if (oldCount != 0) {
|
||||||
return;
|
return;
|
||||||
@@ -145,6 +151,10 @@ public final class ServerEntityLookup extends EntityLookup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void removeEnderPearl(final long coordinate) {
|
private void removeEnderPearl(final long coordinate) {
|
||||||
|
if (!this.keepEnderPearlsTicking) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final int oldCount = this.enderPearlChunkCount.addTo(coordinate, -1);
|
final int oldCount = this.enderPearlChunkCount.addTo(coordinate, -1);
|
||||||
if (oldCount != 1) {
|
if (oldCount != 1) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user