Example #1
0
 public override void onEntityWalking(World world, int i, int j, int k, Entity entity)
 {
     if (world.rand.nextInt(4) == 0)
     {
         world.setBlockWithNotify(i, j, k, dirt.blockID);
     }
 }
Example #2
0
 public override bool generate(World world, Random random, int i, int j, int k)
 {
     worldObj = world;
     long l = random.nextLong();
     field_759_b.setSeed(l);
     basePos[0] = i;
     basePos[1] = j;
     basePos[2] = k;
     if (field_756_e == 0)
     {
         field_756_e = 5 + field_759_b.nextInt(field_748_m);
     }
     if (!func_422_e())
     {
         return false;
     }
     else
     {
         func_424_a();
         func_421_b();
         func_432_c();
         func_428_d();
         return true;
     }
 }
Example #3
0
 public override MovingObjectPosition collisionRayTrace(World world, int i, int j, int k, Vec3D vec3d,
     Vec3D vec3d1)
 {
     int l = world.getBlockMetadata(i, j, k) & 7;
     float f = 0.15F;
     if (l == 1)
     {
         setBlockBounds(0.0F, 0.2F, 0.5F - f, f*2.0F, 0.8F, 0.5F + f);
     }
     else if (l == 2)
     {
         setBlockBounds(1.0F - f*2.0F, 0.2F, 0.5F - f, 1.0F, 0.8F, 0.5F + f);
     }
     else if (l == 3)
     {
         setBlockBounds(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f*2.0F);
     }
     else if (l == 4)
     {
         setBlockBounds(0.5F - f, 0.2F, 1.0F - f*2.0F, 0.5F + f, 0.8F, 1.0F);
     }
     else
     {
         float f1 = 0.1F;
         setBlockBounds(0.5F - f1, 0.0F, 0.5F - f1, 0.5F + f1, 0.6F, 0.5F + f1);
     }
     return base.collisionRayTrace(world, i, j, k, vec3d, vec3d1);
 }
Example #4
0
 public override void playBlock(World world, int i, int j, int k, int l, int i1)
 {
     var f = (float) Math.pow(2D, (i1 - 12)/12D);
     string s = "harp";
     if (l == 1)
     {
         s = "bd";
     }
     if (l == 2)
     {
         s = "snare";
     }
     if (l == 3)
     {
         s = "hat";
     }
     if (l == 4)
     {
         s = "bassattack";
     }
     world.playSoundEffect(i + 0.5D, j + 0.5D, k + 0.5D,
                           (new StringBuilder()).append("note.").append(s).toString(), 3F, f);
     world.spawnParticle("note", i + 0.5D, j + 1.2D, k + 0.5D, i1/24D, 0.0D,
                         0.0D);
 }
Example #5
0
 public override void onBlockRemoval(World world, int i, int j, int k)
 {
     byte byte0 = 4;
     int l = byte0 + 1;
     if (world.checkChunksExist(i - l, j - l, k - l, i + l, j + l, k + l))
     {
         for (int i1 = -byte0; i1 <= byte0; i1++)
         {
             for (int j1 = -byte0; j1 <= byte0; j1++)
             {
                 for (int k1 = -byte0; k1 <= byte0; k1++)
                 {
                     int l1 = world.getBlockId(i + i1, j + j1, k + k1);
                     if (l1 != leaves.blockID)
                     {
                         continue;
                     }
                     int i2 = world.getBlockMetadata(i + i1, j + j1, k + k1);
                     if ((i2 & 4) == 0)
                     {
                         world.setBlockMetadata(i + i1, j + j1, k + k1, i2 | 4);
                     }
                 }
             }
         }
     }
 }
