Class TrialSpawner
java.lang.Object
net.minecraft.world.level.block.entity.trialspawner.TrialSpawner
- All Implemented Interfaces:
IOwnedSpawner
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
static interface
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TrialSpawnerData
private static final int
private static final int
static final int
private final PlayerDetector.EntitySelector
private boolean
private static final int
private static final int
static final String
private final TrialSpawnerConfig
static final String
private final TrialSpawnerConfig
private boolean
private PlayerDetector
private final int
private static final float
private final TrialSpawner.StateAccessor
private final int
-
Constructor Summary
ConstructorsConstructorDescriptionTrialSpawner
(TrialSpawner.StateAccessor stateAccessor, PlayerDetector playerDetector, PlayerDetector.EntitySelector entitySelector) TrialSpawner
(TrialSpawnerConfig normalConfig, TrialSpawnerConfig ominousConfig, TrialSpawnerData data, int targetCooldownLength, int requiredPlayerRange, TrialSpawner.StateAccessor stateAccessor, PlayerDetector playerDetector, PlayerDetector.EntitySelector entitySelector) -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addBecomeOminousParticles
(Level level, BlockPos pos, RandomSource random) static void
addDetectPlayerParticles
(Level level, BlockPos pos, RandomSource random, int type, ParticleOptions particle) static void
addEjectItemParticles
(Level level, BlockPos pos, RandomSource random) static void
addSpawnParticles
(Level level, BlockPos pos, RandomSource random, SimpleParticleType particleType) void
applyOminous
(ServerLevel level, BlockPos pos) boolean
canSpawnInLevel
(Level level) com.mojang.serialization.Codec
<TrialSpawner> codec()
void
ejectReward
(ServerLevel level, BlockPos pos, ResourceKey<LootTable> lootTable) getData()
private TrialSpawnerConfig
com.mojang.datafixers.util.Either
<BlockEntity, Entity> getOwner()
Returns the block entity or entity which owns this spawner object.int
getState()
int
private static boolean
inLineOfSight
(Level level, Vec3 spawnerPos, Vec3 mobPos) boolean
void
void
Deprecated, for removal: This API element is subject to removal in a future version.void
removeOminous
(ServerLevel level, BlockPos pos) void
setPlayerDetector
(PlayerDetector playerDetector) Deprecated, for removal: This API element is subject to removal in a future version.void
setState
(Level level, TrialSpawnerState state) private static boolean
shouldMobBeUntracked
(ServerLevel level, BlockPos pos, UUID uuid) spawnMob
(ServerLevel level, BlockPos pos) void
tickClient
(Level level, BlockPos pos, boolean isOminous) void
tickServer
(ServerLevel level, BlockPos pos, boolean isOminous)
-
Field Details
-
NORMAL_CONFIG_TAG_NAME
- See Also:
-
OMINOUS_CONFIG_TAG_NAME
- See Also:
-
DETECT_PLAYER_SPAWN_BUFFER
public static final int DETECT_PLAYER_SPAWN_BUFFER- See Also:
-
DEFAULT_TARGET_COOLDOWN_LENGTH
private static final int DEFAULT_TARGET_COOLDOWN_LENGTH- See Also:
-
DEFAULT_PLAYER_SCAN_RANGE
private static final int DEFAULT_PLAYER_SCAN_RANGE- See Also:
-
MAX_MOB_TRACKING_DISTANCE
private static final int MAX_MOB_TRACKING_DISTANCE- See Also:
-
MAX_MOB_TRACKING_DISTANCE_SQR
private static final int MAX_MOB_TRACKING_DISTANCE_SQR -
SPAWNING_AMBIENT_SOUND_CHANCE
private static final float SPAWNING_AMBIENT_SOUND_CHANCE- See Also:
-
normalConfig
-
ominousConfig
-
data
-
requiredPlayerRange
private final int requiredPlayerRange -
targetCooldownLength
private final int targetCooldownLength -
stateAccessor
-
playerDetector
-
entitySelector
-
overridePeacefulAndMobSpawnRule
private boolean overridePeacefulAndMobSpawnRule -
isOminous
private boolean isOminous
-
-
Constructor Details
-
TrialSpawner
public TrialSpawner(TrialSpawner.StateAccessor stateAccessor, PlayerDetector playerDetector, PlayerDetector.EntitySelector entitySelector) -
TrialSpawner
public TrialSpawner(TrialSpawnerConfig normalConfig, TrialSpawnerConfig ominousConfig, TrialSpawnerData data, int targetCooldownLength, int requiredPlayerRange, TrialSpawner.StateAccessor stateAccessor, PlayerDetector playerDetector, PlayerDetector.EntitySelector entitySelector)
-
-
Method Details
-
codec
-
getConfig
-
getNormalConfig
-
getOminousConfig
-
getOminousConfigForSerialization
-
applyOminous
-
removeOminous
-
isOminous
public boolean isOminous() -
getData
-
getTargetCooldownLength
public int getTargetCooldownLength() -
getRequiredPlayerRange
public int getRequiredPlayerRange() -
getState
-
setState
-
markUpdated
public void markUpdated() -
getPlayerDetector
-
getEntitySelector
-
canSpawnInLevel
-
spawnMob
-
ejectReward
-
tickClient
-
tickServer
-
shouldMobBeUntracked
-
inLineOfSight
-
addSpawnParticles
public static void addSpawnParticles(Level level, BlockPos pos, RandomSource random, SimpleParticleType particleType) -
addBecomeOminousParticles
-
addDetectPlayerParticles
public static void addDetectPlayerParticles(Level level, BlockPos pos, RandomSource random, int type, ParticleOptions particle) -
addEjectItemParticles
-
setPlayerDetector
Deprecated, for removal: This API element is subject to removal in a future version. -
overridePeacefulAndMobSpawnRule
Deprecated, for removal: This API element is subject to removal in a future version. -
getOwner
Description copied from interface:IOwnedSpawner
Returns the block entity or entity which owns this spawner object.For a
BaseSpawner
, this is theinvalid reference
MobSpawnerBlockEntity
MinecartSpawner
.For a
TrialSpawner
, this is theTrialSpawnerBlockEntity
.- Specified by:
getOwner
in interfaceIOwnedSpawner
-