本文整理匯總了Java中net.minecraftforge.event.entity.living.LivingDeathEvent.isCanceled方法的典型用法代碼示例。如果您正苦於以下問題:Java LivingDeathEvent.isCanceled方法的具體用法?Java LivingDeathEvent.isCanceled怎麽用?Java LivingDeathEvent.isCanceled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraftforge.event.entity.living.LivingDeathEvent
的用法示例。
在下文中一共展示了LivingDeathEvent.isCanceled方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: japaneseDeath
import net.minecraftforge.event.entity.living.LivingDeathEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.LOWEST)
public void japaneseDeath(LivingDeathEvent event)
{
EntityLivingBase living = event.getEntityLiving();
World world = living.world;
if(!event.isCanceled() && !world.isRemote && living.hasCapability(JAPANESE_MOB_CAP,null))
{
JapaneseMob japaneseMob = living.getCapability(JAPANESE_MOB_CAP,null);
int i = japaneseMob.spirits;
while (i > 0)
{
int j = EntitySpirit.getSpiritSplit(i);
i -= j;
world.spawnEntity(new EntitySpirit(world, living.posX, living.posY, living.posZ, j));
}
}
}
示例2: onDeath
import net.minecraftforge.event.entity.living.LivingDeathEvent; //導入方法依賴的package包/類
@Override
public void onDeath(ItemStack itemStack, LivingDeathEvent event, boolean isWornArmor) {
System.out.println("ABORTING DEATH");
if(isWornArmor && !event.isCanceled()) {
EntityPlayer player = (EntityPlayer)event.entity;
NBTTagCompound data = itemStack.getTagCompound();
//System.out.println("Cooldown: " + data.getInteger("resCooldown"));
if(data.getInteger("resCooldown_armor") <= 0) {
event.setCanceled(true);
player.setHealth(20);
data.setInteger("resCooldown_armor", 6000);
itemStack.damageItem(5, player);
return;
}
}
}
示例3: entityDeath
import net.minecraftforge.event.entity.living.LivingDeathEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void entityDeath(LivingDeathEvent event) {
if (event.isCanceled())
return;
if (event.entity.worldObj.isRemote)
return;
if (event.source.getSourceOfDamage() == null)
return;
EntityPlayer player;
Entity ent = event.source.getSourceOfDamage();
boolean arrow = false;
double distance = 0;
if (ent instanceof EntityPlayer)
player = (EntityPlayer) event.source.getSourceOfDamage();
else if (ent instanceof EntityArrow) {
if (((EntityArrow) ent).shootingEntity instanceof EntityPlayer) {
player = (EntityPlayer) ((EntityArrow) ent).shootingEntity;
arrow = true;
distance = event.entity.getDistanceSqToEntity(player);
}
else
return;
}
else
return;
if (isPlayerFake(player))
return;
String name = "entity.kill." + EntityList.getEntityString(event.entity);
PlayerResearchHelper.progressResearch(player, name, 1, true);
if (arrow)
PlayerResearchHelper.progressResearch(player, "entity.arrowHit", distance, true);
}
示例4: onDeath
import net.minecraftforge.event.entity.living.LivingDeathEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onDeath(LivingDeathEvent event) {
if (!event.isCanceled()) {
if (Config.enableChatBox) {
if (event.entity instanceof EntityPlayer) {
for (TileEntityChatBox box : chatBoxMap.keySet()) {
if (Config.readRange < 0 || Vec3.createVectorHelper(box.xCoord, box.yCoord, box.zCoord).distanceTo(((EntityPlayer) event.entity).getPosition(1.0f)) <= Config.readRange)
box.onDeath((EntityPlayer) event.entity, event.source);
}
}
}
}
}
示例5: onLivingDeath
import net.minecraftforge.event.entity.living.LivingDeathEvent; //導入方法依賴的package包/類
@ForgeSubscribe(priority=EventPriority.LOWEST)
public void onLivingDeath(LivingDeathEvent event) {
if (!event.isCanceled() && !(event.entityLiving instanceof EntityPlayer)) {
Map<EntityLivingBase, EntityStats> entityStats = getEntityStatsMap(getSide(event.entityLiving));
entityStats.remove(event.entityLiving);
}
}