<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Chraft.Interfaces;
using Chraft.Utils;

namespace Chraft.World.Blocks.Physics
{
    public class FallingSand : BlockBasePhysics
    {
        protected byte BlockId;

        public FallingSand(WorldManager world, Location pos) : base(world, pos)
        {
            Type = Net.Packets.AddObjectVehiclePacket.ObjectType.FallingSand;
            BlockId = (byte) BlockData.Blocks.Sand;
            Velocity = new Vector3(0, -0.4D, 0);
        }

        public override void Simulate()
        {
            int x = MathHelper.floor_double(Position.X);
            int y = MathHelper.floor_double(Position.Y);
            int z = MathHelper.floor_double(Position.Z);
            byte blockId = World.GetBlockId(x, y, z);
            if (blockId != (byte)BlockData.Blocks.Air)
            {
                Stop();
                return;
            }

            if (Position.Y <= 1)
            {
                Stop();
                return;
            }

            Position.Vector += Velocity;
        }

        protected override void OnStop()
        {
            UniversalCoords currentBlockCoords = UniversalCoords.FromWorld(MathHelper.floor_double(Position.X),
                                                                           MathHelper.floor_double(Position.Y),
                                                                           MathHelper.floor_double(Position.Z));
            byte blockId = World.GetBlockId(currentBlockCoords);
            if (BlockHelper.Instance(blockId).IsAir)
            {
                World.Server.DropItem(World, currentBlockCoords, new ItemStack(BlockId, 1));
            }
            else
            {
                UniversalCoords aboveBlockCoords = UniversalCoords.FromWorld(currentBlockCoords.WorldX,
                                                                             currentBlockCoords.WorldY + 1,
                                                                             currentBlockCoords.WorldZ);
                StructBlock aboveBlock = new StructBlock(aboveBlockCoords, BlockId, 0, World);
                BlockHelper.Instance(BlockId).Spawn(aboveBlock);
            }
            base.OnStop();
        }
    }
}<commit_msg>* Removed duplicate MathHelper call<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Chraft.Interfaces;
using Chraft.Utils;

namespace Chraft.World.Blocks.Physics
{
    public class FallingSand : BlockBasePhysics
    {
        protected byte BlockId;

        public FallingSand(WorldManager world, Location pos) : base(world, pos)
        {
            Type = Net.Packets.AddObjectVehiclePacket.ObjectType.FallingSand;
            BlockId = (byte) BlockData.Blocks.Sand;
            Velocity = new Vector3(0, -0.4D, 0);
        }

        public override void Simulate()
        {
            int x = MathHelper.floor_double(Position.X);
            int y = MathHelper.floor_double(Position.Y);
            int z = MathHelper.floor_double(Position.Z);
            byte blockId = World.GetBlockId(x, y, z);
            if (blockId != (byte)BlockData.Blocks.Air)
            {
                Stop();
                return;
            }

            if (Position.Y <= 1)
            {
                Stop();
                return;
            }

            Position.Vector += Velocity;
        }

        protected override void OnStop()
        {
            UniversalCoords currentBlockCoords = UniversalCoords.FromWorld(Position.X, Position.Y, Position.Z);
            byte blockId = World.GetBlockId(currentBlockCoords);
            if (BlockHelper.Instance(blockId).IsAir)
            {
                World.Server.DropItem(World, currentBlockCoords, new ItemStack(BlockId, 1));
            }
            else
            {
                UniversalCoords aboveBlockCoords = UniversalCoords.FromWorld(currentBlockCoords.WorldX,
                                                                             currentBlockCoords.WorldY + 1,
                                                                             currentBlockCoords.WorldZ);
                StructBlock aboveBlock = new StructBlock(aboveBlockCoords, BlockId, 0, World);
                BlockHelper.Instance(BlockId).Spawn(aboveBlock);
            }
            base.OnStop();
        }
    }
}
{'fraction_non_alphanumeric': 0.08305274971941638, 'fraction_numerical': 0.00404040404040404, 'mean_word_length': 1.4323144104803494, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2638326', 'n_tokens_mistral': 1120, 'n_tokens_neox': 1076, 'n_words': 210}