Class HackableEnderman
java.lang.Object
me.desht.pneumaticcraft.common.hacking.entity.HackableEnderman
- All Implemented Interfaces:
IHackableEntity
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddHackInfo(net.minecraft.world.entity.Entity entity, List<net.minecraft.network.chat.Component> curInfo, net.minecraft.world.entity.player.Player player) Add info that is displayed on the tracker tooltip here.voidaddPostHackInfo(net.minecraft.world.entity.Entity entity, List<net.minecraft.network.chat.Component> curInfo, net.minecraft.world.entity.player.Player player) Add info that is being displayed after hacking, as long as 'afterHackTick' is returning true.booleanafterHackTick(net.minecraft.world.entity.Entity entity) Called every tick after the hacking finished.booleancanHack(net.minecraft.world.entity.Entity entity, net.minecraft.world.entity.player.Player player) Returning true will allow the player to hack this entity.net.minecraft.resources.ResourceLocationShould return a unique id to represent this hackable.intgetHackTime(net.minecraft.world.entity.Entity entity, net.minecraft.world.entity.player.Player player) Return the time it takes to hack this entity in ticks.voidonHackFinished(net.minecraft.world.entity.Entity entity, net.minecraft.world.entity.player.Player player) Called when a player successfully hacks an entity; basicallygetHackTime(Entity)ticks after the hack was initiated.
-
Constructor Details
-
HackableEnderman
public HackableEnderman()
-
-
Method Details
-
getHackableId
public net.minecraft.resources.ResourceLocation getHackableId()Description copied from interface:IHackableEntityShould return a unique id to represent this hackable. Used in NBT saving to be able to trigger the afterHackTime after a server restart. Null is a valid return: afterHackTick will not be triggered at all in that case.- Specified by:
getHackableIdin interfaceIHackableEntity- Returns:
- a unique String id
-
canHack
public boolean canHack(net.minecraft.world.entity.Entity entity, net.minecraft.world.entity.player.Player player) Description copied from interface:IHackableEntityReturning true will allow the player to hack this entity. This can be used to only allow hacking under certain conditions.- Specified by:
canHackin interfaceIHackableEntity- Parameters:
entity- the potential hacking targetplayer- the player who is looking at the entity
-
addHackInfo
public void addHackInfo(net.minecraft.world.entity.Entity entity, List<net.minecraft.network.chat.Component> curInfo, net.minecraft.world.entity.player.Player player) Description copied from interface:IHackableEntityAdd info that is displayed on the tracker tooltip here. Text like "Hack to explode" can be added. This method is only called when canHack(Entity) returned true.- Specified by:
addHackInfoin interfaceIHackableEntity- Parameters:
entity- the potential hack targetcurInfo- a text component list to append info toplayer- the player who is looking at the entity
-
addPostHackInfo
public void addPostHackInfo(net.minecraft.world.entity.Entity entity, List<net.minecraft.network.chat.Component> curInfo, net.minecraft.world.entity.player.Player player) Description copied from interface:IHackableEntityAdd info that is being displayed after hacking, as long as 'afterHackTick' is returning true. Things like "Neutralized".- Specified by:
addPostHackInfoin interfaceIHackableEntity- Parameters:
entity- the hacked entitycurInfo- a text component list to append info toplayer- the player who has hacked the entity
-
getHackTime
public int getHackTime(net.minecraft.world.entity.Entity entity, net.minecraft.world.entity.player.Player player) Description copied from interface:IHackableEntityReturn the time it takes to hack this entity in ticks. For more powerful hacks, a longer required hacking time is recommended.- Specified by:
getHackTimein interfaceIHackableEntity- Parameters:
entity- the potential hack targetplayer- the player who is looking at the entity
-
onHackFinished
public void onHackFinished(net.minecraft.world.entity.Entity entity, net.minecraft.world.entity.player.Player player) Description copied from interface:IHackableEntityCalled when a player successfully hacks an entity; basicallygetHackTime(Entity)ticks after the hack was initiated.- Specified by:
onHackFinishedin interfaceIHackableEntity- Parameters:
entity- the hacked entityplayer- the player who has hacked the entity
-
afterHackTick
public boolean afterHackTick(net.minecraft.world.entity.Entity entity) Description copied from interface:IHackableEntityCalled every tick after the hacking finished. Returning true will keep this going (e.g. for endermen, to suppress their teleportation) or false for one-shot hacks (e.g. hacking a cow turns it into a mooshroom, and that is all)- Specified by:
afterHackTickin interfaceIHackableEntity- Parameters:
entity- the hacked entity
-