Skip to content

Package net.minecraft.world.level.gameevent.vibrations

Part 1/1


VibrationInfo

  • Full name: net.minecraft.world.level.gameevent.vibrations.VibrationInfo
  • Package: net.minecraft.world.level.gameevent.vibrations
  • Source: commonnet/minecraft/world/level/gameevent/vibrations/VibrationInfo.java
  • Type: record
  • Modifiers: public

net.minecraft.world.level.gameevent.vibrations.VibrationInfo#getEntity(ServerLevel)

  • Origin: common
  • Source: net/minecraft/world/level/gameevent/vibrations/VibrationInfo.java:43
  • Modifiers: public
  • Return: Optional<Entity>

คืออะไร

อ่านค่า Entity

ทำงานยังไง

เรียกต่อ: ofNullable(), or(), map(). คืนค่า: Optional.ofNullable(this.entity).or(() -> Optional.ofNullable(this.uuid).map(serverLevel::getEntity)).

Parameters

  • ServerLevel serverLevel

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

VibrationInfo instance = ...;
ServerLevel serverLevel = ...;
Optional<Entity> result = instance.getEntity(serverLevel);

net.minecraft.world.level.gameevent.vibrations.VibrationInfo#getProjectileOwner(ServerLevel)

  • Origin: common
  • Source: net/minecraft/world/level/gameevent/vibrations/VibrationInfo.java:47
  • Modifiers: public
  • Return: Optional<Entity>

คืออะไร

อ่านค่า Projectile Owner

ทำงานยังไง

เรียกต่อ: getEntity(), filter(), map(), or(), ofNullable().

Parameters

  • ServerLevel serverLevel

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

VibrationInfo instance = ...;
ServerLevel serverLevel = ...;
Optional<Entity> result = instance.getProjectileOwner(serverLevel);

net.minecraft.world.level.gameevent.vibrations.VibrationInfo#VibrationInfo(Holder<GameEvent>,float,Vec3,Entity)

  • Origin: common
  • Source: net/minecraft/world/level/gameevent/vibrations/VibrationInfo.java:34
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

เรียกต่อ: getUUID(), getProjectileOwner().

Parameters

  • Holder<GameEvent> holder
  • float f
  • Vec3 vec3
  • Entity entity

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

Holder<GameEvent> holder = ...;
Vec3 vec3 = ...;
Entity entity = ...;
VibrationInfo instance = new VibrationInfo(holder, 0.0F, vec3, entity);

net.minecraft.world.level.gameevent.vibrations.VibrationInfo#VibrationInfo(Holder<GameEvent>,float,Vec3,UUID,UUID)

  • Origin: common
  • Source: net/minecraft/world/level/gameevent/vibrations/VibrationInfo.java:30
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

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

Parameters

  • Holder<GameEvent> holder
  • float f
  • Vec3 vec3
  • UUID uUID
  • UUID uUID2

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

Holder<GameEvent> holder = ...;
Vec3 vec3 = ...;
UUID uUID = ...;
UUID uUID2 = ...;
VibrationInfo instance = new VibrationInfo(holder, 0.0F, vec3, uUID, uUID2);

VibrationSelector

  • Full name: net.minecraft.world.level.gameevent.vibrations.VibrationSelector
  • Package: net.minecraft.world.level.gameevent.vibrations
  • Source: commonnet/minecraft/world/level/gameevent/vibrations/VibrationSelector.java
  • Type: class
  • Modifiers: public

net.minecraft.world.level.gameevent.vibrations.VibrationSelector#addCandidate(VibrationInfo,long)

  • Origin: common
  • Source: net/minecraft/world/level/gameevent/vibrations/VibrationSelector.java:26
  • Modifiers: public
  • Return: void

คืออะไร

เพิ่ม Candidate

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. แก้ state: currentVibrationData. เรียกต่อ: shouldReplaceVibration(), of().

Parameters

  • VibrationInfo vibrationInfo
  • long l

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

VibrationSelector instance = ...;
VibrationInfo vibrationInfo = ...;
instance.addCandidate(vibrationInfo, 0L);

net.minecraft.world.level.gameevent.vibrations.VibrationSelector#chosenCandidate(long)

  • Origin: common
  • Source: net/minecraft/world/level/gameevent/vibrations/VibrationSelector.java:53
  • Modifiers: public
  • Return: Optional<VibrationInfo>

คืออะไร

ดำเนินการ chosenCandidate ตาม implementation ของ VibrationSelector

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: isEmpty(), empty(), get(), getRight(), of(), getLeft(). มีจุด return อย่างน้อย 2 จุด.

Parameters

  • long l

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

VibrationSelector instance = ...;
Optional<VibrationInfo> result = instance.chosenCandidate(0L);

net.minecraft.world.level.gameevent.vibrations.VibrationSelector#startOver()

  • Origin: common
  • Source: net/minecraft/world/level/gameevent/vibrations/VibrationSelector.java:61
  • Modifiers: public
  • Return: void

