public interface IHackableBlock
IPneumaticHelmetRegistry.addHackable(Block, Supplier) . With the former way there will be one
instance only per type. In the latter, there will be an IHackableBlock instance for every block.| Modifier and Type | Method and Description |
|---|---|
void |
addInfo(net.minecraft.world.IBlockReader world,
net.minecraft.util.math.BlockPos pos,
java.util.List<net.minecraft.util.text.ITextComponent> curInfo,
net.minecraft.entity.player.PlayerEntity player)
Add info that is displayed on the tracker tooltip here.
|
void |
addPostHackInfo(net.minecraft.world.IBlockReader world,
net.minecraft.util.math.BlockPos pos,
java.util.List<net.minecraft.util.text.ITextComponent> curInfo,
net.minecraft.entity.player.PlayerEntity player)
Add info to be displayed on the HUD after hacking is complete, as long as
afterHackTick(IBlockReader, BlockPos) continues to returning true, e.g. |
default boolean |
afterHackTick(net.minecraft.world.IBlockReader world,
net.minecraft.util.math.BlockPos pos)
Called every tick after the hacking finished (on both server and client side).
|
default boolean |
canHack(net.minecraft.world.IBlockReader world,
net.minecraft.util.math.BlockPos pos,
net.minecraft.entity.player.PlayerEntity player)
Returning true will allow the player to hack this block.
|
default java.util.Optional<net.minecraft.util.math.BlockRayTraceResult> |
fakeRayTrace(net.minecraft.entity.player.PlayerEntity player,
net.minecraft.util.math.BlockPos targetPos)
Fake up a ray trace result for a targeted block.
|
net.minecraft.util.ResourceLocation |
getHackableId()
Get a unique id to represent this hackable.
|
int |
getHackTime(net.minecraft.world.IBlockReader world,
net.minecraft.util.math.BlockPos pos,
net.minecraft.entity.player.PlayerEntity player)
Get the time it takes to hack this block in ticks.
|
void |
onHackComplete(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos,
net.minecraft.entity.player.PlayerEntity player)
When the player has been hacking the block for
getHackTime(IBlockReader, BlockPos, PlayerEntity) ticks,
this will be called on both server and client side. |
net.minecraft.util.ResourceLocation getHackableId()
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).
CURRENTLY THIS ISN'T IMPLEMENTED.
default boolean canHack(net.minecraft.world.IBlockReader world,
net.minecraft.util.math.BlockPos pos,
net.minecraft.entity.player.PlayerEntity player)
world - the worldpos - the block posplayer - the player observing the blockvoid addInfo(net.minecraft.world.IBlockReader world,
net.minecraft.util.math.BlockPos pos,
java.util.List<net.minecraft.util.text.ITextComponent> curInfo,
net.minecraft.entity.player.PlayerEntity player)
canHack(IBlockReader, BlockPos, PlayerEntity) has returned true.
Keep this message short; one short sentence is enough.world - the worldpos - the block pos of the to-be-hacked blockcurInfo - text component list to add info toplayer - the player observing the hackable blockvoid addPostHackInfo(net.minecraft.world.IBlockReader world,
net.minecraft.util.math.BlockPos pos,
java.util.List<net.minecraft.util.text.ITextComponent> curInfo,
net.minecraft.entity.player.PlayerEntity player)
afterHackTick(IBlockReader, BlockPos) continues to returning true, e.g. "Spawner Disabled".
Keep this message short; one short sentence or even a couple of words is enough.world - the worldpos - the block pos of the hacked blockcurInfo - text component list to add info toplayer - the player observing the hacked blockint getHackTime(net.minecraft.world.IBlockReader world,
net.minecraft.util.math.BlockPos pos,
net.minecraft.entity.player.PlayerEntity player)
world - the worldpos - the block posplayer - the player observing the hackable blockvoid onHackComplete(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos,
net.minecraft.entity.player.PlayerEntity player)
getHackTime(IBlockReader, BlockPos, PlayerEntity) ticks,
this will be called on both server and client side.world - the worldpos - the block posplayer - the player observing the hacked blockdefault boolean afterHackTick(net.minecraft.world.IBlockReader world,
net.minecraft.util.math.BlockPos pos)
CURRENTLY THIS METHOD WILL STOP GETTING INVOKED AFTER A SERVER RESTART!
world - the worldpos - the block posdefault java.util.Optional<net.minecraft.util.math.BlockRayTraceResult> fakeRayTrace(net.minecraft.entity.player.PlayerEntity player,
net.minecraft.util.math.BlockPos targetPos)
AbstractBlock.AbstractBlockState.use(World, PlayerEntity, Hand, BlockRayTraceResult), which needs a non-null
ray trace result to get the block's position.player - player doing the hackingtargetPos - position of the to-be-hacked block