Package cn.nukkit.blockentity
Class BlockEntitySculkSensor
java.lang.Object
cn.nukkit.math.Vector3
cn.nukkit.positiontracking.NamedPosition
cn.nukkit.level.Position
cn.nukkit.blockentity.BlockEntity
cn.nukkit.blockentity.BlockEntitySculkSensor
- All Implemented Interfaces:
VibrationListener
,Cloneable
@PowerNukkitXOnly
@Since("1.6.0.0-PNX")
public class BlockEntitySculkSensor
extends BlockEntity
implements VibrationListener
- Author:
- Kevims KCodeYT
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
protected int
protected VibrationEvent
protected int
protected boolean
Fields inherited from class cn.nukkit.blockentity.BlockEntity
BANNER, BARREL, BEACON, BED, BEEHIVE, BELL, BLAST_FURNACE, BREWING_STAND, CAMPFIRE, CAULDRON, CHEST, chunk, closed, COMMAND_BLOCK, COMPARATOR, CONDUIT, count, DAYLIGHT_DETECTOR, DISPENSER, DROPPER, ENCHANT_TABLE, END_GATEWAY, END_PORTAL, ENDER_CHEST, FLOWER_POT, FURNACE, HOPPER, id, ITEM_FRAME, JUKEBOX, lastUpdate, LECTERN, LODESTONE, MOB_SPAWNER, movable, MOVING_BLOCK, MUSIC, name, namedTag, NETHER_REACTOR, PISTON_ARM, SCULK_CATALYST, SCULK_SENSOR, SCULK_SHRIEKER, server, SHULKER_BOX, SIGN, SKULL, SMOKER, STRUCTURE_BLOCK, TARGET, timing
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
calPower()
void
close()
int
int
返回振动监听器的位置double
返回振动监听半径int
getPower()
protected void
boolean
void
onBreak()
void
onVibrationArrive
(VibrationEvent event) 声波到达事件boolean
onVibrationOccur
(VibrationEvent event) 是否响应此振动 若响应,将会从声波源发射声波到监听器位置,并在到达时调用 onVibrationArrive() 方法 请注意,若此方法被调用,则声波必定可到达protected void
Methods inherited from class cn.nukkit.blockentity.BlockEntity
createBlockEntity, createBlockEntity, createBlockEntity, getBlock, getCleanedNBT, getDefaultCompound, getId, getLevelBlockEntity, getName, getSaveId, isMovable, isObservable, loadNBT, onBreak, onUpdate, registerBlockEntity, saveNBT, scheduleUpdate, setDirty
Methods inherited from class cn.nukkit.level.Position
abs, add, add, add, add, ceil, clone, divide, floor, fromObject, fromObject, getChunk, getLevel, getLevelBlock, getLevelBlock, getLevelBlock, getLevelBlockAround, getLevelBlockAtLayer, getLevelBlockState, getLevelBlockState, getLevelName, getLocation, getSide, getSide, getTickCachedLevelBlock, getTickCachedLevelBlockAtLayer, getTypedBlockEntity, getValidLevel, isValid, multiply, round, setComponents, setComponents, setLevel, setStrong, setWeak, subtract, subtract, subtract, subtract, subtract, toString
Methods inherited from class cn.nukkit.positiontracking.NamedPosition
matchesNamedPosition
Methods inherited from class cn.nukkit.math.Vector3
asBlockVector3, asVector3f, cross, distance, distance, distanceManhattan, distanceSquared, distanceSquared, dot, down, down, east, east, equals, getAxis, getChunkSectionY, getChunkVector, getChunkX, getChunkZ, getFloorX, getFloorY, getFloorZ, getForward, getIntermediateWithXValue, getIntermediateWithYValue, getIntermediateWithZValue, getRight, getSideVec, getSouth, getUp, getWest, getX, getY, getZ, hashCode, length, lengthSquared, maxPlainDistance, maxPlainDistance, maxPlainDistance, maxPlainDistance, maxPlainDistance, normalize, north, north, rawHashCode, setComponentsAdding, setComponentsAdding, setX, setY, setZ, south, south, up, up, west, west
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface cn.nukkit.level.vibration.VibrationListener
asEntity, isEntity
-
Field Details
-
lastActiveTime
protected int lastActiveTime -
lastVibrationEvent
-
power
protected int power -
comparatorPower
protected int comparatorPower -
waitForVibration
protected boolean waitForVibration
-
-
Constructor Details
-
BlockEntitySculkSensor
@PowerNukkitXOnly @Since("1.6.0.0-PNX") public BlockEntitySculkSensor(FullChunk chunk, CompoundTag nbt)
-
-
Method Details
-
initBlockEntity
protected void initBlockEntity()- Overrides:
initBlockEntity
in classBlockEntity
-
onBreak
public void onBreak()- Overrides:
onBreak
in classBlockEntity
-
close
public void close()- Overrides:
close
in classBlockEntity
-
isBlockEntityValid
public boolean isBlockEntityValid()- Specified by:
isBlockEntityValid
in classBlockEntity
-
getListenerVector
Description copied from interface:VibrationListener
返回振动监听器的位置- Specified by:
getListenerVector
in interfaceVibrationListener
- Returns:
- Vector3
-
onVibrationOccur
Description copied from interface:VibrationListener
是否响应此振动 若响应,将会从声波源发射声波到监听器位置,并在到达时调用 onVibrationArrive() 方法 请注意,若此方法被调用,则声波必定可到达- Specified by:
onVibrationOccur
in interfaceVibrationListener
- Parameters:
event
- 振动事件- Returns:
- boolean
-
onVibrationArrive
Description copied from interface:VibrationListener
声波到达事件- Specified by:
onVibrationArrive
in interfaceVibrationListener
- Parameters:
event
- 振动事件
-
getLastVibrationEvent
-
getLastActiveTime
public int getLastActiveTime() -
getPower
public int getPower() -
getComparatorPower
public int getComparatorPower() -
getListenRange
public double getListenRange()Description copied from interface:VibrationListener
返回振动监听半径- Specified by:
getListenRange
in interfaceVibrationListener
- Returns:
- double
-
updateLastActiveTime
protected void updateLastActiveTime() -
calPower
public void calPower()
-