addAll() public method

public addAll ( int arg0, java arg1 ) : bool
arg0 int
arg1 java
return bool
コード例 #1
0
ファイル: Explosion.cs プロジェクト: riverar/Crafty
        public void doEffects()
        {
            worldObj.playSoundEffect(explosionX, explosionY, explosionZ, "random.explode", 4F,
                                     (1.0F + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat())*0.2F)*0.7F);
            var arraylist = new ArrayList();
            arraylist.addAll(destroyedBlockPositions);
            for (int i = arraylist.size() - 1; i >= 0; i--)
            {
                var chunkposition = (ChunkPosition) arraylist.get(i);
                int j = chunkposition.x;
                int k = chunkposition.y;
                int l = chunkposition.z;
                int i1 = worldObj.getBlockId(j, k, l);
                for (int j1 = 0; j1 < 1; j1++)
                {
                    double d = j + worldObj.rand.nextFloat();
                    double d1 = k + worldObj.rand.nextFloat();
                    double d2 = l + worldObj.rand.nextFloat();
                    double d3 = d - explosionX;
                    double d4 = d1 - explosionY;
                    double d5 = d2 - explosionZ;
                    double d6 = MathHelper.sqrt_double(d3*d3 + d4*d4 + d5*d5);
                    d3 /= d6;
                    d4 /= d6;
                    d5 /= d6;
                    double d7 = 0.5D/(d6/explosionSize + 0.10000000000000001D);
                    d7 *= worldObj.rand.nextFloat()*worldObj.rand.nextFloat() + 0.3F;
                    d3 *= d7;
                    d4 *= d7;
                    d5 *= d7;
                    worldObj.spawnParticle("explode", (d + explosionX*1.0D)/2D, (d1 + explosionY*1.0D)/2D,
                                           (d2 + explosionZ*1.0D)/2D, d3, d4, d5);
                    worldObj.spawnParticle("smoke", d, d1, d2, d3, d4, d5);
                }

                if (i1 > 0)
                {
                    Block.blocksList[i1].dropBlockAsItemWithChance(worldObj, j, k, l, worldObj.getBlockMetadata(j, k, l),
                                                                   0.3F);
                    worldObj.setBlockWithNotify(j, k, l, 0);
                    Block.blocksList[i1].onBlockDestroyedByExplosion(worldObj, j, k, l);
                }
            }
        }
コード例 #2
0
ファイル: IOUtils.cs プロジェクト: NALSS/SmartDashboard.NET
 public virtual string createRelativeURL(URL url, URL baseURL)
 {
   if (url == null)
   {
     string str = "content url must not be null.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new NullPointerException(str);
   }
   else if (baseURL == null)
   {
     string str = "baseURL must not be null.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new NullPointerException(str);
   }
   else if (this.isFileStyleProtocol(url) && this.isSameService(url, baseURL))
   {
     List list1 = this.parseName(this.getPath(url));
     List list2 = this.parseName(this.getPath(baseURL));
     string query = this.getQuery(url);
     if (!this.isPath(baseURL))
       list2.remove(list2.size() - 1);
     if (url.equals((object) baseURL))
       return (string) list1.get(list1.size() - 1);
     int num1 = this.startsWithUntil(list1, list2);
     if (num1 == 0)
     {
       return url.toExternalForm();
     }
     else
     {
       if (num1 == list1.size())
         num1 += -1;
       ArrayList arrayList = new ArrayList();
       if (list2.size() >= list1.size())
       {
         int num2 = list2.size() - num1;
         for (int index = 0; index < num2; ++index)
           arrayList.add((object) "..");
       }
       arrayList.addAll((Collection) list1.subList(num1, list1.size()));
       return this.formatName((List) arrayList, query);
     }
   }
   else
     return url.toExternalForm();
 }
