コード例 #1
0
ファイル: BlockBaseMushroom.cs プロジェクト: TheaP/c-raft
 protected BlockBaseMushroom()
 {
     Name = "BaseMushroom";
     IsAir = true;
     IsSingleHit = true;
     Opacity = 0x0;
     BlockBoundsOffset = new BoundingBox(0.3, 0, 0.3, 0.7, 0.4, 0.7);
 }
コード例 #2
0
ファイル: BlockSlab.cs プロジェクト: Nirad/c-raft
 public BlockSlab()
 {
     Name = "Slab";
     Type = BlockData.Blocks.Slab;
     IsSolid = true;
     LootTable.Add(new ItemStack((short)Type, 1));
     BlockBoundsOffset = new BoundingBox(0, 0, 0, 1, 0.5, 1);
 }
コード例 #3
0
ファイル: BlockRedstoneRepeater.cs プロジェクト: Nirad/c-raft
 public BlockRedstoneRepeater()
 {
     Name = "RedstoneRepeater";
     Type = BlockData.Blocks.Redstone_Repeater;
     Opacity = 0x0;
     IsSolid = true;
     LootTable.Add(new ItemStack((short)BlockData.Items.Redstone_Repeater, 1));
     BlockBoundsOffset = new BoundingBox(0, 0, 0, 1, 0.125, 1);
 }
コード例 #4
0
ファイル: BlockTracks.cs プロジェクト: Nirad/c-raft
 public BlockTracks()
 {
     Name = "Tracks";
     Type = BlockData.Blocks.Tracks;
     IsAir = true;
     LootTable.Add(new ItemStack((short)Type, 1));
     Opacity = 0x0;
     BlockBoundsOffset = new BoundingBox(0, 0, 0, 1, 0.125, 1);
 }
コード例 #5
0
 public BlockWoodenPressurePlate()
 {
     Name = "WoodenPressurePlate";
     Type = BlockData.Blocks.Wooden_Pressure_Plate;
     IsAir = true;
     LootTable.Add(new ItemStack((short)Type, 1));
     Opacity = 0x0;
     BlockBoundsOffset = new BoundingBox(0.0625, 0, 0.0625, 0.9375, 0.0625, 0.9375);
 }
コード例 #6
0
ファイル: BlockDetectorRail.cs プロジェクト: Nirad/c-raft
 public BlockDetectorRail()
 {
     Name = "DetectorRail";
     Type = BlockData.Blocks.DetectorRail;
     IsAir = true;
     Opacity = 0x0;
     LootTable.Add(new ItemStack((short)Type, 1));
     BlockBoundsOffset = new BoundingBox(0, 0, 0, 1, 0.125, 1);
 }
コード例 #7
0
ファイル: BlockSnow.cs プロジェクト: keneo/c-raft
 public BlockSnow()
 {
     Name = "Snow";
     Type = BlockData.Blocks.Snow;
     IsAir = true;
     Opacity = 0x0;
     IsSolid = true;
     BlockBoundsOffset = new BoundingBox(0, 0, 0, 1, 0.125, 1);
 }
コード例 #8
0
ファイル: BlockCactus.cs プロジェクト: Nirad/c-raft
 public BlockCactus()
 {
     Name = "Cactus";
     Type = BlockData.Blocks.Cactus;
     IsSolid = true;
     Opacity = 0x0;
     LootTable.Add(new ItemStack((short)Type, 1));
     BlockBoundsOffset = new BoundingBox(0.0625, 0, 0.0625, 0.9375, 0.9375, 0.9375);
 }
コード例 #9
0
ファイル: BlockSoil.cs プロジェクト: Nirad/c-raft
 public BlockSoil()
 {
     Name = "Soil";
     Type = BlockData.Blocks.Soil;
     IsSolid = true;
     IsFertile = true;
     IsPlowed = true;
     LootTable.Add(new ItemStack((short)BlockData.Blocks.Dirt, 1));
     BlockBoundsOffset = new BoundingBox(0, 0, 0, 1, 0.9375, 1);
 }
コード例 #10
0
ファイル: BlockBed.cs プロジェクト: TheaP/c-raft
 public BlockBed()
 {
     Name = "Bed";
     Type = BlockData.Blocks.Bed;
     BurnEfficiency = 300;
     var item = ItemHelper.GetInstance((short)BlockData.Items.Bed);
     item.Count = 1;
     LootTable.Add(item);
     BlockBoundsOffset = new BoundingBox(0, 0, 0, 1, 0.5625, 1);
 }