Example #6
0
 public override bool canPlaceBlockAt(World world, int i, int j, int k)
 {
     int l = world.getBlockId(i, j - 1, k);
     if (l == blockID)
     {
         return true;
     }
     if (l != grass.blockID && l != dirt.blockID)
     {
         return false;
     }
     if (world.getBlockMaterial(i - 1, j - 1, k) == Material.water)
     {
         return true;
     }
     if (world.getBlockMaterial(i + 1, j - 1, k) == Material.water)
     {
         return true;
     }
     if (world.getBlockMaterial(i, j - 1, k - 1) == Material.water)
     {
         return true;
     }
     return world.getBlockMaterial(i, j - 1, k + 1) == Material.water;
 }
Example #7
0
 public override bool isIndirectlyPoweringTo(World world, int i, int j, int k, int l)
 {
     int i1 = world.getBlockMetadata(i, j, k);
     if ((i1 & 8) == 0)
     {
         return false;
     }
     int j1 = i1 & 7;
     if (j1 == 5 && l == 1)
     {
         return true;
     }
     if (j1 == 4 && l == 2)
     {
         return true;
     }
     if (j1 == 3 && l == 3)
     {
         return true;
     }
     if (j1 == 2 && l == 4)
     {
         return true;
     }
     return j1 == 1 && l == 5;
 }
Example #8
0
 public EntityFireball(World world, EntityLiving entityliving, double d, double d1, double d2)
     : base(world)
 {
     xTile = -1;
     yTile = -1;
     zTile = -1;
     inTile = 0;
     inGround = false;
     shake = 0;
     ticksInAir = 0;
     owner = entityliving;
     setSize(1.0F, 1.0F);
     setLocationAndAngles(entityliving.posX, entityliving.posY, entityliving.posZ, entityliving.rotationYaw,
                          entityliving.rotationPitch);
     setPosition(posX, posY, posZ);
     yOffset = 0.0F;
     motionX = motionY = motionZ = 0.0D;
     d += rand.nextGaussian()*0.40000000000000002D;
     d1 += rand.nextGaussian()*0.40000000000000002D;
     d2 += rand.nextGaussian()*0.40000000000000002D;
     double d3 = MathHelper.sqrt_double(d*d + d1*d1 + d2*d2);
     field_9199_b = (d/d3)*0.10000000000000001D;
     field_9198_c = (d1/d3)*0.10000000000000001D;
     field_9196_d = (d2/d3)*0.10000000000000001D;
 }
Example #9
0
 public override void getCollidingBoundingBoxes(World world, int i, int j, int k, AxisAlignedBB axisalignedbb,
     ArrayList arraylist)
 {
     int l = world.getBlockMetadata(i, j, k);
     if (l == 0)
     {
         setBlockBounds(0.0F, 0.0F, 0.0F, 0.5F, 0.5F, 1.0F);
         base.getCollidingBoundingBoxes(world, i, j, k, axisalignedbb, arraylist);
         setBlockBounds(0.5F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
         base.getCollidingBoundingBoxes(world, i, j, k, axisalignedbb, arraylist);
     }
     else if (l == 1)
     {
         setBlockBounds(0.0F, 0.0F, 0.0F, 0.5F, 1.0F, 1.0F);
         base.getCollidingBoundingBoxes(world, i, j, k, axisalignedbb, arraylist);
         setBlockBounds(0.5F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
         base.getCollidingBoundingBoxes(world, i, j, k, axisalignedbb, arraylist);
     }
     else if (l == 2)
     {
         setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 0.5F);
         base.getCollidingBoundingBoxes(world, i, j, k, axisalignedbb, arraylist);
         setBlockBounds(0.0F, 0.0F, 0.5F, 1.0F, 1.0F, 1.0F);
         base.getCollidingBoundingBoxes(world, i, j, k, axisalignedbb, arraylist);
     }
     else if (l == 3)
     {
         setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.5F);
         base.getCollidingBoundingBoxes(world, i, j, k, axisalignedbb, arraylist);
         setBlockBounds(0.0F, 0.0F, 0.5F, 1.0F, 0.5F, 1.0F);
         base.getCollidingBoundingBoxes(world, i, j, k, axisalignedbb, arraylist);
     }
     setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
 }