コード例 #3
0
 public void testNonMatchesWithValidLeniency()
 {
     List<NumberTest> testCases = new ArrayList<NumberTest>();
     testCases.addAll(Arrays.asList(IMPOSSIBLE_CASES));
     testCases.addAll(Arrays.asList(POSSIBLE_ONLY_CASES));
     doTestNumberNonMatchesForLeniency(testCases, Leniency.VALID);
 }
コード例 #4
0
 public void testNonMatchesWithStrictGroupLeniency()
 {
     List<NumberTest> testCases = new ArrayList<NumberTest>();
     testCases.addAll(Arrays.asList(IMPOSSIBLE_CASES));
     testCases.addAll(Arrays.asList(POSSIBLE_ONLY_CASES));
     testCases.addAll(Arrays.asList(VALID_CASES));
     doTestNumberNonMatchesForLeniency(testCases, Leniency.STRICT_GROUPING);
 }
コード例 #5
0
 public void testNonMatchesWithPossibleLeniency()
 {
     List<NumberTest> testCases = new ArrayList<NumberTest>();
     testCases.addAll(Arrays.asList(IMPOSSIBLE_CASES));
     doTestNumberNonMatchesForLeniency(testCases, Leniency.POSSIBLE);
 }
コード例 #6
0
 public void testMatchesWithValidLeniency()
 {
     List<NumberTest> testCases = new ArrayList<NumberTest>();
     testCases.addAll(Arrays.asList(STRICT_GROUPING_CASES));
     testCases.addAll(Arrays.asList(EXACT_GROUPING_CASES));
     testCases.addAll(Arrays.asList(VALID_CASES));
     doTestNumberMatchesForLeniency(testCases, Leniency.VALID);
 }
コード例 #7
0
 public void testMatchesWithStrictGroupingLeniency()
 {
     List<NumberTest> testCases = new ArrayList<NumberTest>();
     testCases.addAll(Arrays.asList(STRICT_GROUPING_CASES));
     testCases.addAll(Arrays.asList(EXACT_GROUPING_CASES));
     doTestNumberMatchesForLeniency(testCases, Leniency.STRICT_GROUPING);
 }
コード例 #8
0
 public void testMatchesWithPossibleLeniency()
 {
     List<NumberTest> testCases = new ArrayList<NumberTest>();
     testCases.addAll(Arrays.asList(STRICT_GROUPING_CASES));
     testCases.addAll(Arrays.asList(EXACT_GROUPING_CASES));
     testCases.addAll(Arrays.asList(VALID_CASES));
     testCases.addAll(Arrays.asList(POSSIBLE_ONLY_CASES));
     doTestNumberMatchesForLeniency(testCases, Leniency.POSSIBLE);
 }
