Skip to content

Package net.minecraft.world.entity.ambient

Part 1/1


AmbientCreature

  • Full name: net.minecraft.world.entity.ambient.AmbientCreature
  • Package: net.minecraft.world.entity.ambient
  • Source: commonnet/minecraft/world/entity/ambient/AmbientCreature.java
  • Type: class
  • Modifiers: public abstract
  • Extends: Mob

net.minecraft.world.entity.ambient.AmbientCreature#AmbientCreature(EntityType<? extends AmbientCreature>,Level)

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/AmbientCreature.java:8
  • Modifiers: protected
  • Kind: constructor

คืออะไร

สร้างออบเจ็กต์ AmbientCreature ด้วยพารามิเตอร์ที่ระบุ

ทำงานยังไง

ทำงานตาม body โดยตรง (ประมาณ 1 statement).

Parameters

  • EntityType<? extends AmbientCreature> entityType
  • Level level

ตัวอย่างใช้งาน

EntityType<? extends AmbientCreature> entityType = ...;
Level level = ...;
AmbientCreature instance = new AmbientCreature(entityType, level);

net.minecraft.world.entity.ambient.AmbientCreature#canBeLeashed()

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/AmbientCreature.java:12
  • Modifiers: public
  • Return: boolean

คืออะไร

ตรวจสอบว่าสามารถ Be Leashed

ทำงานยังไง

คืนค่า: false.

Parameters

  • ไม่มี

ตัวอย่างใช้งาน

AmbientCreature instance = ...;
boolean result = instance.canBeLeashed();

Bat

  • Full name: net.minecraft.world.entity.ambient.Bat
  • Package: net.minecraft.world.entity.ambient
  • Source: commonnet/minecraft/world/entity/ambient/Bat.java
  • Type: class
  • Modifiers: public
  • Extends: AmbientCreature

net.minecraft.world.entity.ambient.Bat#addAdditionalSaveData(CompoundTag)

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/Bat.java:216
  • Modifiers: public
  • Return: void

คืออะไร

เพิ่ม Additional Save Data

ทำงานยังไง

เรียกต่อ: putByte(), get().

Parameters

  • CompoundTag compoundTag

ตัวอย่างใช้งาน

Bat instance = ...;
CompoundTag compoundTag = ...;
instance.addAdditionalSaveData(compoundTag);

net.minecraft.world.entity.ambient.Bat#Bat(EntityType<? extends Bat>,Level)

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/Bat.java:43
  • Modifiers: public
  • Kind: constructor

คืออะไร

สร้างออบเจ็กต์ Bat ด้วยพารามิเตอร์ที่ระบุ

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: setResting().

Parameters

  • EntityType<? extends Bat> entityType
  • Level level

ตัวอย่างใช้งาน

EntityType<? extends Bat> entityType = ...;
Level level = ...;
Bat instance = new Bat(entityType, level);

net.minecraft.world.entity.ambient.Bat#checkBatSpawnRules(EntityType<Bat>,LevelAccessor,EntitySpawnReason,BlockPos,RandomSource)

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/Bat.java:222
  • Modifiers: public static
  • Return: boolean

คืออะไร

ตรวจสอบ Bat Spawn Rules

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: getY(), getHeightmapPos(), getMaxLocalRawBrightness(), isHalloween(), nextBoolean(), nextInt(), getBlockState(), below(). มีจุด return อย่างน้อย 3 จุด.

Parameters

  • EntityType<Bat> entityType
  • LevelAccessor levelAccessor
  • EntitySpawnReason entitySpawnReason
  • BlockPos blockPos
  • RandomSource randomSource

ตัวอย่างใช้งาน

EntityType<Bat> entityType = ...;
LevelAccessor levelAccessor = ...;
EntitySpawnReason entitySpawnReason = ...;
BlockPos blockPos = ...;
RandomSource randomSource = ...;
boolean result = Bat.checkBatSpawnRules(entityType, levelAccessor, entitySpawnReason, blockPos, randomSource);

net.minecraft.world.entity.ambient.Bat#checkFallDamage(double,boolean,BlockState,BlockPos)

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/Bat.java:188
  • Modifiers: protected
  • Return: void

คืออะไร

ตรวจสอบ Fall Damage

ทำงานยังไง

ทำงานตาม body โดยตรง (ประมาณ 1 statement).

Parameters

  • double d
  • boolean bl
  • BlockState blockState
  • BlockPos blockPos

ตัวอย่างใช้งาน

BlockState blockState = ...;
BlockPos blockPos = ...;
@Override
protected void checkFallDamage(double d, boolean bl, BlockState blockState, BlockPos blockPos) {
    super.checkFallDamage(d, bl, blockState, blockPos);
}