コード例 #11
0
ファイル: BlockDeadBush.cs プロジェクト: TheaP/c-raft
 public BlockDeadBush()
 {
     Name = "DeadBush";
     Type = BlockData.Blocks.DeadBush;
     IsSingleHit = true;
     IsAir = true;
     IsSolid = true;
     Opacity = 0x0;
     BlockBoundsOffset = new BoundingBox(0.1, 0, 0.1, 0.9, 0.8, 0.9);
 }
コード例 #12
0
ファイル: BlockSapling.cs プロジェクト: TheaP/c-raft
 public BlockSapling()
 {
     Name = "Sapling";
     Type = BlockData.Blocks.Sapling;
     IsAir = true;
     IsSingleHit = true;
     BurnEfficiency = 100;
     Opacity = 0x0;
     BlockBoundsOffset = new BoundingBox(0.1, 0, 0.1, 0.9, 0.8, 0.9);
 }
コード例 #13
0
ファイル: BlockRedstoneWire.cs プロジェクト: Nirad/c-raft
 public BlockRedstoneWire()
 {
     Name = "RedstoneWire";
     Type = BlockData.Blocks.Redstone_Wire;
     IsAir = true;
     IsSingleHit = true;
     LootTable.Add(new ItemStack((short)BlockData.Items.Redstone, 1));
     Opacity = 0x0;
     BlockBoundsOffset = new BoundingBox(0, 0, 0, 1, 0.0625, 1);
 }
コード例 #14
0
ファイル: BlockSlab.cs プロジェクト: TheaP/c-raft
 public BlockSlab()
 {
     Name = "Slab";
     Type = BlockData.Blocks.Slab;
     IsSolid = true;
     var item = ItemHelper.GetInstance(Type);
     item.Count = 1;
     LootTable.Add(item);
     BlockBoundsOffset = new BoundingBox(0, 0, 0, 1, 0.5, 1);
 }
コード例 #15
0
ファイル: BlockYellowFlower.cs プロジェクト: Nirad/c-raft
 public BlockYellowFlower()
 {
     Name = "YellowFlower";
     Type = BlockData.Blocks.Yellow_Flower;
     IsAir = true;
     IsSingleHit = true;
     LootTable.Add(new ItemStack((short)Type, 1));
     Opacity = 0x0;
     BlockBoundsOffset = new BoundingBox(0.3, 0, 0.3, 0.7, 0.6, 0.7);
 }
コード例 #16
0
ファイル: BlockTallGrass.cs プロジェクト: keneo/c-raft
 public BlockTallGrass()
 {
     Name = "TallGrass";
     Type = BlockData.Blocks.TallGrass;
     IsSingleHit = true;
     IsAir = true;
     IsSolid = true;
     Opacity = 0x0;
     BlockBoundsOffset = new BoundingBox(0.1, 0, 0.1, 0.9, 0.8, 0.9);
 }
コード例 #17
0
ファイル: BlockTracks.cs プロジェクト: TheaP/c-raft
 public BlockTracks()
 {
     Name = "Tracks";
     Type = BlockData.Blocks.Tracks;
     IsAir = true;
     var item = ItemHelper.GetInstance(Type);
     item.Count = 1;
     LootTable.Add(item);
     Opacity = 0x0;
     BlockBoundsOffset = new BoundingBox(0, 0, 0, 1, 0.125, 1);
 }
コード例 #18
0
 public BlockWoodenPressurePlate()
 {
     Name = "WoodenPressurePlate";
     Type = BlockData.Blocks.Wooden_Pressure_Plate;
     IsAir = true;
     var item = ItemHelper.GetInstance(Type);
     item.Count = 1;
     LootTable.Add(item);
     Opacity = 0x0;
     BlockBoundsOffset = new BoundingBox(0.0625, 0, 0.0625, 0.9375, 0.0625, 0.9375);
 }
コード例 #19
0
ファイル: BlockRedstoneRepeater.cs プロジェクト: TheaP/c-raft
 public BlockRedstoneRepeater()
 {
     Name = "RedstoneRepeater";
     Type = BlockData.Blocks.Redstone_Repeater;
     Opacity = 0x0;
     IsSolid = true;
     var item = ItemHelper.GetInstance(BlockData.Items.Redstone_Repeater);
     item.Count = 1;
     LootTable.Add(item);
     BlockBoundsOffset = new BoundingBox(0, 0, 0, 1, 0.125, 1);
 }
コード例 #20
0
ファイル: BlockPoweredRail.cs プロジェクト: TheaP/c-raft
 public BlockPoweredRail()
 {
     Name = "PoweredRail";
     Type = BlockData.Blocks.PoweredRail;
     IsAir = true;
     Opacity = 0x0;
     var item = ItemHelper.GetInstance(Type);
     item.Count = 1;
     LootTable.Add(item);
     BlockBoundsOffset = new BoundingBox(0, 0, 0, 1, 0.125, 1);
 }
