public class PiglinEntity extends AbstractPiglinEntity implements CrossbowUser
Entity.PositionUpdater, Entity.RemovalReason| Modifier and Type | Field and Description |
|---|---|
private static TrackedData<Boolean> |
BABY |
private static EntityAttributeModifier |
BABY_SPEED_BOOST |
private static UUID |
BABY_SPEED_BOOST_ID |
private boolean |
cannotHunt |
private static TrackedData<Boolean> |
CHARGING |
private static TrackedData<Boolean> |
DANCING |
private SimpleInventory |
inventory |
protected static ImmutableList<MemoryModuleType<?>> |
MEMORY_MODULE_TYPES |
protected static ImmutableList<SensorType<? extends Sensor<? super PiglinEntity>>> |
SENSOR_TYPES |
IMMUNE_TO_ZOMBIFICATION, timeInOverworldambientSoundChance, armorDropChances, experiencePoints, goalSelector, handDropChances, jumpControl, lookControl, moveControl, navigation, targetSelectoractiveItemStack, attackingPlayer, bodyTrackingIncrements, bodyYaw, brain, dead, deathTime, defaultMaxHealth, despawnCounter, field_6215, flyingSpeed, forwardSpeed, handSwinging, handSwingProgress, handSwingTicks, headTrackingIncrements, headYaw, hurtTime, itemUseTimeLeft, jumping, knockbackVelocity, lastAttackedTicks, lastDamageTaken, lastHandSwingProgress, lastLimbDistance, limbAngle, limbDistance, LIVING_FLAGS, lookDirection, maxHurtTime, playerHitTimer, preferredHand, prevBodyYaw, prevHeadYaw, prevLookDirection, prevStepBobbingAmount, randomLargeSeed, randomSmallSeed, riptideTicks, roll, scoreAmount, serverHeadYaw, serverPitch, serverX, serverY, serverYaw, serverZ, sidewaysSpeed, SLEEPING_DIMENSIONS, stepBobbingAmount, stuckArrowTimer, stuckStingerTimer, upwardSpeedage, dataTracker, distanceTraveled, fallDistance, field_25599, firstUpdate, FLAGS, fluidHeight, glowing, horizontalCollision, horizontalSpeed, ignoreCameraFrustum, inanimate, inNetherPortal, lastNetherPortalPosition, lastRenderX, lastRenderY, lastRenderZ, LOGGER, movementMultiplier, netherPortalTime, noClip, onGround, pitch, POSE, prevHorizontalSpeed, prevPitch, prevX, prevY, prevYaw, prevZ, pushSpeedReduction, random, ridingCooldown, stepHeight, submergedInWater, teleporting, timeUntilRegen, touchingWater, uuid, uuidString, velocityDirty, velocityModified, verticalCollision, world, yawDUMMY| Constructor and Description |
|---|
PiglinEntity(EntityType<? extends AbstractPiglinEntity> type,
World world) |
| Modifier and Type | Method and Description |
|---|---|
protected ItemStack |
addItem(ItemStack stack) |
void |
attack(LivingEntity target,
float pullProgress) |
protected boolean |
canEquipStack(ItemStack stack)
Returns whether this piglin can equip into or replace current equipment slot.
|
boolean |
canGather(ItemStack stack) |
protected boolean |
canHunt() |
boolean |
canImmediatelyDespawn(double distanceSquared) |
protected boolean |
canInsertIntoInventory(ItemStack stack) |
static boolean |
canSpawn(EntityType<PiglinEntity> type,
WorldAccess world,
SpawnReason spawnReason,
BlockPos pos,
Random random) |
boolean |
canUseRangedWeapon(RangedWeaponItem weapon) |
protected Brain.Profile<PiglinEntity> |
createBrainProfile() |
static DefaultAttributeContainer.Builder |
createPiglinAttributes() |
boolean |
damage(DamageSource source,
float amount) |
protected Brain<?> |
deserializeBrain(com.mojang.serialization.Dynamic<?> dynamic) |
protected void |
dropEquipment(DamageSource source,
int lootingMultiplier,
boolean allowDrops) |
private void |
equipAtChance(EquipmentSlot slot,
ItemStack stack) |
protected void |
equipToMainHand(ItemStack stack) |
protected void |
equipToOffHand(ItemStack stack) |
protected float |
getActiveEyeHeight(EntityPose pose,
EntityDimensions dimensions) |
PiglinActivity |
getActivity() |
protected SoundEvent |
getAmbientSound() |
Brain<PiglinEntity> |
getBrain() |
protected int |
getCurrentExperience(PlayerEntity player) |
protected SoundEvent |
getDeathSound() |
protected SoundEvent |
getHurtSound(DamageSource source) |
double |
getMountedHeightOffset() |
private Entity |
getTopMostPassenger(Entity entity,
int maxLevel)
Returns the passenger entity at
maxLevel in a stacked riding (riding on
an entity that is riding on another entity, etc). |
protected void |
initDataTracker() |
protected void |
initEquipment(LocalDifficulty difficulty) |
EntityData |
initialize(ServerWorldAccess world,
LocalDifficulty difficulty,
SpawnReason spawnReason,
EntityData entityData,
CompoundTag entityTag) |
ActionResult |
interactMob(PlayerEntity player,
Hand hand) |
boolean |
isBaby() |
private boolean |
isCharging() |
boolean |
isDancing() |
protected boolean |
isDisallowedInPeaceful() |
protected void |
loot(ItemEntity item) |
private ItemStack |
makeInitialWeapon() |
protected void |
mobTick() |
void |
onTrackedDataSet(TrackedData<?> data) |
protected void |
playSound(SoundEvent sound) |
protected void |
playStepSound(BlockPos pos,
BlockState state) |
protected void |
playZombificationSound() |
void |
postShoot() |
protected boolean |
prefersNewEquipment(ItemStack newStack,
ItemStack oldStack) |
void |
readCustomDataFromTag(CompoundTag tag) |
void |
setBaby(boolean baby) |
private void |
setCannotHunt(boolean cannotHunt) |
void |
setCharging(boolean charging) |
void |
setDancing(boolean dancing) |
void |
shoot(LivingEntity target,
ItemStack crossbow,
ProjectileEntity projectile,
float multiShotSpray) |
boolean |
startRiding(Entity entity,
boolean force) |
void |
writeCustomDataToTag(CompoundTag tag) |
protected void |
zombify(ServerWorld world) |
getHeightOffset, getTarget, isAdult, isHoldingTool, isImmuneToZombification, playAmbientSound, sendAiDebugData, setImmuneToZombification, shouldZombifycanDropLootAndXp, canSpawnIgnoreLightLevel, canSpawnInDark, createHostileAttributes, getArrowType, getFallSound, getPathfindingFavor, getSoundCategory, getSplashSound, getSwimSound, isAngryAt, isSpawnDark, shouldDropLoot, tickMovement, updateDespawnCountercanSpawn, getPathfindingFavor, getRunFromLeashSpeed, isNavigating, updateForLeashLength, updateLeashattachLeash, baseTick, canBeControlledByRider, canBeLeashedBy, canEquip, canEquipmentSlotContain, canMobSpawn, canMoveVoluntarily, cannotDespawn, canPickupItem, canPickUpLoot, canSpawn, canTarget, canTarget, checkDespawn, createBodyControl, createMobAttributes, createNavigation, detachLeash, dropLoot, equip, equipLootStack, equipStack, getArmorItems, getBodyYawSpeed, getDropChance, getEquipmentForSlot, getEquippedStack, getHoldingEntity, getItemsHand, getJumpControl, getLimitPerChunk, getLookControl, getLookPitchSpeed, getLookYawSpeed, getLootContextBuilder, getLootTable, getLootTableId, getMainArm, getMinAmbientSoundDelay, getMoveControl, getNavigation, getPathfindingPenalty, getPickBlockStack, getPositionTarget, getPositionTargetRange, getPreferredEquipmentSlot, getSafeFallDistance, getVisibilityCache, handleStatus, hasPositionTarget, initGoals, interact, isAffectedByDaylight, isAiDisabled, isAttacking, isInWalkTargetRange, isInWalkTargetRange, isLeashed, isLeftHanded, isLogicalSideForUpdatingMovement, isPersistent, lookAtEntity, method_29243, method_29244, method_30076, method_30758, method_30759, movesIndependently, onEatingGrass, onPlayerSpawnedChild, playHurtSound, playSpawnEffects, prefersNewDamageableItem, setAiDisabled, setAttacking, setCanPickUpLoot, setEquipmentDropChance, setForwardSpeed, setHoldingEntityId, setLeftHanded, setMovementSpeed, setPathfindingPenalty, setPersistent, setPositionTarget, setSidewaysSpeed, setTarget, setUpwardSpeed, spawnsTooManyForEachTry, swimUpward, tick, tickNewAi, tryAttack, tryEquip, turnHead, updateDropChances, updateEnchantments, updateGoalControlsaddSoulSpeedBoostIfNeeded, addStatusEffect, animateDamage, applyArmorToDamage, applyDamage, applyEnchantmentsToDamage, applyMovementEffects, applyStatusEffect, attackLivingEntity, canBeRiddenInWater, canBreatheInWater, canHaveStatusEffect, canSee, canWalkOnFluid, clearActiveItem, clearPotionSwirls, clearSleepingPosition, clearStatusEffects, collides, computeFallDamage, consumeItem, containsOnlyAmbientEffects, createLivingAttributes, createSpawnPacket, damageArmor, damageShield, destroy, displaySoulSpeedEffects, drop, dropInventory, dropXp, eatFood, endCombat, enterCombat, fall, getAbsorptionAmount, getActiveHand, getActiveItem, getActiveStatusEffects, getArmor, getArmorVisibility, getAttackDistanceScalingFactor, getAttacker, getAttacking, getAttributeBaseValue, getAttributeInstance, getAttributes, getAttributeValue, getBaseMovementSpeedMultiplier, getBlockState, getBoundingBox, getClimbingPos, getDamageTracker, getDespawnCounter, getDimensions, getDrinkSound, getEatSound, getEyeHeight, getGroup, getHandSwingProgress, getHeadYaw, getHealth, getItemUseTime, getItemUseTimeLeft, getJumpVelocity, getLastAttackedTime, getLastAttackTime, getLeaningPitch, getMainHandStack, getMaxHealth, getMovementSpeed, getNextAirOnLand, getNextAirUnderwater, getOffHandStack, getPoses, getPrimeAdversary, getRandom, getRecentDamageSource, getRoll, getScaleFactor, getSleepingDirection, getSleepingPosition, getSoundPitch, getSoundVolume, getStackInHand, getStatusEffect, getStatusEffects, getStingerCount, getStuckArrowCount, getVelocityMultiplier, getVisibilityBoundingBox, getYaw, handleFallDamage, hasStackEquipped, hasStatusEffect, heal, hurtByWater, isAffectedBySplashPotions, isAlive, isBlocking, isClimbing, isDead, isFallFlying, isHolding, isHolding, isHoldingOntoLadder, isImmobile, isInsideWall, isInSwimmingPose, isMobOrPlayer, isOnSoulSpeedBlock, isPushable, isSleeping, isTarget, isUndead, isUsingItem, isUsingRiptide, jump, kill, knockback, knockDownwards, lookAt, markEffectsDirty, method_26317, method_26318, method_29242, method_29500, method_30633, method_31079, onAttacking, onDeath, onEquipStack, onKilledBy, onStatusEffectApplied, onStatusEffectRemoved, onStatusEffectUpgraded, playBlockFallSound, pushAway, pushAwayFrom, removeSoulSpeedBoost, removeStatusEffect, removeStatusEffectInternal, scheduleVelocityUpdate, sendEquipmentBreakStatus, sendPickup, sendToolBreakStatus, setAbsorptionAmount, setAttacker, setAttacking, setCurrentHand, setDespawnCounter, setHeadYaw, setHealth, setJumping, setLivingFlag, setNearbySongPlaying, setOnGround, setRiptideTicks, setSleepingPosition, setSprinting, setStackInHand, setStingerCount, setStuckArrowCount, setYaw, shouldAlwaysDropXp, shouldDisplaySoulSpeedEffects, shouldRenderName, shouldSwimInFluids, sleep, spawnConsumptionEffects, stopRiding, stopUsingItem, swingHand, swingHand, takeKnockback, takeShieldHit, teleport, tickCramming, tickHandSwing, tickRiding, tickRiptide, tickStatusEffects, travel, triggerItemPickedUpByEntityCriteria, updatePostDeath, updatePotionVisibility, updateTrackedHeadRotation, updateTrackedPositionAndAngles, wakeUpaddPassenger, addScoreboardTag, addVelocity, adjustMovementForCollisions, adjustMovementForCollisions, adjustMovementForPiston, adjustMovementForSneaking, adjustSingleAxisMovementForCollisions, afterSpawn, applyMirror, applyRotation, bypassesLandingEffects, bypassesSteppingEffects, calculateBoundsForPose, calculateDimensions, calculateNextStepSoundDistance, canAddPassenger, canAvoidTraps, canBeSpectated, canClimb, canExplosionDestroyBlock, canFly, canStartRiding, canUsePortals, changeLookDirection, checkBlockCollision, collidesWith, copyFrom, copyPositionAndRotation, dealDamage, detach, discard, dismountVehicle, distanceTo, doesNotCollide, doesRenderOnFire, dropItem, dropItem, dropStack, dropStack, entityDataRequiresOperator, equals, extinguish, fromTag, getAir, getBlockPos, getBlockX, getBlockY, getBlockZ, getBodyY, getBoundingBox, getBrightnessAtEyes, getBurningDuration, getCameraPosVec, getChunkPos, getCommandSource, getCustomName, getDataTracker, getDefaultName, getDefaultNetherPortalCooldown, getDisplayName, getEffectiveExplosionResistance, getEntityId, getEntityName, getEntityWorld, getEyeHeight, getEyeY, getFireTicks, getFirstPassenger, getFlag, getFluidHeight, getHeight, getHighSpeedSplashSound, getHorizontalFacing, getHoverEvent, getItemsEquipped, getJumpVelocityMultiplier, getLandingBlockState, getLandingPos, getMaxAir, getMaxNetherPortalTime, getMovementDirection, getName, getOppositeRotationVector, getOppositeRotationVector, getParticleX, getParticleZ, getPassengerDismountOffset, getPassengerList, getPassengersDeep, getPermissionLevel, getPistonBehavior, getPitch, getPos, getPose, getPrimaryPassenger, getRandomBodyY, getRenderDistanceMultiplier, getRootVehicle, getRotationClient, getRotationVec, getRotationVecClient, getRotationVector, getRotationVector, getSavedEntityId, getScoreboardTags, getScoreboardTeam, getServer, getStandingEyeHeight, getTargetingMargin, getTeamColorValue, getTeleportTarget, getTrackedPosition, getType, getUuid, getUuidAsString, getVehicle, getVelocity, getVelocityAffectingPos, getWidth, getX, getY, getZ, handleAttack, hasCustomName, hashCode, hasNetherPortalCooldown, hasNoGravity, hasPassenger, hasPassengerDeep, hasPassengers, hasPassengerType, hasPermissionLevel, hasPlayerRider, hasVehicle, hasWings, interactAt, isAttackable, isCollidable, isConnectedThroughVehicle, isCustomNameVisible, isDescending, isFireImmune, isGlowing, isImmuneToExplosion, isInLava, isInRange, isInsideWaterOrBubbleColumn, isInSneakingPose, isInvisible, isInvisibleTo, isInvulnerable, isInvulnerableTo, isLiving, isOnFire, isOnGround, isPartOf, isPlayer, isRemoved, isSilent, isSneaking, isSneaky, isSpectator, isSprinting, isSubmergedIn, isSubmergedInWater, isSwimming, isTeammate, isTeamPlayer, isTouchingWater, isTouchingWaterOrRain, isWet, method_29241, method_29919, method_30330, method_30632, method_30634, method_30950, method_30951, method_31166, method_31473, method_31744, method_31746, method_31748, move, moveToBoundingBoxCenter, moveToWorld, offsetX, offsetZ, onBlockCollision, onBubbleColumnCollision, onBubbleColumnSurfaceCollision, onKilledOther, onPassengerLookAround, onPlayerCollision, onSpawnPacket, onStartedTrackingBy, onStoppedTrackingBy, onStruckByLightning, onSwimmingStart, playFlySound, playSound, playSwimSound, populateCrashReport, pushOutOfBlocks, raycast, refreshPosition, refreshPositionAfterTeleport, refreshPositionAfterTeleport, refreshPositionAndAngles, refreshPositionAndAngles, remove, removeAllPassengers, removePassenger, removeScoreboardTag, requestTeleport, resetNetherPortalCooldown, resetPosition, saveSelfToTag, saveToTag, sendSystemMessage, setAir, setBoundingBox, setCustomName, setCustomNameVisible, setEntityId, setFireTicks, setFlag, setGlowing, setInNetherPortal, setInvisible, setInvulnerable, setNoGravity, setOnFireFor, setOnFireFromLava, setPos, setPose, setRemoved, setRenderDistanceMultiplier, setRotation, setSilent, setSneaking, setSwimming, setUuid, setVelocity, setVelocity, setVelocityClient, setWorld, shouldBroadcastConsoleToOps, shouldLeaveSwimmingPose, shouldReceiveFeedback, shouldRender, shouldRender, shouldSetPositionOnLoad, shouldSpawnSprintingParticles, shouldTrackOutput, slowMovement, spawnSprintingParticles, squaredDistanceTo, squaredDistanceTo, squaredDistanceTo, squaredHorizontalLength, startRiding, streamPassengersRecursively, teleport, tickNetherPortal, tickNetherPortalCooldown, toListTag, toListTag, toString, toTag, unsetRemoved, updateKilledAdvancementCriterion, updateMovementInFluid, updatePassengerForDismount, updatePassengerPosition, updatePosition, updatePositionAndAngles, updateSwimming, updateTrackedPosition, updateTrackedPosition, updateVelocity, updateWaterState, wouldPoseNotCollideclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetProjectileLaunchVelocity, getTarget, shoot, shootprivate static final TrackedData<Boolean> BABY
private static final TrackedData<Boolean> CHARGING
private static final TrackedData<Boolean> DANCING
private static final UUID BABY_SPEED_BOOST_ID
private static final EntityAttributeModifier BABY_SPEED_BOOST
protected static final ImmutableList<SensorType<? extends Sensor<? super PiglinEntity>>> SENSOR_TYPES
protected static final ImmutableList<MemoryModuleType<?>> MEMORY_MODULE_TYPES
private final SimpleInventory inventory
private boolean cannotHunt
public PiglinEntity(EntityType<? extends AbstractPiglinEntity> type, World world)
public void writeCustomDataToTag(CompoundTag tag)
writeCustomDataToTag in class AbstractPiglinEntitypublic void readCustomDataFromTag(CompoundTag tag)
readCustomDataFromTag in class AbstractPiglinEntityprotected void dropEquipment(DamageSource source, int lootingMultiplier, boolean allowDrops)
dropEquipment in class MobEntityprotected boolean canInsertIntoInventory(ItemStack stack)
protected void initDataTracker()
initDataTracker in class AbstractPiglinEntitypublic void onTrackedDataSet(TrackedData<?> data)
onTrackedDataSet in class LivingEntitypublic static DefaultAttributeContainer.Builder createPiglinAttributes()
public static boolean canSpawn(EntityType<PiglinEntity> type, WorldAccess world, SpawnReason spawnReason, BlockPos pos, Random random)
@Nullable public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, @Nullable EntityData entityData, @Nullable CompoundTag entityTag)
initialize in class MobEntityprotected boolean isDisallowedInPeaceful()
isDisallowedInPeaceful in class HostileEntitypublic boolean canImmediatelyDespawn(double distanceSquared)
canImmediatelyDespawn in class MobEntityprotected void initEquipment(LocalDifficulty difficulty)
initEquipment in class MobEntityprivate void equipAtChance(EquipmentSlot slot, ItemStack stack)
protected Brain.Profile<PiglinEntity> createBrainProfile()
createBrainProfile in class LivingEntityprotected Brain<?> deserializeBrain(com.mojang.serialization.Dynamic<?> dynamic)
deserializeBrain in class LivingEntitypublic Brain<PiglinEntity> getBrain()
getBrain in class LivingEntitypublic ActionResult interactMob(PlayerEntity player, Hand hand)
interactMob in class MobEntityprotected float getActiveEyeHeight(EntityPose pose, EntityDimensions dimensions)
getActiveEyeHeight in class LivingEntitypublic double getMountedHeightOffset()
getMountedHeightOffset in class Entitypublic boolean isBaby()
isBaby in class LivingEntityprivate void setCannotHunt(boolean cannotHunt)
protected boolean canHunt()
canHunt in class AbstractPiglinEntityprotected void mobTick()
mobTick in class AbstractPiglinEntityprotected int getCurrentExperience(PlayerEntity player)
getCurrentExperience in class MobEntityprotected void zombify(ServerWorld world)
zombify in class AbstractPiglinEntityprivate ItemStack makeInitialWeapon()
private boolean isCharging()
public void setCharging(boolean charging)
setCharging in interface CrossbowUserpublic void postShoot()
postShoot in interface CrossbowUserpublic PiglinActivity getActivity()
getActivity in class AbstractPiglinEntitypublic boolean isDancing()
public void setDancing(boolean dancing)
public boolean damage(DamageSource source, float amount)
damage in class HostileEntitypublic void attack(LivingEntity target, float pullProgress)
attack in interface RangedAttackMobpublic void shoot(LivingEntity target, ItemStack crossbow, ProjectileEntity projectile, float multiShotSpray)
shoot in interface CrossbowUserpublic boolean canUseRangedWeapon(RangedWeaponItem weapon)
canUseRangedWeapon in class MobEntityprotected void equipToMainHand(ItemStack stack)
protected void equipToOffHand(ItemStack stack)
protected boolean canEquipStack(ItemStack stack)
protected boolean prefersNewEquipment(ItemStack newStack, ItemStack oldStack)
prefersNewEquipment in class MobEntityprotected void loot(ItemEntity item)
public boolean startRiding(Entity entity, boolean force)
startRiding in class MobEntityprivate Entity getTopMostPassenger(Entity entity, int maxLevel)
maxLevel in a stacked riding (riding on
an entity that is riding on another entity, etc).
If the number of stacked entities is less than maxLevel, returns the
top most passenger entity.
protected SoundEvent getAmbientSound()
getAmbientSound in class MobEntityprotected SoundEvent getHurtSound(DamageSource source)
getHurtSound in class HostileEntityprotected SoundEvent getDeathSound()
getDeathSound in class HostileEntityprotected void playStepSound(BlockPos pos, BlockState state)
playStepSound in class Entityprotected void playSound(SoundEvent sound)
protected void playZombificationSound()
playZombificationSound in class AbstractPiglinEntity