net.minecraft.world.entity.ambient.Bat#createAttributes()

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/Bat.java:100
  • Modifiers: public static
  • Return: AttributeSupplier.Builder

คืออะไร

สร้าง Attributes

ทำงานยังไง

เรียกต่อ: createMobAttributes(), add(). คืนค่า: Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 6.0).

Parameters

  • ไม่มี

ตัวอย่างใช้งาน

AttributeSupplier.Builder result = Bat.createAttributes();

net.minecraft.world.entity.ambient.Bat#customServerAiStep(ServerLevel)

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/Bat.java:130
  • Modifiers: protected
  • Return: void

คืออะไร

ดำเนินการ customServerAiStep ตาม implementation ของ Bat

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. แก้ state: yHeadRot, targetPosition, zza. เรียกต่อ: blockPosition(), above(), isResting(), isSilent(), getBlockState(), isRedstoneConductor(), nextInt(), getNearestPlayer().

Parameters

  • ServerLevel serverLevel

ตัวอย่างใช้งาน

ServerLevel serverLevel = ...;
@Override
protected void customServerAiStep(ServerLevel serverLevel) {
    super.customServerAiStep(serverLevel);
}

net.minecraft.world.entity.ambient.Bat#defineSynchedData(SynchedEntityData.Builder)

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/Bat.java:55
  • Modifiers: protected
  • Return: void

คืออะไร

ดำเนินการ defineSynchedData ตาม implementation ของ Bat

ทำงานยังไง

เรียกต่อ: define().

Parameters

  • SynchedEntityData.Builder builder

ตัวอย่างใช้งาน

SynchedEntityData.Builder builder = ...;
@Override
protected void defineSynchedData(SynchedEntityData.Builder builder) {
    super.defineSynchedData(builder);
}

net.minecraft.world.entity.ambient.Bat#doPush(Entity)

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/Bat.java:92
  • Modifiers: protected
  • Return: void

คืออะไร

ดำเนินการ doPush ตาม implementation ของ Bat

ทำงานยังไง

ทำงานตาม body โดยตรง (ประมาณ 1 statement).

Parameters

  • Entity entity

ตัวอย่างใช้งาน

Entity entity = ...;
@Override
protected void doPush(Entity entity) {
    super.doPush(entity);
}

net.minecraft.world.entity.ambient.Bat#getAmbientSound()

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/Bat.java:71
  • Modifiers: public
  • Return: SoundEvent

คืออะไร

อ่านค่า Ambient Sound

ทำงานยังไง

เรียกต่อ: isResting(), nextInt(). คืนค่า: this.isResting() && this.random.nextInt(4) != 0 ? null : SoundEvents.BAT_AMBIENT.

Parameters

  • ไม่มี

ตัวอย่างใช้งาน

Bat instance = ...;
SoundEvent result = instance.getAmbientSound();

net.minecraft.world.entity.ambient.Bat#getDeathSound()

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/Bat.java:82
  • Modifiers: protected
  • Return: SoundEvent

คืออะไร

อ่านค่า Death Sound

ทำงานยังไง

คืนค่า: SoundEvents.BAT_DEATH.

Parameters

  • ไม่มี

ตัวอย่างใช้งาน

@Override
protected SoundEvent getDeathSound() {
    return super.getDeathSound();
}

net.minecraft.world.entity.ambient.Bat#getHurtSound(DamageSource)

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/Bat.java:77
  • Modifiers: protected
  • Return: SoundEvent

คืออะไร

อ่านค่า Hurt Sound

ทำงานยังไง

คืนค่า: SoundEvents.BAT_HURT.

Parameters

  • DamageSource damageSource

ตัวอย่างใช้งาน

DamageSource damageSource = ...;
@Override
protected SoundEvent getHurtSound(DamageSource damageSource) {
    return super.getHurtSound(damageSource);
}

net.minecraft.world.entity.ambient.Bat#getMovementEmission()

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/Bat.java:183
  • Modifiers: protected
  • Return: Entity.MovementEmission

คืออะไร

อ่านค่า Movement Emission

ทำงานยังไง

คืนค่า: Entity.MovementEmission.EVENTS.

Parameters

  • ไม่มี

ตัวอย่างใช้งาน

@Override
protected Entity.MovementEmission getMovementEmission() {
    return super.getMovementEmission();
}

net.minecraft.world.entity.ambient.Bat#getSoundVolume()

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/Bat.java:61
  • Modifiers: protected
  • Return: float

คืออะไร

อ่านค่า Sound Volume

ทำงานยังไง

คืนค่า: 0.1F.

Parameters

  • ไม่มี

ตัวอย่างใช้งาน

