Example #1
0
        private void SetDispenserDefaultDirection(net.minecraft.src.World world, int i, int
                                                  j, int k)
        {
            if (world.singleplayerWorld)
            {
                return;
            }
            int  l     = world.GetBlockId(i, j, k - 1);
            int  i1    = world.GetBlockId(i, j, k + 1);
            int  j1    = world.GetBlockId(i - 1, j, k);
            int  k1    = world.GetBlockId(i + 1, j, k);
            byte byte0 = 3;

            if (net.minecraft.src.Block.opaqueCubeLookup[l] && !net.minecraft.src.Block.opaqueCubeLookup
                [i1])
            {
                byte0 = 3;
            }
            if (net.minecraft.src.Block.opaqueCubeLookup[i1] && !net.minecraft.src.Block.opaqueCubeLookup
                [l])
            {
                byte0 = 2;
            }
            if (net.minecraft.src.Block.opaqueCubeLookup[j1] && !net.minecraft.src.Block.opaqueCubeLookup
                [k1])
            {
                byte0 = 5;
            }
            if (net.minecraft.src.Block.opaqueCubeLookup[k1] && !net.minecraft.src.Block.opaqueCubeLookup
                [j1])
            {
                byte0 = 4;
            }
            world.SetBlockMetadataWithNotify(i, j, k, byte0);
        }
Example #2
0
        public override void OnNeighborBlockChange(net.minecraft.src.World world, int i,
                                                   int j, int k, int l)
        {
            int i1 = world.GetBlockMetadata(i, j, k);
            int j1 = Func_22019_c(i1);

            if (Func_22020_d(i1))
            {
                if (world.GetBlockId(i - field_22023_a[j1][0], j, k - field_22023_a[j1][1]) != ID)
                {
                    world.SetBlockWithNotify(i, j, k, 0);
                }
            }
            else
            {
                if (world.GetBlockId(i + field_22023_a[j1][0], j, k + field_22023_a[j1][1]) != ID)
                {
                    world.SetBlockWithNotify(i, j, k, 0);
                    if (!world.singleplayerWorld)
                    {
                        DropBlockAsItem(world, i, j, k, i1);
                    }
                }
            }
        }
Example #3
0
 public override void UpdateTick(net.minecraft.src.World world, int i, int j, int
                                 k, SharpBukkitLive.SharpBukkit.SharpRandom random)
 {
     if (world.singleplayerWorld)
     {
         return;
     }
     if (world.GetBlockLightValue(i, j + 1, k) < 4 && net.minecraft.src.Block.lightOpacity
         [world.GetBlockId(i, j + 1, k)] > 2)
     {
         if (random.Next(4) != 0)
         {
             return;
         }
         world.SetBlockWithNotify(i, j, k, net.minecraft.src.Block.DIRT.ID);
     }
     else
     {
         if (world.GetBlockLightValue(i, j + 1, k) >= 9)
         {
             int l  = (i + random.Next(3)) - 1;
             int i1 = (j + random.Next(5)) - 3;
             int j1 = (k + random.Next(3)) - 1;
             int k1 = world.GetBlockId(l, i1 + 1, j1);
             if (world.GetBlockId(l, i1, j1) == net.minecraft.src.Block.DIRT.ID && world.
                 GetBlockLightValue(l, i1 + 1, j1) >= 4 && net.minecraft.src.Block.lightOpacity[k1
                 ] <= 2)
             {
                 world.SetBlockWithNotify(l, i1, j1, net.minecraft.src.Block.GRASS.ID);
             }
         }
     }
 }
Example #4
0
        private void TryToCatchBlockOnFire(net.minecraft.src.World world, int i, int j, int
                                           k, int l, SharpBukkitLive.SharpBukkit.SharpRandom random, int i1)
        {
            int j1 = abilityToCatchFire[world.GetBlockId(i, j, k)];

            if (random.Next(l) < j1)
            {
                bool flag = world.GetBlockId(i, j, k) == net.minecraft.src.Block.TNT.ID;
                if (random.Next(i1 + 10) < 5 && !world.CanLightningStrikeAt(i, j, k))
                {
                    int k1 = i1 + random.Next(5) / 4;
                    if (k1 > 15)
                    {
                        k1 = 15;
                    }
                    world.SetBlockAndMetadataWithNotify(i, j, k, ID, k1);
                }
                else
                {
                    world.SetBlockWithNotify(i, j, k, 0);
                }
                if (flag)
                {
                    net.minecraft.src.Block.TNT.OnBlockDestroyedByPlayer(world, i, j, k, 1);
                }
            }
        }
Example #5
0
        public override bool OnItemUse(net.minecraft.src.ItemStack itemstack, net.minecraft.src.EntityPlayer
                                       entityplayer, net.minecraft.src.World world, int i, int j, int k, int l)
        {
            int i1 = world.GetBlockId(i, j, k);
            int j1 = world.GetBlockId(i, j + 1, k);

            if (l != 0 && j1 == 0 && i1 == net.minecraft.src.Block.GRASS.ID || i1 == net.minecraft.src.Block
                .DIRT.ID)
            {
                net.minecraft.src.Block block = net.minecraft.src.Block.SOIL;
                world.PlaySoundEffect((float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F, block.stepSound
                                      .Func_737_c(), (block.stepSound.GetVolume() + 1.0F) / 2.0F, block.stepSound.GetPitch
                                          () * 0.8F);
                if (world.singleplayerWorld)
                {
                    return(true);
                }
                else
                {
                    world.SetBlockWithNotify(i, j, k, block.ID);
                    itemstack.DamageItem(1, entityplayer);
                    return(true);
                }
            }
            else
            {
                return(false);
            }
        }
Example #6
0
        public virtual void Func_272_a(net.minecraft.src.World world, int i, int j, int k
                                       , bool flag)
        {
            int l = world.GetBlockMetadata(i, j, k);

            if ((l & 8) != 0)
            {
                if (world.GetBlockId(i, j - 1, k) == ID)
                {
                    Func_272_a(world, i, j - 1, k, flag);
                }
                return;
            }
            bool flag1 = (world.GetBlockMetadata(i, j, k) & 4) > 0;

            if (flag1 == flag)
            {
                return;
            }
            if (world.GetBlockId(i, j + 1, k) == ID)
            {
                world.SetBlockMetadataWithNotify(i, j + 1, k, (l ^ 4) + 8);
            }
            world.SetBlockMetadataWithNotify(i, j, k, l ^ 4);
            world.MarkBlocksDirty(i, j - 1, k, i, j, k);
            world.SendSoundEffectToAllPlayersWithin64(null, 1003, i, j, k, 0);
        }
Example #7
0
        public override bool BlockActivated(net.minecraft.src.World world, int i, int j,
                                            int k, net.minecraft.src.EntityPlayer entityplayer)
        {
            if (blockMaterial == net.minecraft.src.Material.iron)
            {
                return(true);
            }
            int l = world.GetBlockMetadata(i, j, k);

            if ((l & 8) != 0)
            {
                if (world.GetBlockId(i, j - 1, k) == ID)
                {
                    BlockActivated(world, i, j - 1, k, entityplayer);
                }
                return(true);
            }
            if (world.GetBlockId(i, j + 1, k) == ID)
            {
                world.SetBlockMetadataWithNotify(i, j + 1, k, (l ^ 4) + 8);
            }
            world.SetBlockMetadataWithNotify(i, j, k, l ^ 4);
            world.MarkBlocksDirty(i, j - 1, k, i, j, k);
            world.SendSoundEffectToAllPlayersWithin64(entityplayer, 1003, i, j, k, 0);
            return(true);
        }
Example #8
0
        public override void OnNeighborBlockChange(net.minecraft.src.World world, int i,
                                                   int j, int k, int l)
        {
            int i1 = world.GetBlockMetadata(i, j, k);

            if ((i1 & 8) != 0)
            {
                if (world.GetBlockId(i, j - 1, k) != ID)
                {
                    world.SetBlockWithNotify(i, j, k, 0);
                }
                if (l > 0 && net.minecraft.src.Block.blocksList[l].CanProvidePower())
                {
                    OnNeighborBlockChange(world, i, j - 1, k, l);
                }
            }
            else
            {
                bool flag = false;
                if (world.GetBlockId(i, j + 1, k) != ID)
                {
                    world.SetBlockWithNotify(i, j, k, 0);
                    flag = true;
                }
                if (!world.IsBlockNormalCube(i, j - 1, k))
                {
                    world.SetBlockWithNotify(i, j, k, 0);
                    flag = true;
                    if (world.GetBlockId(i, j + 1, k) == ID)
                    {
                        world.SetBlockWithNotify(i, j + 1, k, 0);
                    }
                }
                if (flag)
                {
                    if (!world.singleplayerWorld)
                    {
                        DropBlockAsItem(world, i, j, k, i1);
                    }
                }
                else
                {
                    if (l > 0 && net.minecraft.src.Block.blocksList[l].CanProvidePower())
                    {
                        bool flag1 = world.IsBlockIndirectlyGettingPowered(i, j, k) || world.IsBlockIndirectlyGettingPowered
                                         (i, j + 1, k);
                        Func_272_a(world, i, j, k, flag1);
                    }
                }
            }
        }
Example #9
0
        public RailLogic(net.minecraft.src.BlockRail blockrail, net.minecraft.src.World world
                         , int i, int j, int k)
        {
            // Referenced classes of package net.minecraft.src:
            //            World, Block, BlockRail, ChunkPosition
            //        super();
            minecartTrack   = blockrail;
            connectedTracks = new List <ChunkPosition>();
            worldObj        = world;
            trackX          = i;
            trackY          = j;
            trackZ          = k;
            int l  = world.GetBlockId(i, j, k);
            int i1 = world.GetBlockMetadata(i, j, k);

            if (net.minecraft.src.BlockRail.Func_27033_a((net.minecraft.src.BlockRail)net.minecraft.src.Block
                                                         .blocksList[l]))
            {
                field_27084_f = true;
                i1           &= -9;
            }
            else
            {
                field_27084_f = false;
            }
            Func_27083_a(i1);
        }
Example #10
0
        public override bool CanPlaceBlockAt(net.minecraft.src.World world, int i, int j,
                                             int k)
        {
            int l = world.GetBlockId(i, j - 1, k);

            if (l == ID)
            {
                return(true);
            }
            if (l != net.minecraft.src.Block.GRASS.ID && l != net.minecraft.src.Block.DIRT
                .ID)
            {
                return(false);
            }
            if (world.GetBlockMaterial(i - 1, j - 1, k) == net.minecraft.src.Material.water)
            {
                return(true);
            }
            if (world.GetBlockMaterial(i + 1, j - 1, k) == net.minecraft.src.Material.water)
            {
                return(true);
            }
            if (world.GetBlockMaterial(i, j - 1, k - 1) == net.minecraft.src.Material.water)
            {
                return(true);
            }
            return(world.GetBlockMaterial(i, j - 1, k + 1) == net.minecraft.src.Material.water);
        }
Example #11
0
        public override void OnNeighborBlockChange(net.minecraft.src.World world, int i,
                                                   int j, int k, int l)
        {
            int i1 = Func_31045_b(world.GetBlockMetadata(i, j, k));

            if (l > 5 || l < 0)
            {
                return;                             // CRAFTBUKKIT - fixed a piston AIOOBE issue.
            }
            int j1 = world.GetBlockId(i - net.minecraft.src.PistonBlockTextures.field_31051_b
                                      [i1], j - net.minecraft.src.PistonBlockTextures.field_31054_c[i1], k - net.minecraft.src.PistonBlockTextures
                                      .field_31053_d[i1]);

            if (j1 != net.minecraft.src.Block.PISTON.ID && j1 != net.minecraft.src.Block
                .PISTON_STICKY.ID)
            {
                world.SetBlockWithNotify(i, j, k, 0);
            }
            else
            {
                net.minecraft.src.Block.blocksList[j1].OnNeighborBlockChange(world, i - net.minecraft.src.PistonBlockTextures
                                                                             .field_31051_b[i1], j - net.minecraft.src.PistonBlockTextures.field_31054_c[i1],
                                                                             k - net.minecraft.src.PistonBlockTextures.field_31053_d[i1], l);
            }
        }
Example #12
0
        public override void OnBlockRemoval(net.minecraft.src.World world, int i, int j,
                                            int k)
        {
            int l  = 1;
            int i1 = l + 1;

            if (world.CheckChunksExist(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1))
            {
                for (int j1 = -l; j1 <= l; j1++)
                {
                    for (int k1 = -l; k1 <= l; k1++)
                    {
                        for (int l1 = -l; l1 <= l; l1++)
                        {
                            int i2 = world.GetBlockId(i + j1, j + k1, k + l1);
                            if (i2 == net.minecraft.src.Block.LEAVES.ID)
                            {
                                int j2 = world.GetBlockMetadata(i + j1, j + k1, k + l1);
                                world.SetBlockMetadata(i + j1, j + k1, k + l1, j2 | 8);
                            }
                        }
                    }
                }
            }
        }
Example #13
0
 public override void UpdateTick(net.minecraft.src.World world, int i, int j, int
                                 k, SharpBukkitLive.SharpBukkit.SharpRandom random)
 {
     if (blockMaterial == net.minecraft.src.Material.lava)
     {
         int l = random.Next(3);
         for (int i1 = 0; i1 < l; i1++)
         {
             i += random.Next(3) - 1;
             j++;
             k += random.Next(3) - 1;
             int j1 = world.GetBlockId(i, j, k);
             if (j1 == 0)
             {
                 if (Func_4033_j(world, i - 1, j, k) || Func_4033_j(world, i + 1, j, k) || Func_4033_j
                         (world, i, j, k - 1) || Func_4033_j(world, i, j, k + 1) || Func_4033_j(world, i,
                                                                                                j - 1, k) || Func_4033_j(world, i, j + 1, k))
                 {
                     world.SetBlockWithNotify(i, j, k, net.minecraft.src.Block.FIRE.ID);
                     return;
                 }
                 continue;
             }
             if (net.minecraft.src.Block.blocksList[j1].blockMaterial.GetIsSolid())
             {
                 return;
             }
         }
     }
 }
Example #14
0
 public static net.minecraft.src.ChunkCoordinates Func_25051_a(net.minecraft.src.World
                                                               world, net.minecraft.src.ChunkCoordinates chunkcoordinates)
 {
     net.minecraft.src.IChunkProvider ichunkprovider = world.GetChunkProvider();
     ichunkprovider.LoadChunk(chunkcoordinates.posX - 3 >> 4, chunkcoordinates.posZ -
                              3 >> 4);
     ichunkprovider.LoadChunk(chunkcoordinates.posX + 3 >> 4, chunkcoordinates.posZ -
                              3 >> 4);
     ichunkprovider.LoadChunk(chunkcoordinates.posX - 3 >> 4, chunkcoordinates.posZ +
                              3 >> 4);
     ichunkprovider.LoadChunk(chunkcoordinates.posX + 3 >> 4, chunkcoordinates.posZ +
                              3 >> 4);
     if (world.GetBlockId(chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates
                          .posZ) != net.minecraft.src.Block.BED.ID)
     {
         return(null);
     }
     else
     {
         net.minecraft.src.ChunkCoordinates chunkcoordinates1 = net.minecraft.src.BlockBed
                                                                .Func_22021_g(world, chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates
                                                                              .posZ, 0);
         return(chunkcoordinates1);
     }
 }
Example #15
0
 public override bool CanBlockStay(net.minecraft.src.World world, int i, int j, int
                                   k)
 {
     if (world.GetBlockMaterial(i - 1, j, k).IsSolid())
     {
         return(false);
     }
     if (world.GetBlockMaterial(i + 1, j, k).IsSolid())
     {
         return(false);
     }
     if (world.GetBlockMaterial(i, j, k - 1).IsSolid())
     {
         return(false);
     }
     if (world.GetBlockMaterial(i, j, k + 1).IsSolid())
     {
         return(false);
     }
     else
     {
         int l = world.GetBlockId(i, j - 1, k);
         return(l == net.minecraft.src.Block.CACTUS.ID || l == net.minecraft.src.Block
                .SAND.ID);
     }
 }
Example #16
0
        public override void OnBlockRemoval(net.minecraft.src.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 != net.minecraft.src.Block.LEAVES.ID)
                            {
                                continue;
                            }
                            int i2 = world.GetBlockMetadata(i + i1, j + j1, k + k1);
                            if ((i2 & 8) == 0)
                            {
                                world.SetBlockMetadata(i + i1, j + j1, k + k1, i2 | 8);
                            }
                        }
                    }
                }
            }
        }
Example #17
0
        public override void OnBlockRemoval(net.minecraft.src.World world, int i, int j,
                                            int k)
        {
            base.OnBlockRemoval(world, i, j, k);
            int l = world.GetBlockMetadata(i, j, k);

            if (l > 5 || l < 0)
            {
                return;                             // CRAFTBUKKIT - fixed a piston AIOOBE issue.
            }
            int j1 = net.minecraft.src.PistonBlockTextures.field_31052_a[Func_31045_b(l)];

            i += net.minecraft.src.PistonBlockTextures.field_31051_b[j1];
            j += net.minecraft.src.PistonBlockTextures.field_31054_c[j1];
            k += net.minecraft.src.PistonBlockTextures.field_31053_d[j1];
            int k1 = world.GetBlockId(i, j, k);

            if (k1 == net.minecraft.src.Block.PISTON.ID || k1 == net.minecraft.src.Block
                .PISTON_STICKY.ID)
            {
                int i1 = world.GetBlockMetadata(i, j, k);
                if (net.minecraft.src.BlockPistonBase.IsExtended(i1))
                {
                    net.minecraft.src.Block.blocksList[k1].DropBlockAsItem(world, i, j, k, i1);
                    world.SetBlockWithNotify(i, j, k, 0);
                }
            }
        }
Example #18
0
        private bool Func_27031_a(net.minecraft.src.World world, int i, int j, int k, bool
                                  flag, int l, int i1)
        {
            int j1 = world.GetBlockId(i, j, k);

            if (j1 == net.minecraft.src.Block.GOLDEN_RAIL.ID)
            {
                int k1 = world.GetBlockMetadata(i, j, k);
                int l1 = k1 & 7;
                if (i1 == 1 && (l1 == 0 || l1 == 4 || l1 == 5))
                {
                    return(false);
                }
                if (i1 == 0 && (l1 == 1 || l1 == 2 || l1 == 3))
                {
                    return(false);
                }
                if ((k1 & 8) != 0)
                {
                    if (world.IsBlockIndirectlyGettingPowered(i, j, k) || world.IsBlockIndirectlyGettingPowered
                            (i, j + 1, k))
                    {
                        return(true);
                    }
                    else
                    {
                        return(Func_27032_a(world, i, j, k, k1, flag, l + 1));
                    }
                }
            }
            return(false);
        }
Example #19
0
        public override bool Generate(net.minecraft.src.World world, SharpBukkitLive.SharpBukkit.SharpRandom random
                                      , int i, int j, int k)
        {
            if (world.GetBlockMaterial(i, j, k) != net.minecraft.src.Material.water)
            {
                return(false);
            }
            float  f = ((float)random.NextDouble()) * 3.141593F;
            double d = (float)(i + 8) + (net.minecraft.src.MathHelper.Sin(f) * (float)numberOfBlocks
                                         ) / 8F;
            double d1 = (float)(i + 8) - (net.minecraft.src.MathHelper.Sin(f) * (float)numberOfBlocks
                                          ) / 8F;
            double d2 = (float)(k + 8) + (net.minecraft.src.MathHelper.Cos(f) * (float)numberOfBlocks
                                          ) / 8F;
            double d3 = (float)(k + 8) - (net.minecraft.src.MathHelper.Cos(f) * (float)numberOfBlocks
                                          ) / 8F;
            double d4 = j + random.Next(3) + 2;
            double d5 = j + random.Next(3) + 2;

            for (int l = 0; l <= numberOfBlocks; l++)
            {
                double d6  = d + ((d1 - d) * (double)l) / (double)numberOfBlocks;
                double d7  = d4 + ((d5 - d4) * (double)l) / (double)numberOfBlocks;
                double d8  = d2 + ((d3 - d2) * (double)l) / (double)numberOfBlocks;
                double d9  = (random.NextDouble() * (double)numberOfBlocks) / 16D;
                double d10 = (double)(net.minecraft.src.MathHelper.Sin(((float)l * 3.141593F) / (
                                                                           float)numberOfBlocks) + 1.0F) * d9 + 1.0D;
                double d11 = (double)(net.minecraft.src.MathHelper.Sin(((float)l * 3.141593F) / (
                                                                           float)numberOfBlocks) + 1.0F) * d9 + 1.0D;
                int i1 = net.minecraft.src.MathHelper.Floor_double(d6 - d10 / 2D);
                int j1 = net.minecraft.src.MathHelper.Floor_double(d6 + d10 / 2D);
                int k1 = net.minecraft.src.MathHelper.Floor_double(d7 - d11 / 2D);
                int l1 = net.minecraft.src.MathHelper.Floor_double(d7 + d11 / 2D);
                int i2 = net.minecraft.src.MathHelper.Floor_double(d8 - d10 / 2D);
                int j2 = net.minecraft.src.MathHelper.Floor_double(d8 + d10 / 2D);
                for (int k2 = i1; k2 <= j1; k2++)
                {
                    for (int l2 = k1; l2 <= l1; l2++)
                    {
                        for (int i3 = i2; i3 <= j2; i3++)
                        {
                            double d12 = (((double)k2 + 0.5D) - d6) / (d10 / 2D);
                            double d13 = (((double)l2 + 0.5D) - d7) / (d11 / 2D);
                            double d14 = (((double)i3 + 0.5D) - d8) / (d10 / 2D);
                            if (d12 * d12 + d13 * d13 + d14 * d14 >= 1.0D)
                            {
                                continue;
                            }
                            int j3 = world.GetBlockId(k2, l2, i3);
                            if (j3 == net.minecraft.src.Block.SAND.ID)
                            {
                                world.SetBlock(k2, l2, i3, clayBlockId);
                            }
                        }
                    }
                }
            }
            return(true);
        }
Example #20
0
        // Referenced classes of package net.minecraft.src:
        //            Block, World, Material, IBlockAccess,
        //            RailLogic, AxisAlignedBB, Vec3D, MovingObjectPosition
        public static bool Func_27029_g(net.minecraft.src.World world, int i, int j, int
                                        k)
        {
            int l = world.GetBlockId(i, j, k);

            return(l == net.minecraft.src.Block.RAILS.ID || l == net.minecraft.src.Block
                   .GOLDEN_RAIL.ID || l == net.minecraft.src.Block.DETECTOR_RAIL.ID);
        }
Example #21
0
        public override bool CanPlaceBlockAt(net.minecraft.src.World world, int i, int j,
                                             int k)
        {
            int l = world.GetBlockId(i, j, k);

            return((l == 0 || net.minecraft.src.Block.blocksList[l].blockMaterial.Func_27090_g
                        ()) && world.IsBlockNormalCube(i, j - 1, k));
        }
Example #22
0
 public override void OnNeighborBlockChange(net.minecraft.src.World world, int i,
                                            int j, int k, int l)
 {
     base.OnNeighborBlockChange(world, i, j, k, l);
     if (world.GetBlockId(i, j, k) == ID)
     {
         Func_30005_i(world, i, j, k);
     }
 }
Example #23
0
 public override void OnBlockAdded(net.minecraft.src.World world, int i, int j, int
                                   k)
 {
     base.OnBlockAdded(world, i, j, k);
     if (world.GetBlockId(i, j, k) == ID)
     {
         world.ScheduleUpdateTick(i, j, k, ID, TickRate());
     }
 }
Example #24
0
 public Packet53BlockChange(int x, int y, int z, net.minecraft.src.World world)
 {
     isChunkDataPacket = true;
     xPosition         = x;
     yPosition         = y;
     zPosition         = z;
     type     = world.GetBlockId(x, y, z);
     metadata = world.GetBlockMetadata(x, y, z);
 }
Example #25
0
 public override bool OnItemUse(net.minecraft.src.ItemStack itemstack, net.minecraft.src.EntityPlayer
                                entityplayer, net.minecraft.src.World world, int i, int j, int k, int l)
 {
     if (world.GetBlockId(i, j, k) == net.minecraft.src.Block.SNOW.ID)
     {
         l = 0;
     }
     else
     {
         if (l == 0)
         {
             j--;
         }
         if (l == 1)
         {
             j++;
         }
         if (l == 2)
         {
             k--;
         }
         if (l == 3)
         {
             k++;
         }
         if (l == 4)
         {
             i--;
         }
         if (l == 5)
         {
             i++;
         }
     }
     if (itemstack.stackSize == 0)
     {
         return(false);
     }
     if (world.CanBlockBePlacedAt(field_253_a, i, j, k, false, l))
     {
         net.minecraft.src.Block block = net.minecraft.src.Block.blocksList[field_253_a];
         if (world.SetBlockWithNotify(i, j, k, field_253_a))
         {
             net.minecraft.src.Block.blocksList[field_253_a].OnBlockPlaced(world, i, j, k, l);
             net.minecraft.src.Block.blocksList[field_253_a].OnBlockPlacedBy(world, i, j, k, entityplayer
                                                                             );
             world.PlaySoundEffect((float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F, block.stepSound
                                   .Func_737_c(), (block.stepSound.GetVolume() + 1.0F) / 2.0F, block.stepSound.GetPitch
                                       () * 0.8F);
             itemstack.stackSize--;
         }
     }
     return(true);
 }
Example #26
0
        private bool Func_22012_g(net.minecraft.src.World world, int i, int j, int k, int
                                  l)
        {
            int i1 = l & 3;

            switch (i1)
            {
            case 0:
            {
                // '\0'
                return(world.IsBlockIndirectlyProvidingPowerTo(i, j, k + 1, 3) || world.GetBlockId
                           (i, j, k + 1) == net.minecraft.src.Block.REDSTONE_WIRE.ID && world.GetBlockMetadata
                           (i, j, k + 1) > 0);
            }

            case 2:
            {
                // '\002'
                return(world.IsBlockIndirectlyProvidingPowerTo(i, j, k - 1, 2) || world.GetBlockId
                           (i, j, k - 1) == net.minecraft.src.Block.REDSTONE_WIRE.ID && world.GetBlockMetadata
                           (i, j, k - 1) > 0);
            }

            case 3:
            {
                // '\003'
                return(world.IsBlockIndirectlyProvidingPowerTo(i + 1, j, k, 5) || world.GetBlockId
                           (i + 1, j, k) == net.minecraft.src.Block.REDSTONE_WIRE.ID && world.GetBlockMetadata
                           (i + 1, j, k) > 0);
            }

            case 1:
            {
                // '\001'
                return(world.IsBlockIndirectlyProvidingPowerTo(i - 1, j, k, 4) || world.GetBlockId
                           (i - 1, j, k) == net.minecraft.src.Block.REDSTONE_WIRE.ID && world.GetBlockMetadata
                           (i - 1, j, k) > 0);
            }
            }
            return(false);
        }
Example #27
0
 private bool IsThereANeighborChest(net.minecraft.src.World world, int i, int j, int
                                    k)
 {
     if (world.GetBlockId(i, j, k) != ID)
     {
         return(false);
     }
     if (world.GetBlockId(i - 1, j, k) == ID)
     {
         return(true);
     }
     if (world.GetBlockId(i + 1, j, k) == ID)
     {
         return(true);
     }
     if (world.GetBlockId(i, j, k - 1) == ID)
     {
         return(true);
     }
     return(world.GetBlockId(i, j, k + 1) == ID);
 }
Example #28
0
        public override net.minecraft.src.ItemStack OnItemRightClick(net.minecraft.src.ItemStack
                                                                     itemstack, net.minecraft.src.World world, net.minecraft.src.EntityPlayer entityplayer
                                                                     )
        {
            float f  = 1.0F;
            float f1 = entityplayer.prevRotationPitch + (entityplayer.rotationPitch - entityplayer
                                                         .prevRotationPitch) * f;
            float f2 = entityplayer.prevRotationYaw + (entityplayer.rotationYaw - entityplayer
                                                       .prevRotationYaw) * f;
            double d = entityplayer.prevPosX + (entityplayer.posX - entityplayer.prevPosX) *
                       (double)f;
            double d1 = (entityplayer.prevPosY + (entityplayer.posY - entityplayer.prevPosY)
                         * (double)f + 1.6200000000000001D) - (double)entityplayer.yOffset;
            double d2 = entityplayer.prevPosZ + (entityplayer.posZ - entityplayer.prevPosZ) *
                        (double)f;

            net.minecraft.src.Vec3D vec3d = net.minecraft.src.Vec3D.CreateVector(d, d1, d2);
            float  f3 = net.minecraft.src.MathHelper.Cos(-f2 * 0.01745329F - 3.141593F);
            float  f4 = net.minecraft.src.MathHelper.Sin(-f2 * 0.01745329F - 3.141593F);
            float  f5 = -net.minecraft.src.MathHelper.Cos(-f1 * 0.01745329F);
            float  f6 = net.minecraft.src.MathHelper.Sin(-f1 * 0.01745329F);
            float  f7 = f4 * f5;
            float  f8 = f6;
            float  f9 = f3 * f5;
            double d3 = 5D;

            net.minecraft.src.Vec3D vec3d1 = vec3d.AddVector((double)f7 * d3, (double)f8 * d3
                                                             , (double)f9 * d3);
            net.minecraft.src.MovingObjectPosition movingobjectposition = world.RayTraceBlocks_do
                                                                              (vec3d, vec3d1, true);
            if (movingobjectposition == null)
            {
                return(itemstack);
            }
            if (movingobjectposition.typeOfHit == net.minecraft.src.EnumMovingObjectType.TILE)
            {
                int i = movingobjectposition.blockX;
                int j = movingobjectposition.blockY;
                int k = movingobjectposition.blockZ;
                if (!world.singleplayerWorld)
                {
                    if (world.GetBlockId(i, j, k) == net.minecraft.src.Block.SNOW.ID)
                    {
                        j--;
                    }
                    world.AddEntity(new net.minecraft.src.EntityBoat(world, (float)i + 0.5F,
                                                                     (float)j + 1.0F, (float)k + 0.5F));
                }
                itemstack.stackSize--;
            }
            return(itemstack);
        }
Example #29
0
        public override bool CanPlaceBlockAt(net.minecraft.src.World world, int i, int j,
                                             int k)
        {
            int l = 0;

            if (world.GetBlockId(i - 1, j, k) == ID)
            {
                l++;
            }
            if (world.GetBlockId(i + 1, j, k) == ID)
            {
                l++;
            }
            if (world.GetBlockId(i, j, k - 1) == ID)
            {
                l++;
            }
            if (world.GetBlockId(i, j, k + 1) == ID)
            {
                l++;
            }
            if (l > 1)
            {
                return(false);
            }
            if (IsThereANeighborChest(world, i - 1, j, k))
            {
                return(false);
            }
            if (IsThereANeighborChest(world, i + 1, j, k))
            {
                return(false);
            }
            if (IsThereANeighborChest(world, i, j, k - 1))
            {
                return(false);
            }
            return(!IsThereANeighborChest(world, i, j, k + 1));
        }
Example #30
0
 public override bool CanBlockStay(net.minecraft.src.World world, int i, int j, int
                                   k)
 {
     if (j < 0 || j >= 128)
     {
         return(false);
     }
     else
     {
         return(world.GetBlockLightValueNoChecks(i, j, k) < 13 && CanThisPlantGrowOnThisBlockID
                    (world.GetBlockId(i, j - 1, k)));
     }
 }