当前位置: 首页>>代码示例>>Java>>正文


Java EntityJoinWorldEvent.setCanceled方法代码示例

本文整理汇总了Java中net.minecraftforge.event.entity.EntityJoinWorldEvent.setCanceled方法的典型用法代码示例。如果您正苦于以下问题:Java EntityJoinWorldEvent.setCanceled方法的具体用法?Java EntityJoinWorldEvent.setCanceled怎么用?Java EntityJoinWorldEvent.setCanceled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.event.entity.EntityJoinWorldEvent的用法示例。


在下文中一共展示了EntityJoinWorldEvent.setCanceled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onEntityJoinWorld

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityJoinWorld(EntityJoinWorldEvent event) {
    int i = 0;
    for (SpawnRule rule : RulesManager.rules) {
        if (rule.isOnJoin() && rule.match(event)) {
            Event.Result result = rule.getResult();
            if (debug) {
                InControl.logger.log(Level.INFO, "Join Rule " + i + ": "+ result
                        + " entity: " + event.getEntity().getName()
                        + " y: " + event.getEntity().getPosition().getY());
            }
            if (result != Event.Result.DENY) {
                rule.action(event);
            } else {
                event.setCanceled(true);
            }
            return;
        }
        i++;
    }
}
 
开发者ID:McJty,项目名称:InControl,代码行数:22,代码来源:ForgeEventHandlers.java

示例2: checkSpawn

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void checkSpawn (EntityJoinWorldEvent event) {

    if (event.getEntity() instanceof EntitySlime && !event.getEntity().hasCustomName()) {

        for (final TileEntity tile : event.getWorld().loadedTileEntityList) {

            if (tile instanceof TileEntityAntiSlime && ((TileEntityAntiSlime) tile).shareChunks((EntityLivingBase) event.getEntity())) {

                if (event.getWorld().isBlockPowered(tile.getPos())) {
                    continue;
                }

                event.setCanceled(true);
                event.getEntity().setDead();
                break;
            }
        }
    }
}
 
开发者ID:Darkhax-Minecraft,项目名称:Dark-Utilities,代码行数:21,代码来源:FeatureAntiSlime.java