@Override
protected float getSoundVolume() {
    return super.getSoundVolume();
}

net.minecraft.world.entity.ambient.Bat#getVoicePitch()

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/Bat.java:66
  • Modifiers: public
  • Return: float

คืออะไร

อ่านค่า Voice Pitch

ทำงานยังไง

คืนค่า: super.getVoicePitch() * 0.95F.

Parameters

  • ไม่มี

ตัวอย่างใช้งาน

Bat instance = ...;
float result = instance.getVoicePitch();

net.minecraft.world.entity.ambient.Bat#hurtServer(ServerLevel,DamageSource,float)

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/Bat.java:197
  • Modifiers: public
  • Return: boolean

คืออะไร

ประมวลผลความเสียหาย Server

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: isInvulnerableTo(), isResting(), setResting(). มีจุด return อย่างน้อย 2 จุด.

Parameters

  • ServerLevel serverLevel
  • DamageSource damageSource
  • float f

ตัวอย่างใช้งาน

Bat instance = ...;
ServerLevel serverLevel = ...;
DamageSource damageSource = ...;
boolean result = instance.hurtServer(serverLevel, damageSource, 0.0F);

net.minecraft.world.entity.ambient.Bat#isFlapping()

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/Bat.java:50
  • Modifiers: public
  • Return: boolean

คืออะไร

ตรวจสอบสถานะ Flapping

ทำงานยังไง

เรียกต่อ: isResting(). คืนค่า: !this.isResting() && this.tickCount % 10.0F == 0.0F.

Parameters

  • ไม่มี

ตัวอย่างใช้งาน

Bat instance = ...;
boolean result = instance.isFlapping();

net.minecraft.world.entity.ambient.Bat#isIgnoringBlockTriggers()

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/Bat.java:192
  • Modifiers: public
  • Return: boolean

คืออะไร

ตรวจสอบสถานะ Ignoring Block Triggers

ทำงานยังไง

คืนค่า: true.

Parameters

  • ไม่มี

ตัวอย่างใช้งาน

Bat instance = ...;
boolean result = instance.isIgnoringBlockTriggers();

net.minecraft.world.entity.ambient.Bat#isPushable()

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/Bat.java:87
  • Modifiers: public
  • Return: boolean

คืออะไร

ตรวจสอบสถานะ Pushable

ทำงานยังไง

คืนค่า: false.

Parameters

  • ไม่มี

ตัวอย่างใช้งาน

Bat instance = ...;
boolean result = instance.isPushable();

net.minecraft.world.entity.ambient.Bat#isResting()

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/Bat.java:104
  • Modifiers: public
  • Return: boolean

คืออะไร

ตรวจสอบสถานะ Resting

ทำงานยังไง

เรียกต่อ: get(). คืนค่า: (this.entityData.get(DATA_ID_FLAGS) & 1) != 0.

Parameters

  • ไม่มี

ตัวอย่างใช้งาน

Bat instance = ...;
boolean result = instance.isResting();

net.minecraft.world.entity.ambient.Bat#pushEntities()

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/Bat.java:96
  • Modifiers: protected
  • Return: void

คืออะไร

ดำเนินการ pushEntities ตาม implementation ของ Bat

ทำงานยังไง

ทำงานตาม body โดยตรง (ประมาณ 1 statement).

Parameters

  • ไม่มี

ตัวอย่างใช้งาน

@Override
protected void pushEntities() {
    super.pushEntities();
}

net.minecraft.world.entity.ambient.Bat#readAdditionalSaveData(CompoundTag)

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/Bat.java:210
  • Modifiers: public
  • Return: void

คืออะไร

อ่าน Additional Save Data

ทำงานยังไง

เรียกต่อ: set(), getByte().

Parameters

  • CompoundTag compoundTag

ตัวอย่างใช้งาน

Bat instance = ...;
CompoundTag compoundTag = ...;
instance.readAdditionalSaveData(compoundTag);

net.minecraft.world.entity.ambient.Bat#setResting(boolean)

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/Bat.java:108
  • Modifiers: public
  • Return: void

คืออะไร

กำหนดค่า Resting

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: get(), set().

Parameters

  • boolean bl

ตัวอย่างใช้งาน

Bat instance = ...;
instance.setResting(true);

net.minecraft.world.entity.ambient.Bat#tick()

  • Origin: common
  • Source: net/minecraft/world/entity/ambient/Bat.java:117
  • Modifiers: public
  • Return: void

คืออะไร

ประมวลผล tick tick

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: isResting(), setDeltaMovement(), setPosRaw(), getX(), floor(), getY(), getBbHeight(), getZ().

Parameters

  • ไม่มี

ตัวอย่างใช้งาน

Bat instance = ...;
instance.tick();