mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 23:10:16 +01:00
readd bukkit extra data to entity tags
This commit is contained in:
parent
48be22a63e
commit
9e8a2de45b
8 changed files with 38 additions and 42 deletions
|
@ -28,10 +28,10 @@ index 678b3027e8c53e6021ea49afa69cdbe5f60dcf25..cce78d73e8adafd66d0f3ffb3fabb5e6
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||||
index e3a4cf9cd03670705391f4dc68f193d7cee656e0..f9c9485a051f5fa6d508b8a194c9f17657e1a0f4 100644
|
index cfd30aa774d3bb3049ff9331a623624c6a13f774..940509d1f31aedf20b8f5b9192c34ad004875728 100644
|
||||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||||
@@ -2654,6 +2654,14 @@ public class ServerPlayer extends Player {
|
@@ -2655,6 +2655,14 @@ public class ServerPlayer extends Player {
|
||||||
this.awardStat(Stats.DROP);
|
this.awardStat(Stats.DROP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ Optimise the stream.anyMatch statement to move to a bitset
|
||||||
where we can replace the call with a single bitwise operation.
|
where we can replace the call with a single bitwise operation.
|
||||||
|
|
||||||
diff --git a/net/minecraft/world/entity/ai/goal/Goal.java b/net/minecraft/world/entity/ai/goal/Goal.java
|
diff --git a/net/minecraft/world/entity/ai/goal/Goal.java b/net/minecraft/world/entity/ai/goal/Goal.java
|
||||||
index e99836c4073d8b25eddd3b4c784dbdb1f0c4f2b1..a2d788a656b2a5767c8a00bbcaca16efa2db8d24 100644
|
index d4f8387254a65b25fc808932a069298d0f8da091..5f5bf0e710ecff09a571091e5a923332be70cb74 100644
|
||||||
--- a/net/minecraft/world/entity/ai/goal/Goal.java
|
--- a/net/minecraft/world/entity/ai/goal/Goal.java
|
||||||
+++ b/net/minecraft/world/entity/ai/goal/Goal.java
|
+++ b/net/minecraft/world/entity/ai/goal/Goal.java
|
||||||
@@ -7,7 +7,15 @@ import net.minecraft.world.entity.Entity;
|
@@ -7,7 +7,15 @@ import net.minecraft.world.entity.Entity;
|
||||||
|
@ -15,15 +15,15 @@ index e99836c4073d8b25eddd3b4c784dbdb1f0c4f2b1..a2d788a656b2a5767c8a00bbcaca16ef
|
||||||
|
|
||||||
public abstract class Goal {
|
public abstract class Goal {
|
||||||
- private final EnumSet<Goal.Flag> flags = EnumSet.noneOf(Goal.Flag.class);
|
- private final EnumSet<Goal.Flag> flags = EnumSet.noneOf(Goal.Flag.class);
|
||||||
+ private final ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<net.minecraft.world.entity.ai.goal.Goal.Flag> goalTypes = new ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<>(Goal.Flag.class); // Paper - remove streams from pathfindergoalselector
|
+ private final ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<net.minecraft.world.entity.ai.goal.Goal.Flag> goalTypes = new ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<>(Goal.Flag.class); // Paper - remove streams from GoalSelector
|
||||||
+
|
+
|
||||||
+ // Paper start - remove streams from pathfindergoalselector; make sure types are not empty
|
+ // Paper start - remove streams from GoalSelector; make sure types are not empty
|
||||||
+ protected Goal() {
|
+ protected Goal() {
|
||||||
+ if (this.goalTypes.size() == 0) {
|
+ if (this.goalTypes.size() == 0) {
|
||||||
+ this.goalTypes.addUnchecked(Flag.UNKNOWN_BEHAVIOR);
|
+ this.goalTypes.addUnchecked(Flag.UNKNOWN_BEHAVIOR);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - remove streams from pathfindergoalselector
|
+ // Paper end - remove streams from GoalSelector
|
||||||
|
|
||||||
public abstract boolean canUse();
|
public abstract boolean canUse();
|
||||||
|
|
||||||
|
@ -33,13 +33,13 @@ index e99836c4073d8b25eddd3b4c784dbdb1f0c4f2b1..a2d788a656b2a5767c8a00bbcaca16ef
|
||||||
public void setFlags(EnumSet<Goal.Flag> flagSet) {
|
public void setFlags(EnumSet<Goal.Flag> flagSet) {
|
||||||
- this.flags.clear();
|
- this.flags.clear();
|
||||||
- this.flags.addAll(flagSet);
|
- this.flags.addAll(flagSet);
|
||||||
+ // Paper start - remove streams from pathfindergoalselector
|
+ // Paper start - remove streams from GoalSelector
|
||||||
+ this.goalTypes.clear();
|
+ this.goalTypes.clear();
|
||||||
+ this.goalTypes.addAllUnchecked(flagSet);
|
+ this.goalTypes.addAllUnchecked(flagSet);
|
||||||
+ if (this.goalTypes.size() == 0) {
|
+ if (this.goalTypes.size() == 0) {
|
||||||
+ this.goalTypes.addUnchecked(Flag.UNKNOWN_BEHAVIOR);
|
+ this.goalTypes.addUnchecked(Flag.UNKNOWN_BEHAVIOR);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - remove streams from pathfindergoalselector;
|
+ // Paper end - remove streams from GoalSelector
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -49,10 +49,10 @@ index e99836c4073d8b25eddd3b4c784dbdb1f0c4f2b1..a2d788a656b2a5767c8a00bbcaca16ef
|
||||||
|
|
||||||
- public EnumSet<Goal.Flag> getFlags() {
|
- public EnumSet<Goal.Flag> getFlags() {
|
||||||
- return this.flags;
|
- return this.flags;
|
||||||
+ // Paper start - remove streams from pathfindergoalselector
|
+ // Paper start - remove streams from GoalSelector
|
||||||
+ public ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<Goal.Flag> getFlags() {
|
+ public ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<Goal.Flag> getFlags() {
|
||||||
+ return this.goalTypes;
|
+ return this.goalTypes;
|
||||||
+ // Paper end - remove streams from pathfindergoalselector
|
+ // Paper end - remove streams from GoalSelector
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,10 +66,10 @@ index e99836c4073d8b25eddd3b4c784dbdb1f0c4f2b1..a2d788a656b2a5767c8a00bbcaca16ef
|
||||||
- this.flags.add(flag);
|
- this.flags.add(flag);
|
||||||
+ this.goalTypes.addUnchecked(flag);
|
+ this.goalTypes.addUnchecked(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Paper end - Mob Goal API
|
// Paper end - Mob Goal API
|
||||||
|
|
||||||
diff --git a/net/minecraft/world/entity/ai/goal/GoalSelector.java b/net/minecraft/world/entity/ai/goal/GoalSelector.java
|
diff --git a/net/minecraft/world/entity/ai/goal/GoalSelector.java b/net/minecraft/world/entity/ai/goal/GoalSelector.java
|
||||||
index eeba224bd575451ba6023df65ef9d9b97f7f1c71..20f0c1a444f40b28fe4de9ebc9eb40243c1f22a0 100644
|
index eeba224bd575451ba6023df65ef9d9b97f7f1c71..a927c2790c8ab9ccaa7161b970e10b0b44817dd8 100644
|
||||||
--- a/net/minecraft/world/entity/ai/goal/GoalSelector.java
|
--- a/net/minecraft/world/entity/ai/goal/GoalSelector.java
|
||||||
+++ b/net/minecraft/world/entity/ai/goal/GoalSelector.java
|
+++ b/net/minecraft/world/entity/ai/goal/GoalSelector.java
|
||||||
@@ -24,7 +24,8 @@ public class GoalSelector {
|
@@ -24,7 +24,8 @@ public class GoalSelector {
|
||||||
|
@ -77,8 +77,8 @@ index eeba224bd575451ba6023df65ef9d9b97f7f1c71..20f0c1a444f40b28fe4de9ebc9eb4024
|
||||||
private final Map<Goal.Flag, WrappedGoal> lockedFlags = new EnumMap<>(Goal.Flag.class);
|
private final Map<Goal.Flag, WrappedGoal> lockedFlags = new EnumMap<>(Goal.Flag.class);
|
||||||
private final Set<WrappedGoal> availableGoals = new ObjectLinkedOpenHashSet<>();
|
private final Set<WrappedGoal> availableGoals = new ObjectLinkedOpenHashSet<>();
|
||||||
- private final EnumSet<Goal.Flag> disabledFlags = EnumSet.noneOf(Goal.Flag.class);
|
- private final EnumSet<Goal.Flag> disabledFlags = EnumSet.noneOf(Goal.Flag.class);
|
||||||
+ private static final Goal.Flag[] GOAL_FLAG_VALUES = Goal.Flag.values(); // Paper - remove streams from pathfindergoalselector
|
+ private static final Goal.Flag[] GOAL_FLAG_VALUES = Goal.Flag.values(); // Paper - remove streams from GoalSelector
|
||||||
+ private final ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<net.minecraft.world.entity.ai.goal.Goal.Flag> goalTypes = new ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<>(Goal.Flag.class); // Paper - remove streams from pathfindergoalselector
|
+ private final ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<net.minecraft.world.entity.ai.goal.Goal.Flag> goalTypes = new ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<>(Goal.Flag.class); // Paper - remove streams from GoalSelector
|
||||||
private int curRate; // Paper - EAR 2
|
private int curRate; // Paper - EAR 2
|
||||||
|
|
||||||
public void addGoal(int priority, Goal goal) {
|
public void addGoal(int priority, Goal goal) {
|
||||||
|
@ -144,17 +144,17 @@ index eeba224bd575451ba6023df65ef9d9b97f7f1c71..20f0c1a444f40b28fe4de9ebc9eb4024
|
||||||
|
|
||||||
public void disableControlFlag(Goal.Flag flag) {
|
public void disableControlFlag(Goal.Flag flag) {
|
||||||
- this.disabledFlags.add(flag);
|
- this.disabledFlags.add(flag);
|
||||||
+ this.goalTypes.addUnchecked(flag); // Paper - remove streams from pathfindergoalselector
|
+ this.goalTypes.addUnchecked(flag); // Paper - remove streams from GoalSelector
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enableControlFlag(Goal.Flag flag) {
|
public void enableControlFlag(Goal.Flag flag) {
|
||||||
- this.disabledFlags.remove(flag);
|
- this.disabledFlags.remove(flag);
|
||||||
+ this.goalTypes.removeUnchecked(flag); // Paper - remove streams from pathfindergoalselector
|
+ this.goalTypes.removeUnchecked(flag); // Paper - remove streams from GoalSelector
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setControlFlag(Goal.Flag flag, boolean enabled) {
|
public void setControlFlag(Goal.Flag flag, boolean enabled) {
|
||||||
diff --git a/net/minecraft/world/entity/ai/goal/WrappedGoal.java b/net/minecraft/world/entity/ai/goal/WrappedGoal.java
|
diff --git a/net/minecraft/world/entity/ai/goal/WrappedGoal.java b/net/minecraft/world/entity/ai/goal/WrappedGoal.java
|
||||||
index 4bdbd323b642ed3422948fe24780be8b503602dc..5aaad796d2e2f7b57b1fd911a1498cdf235c36be 100644
|
index 4bdbd323b642ed3422948fe24780be8b503602dc..2c2ab6a1df9d3d23773e44ce4041cc1c21b55163 100644
|
||||||
--- a/net/minecraft/world/entity/ai/goal/WrappedGoal.java
|
--- a/net/minecraft/world/entity/ai/goal/WrappedGoal.java
|
||||||
+++ b/net/minecraft/world/entity/ai/goal/WrappedGoal.java
|
+++ b/net/minecraft/world/entity/ai/goal/WrappedGoal.java
|
||||||
@@ -69,7 +69,7 @@ public class WrappedGoal extends Goal {
|
@@ -69,7 +69,7 @@ public class WrappedGoal extends Goal {
|
||||||
|
@ -162,7 +162,7 @@ index 4bdbd323b642ed3422948fe24780be8b503602dc..5aaad796d2e2f7b57b1fd911a1498cdf
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
- public EnumSet<Goal.Flag> getFlags() {
|
- public EnumSet<Goal.Flag> getFlags() {
|
||||||
+ public ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<Goal.Flag> getFlags() { // Paper - remove streams from pathfindergoalselector
|
+ public ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<Goal.Flag> getFlags() { // Paper - remove streams from GoalSelector
|
||||||
return this.goal.getFlags();
|
return this.goal.getFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
private boolean disconnected;
|
private boolean disconnected;
|
||||||
private int requestedViewDistance = 2;
|
private int requestedViewDistance = 2;
|
||||||
- public String language = "en_us";
|
- public String language = "en_us";
|
||||||
+ public String language = null; // CraftBukkit - default // Paper - default to null
|
+ public String language = null; // Paper - default to null
|
||||||
+ public java.util.Locale adventure$locale = java.util.Locale.US; // Paper
|
+ public java.util.Locale adventure$locale = java.util.Locale.US; // Paper
|
||||||
@Nullable
|
@Nullable
|
||||||
private Vec3 startingToFallPosition;
|
private Vec3 startingToFallPosition;
|
||||||
|
@ -106,7 +106,7 @@
|
||||||
this.advancements = server.getPlayerList().getPlayerAdvancements(this);
|
this.advancements = server.getPlayerList().getPlayerAdvancements(this);
|
||||||
- this.moveTo(this.adjustSpawnLocation(level, level.getSharedSpawnPos()).getBottomCenter(), 0.0F, 0.0F);
|
- this.moveTo(this.adjustSpawnLocation(level, level.getSharedSpawnPos()).getBottomCenter(), 0.0F, 0.0F);
|
||||||
- this.updateOptions(clientInformation);
|
- this.updateOptions(clientInformation);
|
||||||
+ // this.moveTo(this.adjustSpawnLocation(level, level.getSharedSpawnPos()).getBottomCenter(), 0.0F, 0.0F); // Paper - Don't move existing players to world spawn
|
+ // this.moveTo(this.adjustSpawnLocation(level, level.getSharedSpawnPos()).getBottomCenter(), 0.0F, 0.0F); // Paper - Don't move existing players to world spawn
|
||||||
+ this.updateOptionsNoEvents(clientInformation); // Paper - don't call options events on login
|
+ this.updateOptionsNoEvents(clientInformation); // Paper - don't call options events on login
|
||||||
this.object = null;
|
this.object = null;
|
||||||
+
|
+
|
||||||
|
@ -196,6 +196,14 @@
|
||||||
if (compound.contains("SpawnX", 99) && compound.contains("SpawnY", 99) && compound.contains("SpawnZ", 99)) {
|
if (compound.contains("SpawnX", 99) && compound.contains("SpawnY", 99) && compound.contains("SpawnZ", 99)) {
|
||||||
this.respawnPosition = new BlockPos(compound.getInt("SpawnX"), compound.getInt("SpawnY"), compound.getInt("SpawnZ"));
|
this.respawnPosition = new BlockPos(compound.getInt("SpawnX"), compound.getInt("SpawnY"), compound.getInt("SpawnZ"));
|
||||||
this.respawnForced = compound.getBoolean("SpawnForced");
|
this.respawnForced = compound.getBoolean("SpawnForced");
|
||||||
|
@@ -475,6 +_,7 @@
|
||||||
|
.resultOrPartial(LOGGER::error)
|
||||||
|
.ifPresent(spawnDimension -> compound.put("SpawnDimension", spawnDimension));
|
||||||
|
}
|
||||||
|
+ this.getBukkitEntity().setExtraData(compound); // CraftBukkit
|
||||||
|
|
||||||
|
compound.putBoolean("spawn_extra_particles_on_fall", this.spawnExtraParticlesOnFall);
|
||||||
|
if (this.raidOmenPosition != null) {
|
||||||
@@ -490,7 +_,18 @@
|
@@ -490,7 +_,18 @@
|
||||||
private void saveParentVehicle(CompoundTag tag) {
|
private void saveParentVehicle(CompoundTag tag) {
|
||||||
Entity rootVehicle = this.getRootVehicle();
|
Entity rootVehicle = this.getRootVehicle();
|
||||||
|
|
|
@ -1,20 +1,12 @@
|
||||||
--- a/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java
|
--- a/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java
|
||||||
+++ b/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java
|
+++ b/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java
|
||||||
@@ -10,6 +_,7 @@
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.core.Direction;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
+import net.minecraft.server.level.ServerPlayer;
|
|
||||||
import net.minecraft.sounds.SoundEvent;
|
|
||||||
import net.minecraft.sounds.SoundSource;
|
|
||||||
import net.minecraft.util.Mth;
|
|
||||||
@@ -75,6 +_,16 @@
|
@@ -75,6 +_,16 @@
|
||||||
.flatMap(
|
.flatMap(
|
||||||
nearestVisibleLivingEntities -> nearestVisibleLivingEntities.findClosest(livingEntity -> this.ramTargeting.test(level, entity, livingEntity))
|
nearestVisibleLivingEntities -> nearestVisibleLivingEntities.findClosest(livingEntity -> this.ramTargeting.test(level, entity, livingEntity))
|
||||||
)
|
)
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ .map((entityliving) -> {
|
+ .map((entityliving) -> {
|
||||||
+ org.bukkit.event.entity.EntityTargetEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetLivingEvent(entity, entityliving, (entityliving instanceof ServerPlayer) ? org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER : org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_ENTITY);
|
+ org.bukkit.event.entity.EntityTargetEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetLivingEvent(entity, entityliving, (entityliving instanceof net.minecraft.server.level.ServerPlayer) ? org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER : org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_ENTITY);
|
||||||
+ if (event.isCancelled() || event.getTarget() == null) {
|
+ if (event.isCancelled() || event.getTarget() == null) {
|
||||||
+ return null;
|
+ return null;
|
||||||
+ }
|
+ }
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
inventory.removeItemType(Items.WHEAT, i3);
|
inventory.removeItemType(Items.WHEAT, i3);
|
||||||
ItemStack itemStack = inventory.addItem(new ItemStack(Items.BREAD, min));
|
ItemStack itemStack = inventory.addItem(new ItemStack(Items.BREAD, min));
|
||||||
if (!itemStack.isEmpty()) {
|
if (!itemStack.isEmpty()) {
|
||||||
+ villager.forceDrops = true; // Paper - Add missing forceDrop toggle
|
+ villager.forceDrops = true; // Paper - Add missing forceDrop toggles
|
||||||
villager.spawnAtLocation(level, itemStack, 0.5F);
|
villager.spawnAtLocation(level, itemStack, 0.5F);
|
||||||
+ villager.forceDrops = false; // Paper - Add missing forceDrop toggle
|
+ villager.forceDrops = false; // Paper - Add missing forceDrop toggles
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
+ public void addFlag(final Goal.Flag flag) {
|
+ public void addFlag(final Goal.Flag flag) {
|
||||||
+ this.flags.add(flag);
|
+ this.flags.add(flag);
|
||||||
+ }
|
+ }
|
||||||
+
|
|
||||||
+ // Paper end - Mob Goal API
|
+ // Paper end - Mob Goal API
|
||||||
|
+
|
||||||
protected int adjustedTickDelay(int adjustment) {
|
protected int adjustedTickDelay(int adjustment) {
|
||||||
return this.requiresUpdateEveryTick() ? adjustment : reducedTickDelay(adjustment);
|
return this.requiresUpdateEveryTick() ? adjustment : reducedTickDelay(adjustment);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
+ // Paper start - Mob goal api
|
+ // Paper start - Mob goal api
|
||||||
+ private com.destroystokyo.paper.entity.ai.PaperVanillaGoal<?> vanillaGoal;
|
+ private com.destroystokyo.paper.entity.ai.PaperVanillaGoal<?> vanillaGoal;
|
||||||
+ public <T extends org.bukkit.entity.Mob> com.destroystokyo.paper.entity.ai.Goal<T> asPaperVanillaGoal() {
|
+ public <T extends org.bukkit.entity.Mob> com.destroystokyo.paper.entity.ai.Goal<T> asPaperVanillaGoal() {
|
||||||
+ if(this.vanillaGoal == null) {
|
+ if (this.vanillaGoal == null) {
|
||||||
+ this.vanillaGoal = new com.destroystokyo.paper.entity.ai.PaperVanillaGoal<>(this);
|
+ this.vanillaGoal = new com.destroystokyo.paper.entity.ai.PaperVanillaGoal<>(this);
|
||||||
+ }
|
+ }
|
||||||
+ //noinspection unchecked
|
+ //noinspection unchecked
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
@Override
|
@Override
|
||||||
public void stop() {
|
public void stop() {
|
||||||
- this.mob.setTarget(null);
|
- this.mob.setTarget(null);
|
||||||
+ this.mob.setTarget((LivingEntity) null, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit
|
+ this.mob.setTarget(null, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit
|
||||||
this.targetMob = null;
|
this.targetMob = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
--- a/net/minecraft/world/entity/ai/sensing/Sensor.java
|
--- a/net/minecraft/world/entity/ai/sensing/Sensor.java
|
||||||
+++ b/net/minecraft/world/entity/ai/sensing/Sensor.java
|
+++ b/net/minecraft/world/entity/ai/sensing/Sensor.java
|
||||||
@@ -29,8 +_,19 @@
|
@@ -29,8 +_,17 @@
|
||||||
.ignoreInvisibilityTesting();
|
.ignoreInvisibilityTesting();
|
||||||
private final int scanRate;
|
private final int scanRate;
|
||||||
private long timeToTick;
|
private long timeToTick;
|
||||||
+ // Paper start - configurable sensor tick rate and timings
|
+ private final String configKey; // Paper - configurable sensor tick rate and timings
|
||||||
+ private final String configKey;
|
|
||||||
+ // Paper end
|
|
||||||
|
|
||||||
public Sensor(int scanRate) {
|
public Sensor(int scanRate) {
|
||||||
+ // Paper start - configurable sensor tick rate and timings
|
+ // Paper start - configurable sensor tick rate and timings
|
||||||
|
@ -20,14 +18,12 @@
|
||||||
this.scanRate = scanRate;
|
this.scanRate = scanRate;
|
||||||
this.timeToTick = RANDOM.nextInt(scanRate);
|
this.timeToTick = RANDOM.nextInt(scanRate);
|
||||||
}
|
}
|
||||||
@@ -41,7 +_,9 @@
|
@@ -41,7 +_,7 @@
|
||||||
|
|
||||||
public final void tick(ServerLevel level, E entity) {
|
public final void tick(ServerLevel level, E entity) {
|
||||||
if (--this.timeToTick <= 0L) {
|
if (--this.timeToTick <= 0L) {
|
||||||
- this.timeToTick = this.scanRate;
|
- this.timeToTick = this.scanRate;
|
||||||
+ // Paper start - configurable sensor tick rate and timings
|
+ this.timeToTick = java.util.Objects.requireNonNullElse(level.paperConfig().tickRates.sensor.get(entity.getType(), this.configKey), this.scanRate); // Paper - configurable sensor tick rate and timings
|
||||||
+ this.timeToTick = java.util.Objects.requireNonNullElse(level.paperConfig().tickRates.sensor.get(entity.getType(), this.configKey), this.scanRate);
|
|
||||||
+ // Paper end
|
|
||||||
this.updateTargetingConditionRanges(entity);
|
this.updateTargetingConditionRanges(entity);
|
||||||
this.doTick(level, entity);
|
this.doTick(level, entity);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue