本文整理汇总了Java中net.minecraftforge.event.entity.living.LivingFallEvent.setCanceled方法的典型用法代码示例。如果您正苦于以下问题:Java LivingFallEvent.setCanceled方法的具体用法?Java LivingFallEvent.setCanceled怎么用?Java LivingFallEvent.setCanceled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.event.entity.living.LivingFallEvent
的用法示例。
在下文中一共展示了LivingFallEvent.setCanceled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onEntityFall
import net.minecraftforge.event.entity.living.LivingFallEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityFall(LivingFallEvent event)
{
if (event.entityLiving instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) event.entityLiving;
if (player.ridingEntity instanceof EntityAutoRocket || player.ridingEntity instanceof EntityLanderBase)
{
event.distance = 0.0F;
event.setCanceled(true);
return;
}
}
if (event.entityLiving.worldObj.provider instanceof IGalacticraftWorldProvider)
{
event.distance *= ((IGalacticraftWorldProvider) event.entityLiving.worldObj.provider).getFallDamageModifier();
}
}
示例2: onLivingFallEvent
import net.minecraftforge.event.entity.living.LivingFallEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onLivingFallEvent(LivingFallEvent event)
{
if (event.getEntity() != null && event.getEntity() instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer)event.getEntity();
for (ItemStack armor : player.getArmorInventoryList()) {
if (armor != null && armor.getItem() instanceof LongFallBoots)
{
// this cancels the fall event so you take no damage
event.setCanceled(true);
}
}
}
}
示例3: onFall
import net.minecraftforge.event.entity.living.LivingFallEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onFall(LivingFallEvent evt) {
final Entity e = evt.getEntityLiving();
if (evt.getDistance() > 4 && !e.isSneaking() && e instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer)e;
EnchantmentLevel level = tryUseEnchantment(player, EntityEquipmentSlot.FEET);
if (level == null) return;
JumpInfo boost = new JumpInfo(level, evt.getDistance());
level.createJumpExplosion(player);
if (OpenMods.proxy.isClientPlayer(player)) {
// And Now, Ladies and Gentlemen!
// Logic Defying...
// Loved By Everyone...
// Possibly Buggy
// TEEERRRRRIIIIBLE HAAAAAACK!
KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindJump.getKeyCode(), true);
// no, seriously, can't find better way to make jump
jumpBoosts.put(player, boost);
}
evt.setCanceled(true);
}
}
示例4: onFall
import net.minecraftforge.event.entity.living.LivingFallEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onFall(LivingFallEvent event) {
if (event.getEntityLiving() instanceof EntityPlayer) {
PossessivePlayer possessivePlayer = PossessHandler.get((EntityPlayer) event.getEntityLiving());
if (possessivePlayer != null) {
possessivePlayer.getPossessing().fall(event.getDistance(), event.getDamageMultiplier());
event.setCanceled(true);
}
}
}
示例5: onEvent
import net.minecraftforge.event.entity.living.LivingFallEvent; //导入方法依赖的package包/类
@Override
public void onEvent(LivingFallEvent event) {
if (event.getEntity() instanceof EntityPlayerMP) {
EntityPlayerMP player = (EntityPlayerMP) event.getEntity();
ServerPlayerSettings settings = getPlayerSettings(player);
if (settings.noFall) {event.setCanceled(true);}
else if (settings.justDisabled) {
event.setCanceled(true);
settings.justDisabled = false;
}
}
}
示例6: onEvent
import net.minecraftforge.event.entity.living.LivingFallEvent; //导入方法依赖的package包/类
@Override
public void onEvent(LivingFallEvent event) {
if (event.getEntity() instanceof EntityPlayerMP) {
EntityPlayerMP player = (EntityPlayerMP) event.getEntity();
if (!getPlayerSettings(player).falldamage) event.setCanceled(true);
}
}
示例7: onFall
import net.minecraftforge.event.entity.living.LivingFallEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onFall(LivingFallEvent event) {
EntityLivingBase entity = event.getEntityLiving();
if (entity == null || entity instanceof EntityPlayer == false || entity.isSneaking()
|| entity.isPotionActive(this) == false) {
return;
}
EntityPlayer player = (EntityPlayer) entity;
if (event.getDistance() >= MIN_HEIGHT_START_BOUNCE) {
event.setDamageMultiplier(0);
if (entity.getEntityWorld().isRemote == false) {
event.setCanceled(true); //nada serverside
}
else {
UtilSound.playSound(player, player.getPosition(), SoundEvents.BLOCK_SLIME_FALL, SoundCategory.PLAYERS, UtilSound.VOLUME / event.getDistance());
UtilParticle.spawnParticle(player.world, EnumParticleTypes.SLIME, player.getPosition());
event.setDistance(0);// fall distance
player.motionY *= -PERCENT_HEIGHT_BOUNCED;
player.isAirBorne = true;
player.onGround = false;
//postpone until one tick later. otherwise there is vanilla code internally that says "ok you finished falldamage so motionY=0;"
player.posY += 0.01;
player.getEntityData().setInteger(NBT_TICK, player.ticksExisted + 1);
player.getEntityData().setInteger(NBT_MOTIONY, (int) (player.motionY * 100f));
}
}
else if (!entity.getEntityWorld().isRemote && entity.isSneaking()) {
event.setDamageMultiplier(DAMAGE_REDUCTION);
}
}
示例8: onLivingFallEvent
import net.minecraftforge.event.entity.living.LivingFallEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onLivingFallEvent(LivingFallEvent event)
{
if (event.getEntity() != null && grapplemod.attached.contains(event.getEntity().getEntityId()))
{
event.setCanceled(true);
}
}
示例9: onLivingUpdate
import net.minecraftforge.event.entity.living.LivingFallEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onLivingUpdate(LivingFallEvent event) {
if (event.getEntityLiving() instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
int damage = (int) (event.getDistance() - 3);
int maxAbsorbed = PlayerTracker.getPlayerData(player).getAbilities().getFallDamagePrevention();
if (damage < maxAbsorbed) {
event.setCanceled(true);
} else {
event.setDistance(event.getDistance() - maxAbsorbed);
}
}
}
示例10: absorbFall
import net.minecraftforge.event.entity.living.LivingFallEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void absorbFall(LivingFallEvent event)
{
if (event.entityLiving.getCurrentArmor(3) == null) return;
if (event.entityLiving.getCurrentArmor(3).getItem() instanceof Exoskeleton) {
event.setCanceled(true);
}
}
示例11: onFallEvent
import net.minecraftforge.event.entity.living.LivingFallEvent; //导入方法依赖的package包/类
@SuppressWarnings("unused")
@SubscribeEvent
public void onFallEvent(LivingFallEvent event) {
if (event.getEntityLiving() instanceof EntityPlayer && isDismounting) { //ConfigHandler.isDismounting()) {
event.setCanceled(true);
event.setDistance(0.0f);
event.setDamageMultiplier(0.0f);
// ConfigHandler.setIsDismounting(false);
isDismounting = false;
}
}
示例12: fall
import net.minecraftforge.event.entity.living.LivingFallEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void fall(LivingFallEvent event)
{
if(!shouldCancelled(event.entityLiving))
{
return;
}
event.setCanceled(true);
}
示例13: negateFallDamage
import net.minecraftforge.event.entity.living.LivingFallEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void negateFallDamage(LivingFallEvent event) {
if (!(event.getEntity() instanceof EntityPlayer)) {
return;
}
event.setCanceled(true);
}
示例14: onFall
import net.minecraftforge.event.entity.living.LivingFallEvent; //导入方法依赖的package包/类
/**
* Used by the Piston boots to lessen the fall damage. It's hacky, but I don't care.
*
* @param event
*/
@SubscribeEvent
public void onFall(LivingFallEvent event)
{
if (event.entity != null)
{
if (event.entityLiving instanceof EntityCreature && ConfigHandler.FIX_LEAD)
{
EntityCreature creature = (EntityCreature) event.entityLiving;
if (creature.getLeashed() && creature.getLeashedToEntity() != null && creature.getLeashedToEntity() instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) creature.getLeashedToEntity();
if (creature.motionY > -2.0f && player.motionY > -2.0f)
{
event.setCanceled(true);
}
}
}
if (event.entityLiving instanceof EntityFriendlySpider)
{
if (((EntityFriendlySpider) event.entityLiving).riddenByEntity != null
&& ((EntityFriendlySpider) event.entityLiving).riddenByEntity instanceof EntityPlayer
&& event.distance < 5)
{
event.setCanceled(true);
}
}
if (event.entityLiving instanceof EntityPlayer)
{
if (Wearing.isWearingBoots(((EntityPlayer) event.entityLiving)) && event.distance < 8)
{
event.setCanceled(true);
}
if(Wearing.isWearingTheRightBackpack((EntityPlayer)event.entityLiving,"IronGolem") && ConfigHandler.BACKPACK_ABILITIES)
{
event.setCanceled(true);
}
}
}
}
示例15: playerFallingDamage
import net.minecraftforge.event.entity.living.LivingFallEvent; //导入方法依赖的package包/类
@ForgeSubscribe
public void playerFallingDamage(LivingFallEvent event) {
event.setCanceled(true);
}