Package net.minecraft.tileentity

Examples of net.minecraft.tileentity.MobSpawnerBaseLogic


              }
            }
          }

          TileEntityMobSpawner spawner = (TileEntityMobSpawner) tile;
          MobSpawnerBaseLogic logic = spawner.func_145881_a();
          if(logic != null) {
            String name = logic.getEntityNameToSpawn();
            if(name != null && !isBlackListed(name)) {
              ItemStack drop = ItemBrokenSpawner.createStackForMobType(name);
              dropQueue.add(new DropInfo(evt, drop));
            }
          }
View Full Code Here


  @Override
  public void updateEntity() {
    TileEntity tileBelow = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord);
    if(mana >= 5 && tileBelow instanceof TileEntityMobSpawner) {
      TileEntityMobSpawner spawner = (TileEntityMobSpawner) tileBelow;
      MobSpawnerBaseLogic logic = spawner.func_145881_a();

      if(!logic.isActivated()) {
        if(!worldObj.isRemote)
          mana -= 6;

        if(logic.getSpawnerWorld().isRemote) {
          if(logic.spawnDelay > 0)
            --logic.spawnDelay;

          if(Math.random() > 0.5)
            Botania.proxy.wispFX(worldObj, xCoord + 0.3 + Math.random() * 0.5, yCoord - 0.3 + Math.random() * 0.25, zCoord + Math.random(), 0.6F - (float) Math.random() * 0.3F, 0.1F, 0.6F - (float) Math.random() * 0.3F, (float) Math.random() / 3F, -0.025F - 0.005F * (float) Math.random(), 2F);

          logic.field_98284_d = logic.field_98287_c;
          logic.field_98287_c = (logic.field_98287_c + 1000.0F / (logic.spawnDelay + 200.0F)) % 360.0D;
        } else if(logic.spawnDelay == -1)
          resetTimer(logic);

        if(logic.spawnDelay > 0) {
          --logic.spawnDelay;
          return;
        }

        boolean flag = false;

        int spawnCount = ReflectionHelper.getPrivateValue(MobSpawnerBaseLogic.class, logic, LibObfuscation.SPAWN_COUNT);
        int spawnRange = ReflectionHelper.getPrivateValue(MobSpawnerBaseLogic.class, logic, LibObfuscation.SPAWN_RANGE);
        int maxNearbyEntities = ReflectionHelper.getPrivateValue(MobSpawnerBaseLogic.class, logic, LibObfuscation.MAX_NEARBY_ENTITIES);

        for(int i = 0; i < spawnCount; ++i) {
          Entity entity = EntityList.createEntityByName(logic.getEntityNameToSpawn(), logic.getSpawnerWorld());

          if (entity == null)
            return;

          int j = logic.getSpawnerWorld().getEntitiesWithinAABB(entity.getClass(), AxisAlignedBB.getBoundingBox(logic.getSpawnerX(), logic.getSpawnerY(), logic.getSpawnerZ(), logic.getSpawnerX() + 1, logic.getSpawnerY() + 1, logic.getSpawnerZ() + 1).expand(spawnRange * 2, 4.0D, spawnRange * 2)).size();

          if (j >= maxNearbyEntities) {
            resetTimer(logic);
            return;
          }

          double d2 = logic.getSpawnerX() + (logic.getSpawnerWorld().rand.nextDouble() - logic.getSpawnerWorld().rand.nextDouble()) * spawnRange;
          double d3 = logic.getSpawnerY() + logic.getSpawnerWorld().rand.nextInt(3) - 1;
          double d4 = logic.getSpawnerZ() + (logic.getSpawnerWorld().rand.nextDouble() - logic.getSpawnerWorld().rand.nextDouble()) * spawnRange;
          EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving)entity : null;
          entity.setLocationAndAngles(d2, d3, d4, logic.getSpawnerWorld().rand.nextFloat() * 360.0F, 0.0F);

          if(entityliving == null || entityliving.getCanSpawnHere()) {
            logic.func_98265_a(entity);
            logic.getSpawnerWorld().playAuxSFX(2004, logic.getSpawnerX(), logic.getSpawnerY(), logic.getSpawnerZ(), 0);

            if (entityliving != null)
              entityliving.spawnExplosionParticle();

            flag = true;
View Full Code Here

        return 10;
    }

    @Override
    public void addInformation(World world, int x, int y, int z, List<String> infoList){
        MobSpawnerBaseLogic spawner = ((TileEntityMobSpawner)world.getTileEntity(x, y, z)).func_145881_a();
        infoList.add("Spawner Type: " + StatCollector.translateToLocal("entity." + spawner.getEntityNameToSpawn() + ".name"));
        if(spawner.isActivated()) {
            infoList.add("Time until next spawn: " + PneumaticCraftUtils.convertTicksToMinutesAndSeconds(spawner.spawnDelay, false));
        } else if(HackableMobSpawner.isHacked(world, x, y, z)) {
            infoList.add("Spawner is hacked");
        } else {
            infoList.add("Spawner is standing by");
View Full Code Here

    }

    @Override
    public boolean afterHackTick(World world, int x, int y, int z){
        MobSpawnerBaseLogic spawner = ((TileEntityMobSpawner)world.getTileEntity(x, y, z)).func_145881_a();
        spawner.field_98284_d = spawner.field_98287_c;//oldRotation = rotation, to stop render glitching
        spawner.spawnDelay = 10;
        return false;
    }
View Full Code Here

TOP

Related Classes of net.minecraft.tileentity.MobSpawnerBaseLogic

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.