Package net.minecraft.entity

Examples of net.minecraft.entity.Entity


      requirements.add(s);
    }
  }

  public void writeToWorld(IBuilderContext context) {
    Entity e = EntityList.createEntityFromNBT(cpt, context.world());
    context.world().spawnEntityInWorld(e);
  }
View Full Code Here


    NBTTagList nbttaglist = cpt.getTagList("Pos", 6);
    Position newPosition = new Position(nbttaglist.func_150309_d(0),
        nbttaglist.func_150309_d(1), nbttaglist.func_150309_d(2));

    for (Object o : context.world().loadedEntityList) {
      Entity e = (Entity) o;

      Position existingPositon = new Position(e.posX, e.posY, e.posZ);

      if (existingPositon.isClose(newPosition, 0.1F)) {
        return true;
View Full Code Here

  @Override
  public void renderItem(ItemRenderType itemRenderType, ItemStack itemStack, Object... objects) {
    ItemMobDisplay item = (ItemMobDisplay) itemStack.getItem();
    EnumMobAspect aspect = item.getEntityType(itemStack);
    Entity entity = null;
    float f1 = 0.4f;
    float verticalOffset = 0.0f;
    if (aspect != null) {
      entity = EnumMobAspect.getEntityFromCache(aspect, null);
      f1 = aspect.getScale();
      verticalOffset = aspect.getVerticalOffset();
    }
    switch (itemRenderType) {

      case ENTITY:

        GL11.glPushMatrix();
        GL11.glTranslated(0.5, 0.2 + verticalOffset, 0.5);
        GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
        GL11.glTranslatef(0.0F, -0.4F, 0.0F);
        GL11.glScalef(f1, f1, f1);
        EntityItem eItem = (EntityItem) objects[1];
        if (entity != null) {
          entity.worldObj = (Minecraft.getMinecraft() != null) ? Minecraft.getMinecraft().theWorld : null;
          if (entity.worldObj != null) {
            Render renderer = RenderManager.instance.getEntityRenderObject(entity);
            entity.setWorld(eItem.worldObj);
            entity.copyLocationAndAnglesFrom(eItem);
            if (renderer != null && renderer.getFontRendererFromRenderManager() != null) {
              GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
              //if (renderWithLighting) RenderUtils.enableLightmap();
              renderer.doRender(entity, 0, 0, 0, 0, 0);
              GL11.glPopAttrib();
View Full Code Here

        player.attackEntityFrom(DamageSource.magic, 3);
      }
    }

    if (handle) {
      Entity source = event.source.getSourceOfDamage();
      if (source != null && source instanceof EntityLivingBase) {
        EntityLivingBase attacker = (EntityLivingBase) source;
        ItemStack itemInUse = attacker.getHeldItem();
        if (itemInUse != null && itemInUse.getItem() == this)
          attacker.attackEntityFrom(DamageSource.magic, 2);
View Full Code Here

    @SubscribeEvent
    public void onTick(TickEvent.ServerTickEvent e) {

        Iterator iter = airPotionHit.keySet().iterator();
        while (iter.hasNext()) {
            Entity target = (Entity) iter.next();
            if (target.isEntityAlive()) {
                if (target.worldObj.getTotalWorldTime() % 5 == 0) {
                    Random rand = new Random();
                    target.setVelocity(rand.nextFloat() - .5, rand.nextFloat(), rand.nextFloat() - .5);
                    ThaumicTinkerer.tcProxy.burst(target.worldObj, target.posX, target.posY, target.posZ, .5F);
                }
            }
            if (target.worldObj.getTotalWorldTime() > airPotionHit.get(target) + 20) {
                iter.remove();
            }
        }

        //Fire Potion
        iter = firePotionHit.keySet().iterator();
        while (iter.hasNext()) {
            Entity target = (Entity) iter.next();
            if (target.isEntityAlive()) {
                if (target.worldObj.getTotalWorldTime() % 5 == 0) {
                    Random rand = new Random();
                    target.setFire(6);

                    for (int i = 0; i < 30; i++) {
                        double theta = rand.nextFloat() * 2 * Math.PI;

                        double phi = rand.nextFloat() * 2 * Math.PI;
 
View Full Code Here

  }

  public static class ThaumcraftFrostShardOwnerGetter implements Function<Entity, Entity> {
    @Override
    public Entity apply(Entity e) {
      Entity owner = ((EntityFrostShard) e).shootingEntity;
      return owner != null ? owner : e.worldObj.getEntityByID(((EntityFrostShard) e).shootingEntityId);
    }
View Full Code Here

    //System.out.println(cmp.getCompoundTag("TCResearch").getTagList("TCResearchList").tagCount());

    boolean done = false;

    if (leftClick) {
      Entity entity = detectedEntities.isEmpty() ? null : detectedEntities.get(worldObj.rand.nextInt(detectedEntities.size()));
      if (entity != null) {
        player.getAttributeMap().applyAttributeModifiers(stack.getAttributeModifiers()); // Set attack strenght
        player.attackTargetEntityWithCurrentItem(entity);
        done = true;
      } else if (!isBreaking) {
        if (block != Blocks.air && !block.isAir(worldObj, coords.posX, coords.posY, coords.posZ) && block.getBlockHardness(worldObj, coords.posX, coords.posY, coords.posZ) >= 0) {
          isBreaking = true;
          startBreaking(block, worldObj.getBlockMetadata(coords.posX, coords.posY, coords.posZ));
          done = true;
        }
      }
    } else {
      int side = SIDES[(getBlockMetadata() & 7) - 2].getOpposite().ordinal();

      if (!(block != Blocks.air && !block.isAir(worldObj, coords.posX, coords.posY, coords.posZ))) {
        coords.posY -= 1;
        side = ForgeDirection.UP.ordinal();
        block = worldObj.getBlock(coords.posX, coords.posY, coords.posZ);
      }

      try {
        ForgeEventFactory.onPlayerInteract(player, Action.RIGHT_CLICK_AIR, coords.posX, coords.posY, coords.posZ, side,worldObj);
        Entity entity = detectedEntities.isEmpty() ? null : detectedEntities.get(worldObj.rand.nextInt(detectedEntities.size()));
        done = entity != null && entity instanceof EntityLiving && (item.itemInteractionForEntity(stack, player, (EntityLivingBase) entity) || (!(entity instanceof EntityAnimal) || ((EntityAnimal) entity).interact(player)));

        if (!done)
          item.onItemUseFirst(stack, player, worldObj, coords.posX, coords.posY, coords.posZ, side, 0F, 0F, 0F);
        if (!done)
View Full Code Here

                                        if (!isInfused || ItemMobAspect.lastUsedTabletMatches(ped1.getStackInSlot(0), this)
                                                && ItemMobAspect.lastUsedTabletMatches(ped2.getStackInSlot(0), this)
                                                && ItemMobAspect.lastUsedTabletMatches(ped3.getStackInSlot(0), this)) {

                                            if (!worldObj.isRemote) {
                                                Entity spawn = EntityList.createEntityByName(recipe.toString(), worldObj);
                                                spawn.setLocationAndAngles(xCoord + .5, yCoord + 1, zCoord + .5, 0, 0);
                                                if (spawn instanceof EntitySkeleton && worldObj.provider.isHellWorld) {
                                                    ((EntitySkeleton) spawn).setSkeletonType(1);
                                                }
                                                worldObj.spawnEntityInWorld(spawn);
                                                ((EntityLiving) spawn).onSpawnWithEgg(null);
View Full Code Here

      e.worldObj.removeEntity(e);
      e.isDead = false;
      e.worldObj.theProfiler.startSection("reposition");
      minecraftserver.getConfigurationManager().transferEntityToWorld(e, j, worldserver, worldserver1, new TeleporterBedrock(worldserver));
      e.worldObj.theProfiler.endStartSection("reloading");
      Entity entity = EntityList.createEntityByName(EntityList.getEntityString(e), worldserver1);

      if (entity != null) {
        entity.copyDataFrom(e, true);

        if (j == 1 && par1 == 1) {
          ChunkCoordinates chunkcoordinates = worldserver1.getSpawnPoint();
          chunkcoordinates.posY = e.worldObj.getTopSolidOrLiquidBlock(chunkcoordinates.posX, chunkcoordinates.posZ);
          entity.setLocationAndAngles((double) chunkcoordinates.posX, (double) chunkcoordinates.posY, (double) chunkcoordinates.posZ, entity.rotationYaw, entity.rotationPitch);
        }

        worldserver1.spawnEntityInWorld(entity);
      }
View Full Code Here

    if(!containsSoul(itemstack)) {
      return true;
    }
   
    NBTTagCompound root = itemstack.stackTagCompound;   
    Entity mob = EntityList.createEntityFromNBT(root, world);
    if (mob == null) {
      return true;     
    }
    mob.readFromNBT(root);
   
    Block blk = world.getBlock(x,y,z);   
    double spawnX = x + Facing.offsetsXForSide[side] + 0.5;
    double spawnY = y + Facing.offsetsYForSide[side];
    double spawnZ = z + Facing.offsetsZForSide[side] + 0.5;
    if(side == ForgeDirection.UP.ordinal() && (blk instanceof BlockFence || blk instanceof BlockWall)) {
      spawnY += 0.5;
    }   
    mob.setLocationAndAngles(spawnX, spawnY, spawnZ, world.rand.nextFloat() * 360.0F, 0)

    boolean spaceClear = world.checkNoEntityCollision(mob.boundingBox)
        && world.getCollidingBoundingBoxes(mob, mob.boundingBox).isEmpty();
    if(!spaceClear) {
      return false;
    }
  
//    if(mob instanceof EntityHorse) {
//      ((EntityHorse)mob).setHorseType(3);
//    }
   
    world.spawnEntityInWorld(mob);   
    if(mob instanceof EntityLiving) {
      ((EntityLiving)mob).playLivingSound();
   
   
    Entity riddenByEntity = mob.riddenByEntity;
    while(riddenByEntity != null) {     
      riddenByEntity.setLocationAndAngles(spawnX, spawnY, spawnZ, world.rand.nextFloat() * 360.0F, 0.0F);     
      world.spawnEntityInWorld(riddenByEntity);
      if(riddenByEntity instanceof EntityLiving) {
        ((EntityLiving)riddenByEntity).playLivingSound();
      }     
      riddenByEntity = riddenByEntity.riddenByEntity;
View Full Code Here

TOP

Related Classes of net.minecraft.entity.Entity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.