Example #10
0
 public override void onBlockDestroyedByExplosion(World world, int i, int j, int k)
 {
     var entitytntprimed = new EntityTNTPrimed(world, i + 0.5F, j + 0.5F,
                                               k + 0.5F);
     entitytntprimed.fuse = world.rand.nextInt(entitytntprimed.fuse/4) + entitytntprimed.fuse/8;
     world.entityJoinedWorld(entitytntprimed);
 }
Example #11
0
 public override void func_666_a(World world, int i, int j, int k, int l, byte[] abyte0)
 {
     int i1 = rand.nextInt(rand.nextInt(rand.nextInt(40) + 1) + 1);
     if (rand.nextInt(15) != 0)
     {
         i1 = 0;
     }
     for (int j1 = 0; j1 < i1; j1++)
     {
         double d = i*16 + rand.nextInt(16);
         double d1 = rand.nextInt(rand.nextInt(120) + 8);
         double d2 = j*16 + rand.nextInt(16);
         int k1 = 1;
         if (rand.nextInt(4) == 0)
         {
             func_669_a(k, l, abyte0, d, d1, d2);
             k1 += rand.nextInt(4);
         }
         for (int l1 = 0; l1 < k1; l1++)
         {
             float f = rand.nextFloat()*3.141593F*2.0F;
             float f1 = ((rand.nextFloat() - 0.5F)*2.0F)/8F;
             float f2 = rand.nextFloat()*2.0F + rand.nextFloat();
             releaseEntitySkin(k, l, abyte0, d, d1, d2, f2, f, f1, 0, 0, 1.0D);
         }
     }
 }
Example #12
0
 public override void updateTick(World world, int i, int j, int k, Random random)
 {
     if (world.singleplayerWorld)
     {
         return;
     }
     if (world.getBlockLightValue(i, j + 1, k) < 4 && world.getBlockMaterial(i, j + 1, k).getCanBlockGrass())
     {
         if (random.nextInt(4) != 0)
         {
             return;
         }
         world.setBlockWithNotify(i, j, k, dirt.blockID);
     }
     else if (world.getBlockLightValue(i, j + 1, k) >= 9)
     {
         int l = (i + random.nextInt(3)) - 1;
         int i1 = (j + random.nextInt(5)) - 3;
         int j1 = (k + random.nextInt(3)) - 1;
         if (world.getBlockId(l, i1, j1) == dirt.blockID && world.getBlockLightValue(l, i1 + 1, j1) >= 4 &&
             !world.getBlockMaterial(l, i1 + 1, j1).getCanBlockGrass())
         {
             world.setBlockWithNotify(l, i1, j1, grass.blockID);
         }
     }
 }
Example #13
0
        public override bool generate(World world, Random random, int i, int j, int k)
        {
            for (int l = 0; l < 20; l++)
            {
                int i1 = (i + random.nextInt(4)) - random.nextInt(4);
                int j1 = j;
                int k1 = (k + random.nextInt(4)) - random.nextInt(4);
                if (!world.isAirBlock(i1, j1, k1) ||
                    world.getBlockMaterial(i1 - 1, j1 - 1, k1) != Material.water &&
                    world.getBlockMaterial(i1 + 1, j1 - 1, k1) != Material.water &&
                    world.getBlockMaterial(i1, j1 - 1, k1 - 1) != Material.water &&
                    world.getBlockMaterial(i1, j1 - 1, k1 + 1) != Material.water)
                {
                    continue;
                }
                int l1 = 2 + random.nextInt(random.nextInt(3) + 1);
                for (int i2 = 0; i2 < l1; i2++)
                {
                    if (Block.reed.canBlockStay(world, i1, j1 + i2, k1))
                    {
                        world.setBlock(i1, j1 + i2, k1, Block.reed.blockID);
                    }
                }
            }

            return true;
        }