コード例 #9
0
ファイル: Explosion.cs プロジェクト: riverar/Crafty
        public void doExplosion()
        {
            float f = explosionSize;
            int i = 16;
            for (int j = 0; j < i; j++)
            {
                for (int l = 0; l < i; l++)
                {
                    for (int j1 = 0; j1 < i; j1++)
                    {
                        if (j != 0 && j != i - 1 && l != 0 && l != i - 1 && j1 != 0 && j1 != i - 1)
                        {
                            continue;
                        }
                        double d = (j/(i - 1.0F))*2.0F - 1.0F;
                        double d1 = (l/(i - 1.0F))*2.0F - 1.0F;
                        double d2 = (j1/(i - 1.0F))*2.0F - 1.0F;
                        double d3 = Math.sqrt(d*d + d1*d1 + d2*d2);
                        d /= d3;
                        d1 /= d3;
                        d2 /= d3;
                        float f1 = explosionSize*(0.7F + worldObj.rand.nextFloat()*0.6F);
                        double d5 = explosionX;
                        double d7 = explosionY;
                        double d9 = explosionZ;
                        float f2 = 0.3F;
                        do
                        {
                            if (f1 <= 0.0F)
                            {
                                goto label0;
                            }
                            int j4 = MathHelper.floor_double(d5);
                            int k4 = MathHelper.floor_double(d7);
                            int l4 = MathHelper.floor_double(d9);
                            int i5 = worldObj.getBlockId(j4, k4, l4);
                            if (i5 > 0)
                            {
                                f1 -= (Block.blocksList[i5].getExplosionResistance(exploder) + 0.3F)*f2;
                            }
                            if (f1 > 0.0F)
                            {
                                destroyedBlockPositions.add(new ChunkPosition(j4, k4, l4));
                            }
                            d5 += d*f2;
                            d7 += d1*f2;
                            d9 += d2*f2;
                            f1 -= f2*0.75F;
                        } while (true);

                        label0:
                        ;
                    }
                }
            }

            explosionSize *= 2.0F;
            int k = MathHelper.floor_double(explosionX - explosionSize - 1.0D);
            int i1 = MathHelper.floor_double(explosionX + explosionSize + 1.0D);
            int k1 = MathHelper.floor_double(explosionY - explosionSize - 1.0D);
            int l1 = MathHelper.floor_double(explosionY + explosionSize + 1.0D);
            int i2 = MathHelper.floor_double(explosionZ - explosionSize - 1.0D);
            int j2 = MathHelper.floor_double(explosionZ + explosionSize + 1.0D);
            List list = worldObj.getEntitiesWithinAABBExcludingEntity(exploder,
                                                                      AxisAlignedBB.getBoundingBoxFromPool(k, k1, i2, i1,
                                                                                                           l1, j2));
            Vec3D vec3d = Vec3D.createVector(explosionX, explosionY, explosionZ);
            for (int k2 = 0; k2 < list.size(); k2++)
            {
                var entity = (Entity) list.get(k2);
                double d4 = entity.getDistance(explosionX, explosionY, explosionZ)/explosionSize;
                if (d4 <= 1.0D)
                {
                    double d6 = entity.posX - explosionX;
                    double d8 = entity.posY - explosionY;
                    double d10 = entity.posZ - explosionZ;
                    double d11 = MathHelper.sqrt_double(d6*d6 + d8*d8 + d10*d10);
                    d6 /= d11;
                    d8 /= d11;
                    d10 /= d11;
                    double d12 = worldObj.func_494_a(vec3d, entity.boundingBox);
                    double d13 = (1.0D - d4)*d12;
                    entity.attackEntityFrom(exploder, (int) (((d13*d13 + d13)/2D)*8D*explosionSize + 1.0D));
                    double d14 = d13;
                    entity.motionX += d6*d14;
                    entity.motionY += d8*d14;
                    entity.motionZ += d10*d14;
                }
            }

            explosionSize = f;
            var arraylist = new ArrayList();
            arraylist.addAll(destroyedBlockPositions);
            if (isFlaming)
            {
                for (int l2 = arraylist.size() - 1; l2 >= 0; l2--)
                {
                    var chunkposition = (ChunkPosition) arraylist.get(l2);
                    int i3 = chunkposition.x;
                    int j3 = chunkposition.y;
                    int k3 = chunkposition.z;
                    int l3 = worldObj.getBlockId(i3, j3, k3);
                    int i4 = worldObj.getBlockId(i3, j3 - 1, k3);
                    if (l3 == 0 && Block.opaqueCubeLookup[i4] && ExplosionRNG.nextInt(3) == 0)
                    {
                        worldObj.setBlockWithNotify(i3, j3, k3, Block.fire.blockID);
                    }
                }
            }
        }
コード例 #10
0
ファイル: Log.cs プロジェクト: NALSS/SmartDashboard.NET
 public virtual void removeTarget(LogTarget target)
 {
   if (target == null)
   {
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new NullPointerException();
   }
   else
   {
     ArrayList arrayList = new ArrayList();
     arrayList.addAll((Collection) Arrays.asList((object[]) this.logTargets));
     arrayList.remove((object) target);
     LogTarget[] logTargetArray = new LogTarget[arrayList.size()];
     this.logTargets = (LogTarget[]) arrayList.toArray((object[]) logTargetArray);
   }
 }