Class HackableSecurityStation
java.lang.Object
me.desht.pneumaticcraft.common.hacking.block.HackableSecurityStation
- All Implemented Interfaces:
IHackableBlock
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInfo(net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos, List<net.minecraft.network.chat.Component> curInfo, net.minecraft.world.entity.player.Player player) Add info that is displayed on the block tracker panel, describing what the hack would do to the block.voidaddPostHackInfo(net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos, List<net.minecraft.network.chat.Component> curInfo, net.minecraft.world.entity.player.Player player) Add info that is displayed on the block tracker panel, describing what the hack has done to the block.booleancanHack(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.entity.player.Player player) Can this block actually be hacked? This will normally return true, since the object is registered with the block, but this can be overridden to filter hackability by the actual blockstate (e.g Jukeboxes can only be hacked when they contain a music disc), or by some property of the player.net.minecraft.resources.ResourceLocationGet a unique id to represent this hackable.intgetHackTime(net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.player.Player player) Get the time it takes to hack this block in ticks.voidonHackComplete(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.player.Player player) When the player has been hacking the block forIHackableBlock.getHackTime(BlockGetter, BlockPos, Player)ticks, this will be called on both server and client side.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface me.desht.pneumaticcraft.api.pneumatic_armor.hacking.IHackableBlock
afterHackTick, fakeRayTrace
-
Constructor Details
-
HackableSecurityStation
public HackableSecurityStation()
-
-
Method Details
-
getHackableId
public net.minecraft.resources.ResourceLocation getHackableId()Description copied from interface:IHackableBlockGet a unique id to represent this hackable. Used in NBT saving to be able to trigger the afterHackTime after a server restart.The returned ResourceLocation should be in the namespace of the mod which adds the hack (which is not necessarily the mod that adds the hackable block).
- Specified by:
getHackableIdin interfaceIHackableBlock- Returns:
- a unique ID for this hack type
-
canHack
public boolean canHack(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.entity.player.Player player) Description copied from interface:IHackableBlockCan this block actually be hacked? This will normally return true, since the object is registered with the block, but this can be overridden to filter hackability by the actual blockstate (e.g Jukeboxes can only be hacked when they contain a music disc), or by some property of the player.Note that this can be called on both server and client.
- Specified by:
canHackin interfaceIHackableBlock- Parameters:
level- the worldpos- the block posstate- the blockstate at the given blockposplayer- the player potentially hacking the block
-
addInfo
public void addInfo(net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos, List<net.minecraft.network.chat.Component> curInfo, net.minecraft.world.entity.player.Player player) Description copied from interface:IHackableBlockAdd info that is displayed on the block tracker panel, describing what the hack would do to the block. This is only called whenIHackableBlock.canHack(BlockGetter, BlockPos, BlockState, Player)has returned true. Keep this message short; one short phrase is enough.- Specified by:
addInfoin interfaceIHackableBlock- Parameters:
world- the worldpos- the block pos of the to-be-hacked blockcurInfo- text component list to add info toplayer- the player observing the hackable block
-
addPostHackInfo
public void addPostHackInfo(net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos, List<net.minecraft.network.chat.Component> curInfo, net.minecraft.world.entity.player.Player player) Description copied from interface:IHackableBlockAdd info that is displayed on the block tracker panel, describing what the hack has done to the block. This is displayed for a second or so after the hack completes. Keep this message short; one short phrase is enough.- Specified by:
addPostHackInfoin interfaceIHackableBlock- Parameters:
world- the worldpos- the block pos of the hacked blockcurInfo- text component list to add info toplayer- the player observing the hacked block
-
getHackTime
public int getHackTime(net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.player.Player player) Description copied from interface:IHackableBlockGet the time it takes to hack this block in ticks. For more powerful hacks, a longer hacking time is recommended.- Specified by:
getHackTimein interfaceIHackableBlock- Parameters:
world- the worldpos- the block posplayer- the player observing the hackable block
-
onHackComplete
public void onHackComplete(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.player.Player player) Description copied from interface:IHackableBlockWhen the player has been hacking the block forIHackableBlock.getHackTime(BlockGetter, BlockPos, Player)ticks, this will be called on both server and client side.- Specified by:
onHackCompletein interfaceIHackableBlock- Parameters:
world- the worldpos- the block posplayer- the player observing the hacked block
-