本文整理汇总了Java中net.minecraftforge.event.entity.living.EnderTeleportEvent.getEntity方法的典型用法代码示例。如果您正苦于以下问题:Java EnderTeleportEvent.getEntity方法的具体用法?Java EnderTeleportEvent.getEntity怎么用?Java EnderTeleportEvent.getEntity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.event.entity.living.EnderTeleportEvent
的用法示例。
在下文中一共展示了EnderTeleportEvent.getEntity方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enderPearlTeleport
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void enderPearlTeleport(EnderTeleportEvent ev) {
if (ev.getEntity().getEntityWorld().isRemote || !(ev.getEntity() instanceof EntityPlayerMP)) {
return;
}
EntityPlayerMP player = (EntityPlayerMP) ev.getEntity();
if (isWearingEnderBoots(player)) {
ev.setAttackDamage(0.01f);
damageEnderBoots(player);
}
}
示例2: onEnderTeleport
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEnderTeleport(EnderTeleportEvent event){
if(event.getAttackDamage()>0&&event.getEntity()instanceof EntityPlayer){
ItemStack armor=((EntityPlayer)event.getEntity()).inventory.armorInventory[0];
if(armor!=null&&armor.getItem() instanceof ItemArmor&&((ItemArmor) armor.getItem()).getArmorMaterial()==ArmorMaterials.Terminium){
event.setAttackDamage(0);
}
}
}
示例3: onEnderTeleportEvent
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEnderTeleportEvent(EnderTeleportEvent event) {
if (mountedPearl) {
Entity rider = event.getEntity();
if (rider != null && rider instanceof EntityPlayer && rider.getRidingEntity() != null) {
EntityPlayer playerRider = (EntityPlayer) rider;
Entity maybeHorse = playerRider.getRidingEntity();
//take the players horse and set its position to the target
event.getEntity().getRidingEntity().setPositionAndUpdate(event.getTargetX(), event.getTargetY(), event.getTargetZ());
playerRider.getEntityData().setInteger(KEY_MOUNTENTITY, maybeHorse.getEntityId());
}
}
}
示例4: onEnderTeleportEvent
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEnderTeleportEvent(EnderTeleportEvent event) {
Entity ent = event.getEntity();
if (ent instanceof EntityLivingBase == false) {
return;
}
EntityLivingBase living = (EntityLivingBase) event.getEntity();
if (living.isPotionActive(this)) {
event.setAttackDamage(0);
}
}
示例5: handleTeleportEvent
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //导入方法依赖的package包/类
/**
* Most generic handling of EnderTeleportEvent
*
* @param event to handle
* @return true only if the event is not cancelled
*/
private boolean handleTeleportEvent(EnderTeleportEvent event){
if (!MinecraftForge.EVENT_BUS.post(event)) {
for (int i = 0; i < 32; ++i){
this.world.spawnParticle(EnumParticleTypes.PORTAL, event.getTargetX(), event.getTargetY() + this.rand.nextDouble() * 2.0D, event.getTargetZ(), this.rand.nextGaussian(), 0.0D, this.rand.nextGaussian());
}
event.getEntity().dismountRidingEntity();
event.getEntity().setPositionAndUpdate(event.getTargetX(), event.getTargetY(), event.getTargetZ());
event.getEntity().fallDistance = 0.0F;
event.getEntity().attackEntityFrom(getEnderDamage(), event.getAttackDamage());
return true;
}
return false;
}
示例6: stopEndermanTeleporting
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void stopEndermanTeleporting(EnderTeleportEvent e){
if((e.getEntity() instanceof EntityEnderman || e.getEntity() instanceof EntityShulker) && ConfigurationFile.stopMobsFromTeleporting){
e.setCanceled(true);
}
}