คืออะไร

เริ่ม Over

ทำงานยังไง

แก้ state: currentVibrationData. เรียกต่อ: empty().

Parameters

  • ไม่มี

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

VibrationSelector instance = ...;
instance.startOver();

net.minecraft.world.level.gameevent.vibrations.VibrationSelector#VibrationSelector()

  • Origin: common
  • Source: net/minecraft/world/level/gameevent/vibrations/VibrationSelector.java:22
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

แก้ state: currentVibrationData. เรียกต่อ: empty().

Parameters

  • ไม่มี

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

VibrationSelector instance = new VibrationSelector();

net.minecraft.world.level.gameevent.vibrations.VibrationSelector#VibrationSelector(Optional<VibrationInfo>,long)

  • Origin: common
  • Source: net/minecraft/world/level/gameevent/vibrations/VibrationSelector.java:18
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

แก้ state: currentVibrationData. เรียกต่อ: map(), of().

Parameters

  • Optional<VibrationInfo> optional
  • long l

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

Optional<VibrationInfo> optional = ...;
VibrationSelector instance = new VibrationSelector(optional, 0L);

VibrationSystem

  • Full name: net.minecraft.world.level.gameevent.vibrations.VibrationSystem
  • Package: net.minecraft.world.level.gameevent.vibrations
  • Source: commonnet/minecraft/world/level/gameevent/vibrations/VibrationSystem.java
  • Type: interface
  • Modifiers: public

net.minecraft.world.level.gameevent.vibrations.VibrationSystem#getGameEventFrequency(Holder<GameEvent>)

  • Origin: common
  • Source: net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java:105
  • Modifiers: static
  • Return: int

คืออะไร

อ่านค่า Game Event Frequency

ทำงานยังไง

เรียกต่อ: unwrapKey(), map(), orElse(). คืนค่า: holder.unwrapKey().map(VibrationSystem::getGameEventFrequency).orElse(0).

Parameters

  • Holder<GameEvent> holder

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

Holder<GameEvent> holder = ...;
int result = VibrationSystem.getGameEventFrequency(holder);

net.minecraft.world.level.gameevent.vibrations.VibrationSystem#getGameEventFrequency(ResourceKey<GameEvent>)

  • Origin: common
  • Source: net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java:109
  • Modifiers: static
  • Return: int

คืออะไร

อ่านค่า Game Event Frequency

ทำงานยังไง

เรียกต่อ: applyAsInt(). คืนค่า: VIBRATION_FREQUENCY_FOR_EVENT.applyAsInt(resourceKey).

Parameters

  • ResourceKey<GameEvent> resourceKey

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

ResourceKey<GameEvent> resourceKey = ...;
int result = VibrationSystem.getGameEventFrequency(resourceKey);

net.minecraft.world.level.gameevent.vibrations.VibrationSystem#getRedstoneStrengthForDistance(float,int)

  • Origin: common
  • Source: net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java:117
  • Modifiers: static
  • Return: int

คืออะไร

อ่านค่า Redstone Strength For Distance

ทำงานยังไง

เรียกต่อ: max(), floor(). คืนค่า: Math.max(1, 15 - Mth.floor(d * f)).

Parameters

  • float f
  • int i

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

int result = VibrationSystem.getRedstoneStrengthForDistance(0.0F, 0);

net.minecraft.world.level.gameevent.vibrations.VibrationSystem#getResonanceEventByFrequency(int)

  • Origin: common
  • Source: net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java:113
  • Modifiers: static
  • Return: ResourceKey<GameEvent>

คืออะไร

อ่านค่า Resonance Event By Frequency

ทำงานยังไง

เรียกต่อ: get(). คืนค่า: RESONANCE_EVENTS.get(i - 1).

Parameters

  • int i

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

ResourceKey<GameEvent> result = VibrationSystem.getResonanceEventByFrequency(0);

net.minecraft.world.level.gameevent.vibrations.VibrationSystem#getVibrationData()

  • Origin: common
  • Source: net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java:101
  • Modifiers: ``
  • Return: VibrationSystem.Data

คืออะไร

อ่านค่า Vibration Data

ทำงานยังไง

ไม่มี body ใน source declaration นี้

Parameters

  • ไม่มี

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

VibrationSystem instance = ...;
VibrationSystem.Data result = instance.getVibrationData();

net.minecraft.world.level.gameevent.vibrations.VibrationSystem#getVibrationUser()

  • Origin: common
  • Source: net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java:103
  • Modifiers: ``
  • Return: VibrationSystem.User

คืออะไร

อ่านค่า Vibration User

ทำงานยังไง

ไม่มี body ใน source declaration นี้

Parameters

  • ไม่มี

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

VibrationSystem instance = ...;
VibrationSystem.User result = instance.getVibrationUser();