Java 类net.minecraft.entity.EntityList 实例源码
项目:ProgressiveDifficulty
文件:Region.java
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;
}
项目:ProgressiveDifficulty
文件:SpecificMobKilledControl.java
@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;
}
项目:ProgressiveDifficulty
文件:MobUpkeepController.java
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());
}
}
}
}
项目:CustomWorldGen
文件:EntitySelector.java
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;
}
}
项目:Backmemed
文件:EntitySelector.java
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;
}
}
}
项目:Mods
文件:GuiDisguiseKit.java
@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);
}
}
项目:Mods
文件:TF2PlayerCapability.java
@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");
}
项目:DecompiledMinecraft
文件:GuiStats.java
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);
}
项目:DecompiledMinecraft
文件:PlayerSelector.java
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;
}
}
项目:chesttransporter
文件:Spawner.java
@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);
}
}
}
项目:uniquecrops
文件:EmblemTransformation.java
@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();
}
项目:BaseClient
文件:CustomColors.java
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;
}
}
}
项目:BaseClient
文件:GuiStats.java
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);
}
项目:NemesisSystem
文件:NemesisSystemCommand.java
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();
}
项目:BaseClient
文件:GuiStats.java
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);
}
项目:BaseClient
文件:PlayerSelector.java
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;
}
}
项目:Proyecto-DASI
文件:BlockDrawingHelper.java
/** 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());
}
}
项目:Loot-Slash-Conquer
文件:DungeonHelper.java
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()));
}
项目:CursedLasso
文件:ItemCursedLasso.java
@Override
public boolean itemInteractionForEntity(ItemStack item, EntityPlayer player, EntityLivingBase entity) {
if (entity.worldObj.isRemote) {
return false;
}
if (entity instanceof IMob) {
if (item.hasTagCompound())
return false;
item.setTagCompound(new NBTTagCompound());
NBTTagCompound mainTag = new NBTTagCompound();
NBTTagCompound entityTag = new NBTTagCompound();
entity.writeToNBT(entityTag);
mainTag.setFloat("health",entity.getHealth());
mainTag.setTag("data", entityTag);
mainTag.setString("id", EntityList.getEntityString(entity));
if (entity instanceof EntitySlime) {
mainTag.setInteger("slimesize", ((EntitySlime) entity).getSlimeSize());
}
if(entity instanceof EntityZombie){
mainTag.setBoolean("isBabyZombie",entity.isChild());
}
item.getTagCompound().setTag("entity",mainTag);
player.setCurrentItemOrArmor(0, item);
entity.setDead();
return true;
}
return super.itemInteractionForEntity(item, player, entity);
}
项目:ProgressiveDifficulty
文件:Region.java
public void makeDifficultyChanges(EntityLiving entity, int determinedDifficulty, Random rand) {
Map<String, Integer> thisSpawnModifiers = Maps.newHashMap();
int initialDifficulty = determinedDifficulty;
int failCount = 0;
String mobId = EntityList.getEntityString(entity);
RegionMobConfig mobConfig = getConfigForMob(mobId);
while (determinedDifficulty > allowedMargin && failCount < maxFailCount) {
DifficultyModifier pickedModifier = mobConfig.pickModifierFromList(rand);
boolean failed = true;
if (pickedModifier.costPerChange() <= (determinedDifficulty + allowedMargin) && pickedModifier.validForEntity(entity)) {
//add mod to list, IFF not past max
int numAlreadyInList = thisSpawnModifiers.computeIfAbsent(pickedModifier.getIdentifier(), result -> 0);
if (numAlreadyInList < pickedModifier.getMaxInstances()) {
thisSpawnModifiers.put(pickedModifier.getIdentifier(), 1 + thisSpawnModifiers.get(pickedModifier.getIdentifier()));
//reduce remainder of difficulty
determinedDifficulty -= pickedModifier.costPerChange();
failed = false;
failCount = 0;
}
}
if (failed) {
failCount++;
}
}
String log = "For spawn of " + EntityList.getEntityString(entity)
+ " in region "+ getName()
+ " with difficulty " + initialDifficulty + ", ("+determinedDifficulty+" remaining) decided to use: ";
for (String modId : thisSpawnModifiers.keySet()) {
int numToApply = thisSpawnModifiers.get(modId);
mobConfig.modifiers.get(modId).handleSpawnEvent(numToApply, entity);
log = log + modId + " " + numToApply + " times, ";
}
if(DifficultyManager.debugLogSpawns) {
LOG.info(log);
}
MobNBTHandler.setChangeMap(entity,getName(),thisSpawnModifiers);
}
项目:CustomWorldGen
文件:EntityRegistry.java
/**
* Add a spawn entry for the supplied entity in the supplied {@link BiomeGenBase} list
* @param entityName The entity name
* @param weightedProb Probability
* @param min Min spawn count
* @param max Max spawn count
* @param typeOfCreature type of spawn
* @param biomes List of biomes
*/
@SuppressWarnings("unchecked")
public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, Biome... biomes)
{
Class <? extends Entity > entityClazz = EntityList.NAME_TO_CLASS.get(entityName);
if (EntityLiving.class.isAssignableFrom(entityClazz))
{
addSpawn((Class <? extends EntityLiving >) entityClazz, weightedProb, min, max, typeOfCreature, biomes);
}
}
项目:CustomWorldGen
文件:WorldServer.java
private boolean canAddEntity(Entity entityIn)
{
if (entityIn.isDead)
{
LOGGER.warn("Tried to add entity {} but it was marked as removed already", new Object[] {EntityList.getEntityString(entityIn)});
return false;
}
else
{
UUID uuid = entityIn.getUniqueID();
if (this.entitiesByUuid.containsKey(uuid))
{
Entity entity = (Entity)this.entitiesByUuid.get(uuid);
if (this.unloadedEntityList.contains(entity))
{
this.unloadedEntityList.remove(entity);
}
else
{
if (!(entityIn instanceof EntityPlayer))
{
LOGGER.warn("Keeping entity {} that already exists with UUID {}", new Object[] {EntityList.getEntityString(entity), uuid.toString()});
return false;
}
LOGGER.warn("Force-added player with duplicate UUID {}", new Object[] {uuid.toString()});
}
this.removeEntityDangerously(entity);
}
return true;
}
}
项目:Industrial-Foregoing
文件:MobRenderInPrisonHandler.java
@SubscribeEvent
public void onTooltip(RenderTooltipEvent.PostText event) {
if (event.getStack() == null || event.getStack().isEmpty()) return;
if (event.getStack().getItem() instanceof MobImprisonmentToolItem && ((MobImprisonmentToolItem) event.getStack().getItem()).containsEntity(event.getStack())) {
try {
Entity entity = EntityList.createEntityByID(event.getStack().getTagCompound().getInteger("id"), Minecraft.getMinecraft().world);
entity.readFromNBT(event.getStack().getTagCompound());
ItemStackUtils.renderEntity((int) (event.getX() + 15 + entity.width), (int) (event.getY() + 58 + entity.height), 15, 0, 0, (EntityLivingBase) entity);
} catch (NullPointerException e) {
e.printStackTrace();
}
}
}
项目:Uranium
文件:CraftStatistic.java
public static net.minecraft.stats.StatBase getEntityStatistic(org.bukkit.Statistic stat, EntityType entity) {
EntityEggInfo entityEggInfo = (EntityEggInfo) EntityList.entityEggs.get(Integer.valueOf(entity.getTypeId()));
if (entityEggInfo != null) {
return entityEggInfo.field_151512_d;
}
return null;
}
项目:CustomWorldGen
文件:AnvilChunkLoader.java
@Nullable
protected static Entity createEntityFromNBT(NBTTagCompound compound, World worldIn)
{
try
{
return EntityList.createEntityFromNBT(compound, worldIn);
}
catch (RuntimeException var3)
{
return null;
}
}
项目:DecompiledMinecraft
文件:EntityPlayer.java
/**
* This method gets called when the entity kills another one.
*/
public void onKillEntity(EntityLivingBase entityLivingIn)
{
if (entityLivingIn instanceof IMob)
{
this.triggerAchievement(AchievementList.killEnemy);
}
EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entityLivingIn)));
if (entitylist$entityegginfo != null)
{
this.triggerAchievement(entitylist$entityegginfo.field_151512_d);
}
}
项目:CustomWorldGen
文件:StatList.java
public static void init()
{
initMiningStats();
initStats();
initItemDepleteStats();
initCraftableStats();
initPickedUpAndDroppedStats();
AchievementList.init();
EntityList.init();
}
项目:DecompiledMinecraft
文件:ItemMonsterPlacer.java
/**
* Spawns the creature specified by the egg's type in the location specified by the last three parameters.
* Parameters: world, entityID, x, y, z.
*/
public static Entity spawnCreature(World worldIn, int entityID, double x, double y, double z)
{
if (!EntityList.entityEggs.containsKey(Integer.valueOf(entityID)))
{
return null;
}
else
{
Entity entity = null;
for (int i = 0; i < 1; ++i)
{
entity = EntityList.createEntityByID(entityID, worldIn);
if (entity instanceof EntityLivingBase)
{
EntityLiving entityliving = (EntityLiving)entity;
entity.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(worldIn.rand.nextFloat() * 360.0F), 0.0F);
entityliving.rotationYawHead = entityliving.rotationYaw;
entityliving.renderYawOffset = entityliving.rotationYaw;
entityliving.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityliving)), (IEntityLivingData)null);
worldIn.spawnEntityInWorld(entity);
entityliving.playLivingSound();
}
}
return entity;
}
}
项目:CustomWorldGen
文件:ItemMonsterPlacer.java
/**
* Spawns the creature specified by the egg's type in the location specified by the last three parameters.
* Parameters: world, entityID, x, y, z.
*/
@Nullable
public static Entity spawnCreature(World worldIn, @Nullable String entityID, double x, double y, double z)
{
if (entityID != null && EntityList.ENTITY_EGGS.containsKey(entityID))
{
Entity entity = null;
for (int i = 0; i < 1; ++i)
{
entity = EntityList.createEntityByIDFromName(entityID, worldIn);
if (entity instanceof EntityLivingBase)
{
EntityLiving entityliving = (EntityLiving)entity;
entity.setLocationAndAngles(x, y, z, MathHelper.wrapDegrees(worldIn.rand.nextFloat() * 360.0F), 0.0F);
entityliving.rotationYawHead = entityliving.rotationYaw;
entityliving.renderYawOffset = entityliving.rotationYaw;
entityliving.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityliving)), (IEntityLivingData)null);
worldIn.spawnEntityInWorld(entity);
entityliving.playLivingSound();
}
}
return entity;
}
else
{
return null;
}
}
项目:CustomWorldGen
文件:EntityPlayer.java
/**
* This method gets called when the entity kills another one.
*/
public void onKillEntity(EntityLivingBase entityLivingIn)
{
if (entityLivingIn instanceof IMob)
{
this.addStat(AchievementList.KILL_ENEMY);
}
EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.ENTITY_EGGS.get(EntityList.getEntityString(entityLivingIn));
if (entitylist$entityegginfo != null)
{
this.addStat(entitylist$entityegginfo.killEntityStat);
}
}
项目:DecompiledMinecraft
文件:EntityPlayer.java
/**
* This method gets called when the entity kills another one.
*/
public void onKillEntity(EntityLivingBase entityLivingIn)
{
if (entityLivingIn instanceof IMob)
{
this.triggerAchievement(AchievementList.killEnemy);
}
EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entityLivingIn)));
if (entitylist$entityegginfo != null)
{
this.triggerAchievement(entitylist$entityegginfo.field_151512_d);
}
}
项目:Backmemed
文件:Template.java
private void addEntitiesToWorld(World worldIn, BlockPos pos, Mirror mirrorIn, Rotation rotationIn, @Nullable StructureBoundingBox aabb)
{
for (Template.EntityInfo template$entityinfo : this.entities)
{
BlockPos blockpos = transformedBlockPos(template$entityinfo.blockPos, mirrorIn, rotationIn).add(pos);
if (aabb == null || aabb.isVecInside(blockpos))
{
NBTTagCompound nbttagcompound = template$entityinfo.entityData;
Vec3d vec3d = transformedVec3d(template$entityinfo.pos, mirrorIn, rotationIn);
Vec3d vec3d1 = vec3d.addVector((double)pos.getX(), (double)pos.getY(), (double)pos.getZ());
NBTTagList nbttaglist = new NBTTagList();
nbttaglist.appendTag(new NBTTagDouble(vec3d1.xCoord));
nbttaglist.appendTag(new NBTTagDouble(vec3d1.yCoord));
nbttaglist.appendTag(new NBTTagDouble(vec3d1.zCoord));
nbttagcompound.setTag("Pos", nbttaglist);
nbttagcompound.setUniqueId("UUID", UUID.randomUUID());
Entity entity;
try
{
entity = EntityList.createEntityFromNBT(nbttagcompound, worldIn);
}
catch (Exception var15)
{
entity = null;
}
if (entity != null)
{
float f = entity.getMirroredYaw(mirrorIn);
f = f + (entity.rotationYaw - entity.getRotatedYaw(rotationIn));
entity.setLocationAndAngles(vec3d1.xCoord, vec3d1.yCoord, vec3d1.zCoord, f, entity.rotationPitch);
worldIn.spawnEntityInWorld(entity);
}
}
}
}
项目:DecompiledMinecraft
文件:ItemMonsterPlacer.java
/**
* Spawns the creature specified by the egg's type in the location specified by the last three parameters.
* Parameters: world, entityID, x, y, z.
*/
public static Entity spawnCreature(World worldIn, int entityID, double x, double y, double z)
{
if (!EntityList.entityEggs.containsKey(Integer.valueOf(entityID)))
{
return null;
}
else
{
Entity entity = null;
for (int i = 0; i < 1; ++i)
{
entity = EntityList.createEntityByID(entityID, worldIn);
if (entity instanceof EntityLivingBase)
{
EntityLiving entityliving = (EntityLiving)entity;
entity.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(worldIn.rand.nextFloat() * 360.0F), 0.0F);
entityliving.rotationYawHead = entityliving.rotationYaw;
entityliving.renderYawOffset = entityliving.rotationYaw;
entityliving.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityliving)), (IEntityLivingData)null);
worldIn.spawnEntityInWorld(entity);
entityliving.playLivingSound();
}
}
return entity;
}
}
项目:CustomWorldGen
文件:ItemMonsterPlacer.java
/**
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
*/
@SideOnly(Side.CLIENT)
public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems)
{
for (EntityList.EntityEggInfo entitylist$entityegginfo : EntityList.ENTITY_EGGS.values())
{
ItemStack itemstack = new ItemStack(itemIn, 1);
applyEntityIdToItemStack(itemstack, entitylist$entityegginfo.spawnedID);
subItems.add(itemstack);
}
}
项目:DecompiledMinecraft
文件:NetHandlerPlayClient.java
/**
* Spawns the mob entity at the specified location, with the specified rotation, momentum and type. Updates the
* entities Datawatchers with the entity metadata specified in the packet
*/
public void handleSpawnMob(S0FPacketSpawnMob packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
double d0 = (double)packetIn.getX() / 32.0D;
double d1 = (double)packetIn.getY() / 32.0D;
double d2 = (double)packetIn.getZ() / 32.0D;
float f = (float)(packetIn.getYaw() * 360) / 256.0F;
float f1 = (float)(packetIn.getPitch() * 360) / 256.0F;
EntityLivingBase entitylivingbase = (EntityLivingBase)EntityList.createEntityByID(packetIn.getEntityType(), this.gameController.theWorld);
entitylivingbase.serverPosX = packetIn.getX();
entitylivingbase.serverPosY = packetIn.getY();
entitylivingbase.serverPosZ = packetIn.getZ();
entitylivingbase.renderYawOffset = entitylivingbase.rotationYawHead = (float)(packetIn.getHeadPitch() * 360) / 256.0F;
Entity[] aentity = entitylivingbase.getParts();
if (aentity != null)
{
int i = packetIn.getEntityID() - entitylivingbase.getEntityId();
for (int j = 0; j < aentity.length; ++j)
{
aentity[j].setEntityId(aentity[j].getEntityId() + i);
}
}
entitylivingbase.setEntityId(packetIn.getEntityID());
entitylivingbase.setPositionAndRotation(d0, d1, d2, f, f1);
entitylivingbase.motionX = (double)((float)packetIn.getVelocityX() / 8000.0F);
entitylivingbase.motionY = (double)((float)packetIn.getVelocityY() / 8000.0F);
entitylivingbase.motionZ = (double)((float)packetIn.getVelocityZ() / 8000.0F);
this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entitylivingbase);
List<DataWatcher.WatchableObject> list = packetIn.func_149027_c();
if (list != null)
{
entitylivingbase.getDataWatcher().updateWatchedObjectsFromList(list);
}
}
项目:DecompiledMinecraft
文件:GuiStats.java
public StatsMobsList(Minecraft mcIn)
{
super(mcIn, GuiStats.this.width, GuiStats.this.height, 32, GuiStats.this.height - 64, GuiStats.this.fontRendererObj.FONT_HEIGHT * 4);
this.setShowSelectionBox(false);
for (EntityList.EntityEggInfo entitylist$entityegginfo : EntityList.entityEggs.values())
{
if (GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151512_d) > 0 || GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151513_e) > 0)
{
this.field_148222_l.add(entitylist$entityegginfo);
}
}
}
项目:DecompiledMinecraft
文件:StatList.java
public static void init()
{
initMiningStats();
initStats();
initItemDepleteStats();
initCraftableStats();
AchievementList.init();
EntityList.func_151514_a();
}
项目:Mods
文件:ItemStatue.java
public String getItemStackDisplayName(ItemStack stack)
{
if(!stack.hasTagCompound())
return super.getItemStackDisplayName(stack);
if(!stack.getTagCompound().getCompoundTag("Statue").getBoolean("Player"))
return I18n.translateToLocal("entity." + EntityList.getTranslationName
(new ResourceLocation(stack.getTagCompound().getCompoundTag("Statue").getCompoundTag("Entity").getString("id")))+".name")+" "+
I18n.translateToLocal(this.getUnlocalizedName() + ".name");
else
return I18n.translateToLocal(this.getUnlocalizedName() + ".player.name");
}
项目:BaseClient
文件:EntityPlayer.java
/**
* This method gets called when the entity kills another one.
*/
public void onKillEntity(EntityLivingBase entityLivingIn)
{
if (entityLivingIn instanceof IMob)
{
this.triggerAchievement(AchievementList.killEnemy);
}
EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entityLivingIn)));
if (entitylist$entityegginfo != null)
{
this.triggerAchievement(entitylist$entityegginfo.field_151512_d);
}
}
项目:BaseClient
文件:ItemMonsterPlacer.java
public String getItemStackDisplayName(ItemStack stack)
{
String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim();
String s1 = EntityList.getStringFromID(stack.getMetadata());
if (s1 != null)
{
s = s + " " + StatCollector.translateToLocal("entity." + s1 + ".name");
}
return s;
}