mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
Upstream has released updates that appear to apply and compile correctly Purpur Changes: PurpurMC/Purpur@c8a4f0b6 Updated Upstream (Paper) PurpurMC/Purpur@e8fe8ece forgot to commit this PurpurMC/Purpur@45bc9f41 Updated Upstream (Paper)
149 lines
7.2 KiB
Diff
149 lines
7.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
|
Date: Thu, 10 Jul 2025 04:51:08 +0300
|
|
Subject: [PATCH] Raytrace Entity Tracker
|
|
|
|
Original project: https://github.com/tr7zw/EntityCulling
|
|
Original license: Custom License
|
|
|
|
Original project: https://github.com/LogisticsCraft/OcclusionCulling
|
|
Original license: MIT
|
|
|
|
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
|
index 714a7722a45798a445acf3aeb1e7db5d250a9670..0e7a870e85be7f3a2856ce0ca9c861295a66e032 100644
|
|
--- a/net/minecraft/world/entity/Entity.java
|
|
+++ b/net/minecraft/world/entity/Entity.java
|
|
@@ -147,7 +147,7 @@ import net.minecraft.world.waypoints.WaypointTransmitter;
|
|
import org.jetbrains.annotations.Contract;
|
|
import org.slf4j.Logger;
|
|
|
|
-public abstract class Entity implements SyncedDataHolder, DebugValueSource, Nameable, ItemOwner, EntityAccess, ScoreHolder, DataComponentGetter, ca.spottedleaf.moonrise.patches.chunk_system.entity.ChunkSystemEntity, ca.spottedleaf.moonrise.patches.entity_tracker.EntityTrackerEntity { // Paper - rewrite chunk system // Paper - optimise entity tracker
|
|
+public abstract class Entity implements SyncedDataHolder, DebugValueSource, Nameable, ItemOwner, EntityAccess, ScoreHolder, DataComponentGetter, ca.spottedleaf.moonrise.patches.chunk_system.entity.ChunkSystemEntity, ca.spottedleaf.moonrise.patches.entity_tracker.EntityTrackerEntity, dev.tr7zw.entityculling.versionless.access.Cullable { // Paper - rewrite chunk system // Paper - optimise entity tracker // DivineMC - Raytrace Entity Tracker
|
|
public static javax.script.ScriptEngine scriptEngine = new javax.script.ScriptEngineManager().getEngineByName("rhino"); // Purpur - Configurable entity base attributes
|
|
// CraftBukkit start
|
|
private static final int CURRENT_LEVEL = 2;
|
|
@@ -5564,4 +5564,47 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
|
|
return false;
|
|
}
|
|
// Purpur end - Ridables
|
|
+
|
|
+ // DivineMC start - Raytrace Entity Tracker
|
|
+ private long lasttime = 0;
|
|
+ private boolean culled = false;
|
|
+ private boolean outOfCamera = false;
|
|
+
|
|
+ @Override
|
|
+ public void setTimeout() {
|
|
+ this.lasttime = System.currentTimeMillis() + 1000;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isForcedVisible() {
|
|
+ return this.lasttime > System.currentTimeMillis();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setCulled(boolean value) {
|
|
+ this.culled = value;
|
|
+ if (!value) {
|
|
+ setTimeout();
|
|
+ }
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isCulled() {
|
|
+ if (!org.bxteam.divinemc.config.DivineConfig.MiscCategory.retEnabled) return false;
|
|
+
|
|
+ return this.culled;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setOutOfCamera(boolean value) {
|
|
+ this.outOfCamera = value;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isOutOfCamera() {
|
|
+ if (!org.bxteam.divinemc.config.DivineConfig.MiscCategory.retEnabled) return false;
|
|
+
|
|
+ return this.outOfCamera;
|
|
+ }
|
|
+ // DivineMC end - Raytrace Entity Tracker
|
|
}
|
|
diff --git a/net/minecraft/world/entity/EntityType.java b/net/minecraft/world/entity/EntityType.java
|
|
index 7d5940327c5e7a945165228d502f678a8234cd02..5a4a337694c36e6342c0b0ae5034ac2f11d205a1 100644
|
|
--- a/net/minecraft/world/entity/EntityType.java
|
|
+++ b/net/minecraft/world/entity/EntityType.java
|
|
@@ -1201,6 +1201,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
|
private final float spawnDimensionsScale;
|
|
private final FeatureFlagSet requiredFeatures;
|
|
private final boolean allowedInPeaceful;
|
|
+ public boolean skipRaytracingCheck = false; // DivineMC - Raytrace Entity Tracker
|
|
|
|
private static <T extends Entity> EntityType<T> register(ResourceKey<EntityType<?>> key, EntityType.Builder<T> builder) {
|
|
return Registry.register(BuiltInRegistries.ENTITY_TYPE, key, builder.build(key));
|
|
diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java
|
|
index d5337d37be18d2ebb047e122b220e1a694f46696..bd41bbac179460d38edee624334cdcd0efb5504c 100644
|
|
--- a/net/minecraft/world/entity/player/Player.java
|
|
+++ b/net/minecraft/world/entity/player/Player.java
|
|
@@ -183,6 +183,25 @@ public abstract class Player extends Avatar implements ContainerUser {
|
|
public int burpDelay = 0; // Purpur - Burp delay
|
|
public boolean canPortalInstant = false; // Purpur - Add portal permission bypass
|
|
public int sixRowEnderchestSlotCount = -1; // Purpur - Barrels and enderchests 6 rows
|
|
+ // DivineMC start - Raytrace Entity Tracker
|
|
+ public dev.tr7zw.entityculling.CullTask cullTask;
|
|
+ {
|
|
+ if (!org.bxteam.divinemc.config.DivineConfig.MiscCategory.retEnabled) {
|
|
+ this.cullTask = null;
|
|
+ } else {
|
|
+ final com.logisticscraft.occlusionculling.OcclusionCullingInstance culling = new com.logisticscraft.occlusionculling.OcclusionCullingInstance(
|
|
+ org.bxteam.divinemc.config.DivineConfig.MiscCategory.retTracingDistance,
|
|
+ new dev.tr7zw.entityculling.DefaultChunkDataProvider(this.level())
|
|
+ );
|
|
+
|
|
+ this.cullTask = new dev.tr7zw.entityculling.CullTask(
|
|
+ culling, this,
|
|
+ org.bxteam.divinemc.config.DivineConfig.MiscCategory.retHitboxLimit,
|
|
+ org.bxteam.divinemc.config.DivineConfig.MiscCategory.retCheckIntervalMs
|
|
+ );
|
|
+ }
|
|
+ }
|
|
+ // DivineMC end - Raytrace Entity Tracker
|
|
|
|
// CraftBukkit start
|
|
public boolean fauxSleeping;
|
|
@@ -269,6 +288,25 @@ public abstract class Player extends Avatar implements ContainerUser {
|
|
|
|
@Override
|
|
public void tick() {
|
|
+ // DivineMC start - Raytrace Entity Tracker
|
|
+ if (!org.bxteam.divinemc.config.DivineConfig.MiscCategory.retEnabled) {
|
|
+ if (this.cullTask != null) this.cullTask.signalStop();
|
|
+ this.cullTask = null;
|
|
+ } else {
|
|
+ final com.logisticscraft.occlusionculling.OcclusionCullingInstance culling = new com.logisticscraft.occlusionculling.OcclusionCullingInstance(
|
|
+ org.bxteam.divinemc.config.DivineConfig.MiscCategory.retTracingDistance,
|
|
+ new dev.tr7zw.entityculling.DefaultChunkDataProvider(this.level())
|
|
+ );
|
|
+
|
|
+ this.cullTask = new dev.tr7zw.entityculling.CullTask(
|
|
+ culling, this,
|
|
+ org.bxteam.divinemc.config.DivineConfig.MiscCategory.retHitboxLimit,
|
|
+ org.bxteam.divinemc.config.DivineConfig.MiscCategory.retCheckIntervalMs
|
|
+ );
|
|
+ }
|
|
+ if (this.cullTask != null) this.cullTask.setup();
|
|
+ if (this.cullTask != null) this.cullTask.requestCullSignal();
|
|
+ // DivineMC end - Raytrace Entity Tracker
|
|
// Purpur start - Burp delay
|
|
if (this.burpDelay > 0 && --this.burpDelay == 0) {
|
|
this.level().playSound(null, getX(), getY(), getZ(), SoundEvents.PLAYER_BURP, SoundSource.PLAYERS, 1.0F, this.level().random.nextFloat() * 0.1F + 0.9F);
|
|
@@ -1314,6 +1352,7 @@ public abstract class Player extends Avatar implements ContainerUser {
|
|
if (this.hasContainerOpen()) {
|
|
this.doCloseContainer();
|
|
}
|
|
+ if (this.cullTask != null) this.cullTask.signalStop(); // DivineMC - Raytrace Entity Tracker
|
|
}
|
|
|
|
@Override
|