示例3: on

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOW)
public void on(EntityJoinWorldEvent event) {
    if(!event.world.isRemote && event.entity instanceof EntityItem) {
        ItemStack stack = ((EntityItem) event.entity).getEntityItem();
        if(isDisguised(stack)) {
            long time = event.world.getTotalWorldTime() + event.world.rand.nextInt(60) + 40;
            trackedItems.put((EntityItem) event.entity, time);
        }
        if(stack.getItem() instanceof ItemElement && !(event.entity instanceof EntityItemElement)) {
            event.setCanceled(true);
            EntityItem newItem = new EntityItemElement(event.world,
                    event.entity.posX, event.entity.posY, event.entity.posZ,
                    ((EntityItem) event.entity).getEntityItem());
            newItem.delayBeforeCanPickup = ((EntityItem) event.entity).delayBeforeCanPickup;
            newItem.motionX = event.entity.motionX;
            newItem.motionY = event.entity.motionY;
            newItem.motionZ = event.entity.motionZ;
            event.world.spawnEntityInWorld(newItem);
        }
    }
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:22,代码来源:EventHandlerWorld.java

示例4: onEntitySpawn

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onEntitySpawn(EntityJoinWorldEvent event)
{
    if(event.entity.worldObj.isRemote && event.entity instanceof EntityMeteorite && FMLCommonHandler.instance().getEffectiveSide().isClient() && !event.entity.isDead)
    {
        event.setCanceled(true);
        if(!event.entity.worldObj.weatherEffects.contains(event.entity))
        {
            boolean has = false;
            for(int i = 0; i < event.entity.worldObj.weatherEffects.size(); i++)
            {
                Entity ent = (Entity)event.entity.worldObj.weatherEffects.get(i);
                if(ent instanceof EntityMeteorite && ent.getEntityId() == event.entity.getEntityId())
                {
                    has = true;
                    ent.setLocationAndAngles(event.entity.posX, event.entity.posY, event.entity.posZ, 0F, 0F);
                    break;
                }
            }
            if(!has)
            {
                event.entity.worldObj.weatherEffects.add(event.entity);
            }
        }
    }
}
 
开发者ID:iChun,项目名称:ItFellFromTheSky,代码行数:27,代码来源:EventHandler.java

示例5: onEntityJoinWorldEvent

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityJoinWorldEvent(EntityJoinWorldEvent e) {
    if (!e.getWorld().isRemote) {
        List<TileEntity> loadedTileEntityList = e.getWorld().loadedTileEntityList;

        for (int i = loadedTileEntityList.size() - 1; i >= 0; i--) {
            TileEntity tileEntity = loadedTileEntityList.get(i);
            if (tileEntity instanceof OfferingBoxTileEntity) {
                if (((OfferingBoxTileEntity) tileEntity).getChargeLevel() > 0) {
                    if (TotemHelper.hasTotemType((OfferingBoxTileEntity) tileEntity, TotemType.COW)) {
                        Modifiers mods = TotemHelper.getModifiers(e.getWorld(), (OfferingBoxTileEntity) tileEntity);
                        int radius = TotemHelper.DEFAULT_RADIUS + (int) (TotemHelper.RANGE_BOOST * mods.range);

                        if (!canSpawnMobHere(tileEntity.getPos(), e.getEntity(), radius)) {
                            //FMLLog.log(Level.ERROR, "Stopped mob from spawning with radius: " + radius);
                            e.setCanceled(true);
                            break;
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:CorwinJV,项目名称:MobTotems,代码行数:25,代码来源:CowLogic.java

示例6: onEntityJoinWorldEvent

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityJoinWorldEvent(EntityJoinWorldEvent e) {
    if (!e.getWorld().isRemote) {
        List<TileEntity> loadedTileEntityList = new ArrayList<>(e.getWorld().loadedTileEntityList);

        for (TileEntity tileEntity : loadedTileEntityList) {
            if (tileEntity instanceof OfferingBoxTileEntity) {
                if (((OfferingBoxTileEntity) tileEntity).getChargeLevel() > 0) {
                    if (TotemHelper.hasTotemType((OfferingBoxTileEntity) tileEntity, TotemType.CREEPER)) {
                        Modifiers mods = TotemHelper.getModifiers(e.getWorld(), (OfferingBoxTileEntity) tileEntity);
                        int radius = TotemHelper.DEFAULT_RADIUS + (int) (TotemHelper.RANGE_BOOST * mods.range);
                        if (!canSpawnMobHere(tileEntity.getPos(), e.getEntity(), radius)) {
                            //FMLLog.log(Level.ERROR, "Stopped mob from spawning with radius: " + radius);
                            e.setCanceled(true);
                            break;
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:CorwinJV,项目名称:MobTotems,代码行数:23,代码来源:CreeperLogic.java

示例7: onBlockFall

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onBlockFall(EntityJoinWorldEvent event) {
	
	if (event.getEntity() != null && event.getEntity() instanceof EntityFallingBlock) {
		EntityPlayer player = event.getEntity().worldObj.getClosestPlayerToEntity(event.getEntity(), range);
		if (player != null && player.getHeldItemMainhand() != null && player.getHeldItemMainhand().getItem() == UCItems.precisionShovel) {
			if (NBTUtils.getInt(player.getHeldItemMainhand(), ItemGeneric.TAG_UPGRADE, -1) == 10)
				event.setCanceled(true);
		}
	}
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:12,代码来源:UCEventHandlerServer.java

示例8: handleRespawnOfNemesis

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
private void handleRespawnOfNemesis(EntityJoinWorldEvent event) {
	Entity entity = event.getEntity();
	NemesisEntry nemesis = NemesisUtil.loadNemesisFromEntity(event.getEntity());
	if (nemesis == null) {
		/*
		 * missing nemesis data
		 */
		entity.setDead();
		event.setCanceled(true);
	} else if (entity.getTags().contains(NemesisSystem.TAG_SPAWNING)) {
		/*
		 * new nemesis spawn in progress
		 */
		entity.removeTag(NemesisSystem.TAG_SPAWNING);
		nemesis.setSpawned(entity.getEntityId());
		nemesis.setUnloaded(null);
		NemesisRegistryProvider.get(entity.world).update(nemesis);
		sendNemesisDataToClient(nemesis);
	} else if (!nemesis.isSpawned()) {
		/*
		 * nemesis has been marked as despawned
		 */
		event.setCanceled(true);
	} else {
		/*
		 * nemesis is marked unloaded, mark as loaded now he is respawning
		 */
		if (!entity.getPersistentID().equals(nemesis.getEntityUuid())) {
			event.setCanceled(true);
			return;
		}

		nemesis.setSpawned(entity.getEntityId());
		nemesis.setUnloaded(null);
		nemesis.setLastSpawned(entity.world.getTotalWorldTime());
		NemesisRegistryProvider.get(event.getWorld()).update(nemesis);
		sendNemesisDataToClient(nemesis);
	}
}
 
开发者ID:ToroCraft,项目名称:NemesisSystem,代码行数:40,代码来源:SpawnHandler.java

示例9: onEntityCreation

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityCreation(EntityJoinWorldEvent event){
	if(Config.lockedTimeFalling && (event.getEntity() instanceof EntityFallingBlock)){
		if(LockedTimeData.get(event.getWorld()).getNumRunes()>0){
			EntityFallingBlock fb = (EntityFallingBlock)event.getEntity();
			IBlockState state = fb.getBlock();
			fb.setDead();
			event.getWorld().setBlockState(fb.getPosition(), state);
			event.setCanceled(true);
		}
	}
}
 
开发者ID:Xilef11,项目名称:runesofwizardry-classics,代码行数:13,代码来源:RuneLockedTime.java

示例10: entitySpawn

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public static void entitySpawn(EntityJoinWorldEvent event){
	if(ConfigValues.XPOVERRIDE && !event.getWorld().isRemote && event.getEntity().getClass() == EntityXPOrb.class){
		event.setCanceled(true);
		EntityXPOrb xp = (EntityXPOrb) event.getEntity();
		EntityCustomXPOrb newXP = new EntityCustomXPOrb(xp.world, xp.posX, xp.posY, xp.posZ, xp.xpValue);
		event.getWorld().spawnEntity(newXP);
	}
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:Overlord,代码行数:10,代码来源:CommonEvents.java

示例11: entityJoinWorldEvent

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void entityJoinWorldEvent(EntityJoinWorldEvent event) {
    Entity entity = event.getEntity();

    if (ExtendedConfig.overrideVanillaFishing && entity instanceof EntityFishHook && entity.getClass().equals(EntityFishHook.class)) {
        World world = event.getWorld();
        if (!world.isRemote) {
            EntityPlayer player = ((EntityFishHook) entity).getAngler();
            ItemStack stack = player.getHeldItem(EnumHand.MAIN_HAND);
            if (stack.getItem() != Items.FISHING_ROD) {
                stack = player.getHeldItem(EnumHand.OFF_HAND);
            }
            entity.setDead();

            EntityCustomFishHook hook = new EntityCustomFishHook(world, player);

            int speed = EnchantmentHelper.getFishingSpeedBonus(stack);
            if (speed > 0) {
                hook.setLureSpeed(speed);
            }
            int luck = EnchantmentHelper.getFishingLuckBonus(stack);
            if (luck > 0) {
                hook.setLuck(luck);
            }

            world.spawnEntity(hook);
        }

        event.setCanceled(true);
    }
}
 
开发者ID:NightKosh,项目名称:Gravestone-mod-Extended,代码行数:32,代码来源:GSEventsHandler.java

示例12: onEntitySpawn

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntitySpawn(EntityJoinWorldEvent event)
{
	if(event.entity instanceof EntityItem && isMonitoring)
	{
		event.setCanceled(true);
	}
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:9,代码来源:ItemBlockCardboardBox.java

示例13: onEntityJoin

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityJoin(EntityJoinWorldEvent event)
{
    Entity entity = event.entity;
    Class<?> entityClass = entity.getClass();
    if (blockedMobClasses.containsValue(entityClass) && SprinklesForVanilla.isOnServer)
    {
        if (entityClass == EntityZombie.class)
        {
            if (blockedMobClasses.containsKey("zombieVillager") && ((EntityZombie) entity).isVillager())
            {
                event.setCanceled(true);
            }
            else if (blockedMobClasses.containsKey("zombie") && !((EntityZombie) entity).isVillager())
            {
                event.setCanceled(true);
            }
        }
        else if (entityClass == EntitySkeleton.class)
        {
            if (blockedMobClasses.containsKey("skeleton") && ((EntitySkeleton) entity).getSkeletonType() == 0)
            {
                event.setCanceled(true);
            }
            else if (blockedMobClasses.containsKey("witherSkeleton") && ((EntitySkeleton) entity).getSkeletonType() == 1)
            {
                event.setCanceled(true);
            }
        }
        else
        {
            event.setCanceled(true);
        }
    }
}
 
开发者ID:VikeStep,项目名称:sprinkles_for_vanilla,代码行数:36,代码来源:EntityHandlers.java

示例14: entityJoin

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
  public void entityJoin(EntityJoinWorldEvent evt) {
if (!evt.world.isRemote && evt.entity instanceof EntityPlayerMP) {
	
	packetPipeline.sendTo(new WorldDataPacket(evt.world.getSeed()), (EntityPlayerMP)evt.entity);
}

if (evt.entity instanceof EntityZombie) {
	if (((EntityZombie)evt.entity).isChild()) {
		((EntityZombie)evt.entity).setChild(false);
		evt.setCanceled(true);
	}
}
  }
 
开发者ID:tyronx,项目名称:vintagecraft,代码行数:15,代码来源:VintageCraft.java

示例15: onJoinWorld

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onJoinWorld(EntityJoinWorldEvent event)
{
    if (event.getWorld().isRemote == false)
    {
        if ((event.getEntity() instanceof EntityLiving) && event.getEntity().getTags().contains(ItemSyringe.TAG_PASSIFIED))
        {
            ItemSyringe.passifyEntity((EntityLiving) event.getEntity());
        }
        else if (preventItemSpawningInWorld && (event.getEntity() instanceof EntityItem))
        {
            event.setCanceled(true);
        }
    }
}
 
开发者ID:maruohon,项目名称:enderutilities,代码行数:16,代码来源:EntityEventHandler.java


注:本文中的net.minecraftforge.event.entity.EntityJoinWorldEvent.setCanceled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。