Esempio n. 1
0
 public override void SetBlockBoundsBasedOnState(net.minecraft.src.IBlockAccess iblockaccess
                                                 , int i, int j, int k)
 {
     net.minecraft.src.TileEntityPiston tileentitypiston = GetTileEntityAtLocation(iblockaccess
                                                                                   , i, j, k);
     if (tileentitypiston != null)
     {
         net.minecraft.src.Block block = net.minecraft.src.Block.blocksList[tileentitypiston
                                                                            .GetStoredBlockID()];
         if (block == null || block == this)
         {
             return;
         }
         block.SetBlockBoundsBasedOnState(iblockaccess, i, j, k);
         float f = tileentitypiston.Func_31007_a(0.0F);
         if (tileentitypiston.Func_31010_c())
         {
             f = 1.0F - f;
         }
         int l = tileentitypiston.Func_31008_d();
         minX = block.minX - (double)((float)net.minecraft.src.PistonBlockTextures.field_31051_b
                                      [l] * f);
         minY = block.minY - (double)((float)net.minecraft.src.PistonBlockTextures.field_31054_c
                                      [l] * f);
         minZ = block.minZ - (double)((float)net.minecraft.src.PistonBlockTextures.field_31053_d
                                      [l] * f);
         maxX = block.maxX - (double)((float)net.minecraft.src.PistonBlockTextures.field_31051_b
                                      [l] * f);
         maxY = block.maxY - (double)((float)net.minecraft.src.PistonBlockTextures.field_31054_c
                                      [l] * f);
         maxZ = block.maxZ - (double)((float)net.minecraft.src.PistonBlockTextures.field_31053_d
                                      [l] * f);
     }
 }
Esempio n. 2
0
        public override net.minecraft.src.AxisAlignedBB GetCollisionBoundingBoxFromPool(net.minecraft.src.World
                                                                                        world, int i, int j, int k)
        {
            net.minecraft.src.TileEntityPiston tileentitypiston = GetTileEntityAtLocation(world
                                                                                          , i, j, k);
            if (tileentitypiston == null)
            {
                return(null);
            }
            float f = tileentitypiston.Func_31007_a(0.0F);

            if (tileentitypiston.Func_31010_c())
            {
                f = 1.0F - f;
            }
            return(Func_31032_a(world, i, j, k, tileentitypiston.GetStoredBlockID(), f, tileentitypiston
                                .Func_31008_d()));
        }
Esempio n. 3
0
 public override void DropBlockAsItemWithChance(net.minecraft.src.World world, int
                                                i, int j, int k, int l, float f)
 {
     if (world.singleplayerWorld)
     {
         return;
     }
     net.minecraft.src.TileEntityPiston tileentitypiston = GetTileEntityAtLocation(world
                                                                                   , i, j, k);
     if (tileentitypiston == null)
     {
         return;
     }
     else
     {
         net.minecraft.src.Block.blocksList[tileentitypiston.GetStoredBlockID()].DropBlockAsItem
             (world, i, j, k, tileentitypiston.Func_31005_e());
         return;
     }
 }
Esempio n. 4
0
        public override void PlayBlock(net.minecraft.src.World world, int i, int j, int k
                                       , int l, int i1)
        {
            ignoreUpdates = true;
            int j1 = i1;

            if (l == 0)
            {
                if (TryExtend(world, i, j, k, j1))
                {
                    world.SetBlockMetadataWithNotify(i, j, k, j1 | 8);
                    world.PlaySoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "tile.piston.out"
                                          , 0.5F, world.rand.NextFloat() * 0.25F + 0.6F);
                }
            }
            else
            {
                if (l == 1)
                {
                    net.minecraft.src.TileEntity tileentity = world.GetBlockTileEntity(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]);
                    if (tileentity != null && (tileentity is net.minecraft.src.TileEntityPiston))
                    {
                        ((net.minecraft.src.TileEntityPiston)tileentity).ClearPistonTileEntity();
                    }
                    world.SetBlockAndMetadata(i, j, k, net.minecraft.src.Block.PISTON_MOVING.ID,
                                              j1);
                    world.SetBlockTileEntity(i, j, k, net.minecraft.src.BlockPistonMoving.GetTileEntity
                                                 (ID, j1, j1, false, true));
                    if (isSticky)
                    {
                        int  k1   = i + net.minecraft.src.PistonBlockTextures.field_31051_b[j1] * 2;
                        int  l1   = j + net.minecraft.src.PistonBlockTextures.field_31054_c[j1] * 2;
                        int  i2   = k + net.minecraft.src.PistonBlockTextures.field_31053_d[j1] * 2;
                        int  j2   = world.GetBlockId(k1, l1, i2);
                        int  k2   = world.GetBlockMetadata(k1, l1, i2);
                        bool flag = false;
                        if (j2 == net.minecraft.src.Block.PISTON_MOVING.ID)
                        {
                            net.minecraft.src.TileEntity tileentity1 = world.GetBlockTileEntity(k1, l1, i2);
                            if (tileentity1 != null && (tileentity1 is net.minecraft.src.TileEntityPiston))
                            {
                                net.minecraft.src.TileEntityPiston tileentitypiston = (net.minecraft.src.TileEntityPiston
                                                                                       )tileentity1;
                                if (tileentitypiston.Func_31008_d() == j1 && tileentitypiston.Func_31010_c())
                                {
                                    tileentitypiston.ClearPistonTileEntity();
                                    j2   = tileentitypiston.GetStoredBlockID();
                                    k2   = tileentitypiston.Func_31005_e();
                                    flag = true;
                                }
                            }
                        }
                        if (!flag && j2 > 0 && CanPushBlock(j2, world, k1, l1, i2, false) && (net.minecraft.src.Block
                                                                                              .blocksList[j2].GetMobilityFlag() == 0 || j2 == net.minecraft.src.Block.PISTON
                                                                                              .ID || j2 == net.minecraft.src.Block.PISTON_STICKY.ID))
                        {
                            ignoreUpdates = false;
                            world.SetBlockWithNotify(k1, l1, i2, 0);
                            ignoreUpdates = true;
                            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];
                            world.SetBlockAndMetadata(i, j, k, net.minecraft.src.Block.PISTON_MOVING.ID,
                                                      k2);
                            world.SetBlockTileEntity(i, j, k, net.minecraft.src.BlockPistonMoving.GetTileEntity
                                                         (j2, k2, j1, false, false));
                        }
                        else
                        {
                            if (!flag)
                            {
                                ignoreUpdates = false;
                                world.SetBlockWithNotify(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], 0);
                                ignoreUpdates = true;
                            }
                        }
                    }
                    else
                    {
                        ignoreUpdates = false;
                        world.SetBlockWithNotify(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], 0);
                        ignoreUpdates = true;
                    }
                    world.PlaySoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "tile.piston.in"
                                          , 0.5F, world.rand.NextFloat() * 0.15F + 0.6F);
                }
            }
            ignoreUpdates = false;
        }