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


Java EntityList类代码示例

本文整理汇总了Java中net.minecraft.entity.EntityList的典型用法代码示例。如果您正苦于以下问题:Java EntityList类的具体用法?Java EntityList怎么用?Java EntityList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: determineDifficultyForSpawnEvent

import net.minecraft.entity.EntityList; //导入依赖的package包/类
public int determineDifficultyForSpawnEvent(SpawnEventDetails details){
    int difficulty = baseDifficulty;
    difficulty+=getMobBaseSpawnCost(details.entity);
    String mobId = EntityList.getEntityString(details.entity);
    RegionMobConfig mobConfig = getConfigForMob(mobId);
    for(DifficultyControl control : mobConfig.controls){
        try {
            difficulty += control.getChangeForSpawn(details);
        }catch (Exception e){
            if(DifficultyManager.debugLogSpawns){
                LOG.warn("A control misbehaved: "+control.getIdentifier());
                LOG.warn("  Issue was: "+e.getMessage());
            }
        }
    }
    return difficulty;
}
 
开发者ID:talandar,项目名称:ProgressiveDifficulty,代码行数:18,代码来源:Region.java

示例2: getChangeForSpawn

import net.minecraft.entity.EntityList; //导入依赖的package包/类
@Override
public int getChangeForSpawn(SpawnEventDetails details) {

    EntityList.EntityEggInfo eggInfo = EntityRegistry.getEntry(details.entity.getClass()).getEgg();
    if(eggInfo==null) {
        if(DifficultyManager.debugLogSpawns){
            LOG.info("Tried to get kills for mob with class "+details.entity.getClass()+", but not spawn egg found.  Cannot count kills for this mob for difficulty.");
        }
        return 0;
    }
    StatBase stat = eggInfo.killEntityStat;
    int killedMobs = PlayerAreaStatAccumulator.getStatForPlayersInArea(type,stat,details.entity,128);

    int contribution = (int)(((double)killedMobs * difficultyPerHundredKills) / 100);

    if(maxAddedDifficulty>=0){
        contribution = Math.min(contribution,maxAddedDifficulty);
    }

    return contribution;
}
 
开发者ID:talandar,项目名称:ProgressiveDifficulty,代码行数:22,代码来源:SpecificMobKilledControl.java

示例3: doUpkeep

import net.minecraft.entity.EntityList; //导入依赖的package包/类
private static void doUpkeep(World world){
    List<EntityLiving> modifiedEntities = MobNBTHandler.getModifiedEntities(world);

    for(EntityLiving entity : modifiedEntities){
        String regionName = MobNBTHandler.getEntityRegion(entity);
        Map<String,Integer> changes = MobNBTHandler.getChangeMap(entity);
        Region region = DifficultyManager.getRegionByName(regionName);
        String mobId = EntityList.getEntityString(entity);
        for(String change : changes.keySet()){
            try {
                DifficultyModifier modifier = region.getModifierForMobById(mobId,change);
                if (modifier != null) {
                    modifier.handleUpkeepEvent(changes.get(change), entity);
                }
            }catch(Exception e){
                LOG.warn("Error applying modifier at upkeep.  Mob was "+entity.getName()+", Modifier was "+change+".  Please report to Progressive Difficulty Developer!");
                LOG.warn("\tCaught Exception had message "+e.getMessage());
            }
        }
    }
}
 
开发者ID:talandar,项目名称:ProgressiveDifficulty,代码行数:22,代码来源:MobUpkeepController.java

示例4: isEntityTypeValid

