public static void PlayerPlacingPhysics( object sender, PlayerPlacingBlockEventArgs e )
{
World world = e.Player.World;
if ( e.Result != CanPlaceResult.Allowed ) {
return;
}
if ( e.NewBlock == Block.Gold ) {
if ( e.Context == BlockChangeContext.Manual ) {
if ( e.Player.fireworkMode && world.fireworkPhysics ) {
if ( world.FireworkCount > 10 ) {
e.Result = CanPlaceResult.Revert;
e.Player.Message( "&WThere are too many active fireworks on this world" );
return;
} else {
world.FireworkCount++;
world.AddPhysicsTask( new Firework( world, e.Coords ), 300 );
}
}
}
}
if ( e.NewBlock == Block.TNT ) {
if ( world.tntPhysics ) {
if ( e.Context == BlockChangeContext.Manual ) {
lock ( world.SyncRoot ) {
world.AddPhysicsTask( new TNTTask( world, e.Coords, e.Player, false, true ), 3000 );
return;
}
}
}
}
if ( e.NewBlock == Block.Sand || e.NewBlock == Block.Gravel ) {
if ( e.Context == BlockChangeContext.Manual ) {
if ( world.sandPhysics ) {
lock ( world.SyncRoot ) {
world.AddPhysicsTask( new SandTask( world, e.Coords, e.NewBlock ), 150 );
return;
}
}
}
}
if ( Physics.CanFloat( e.NewBlock ) ) {
if ( world.waterPhysics ) {
if ( e.Context == BlockChangeContext.Manual ) {
world.AddPhysicsTask( new BlockFloat( world, e.Coords, e.NewBlock ), 200 );
return;
}
}
}
if ( !Physics.CanFloat( e.NewBlock )
&& e.NewBlock != Block.Air
&& e.NewBlock != Block.Water
&& e.NewBlock != Block.Lava
&& e.NewBlock != Block.BrownMushroom
&& e.NewBlock != Block.RedFlower
&& e.NewBlock != Block.RedMushroom
&& e.NewBlock != Block.YellowFlower
&& e.NewBlock != Block.Plant ) {
if ( e.Context == BlockChangeContext.Manual ) {
if ( world.waterPhysics ) {
world.AddPhysicsTask( new BlockSink( world, e.Coords, e.NewBlock ), 200 );
return;
}
}
}
}