Example #14
0
 public override void onNeighborBlockChange(World world, int i, int j, int k, int l)
 {
     int i1 = world.getBlockMetadata(i, j, k);
     bool flag = false;
     if (i1 == 2 && world.isBlockOpaqueCube(i, j, k + 1))
     {
         flag = true;
     }
     if (i1 == 3 && world.isBlockOpaqueCube(i, j, k - 1))
     {
         flag = true;
     }
     if (i1 == 4 && world.isBlockOpaqueCube(i + 1, j, k))
     {
         flag = true;
     }
     if (i1 == 5 && world.isBlockOpaqueCube(i - 1, j, k))
     {
         flag = true;
     }
     if (!flag)
     {
         dropBlockAsItem(world, i, j, k, i1);
         world.setBlockWithNotify(i, j, k, 0);
     }
     base.onNeighborBlockChange(world, i, j, k, l);
 }
Example #15
0
 public static Entity createEntityFromNBT(NBTTagCompound nbttagcompound, World world)
 {
     Entity entity = null;
     try
     {
         var class1 = (Class) stringToClassMapping.get(nbttagcompound.getString("id"));
         if (class1 != null)
         {
             entity = (Entity) class1.getConstructor(new Class[]
                                                     {
                                                         typeof (World)
                                                     }).newInstance(new object[]
                                                                    {
                                                                        world
                                                                    });
         }
     }
     catch (Exception exception)
     {
         exception.printStackTrace();
     }
     if (entity != null)
     {
         entity.readFromNBT(nbttagcompound);
     }
     else
     {
         [email protected](
             (new StringBuilder()).append("Skipping Entity with id ").append(nbttagcompound.getString("id")).
                 toString());
     }
     return entity;
 }
Example #16
0
        public EntityPainting(World world, int i, int j, int k, int l)
            : this(world)
        {
            xPosition = i;
            yPosition = j;
            zPosition = k;
            var arraylist = new ArrayList();
            EnumArt[] aenumart = EnumArt.values();
            int i1 = aenumart.Length;
            for (int j1 = 0; j1 < i1; j1++)
            {
                EnumArt enumart = aenumart[j1];
                art = enumart;
                func_179_a(l);
                if (onValidSurface())
                {
                    arraylist.add(enumart);
                }
            }

            if (arraylist.size() > 0)
            {
                art = (EnumArt) arraylist.get(rand.nextInt(arraylist.size()));
            }
            func_179_a(l);
        }
Example #17
0
 public override void updateTick(World world, int i, int j, int k, Random random)
 {
     if (blockID == oreRedstoneGlowing.blockID)
     {
         world.setBlockWithNotify(i, j, k, oreRedstone.blockID);
     }
 }
Example #18
0
 public EntitySnowball(World world, EntityLiving entityliving)
     : base(world)
 {
     xTileSnowball = -1;
     yTileSnowball = -1;
     zTileSnowball = -1;
     inTileSnowball = 0;
     inGroundSnowball = false;
     shakeSnowball = 0;
     ticksInAir = 0;
     owner = entityliving;
     setSize(0.25F, 0.25F);
     setLocationAndAngles(entityliving.posX, entityliving.posY + entityliving.getEyeHeight(),
                          entityliving.posZ, entityliving.rotationYaw, entityliving.rotationPitch);
     posX -= MathHelper.cos((rotationYaw/180F)*3.141593F)*0.16F;
     posY -= 0.10000000149011612D;
     posZ -= MathHelper.sin((rotationYaw/180F)*3.141593F)*0.16F;
     setPosition(posX, posY, posZ);
     yOffset = 0.0F;
     float f = 0.4F;
     motionX = -MathHelper.sin((rotationYaw/180F)*3.141593F)*MathHelper.cos((rotationPitch/180F)*3.141593F)*f;
     motionZ = MathHelper.cos((rotationYaw/180F)*3.141593F)*MathHelper.cos((rotationPitch/180F)*3.141593F)*f;
     motionY = -MathHelper.sin((rotationPitch/180F)*3.141593F)*f;
     func_6141_a(motionX, motionY, motionZ, 1.5F, 1.0F);
 }
