Package vazkii.botania.client.core.handler.LightningHandler.LightningBolt

Examples of vazkii.botania.client.core.handler.LightningHandler.LightningBolt.Segment


      particleAge = -(int) (length * speed);

      boundingBox = AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0);
      boundingBox.setBB(AxisAlignedBB.getBoundingBox(Math.min(start.x, end.x), Math.min(start.y, end.y), Math.min(start.z, end.z), Math.max(start.x, end.x), Math.max(start.y, end.y), Math.max(start.z, end.z)).expand(length / 2, length / 2, length / 2));

      segments.add(new Segment(start, end));
    }
View Full Code Here


        return;

      ArrayList<Segment> oldsegments = segments;
      segments = new ArrayList<Segment>();

      Segment prev = null;

      for(Segment segment : oldsegments) {
        prev = segment.prev;

        Vector3 subsegment = segment.diff.copy().multiply(1F / splits);

        BoltPoint[] newpoints = new BoltPoint[splits + 1];

        Vector3 startpoint = segment.startpoint.point;
        newpoints[0] = segment.startpoint;
        newpoints[splits] = segment.endpoint;

        for(int i = 1; i < splits; i++) {
          Vector3 randoff = segment.diff.copy().perpendicular().normalize().rotate(rand.nextFloat() * 360, segment.diff);
          randoff.multiply((rand.nextFloat() - 0.5F) * amount * 2);

          Vector3 basepoint = startpoint.copy().add(subsegment.copy().multiply(i));

          newpoints[i] = new BoltPoint(basepoint, randoff);
        }

        for(int i = 0; i < splits; i++) {
          Segment next = new Segment(newpoints[i], newpoints[i + 1], segment.light, segment.segmentno * splits + i, segment.splitno);
          next.prev = prev;
          if (prev != null)
            prev.next = next;

          if(i != 0 && rand.nextFloat() < splitchance) {
            Vector3 splitrot = next.diff.copy().xCrossProduct().rotate(rand.nextFloat() * 360, next.diff);
            Vector3 diff = next.diff.copy().rotate((rand.nextFloat() * 0.66F + 0.33F) * splitangle, splitrot).multiply(splitlength);

            numsplits++;
            splitparents.put(numsplits, next.splitno);

            Segment split = new Segment(newpoints[i], new BoltPoint(newpoints[i + 1].basepoint, newpoints[i + 1].offsetvec.copy().add(diff)), segment.light / 2F, next.segmentno, numsplits);
            split.prev = prev;

            segments.add(split);
          }

View Full Code Here

      lastactivesegment.put(lastsplitcalc, lastactiveseg);

      lastsplitcalc = 0;
      lastactiveseg = lastactivesegment.get(0);
      for(Iterator<Segment> iterator = segments.iterator(); iterator.hasNext();) {
        Segment segment = iterator.next();
        if(lastsplitcalc != segment.splitno) {
          lastsplitcalc = segment.splitno;
          lastactiveseg = lastactivesegment.get(segment.splitno);
        }

        if(segment.segmentno > lastactiveseg)
          iterator.remove();
        segment.calcEndDiffs();
      }
    }
View Full Code Here

TOP

Related Classes of vazkii.botania.client.core.handler.LightningHandler.LightningBolt.Segment

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.