コード例 #21
0
ファイル: BlockCactus.cs プロジェクト: TheaP/c-raft
 public BlockCactus()
 {
     Name = "Cactus";
     Type = BlockData.Blocks.Cactus;
     IsSolid = true;
     Opacity = 0x0;
     var item = ItemHelper.GetInstance((short)Type);
     item.Count = 1;
     LootTable.Add(item);
     BlockBoundsOffset = new BoundingBox(0.0625, 0, 0.0625, 0.9375, 0.9375, 0.9375);
 }
コード例 #22
0
ファイル: BlockRedRose.cs プロジェクト: TheaP/c-raft
 public BlockRedRose()
 {
     Name = "RedRose";
     Type = BlockData.Blocks.Red_Rose;
     IsAir = true;
     IsSingleHit = true;
     var item = ItemHelper.GetInstance(Type);
     item.Count = 1;
     LootTable.Add(item);
     Opacity = 0x0;
     BlockBoundsOffset = new BoundingBox(0.3, 0, 0.3, 0.7, 0.6, 0.7);
 }
コード例 #23
0
ファイル: BlockYellowFlower.cs プロジェクト: TheaP/c-raft
 public BlockYellowFlower()
 {
     Name = "YellowFlower";
     Type = BlockData.Blocks.Yellow_Flower;
     IsAir = true;
     IsSingleHit = true;
     var item = ItemHelper.GetInstance(Type);
     item.Count = 1;
     LootTable.Add(item);
     Opacity = 0x0;
     BlockBoundsOffset = new BoundingBox(0.3, 0, 0.3, 0.7, 0.6, 0.7);
 }
コード例 #24
0
ファイル: BlockRedstoneWire.cs プロジェクト: TheaP/c-raft
 public BlockRedstoneWire()
 {
     Name = "RedstoneWire";
     Type = BlockData.Blocks.Redstone_Wire;
     IsAir = true;
     IsSingleHit = true;
     var item = ItemHelper.GetInstance(BlockData.Items.Redstone);
     item.Count = 1;
     LootTable.Add(item);
     Opacity = 0x0;
     BlockBoundsOffset = new BoundingBox(0, 0, 0, 1, 0.0625, 1);
 }
コード例 #25
0
ファイル: BlockSoil.cs プロジェクト: TheaP/c-raft
 public BlockSoil()
 {
     Name = "Soil";
     Type = BlockData.Blocks.Soil;
     IsSolid = true;
     IsFertile = true;
     IsPlowed = true;
     var item = ItemHelper.GetInstance(BlockData.Blocks.Soil);
     item.Count = 1;
     LootTable.Add(item);
     BlockBoundsOffset = new BoundingBox(0, 0, 0, 1, 0.9375, 1);
 }
コード例 #26
0
ファイル: BlockReed.cs プロジェクト: TheaP/c-raft
 public BlockReed()
 {
     Name = "Reed";
     Type = BlockData.Blocks.Reed;
     Opacity = 0x0;
     IsAir = true;
     IsSolid = true;
     IsSingleHit = true;
     IsWaterProof = true;
     var item = ItemHelper.GetInstance(BlockData.Items.Reeds);
     item.Count = 1;
     LootTable.Add(item);
     BlockBoundsOffset = new BoundingBox(0.125, 0, 0.125, 0.875, 1, 0.875);
 }
コード例 #27
0
ファイル: BlockBase.cs プロジェクト: keneo/c-raft
 /// <summary>
 /// Base contructor
 /// </summary>
 protected BlockBase()
 {
     Name = "BaseBlock";
     Type = BlockData.Blocks.Air;
     IsAir = false;
     IsLiquid = false;
     Opacity = 0xf;
     IsSolid = false;
     IsSingleHit = false;
     IsFertile = false;
     IsPlowed = false;
     BurnEfficiency = 0;
     LootTable = new List<ItemStack>();
     Luminance = 0;
     IsWaterProof = false;
     Slipperiness = 0.6;
     BlockBoundsOffset = new BoundingBox(0, 0, 0, 1, 1, 1);
 }
コード例 #28
0
ファイル: BoundingBox.cs プロジェクト: keneo/c-raft
 public bool Equals(BoundingBox other)
 {
     return other._minimum.Equals(_minimum) && other._maximum.Equals(_maximum);
 }
コード例 #29
0
ファイル: BoundingBox.cs プロジェクト: keneo/c-raft
 /// <summary>
 /// Determines if this intersects with <paramref name="boundingBox"/>.
 /// </summary>
 /// <returns>
 /// If true the bounding boxes intersect
 /// </returns>
 /// <param name='boundingBox'>
 /// The bounding box to check for an intersection with
 /// </param>
 public bool IntersectsWith(BoundingBox boundingBox)
 {
     return boundingBox.Maximum.X > Minimum.X && boundingBox.Minimum.X < Maximum.X &&
            boundingBox.Maximum.Y > Minimum.Y && boundingBox.Minimum.Y < Maximum.Y &&
            boundingBox.Maximum.Z > Minimum.Z && boundingBox.Minimum.Z < Maximum.Z;
 }
コード例 #30
0
ファイル: BoundingBox.cs プロジェクト: keneo/c-raft
        /// <summary>
        /// Offsets the BoundingBox with motion, with clipping based on potential collisions.
        /// </summary>
        /// <returns>
        /// The BoundingBox in the new location after clipping, and set motion to the actual offset used after clipping is applied.
        /// </returns>
        /// <param name='motion'>
        /// Motion to be applied. The value will be changed to reflect the actual offset used after clipping is applied.
        /// </param>
        /// <param name='potentialCollisions'>
        /// Potential collisions.
        /// </param>
        public BoundingBox OffsetWithClipping(ref Vector3 motion, BoundingBox[] potentialCollisions)
        {
            if (potentialCollisions == null || potentialCollisions.Length == 0)
                return this + motion;

            BoundingBox offsetBB = this;

            // If there is Y movement, calculate new Y offset for collisions
            // Y is calculated first to adjust for jumping height/falling before applying restrictions on X and Z
            if (System.Math.Abs(motion.Y) >= double.Epsilon)
            {
                foreach (var collision in potentialCollisions)
                {
                    // If the collision is on the same X or Z axis, then adjust the Y movement
                    if (collision.IsVectorWithinXZ(offsetBB.Minimum) || collision.IsVectorWithinXZ(offsetBB.Maximum))
                    {
                        if (motion.Y > 0.0d && offsetBB.Maximum.Y <= collision.Minimum.Y)
                        {
                            motion.Y = System.Math.Min(motion.Y, collision.Minimum.Y - offsetBB.Maximum.Y);
                        }
                        else if (motion.Y < 0.0d && offsetBB.Minimum.Y >= collision.Maximum.Y)
                        {
                            motion.Y = System.Math.Max(motion.Y, collision.Maximum.Y - offsetBB.Minimum.Y);
                        }
                    }
                }

                offsetBB = offsetBB + new Vector3(0, motion.Y, 0);
            }

            // If there is an X movement, calculate new X offset for collisions
            if (System.Math.Abs(motion.X) >= double.Epsilon)
            {
                foreach (var collision in potentialCollisions)
                {
                    // If the collision is on the same Y or Z axis, then adjust the X movement
                    if (collision.IsVectorWithinYZ(offsetBB.Minimum) || collision.IsVectorWithinYZ(offsetBB.Maximum))
                    {
                        if (motion.X > 0.0d && offsetBB.Maximum.X <= collision.Minimum.X)
                        {
                            motion.X = System.Math.Min(motion.X, collision.Minimum.X - offsetBB.Maximum.X);
                        }
                        else if (motion.X < 0.0d && offsetBB.Minimum.X >= collision.Maximum.X)
                        {
                            motion.X = System.Math.Max(motion.X, collision.Maximum.X - offsetBB.Minimum.X);
                        }
                    }
                }

                offsetBB = offsetBB + new Vector3(motion.X, 0, 0);
            }

            // If there is any Z movement, calculate new Z offset based on any collisions
            if (System.Math.Abs(motion.Z) >= double.Epsilon)
            {
                foreach (var collision in potentialCollisions)
                {
                    // If the collision is on the same Y or Z axis, then adjust the X movement
                    if (collision.IsVectorWithinXY(offsetBB.Minimum) || collision.IsVectorWithinXY(offsetBB.Maximum))
                    {
                        if (motion.Z > 0.0d && offsetBB.Maximum.Z <= collision.Minimum.Z)
                        {
                            motion.Z = System.Math.Min(motion.Z, collision.Minimum.Z - offsetBB.Maximum.Z);
                        }
                        else if (motion.Z < 0.0d && offsetBB.Minimum.Z >= collision.Maximum.Z)
                        {
                            motion.Z = System.Math.Max(motion.Z, collision.Maximum.Z - offsetBB.Minimum.Z);
                        }
                    }
                }

                offsetBB = offsetBB + new Vector3(motion.X, 0, 0);
            }

            return offsetBB;
        }