Example #19
0
 public override void onNeighborBlockChange(World world, int i, int j, int k, int l)
 {
     if (l > 0 && blocksList[l].canProvidePower() && world.isBlockIndirectlyGettingPowered(i, j, k))
     {
         onBlockDestroyedByPlayer(world, i, j, k, 0);
         world.setBlockWithNotify(i, j, k, 0);
     }
 }
Example #20
0
 public override void onBlockAdded(World world, int i, int j, int k)
 {
     base.onBlockAdded(world, i, j, k);
     if (world.getBlockId(i, j, k) == blockID)
     {
         world.func_22074_c(i, j, k, blockID, tickRate());
     }
 }
Example #21
0
 public EntityPainting(World world)
     : base(world)
 {
     field_452_ad = 0;
     direction = 0;
     yOffset = 0.0F;
     setSize(0.5F, 0.5F);
 }
Example #22
0
 public override bool blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
 {
     int l = world.getBlockMetadata(i, j, k);
     int i1 = (l & 0xc) >> 2;
     i1 = i1 + 1 << 2 & 0xc;
     world.setBlockMetadataWithNotify(i, j, k, i1 | l & 3);
     return true;
 }
Example #23
0
 public override void onBlockAdded(World world, int i, int j, int k)
 {
     if (!world.singleplayerWorld)
     {
         world.setBlockMetadataWithNotify(i, j, k, 15);
         func_4038_g(world, i, j, k);
     }
 }
Example #24
0
 protected void func_276_g(World world, int i, int j, int k)
 {
     if (!canBlockStay(world, i, j, k))
     {
         dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k));
         world.setBlockWithNotify(i, j, k, 0);
     }
 }
Example #25
0
 public Chunk(World world, byte[] abyte0, int i, int j)
     : this(world, i, j)
 {
     blocks = abyte0;
     data = new NibbleArray(abyte0.Length);
     skylightMap = new NibbleArray(abyte0.Length);
     blocklightMap = new NibbleArray(abyte0.Length);
 }
Example #26
0
 public EntityTNTPrimed(World world)
     : base(world)
 {
     fuse = 0;
     preventEntitySpawning = true;
     setSize(0.98F, 0.98F);
     yOffset = height/2.0F;
 }
Example #27
0
 public override void onBlockRemoval(World world, int i, int j, int k)
 {
     Material material = world.getBlockMaterial(i, j - 1, k);
     if (material.getIsSolid() || material.getIsLiquid())
     {
         world.setBlockWithNotify(i, j, k, waterStill.blockID);
     }
 }
Example #28
0
 public override void updateTick(World world, int i, int j, int k, Random random)
 {
     if (world.getSavedLightValue(EnumSkyBlock.Block, i, j, k) > 11 - lightOpacity[blockID])
     {
         dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k));
         world.setBlockWithNotify(i, j, k, waterMoving.blockID);
     }
 }
Example #29
0
 public EntityItem(World world)
     : base(world)
 {
     age = 0;
     health = 5;
     field_432_ae = (float) (Math.random()*3.1415926535897931D*2D);
     setSize(0.25F, 0.25F);
     yOffset = height/2.0F;
 }
Example #30
0
 public override AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
 {
     int l = world.getBlockMetadata(i, j, k);
     float f = 0.0625F;
     float f1 = (1 + l*2)/16F;
     float f2 = 0.5F;
     return AxisAlignedBB.getBoundingBoxFromPool(i + f1, j, k + f, (i + 1) - f,
                                                 (j + f2) - f, (k + 1) - f);
 }