import net.minecraft.entity.EntityList; //导入依赖的package包/类
private static <T extends Entity> boolean isEntityTypeValid(ICommandSender commandSender, Map<String, String> params)
{
    String s = getArgument(params, "type");
    s = s != null && s.startsWith("!") ? s.substring(1) : s;

    if (s != null && !EntityList.isStringValidEntityName(s))
    {
        TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("commands.generic.entity.invalidType", new Object[] {s});
        textcomponenttranslation.getStyle().setColor(TextFormatting.RED);
        commandSender.addChatMessage(textcomponenttranslation);
        return false;
    }
    else
    {
        return true;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:18,代码来源:EntitySelector.java

示例5: isEntityTypeValid

import net.minecraft.entity.EntityList; //导入依赖的package包/类
private static <T extends Entity> boolean isEntityTypeValid(ICommandSender commandSender, Map<String, String> params)
{
    String s = getArgument(params, field_190849_w);

    if (s == null)
    {
        return true;
    }
    else
    {
        ResourceLocation resourcelocation = new ResourceLocation(s.startsWith("!") ? s.substring(1) : s);

        if (EntityList.isStringValidEntityName(resourcelocation))
        {
            return true;
        }
        else
        {
            TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("commands.generic.entity.invalidType", new Object[] {resourcelocation});
            textcomponenttranslation.getStyle().setColor(TextFormatting.RED);
            commandSender.addChatMessage(textcomponenttranslation);
            return false;
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:26,代码来源:EntitySelector.java

示例6: actionPerformed

import net.minecraft.entity.EntityList; //导入依赖的package包/类
@Override
protected void actionPerformed(GuiButton button) throws IOException {
	if (button.enabled) {
		/*if (button.id == 0)
			TF2weapons.network.sendToServer(new TF2Message.DisguiseMessage("M:zombie"));
		if (button.id == 1)
			TF2weapons.network.sendToServer(new TF2Message.DisguiseMessage("M:creeper"));
		if (button.id == 2)
			TF2weapons.network.sendToServer(new TF2Message.DisguiseMessage("M:enderman"));
		if (button.id == 3)
			TF2weapons.network.sendToServer(new TF2Message.DisguiseMessage("M:cow"));
		if (button.id == 4)
			TF2weapons.network.sendToServer(new TF2Message.DisguiseMessage("M:pig"));*/
		if (button.id == 30)
			TF2weapons.network.sendToServer(new TF2Message.DisguiseMessage("P:" + playerNameField.getText()));
		if (button.id < 16) {
			TF2weapons.network.sendToServer(new TF2Message.DisguiseMessage("M:"+ EntityList.getKey(mobList.get(button.id+this.firstIndex)).toString()));
		}
		/*if (button.id == 7)
			TF2weapons.network.sendToServer(new TF2Message.DisguiseMessage("M:spider"));
		if (button.id == 8)
			TF2weapons.network.sendToServer(new TF2Message.DisguiseMessage("M:" + playerNameField.getText()));*/
		this.mc.displayGuiScreen(null);
	}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:26,代码来源:GuiDisguiseKit.java

示例7: deserializeNBT

import net.minecraft.entity.EntityList; //导入依赖的package包/类
@Override
public void deserializeNBT(NBTTagCompound nbt) {
	NBTTagCompound bossInfo = nbt.getCompoundTag("BossInfo");
	for (String key : bossInfo.getKeySet())
		this.highestBossLevel.put(EntityList.getClass(new ResourceLocation(key)), bossInfo.getShort(key));
	this.nextBossTicks = nbt.getInteger("NextBossTick");
	this.dodgedDmg=nbt.getFloat("DodgedDmg");
	NBTTagList list=(NBTTagList) nbt.getTag("Contracts");
	if(list != null)
	for(int i=0;i<list.tagCount();i++) {
		NBTTagCompound com=list.getCompoundTagAt(i);
		byte[] objsb=com.getByteArray("Objectives");
		Objective[] objs=new Objective[objsb.length];
		for(int j=0;j<objsb.length;j++) {
			objs[j]=Objective.values()[objsb[j]];
		}
		Contract contract=new Contract(com.getString("Name"), 0, objs);
		contract.active=com.getBoolean("Active");
		contract.progress=com.getShort("Progress");
		contract.rewards=com.getByte("Rewards");
		this.contracts.add(contract);
		//TF2weapons.network.sendTo(new TF2Message.ContractMessage(i, contract), (EntityPlayerMP) this.owner);
	}
	this.nextContractDay=nbt.getInteger("NextContractDay");
	
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:27,代码来源:TF2PlayerCapability.java

示例8: drawSlot

import net.minecraft.entity.EntityList; //导入依赖的package包/类
protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn)
{
    EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)this.field_148222_l.get(entryID);
    String s = I18n.format("entity." + EntityList.getStringFromID(entitylist$entityegginfo.spawnedID) + ".name", new Object[0]);
    int i = GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151512_d);
    int j = GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151513_e);
    String s1 = I18n.format("stat.entityKills", new Object[] {Integer.valueOf(i), s});
    String s2 = I18n.format("stat.entityKilledBy", new Object[] {s, Integer.valueOf(j)});

    if (i == 0)
    {
        s1 = I18n.format("stat.entityKills.none", new Object[] {s});
    }

    if (j == 0)
    {
        s2 = I18n.format("stat.entityKilledBy.none", new Object[] {s});
    }

    GuiStats.this.drawString(GuiStats.this.fontRendererObj, s, p_180791_2_ + 2 - 10, p_180791_3_ + 1, 16777215);
    GuiStats.this.drawString(GuiStats.this.fontRendererObj, s1, p_180791_2_ + 2, p_180791_3_ + 1 + GuiStats.this.fontRendererObj.FONT_HEIGHT, i == 0 ? 6316128 : 9474192);
    GuiStats.this.drawString(GuiStats.this.fontRendererObj, s2, p_180791_2_ + 2, p_180791_3_ + 1 + GuiStats.this.fontRendererObj.FONT_HEIGHT * 2, j == 0 ? 6316128 : 9474192);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:24,代码来源:GuiStats.java

示例9: isEntityTypeValid

import net.minecraft.entity.EntityList; //导入依赖的package包/类
private static <T extends Entity> boolean isEntityTypeValid(ICommandSender commandSender, Map<String, String> params)
{
    String s = func_179651_b(params, "type");
    s = s != null && s.startsWith("!") ? s.substring(1) : s;

    if (s != null && !EntityList.isStringValidEntityName(s))
    {
        ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.generic.entity.invalidType", new Object[] {s});
        chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED);
        commandSender.addChatMessage(chatcomponenttranslation);
        return false;
    }
    else
    {
        return true;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:18,代码来源:PlayerSelector.java

示例10: addInformation

import net.minecraft.entity.EntityList; //导入依赖的package包/类
@Override
public void addInformation(ItemStack stack, @Nullable World world, List<String> list, ITooltipFlag advanced)
{
    if (stack.hasTagCompound())
    {
        NBTTagCompound chestTile = stack.getTagCompound().getCompoundTag("ChestTile");
        NBTTagCompound spawnData = chestTile.getCompoundTag("SpawnData");
        String mobId = spawnData.getString("id");

        if (mobId.length() > 0)
        {
            String translated = EntityList.getTranslationName(new ResourceLocation(mobId));
            list.add(translated == null ? mobId : translated);
        }
    }
}
 
开发者ID:cubex2,项目名称:chesttransporter,代码行数:17,代码来源:Spawner.java

示例11: onHitEntity

import net.minecraft.entity.EntityList; //导入依赖的package包/类
@SubscribeEvent
public void onHitEntity(LivingHurtEvent event) {
	
	if (event.getAmount() <= 0 || event.getEntityLiving() instanceof EntityPlayer) return;
	
	if (!(event.getSource().getSourceOfDamage() instanceof EntityPlayer)) return;
	
	ItemStack transformer = BaublesApi.getBaublesHandler((EntityPlayer)event.getSource().getSourceOfDamage()).getStackInSlot(6);
	if (transformer == null || (transformer != null && transformer.getItem() != this)) return;
	
	Random rand = new Random();
	if (rand.nextInt(100) != 0) return;
	
	EntityLivingBase elb = event.getEntityLiving();
	List<String> entities = new ArrayList<String>(EntityList.ENTITY_EGGS.keySet());
	String randomString = entities.get(rand.nextInt(entities.size()));
	Entity entity = EntityList.createEntityByName(randomString, elb.worldObj);
	if (!entity.isNonBoss()) return;
	entity.setPositionAndRotation(elb.posX, elb.posY, elb.posZ, elb.rotationYaw, elb.rotationPitch);
	
	elb.worldObj.spawnEntityInWorld(entity);
	elb.setDead();
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:24,代码来源:EmblemTransformation.java

示例12: getEntityId

import net.minecraft.entity.EntityList; //导入依赖的package包/类
private static int getEntityId(String p_getEntityId_0_)
{
    if (p_getEntityId_0_ == null)
    {
        return -1;
    }
    else
    {
        int i = EntityList.getIDFromString(p_getEntityId_0_);

        if (i < 0)
        {
            return -1;
        }
        else
        {
            String s = EntityList.getStringFromID(i);
            return !Config.equals(p_getEntityId_0_, s) ? -1 : i;
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:22,代码来源:CustomColors.java

示例13: tabCompletionsForCreate

import net.minecraft.entity.EntityList; //导入依赖的package包/类
private List<String> tabCompletionsForCreate(String[] args) {

		if (args.length == 2) {
			return getListOfStringsMatchingLastWord(args, EntityList.getEntityNameList());
		}

		if (args.length == 3) {
			String[] levels = new String[10];
			for (int i = 0; i < 10; i++) {
				levels[i] = Integer.toString(i, 10);
			}
			return getListOfStringsMatchingLastWord(args, levels);
		}

		return Collections.emptyList();
	}
 
开发者ID:ToroCraft,项目名称:NemesisSystem,代码行数:17,代码来源:NemesisSystemCommand.java

示例14: DrawPrimitive

import net.minecraft.entity.EntityList; //导入依赖的package包/类
/** Spawn a single entity at the specified position.
 * @param e the actual entity to be spawned.
 * @param w the world in which to spawn the entity.
 * @throws Exception
 */
private void DrawPrimitive( DrawEntity e, World w ) throws Exception
{
    String entityName = e.getType().getValue();
    NBTTagCompound nbttagcompound = new NBTTagCompound();
    nbttagcompound.setString("id", entityName);
    Entity entity;
    try
    {
        entity = EntityList.createEntityFromNBT(nbttagcompound, w);
        if (entity != null)
        {
            positionEntity(entity, e.getX().doubleValue(), e.getY().doubleValue(), e.getZ().doubleValue(), e.getYaw().floatValue(), e.getPitch().floatValue());
            entity.setVelocity(e.getXVel().doubleValue(), e.getYVel().doubleValue(), e.getZVel().doubleValue());
            w.spawnEntityInWorld(entity);
        }
    }
    catch (RuntimeException runtimeexception)
    {
        // Cannot summon this entity.
        throw new Exception("Couldn't create entity type: " + e.getType().getValue());
    }
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:28,代码来源:BlockDrawingHelper.java

示例15: getRandomMonster

import net.minecraft.entity.EntityList; //导入依赖的package包/类
private static ResourceLocation getRandomMonster()
{
	ArrayList<ResourceLocation> entities = new ArrayList<ResourceLocation>();
	
	entities.add(EntityList.getKey(EntityZombie.class));
	entities.add(EntityList.getKey(EntitySpider.class));
	entities.add(EntityList.getKey(EntitySkeleton.class));
	entities.add(EntityList.getKey(EntityEnderman.class));
	entities.add(EntityList.getKey(EntityCreeper.class));
	entities.add(EntityList.getKey(EntityCaveSpider.class));
	
	return entities.get((int) (Math.random() * entities.size()));
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:14,代码来源:DungeonHelper.java


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