Examples of Entity


Examples of main.ch.morrolan.gibb.snake.Entity

    // Todo: A before hook would cut down on the boilerplate. (Initializing entity = new Entity(0, 0))
    // Todo: If JUnit provides an "expect bla to change x by z" we could write the move... tests a tad cleaner.

    @Test
    public void Entity() {
        Entity entity;

        entity = new Entity();
        assertEquals(new Point(0, 0), entity.position);
        assertEquals(true, entity.alive);

        entity = new Entity(7, 11);
        assertEquals(new Point(7, 11), entity.position);
        assertEquals(true, entity.alive);

        entity = new Entity(new Point(11, 2));
        assertEquals(new Point(11, 2), entity.position);
        assertEquals(true, entity.alive);
    }
View Full Code Here

Examples of megamek.common.Entity

        }

        Vector<MechSummary> vMatches = new Vector<MechSummary>();
        for (MechSummary ms : m_mechsCurrent) {
            try {
                Entity entity = new MechFileParser(ms.getSourceFile(), ms
                        .getEntryName()).getEntity();
                if (isMatch(entity)) {
                    vMatches.addElement(ms);
                }
            } catch (EntityLoadingException ex) {
View Full Code Here

Examples of mf.org.w3c.dom.Entity

            /** Copy entities. */
            NamedNodeMap oldMap = node.getEntities();
            NamedNodeMap newMap = docType.getEntities();
            int length = oldMap.getLength();
            for (int i = 0; i < length; ++i) {
                Entity oldEntity = (Entity) oldMap.item(i);
                EntityImpl newEntity = (EntityImpl) fDocumentImpl.createEntity(oldEntity.getNodeName());
                newEntity.setPublicId(oldEntity.getPublicId());
                newEntity.setSystemId(oldEntity.getSystemId());
                newEntity.setNotationName(oldEntity.getNotationName());
                newMap.setNamedItem(newEntity);
            }
            /** Copy notations. */
            oldMap = node.getNotations();
            newMap = docType.getNotations();
View Full Code Here

Examples of net.canarymod.api.entity.Entity

            Block b = tracer.getTargetBlock();
            // Spawn a mob with Rider
            if (b != null) {
                b.setY(b.getY() + 1);
                try {
                    Entity mob = Canary.factory().getEntityFactory().newEntity(EntityType.valueOf(args[1].toUpperCase()), b.getLocation());
                    if (mob.spawn()) {
                        player.message(Colors.YELLOW + Translator.translateAndFormat("mobspawn spawned", args[1]));
                    }
                    else {
                        player.notice("mobspawn failed");
                    }
                }
                catch (IllegalArgumentException e) {
                    player.notice("mobspawn failed");
                }
            }
            else {
                player.notice("mobspawn failed");
            }
        }

        if (args.length == 3) {
            if (args[2].matches("^[0-9]+$")) {
                // Spawn X amount of entities
                int amount = Integer.parseInt(args[2]);
                LineTracer tracer = new LineTracer(player);
                Block b = tracer.getTargetBlock();
                if (b == null) {
                    player.notice(Translator.translate("mobspawn failed"));
                    return;
                }
                b.setY(b.getY() + 1);
                boolean spawnSuccess = true;
                for (int i = 0; i < amount; ++i) {
                    try {
                        Entity e = Canary.factory().getEntityFactory().newEntity(EntityType.valueOf(args[1].toUpperCase()), b.getLocation());
                        spawnSuccess &= e.spawn();
                    }
                    catch (IllegalArgumentException e) {
                        player.notice(Translator.translate("mobspawn failed"));
                    }
                }
                if (spawnSuccess) {
                    player.message(Colors.YELLOW + Translator.translateAndFormat("mobspawn spawned", args[1]));
                }
                else {
                    player.notice(Translator.translate("mobspawn failed"));
                }
            }
            else {
                LineTracer tracer = new LineTracer(player);
                Block b = tracer.getTargetBlock();
                if (b == null) {
                    player.notice(Translator.translate("mobspawn failed"));
                    return;
                }
                b.setY(b.getY() + 1);
                // Spawn a mob with Rider
                try {
                    Entity mob = Canary.factory().getEntityFactory().newEntity(EntityType.valueOf(args[1].toUpperCase()), b.getLocation());
                    Entity rider = Canary.factory().getEntityFactory().newEntity(EntityType.valueOf(args[2].toUpperCase()));
                    mob.spawn(rider);
                    player.message(Colors.YELLOW + Translator.translateAndFormat("mobspawn spawned rider", args[1], args[2]));
                }
                catch (IllegalArgumentException e) {
                    player.notice(Translator.translate("mobspawn failed"));
                }
            }
        }
        if (args.length == 4) {
            if (!args[3].matches("^[0-9]+$")) {
                player.notice(Translator.translate("mobspawn failed"));
                Canary.help().getHelp(player, "mobspawn");
                return;
            }
            // Spawn X amount of entities
            int amount = Integer.parseInt(args[3]);
            LineTracer tracer = new LineTracer(player);
            Block b = tracer.getTargetBlock();
            if (b == null) {
                player.notice(Translator.translate("mobspawn failed"));
                return;
            }
            b.setY(b.getY() + 1);
            boolean spawnSuccess = true;
            // Spawn a mob with Rider
            for (int i = 0; i < amount; ++i) {
                try {
                    Entity mob = Canary.factory().getEntityFactory().newEntity(EntityType.valueOf(args[1].toUpperCase()), b.getLocation());
                    Entity rider = Canary.factory().getEntityFactory().newEntity(EntityType.valueOf(args[2].toUpperCase()));
                    spawnSuccess &= mob.spawn(rider);
                }
                catch (IllegalArgumentException e) {
                    player.notice(Translator.translate("mobspawn failed"));
                }
View Full Code Here

Examples of net.floodlightcontroller.devicemanager.internal.Entity

        if (vlan != null && vlan.shortValue() <= 0)
            vlan = null;
        if (ipv4Address != null && ipv4Address == 0)
            ipv4Address = null;
        IDevice res =  learnDeviceByEntity(new Entity(macAddress, vlan,
                                                      ipv4Address, switchDPID,
                                                      switchPort, new Date()));
        // Restore listeners
        if (listeners != null) {
            for (IDeviceListener listener : listeners) {
View Full Code Here

Examples of net.mdked.Jrachgame.world.Entity

          imin = j;
        }
      }

      if (i != imin) {
        Entity temp = World.objecz.get(i);
        World.objecz.set(i, World.objecz.get(imin));
        World.objecz.set(imin, temp);
      }
    }
    //jivotnii
View Full Code Here

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

Examples of net.minecraft.server.Entity

        boolean cancel = false;

        final long time = System.currentTimeMillis();

        // Get the damagee (entity that got hit)
        Entity entity = data.damagee;

        // Safeguard, if entity is complex, this check will fail
        // due to giant and hard to define hitboxes
        if(entity instanceof EntityComplex || entity instanceof EntityComplexPart) {
            return false;
View Full Code Here

Examples of net.minecraft.server.v1_6_R3.Entity

    } else if (method.getName().equals("b") && Arrays.deepEquals(method.getParameterTypes(), new Class[] {World.class, int.class, int.class, int.class, Entity.class})) {
      World world = (World) args[0];
      int x = (Integer) args[1];
      int y = (Integer) args[2];
      int z = (Integer) args[3];
      Entity e = (Entity) args[4];
      org.getspout.spoutapi.material.CustomBlock block = getCustomBlock(world, x, y, z);
      if (block != null) {
        block.onEntityMoveAt(world.getWorld(), x, y, z, e.getBukkitEntity());
        return null;
      }
    } else if (method.getName().equals("interact")) {
      World world = (World) args[0];
      int x = (Integer) args[1];
      int y = (Integer) args[2];
      int z = (Integer) args[3];
      Entity human = (Entity) args[4];
      org.getspout.spoutapi.material.CustomBlock block = getCustomBlock(world, x, y, z);
      if (block != null && human instanceof EntityPlayer) {
        return block.onBlockInteract(world.getWorld(), x, y, z, ((SpoutPlayer) human.getBukkitEntity()));
      }
    } else if (method.getName().equals("getDamage")) {
      EntityHuman human = (EntityHuman) args[0];
      World world = (World) args[1];
      int x = (Integer) args[2];
      int y = (Integer) args[3];
      int z = (Integer) args[4];
      org.getspout.spoutapi.material.CustomBlock block = getCustomBlock(world, x, y, z);
      if (block != null) {
        if (block instanceof org.getspout.spoutapi.material.CustomBlock) {
          SpoutPlayer player = (SpoutPlayer) human.getBukkitEntity();
          float def;
          SpoutItemStack inHand = player.getItemInHand() == null ? null : new SpoutItemStack(player.getItemInHand());
          org.getspout.spoutapi.material.Material item = inHand.getMaterial();

          float hardness = block.getHardness();
          if (hardness <= 0F) {
            return m.invoke(wrapped, args);
          }

          def = (!human.a(wrapped) ? 1.0F / hardness / 100.0F : human.a(wrapped, false) / hardness / 30.0F); //TODO EntityHuman.a(Block, boolean) appears to not make any use of the flag variable...

          if (!(item instanceof CustomItem)) {
            return def;
          }
View Full Code Here

Examples of net.minecraft.src.Entity

      List<?> nearbyEntities = world.getEntitiesWithinAABBExcludingEntity(
               player.getMinecraftPlayer(), boundingBox
      );
      int removedDrops = 0;
      for(int entityIndex = 0; entityIndex < nearbyEntities.size(); entityIndex++) {
         Entity entity = (Entity)nearbyEntities.get(entityIndex);
         if(entity instanceof EntityItem) {
            EntityItem entityItem = (EntityItem)entity;
            if(entityItem.age >= 0) {
               player.getWorld().getMinecraftWorld().removeEntity(entityItem);
               removedDrops++;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.